--- /dev/null
+/home/build/tmp/build/external/dist/lib/wx/config/gtk2-unicode-static-3.0
\ No newline at end of file
--- /dev/null
+wxrc-3.0
\ No newline at end of file
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/aboutdlg.h
+// Purpose: declaration of wxAboutDialog class
+// Author: Vadim Zeitlin
+// Created: 2006-10-07
+// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_ABOUTDLG_H_
+#define _WX_ABOUTDLG_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_ABOUTDLG
+
+#include "wx/app.h"
+#include "wx/icon.h"
+
+// ----------------------------------------------------------------------------
+// wxAboutDialogInfo: information shown by the standard "About" dialog
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxAboutDialogInfo
+{
+public:
+ // all fields are initially uninitialized
+ wxAboutDialogInfo() { }
+
+ // accessors for various simply fields
+ // -----------------------------------
+
+ // name of the program, if not used defaults to wxApp::GetAppDisplayName()
+ void SetName(const wxString& name) { m_name = name; }
+ wxString GetName() const
+ { return m_name.empty() ? wxTheApp->GetAppDisplayName() : m_name; }
+
+ // version should contain program version without "version" word (e.g.,
+ // "1.2" or "RC2") while longVersion may contain the full version including
+ // "version" word (e.g., "Version 1.2" or "Release Candidate 2")
+ //
+ // if longVersion is empty, it is automatically constructed from version
+ //
+ // generic and gtk native: use short version only, as a suffix to the
+ // program name msw and osx native: use long version
+ void SetVersion(const wxString& version,
+ const wxString& longVersion = wxString());
+
+ bool HasVersion() const { return !m_version.empty(); }
+ const wxString& GetVersion() const { return m_version; }
+ const wxString& GetLongVersion() const { return m_longVersion; }
+
+ // brief, but possibly multiline, description of the program
+ void SetDescription(const wxString& desc) { m_description = desc; }
+ bool HasDescription() const { return !m_description.empty(); }
+ const wxString& GetDescription() const { return m_description; }
+
+ // short string containing the program copyright information
+ void SetCopyright(const wxString& copyright) { m_copyright = copyright; }
+ bool HasCopyright() const { return !m_copyright.empty(); }
+ const wxString& GetCopyright() const { return m_copyright; }
+
+ // long, multiline string containing the text of the program licence
+ void SetLicence(const wxString& licence) { m_licence = licence; }
+ void SetLicense(const wxString& licence) { m_licence = licence; }
+ bool HasLicence() const { return !m_licence.empty(); }
+ const wxString& GetLicence() const { return m_licence; }
+
+ // icon to be shown in the dialog, defaults to the main frame icon
+ void SetIcon(const wxIcon& icon) { m_icon = icon; }
+ bool HasIcon() const { return m_icon.IsOk(); }
+ wxIcon GetIcon() const;
+
+ // web site for the program and its description (defaults to URL itself if
+ // empty)
+ void SetWebSite(const wxString& url, const wxString& desc = wxEmptyString)
+ {
+ m_url = url;
+ m_urlDesc = desc.empty() ? url : desc;
+ }
+
+ bool HasWebSite() const { return !m_url.empty(); }
+
+ const wxString& GetWebSiteURL() const { return m_url; }
+ const wxString& GetWebSiteDescription() const { return m_urlDesc; }
+
+ // accessors for the arrays
+ // ------------------------
+
+ // the list of developers of the program
+ void SetDevelopers(const wxArrayString& developers)
+ { m_developers = developers; }
+ void AddDeveloper(const wxString& developer)
+ { m_developers.push_back(developer); }
+
+ bool HasDevelopers() const { return !m_developers.empty(); }
+ const wxArrayString& GetDevelopers() const { return m_developers; }
+
+ // the list of documentation writers
+ void SetDocWriters(const wxArrayString& docwriters)
+ { m_docwriters = docwriters; }
+ void AddDocWriter(const wxString& docwriter)
+ { m_docwriters.push_back(docwriter); }
+
+ bool HasDocWriters() const { return !m_docwriters.empty(); }
+ const wxArrayString& GetDocWriters() const { return m_docwriters; }
+
+ // the list of artists for the program art
+ void SetArtists(const wxArrayString& artists)
+ { m_artists = artists; }
+ void AddArtist(const wxString& artist)
+ { m_artists.push_back(artist); }
+
+ bool HasArtists() const { return !m_artists.empty(); }
+ const wxArrayString& GetArtists() const { return m_artists; }
+
+ // the list of translators
+ void SetTranslators(const wxArrayString& translators)
+ { m_translators = translators; }
+ void AddTranslator(const wxString& translator)
+ { m_translators.push_back(translator); }
+
+ bool HasTranslators() const { return !m_translators.empty(); }
+ const wxArrayString& GetTranslators() const { return m_translators; }
+
+
+ // implementation only
+ // -------------------
+
+ // "simple" about dialog shows only textual information (with possibly
+ // default icon but without hyperlink nor any long texts such as the
+ // licence text)
+ bool IsSimple() const
+ { return !HasWebSite() && !HasIcon() && !HasLicence(); }
+
+ // get the description and credits (i.e. all of developers, doc writers,
+ // artists and translators) as a one long multiline string
+ wxString GetDescriptionAndCredits() const;
+
+ // returns the copyright with the (C) string substituted by the Unicode
+ // character U+00A9
+ wxString GetCopyrightToDisplay() const;
+
+private:
+ wxString m_name,
+ m_version,
+ m_longVersion,
+ m_description,
+ m_copyright,
+ m_licence;
+
+ wxIcon m_icon;
+
+ wxString m_url,
+ m_urlDesc;
+
+ wxArrayString m_developers,
+ m_docwriters,
+ m_artists,
+ m_translators;
+};
+
+// functions to show the about dialog box
+WXDLLIMPEXP_ADV void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
+
+#endif // wxUSE_ABOUTDLG
+
+#endif // _WX_ABOUTDLG_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/accel.h
+// Purpose: wxAcceleratorEntry and wxAcceleratorTable classes
+// Author: Julian Smart, Robert Roebling, Vadim Zeitlin
+// Modified by:
+// Created: 31.05.01 (extracted from other files)
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_ACCEL_H_BASE_
+#define _WX_ACCEL_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_ACCEL
+
+#include "wx/object.h"
+
+class WXDLLIMPEXP_FWD_CORE wxAcceleratorTable;
+class WXDLLIMPEXP_FWD_CORE wxMenuItem;
+class WXDLLIMPEXP_FWD_CORE wxKeyEvent;
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// wxAcceleratorEntry flags
+enum wxAcceleratorEntryFlags
+{
+ wxACCEL_NORMAL = 0x0000, // no modifiers
+ wxACCEL_ALT = 0x0001, // hold Alt key down
+ wxACCEL_CTRL = 0x0002, // hold Ctrl key down
+ wxACCEL_SHIFT = 0x0004, // hold Shift key down
+#if defined(__WXMAC__) || defined(__WXCOCOA__)
+ wxACCEL_RAW_CTRL= 0x0008, //
+#else
+ wxACCEL_RAW_CTRL= wxACCEL_CTRL,
+#endif
+ wxACCEL_CMD = wxACCEL_CTRL
+};
+
+// ----------------------------------------------------------------------------
+// an entry in wxAcceleratorTable corresponds to one accelerator
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxAcceleratorEntry
+{
+public:
+ wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0,
+ wxMenuItem *item = NULL)
+ : m_flags(flags)
+ , m_keyCode(keyCode)
+ , m_command(cmd)
+ , m_item(item)
+ { }
+
+ wxAcceleratorEntry(const wxAcceleratorEntry& entry)
+ : m_flags(entry.m_flags)
+ , m_keyCode(entry.m_keyCode)
+ , m_command(entry.m_command)
+ , m_item(entry.m_item)
+ { }
+
+ // create accelerator corresponding to the specified string, return NULL if
+ // string couldn't be parsed or a pointer to be deleted by the caller
+ static wxAcceleratorEntry *Create(const wxString& str);
+
+ wxAcceleratorEntry& operator=(const wxAcceleratorEntry& entry)
+ {
+ if (&entry != this)
+ Set(entry.m_flags, entry.m_keyCode, entry.m_command, entry.m_item);
+ return *this;
+ }
+
+ void Set(int flags, int keyCode, int cmd, wxMenuItem *item = NULL)
+ {
+ m_flags = flags;
+ m_keyCode = keyCode;
+ m_command = cmd;
+ m_item = item;
+ }
+
+ void SetMenuItem(wxMenuItem *item) { m_item = item; }
+
+ int GetFlags() const { return m_flags; }
+ int GetKeyCode() const { return m_keyCode; }
+ int GetCommand() const { return m_command; }
+
+ wxMenuItem *GetMenuItem() const { return m_item; }
+
+ bool operator==(const wxAcceleratorEntry& entry) const
+ {
+ return m_flags == entry.m_flags &&
+ m_keyCode == entry.m_keyCode &&
+ m_command == entry.m_command &&
+ m_item == entry.m_item;
+ }
+
+ bool operator!=(const wxAcceleratorEntry& entry) const
+ { return !(*this == entry); }
+
+#if defined(__WXMOTIF__)
+ // Implementation use only
+ bool MatchesEvent(const wxKeyEvent& event) const;
+#endif
+
+ bool IsOk() const
+ {
+ return m_keyCode != 0;
+ }
+
+
+ // string <-> wxAcceleratorEntry conversion
+ // ----------------------------------------
+
+ // returns a wxString for the this accelerator.
+ // this function formats it using the <flags>-<keycode> format
+ // where <flags> maybe a hyphen-separated list of "shift|alt|ctrl"
+ wxString ToString() const { return AsPossiblyLocalizedString(true); }
+
+ // same as above but without translating, useful if the string is meant to
+ // be stored in a file or otherwise stored, instead of being shown to the
+ // user
+ wxString ToRawString() const { return AsPossiblyLocalizedString(false); }
+
+ // returns true if the given string correctly initialized this object
+ // (i.e. if IsOk() returns true after this call)
+ bool FromString(const wxString& str);
+
+
+private:
+ wxString AsPossiblyLocalizedString(bool localized) const;
+
+ // common part of Create() and FromString()
+ static bool ParseAccel(const wxString& str, int *flags, int *keycode);
+
+
+ int m_flags; // combination of wxACCEL_XXX constants
+ int m_keyCode; // ASCII or virtual keycode
+ int m_command; // Command id to generate
+
+ // the menu item this entry corresponds to, may be NULL
+ wxMenuItem *m_item;
+
+ // for compatibility with old code, use accessors now!
+ friend class WXDLLIMPEXP_FWD_CORE wxMenu;
+};
+
+// ----------------------------------------------------------------------------
+// include wxAcceleratorTable class declaration, it is only used by the library
+// and so doesn't have any published user visible interface
+// ----------------------------------------------------------------------------
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/generic/accel.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/accel.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/accel.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/accel.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/accel.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/accel.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/generic/accel.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/accel.h"
+#endif
+
+extern WXDLLIMPEXP_DATA_CORE(wxAcceleratorTable) wxNullAcceleratorTable;
+
+#endif // wxUSE_ACCEL
+
+#endif
+ // _WX_ACCEL_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/access.h
+// Purpose: Accessibility classes
+// Author: Julian Smart
+// Modified by:
+// Created: 2003-02-12
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_ACCESSBASE_H_
+#define _WX_ACCESSBASE_H_
+
+// ----------------------------------------------------------------------------
+// headers we have to include here
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_ACCESSIBILITY
+
+#include "wx/variant.h"
+
+typedef enum
+{
+ wxACC_FAIL,
+ wxACC_FALSE,
+ wxACC_OK,
+ wxACC_NOT_IMPLEMENTED,
+ wxACC_NOT_SUPPORTED
+} wxAccStatus;
+
+// Child ids are integer identifiers from 1 up.
+// So zero represents 'this' object.
+#define wxACC_SELF 0
+
+// Navigation constants
+
+typedef enum
+{
+ wxNAVDIR_DOWN,
+ wxNAVDIR_FIRSTCHILD,
+ wxNAVDIR_LASTCHILD,
+ wxNAVDIR_LEFT,
+ wxNAVDIR_NEXT,
+ wxNAVDIR_PREVIOUS,
+ wxNAVDIR_RIGHT,
+ wxNAVDIR_UP
+} wxNavDir;
+
+// Role constants
+
+typedef enum {
+ wxROLE_NONE,
+ wxROLE_SYSTEM_ALERT,
+ wxROLE_SYSTEM_ANIMATION,
+ wxROLE_SYSTEM_APPLICATION,
+ wxROLE_SYSTEM_BORDER,
+ wxROLE_SYSTEM_BUTTONDROPDOWN,
+ wxROLE_SYSTEM_BUTTONDROPDOWNGRID,
+ wxROLE_SYSTEM_BUTTONMENU,
+ wxROLE_SYSTEM_CARET,
+ wxROLE_SYSTEM_CELL,
+ wxROLE_SYSTEM_CHARACTER,
+ wxROLE_SYSTEM_CHART,
+ wxROLE_SYSTEM_CHECKBUTTON,
+ wxROLE_SYSTEM_CLIENT,
+ wxROLE_SYSTEM_CLOCK,
+ wxROLE_SYSTEM_COLUMN,
+ wxROLE_SYSTEM_COLUMNHEADER,
+ wxROLE_SYSTEM_COMBOBOX,
+ wxROLE_SYSTEM_CURSOR,
+ wxROLE_SYSTEM_DIAGRAM,
+ wxROLE_SYSTEM_DIAL,
+ wxROLE_SYSTEM_DIALOG,
+ wxROLE_SYSTEM_DOCUMENT,
+ wxROLE_SYSTEM_DROPLIST,
+ wxROLE_SYSTEM_EQUATION,
+ wxROLE_SYSTEM_GRAPHIC,
+ wxROLE_SYSTEM_GRIP,
+ wxROLE_SYSTEM_GROUPING,
+ wxROLE_SYSTEM_HELPBALLOON,
+ wxROLE_SYSTEM_HOTKEYFIELD,
+ wxROLE_SYSTEM_INDICATOR,
+ wxROLE_SYSTEM_LINK,
+ wxROLE_SYSTEM_LIST,
+ wxROLE_SYSTEM_LISTITEM,
+ wxROLE_SYSTEM_MENUBAR,
+ wxROLE_SYSTEM_MENUITEM,
+ wxROLE_SYSTEM_MENUPOPUP,
+ wxROLE_SYSTEM_OUTLINE,
+ wxROLE_SYSTEM_OUTLINEITEM,
+ wxROLE_SYSTEM_PAGETAB,
+ wxROLE_SYSTEM_PAGETABLIST,
+ wxROLE_SYSTEM_PANE,
+ wxROLE_SYSTEM_PROGRESSBAR,
+ wxROLE_SYSTEM_PROPERTYPAGE,
+ wxROLE_SYSTEM_PUSHBUTTON,
+ wxROLE_SYSTEM_RADIOBUTTON,
+ wxROLE_SYSTEM_ROW,
+ wxROLE_SYSTEM_ROWHEADER,
+ wxROLE_SYSTEM_SCROLLBAR,
+ wxROLE_SYSTEM_SEPARATOR,
+ wxROLE_SYSTEM_SLIDER,
+ wxROLE_SYSTEM_SOUND,
+ wxROLE_SYSTEM_SPINBUTTON,
+ wxROLE_SYSTEM_STATICTEXT,
+ wxROLE_SYSTEM_STATUSBAR,
+ wxROLE_SYSTEM_TABLE,
+ wxROLE_SYSTEM_TEXT,
+ wxROLE_SYSTEM_TITLEBAR,
+ wxROLE_SYSTEM_TOOLBAR,
+ wxROLE_SYSTEM_TOOLTIP,
+ wxROLE_SYSTEM_WHITESPACE,
+ wxROLE_SYSTEM_WINDOW
+} wxAccRole;
+
+// Object types
+
+typedef enum {
+ wxOBJID_WINDOW = 0x00000000,
+ wxOBJID_SYSMENU = 0xFFFFFFFF,
+ wxOBJID_TITLEBAR = 0xFFFFFFFE,
+ wxOBJID_MENU = 0xFFFFFFFD,
+ wxOBJID_CLIENT = 0xFFFFFFFC,
+ wxOBJID_VSCROLL = 0xFFFFFFFB,
+ wxOBJID_HSCROLL = 0xFFFFFFFA,
+ wxOBJID_SIZEGRIP = 0xFFFFFFF9,
+ wxOBJID_CARET = 0xFFFFFFF8,
+ wxOBJID_CURSOR = 0xFFFFFFF7,
+ wxOBJID_ALERT = 0xFFFFFFF6,
+ wxOBJID_SOUND = 0xFFFFFFF5
+} wxAccObject;
+
+// Accessible states
+
+#define wxACC_STATE_SYSTEM_ALERT_HIGH 0x00000001
+#define wxACC_STATE_SYSTEM_ALERT_MEDIUM 0x00000002
+#define wxACC_STATE_SYSTEM_ALERT_LOW 0x00000004
+#define wxACC_STATE_SYSTEM_ANIMATED 0x00000008
+#define wxACC_STATE_SYSTEM_BUSY 0x00000010
+#define wxACC_STATE_SYSTEM_CHECKED 0x00000020
+#define wxACC_STATE_SYSTEM_COLLAPSED 0x00000040
+#define wxACC_STATE_SYSTEM_DEFAULT 0x00000080
+#define wxACC_STATE_SYSTEM_EXPANDED 0x00000100
+#define wxACC_STATE_SYSTEM_EXTSELECTABLE 0x00000200
+#define wxACC_STATE_SYSTEM_FLOATING 0x00000400
+#define wxACC_STATE_SYSTEM_FOCUSABLE 0x00000800
+#define wxACC_STATE_SYSTEM_FOCUSED 0x00001000
+#define wxACC_STATE_SYSTEM_HOTTRACKED 0x00002000
+#define wxACC_STATE_SYSTEM_INVISIBLE 0x00004000
+#define wxACC_STATE_SYSTEM_MARQUEED 0x00008000
+#define wxACC_STATE_SYSTEM_MIXED 0x00010000
+#define wxACC_STATE_SYSTEM_MULTISELECTABLE 0x00020000
+#define wxACC_STATE_SYSTEM_OFFSCREEN 0x00040000
+#define wxACC_STATE_SYSTEM_PRESSED 0x00080000
+#define wxACC_STATE_SYSTEM_PROTECTED 0x00100000
+#define wxACC_STATE_SYSTEM_READONLY 0x00200000
+#define wxACC_STATE_SYSTEM_SELECTABLE 0x00400000
+#define wxACC_STATE_SYSTEM_SELECTED 0x00800000
+#define wxACC_STATE_SYSTEM_SELFVOICING 0x01000000
+#define wxACC_STATE_SYSTEM_UNAVAILABLE 0x02000000
+
+// Selection flag
+
+typedef enum
+{
+ wxACC_SEL_NONE = 0,
+ wxACC_SEL_TAKEFOCUS = 1,
+ wxACC_SEL_TAKESELECTION = 2,
+ wxACC_SEL_EXTENDSELECTION = 4,
+ wxACC_SEL_ADDSELECTION = 8,
+ wxACC_SEL_REMOVESELECTION = 16
+} wxAccSelectionFlags;
+
+// Accessibility event identifiers
+
+#define wxACC_EVENT_SYSTEM_SOUND 0x0001
+#define wxACC_EVENT_SYSTEM_ALERT 0x0002
+#define wxACC_EVENT_SYSTEM_FOREGROUND 0x0003
+#define wxACC_EVENT_SYSTEM_MENUSTART 0x0004
+#define wxACC_EVENT_SYSTEM_MENUEND 0x0005
+#define wxACC_EVENT_SYSTEM_MENUPOPUPSTART 0x0006
+#define wxACC_EVENT_SYSTEM_MENUPOPUPEND 0x0007
+#define wxACC_EVENT_SYSTEM_CAPTURESTART 0x0008
+#define wxACC_EVENT_SYSTEM_CAPTUREEND 0x0009
+#define wxACC_EVENT_SYSTEM_MOVESIZESTART 0x000A
+#define wxACC_EVENT_SYSTEM_MOVESIZEEND 0x000B
+#define wxACC_EVENT_SYSTEM_CONTEXTHELPSTART 0x000C
+#define wxACC_EVENT_SYSTEM_CONTEXTHELPEND 0x000D
+#define wxACC_EVENT_SYSTEM_DRAGDROPSTART 0x000E
+#define wxACC_EVENT_SYSTEM_DRAGDROPEND 0x000F
+#define wxACC_EVENT_SYSTEM_DIALOGSTART 0x0010
+#define wxACC_EVENT_SYSTEM_DIALOGEND 0x0011
+#define wxACC_EVENT_SYSTEM_SCROLLINGSTART 0x0012
+#define wxACC_EVENT_SYSTEM_SCROLLINGEND 0x0013
+#define wxACC_EVENT_SYSTEM_SWITCHSTART 0x0014
+#define wxACC_EVENT_SYSTEM_SWITCHEND 0x0015
+#define wxACC_EVENT_SYSTEM_MINIMIZESTART 0x0016
+#define wxACC_EVENT_SYSTEM_MINIMIZEEND 0x0017
+#define wxACC_EVENT_OBJECT_CREATE 0x8000
+#define wxACC_EVENT_OBJECT_DESTROY 0x8001
+#define wxACC_EVENT_OBJECT_SHOW 0x8002
+#define wxACC_EVENT_OBJECT_HIDE 0x8003
+#define wxACC_EVENT_OBJECT_REORDER 0x8004
+#define wxACC_EVENT_OBJECT_FOCUS 0x8005
+#define wxACC_EVENT_OBJECT_SELECTION 0x8006
+#define wxACC_EVENT_OBJECT_SELECTIONADD 0x8007
+#define wxACC_EVENT_OBJECT_SELECTIONREMOVE 0x8008
+#define wxACC_EVENT_OBJECT_SELECTIONWITHIN 0x8009
+#define wxACC_EVENT_OBJECT_STATECHANGE 0x800A
+#define wxACC_EVENT_OBJECT_LOCATIONCHANGE 0x800B
+#define wxACC_EVENT_OBJECT_NAMECHANGE 0x800C
+#define wxACC_EVENT_OBJECT_DESCRIPTIONCHANGE 0x800D
+#define wxACC_EVENT_OBJECT_VALUECHANGE 0x800E
+#define wxACC_EVENT_OBJECT_PARENTCHANGE 0x800F
+#define wxACC_EVENT_OBJECT_HELPCHANGE 0x8010
+#define wxACC_EVENT_OBJECT_DEFACTIONCHANGE 0x8011
+#define wxACC_EVENT_OBJECT_ACCELERATORCHANGE 0x8012
+
+// ----------------------------------------------------------------------------
+// wxAccessible
+// All functions return an indication of success, failure, or not implemented.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxAccessible;
+class WXDLLIMPEXP_FWD_CORE wxWindow;
+class WXDLLIMPEXP_FWD_CORE wxPoint;
+class WXDLLIMPEXP_FWD_CORE wxRect;
+class WXDLLIMPEXP_CORE wxAccessibleBase : public wxObject
+{
+ wxDECLARE_NO_COPY_CLASS(wxAccessibleBase);
+
+public:
+ wxAccessibleBase(wxWindow* win): m_window(win) {}
+ virtual ~wxAccessibleBase() {}
+
+// Overridables
+
+ // Can return either a child object, or an integer
+ // representing the child element, starting from 1.
+ // pt is in screen coordinates.
+ virtual wxAccStatus HitTest(const wxPoint& WXUNUSED(pt), int* WXUNUSED(childId), wxAccessible** WXUNUSED(childObject))
+ { return wxACC_NOT_IMPLEMENTED; }
+
+ // Returns the rectangle for this object (id = 0) or a child element (id > 0).
+ // rect is in screen coordinates.
+ virtual wxAccStatus GetLocation(wxRect& WXUNUSED(rect), int WXUNUSED(elementId))
+ { return wxACC_NOT_IMPLEMENTED; }
+
+ // Navigates from fromId to toId/toObject.
+ virtual wxAccStatus Navigate(wxNavDir WXUNUSED(navDir), int WXUNUSED(fromId),
+ int* WXUNUSED(toId), wxAccessible** WXUNUSED(toObject))
+ { return wxACC_NOT_IMPLEMENTED; }
+
+ // Gets the name of the specified object.
+ virtual wxAccStatus GetName(int WXUNUSED(childId), wxString* WXUNUSED(name))
+ { return wxACC_NOT_IMPLEMENTED; }
+
+ // Gets the number of children.
+ virtual wxAccStatus GetChildCount(int* WXUNUSED(childCount))
+ { return wxACC_NOT_IMPLEMENTED; }
+
+ // Gets the specified child (starting from 1).
+ // If *child is NULL and return value is wxACC_OK,
+ // this means that the child is a simple element and
+ // not an accessible object.
+ virtual wxAccStatus GetChild(int WXUNUSED(childId), wxAccessible** WXUNUSED(child))
+ { return wxACC_NOT_IMPLEMENTED; }
+
+ // Gets the parent, or NULL.
+ virtual wxAccStatus GetParent(wxAccessible** WXUNUSED(parent))
+ { return wxACC_NOT_IMPLEMENTED; }
+
+ // Performs the default action. childId is 0 (the action for this object)
+ // or > 0 (the action for a child).
+ // Return wxACC_NOT_SUPPORTED if there is no default action for this
+ // window (e.g. an edit control).
+ virtual wxAccStatus DoDefaultAction(int WXUNUSED(childId))
+ { return wxACC_NOT_IMPLEMENTED; }
+
+ // Gets the default action for this object (0) or > 0 (the action for a child).
+ // Return wxACC_OK even if there is no action. actionName is the action, or the empty
+ // string if there is no action.
+ // The retrieved string describes the action that is performed on an object,
+ // not what the object does as a result. For example, a toolbar button that prints
+ // a document has a default action of "Press" rather than "Prints the current document."
+ virtual wxAccStatus GetDefaultAction(int WXUNUSED(childId), wxString* WXUNUSED(actionName))
+ { return wxACC_NOT_IMPLEMENTED; }
+
+ // Returns the description for this object or a child.
+ virtual wxAccStatus GetDescription(int WXUNUSED(childId), wxString* WXUNUSED(description))
+ { return wxACC_NOT_IMPLEMENTED; }
+
+ // Returns help text for this object or a child, similar to tooltip text.
+ virtual wxAccStatus GetHelpText(int WXUNUSED(childId), wxString* WXUNUSED(helpText))
+ { return wxACC_NOT_IMPLEMENTED; }
+
+ // Returns the keyboard shortcut for this object or child.
+ // Return e.g. ALT+K
+ virtual wxAccStatus GetKeyboardShortcut(int WXUNUSED(childId), wxString* WXUNUSED(shortcut))
+ { return wxACC_NOT_IMPLEMENTED; }
+
+ // Returns a role constant.
+ virtual wxAccStatus GetRole(int WXUNUSED(childId), wxAccRole* WXUNUSED(role))
+ { return wxACC_NOT_IMPLEMENTED; }
+
+ // Returns a state constant.
+ virtual wxAccStatus GetState(int WXUNUSED(childId), long* WXUNUSED(state))
+ { return wxACC_NOT_IMPLEMENTED; }
+
+ // Returns a localized string representing the value for the object
+ // or child.
+ virtual wxAccStatus GetValue(int WXUNUSED(childId), wxString* WXUNUSED(strValue))
+ { return wxACC_NOT_IMPLEMENTED; }
+
+ // Selects the object or child.
+ virtual wxAccStatus Select(int WXUNUSED(childId), wxAccSelectionFlags WXUNUSED(selectFlags))
+ { return wxACC_NOT_IMPLEMENTED; }
+
+ // Gets the window with the keyboard focus.
+ // If childId is 0 and child is NULL, no object in
+ // this subhierarchy has the focus.
+ // If this object has the focus, child should be 'this'.
+ virtual wxAccStatus GetFocus(int* WXUNUSED(childId), wxAccessible** WXUNUSED(child))
+ { return wxACC_NOT_IMPLEMENTED; }
+
+#if wxUSE_VARIANT
+ // Gets a variant representing the selected children
+ // of this object.
+ // Acceptable values:
+ // - a null variant (IsNull() returns TRUE)
+ // - a list variant (GetType() == wxT("list"))
+ // - an integer representing the selected child element,
+ // or 0 if this object is selected (GetType() == wxT("long"))
+ // - a "void*" pointer to a wxAccessible child object
+ virtual wxAccStatus GetSelections(wxVariant* WXUNUSED(selections))
+ { return wxACC_NOT_IMPLEMENTED; }
+#endif // wxUSE_VARIANT
+
+// Accessors
+
+ // Returns the window associated with this object.
+
+ wxWindow* GetWindow() { return m_window; }
+
+ // Sets the window associated with this object.
+
+ void SetWindow(wxWindow* window) { m_window = window; }
+
+// Operations
+
+ // Each platform's implementation must define this
+ // static void NotifyEvent(int eventType, wxWindow* window, wxAccObject objectType,
+ // int objectId);
+
+private:
+
+// Data members
+
+ wxWindow* m_window;
+};
+
+
+// ----------------------------------------------------------------------------
+// now include the declaration of the real class
+// ----------------------------------------------------------------------------
+
+#if defined(__WXMSW__)
+ #include "wx/msw/ole/access.h"
+#endif
+
+#endif // wxUSE_ACCESSIBILITY
+
+#endif // _WX_ACCESSBASE_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/affinematrix2d.h
+// Purpose: wxAffineMatrix2D class.
+// Author: Based on wxTransformMatrix by Chris Breeze, Julian Smart
+// Created: 2011-04-05
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_AFFINEMATRIX2D_H_
+#define _WX_AFFINEMATRIX2D_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_GEOMETRY
+
+#include "wx/affinematrix2dbase.h"
+
+// A simple implementation of wxAffineMatrix2DBase interface done entirely in
+// wxWidgets.
+class WXDLLIMPEXP_CORE wxAffineMatrix2D : public wxAffineMatrix2DBase
+{
+public:
+ wxAffineMatrix2D() : m_11(1), m_12(0),
+ m_21(0), m_22(1),
+ m_tx(0), m_ty(0)
+ {
+ }
+
+ // Implement base class pure virtual methods.
+ virtual void Set(const wxMatrix2D& mat2D, const wxPoint2DDouble& tr);
+ virtual void Get(wxMatrix2D* mat2D, wxPoint2DDouble* tr) const;
+ virtual void Concat(const wxAffineMatrix2DBase& t);
+ virtual bool Invert();
+ virtual bool IsIdentity() const;
+ virtual bool IsEqual(const wxAffineMatrix2DBase& t) const;
+ virtual void Translate(wxDouble dx, wxDouble dy);
+ virtual void Scale(wxDouble xScale, wxDouble yScale);
+ virtual void Rotate(wxDouble cRadians);
+
+protected:
+ virtual wxPoint2DDouble DoTransformPoint(const wxPoint2DDouble& p) const;
+ virtual wxPoint2DDouble DoTransformDistance(const wxPoint2DDouble& p) const;
+
+private:
+ wxDouble m_11, m_12, m_21, m_22, m_tx, m_ty;
+};
+
+#endif // wxUSE_GEOMETRY
+
+#endif // _WX_AFFINEMATRIX2D_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/affinematrix2dbase.h
+// Purpose: Common interface for 2D transformation matrices.
+// Author: Catalin Raceanu
+// Created: 2011-04-06
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_AFFINEMATRIX2DBASE_H_
+#define _WX_AFFINEMATRIX2DBASE_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_GEOMETRY
+
+#include "wx/geometry.h"
+
+struct wxMatrix2D
+{
+ wxMatrix2D(wxDouble v11 = 1,
+ wxDouble v12 = 0,
+ wxDouble v21 = 0,
+ wxDouble v22 = 1)
+ {
+ m_11 = v11; m_12 = v12;
+ m_21 = v21; m_22 = v22;
+ }
+
+ wxDouble m_11, m_12, m_21, m_22;
+};
+
+// A 2x3 matrix representing an affine 2D transformation.
+//
+// This is an abstract base class implemented by wxAffineMatrix2D only so far,
+// but in the future we also plan to derive wxGraphicsMatrix from it (it should
+// also be documented then as currently only wxAffineMatrix2D itself is).
+class WXDLLIMPEXP_CORE wxAffineMatrix2DBase
+{
+public:
+ wxAffineMatrix2DBase() {}
+ virtual ~wxAffineMatrix2DBase() {}
+
+ // sets the matrix to the respective values
+ virtual void Set(const wxMatrix2D& mat2D, const wxPoint2DDouble& tr) = 0;
+
+ // gets the component valuess of the matrix
+ virtual void Get(wxMatrix2D* mat2D, wxPoint2DDouble* tr) const = 0;
+
+ // concatenates the matrix
+ virtual void Concat(const wxAffineMatrix2DBase& t) = 0;
+
+ // makes this the inverse matrix
+ virtual bool Invert() = 0;
+
+ // return true if this is the identity matrix
+ virtual bool IsIdentity() const = 0;
+
+ // returns true if the elements of the transformation matrix are equal ?
+ virtual bool IsEqual(const wxAffineMatrix2DBase& t) const = 0;
+ bool operator==(const wxAffineMatrix2DBase& t) const { return IsEqual(t); }
+ bool operator!=(const wxAffineMatrix2DBase& t) const { return !IsEqual(t); }
+
+
+ //
+ // transformations
+ //
+
+ // add the translation to this matrix
+ virtual void Translate(wxDouble dx, wxDouble dy) = 0;
+
+ // add the scale to this matrix
+ virtual void Scale(wxDouble xScale, wxDouble yScale) = 0;
+
+ // add the rotation to this matrix (counter clockwise, radians)
+ virtual void Rotate(wxDouble ccRadians) = 0;
+
+ // add mirroring to this matrix
+ void Mirror(int direction = wxHORIZONTAL)
+ {
+ wxDouble x = (direction & wxHORIZONTAL) ? -1 : 1;
+ wxDouble y = (direction & wxVERTICAL) ? -1 : 1;
+ Scale(x, y);
+ }
+
+
+ // applies that matrix to the point
+ wxPoint2DDouble TransformPoint(const wxPoint2DDouble& src) const
+ {
+ return DoTransformPoint(src);
+ }
+
+ void TransformPoint(wxDouble* x, wxDouble* y) const
+ {
+ wxCHECK_RET( x && y, "Can't be NULL" );
+
+ const wxPoint2DDouble dst = DoTransformPoint(wxPoint2DDouble(*x, *y));
+ *x = dst.m_x;
+ *y = dst.m_y;
+ }
+
+ // applies the matrix except for translations
+ wxPoint2DDouble TransformDistance(const wxPoint2DDouble& src) const
+ {
+ return DoTransformDistance(src);
+ }
+
+ void TransformDistance(wxDouble* dx, wxDouble* dy) const
+ {
+ wxCHECK_RET( dx && dy, "Can't be NULL" );
+
+ const wxPoint2DDouble
+ dst = DoTransformDistance(wxPoint2DDouble(*dx, *dy));
+ *dx = dst.m_x;
+ *dy = dst.m_y;
+ }
+
+protected:
+ virtual
+ wxPoint2DDouble DoTransformPoint(const wxPoint2DDouble& p) const = 0;
+ virtual
+ wxPoint2DDouble DoTransformDistance(const wxPoint2DDouble& p) const = 0;
+};
+
+#endif // wxUSE_GEOMETRY
+
+#endif // _WX_AFFINEMATRIX2DBASE_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/afterstd.h
+// Purpose: #include after STL headers
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 07/07/03
+// Copyright: (c) 2003 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+/**
+ See the comments in beforestd.h.
+ */
+
+#if defined(__WINDOWS__)
+ #include "wx/msw/winundef.h"
+#endif
+
+// undo what we did in wx/beforestd.h
+#if defined(__VISUALC__) && __VISUALC__ <= 1201
+ // MSVC 5 does not have this
+ #if _MSC_VER > 1100
+ #pragma warning(pop)
+ #else
+ // 'expression' : signed/unsigned mismatch
+ #pragma warning(default:4018)
+
+ // 'identifier' : unreferenced formal parameter
+ #pragma warning(default:4100)
+
+ // 'conversion' : conversion from 'type1' to 'type2',
+ // possible loss of data
+ #pragma warning(default:4244)
+
+ // C++ language change: to explicitly specialize class template
+ // 'identifier' use the following syntax
+ #pragma warning(default:4663)
+ #endif
+#endif
+
+// see beforestd.h for explanation
+#if defined(HAVE_VISIBILITY) && defined(HAVE_BROKEN_LIBSTDCXX_VISIBILITY)
+ #pragma GCC visibility pop
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/anidecod.h
+// Purpose: wxANIDecoder, ANI reader for wxImage and wxAnimation
+// Author: Francesco Montorsi
+// Copyright: (c) 2006 Francesco Montorsi
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_ANIDECOD_H
+#define _WX_ANIDECOD_H
+
+#include "wx/defs.h"
+
+#if wxUSE_STREAMS && (wxUSE_ICO_CUR || wxUSE_GIF)
+
+#include "wx/stream.h"
+#include "wx/image.h"
+#include "wx/animdecod.h"
+#include "wx/dynarray.h"
+
+
+class /*WXDLLIMPEXP_CORE*/ wxANIFrameInfo; // private implementation detail
+
+WX_DECLARE_EXPORTED_OBJARRAY(wxANIFrameInfo, wxANIFrameInfoArray);
+WX_DECLARE_EXPORTED_OBJARRAY(wxImage, wxImageArray);
+
+// --------------------------------------------------------------------------
+// wxANIDecoder class
+// --------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxANIDecoder : public wxAnimationDecoder
+{
+public:
+ // constructor, destructor, etc.
+ wxANIDecoder();
+ ~wxANIDecoder();
+
+
+ virtual wxSize GetFrameSize(unsigned int frame) const;
+ virtual wxPoint GetFramePosition(unsigned int frame) const;
+ virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const;
+ virtual long GetDelay(unsigned int frame) const;
+ virtual wxColour GetTransparentColour(unsigned int frame) const;
+
+ // implementation of wxAnimationDecoder's pure virtuals
+
+ virtual bool Load( wxInputStream& stream );
+
+ bool ConvertToImage(unsigned int frame, wxImage *image) const;
+
+ wxAnimationDecoder *Clone() const
+ { return new wxANIDecoder; }
+ wxAnimationType GetType() const
+ { return wxANIMATION_TYPE_ANI; }
+
+private:
+ // wxAnimationDecoder pure virtual:
+ virtual bool DoCanRead( wxInputStream& stream ) const;
+ // modifies current stream position (see wxAnimationDecoder::CanRead)
+
+ // frames stored as wxImage(s): ANI files are meant to be used mostly for animated
+ // cursors and thus they do not use any optimization to encode differences between
+ // two frames: they are just a list of images to display sequentially.
+ wxImageArray m_images;
+
+ // the info about each image stored in m_images.
+ // NB: m_info.GetCount() may differ from m_images.GetCount()!
+ wxANIFrameInfoArray m_info;
+
+ // this is the wxCURHandler used to load the ICON chunk of the ANI files
+ static wxCURHandler sm_handler;
+
+
+ wxDECLARE_NO_COPY_CLASS(wxANIDecoder);
+};
+
+
+#endif // wxUSE_STREAMS && (wxUSE_ICO_CUR || wxUSE_GIF)
+
+#endif // _WX_ANIDECOD_H
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/animate.h
+// Purpose: wxAnimation and wxAnimationCtrl
+// Author: Julian Smart and Guillermo Rodriguez Garcia
+// Modified by: Francesco Montorsi
+// Created: 13/8/99
+// Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_ANIMATE_H_
+#define _WX_ANIMATE_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_ANIMATIONCTRL
+
+#include "wx/animdecod.h"
+#include "wx/control.h"
+#include "wx/timer.h"
+#include "wx/bitmap.h"
+
+class WXDLLIMPEXP_FWD_ADV wxAnimation;
+
+extern WXDLLIMPEXP_DATA_ADV(wxAnimation) wxNullAnimation;
+extern WXDLLIMPEXP_DATA_ADV(const char) wxAnimationCtrlNameStr[];
+
+
+// ----------------------------------------------------------------------------
+// wxAnimationBase
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxAnimationBase : public wxObject
+{
+public:
+ wxAnimationBase() {}
+
+ virtual bool IsOk() const = 0;
+
+ // can be -1
+ virtual int GetDelay(unsigned int frame) const = 0;
+
+ virtual unsigned int GetFrameCount() const = 0;
+ virtual wxImage GetFrame(unsigned int frame) const = 0;
+ virtual wxSize GetSize() const = 0;
+
+ virtual bool LoadFile(const wxString& name,
+ wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
+ virtual bool Load(wxInputStream& stream,
+ wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
+
+protected:
+ DECLARE_ABSTRACT_CLASS(wxAnimationBase)
+};
+
+
+
+// ----------------------------------------------------------------------------
+// wxAnimationCtrlBase
+// ----------------------------------------------------------------------------
+
+// do not autoresize to the animation's size when SetAnimation() is called
+#define wxAC_NO_AUTORESIZE (0x0010)
+
+// default style does not include wxAC_NO_AUTORESIZE, that is, the control
+// auto-resizes by default to fit the new animation when SetAnimation() is called
+#define wxAC_DEFAULT_STYLE (wxBORDER_NONE)
+
+class WXDLLIMPEXP_ADV wxAnimationCtrlBase : public wxControl
+{
+public:
+ wxAnimationCtrlBase() { }
+
+ // public API
+ virtual bool LoadFile(const wxString& filename,
+ wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
+ virtual bool Load(wxInputStream& stream,
+ wxAnimationType type = wxANIMATION_TYPE_ANY) = 0;
+
+ virtual void SetAnimation(const wxAnimation &anim) = 0;
+ virtual wxAnimation GetAnimation() const = 0;
+
+ virtual bool Play() = 0;
+ virtual void Stop() = 0;
+
+ virtual bool IsPlaying() const = 0;
+
+ virtual void SetInactiveBitmap(const wxBitmap &bmp);
+
+ // always return the original bitmap set in this control
+ wxBitmap GetInactiveBitmap() const
+ { return m_bmpStatic; }
+
+protected:
+ // the inactive bitmap as it was set by the user
+ wxBitmap m_bmpStatic;
+
+ // the inactive bitmap currently shown in the control
+ // (may differ in the size from m_bmpStatic)
+ wxBitmap m_bmpStaticReal;
+
+ // updates m_bmpStaticReal from m_bmpStatic if needed
+ virtual void UpdateStaticImage();
+
+ // called by SetInactiveBitmap
+ virtual void DisplayStaticImage() = 0;
+
+private:
+ DECLARE_ABSTRACT_CLASS(wxAnimationCtrlBase)
+};
+
+
+// ----------------------------------------------------------------------------
+// include the platform-specific version of the wxAnimationCtrl class
+// ----------------------------------------------------------------------------
+
+#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
+ #include "wx/gtk/animate.h"
+#else
+ #include "wx/generic/animate.h"
+#endif
+
+#endif // wxUSE_ANIMATIONCTRL
+
+#endif // _WX_ANIMATE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/animdecod.h
+// Purpose: wxAnimationDecoder
+// Author: Francesco Montorsi
+// Copyright: (c) 2006 Francesco Montorsi
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_ANIMDECOD_H
+#define _WX_ANIMDECOD_H
+
+#include "wx/defs.h"
+
+#if wxUSE_STREAMS
+
+#include "wx/colour.h"
+#include "wx/gdicmn.h"
+#include "wx/log.h"
+#include "wx/stream.h"
+
+class WXDLLIMPEXP_FWD_CORE wxImage;
+
+/*
+
+ Differences between a wxAnimationDecoder and a wxImageHandler:
+
+ 1) wxImageHandlers always load an input stream directly into a given wxImage
+ object converting from the format-specific data representation to the
+ wxImage native format (RGB24).
+ wxAnimationDecoders always load an input stream using some optimized format
+ to store it which is format-depedent. This allows to store a (possibly big)
+ animation using a format which is a good compromise between required memory
+ and time required to blit it on the screen.
+
+ 2) wxAnimationDecoders contain the animation data in some internal variable.
+ That's why they derive from wxObjectRefData: they are data which can be shared.
+
+ 3) wxAnimationDecoders can be used by a wxImageHandler to retrieve a frame
+ in wxImage format; the viceversa cannot be done.
+
+ 4) wxAnimationDecoders are decoders only, thus they do not support save features.
+
+ 5) wxAnimationDecoders are directly used by wxAnimation (generic implementation)
+ as wxObjectRefData while they need to be 'wrapped' by a wxImageHandler for
+ wxImage uses.
+
+*/
+
+
+// --------------------------------------------------------------------------
+// Constants
+// --------------------------------------------------------------------------
+
+// NB: the values of these enum items are not casual but coincide with the
+// GIF disposal codes. Do not change them !!
+enum wxAnimationDisposal
+{
+ // No disposal specified. The decoder is not required to take any action.
+ wxANIM_UNSPECIFIED = -1,
+
+ // Do not dispose. The graphic is to be left in place.
+ wxANIM_DONOTREMOVE = 0,
+
+ // Restore to background color. The area used by the graphic must be
+ // restored to the background color.
+ wxANIM_TOBACKGROUND = 1,
+
+ // Restore to previous. The decoder is required to restore the area
+ // overwritten by the graphic with what was there prior to rendering the graphic.
+ wxANIM_TOPREVIOUS = 2
+};
+
+enum wxAnimationType
+{
+ wxANIMATION_TYPE_INVALID,
+ wxANIMATION_TYPE_GIF,
+ wxANIMATION_TYPE_ANI,
+
+ wxANIMATION_TYPE_ANY
+};
+
+
+// --------------------------------------------------------------------------
+// wxAnimationDecoder class
+// --------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxAnimationDecoder : public wxObjectRefData
+{
+public:
+ wxAnimationDecoder()
+ {
+ m_nFrames = 0;
+ }
+
+ virtual bool Load( wxInputStream& stream ) = 0;
+
+ bool CanRead( wxInputStream& stream ) const
+ {
+ // NOTE: this code is the same of wxImageHandler::CallDoCanRead
+
+ if ( !stream.IsSeekable() )
+ return false; // can't test unseekable stream
+
+ wxFileOffset posOld = stream.TellI();
+ bool ok = DoCanRead(stream);
+
+ // restore the old position to be able to test other formats and so on
+ if ( stream.SeekI(posOld) == wxInvalidOffset )
+ {
+ wxLogDebug(wxT("Failed to rewind the stream in wxAnimationDecoder!"));
+
+ // reading would fail anyhow as we're not at the right position
+ return false;
+ }
+
+ return ok;
+ }
+
+ virtual wxAnimationDecoder *Clone() const = 0;
+ virtual wxAnimationType GetType() const = 0;
+
+ // convert given frame to wxImage
+ virtual bool ConvertToImage(unsigned int frame, wxImage *image) const = 0;
+
+
+ // frame specific data getters
+
+ // not all frames may be of the same size; e.g. GIF allows to
+ // specify that between two frames only a smaller portion of the
+ // entire animation has changed.
+ virtual wxSize GetFrameSize(unsigned int frame) const = 0;
+
+ // the position of this frame in case it's not as big as m_szAnimation
+ // or wxPoint(0,0) otherwise.
+ virtual wxPoint GetFramePosition(unsigned int frame) const = 0;
+
+ // what should be done after displaying this frame.
+ virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const = 0;
+
+ // the number of milliseconds this frame should be displayed.
+ // if returns -1 then the frame must be displayed forever.
+ virtual long GetDelay(unsigned int frame) const = 0;
+
+ // the transparent colour for this frame if any or wxNullColour.
+ virtual wxColour GetTransparentColour(unsigned int frame) const = 0;
+
+ // get global data
+ wxSize GetAnimationSize() const { return m_szAnimation; }
+ wxColour GetBackgroundColour() const { return m_background; }
+ unsigned int GetFrameCount() const { return m_nFrames; }
+
+protected:
+ // checks the signature of the data in the given stream and returns true if it
+ // appears to be a valid animation format recognized by the animation decoder;
+ // this function should modify the stream current position without taking care
+ // of restoring it since CanRead() will do it.
+ virtual bool DoCanRead(wxInputStream& stream) const = 0;
+
+ wxSize m_szAnimation;
+ unsigned int m_nFrames;
+
+ // this is the colour to use for the wxANIM_TOBACKGROUND disposal.
+ // if not specified by the animation, it's set to wxNullColour
+ wxColour m_background;
+};
+
+#endif // wxUSE_STREAMS
+
+#endif // _WX_ANIMDECOD_H
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/any.h
+// Purpose: wxAny class
+// Author: Jaakko Salli
+// Modified by:
+// Created: 07/05/2009
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_ANY_H_
+#define _WX_ANY_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_ANY
+
+#include <new> // for placement new
+#include "wx/string.h"
+#include "wx/meta/if.h"
+#include "wx/typeinfo.h"
+#include "wx/list.h"
+
+// Size of the wxAny value buffer.
+enum
+{
+ WX_ANY_VALUE_BUFFER_SIZE = 16
+};
+
+union wxAnyValueBuffer
+{
+ union Alignment
+ {
+ #if wxHAS_INT64
+ wxInt64 m_int64;
+ #endif
+ long double m_longDouble;
+ void ( *m_funcPtr )(void);
+ void ( wxAnyValueBuffer::*m_mFuncPtr )(void);
+ } m_alignment;
+
+ void* m_ptr;
+ wxByte m_buffer[WX_ANY_VALUE_BUFFER_SIZE];
+};
+
+//
+// wxAnyValueType is base class for value type functionality for C++ data
+// types used with wxAny. Usually the default template (wxAnyValueTypeImpl<>)
+// will create a satisfactory wxAnyValueType implementation for a data type.
+//
+class WXDLLIMPEXP_BASE wxAnyValueType
+{
+ WX_DECLARE_ABSTRACT_TYPEINFO(wxAnyValueType)
+public:
+ /**
+ Default constructor.
+ */
+ wxAnyValueType()
+ {
+ }
+
+ /**
+ Destructor.
+ */
+ virtual ~wxAnyValueType()
+ {
+ }
+
+ /**
+ This function is used for internal type matching.
+ */
+ virtual bool IsSameType(const wxAnyValueType* otherType) const = 0;
+
+ /**
+ This function is called every time the data in wxAny
+ buffer needs to be freed.
+ */
+ virtual void DeleteValue(wxAnyValueBuffer& buf) const = 0;
+
+ /**
+ Implement this for buffer-to-buffer copy.
+
+ @param src
+ This is the source data buffer.
+
+ @param dst
+ This is the destination data buffer that is in either
+ uninitialized or freed state.
+ */
+ virtual void CopyBuffer(const wxAnyValueBuffer& src,
+ wxAnyValueBuffer& dst) const = 0;
+
+ /**
+ Convert value into buffer of different type. Return false if
+ not possible.
+ */
+ virtual bool ConvertValue(const wxAnyValueBuffer& src,
+ wxAnyValueType* dstType,
+ wxAnyValueBuffer& dst) const = 0;
+
+ /**
+ Use this template function for checking if wxAnyValueType represents
+ a specific C++ data type.
+
+ @remarks This template function does not work on some older compilers
+ (such as Visual C++ 6.0). For full compiler compatibility
+ please use wxANY_VALUE_TYPE_CHECK_TYPE(valueTypePtr, T) macro
+ instead.
+
+ @see wxAny::CheckType()
+ */
+ // FIXME-VC6: remove this hack when VC6 is no longer supported
+ template <typename T>
+ bool CheckType(T* reserved = NULL) const;
+
+#if wxUSE_EXTENDED_RTTI
+ virtual const wxTypeInfo* GetTypeInfo() const = 0;
+#endif
+private:
+};
+
+
+//
+// We need to allocate wxAnyValueType instances in heap, and need to use
+// scoped ptr to properly deallocate them in dynamic library use cases.
+// Here we have a minimal specialized scoped ptr implementation to deal
+// with various compiler-specific problems with template class' static
+// member variable of template type with explicit constructor which
+// is initialized in global scope.
+//
+class wxAnyValueTypeScopedPtr
+{
+public:
+ wxAnyValueTypeScopedPtr(wxAnyValueType* ptr) : m_ptr(ptr) { }
+ ~wxAnyValueTypeScopedPtr() { delete m_ptr; }
+ wxAnyValueType* get() const { return m_ptr; }
+private:
+ wxAnyValueType* m_ptr;
+};
+
+
+//
+// This method of checking the type is compatible with VC6
+#define wxANY_VALUE_TYPE_CHECK_TYPE(valueTypePtr, T) \
+ wxAnyValueTypeImpl<T>::IsSameClass(valueTypePtr)
+
+
+/**
+ Helper macro for defining user value types.
+
+ Even though C++ RTTI would be fully available to use, we'd have to to
+ facilitate sub-type system which allows, for instance, wxAny with
+ signed short '15' to be treated equal to wxAny with signed long long '15'.
+ Having sm_instance is important here.
+
+ NB: We really need to have wxAnyValueType instances allocated
+ in heap. They are stored as static template member variables,
+ and with them we just can't be too careful (eg. not allocating
+ them in heap broke the type identification in GCC).
+*/
+#define WX_DECLARE_ANY_VALUE_TYPE(CLS) \
+ friend class wxAny; \
+ WX_DECLARE_TYPEINFO_INLINE(CLS) \
+public: \
+ static bool IsSameClass(const wxAnyValueType* otherType) \
+ { \
+ return wxTypeId(*sm_instance.get()) == wxTypeId(*otherType); \
+ } \
+ virtual bool IsSameType(const wxAnyValueType* otherType) const \
+ { \
+ return IsSameClass(otherType); \
+ } \
+private: \
+ static wxAnyValueTypeScopedPtr sm_instance; \
+public: \
+ static wxAnyValueType* GetInstance() \
+ { \
+ return sm_instance.get(); \
+ }
+
+
+#define WX_IMPLEMENT_ANY_VALUE_TYPE(CLS) \
+wxAnyValueTypeScopedPtr CLS::sm_instance(new CLS());
+
+
+#ifdef __VISUALC6__
+ // "non dll-interface class 'xxx' used as base interface
+ #pragma warning (push)
+ #pragma warning (disable:4275)
+#endif
+
+/**
+ Following are helper classes for the wxAnyValueTypeImplBase.
+*/
+namespace wxPrivate
+{
+
+template<typename T>
+class wxAnyValueTypeOpsInplace
+{
+public:
+ static void DeleteValue(wxAnyValueBuffer& buf)
+ {
+ T* value = reinterpret_cast<T*>(&buf.m_buffer[0]);
+ value->~T();
+
+ // Some compiler may given 'unused variable' warnings without this
+ wxUnusedVar(value);
+ }
+
+ static void SetValue(const T& value,
+ wxAnyValueBuffer& buf)
+ {
+ // Use placement new
+ void* const place = buf.m_buffer;
+ ::new(place) T(value);
+ }
+
+ static const T& GetValue(const wxAnyValueBuffer& buf)
+ {
+ // Breaking this code into two lines should suppress
+ // GCC's 'type-punned pointer will break strict-aliasing rules'
+ // warning.
+ const T* value = reinterpret_cast<const T*>(&buf.m_buffer[0]);
+ return *value;
+ }
+};
+
+
+template<typename T>
+class wxAnyValueTypeOpsGeneric
+{
+public:
+ template<typename T2>
+ class DataHolder
+ {
+ public:
+ DataHolder(const T2& value)
+ {
+ m_value = value;
+ }
+ virtual ~DataHolder() { }
+
+ T2 m_value;
+ private:
+ wxDECLARE_NO_COPY_CLASS(DataHolder);
+ };
+
+ static void DeleteValue(wxAnyValueBuffer& buf)
+ {
+ DataHolder<T>* holder = static_cast<DataHolder<T>*>(buf.m_ptr);
+ delete holder;
+ }
+
+ static void SetValue(const T& value,
+ wxAnyValueBuffer& buf)
+ {
+ DataHolder<T>* holder = new DataHolder<T>(value);
+ buf.m_ptr = holder;
+ }
+
+ static const T& GetValue(const wxAnyValueBuffer& buf)
+ {
+ DataHolder<T>* holder = static_cast<DataHolder<T>*>(buf.m_ptr);
+ return holder->m_value;
+ }
+};
+
+} // namespace wxPrivate
+
+
+/**
+ Intermediate template for the generic value type implementation.
+ We can derive from this same value type for multiple actual types
+ (for instance, we can have wxAnyValueTypeImplInt for all signed
+ integer types), and also easily implement specialized templates
+ with specific dynamic type conversion.
+*/
+template<typename T>
+class wxAnyValueTypeImplBase : public wxAnyValueType
+{
+ typedef typename wxIf< sizeof(T) <= WX_ANY_VALUE_BUFFER_SIZE,
+ wxPrivate::wxAnyValueTypeOpsInplace<T>,
+ wxPrivate::wxAnyValueTypeOpsGeneric<T> >::value
+ Ops;
+
+public:
+ wxAnyValueTypeImplBase() : wxAnyValueType() { }
+ virtual ~wxAnyValueTypeImplBase() { }
+
+ virtual void DeleteValue(wxAnyValueBuffer& buf) const
+ {
+ Ops::DeleteValue(buf);
+ }
+
+ virtual void CopyBuffer(const wxAnyValueBuffer& src,
+ wxAnyValueBuffer& dst) const
+ {
+ Ops::SetValue(Ops::GetValue(src), dst);
+ }
+
+ /**
+ It is important to reimplement this in any specialized template
+ classes that inherit from wxAnyValueTypeImplBase.
+ */
+ static void SetValue(const T& value,
+ wxAnyValueBuffer& buf)
+ {
+ Ops::SetValue(value, buf);
+ }
+
+ /**
+ It is important to reimplement this in any specialized template
+ classes that inherit from wxAnyValueTypeImplBase.
+ */
+ static const T& GetValue(const wxAnyValueBuffer& buf)
+ {
+ return Ops::GetValue(buf);
+ }
+#if wxUSE_EXTENDED_RTTI
+ virtual const wxTypeInfo* GetTypeInfo() const
+ {
+ return wxGetTypeInfo((T*)NULL);
+ }
+#endif
+};
+
+
+/*
+ Generic value type template. Note that bulk of the implementation
+ resides in wxAnyValueTypeImplBase.
+*/
+template<typename T>
+class wxAnyValueTypeImpl : public wxAnyValueTypeImplBase<T>
+{
+ WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl<T>)
+public:
+ wxAnyValueTypeImpl() : wxAnyValueTypeImplBase<T>() { }
+ virtual ~wxAnyValueTypeImpl() { }
+
+ virtual bool ConvertValue(const wxAnyValueBuffer& src,
+ wxAnyValueType* dstType,
+ wxAnyValueBuffer& dst) const
+ {
+ wxUnusedVar(src);
+ wxUnusedVar(dstType);
+ wxUnusedVar(dst);
+ return false;
+ }
+};
+
+template<typename T>
+wxAnyValueTypeScopedPtr wxAnyValueTypeImpl<T>::sm_instance = new wxAnyValueTypeImpl<T>();
+
+
+//
+// Helper macro for using same base value type implementation for multiple
+// actual C++ data types.
+//
+#define _WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE) \
+template<> \
+class wxAnyValueTypeImpl<T> : public wxAnyValueTypeImpl##CLSTYPE \
+{ \
+ typedef wxAnyBase##CLSTYPE##Type UseDataType; \
+public: \
+ wxAnyValueTypeImpl() : wxAnyValueTypeImpl##CLSTYPE() { } \
+ virtual ~wxAnyValueTypeImpl() { } \
+ static void SetValue(const T& value, wxAnyValueBuffer& buf) \
+ { \
+ void* voidPtr = reinterpret_cast<void*>(&buf.m_buffer[0]); \
+ UseDataType* dptr = reinterpret_cast<UseDataType*>(voidPtr); \
+ *dptr = static_cast<UseDataType>(value); \
+ } \
+ static T GetValue(const wxAnyValueBuffer& buf) \
+ { \
+ const void* voidPtr = \
+ reinterpret_cast<const void*>(&buf.m_buffer[0]); \
+ const UseDataType* sptr = \
+ reinterpret_cast<const UseDataType*>(voidPtr); \
+ return static_cast<T>(*sptr); \
+ }
+
+#if wxUSE_EXTENDED_RTTI
+#define WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE) \
+_WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE)\
+ virtual const wxTypeInfo* GetTypeInfo() const \
+ { \
+ return wxGetTypeInfo((T*)NULL); \
+ } \
+};
+#else
+#define WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE) \
+_WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE)\
+};
+#endif
+
+//
+// Integer value types
+//
+
+#ifdef wxLongLong_t
+ typedef wxLongLong_t wxAnyBaseIntType;
+ typedef wxULongLong_t wxAnyBaseUintType;
+#else
+ typedef long wxAnyBaseIntType;
+ typedef unsigned long wxAnyBaseUintType;
+#endif
+
+
+class WXDLLIMPEXP_BASE wxAnyValueTypeImplInt :
+ public wxAnyValueTypeImplBase<wxAnyBaseIntType>
+{
+ WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImplInt)
+public:
+ wxAnyValueTypeImplInt() :
+ wxAnyValueTypeImplBase<wxAnyBaseIntType>() { }
+ virtual ~wxAnyValueTypeImplInt() { }
+
+ virtual bool ConvertValue(const wxAnyValueBuffer& src,
+ wxAnyValueType* dstType,
+ wxAnyValueBuffer& dst) const;
+};
+
+
+class WXDLLIMPEXP_BASE wxAnyValueTypeImplUint :
+ public wxAnyValueTypeImplBase<wxAnyBaseUintType>
+{
+ WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImplUint)
+public:
+ wxAnyValueTypeImplUint() :
+ wxAnyValueTypeImplBase<wxAnyBaseUintType>() { }
+ virtual ~wxAnyValueTypeImplUint() { }
+
+ virtual bool ConvertValue(const wxAnyValueBuffer& src,
+ wxAnyValueType* dstType,
+ wxAnyValueBuffer& dst) const;
+};
+
+
+WX_ANY_DEFINE_SUB_TYPE(signed long, Int)
+WX_ANY_DEFINE_SUB_TYPE(signed int, Int)
+WX_ANY_DEFINE_SUB_TYPE(signed short, Int)
+WX_ANY_DEFINE_SUB_TYPE(signed char, Int)
+#ifdef wxLongLong_t
+WX_ANY_DEFINE_SUB_TYPE(wxLongLong_t, Int)
+#endif
+
+WX_ANY_DEFINE_SUB_TYPE(unsigned long, Uint)
+WX_ANY_DEFINE_SUB_TYPE(unsigned int, Uint)
+WX_ANY_DEFINE_SUB_TYPE(unsigned short, Uint)
+WX_ANY_DEFINE_SUB_TYPE(unsigned char, Uint)
+#ifdef wxLongLong_t
+WX_ANY_DEFINE_SUB_TYPE(wxULongLong_t, Uint)
+#endif
+
+
+//
+// This macro is used in header, but then in source file we must have:
+// WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl##TYPENAME)
+//
+#define _WX_ANY_DEFINE_CONVERTIBLE_TYPE(T, TYPENAME, CONVFUNC, GV) \
+class WXDLLIMPEXP_BASE wxAnyValueTypeImpl##TYPENAME : \
+ public wxAnyValueTypeImplBase<T> \
+{ \
+ WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl##TYPENAME) \
+public: \
+ wxAnyValueTypeImpl##TYPENAME() : \
+ wxAnyValueTypeImplBase<T>() { } \
+ virtual ~wxAnyValueTypeImpl##TYPENAME() { } \
+ virtual bool ConvertValue(const wxAnyValueBuffer& src, \
+ wxAnyValueType* dstType, \
+ wxAnyValueBuffer& dst) const \
+ { \
+ GV value = GetValue(src); \
+ return CONVFUNC(value, dstType, dst); \
+ } \
+}; \
+template<> \
+class wxAnyValueTypeImpl<T> : public wxAnyValueTypeImpl##TYPENAME \
+{ \
+public: \
+ wxAnyValueTypeImpl() : wxAnyValueTypeImpl##TYPENAME() { } \
+ virtual ~wxAnyValueTypeImpl() { } \
+};
+
+#define WX_ANY_DEFINE_CONVERTIBLE_TYPE(T, TYPENAME, CONVFUNC, BT) \
+_WX_ANY_DEFINE_CONVERTIBLE_TYPE(T, TYPENAME, CONVFUNC, BT) \
+
+#define WX_ANY_DEFINE_CONVERTIBLE_TYPE_BASE(T, TYPENAME, CONVFUNC) \
+_WX_ANY_DEFINE_CONVERTIBLE_TYPE(T, TYPENAME, \
+ CONVFUNC, const T&) \
+
+//
+// String value type
+//
+
+// Convert wxString to destination wxAny value type
+extern WXDLLIMPEXP_BASE bool wxAnyConvertString(const wxString& value,
+ wxAnyValueType* dstType,
+ wxAnyValueBuffer& dst);
+
+WX_ANY_DEFINE_CONVERTIBLE_TYPE_BASE(wxString, wxString, wxAnyConvertString)
+WX_ANY_DEFINE_CONVERTIBLE_TYPE(const char*, ConstCharPtr,
+ wxAnyConvertString, wxString)
+WX_ANY_DEFINE_CONVERTIBLE_TYPE(const wchar_t*, ConstWchar_tPtr,
+ wxAnyConvertString, wxString)
+
+//
+// Bool value type
+//
+template<>
+class WXDLLIMPEXP_BASE wxAnyValueTypeImpl<bool> :
+ public wxAnyValueTypeImplBase<bool>
+{
+ WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl<bool>)
+public:
+ wxAnyValueTypeImpl() :
+ wxAnyValueTypeImplBase<bool>() { }
+ virtual ~wxAnyValueTypeImpl() { }
+
+ virtual bool ConvertValue(const wxAnyValueBuffer& src,
+ wxAnyValueType* dstType,
+ wxAnyValueBuffer& dst) const;
+};
+
+//
+// Floating point value type
+//
+class WXDLLIMPEXP_BASE wxAnyValueTypeImplDouble :
+ public wxAnyValueTypeImplBase<double>
+{
+ WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImplDouble)
+public:
+ wxAnyValueTypeImplDouble() :
+ wxAnyValueTypeImplBase<double>() { }
+ virtual ~wxAnyValueTypeImplDouble() { }
+
+ virtual bool ConvertValue(const wxAnyValueBuffer& src,
+ wxAnyValueType* dstType,
+ wxAnyValueBuffer& dst) const;
+};
+
+// WX_ANY_DEFINE_SUB_TYPE requires this
+typedef double wxAnyBaseDoubleType;
+
+WX_ANY_DEFINE_SUB_TYPE(float, Double)
+WX_ANY_DEFINE_SUB_TYPE(double, Double)
+
+
+//
+// Defines a dummy wxAnyValueTypeImpl<> with given export
+// declaration. This is needed if a class is used with
+// wxAny in both user shared library and application.
+//
+#define wxDECLARE_ANY_TYPE(CLS, DECL) \
+template<> \
+class DECL wxAnyValueTypeImpl<CLS> : \
+ public wxAnyValueTypeImplBase<CLS> \
+{ \
+ WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl<CLS>) \
+public: \
+ wxAnyValueTypeImpl() : \
+ wxAnyValueTypeImplBase<CLS>() { } \
+ virtual ~wxAnyValueTypeImpl() { } \
+ \
+ virtual bool ConvertValue(const wxAnyValueBuffer& src, \
+ wxAnyValueType* dstType, \
+ wxAnyValueBuffer& dst) const \
+ { \
+ wxUnusedVar(src); \
+ wxUnusedVar(dstType); \
+ wxUnusedVar(dst); \
+ return false; \
+ } \
+};
+
+
+// Make sure some of wx's own types get the right wxAnyValueType export
+// (this is needed only for types that are referred to from wxBase.
+// currently we may not use any of these types from there, but let's
+// use the macro on at least one to make sure it compiles since we can't
+// really test it properly in unit tests since a separate DLL would
+// be needed).
+#if wxUSE_DATETIME
+ #include "wx/datetime.h"
+ wxDECLARE_ANY_TYPE(wxDateTime, WXDLLIMPEXP_BASE)
+#endif
+
+//#include "wx/object.h"
+//wxDECLARE_ANY_TYPE(wxObject*, WXDLLIMPEXP_BASE)
+
+//#include "wx/arrstr.h"
+//wxDECLARE_ANY_TYPE(wxArrayString, WXDLLIMPEXP_BASE)
+
+
+#if wxUSE_VARIANT
+
+class WXDLLIMPEXP_FWD_BASE wxAnyToVariantRegistration;
+
+// Because of header inter-dependencies, cannot include this earlier
+#include "wx/variant.h"
+
+//
+// wxVariantData* data type implementation. For cases when appropriate
+// wxAny<->wxVariant conversion code is missing.
+//
+
+class WXDLLIMPEXP_BASE wxAnyValueTypeImplVariantData :
+ public wxAnyValueTypeImplBase<wxVariantData*>
+{
+ WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImplVariantData)
+public:
+ wxAnyValueTypeImplVariantData() :
+ wxAnyValueTypeImplBase<wxVariantData*>() { }
+ virtual ~wxAnyValueTypeImplVariantData() { }
+
+ virtual void DeleteValue(wxAnyValueBuffer& buf) const
+ {
+ wxVariantData* data = static_cast<wxVariantData*>(buf.m_ptr);
+ if ( data )
+ data->DecRef();
+ }
+
+ virtual void CopyBuffer(const wxAnyValueBuffer& src,
+ wxAnyValueBuffer& dst) const
+ {
+ wxVariantData* data = static_cast<wxVariantData*>(src.m_ptr);
+ if ( data )
+ data->IncRef();
+ dst.m_ptr = data;
+ }
+
+ static void SetValue(wxVariantData* value,
+ wxAnyValueBuffer& buf)
+ {
+ value->IncRef();
+ buf.m_ptr = value;
+ }
+
+ static wxVariantData* GetValue(const wxAnyValueBuffer& buf)
+ {
+ return static_cast<wxVariantData*>(buf.m_ptr);
+ }
+
+ virtual bool ConvertValue(const wxAnyValueBuffer& src,
+ wxAnyValueType* dstType,
+ wxAnyValueBuffer& dst) const
+ {
+ wxUnusedVar(src);
+ wxUnusedVar(dstType);
+ wxUnusedVar(dst);
+ return false;
+ }
+};
+
+template<>
+class wxAnyValueTypeImpl<wxVariantData*> :
+ public wxAnyValueTypeImplVariantData
+{
+public:
+ wxAnyValueTypeImpl() : wxAnyValueTypeImplVariantData() { }
+ virtual ~wxAnyValueTypeImpl() { }
+};
+
+#endif // wxUSE_VARIANT
+
+#ifdef __VISUALC6__
+ // Re-enable useless VC6 warnings
+ #pragma warning (pop)
+#endif
+
+
+/*
+ Let's define a discrete Null value so we don't have to really
+ ever check if wxAny.m_type pointer is NULL or not. This is an
+ optimization, mostly. Implementation of this value type is
+ "hidden" in the source file.
+*/
+extern WXDLLIMPEXP_DATA_BASE(wxAnyValueType*) wxAnyNullValueType;
+
+
+//
+// We need to implement custom signed/unsigned int equals operators
+// for signed/unsigned (eg. wxAny(128UL) == 128L) comparisons to work.
+#define WXANY_IMPLEMENT_INT_EQ_OP(TS, TUS) \
+bool operator==(TS value) const \
+{ \
+ if ( wxAnyValueTypeImpl<TS>::IsSameClass(m_type) ) \
+ return (value == static_cast<TS> \
+ (wxAnyValueTypeImpl<TS>::GetValue(m_buffer))); \
+ if ( wxAnyValueTypeImpl<TUS>::IsSameClass(m_type) ) \
+ return (value == static_cast<TS> \
+ (wxAnyValueTypeImpl<TUS>::GetValue(m_buffer))); \
+ return false; \
+} \
+bool operator==(TUS value) const \
+{ \
+ if ( wxAnyValueTypeImpl<TUS>::IsSameClass(m_type) ) \
+ return (value == static_cast<TUS> \
+ (wxAnyValueTypeImpl<TUS>::GetValue(m_buffer))); \
+ if ( wxAnyValueTypeImpl<TS>::IsSameClass(m_type) ) \
+ return (value == static_cast<TUS> \
+ (wxAnyValueTypeImpl<TS>::GetValue(m_buffer))); \
+ return false; \
+}
+
+
+#if wxUSE_VARIANT
+
+// Note that the following functions are implemented outside wxAny class
+// so that it can reside entirely in header and lack the export declaration.
+
+// Helper function used to associate wxAnyValueType with a wxVariantData.
+extern WXDLLIMPEXP_BASE void
+wxPreRegisterAnyToVariant(wxAnyToVariantRegistration* reg);
+
+// This function performs main wxAny to wxVariant conversion duties.
+extern WXDLLIMPEXP_BASE bool
+wxConvertAnyToVariant(const wxAny& any, wxVariant* variant);
+
+#endif // wxUSE_VARIANT
+
+
+//
+// The wxAny class represents a container for any type. A variant's value
+// can be changed at run time, possibly to a different type of value.
+//
+// As standard, wxAny can store value of almost any type, in a fairly
+// optimal manner even.
+//
+class wxAny
+{
+public:
+ /**
+ Default constructor.
+ */
+ wxAny()
+ {
+ m_type = wxAnyNullValueType;
+ }
+
+ /**
+ Destructor.
+ */
+ ~wxAny()
+ {
+ m_type->DeleteValue(m_buffer);
+ }
+
+ //@{
+ /**
+ Various constructors.
+ */
+ template<typename T>
+ wxAny(const T& value)
+ {
+ m_type = wxAnyValueTypeImpl<T>::sm_instance.get();
+ wxAnyValueTypeImpl<T>::SetValue(value, m_buffer);
+ }
+
+ // These two constructors are needed to deal with string literals
+ wxAny(const char* value)
+ {
+ m_type = wxAnyValueTypeImpl<const char*>::sm_instance.get();
+ wxAnyValueTypeImpl<const char*>::SetValue(value, m_buffer);
+ }
+ wxAny(const wchar_t* value)
+ {
+ m_type = wxAnyValueTypeImpl<const wchar_t*>::sm_instance.get();
+ wxAnyValueTypeImpl<const wchar_t*>::SetValue(value, m_buffer);
+ }
+
+ wxAny(const wxAny& any)
+ {
+ m_type = wxAnyNullValueType;
+ AssignAny(any);
+ }
+
+#if wxUSE_VARIANT
+ wxAny(const wxVariant& variant)
+ {
+ m_type = wxAnyNullValueType;
+ AssignVariant(variant);
+ }
+#endif
+
+ //@}
+
+ /**
+ Use this template function for checking if this wxAny holds
+ a specific C++ data type.
+
+ @remarks This template function does not work on some older compilers
+ (such as Visual C++ 6.0). For full compiler ccompatibility
+ please use wxANY_CHECK_TYPE(any, T) macro instead.
+
+ @see wxAnyValueType::CheckType()
+ */
+ // FIXME-VC6: remove this hack when VC6 is no longer supported
+ template <typename T>
+ bool CheckType(T* = NULL) const
+ {
+ return m_type->CheckType<T>();
+ }
+
+ /**
+ Returns the value type as wxAnyValueType instance.
+
+ @remarks You cannot reliably test whether two wxAnys are of
+ same value type by simply comparing return values
+ of wxAny::GetType(). Instead, use wxAny::HasSameType().
+
+ @see HasSameType()
+ */
+ const wxAnyValueType* GetType() const
+ {
+ return m_type;
+ }
+
+ /**
+ Returns @true if this and another wxAny have the same
+ value type.
+ */
+ bool HasSameType(const wxAny& other) const
+ {
+ return GetType()->IsSameType(other.GetType());
+ }
+
+ /**
+ Tests if wxAny is null (that is, whether there is no data).
+ */
+ bool IsNull() const
+ {
+ return (m_type == wxAnyNullValueType);
+ }
+
+ /**
+ Makes wxAny null (that is, clears it).
+ */
+ void MakeNull()
+ {
+ m_type->DeleteValue(m_buffer);
+ m_type = wxAnyNullValueType;
+ }
+
+ //@{
+ /**
+ Assignment operators.
+ */
+ template<typename T>
+ wxAny& operator=(const T &value)
+ {
+ m_type->DeleteValue(m_buffer);
+ m_type = wxAnyValueTypeImpl<T>::sm_instance.get();
+ wxAnyValueTypeImpl<T>::SetValue(value, m_buffer);
+ return *this;
+ }
+
+ wxAny& operator=(const wxAny &any)
+ {
+ if (this != &any)
+ AssignAny(any);
+ return *this;
+ }
+
+#if wxUSE_VARIANT
+ wxAny& operator=(const wxVariant &variant)
+ {
+ AssignVariant(variant);
+ return *this;
+ }
+#endif
+
+ // These two operators are needed to deal with string literals
+ wxAny& operator=(const char* value)
+ {
+ Assign(value);
+ return *this;
+ }
+ wxAny& operator=(const wchar_t* value)
+ {
+ Assign(value);
+ return *this;
+ }
+
+ //@{
+ /**
+ Equality operators.
+ */
+ bool operator==(const wxString& value) const
+ {
+ wxString value2;
+ if ( !GetAs(&value2) )
+ return false;
+ return value == value2;
+ }
+
+ bool operator==(const char* value) const
+ { return (*this) == wxString(value); }
+ bool operator==(const wchar_t* value) const
+ { return (*this) == wxString(value); }
+
+ //
+ // We need to implement custom signed/unsigned int equals operators
+ // for signed/unsigned (eg. wxAny(128UL) == 128L) comparisons to work.
+ WXANY_IMPLEMENT_INT_EQ_OP(signed char, unsigned char)
+ WXANY_IMPLEMENT_INT_EQ_OP(signed short, unsigned short)
+ WXANY_IMPLEMENT_INT_EQ_OP(signed int, unsigned int)
+ WXANY_IMPLEMENT_INT_EQ_OP(signed long, unsigned long)
+#ifdef wxLongLong_t
+ WXANY_IMPLEMENT_INT_EQ_OP(wxLongLong_t, wxULongLong_t)
+#endif
+
+ wxGCC_WARNING_SUPPRESS(float-equal)
+
+ bool operator==(float value) const
+ {
+ if ( !wxAnyValueTypeImpl<float>::IsSameClass(m_type) )
+ return false;
+
+ return value ==
+ static_cast<float>
+ (wxAnyValueTypeImpl<float>::GetValue(m_buffer));
+ }
+
+ bool operator==(double value) const
+ {
+ if ( !wxAnyValueTypeImpl<double>::IsSameClass(m_type) )
+ return false;
+
+ return value ==
+ static_cast<double>
+ (wxAnyValueTypeImpl<double>::GetValue(m_buffer));
+ }
+
+ wxGCC_WARNING_RESTORE(float-equal)
+
+ bool operator==(bool value) const
+ {
+ if ( !wxAnyValueTypeImpl<bool>::IsSameClass(m_type) )
+ return false;
+
+ return value == (wxAnyValueTypeImpl<bool>::GetValue(m_buffer));
+ }
+
+ //@}
+
+ //@{
+ /**
+ Inequality operators (implement as template).
+ */
+ template<typename T>
+ bool operator!=(const T& value) const
+ { return !((*this) == value); }
+ //@}
+
+ /**
+ This template function converts wxAny into given type. In most cases
+ no type conversion is performed, so if the type is incorrect an
+ assertion failure will occur.
+
+ @remarks For convenience, conversion is done when T is wxString. This
+ is useful when a string literal (which are treated as
+ const char* and const wchar_t*) has been assigned to wxAny.
+
+ This template function may not work properly with Visual C++
+ 6. For full compiler compatibility, please use
+ wxANY_AS(any, T) macro instead.
+ */
+ // FIXME-VC6: remove this hack when VC6 is no longer supported
+ template<typename T>
+ T As(T* = NULL) const
+ {
+ if ( !wxAnyValueTypeImpl<T>::IsSameClass(m_type) )
+ {
+ wxFAIL_MSG("Incorrect or non-convertible data type");
+ }
+
+ return static_cast<T>(wxAnyValueTypeImpl<T>::GetValue(m_buffer));
+ }
+
+ // Allow easy conversion from 'const char *' etc. to wxString
+ // FIXME-VC6: remove this hack when VC6 is no longer supported
+ //template<>
+ wxString As(wxString*) const
+ {
+ wxString value;
+ if ( !GetAs(&value) )
+ {
+ wxFAIL_MSG("Incorrect or non-convertible data type");
+ }
+ return value;
+ }
+
+#if wxUSE_EXTENDED_RTTI
+ const wxTypeInfo* GetTypeInfo() const
+ {
+ return m_type->GetTypeInfo();
+ }
+#endif
+ /**
+ Template function that retrieves and converts the value of this
+ variant to the type that T* value is.
+
+ @return Returns @true if conversion was successful.
+ */
+ template<typename T>
+ bool GetAs(T* value) const
+ {
+ if ( !wxAnyValueTypeImpl<T>::IsSameClass(m_type) )
+ {
+ wxAnyValueType* otherType =
+ wxAnyValueTypeImpl<T>::sm_instance.get();
+ wxAnyValueBuffer temp_buf;
+
+ if ( !m_type->ConvertValue(m_buffer, otherType, temp_buf) )
+ return false;
+
+ *value =
+ static_cast<T>(wxAnyValueTypeImpl<T>::GetValue(temp_buf));
+ otherType->DeleteValue(temp_buf);
+
+ return true;
+ }
+ *value = static_cast<T>(wxAnyValueTypeImpl<T>::GetValue(m_buffer));
+ return true;
+ }
+
+#if wxUSE_VARIANT
+ // GetAs() wxVariant specialization
+ bool GetAs(wxVariant* value) const
+ {
+ return wxConvertAnyToVariant(*this, value);
+ }
+#endif
+
+private:
+ // Assignment functions
+ void AssignAny(const wxAny& any)
+ {
+ // Must delete value - CopyBuffer() never does that
+ m_type->DeleteValue(m_buffer);
+
+ wxAnyValueType* newType = any.m_type;
+
+ if ( !newType->IsSameType(m_type) )
+ m_type = newType;
+
+ newType->CopyBuffer(any.m_buffer, m_buffer);
+ }
+
+#if wxUSE_VARIANT
+ void AssignVariant(const wxVariant& variant)
+ {
+ wxVariantData* data = variant.GetData();
+
+ if ( data && data->GetAsAny(this) )
+ return;
+
+ m_type->DeleteValue(m_buffer);
+
+ if ( variant.IsNull() )
+ {
+ // Init as Null
+ m_type = wxAnyNullValueType;
+ }
+ else
+ {
+ // If everything else fails, wrap the whole wxVariantData
+ m_type = wxAnyValueTypeImpl<wxVariantData*>::sm_instance.get();
+ wxAnyValueTypeImpl<wxVariantData*>::SetValue(data, m_buffer);
+ }
+ }
+#endif
+
+ template<typename T>
+ void Assign(const T &value)
+ {
+ m_type->DeleteValue(m_buffer);
+ m_type = wxAnyValueTypeImpl<T>::sm_instance.get();
+ wxAnyValueTypeImpl<T>::SetValue(value, m_buffer);
+ }
+
+ // Data
+ wxAnyValueBuffer m_buffer;
+ wxAnyValueType* m_type;
+};
+
+
+//
+// This method of checking the type is compatible with VC6
+#define wxANY_CHECK_TYPE(any, T) \
+ wxANY_VALUE_TYPE_CHECK_TYPE((any).GetType(), T)
+
+
+//
+// This method of getting the value is compatible with VC6
+#define wxANY_AS(any, T) \
+ (any).As(static_cast<T*>(NULL))
+
+
+template<typename T>
+inline bool wxAnyValueType::CheckType(T* reserved) const
+{
+ wxUnusedVar(reserved);
+ return wxAnyValueTypeImpl<T>::IsSameClass(this);
+}
+
+WX_DECLARE_LIST_WITH_DECL(wxAny, wxAnyList, class WXDLLIMPEXP_BASE);
+
+#endif // wxUSE_ANY
+
+#endif // _WX_ANY_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/anybutton.h
+// Purpose: wxAnyButtonBase class
+// Author: Vadim Zetlin
+// Created: 2000-08-15 (extracted from button.h)
+// Copyright: (c) Vadim Zetlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_ANYBUTTON_H_BASE_
+#define _WX_ANYBUTTON_H_BASE_
+
+#include "wx/defs.h"
+
+#ifdef wxHAS_ANY_BUTTON
+
+// ----------------------------------------------------------------------------
+// wxAnyButton specific flags
+// ----------------------------------------------------------------------------
+
+// These flags affect label alignment
+#define wxBU_LEFT 0x0040
+#define wxBU_TOP 0x0080
+#define wxBU_RIGHT 0x0100
+#define wxBU_BOTTOM 0x0200
+#define wxBU_ALIGN_MASK ( wxBU_LEFT | wxBU_TOP | wxBU_RIGHT | wxBU_BOTTOM )
+
+// These two flags are obsolete
+#define wxBU_NOAUTODRAW 0x0000
+#define wxBU_AUTODRAW 0x0004
+
+// by default, the buttons will be created with some (system dependent)
+// minimal size to make them look nicer, giving this style will make them as
+// small as possible
+#define wxBU_EXACTFIT 0x0001
+
+// this flag can be used to disable using the text label in the button: it is
+// mostly useful when creating buttons showing bitmap and having stock id as
+// without it both the standard label corresponding to the stock id and the
+// bitmap would be shown
+#define wxBU_NOTEXT 0x0002
+
+
+#include "wx/bitmap.h"
+#include "wx/control.h"
+
+// ----------------------------------------------------------------------------
+// wxAnyButton: common button functionality
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxAnyButtonBase : public wxControl
+{
+public:
+ wxAnyButtonBase() { }
+
+ // show the image in the button in addition to the label: this method is
+ // supported on all (major) platforms
+ void SetBitmap(const wxBitmap& bitmap, wxDirection dir = wxLEFT)
+ {
+ SetBitmapLabel(bitmap);
+ SetBitmapPosition(dir);
+ }
+
+ wxBitmap GetBitmap() const { return DoGetBitmap(State_Normal); }
+
+ // Methods for setting individual images for different states: normal,
+ // selected (meaning pushed or pressed), focused (meaning normal state for
+ // a focused button), disabled or hover (a.k.a. hot or current).
+ //
+ // Remember that SetBitmap() itself must be called before any other
+ // SetBitmapXXX() methods (except for SetBitmapLabel() which is a synonym
+ // for it anyhow) and that all bitmaps passed to these functions should be
+ // of the same size.
+ void SetBitmapLabel(const wxBitmap& bitmap)
+ { DoSetBitmap(bitmap, State_Normal); }
+ void SetBitmapPressed(const wxBitmap& bitmap)
+ { DoSetBitmap(bitmap, State_Pressed); }
+ void SetBitmapDisabled(const wxBitmap& bitmap)
+ { DoSetBitmap(bitmap, State_Disabled); }
+ void SetBitmapCurrent(const wxBitmap& bitmap)
+ { DoSetBitmap(bitmap, State_Current); }
+ void SetBitmapFocus(const wxBitmap& bitmap)
+ { DoSetBitmap(bitmap, State_Focused); }
+
+ wxBitmap GetBitmapLabel() const { return DoGetBitmap(State_Normal); }
+ wxBitmap GetBitmapPressed() const { return DoGetBitmap(State_Pressed); }
+ wxBitmap GetBitmapDisabled() const { return DoGetBitmap(State_Disabled); }
+ wxBitmap GetBitmapCurrent() const { return DoGetBitmap(State_Current); }
+ wxBitmap GetBitmapFocus() const { return DoGetBitmap(State_Focused); }
+
+
+ // set the margins around the image
+ void SetBitmapMargins(wxCoord x, wxCoord y) { DoSetBitmapMargins(x, y); }
+ void SetBitmapMargins(const wxSize& sz) { DoSetBitmapMargins(sz.x, sz.y); }
+ wxSize GetBitmapMargins() { return DoGetBitmapMargins(); }
+
+ // set the image position relative to the text, i.e. wxLEFT means that the
+ // image is to the left of the text (this is the default)
+ void SetBitmapPosition(wxDirection dir);
+
+
+ // Buttons on MSW can look bad if they are not native colours, because
+ // then they become owner-drawn and not theme-drawn. Disable it here
+ // in wxAnyButtonBase to make it consistent.
+ virtual bool ShouldInheritColours() const { return false; }
+
+ // wxUniv-compatible and deprecated equivalents to SetBitmapXXX()
+#if WXWIN_COMPATIBILITY_2_8
+ void SetImageLabel(const wxBitmap& bitmap) { SetBitmap(bitmap); }
+ void SetImageMargins(wxCoord x, wxCoord y) { SetBitmapMargins(x, y); }
+#endif // WXWIN_COMPATIBILITY_2_8
+
+ // backwards compatible names for pressed/current bitmaps: they're not
+ // deprecated as there is nothing really wrong with using them and no real
+ // advantage to using the new names but the new names are still preferred
+ wxBitmap GetBitmapSelected() const { return GetBitmapPressed(); }
+ wxBitmap GetBitmapHover() const { return GetBitmapCurrent(); }
+
+ void SetBitmapSelected(const wxBitmap& bitmap) { SetBitmapPressed(bitmap); }
+ void SetBitmapHover(const wxBitmap& bitmap) { SetBitmapCurrent(bitmap); }
+
+
+ // this enum is not part of wx public API, it is public because it is used
+ // in non wxAnyButton-derived classes internally
+ //
+ // also notice that MSW code relies on the values of the enum elements, do
+ // not change them without revising src/msw/button.cpp
+ enum State
+ {
+ State_Normal,
+ State_Current, // a.k.a. hot or "hovering"
+ State_Pressed, // a.k.a. "selected" in public API for some reason
+ State_Disabled,
+ State_Focused,
+ State_Max
+ };
+
+ // return true if this button shouldn't show the text label, either because
+ // it doesn't have it or because it was explicitly disabled with wxBU_NOTEXT
+ bool DontShowLabel() const
+ {
+ return HasFlag(wxBU_NOTEXT) || GetLabel().empty();
+ }
+
+ // return true if we do show the label
+ bool ShowsLabel() const
+ {
+ return !DontShowLabel();
+ }
+
+protected:
+ // choose the default border for this window
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ virtual wxBitmap DoGetBitmap(State WXUNUSED(which)) const
+ { return wxBitmap(); }
+ virtual void DoSetBitmap(const wxBitmap& WXUNUSED(bitmap),
+ State WXUNUSED(which))
+ { }
+
+ virtual wxSize DoGetBitmapMargins() const
+ { return wxSize(0, 0); }
+
+ virtual void DoSetBitmapMargins(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y))
+ { }
+
+ virtual void DoSetBitmapPosition(wxDirection WXUNUSED(dir))
+ { }
+
+ virtual bool DoGetAuthNeeded() const { return false; }
+ virtual void DoSetAuthNeeded(bool WXUNUSED(show)) { }
+
+
+ wxDECLARE_NO_COPY_CLASS(wxAnyButtonBase);
+};
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/anybutton.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/anybutton.h"
+//#elif defined(__WXMOTIF__)
+// #include "wx/motif/anybutton.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/anybutton.h"
+//#elif defined(__WXGTK__)
+// #include "wx/gtk1/anybutton.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/anybutton.h"
+//#elif defined(__WXCOCOA__)
+// #include "wx/cocoa/anybutton.h"
+//#elif defined(__WXPM__)
+// #include "wx/os2/anybutton.h"
+#else
+ typedef wxAnyButtonBase wxAnyButton;
+#endif
+
+#endif // wxHAS_ANY_BUTTON
+
+#endif // _WX_ANYBUTTON_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/anystr.h
+// Purpose: wxAnyStrPtr class declaration
+// Author: Vadim Zeitlin
+// Created: 2009-03-23
+// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_ANYSTR_H_
+#define _WX_ANYSTR_H_
+
+#include "wx/string.h"
+
+// ----------------------------------------------------------------------------
+// wxAnyStrPtr
+//
+// Notice that this is an internal and intentionally not documented class. It
+// is only used by wxWidgets itself to ensure compatibility with previous
+// versions and shouldn't be used by user code. When you see a function
+// returning it you should just know that you can treat it as a string pointer.
+// ----------------------------------------------------------------------------
+
+// This is a helper class convertible to either narrow or wide string pointer.
+// It is similar to wxCStrData but, unlike it, can be NULL which is required to
+// represent the return value of wxDateTime::ParseXXX() methods for example.
+//
+// NB: this class is fully inline and so doesn't need to be DLL-exported
+class wxAnyStrPtr
+{
+public:
+ // ctors: this class must be created from the associated string or using
+ // its default ctor for an invalid NULL-like object; notice that it is
+ // immutable after creation.
+
+ // ctor for invalid pointer
+ wxAnyStrPtr()
+ : m_str(NULL)
+ {
+ }
+
+ // ctor for valid pointer into the given string (whose lifetime must be
+ // greater than ours and which should remain constant while we're used)
+ wxAnyStrPtr(const wxString& str, const wxString::const_iterator& iter)
+ : m_str(&str),
+ m_iter(iter)
+ {
+ }
+
+ // default copy ctor is ok and so is default dtor, in particular we do not
+ // free the string
+
+
+ // various operators meant to make this class look like a superposition of
+ // char* and wchar_t*
+
+ // this one is needed to allow boolean expressions involving these objects,
+ // e.g. "if ( FuncReturningAnyStrPtr() && ... )" (unfortunately using
+ // unspecified_bool_type here wouldn't help with ambiguity between all the
+ // different conversions to pointers)
+ operator bool() const { return m_str != NULL; }
+
+ // at least VC6 and VC7 also need this one or they complain about ambiguity
+ // for !anystr expressions
+ bool operator!() const { return !((bool)*this); }
+
+
+ // and these are the conversions operator which allow to assign the result
+ // of FuncReturningAnyStrPtr() to either char* or wxChar* (i.e. wchar_t*)
+ operator const char *() const
+ {
+ if ( !m_str )
+ return NULL;
+
+ // check if the string is convertible to char at all
+ //
+ // notice that this pointer points into wxString internal buffer
+ // containing its char* representation and so it can be kept for as
+ // long as wxString is not modified -- which is long enough for our
+ // needs
+ const char *p = m_str->c_str().AsChar();
+ if ( *p )
+ {
+ // find the offset of the character corresponding to this iterator
+ // position in bytes: we don't have any direct way to do it so we
+ // need to redo the conversion again for the part of the string
+ // before the iterator to find its length in bytes in current
+ // locale
+ //
+ // NB: conversion won't fail as it succeeded for the entire string
+ p += strlen(wxString(m_str->begin(), m_iter).mb_str());
+ }
+ //else: conversion failed, return "" as we can't do anything else
+
+ return p;
+ }
+
+ operator const wchar_t *() const
+ {
+ if ( !m_str )
+ return NULL;
+
+ // no complications with wide strings (as long as we discount
+ // surrogates as we do for now)
+ //
+ // just remember that this works as long as wxString keeps an internal
+ // buffer with its wide wide char representation, just as with AsChar()
+ // above
+ return m_str->c_str().AsWChar() + (m_iter - m_str->begin());
+ }
+
+ // Because the objects of this class are only used as return type for
+ // functions which can return NULL we can skip providing dereferencing
+ // operators: the code using this class must test it for NULL first and if
+ // it does anything else with it it has to assign it to either char* or
+ // wchar_t* itself, before dereferencing.
+ //
+ // IOW this
+ //
+ // if ( *FuncReturningAnyStrPtr() )
+ //
+ // is invalid because it could crash. And this
+ //
+ // const char *p = FuncReturningAnyStrPtr();
+ // if ( p && *p )
+ //
+ // already works fine.
+
+private:
+ // the original string and the position in it we correspond to, if the
+ // string is NULL this object is NULL pointer-like
+ const wxString * const m_str;
+ const wxString::const_iterator m_iter;
+
+ wxDECLARE_NO_ASSIGN_CLASS(wxAnyStrPtr);
+};
+
+#endif // _WX_ANYSTR_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/app.h
+// Purpose: wxAppBase class and macros used for declaration of wxApp
+// derived class in the user code
+// Author: Julian Smart
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_APP_H_BASE_
+#define _WX_APP_H_BASE_
+
+// ----------------------------------------------------------------------------
+// headers we have to include here
+// ----------------------------------------------------------------------------
+
+#include "wx/event.h" // for the base class
+#include "wx/eventfilter.h" // (and another one)
+#include "wx/build.h"
+#include "wx/cmdargs.h" // for wxCmdLineArgsArray used by wxApp::argv
+#include "wx/init.h" // we must declare wxEntry()
+#include "wx/intl.h" // for wxLayoutDirection
+#include "wx/log.h" // for wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD()
+
+class WXDLLIMPEXP_FWD_BASE wxAppConsole;
+class WXDLLIMPEXP_FWD_BASE wxAppTraits;
+class WXDLLIMPEXP_FWD_BASE wxCmdLineParser;
+class WXDLLIMPEXP_FWD_BASE wxEventLoopBase;
+class WXDLLIMPEXP_FWD_BASE wxMessageOutput;
+
+#if wxUSE_GUI
+ struct WXDLLIMPEXP_FWD_CORE wxVideoMode;
+ class WXDLLIMPEXP_FWD_CORE wxWindow;
+#endif
+
+// this macro should be used in any main() or equivalent functions defined in wx
+#define wxDISABLE_DEBUG_SUPPORT() \
+ wxDISABLE_ASSERTS_IN_RELEASE_BUILD(); \
+ wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD()
+
+// ----------------------------------------------------------------------------
+// typedefs
+// ----------------------------------------------------------------------------
+
+// the type of the function used to create a wxApp object on program start up
+typedef wxAppConsole* (*wxAppInitializerFunction)();
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+enum
+{
+ wxPRINT_WINDOWS = 1,
+ wxPRINT_POSTSCRIPT = 2
+};
+
+// ----------------------------------------------------------------------------
+// global variables
+// ----------------------------------------------------------------------------
+
+// use of this list is strongly deprecated, use wxApp ScheduleForDestruction()
+// and IsScheduledForDestruction() methods instead of this list directly, it
+// is here for compatibility purposes only
+extern WXDLLIMPEXP_DATA_BASE(wxList) wxPendingDelete;
+
+// ----------------------------------------------------------------------------
+// wxAppConsoleBase: wxApp for non-GUI applications
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxAppConsoleBase : public wxEvtHandler,
+ public wxEventFilter
+{
+public:
+ // ctor and dtor
+ wxAppConsoleBase();
+ virtual ~wxAppConsoleBase();
+
+
+ // the virtual functions which may/must be overridden in the derived class
+ // -----------------------------------------------------------------------
+
+ // This is the very first function called for a newly created wxApp object,
+ // it is used by the library to do the global initialization. If, for some
+ // reason, you must override it (instead of just overriding OnInit(), as
+ // usual, for app-specific initializations), do not forget to call the base
+ // class version!
+ virtual bool Initialize(int& argc, wxChar **argv);
+
+ // This gives wxCocoa a chance to call OnInit() with a memory pool in place
+ virtual bool CallOnInit() { return OnInit(); }
+
+ // Called before OnRun(), this is a good place to do initialization -- if
+ // anything fails, return false from here to prevent the program from
+ // continuing. The command line is normally parsed here, call the base
+ // class OnInit() to do it.
+ virtual bool OnInit();
+
+ // This is the replacement for the normal main(): all program work should
+ // be done here. When OnRun() returns, the programs starts shutting down.
+ virtual int OnRun();
+
+ // Called before the first events are handled, called from within MainLoop()
+ virtual void OnLaunched();
+
+ // This is called by wxEventLoopBase::SetActive(): you should put the code
+ // which needs an active event loop here.
+ // Note that this function is called whenever an event loop is activated;
+ // you may want to use wxEventLoopBase::IsMain() to perform initialization
+ // specific for the app's main event loop.
+ virtual void OnEventLoopEnter(wxEventLoopBase* WXUNUSED(loop)) {}
+
+ // This is only called if OnInit() returned true so it's a good place to do
+ // any cleanup matching the initializations done there.
+ virtual int OnExit();
+
+ // This is called by wxEventLoopBase::OnExit() for each event loop which
+ // is exited.
+ virtual void OnEventLoopExit(wxEventLoopBase* WXUNUSED(loop)) {}
+
+ // This is the very last function called on wxApp object before it is
+ // destroyed. If you override it (instead of overriding OnExit() as usual)
+ // do not forget to call the base class version!
+ virtual void CleanUp();
+
+ // Called when a fatal exception occurs, this function should take care not
+ // to do anything which might provoke a nested exception! It may be
+ // overridden if you wish to react somehow in non-default way (core dump
+ // under Unix, application crash under Windows) to fatal program errors,
+ // however extreme care should be taken if you don't want this function to
+ // crash.
+ virtual void OnFatalException() { }
+
+ // Called from wxExit() function, should terminate the application a.s.a.p.
+ virtual void Exit();
+
+
+ // application info: name, description, vendor
+ // -------------------------------------------
+
+ // NB: all these should be set by the application itself, there are no
+ // reasonable default except for the application name which is taken to
+ // be argv[0]
+
+ // set/get the application name
+ wxString GetAppName() const;
+ void SetAppName(const wxString& name) { m_appName = name; }
+
+ // set/get the application display name: the display name is the name
+ // shown to the user in titles, reports, etc while the app name is
+ // used for paths, config, and other places the user doesn't see
+ //
+ // by default the display name is the same as app name or a capitalized
+ // version of the program if app name was not set neither but it's
+ // usually better to set it explicitly to something nicer
+ wxString GetAppDisplayName() const;
+
+ void SetAppDisplayName(const wxString& name) { m_appDisplayName = name; }
+
+ // set/get the app class name
+ wxString GetClassName() const { return m_className; }
+ void SetClassName(const wxString& name) { m_className = name; }
+
+ // set/get the vendor name
+ const wxString& GetVendorName() const { return m_vendorName; }
+ void SetVendorName(const wxString& name) { m_vendorName = name; }
+
+ // set/get the vendor display name: the display name is shown
+ // in titles/reports/dialogs to the user, while the vendor name
+ // is used in some areas such as wxConfig, wxStandardPaths, etc
+ const wxString& GetVendorDisplayName() const
+ {
+ return m_vendorDisplayName.empty() ? GetVendorName()
+ : m_vendorDisplayName;
+ }
+ void SetVendorDisplayName(const wxString& name)
+ {
+ m_vendorDisplayName = name;
+ }
+
+
+ // cmd line parsing stuff
+ // ----------------------
+
+ // all of these methods may be overridden in the derived class to
+ // customize the command line parsing (by default only a few standard
+ // options are handled)
+ //
+ // you also need to call wxApp::OnInit() from YourApp::OnInit() for all
+ // this to work
+
+#if wxUSE_CMDLINE_PARSER
+ // this one is called from OnInit() to add all supported options
+ // to the given parser (don't forget to call the base class version if you
+ // override it!)
+ virtual void OnInitCmdLine(wxCmdLineParser& parser);
+
+ // called after successfully parsing the command line, return true
+ // to continue and false to exit (don't forget to call the base class
+ // version if you override it!)
+ virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
+
+ // called if "--help" option was specified, return true to continue
+ // and false to exit
+ virtual bool OnCmdLineHelp(wxCmdLineParser& parser);
+
+ // called if incorrect command line options were given, return
+ // false to abort and true to continue
+ virtual bool OnCmdLineError(wxCmdLineParser& parser);
+#endif // wxUSE_CMDLINE_PARSER
+
+
+ // miscellaneous customization functions
+ // -------------------------------------
+
+ // create the app traits object to which we delegate for everything which
+ // either should be configurable by the user (then he can change the
+ // default behaviour simply by overriding CreateTraits() and returning his
+ // own traits object) or which is GUI/console dependent as then wxAppTraits
+ // allows us to abstract the differences behind the common facade
+ wxAppTraits *GetTraits();
+
+ // this function provides safer access to traits object than
+ // wxTheApp->GetTraits() during startup or termination when the global
+ // application object itself may be unavailable
+ //
+ // of course, it still returns NULL in this case and the caller must check
+ // for it
+ static wxAppTraits *GetTraitsIfExists();
+
+ // Return some valid traits object.
+ //
+ // This method checks if we have wxTheApp and returns its traits if it does
+ // exist and the traits are non-NULL, similarly to GetTraitsIfExists(), but
+ // falls back to wxConsoleAppTraits to ensure that it always returns
+ // something valid.
+ static wxAppTraits& GetValidTraits();
+
+ // returns the main event loop instance, i.e. the event loop which is started
+ // by OnRun() and which dispatches all events sent from the native toolkit
+ // to the application (except when new event loops are temporarily set-up).
+ // The returned value maybe NULL. Put initialization code which needs a
+ // non-NULL main event loop into OnEventLoopEnter().
+ wxEventLoopBase* GetMainLoop() const
+ { return m_mainLoop; }
+
+ // This function sets the C locale to the default locale for the current
+ // environment. It is advised to call this to ensure that the underlying
+ // toolkit uses the locale in which the numbers and monetary amounts are
+ // shown in the format expected by user and so on.
+ //
+ // Notice that this does _not_ change the global C++ locale, you need to do
+ // it explicitly if you want.
+ //
+ // Finally, notice that while this function is virtual, it is not supposed
+ // to be overridden outside of the library itself.
+ virtual void SetCLocale();
+
+
+ // event processing functions
+ // --------------------------
+
+ // Implement the inherited wxEventFilter method but just return -1 from it
+ // to indicate that default processing should take place.
+ virtual int FilterEvent(wxEvent& event);
+
+ // return true if we're running event loop, i.e. if the events can
+ // (already) be dispatched
+ static bool IsMainLoopRunning();
+
+#if wxUSE_EXCEPTIONS
+ // execute the functor to handle the given event
+ //
+ // this is a generalization of HandleEvent() below and the base class
+ // implementation of CallEventHandler() still calls HandleEvent() for
+ // compatibility for functors which are just wxEventFunctions (i.e. methods
+ // of wxEvtHandler)
+ virtual void CallEventHandler(wxEvtHandler *handler,
+ wxEventFunctor& functor,
+ wxEvent& event) const;
+
+ // call the specified handler on the given object with the given event
+ //
+ // this method only exists to allow catching the exceptions thrown by any
+ // event handler, it would lead to an extra (useless) virtual function call
+ // if the exceptions were not used, so it doesn't even exist in that case
+ virtual void HandleEvent(wxEvtHandler *handler,
+ wxEventFunction func,
+ wxEvent& event) const;
+
+ // Called when an unhandled C++ exception occurs inside OnRun(): note that
+ // the main event loop has already terminated by now and the program will
+ // exit, if you need to really handle the exceptions you need to override
+ // OnExceptionInMainLoop()
+ virtual void OnUnhandledException();
+
+ // Function called if an uncaught exception is caught inside the main
+ // event loop: it may return true to continue running the event loop or
+ // false to stop it (in the latter case it may rethrow the exception as
+ // well)
+ virtual bool OnExceptionInMainLoop();
+
+#endif // wxUSE_EXCEPTIONS
+
+
+ // pending events
+ // --------------
+
+ // IMPORTANT: all these methods conceptually belong to wxEventLoopBase
+ // but for many reasons we need to allow queuing of events
+ // even when there's no event loop (e.g. in wxApp::OnInit);
+ // this feature is used e.g. to queue events on secondary threads
+ // or in wxPython to use wx.CallAfter before the GUI is initialized
+
+ // process all events in the m_handlersWithPendingEvents list -- it is necessary
+ // to call this function to process posted events. This happens during each
+ // event loop iteration in GUI mode but if there is no main loop, it may be
+ // also called directly.
+ virtual void ProcessPendingEvents();
+
+ // check if there are pending events on global pending event list
+ bool HasPendingEvents() const;
+
+ // temporary suspends processing of the pending events
+ void SuspendProcessingOfPendingEvents();
+
+ // resume processing of the pending events previously stopped because of a
+ // call to SuspendProcessingOfPendingEvents()
+ void ResumeProcessingOfPendingEvents();
+
+ // called by ~wxEvtHandler to (eventually) remove the handler from the list of
+ // the handlers with pending events
+ void RemovePendingEventHandler(wxEvtHandler* toRemove);
+
+ // adds an event handler to the list of the handlers with pending events
+ void AppendPendingEventHandler(wxEvtHandler* toAppend);
+
+ // moves the event handler from the list of the handlers with pending events
+ //to the list of the handlers with _delayed_ pending events
+ void DelayPendingEventHandler(wxEvtHandler* toDelay);
+
+ // deletes the current pending events
+ void DeletePendingEvents();
+
+
+ // delayed destruction
+ // -------------------
+
+ // If an object may have pending events for it, it shouldn't be deleted
+ // immediately as this would result in a crash when trying to handle these
+ // events: instead, it should be scheduled for destruction and really
+ // destroyed only after processing all pending events.
+ //
+ // Notice that this is only possible if we have a running event loop,
+ // otherwise the object is just deleted directly by ScheduleForDestruction()
+ // and IsScheduledForDestruction() always returns false.
+
+ // schedule the object for destruction in the near future
+ void ScheduleForDestruction(wxObject *object);
+
+ // return true if the object is scheduled for destruction
+ bool IsScheduledForDestruction(wxObject *object) const;
+
+
+ // wxEventLoop-related methods
+ // ---------------------------
+
+ // all these functions are forwarded to the corresponding methods of the
+ // currently active event loop -- and do nothing if there is none
+ virtual bool Pending();
+ virtual bool Dispatch();
+
+ virtual int MainLoop();
+ virtual void ExitMainLoop();
+
+ bool Yield(bool onlyIfNeeded = false);
+
+ virtual void WakeUpIdle();
+
+ // this method is called by the active event loop when there are no events
+ // to process
+ //
+ // by default it generates the idle events and if you override it in your
+ // derived class you should call the base class version to ensure that idle
+ // events are still sent out
+ virtual bool ProcessIdle();
+
+ // this virtual function is overridden in GUI wxApp to always return true
+ // as GUI applications always have an event loop -- but console ones may
+ // have it or not, so it simply returns true if already have an event loop
+ // running but false otherwise
+ virtual bool UsesEventLoop() const;
+
+
+ // debugging support
+ // -----------------
+
+ // this function is called when an assert failure occurs, the base class
+ // version does the normal processing (i.e. shows the usual assert failure
+ // dialog box)
+ //
+ // the arguments are the location of the failed assert (func may be empty
+ // if the compiler doesn't support C99 __FUNCTION__), the text of the
+ // assert itself and the user-specified message
+ virtual void OnAssertFailure(const wxChar *file,
+ int line,
+ const wxChar *func,
+ const wxChar *cond,
+ const wxChar *msg);
+
+ // old version of the function without func parameter, for compatibility
+ // only, override OnAssertFailure() in the new code
+ virtual void OnAssert(const wxChar *file,
+ int line,
+ const wxChar *cond,
+ const wxChar *msg);
+
+ // check that the wxBuildOptions object (constructed in the application
+ // itself, usually the one from wxIMPLEMENT_APP() macro) matches the build
+ // options of the library and abort if it doesn't
+ static bool CheckBuildOptions(const char *optionsSignature,
+ const char *componentName);
+
+ // implementation only from now on
+ // -------------------------------
+
+ // helpers for dynamic wxApp construction
+ static void SetInitializerFunction(wxAppInitializerFunction fn)
+ { ms_appInitFn = fn; }
+ static wxAppInitializerFunction GetInitializerFunction()
+ { return ms_appInitFn; }
+
+ // accessors for ms_appInstance field (external code might wish to modify
+ // it, this is why we provide a setter here as well, but you should really
+ // know what you're doing if you call it), wxTheApp is usually used instead
+ // of GetInstance()
+ static wxAppConsole *GetInstance() { return ms_appInstance; }
+ static void SetInstance(wxAppConsole *app) { ms_appInstance = app; }
+
+
+ // command line arguments (public for backwards compatibility)
+ int argc;
+
+ // this object is implicitly convertible to either "char**" (traditional
+ // type of argv parameter of main()) or to "wchar_t **" (for compatibility
+ // with Unicode build in previous wx versions and because the command line
+ // can, in pr
+#if wxUSE_UNICODE
+ wxCmdLineArgsArray argv;
+#else
+ char **argv;
+#endif
+
+protected:
+ // delete all objects in wxPendingDelete list
+ //
+ // called from ProcessPendingEvents()
+ void DeletePendingObjects();
+
+ // the function which creates the traits object when GetTraits() needs it
+ // for the first time
+ virtual wxAppTraits *CreateTraits();
+
+ // function used for dynamic wxApp creation
+ static wxAppInitializerFunction ms_appInitFn;
+
+ // the one and only global application object
+ static wxAppConsole *ms_appInstance;
+
+ // create main loop from AppTraits or return NULL if
+ // there is no main loop implementation
+ wxEventLoopBase *CreateMainLoop();
+
+ // application info (must be set from the user code)
+ wxString m_vendorName, // vendor name ("acme")
+ m_vendorDisplayName, // vendor display name (e.g. "ACME Inc")
+ m_appName, // app name ("myapp")
+ m_appDisplayName, // app display name ("My Application")
+ m_className; // class name
+
+ // the class defining the application behaviour, NULL initially and created
+ // by GetTraits() when first needed
+ wxAppTraits *m_traits;
+
+ // the main event loop of the application (may be NULL if the loop hasn't
+ // been started yet or has already terminated)
+ wxEventLoopBase *m_mainLoop;
+
+
+ // pending events management vars:
+
+ // the array of the handlers with pending events which needs to be processed
+ // inside ProcessPendingEvents()
+ wxEvtHandlerArray m_handlersWithPendingEvents;
+
+ // helper array used by ProcessPendingEvents() to store the event handlers
+ // which have pending events but of these events none can be processed right now
+ // (because of a call to wxEventLoop::YieldFor() which asked to selectively process
+ // pending events)
+ wxEvtHandlerArray m_handlersWithPendingDelayedEvents;
+
+#if wxUSE_THREADS
+ // this critical section protects both the lists above
+ wxCriticalSection m_handlersWithPendingEventsLocker;
+#endif
+
+ // flag modified by Suspend/ResumeProcessingOfPendingEvents()
+ bool m_bDoPendingEventProcessing;
+
+ friend class WXDLLIMPEXP_FWD_BASE wxEvtHandler;
+
+ // the application object is a singleton anyhow, there is no sense in
+ // copying it
+ wxDECLARE_NO_COPY_CLASS(wxAppConsoleBase);
+};
+
+#if defined(__UNIX__) && !defined(__WXMSW__)
+ #include "wx/unix/app.h"
+#else
+ // this has to be a class and not a typedef as we forward declare it
+ class wxAppConsole : public wxAppConsoleBase { };
+#endif
+
+// ----------------------------------------------------------------------------
+// wxAppBase: the common part of wxApp implementations for all platforms
+// ----------------------------------------------------------------------------
+
+#if wxUSE_GUI
+
+class WXDLLIMPEXP_CORE wxAppBase : public wxAppConsole
+{
+public:
+ wxAppBase();
+ virtual ~wxAppBase();
+
+ // the virtual functions which may/must be overridden in the derived class
+ // -----------------------------------------------------------------------
+
+ // very first initialization function
+ //
+ // Override: very rarely
+ virtual bool Initialize(int& argc, wxChar **argv);
+
+ // a platform-dependent version of OnInit(): the code here is likely to
+ // depend on the toolkit. default version does nothing.
+ //
+ // Override: rarely.
+ virtual bool OnInitGui();
+
+ // called to start program execution - the default version just enters
+ // the main GUI loop in which events are received and processed until
+ // the last window is not deleted (if GetExitOnFrameDelete) or
+ // ExitMainLoop() is called. In console mode programs, the execution
+ // of the program really starts here
+ //
+ // Override: rarely in GUI applications, always in console ones.
+ virtual int OnRun();
+
+ // a matching function for OnInit()
+ virtual int OnExit();
+
+ // very last clean up function
+ //
+ // Override: very rarely
+ virtual void CleanUp();
+
+
+ // the worker functions - usually not used directly by the user code
+ // -----------------------------------------------------------------
+
+ // safer alternatives to Yield(), using wxWindowDisabler
+ virtual bool SafeYield(wxWindow *win, bool onlyIfNeeded);
+ virtual bool SafeYieldFor(wxWindow *win, long eventsToProcess);
+
+ // this virtual function is called in the GUI mode when the application
+ // becomes idle and normally just sends wxIdleEvent to all interested
+ // parties
+ //
+ // it should return true if more idle events are needed, false if not
+ virtual bool ProcessIdle();
+
+ // override base class version: GUI apps always use an event loop
+ virtual bool UsesEventLoop() const { return true; }
+
+
+ // top level window functions
+ // --------------------------
+
+ // return true if our app has focus
+ virtual bool IsActive() const { return m_isActive; }
+
+ // set the "main" top level window
+ void SetTopWindow(wxWindow *win) { m_topWindow = win; }
+
+ // return the "main" top level window (if it hadn't been set previously
+ // with SetTopWindow(), will return just some top level window and, if
+ // there are none, will return NULL)
+ virtual wxWindow *GetTopWindow() const;
+
+ // control the exit behaviour: by default, the program will exit the
+ // main loop (and so, usually, terminate) when the last top-level
+ // program window is deleted. Beware that if you disable this behaviour
+ // (with SetExitOnFrameDelete(false)), you'll have to call
+ // ExitMainLoop() explicitly from somewhere.
+ void SetExitOnFrameDelete(bool flag)
+ { m_exitOnFrameDelete = flag ? Yes : No; }
+ bool GetExitOnFrameDelete() const
+ { return m_exitOnFrameDelete == Yes; }
+
+
+ // display mode, visual, printing mode, ...
+ // ------------------------------------------------------------------------
+
+ // Get display mode that is used use. This is only used in framebuffer
+ // wxWin ports such as wxDFB.
+ virtual wxVideoMode GetDisplayMode() const;
+ // Set display mode to use. This is only used in framebuffer wxWin
+ // ports such as wxDFB. This method should be called from
+ // wxApp::OnInitGui
+ virtual bool SetDisplayMode(const wxVideoMode& WXUNUSED(info)) { return true; }
+
+ // set use of best visual flag (see below)
+ void SetUseBestVisual( bool flag, bool forceTrueColour = false )
+ { m_useBestVisual = flag; m_forceTrueColour = forceTrueColour; }
+ bool GetUseBestVisual() const { return m_useBestVisual; }
+
+ // set/get printing mode: see wxPRINT_XXX constants.
+ //
+ // default behaviour is the normal one for Unix: always use PostScript
+ // printing.
+ virtual void SetPrintMode(int WXUNUSED(mode)) { }
+ int GetPrintMode() const { return wxPRINT_POSTSCRIPT; }
+
+ // Return the layout direction for the current locale or wxLayout_Default
+ // if it's unknown
+ virtual wxLayoutDirection GetLayoutDirection() const;
+
+ // Change the theme used by the application, return true on success.
+ virtual bool SetNativeTheme(const wxString& WXUNUSED(theme)) { return false; }
+
+
+ // command line parsing (GUI-specific)
+ // ------------------------------------------------------------------------
+
+#if wxUSE_CMDLINE_PARSER
+ virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
+ virtual void OnInitCmdLine(wxCmdLineParser& parser);
+#endif
+
+ // miscellaneous other stuff
+ // ------------------------------------------------------------------------
+
+ // called by toolkit-specific code to set the app status: active (we have
+ // focus) or not and also the last window which had focus before we were
+ // deactivated
+ virtual void SetActive(bool isActive, wxWindow *lastFocus);
+
+#if WXWIN_COMPATIBILITY_2_6
+ // returns true if the program is successfully initialized
+ wxDEPRECATED_MSG("always returns true now, don't call")
+ bool Initialized();
+#endif // WXWIN_COMPATIBILITY_2_6
+
+protected:
+ // override base class method to use GUI traits
+ virtual wxAppTraits *CreateTraits();
+
+
+ // the main top level window (may be NULL)
+ wxWindow *m_topWindow;
+
+ // if Yes, exit the main loop when the last top level window is deleted, if
+ // No don't do it and if Later -- only do it once we reach our OnRun()
+ //
+ // the explanation for using this strange scheme is given in appcmn.cpp
+ enum
+ {
+ Later = -1,
+ No,
+ Yes
+ } m_exitOnFrameDelete;
+
+ // true if the app wants to use the best visual on systems where
+ // more than one are available (Sun, SGI, XFree86 4.0 ?)
+ bool m_useBestVisual;
+ // force TrueColour just in case "best" isn't TrueColour
+ bool m_forceTrueColour;
+
+ // does any of our windows have focus?
+ bool m_isActive;
+
+ wxDECLARE_NO_COPY_CLASS(wxAppBase);
+};
+
+#if WXWIN_COMPATIBILITY_2_6
+ inline bool wxAppBase::Initialized() { return true; }
+#endif // WXWIN_COMPATIBILITY_2_6
+
+// ----------------------------------------------------------------------------
+// now include the declaration of the real class
+// ----------------------------------------------------------------------------
+
+#if defined(__WXMSW__)
+ #include "wx/msw/app.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/app.h"
+#elif defined(__WXDFB__)
+ #include "wx/dfb/app.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/app.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/app.h"
+#elif defined(__WXX11__)
+ #include "wx/x11/app.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/app.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/app.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/app.h"
+#endif
+
+#else // !GUI
+
+// wxApp is defined in core and we cannot define another one in wxBase,
+// so use the preprocessor to allow using wxApp in console programs too
+#define wxApp wxAppConsole
+
+#endif // GUI/!GUI
+
+// ----------------------------------------------------------------------------
+// the global data
+// ----------------------------------------------------------------------------
+
+// for compatibility, we define this macro to access the global application
+// object of type wxApp
+//
+// note that instead of using of wxTheApp in application code you should
+// consider using wxDECLARE_APP() after which you may call wxGetApp() which will
+// return the object of the correct type (i.e. MyApp and not wxApp)
+//
+// the cast is safe as in GUI build we only use wxApp, not wxAppConsole, and in
+// console mode it does nothing at all
+#define wxTheApp static_cast<wxApp*>(wxApp::GetInstance())
+
+// ----------------------------------------------------------------------------
+// global functions
+// ----------------------------------------------------------------------------
+
+// event loop related functions only work in GUI programs
+// ------------------------------------------------------
+
+// Force an exit from main loop
+WXDLLIMPEXP_BASE void wxExit();
+
+// avoid redeclaring this function here if it had been already declared by
+// wx/utils.h, this results in warnings from g++ with -Wredundant-decls
+#ifndef wx_YIELD_DECLARED
+#define wx_YIELD_DECLARED
+
+// Yield to other apps/messages
+WXDLLIMPEXP_CORE bool wxYield();
+
+#endif // wx_YIELD_DECLARED
+
+// Yield to other apps/messages
+WXDLLIMPEXP_BASE void wxWakeUpIdle();
+
+// ----------------------------------------------------------------------------
+// macros for dynamic creation of the application object
+// ----------------------------------------------------------------------------
+
+// Having a global instance of this class allows wxApp to be aware of the app
+// creator function. wxApp can then call this function to create a new app
+// object. Convoluted, but necessary.
+
+class WXDLLIMPEXP_BASE wxAppInitializer
+{
+public:
+ wxAppInitializer(wxAppInitializerFunction fn)
+ { wxApp::SetInitializerFunction(fn); }
+};
+
+// the code below defines a wxIMPLEMENT_WXWIN_MAIN macro which you can use if
+// your compiler really, really wants main() to be in your main program (e.g.
+// hello.cpp). Now wxIMPLEMENT_APP should add this code if required.
+
+// For compilers that support it, prefer to use wmain() as this ensures any
+// Unicode strings can be passed as command line parameters and not just those
+// representable in the current locale.
+#if wxUSE_UNICODE && defined(__VISUALC__)
+ #define wxIMPLEMENT_WXWIN_MAIN_CONSOLE \
+ int wmain(int argc, wchar_t **argv) \
+ { \
+ wxDISABLE_DEBUG_SUPPORT(); \
+ \
+ return wxEntry(argc, argv); \
+ }
+#else // Use standard main()
+ #define wxIMPLEMENT_WXWIN_MAIN_CONSOLE \
+ int main(int argc, char **argv) \
+ { \
+ wxDISABLE_DEBUG_SUPPORT(); \
+ \
+ return wxEntry(argc, argv); \
+ }
+#endif
+
+// port-specific header could have defined it already in some special way
+#ifndef wxIMPLEMENT_WXWIN_MAIN
+ #define wxIMPLEMENT_WXWIN_MAIN wxIMPLEMENT_WXWIN_MAIN_CONSOLE
+#endif // defined(wxIMPLEMENT_WXWIN_MAIN)
+
+#ifdef __WXUNIVERSAL__
+ #include "wx/univ/theme.h"
+
+ #ifdef wxUNIV_DEFAULT_THEME
+ #define wxIMPLEMENT_WX_THEME_SUPPORT \
+ WX_USE_THEME(wxUNIV_DEFAULT_THEME);
+ #else
+ #define wxIMPLEMENT_WX_THEME_SUPPORT
+ #endif
+#else
+ #define wxIMPLEMENT_WX_THEME_SUPPORT
+#endif
+
+// Use this macro if you want to define your own main() or WinMain() function
+// and call wxEntry() from there.
+#define wxIMPLEMENT_APP_NO_MAIN(appname) \
+ appname& wxGetApp() { return *static_cast<appname*>(wxApp::GetInstance()); } \
+ wxAppConsole *wxCreateApp() \
+ { \
+ wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \
+ "your program"); \
+ return new appname; \
+ } \
+ wxAppInitializer \
+ wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp)
+
+// Same as wxIMPLEMENT_APP() normally but doesn't include themes support in
+// wxUniversal builds
+#define wxIMPLEMENT_APP_NO_THEMES(appname) \
+ wxIMPLEMENT_WXWIN_MAIN \
+ wxIMPLEMENT_APP_NO_MAIN(appname)
+
+// Use this macro exactly once, the argument is the name of the wxApp-derived
+// class which is the class of your application.
+#define wxIMPLEMENT_APP(appname) \
+ wxIMPLEMENT_WX_THEME_SUPPORT \
+ wxIMPLEMENT_APP_NO_THEMES(appname)
+
+// Same as IMPLEMENT_APP(), but for console applications.
+#define wxIMPLEMENT_APP_CONSOLE(appname) \
+ wxIMPLEMENT_WXWIN_MAIN_CONSOLE \
+ wxIMPLEMENT_APP_NO_MAIN(appname)
+
+// this macro can be used multiple times and just allows you to use wxGetApp()
+// function
+#define wxDECLARE_APP(appname) \
+ extern appname& wxGetApp()
+
+
+// declare the stuff defined by wxIMPLEMENT_APP() macro, it's not really needed
+// anywhere else but at the very least it suppresses icc warnings about
+// defining extern symbols without prior declaration, and it shouldn't do any
+// harm
+extern wxAppConsole *wxCreateApp();
+extern wxAppInitializer wxTheAppInitializer;
+
+// ----------------------------------------------------------------------------
+// Compatibility macro aliases
+// ----------------------------------------------------------------------------
+
+// deprecated variants _not_ requiring a semicolon after them
+// (note that also some wx-prefixed macro do _not_ require a semicolon because
+// it's not always possible to force the compire to require it)
+
+#define IMPLEMENT_WXWIN_MAIN_CONSOLE wxIMPLEMENT_WXWIN_MAIN_CONSOLE
+#define IMPLEMENT_WXWIN_MAIN wxIMPLEMENT_WXWIN_MAIN
+#define IMPLEMENT_WX_THEME_SUPPORT wxIMPLEMENT_WX_THEME_SUPPORT
+#define IMPLEMENT_APP_NO_MAIN(app) wxIMPLEMENT_APP_NO_MAIN(app);
+#define IMPLEMENT_APP_NO_THEMES(app) wxIMPLEMENT_APP_NO_THEMES(app);
+#define IMPLEMENT_APP(app) wxIMPLEMENT_APP(app);
+#define IMPLEMENT_APP_CONSOLE(app) wxIMPLEMENT_APP_CONSOLE(app);
+#define DECLARE_APP(app) wxDECLARE_APP(app);
+
+#endif // _WX_APP_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/apptrait.h
+// Purpose: declaration of wxAppTraits and derived classes
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 19.06.2003
+// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_APPTRAIT_H_
+#define _WX_APPTRAIT_H_
+
+#include "wx/string.h"
+#include "wx/platinfo.h"
+
+class WXDLLIMPEXP_FWD_BASE wxArrayString;
+class WXDLLIMPEXP_FWD_BASE wxConfigBase;
+class WXDLLIMPEXP_FWD_BASE wxEventLoopBase;
+#if wxUSE_FONTMAP
+ class WXDLLIMPEXP_FWD_CORE wxFontMapper;
+#endif // wxUSE_FONTMAP
+class WXDLLIMPEXP_FWD_BASE wxLog;
+class WXDLLIMPEXP_FWD_BASE wxMessageOutput;
+class WXDLLIMPEXP_FWD_BASE wxObject;
+class WXDLLIMPEXP_FWD_CORE wxRendererNative;
+class WXDLLIMPEXP_FWD_BASE wxStandardPaths;
+class WXDLLIMPEXP_FWD_BASE wxString;
+class WXDLLIMPEXP_FWD_BASE wxTimer;
+class WXDLLIMPEXP_FWD_BASE wxTimerImpl;
+
+class wxSocketManager;
+
+
+// ----------------------------------------------------------------------------
+// wxAppTraits: this class defines various configurable aspects of wxApp
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxAppTraitsBase
+{
+public:
+ // needed since this class declares virtual members
+ virtual ~wxAppTraitsBase() { }
+
+ // hooks for working with the global objects, may be overridden by the user
+ // ------------------------------------------------------------------------
+
+#if wxUSE_CONFIG
+ // create the default configuration object (base class version is
+ // implemented in config.cpp and creates wxRegConfig for wxMSW and
+ // wxFileConfig for all the other platforms)
+ virtual wxConfigBase *CreateConfig();
+#endif // wxUSE_CONFIG
+
+#if wxUSE_LOG
+ // create the default log target
+ virtual wxLog *CreateLogTarget() = 0;
+#endif // wxUSE_LOG
+
+ // create the global object used for printing out messages
+ virtual wxMessageOutput *CreateMessageOutput() = 0;
+
+#if wxUSE_FONTMAP
+ // create the global font mapper object used for encodings/charset mapping
+ virtual wxFontMapper *CreateFontMapper() = 0;
+#endif // wxUSE_FONTMAP
+
+ // get the renderer to use for drawing the generic controls (return value
+ // may be NULL in which case the default renderer for the current platform
+ // is used); this is used in GUI only and always returns NULL in console
+ //
+ // NB: returned pointer will be deleted by the caller
+ virtual wxRendererNative *CreateRenderer() = 0;
+
+ // wxStandardPaths object is normally the same for wxBase and wxGUI
+ // except in the case of wxMac and wxCocoa
+ virtual wxStandardPaths& GetStandardPaths();
+
+
+ // functions abstracting differences between GUI and console modes
+ // ------------------------------------------------------------------------
+
+ // show the assert dialog with the specified message in GUI or just print
+ // the string to stderr in console mode
+ //
+ // base class version has an implementation (in spite of being pure
+ // virtual) in base/appbase.cpp which can be called as last resort.
+ //
+ // return true to suppress subsequent asserts, false to continue as before
+ virtual bool ShowAssertDialog(const wxString& msg) = 0;
+
+ // return true if fprintf(stderr) goes somewhere, false otherwise
+ virtual bool HasStderr() = 0;
+
+#if wxUSE_SOCKETS
+ // this function is used by wxNet library to set the default socket manager
+ // to use: doing it like this allows us to keep all socket-related code in
+ // wxNet instead of having to pull it in wxBase itself as we'd have to do
+ // if we really implemented wxSocketManager here
+ //
+ // we don't take ownership of this pointer, it should have a lifetime
+ // greater than that of any socket (e.g. be a pointer to a static object)
+ static void SetDefaultSocketManager(wxSocketManager *manager)
+ {
+ ms_manager = manager;
+ }
+
+ // return socket manager: this is usually different for console and GUI
+ // applications (although some ports use the same implementation for both)
+ virtual wxSocketManager *GetSocketManager() { return ms_manager; }
+#endif
+
+ // create a new, port specific, instance of the event loop used by wxApp
+ virtual wxEventLoopBase *CreateEventLoop() = 0;
+
+#if wxUSE_TIMER
+ // return platform and toolkit dependent wxTimer implementation
+ virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer) = 0;
+#endif
+
+#if wxUSE_THREADS
+ virtual void MutexGuiEnter();
+ virtual void MutexGuiLeave();
+#endif
+
+ // functions returning port-specific information
+ // ------------------------------------------------------------------------
+
+ // return information about the (native) toolkit currently used and its
+ // runtime (not compile-time) version.
+ // returns wxPORT_BASE for console applications and one of the remaining
+ // wxPORT_* values for GUI applications.
+ virtual wxPortId GetToolkitVersion(int *majVer = NULL, int *minVer = NULL) const = 0;
+
+ // return true if the port is using wxUniversal for the GUI, false if not
+ virtual bool IsUsingUniversalWidgets() const = 0;
+
+ // return the name of the Desktop Environment such as
+ // "KDE" or "GNOME". May return an empty string.
+ virtual wxString GetDesktopEnvironment() const = 0;
+
+ // returns a short string to identify the block of the standard command
+ // line options parsed automatically by current port: if this string is
+ // empty, there are no such options, otherwise the function also fills
+ // passed arrays with the names and the descriptions of those options.
+ virtual wxString GetStandardCmdLineOptions(wxArrayString& names,
+ wxArrayString& desc) const
+ {
+ wxUnusedVar(names);
+ wxUnusedVar(desc);
+
+ return wxEmptyString;
+ }
+
+
+protected:
+#if wxUSE_STACKWALKER
+ // utility function: returns the stack frame as a plain wxString
+ virtual wxString GetAssertStackTrace();
+#endif
+
+private:
+ static wxSocketManager *ms_manager;
+};
+
+// ----------------------------------------------------------------------------
+// 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)
+// ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port
+#if defined(__WIN32__)
+ #include "wx/msw/apptbase.h"
+#elif defined(__UNIX__) && !defined(__EMX__)
+ #include "wx/unix/apptbase.h"
+#elif defined(__OS2__)
+ #include "wx/os2/apptbase.h"
+#else // no platform-specific methods to add to wxAppTraits
+ // wxAppTraits must be a class because it was forward declared as class
+ class WXDLLIMPEXP_BASE wxAppTraits : public wxAppTraitsBase
+ {
+ };
+#endif // platform
+
+// ============================================================================
+// standard traits for console and GUI applications
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxConsoleAppTraitsBase: wxAppTraits implementation for the console apps
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxConsoleAppTraitsBase : public wxAppTraits
+{
+public:
+#if !wxUSE_CONSOLE_EVENTLOOP
+ virtual wxEventLoopBase *CreateEventLoop() { return NULL; }
+#endif // !wxUSE_CONSOLE_EVENTLOOP
+
+#if wxUSE_LOG
+ virtual wxLog *CreateLogTarget();
+#endif // wxUSE_LOG
+ virtual wxMessageOutput *CreateMessageOutput();
+#if wxUSE_FONTMAP
+ virtual wxFontMapper *CreateFontMapper();
+#endif // wxUSE_FONTMAP
+ virtual wxRendererNative *CreateRenderer();
+
+ virtual bool ShowAssertDialog(const wxString& msg);
+ virtual bool HasStderr();
+
+ // the GetToolkitVersion for console application is always the same
+ virtual wxPortId GetToolkitVersion(int *verMaj = NULL, int *verMin = NULL) const
+ {
+ // no toolkits (wxBase is for console applications without GUI support)
+ // NB: zero means "no toolkit", -1 means "not initialized yet"
+ // so we must use zero here!
+ if (verMaj) *verMaj = 0;
+ if (verMin) *verMin = 0;
+ return wxPORT_BASE;
+ }
+
+ virtual bool IsUsingUniversalWidgets() const { return false; }
+ virtual wxString GetDesktopEnvironment() const { return wxEmptyString; }
+};
+
+// ----------------------------------------------------------------------------
+// wxGUIAppTraitsBase: wxAppTraits implementation for the GUI apps
+// ----------------------------------------------------------------------------
+
+#if wxUSE_GUI
+
+class WXDLLIMPEXP_CORE wxGUIAppTraitsBase : public wxAppTraits
+{
+public:
+#if wxUSE_LOG
+ virtual wxLog *CreateLogTarget();
+#endif // wxUSE_LOG
+ virtual wxMessageOutput *CreateMessageOutput();
+#if wxUSE_FONTMAP
+ virtual wxFontMapper *CreateFontMapper();
+#endif // wxUSE_FONTMAP
+ virtual wxRendererNative *CreateRenderer();
+
+ virtual bool ShowAssertDialog(const wxString& msg);
+ virtual bool HasStderr();
+
+ virtual bool IsUsingUniversalWidgets() const
+ {
+ #ifdef __WXUNIVERSAL__
+ return true;
+ #else
+ return false;
+ #endif
+ }
+
+ virtual wxString GetDesktopEnvironment() const { return wxEmptyString; }
+};
+
+#endif // wxUSE_GUI
+
+// ----------------------------------------------------------------------------
+// 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(__WIN32__)
+ #include "wx/msw/apptrait.h"
+#elif defined(__OS2__)
+ #include "wx/os2/apptrait.h"
+#elif defined(__UNIX__)
+ #include "wx/unix/apptrait.h"
+#elif defined(__DOS__)
+ #include "wx/msdos/apptrait.h"
+#else
+ #if wxUSE_GUI
+ class wxGUIAppTraits : public wxGUIAppTraitsBase
+ {
+ };
+ #endif // wxUSE_GUI
+ class wxConsoleAppTraits: public wxConsoleAppTraitsBase
+ {
+ };
+#endif // platform
+
+#endif // _WX_APPTRAIT_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/archive.h
+// Purpose: Streams for archive formats
+// Author: Mike Wetherell
+// Copyright: (c) 2004 Mike Wetherell
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_ARCHIVE_H__
+#define _WX_ARCHIVE_H__
+
+#include "wx/defs.h"
+
+#if wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS
+
+#include "wx/stream.h"
+#include "wx/filename.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+// wxArchiveNotifier
+
+class WXDLLIMPEXP_BASE wxArchiveNotifier
+{
+public:
+ virtual ~wxArchiveNotifier() { }
+
+ virtual void OnEntryUpdated(class wxArchiveEntry& entry) = 0;
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+// wxArchiveEntry
+//
+// Holds an entry's meta data, such as filename and timestamp.
+
+class WXDLLIMPEXP_BASE wxArchiveEntry : public wxObject
+{
+public:
+ virtual ~wxArchiveEntry() { }
+
+ virtual wxDateTime GetDateTime() const = 0;
+ virtual wxFileOffset GetSize() const = 0;
+ virtual wxFileOffset GetOffset() const = 0;
+ virtual bool IsDir() const = 0;
+ virtual bool IsReadOnly() const = 0;
+ virtual wxString GetInternalName() const = 0;
+ virtual wxPathFormat GetInternalFormat() const = 0;
+ virtual wxString GetName(wxPathFormat format = wxPATH_NATIVE) const = 0;
+
+ virtual void SetDateTime(const wxDateTime& dt) = 0;
+ virtual void SetSize(wxFileOffset size) = 0;
+ virtual void SetIsDir(bool isDir = true) = 0;
+ virtual void SetIsReadOnly(bool isReadOnly = true) = 0;
+ virtual void SetName(const wxString& name,
+ wxPathFormat format = wxPATH_NATIVE) = 0;
+
+ wxArchiveEntry *Clone() const { return DoClone(); }
+
+ void SetNotifier(wxArchiveNotifier& notifier);
+ virtual void UnsetNotifier() { m_notifier = NULL; }
+
+protected:
+ wxArchiveEntry() : m_notifier(NULL) { }
+ wxArchiveEntry(const wxArchiveEntry& e) : wxObject(e), m_notifier(NULL) { }
+
+ virtual void SetOffset(wxFileOffset offset) = 0;
+ virtual wxArchiveEntry* DoClone() const = 0;
+
+ wxArchiveNotifier *GetNotifier() const { return m_notifier; }
+ wxArchiveEntry& operator=(const wxArchiveEntry& entry);
+
+private:
+ wxArchiveNotifier *m_notifier;
+
+ DECLARE_ABSTRACT_CLASS(wxArchiveEntry)
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+// wxArchiveInputStream
+//
+// GetNextEntry() returns an wxArchiveEntry object containing the meta-data
+// for the next entry in the archive (and gives away ownership). Reading from
+// the wxArchiveInputStream then returns the entry's data. Eof() becomes true
+// after an attempt has been made to read past the end of the entry's data.
+//
+// When there are no more entries, GetNextEntry() returns NULL and sets Eof().
+
+class WXDLLIMPEXP_BASE wxArchiveInputStream : public wxFilterInputStream
+{
+public:
+ typedef wxArchiveEntry entry_type;
+
+ virtual ~wxArchiveInputStream() { }
+
+ virtual bool OpenEntry(wxArchiveEntry& entry) = 0;
+ virtual bool CloseEntry() = 0;
+
+ wxArchiveEntry *GetNextEntry() { return DoGetNextEntry(); }
+
+ virtual char Peek() { return wxInputStream::Peek(); }
+
+protected:
+ wxArchiveInputStream(wxInputStream& stream, wxMBConv& conv);
+ wxArchiveInputStream(wxInputStream *stream, wxMBConv& conv);
+
+ virtual wxArchiveEntry *DoGetNextEntry() = 0;
+
+ wxMBConv& GetConv() const { return m_conv; }
+
+private:
+ wxMBConv& m_conv;
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+// wxArchiveOutputStream
+//
+// PutNextEntry is used to create a new entry in the output archive, then
+// the entry's data is written to the wxArchiveOutputStream.
+//
+// Only one entry can be open for output at a time; another call to
+// PutNextEntry closes the current entry and begins the next.
+//
+// The overload 'bool PutNextEntry(wxArchiveEntry *entry)' takes ownership
+// of the entry object.
+
+class WXDLLIMPEXP_BASE wxArchiveOutputStream : public wxFilterOutputStream
+{
+public:
+ virtual ~wxArchiveOutputStream() { }
+
+ virtual bool PutNextEntry(wxArchiveEntry *entry) = 0;
+
+ virtual bool PutNextEntry(const wxString& name,
+ const wxDateTime& dt = wxDateTime::Now(),
+ wxFileOffset size = wxInvalidOffset) = 0;
+
+ virtual bool PutNextDirEntry(const wxString& name,
+ const wxDateTime& dt = wxDateTime::Now()) = 0;
+
+ virtual bool CopyEntry(wxArchiveEntry *entry,
+ wxArchiveInputStream& stream) = 0;
+
+ virtual bool CopyArchiveMetaData(wxArchiveInputStream& stream) = 0;
+
+ virtual bool CloseEntry() = 0;
+
+protected:
+ wxArchiveOutputStream(wxOutputStream& stream, wxMBConv& conv);
+ wxArchiveOutputStream(wxOutputStream *stream, wxMBConv& conv);
+
+ wxMBConv& GetConv() const { return m_conv; }
+
+private:
+ wxMBConv& m_conv;
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+// wxArchiveIterator
+//
+// An input iterator that can be used to transfer an archive's catalog to
+// a container.
+
+#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR
+#include <iterator>
+#include <utility>
+
+template <class X, class Y> inline
+void _wxSetArchiveIteratorValue(
+ X& val, Y entry, void *WXUNUSED(d))
+{
+ val = X(entry);
+}
+template <class X, class Y, class Z> inline
+void _wxSetArchiveIteratorValue(
+ std::pair<X, Y>& val, Z entry, Z WXUNUSED(d))
+{
+ val = std::make_pair(X(entry->GetInternalName()), Y(entry));
+}
+
+#if defined _MSC_VER && _MSC_VER < 1300
+template <class Arc, class T = Arc::entry_type*>
+#else
+template <class Arc, class T = typename Arc::entry_type*>
+#endif
+class wxArchiveIterator
+{
+public:
+ typedef std::input_iterator_tag iterator_category;
+ typedef T value_type;
+ typedef ptrdiff_t difference_type;
+ typedef T* pointer;
+ typedef T& reference;
+
+ wxArchiveIterator() : m_rep(NULL) { }
+
+ wxArchiveIterator(Arc& arc) {
+ typename Arc::entry_type* entry = arc.GetNextEntry();
+ m_rep = entry ? new Rep(arc, entry) : NULL;
+ }
+
+ wxArchiveIterator(const wxArchiveIterator& it) : m_rep(it.m_rep) {
+ if (m_rep)
+ m_rep->AddRef();
+ }
+
+ ~wxArchiveIterator() {
+ if (m_rep)
+ m_rep->UnRef();
+ }
+
+ const T& operator *() const {
+ return m_rep->GetValue();
+ }
+
+ const T* operator ->() const {
+ return &**this;
+ }
+
+ wxArchiveIterator& operator =(const wxArchiveIterator& it) {
+ if (it.m_rep)
+ it.m_rep.AddRef();
+ if (m_rep)
+ this->m_rep.UnRef();
+ m_rep = it.m_rep;
+ return *this;
+ }
+
+ wxArchiveIterator& operator ++() {
+ m_rep = m_rep->Next();
+ return *this;
+ }
+
+ wxArchiveIterator operator ++(int) {
+ wxArchiveIterator it(*this);
+ ++(*this);
+ return it;
+ }
+
+ bool operator ==(const wxArchiveIterator& j) const {
+ return m_rep == j.m_rep;
+ }
+
+ bool operator !=(const wxArchiveIterator& j) const {
+ return !(*this == j);
+ }
+
+private:
+ class Rep {
+ Arc& m_arc;
+ typename Arc::entry_type* m_entry;
+ T m_value;
+ int m_ref;
+
+ public:
+ Rep(Arc& arc, typename Arc::entry_type* entry)
+ : m_arc(arc), m_entry(entry), m_value(), m_ref(1) { }
+ ~Rep()
+ { delete m_entry; }
+
+ void AddRef() {
+ m_ref++;
+ }
+
+ void UnRef() {
+ if (--m_ref == 0)
+ delete this;
+ }
+
+ Rep *Next() {
+ typename Arc::entry_type* entry = m_arc.GetNextEntry();
+ if (!entry) {
+ UnRef();
+ return NULL;
+ }
+ if (m_ref > 1) {
+ m_ref--;
+ return new Rep(m_arc, entry);
+ }
+ delete m_entry;
+ m_entry = entry;
+ m_value = T();
+ return this;
+ }
+
+ const T& GetValue() {
+ if (m_entry) {
+ _wxSetArchiveIteratorValue(m_value, m_entry, m_entry);
+ m_entry = NULL;
+ }
+ return m_value;
+ }
+ } *m_rep;
+};
+
+typedef wxArchiveIterator<wxArchiveInputStream> wxArchiveIter;
+typedef wxArchiveIterator<wxArchiveInputStream,
+ std::pair<wxString, wxArchiveEntry*> > wxArchivePairIter;
+
+#endif // wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR
+
+
+/////////////////////////////////////////////////////////////////////////////
+// wxArchiveClassFactory
+//
+// A wxArchiveClassFactory instance for a particular archive type allows
+// the creation of the other classes that may be needed.
+
+void WXDLLIMPEXP_BASE wxUseArchiveClasses();
+
+class WXDLLIMPEXP_BASE wxArchiveClassFactory : public wxFilterClassFactoryBase
+{
+public:
+ typedef wxArchiveEntry entry_type;
+ typedef wxArchiveInputStream instream_type;
+ typedef wxArchiveOutputStream outstream_type;
+ typedef wxArchiveNotifier notifier_type;
+#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR
+ typedef wxArchiveIter iter_type;
+ typedef wxArchivePairIter pairiter_type;
+#endif
+
+ virtual ~wxArchiveClassFactory() { }
+
+ wxArchiveEntry *NewEntry() const
+ { return DoNewEntry(); }
+ wxArchiveInputStream *NewStream(wxInputStream& stream) const
+ { return DoNewStream(stream); }
+ wxArchiveOutputStream *NewStream(wxOutputStream& stream) const
+ { return DoNewStream(stream); }
+ wxArchiveInputStream *NewStream(wxInputStream *stream) const
+ { return DoNewStream(stream); }
+ wxArchiveOutputStream *NewStream(wxOutputStream *stream) const
+ { return DoNewStream(stream); }
+
+ virtual wxString GetInternalName(
+ const wxString& name,
+ wxPathFormat format = wxPATH_NATIVE) const = 0;
+
+ // FIXME-UTF8: remove these from this file, they are used for ANSI
+ // build only
+ void SetConv(wxMBConv& conv) { m_pConv = &conv; }
+ wxMBConv& GetConv() const
+ { if (m_pConv) return *m_pConv; else return wxConvLocal; }
+
+ static const wxArchiveClassFactory *Find(const wxString& protocol,
+ wxStreamProtocolType type
+ = wxSTREAM_PROTOCOL);
+
+ static const wxArchiveClassFactory *GetFirst();
+ const wxArchiveClassFactory *GetNext() const { return m_next; }
+
+ void PushFront() { Remove(); m_next = sm_first; sm_first = this; }
+ void Remove();
+
+protected:
+ // old compilers don't support covarient returns, so 'Do' methods are
+ // used to simulate them
+ virtual wxArchiveEntry *DoNewEntry() const = 0;
+ virtual wxArchiveInputStream *DoNewStream(wxInputStream& stream) const = 0;
+ virtual wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const = 0;
+ virtual wxArchiveInputStream *DoNewStream(wxInputStream *stream) const = 0;
+ virtual wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const = 0;
+
+ wxArchiveClassFactory() : m_pConv(NULL), m_next(this) { }
+ wxArchiveClassFactory& operator=(const wxArchiveClassFactory& WXUNUSED(f))
+ { return *this; }
+
+private:
+ wxMBConv *m_pConv;
+ static wxArchiveClassFactory *sm_first;
+ wxArchiveClassFactory *m_next;
+
+ DECLARE_ABSTRACT_CLASS(wxArchiveClassFactory)
+};
+
+#endif // wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS
+
+#endif // _WX_ARCHIVE_H__
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/arrimpl.cpp
+// Purpose: helper file for implementation of dynamic lists
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 16.10.97
+// Copyright: (c) 1997 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+/*****************************************************************************
+ * Purpose: implements methods of "template" class declared in *
+ * DECLARE_OBJARRAY macro and which couldn't be implemented inline *
+ * (because they need the full definition of type T in scope) *
+ * *
+ * Usage: 1) #include dynarray.h *
+ * 2) WX_DECLARE_OBJARRAY *
+ * 3) #include arrimpl.cpp *
+ * 4) WX_DEFINE_OBJARRAY *
+ *****************************************************************************/
+
+// needed to resolve the conflict between global T and macro parameter T
+
+#define _WX_ERROR_REMOVE2(x) wxT("bad index in ") wxT(#x) wxT("::RemoveAt()")
+
+// macro implements remaining (not inline) methods of template list
+// (it's private to this file)
+#undef _DEFINE_OBJARRAY
+#define _DEFINE_OBJARRAY(T, name) \
+name::~name() \
+{ \
+ Empty(); \
+} \
+ \
+void name::DoCopy(const name& src) \
+{ \
+ for ( size_t ui = 0; ui < src.size(); ui++ ) \
+ Add(src[ui]); \
+} \
+ \
+name& name::operator=(const name& src) \
+{ \
+ Empty(); \
+ DoCopy(src); \
+ \
+ return *this; \
+} \
+ \
+name::name(const name& src) : wxArrayPtrVoid() \
+{ \
+ DoCopy(src); \
+} \
+ \
+void name::DoEmpty() \
+{ \
+ for ( size_t ui = 0; ui < size(); ui++ ) \
+ delete (T*)base_array::operator[](ui); \
+} \
+ \
+void name::RemoveAt(size_t uiIndex, size_t nRemove) \
+{ \
+ wxCHECK_RET( uiIndex < size(), _WX_ERROR_REMOVE2(name) ); \
+ \
+ for (size_t i = 0; i < nRemove; i++ ) \
+ delete (T*)base_array::operator[](uiIndex + i); \
+ \
+ base_array::erase(begin() + uiIndex, begin() + uiIndex + nRemove); \
+} \
+ \
+void name::Add(const T& item, size_t nInsert) \
+{ \
+ if (nInsert == 0) \
+ return; \
+ T* pItem = new T(item); \
+ size_t nOldSize = size(); \
+ if ( pItem != NULL ) \
+ base_array::insert(end(), nInsert, pItem); \
+ for (size_t i = 1; i < nInsert; i++) \
+ base_array::operator[](nOldSize + i) = new T(item); \
+} \
+ \
+void name::Insert(const T& item, size_t uiIndex, size_t nInsert) \
+{ \
+ if (nInsert == 0) \
+ return; \
+ T* pItem = new T(item); \
+ if ( pItem != NULL ) \
+ base_array::insert(begin() + uiIndex, nInsert, pItem); \
+ for (size_t i = 1; i < nInsert; i++) \
+ base_array::operator[](uiIndex + i) = new T(item); \
+} \
+ \
+int name::Index(const T& item, bool bFromEnd) const \
+{ \
+ if ( bFromEnd ) { \
+ if ( size() > 0 ) { \
+ size_t ui = size() - 1; \
+ do { \
+ if ( (T*)base_array::operator[](ui) == &item ) \
+ return static_cast<int>(ui); \
+ ui--; \
+ } \
+ while ( ui != 0 ); \
+ } \
+ } \
+ else { \
+ for( size_t ui = 0; ui < size(); ui++ ) { \
+ if( (T*)base_array::operator[](ui) == &item ) \
+ return static_cast<int>(ui); \
+ } \
+ } \
+ \
+ return wxNOT_FOUND; \
+}
+
+// redefine the macro so that now it will generate the class implementation
+// old value would provoke a compile-time error if this file is not included
+#undef WX_DEFINE_OBJARRAY
+#define WX_DEFINE_OBJARRAY(name) _DEFINE_OBJARRAY(_wxObjArray##name, name)
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/arrstr.h
+// Purpose: wxArrayString class
+// Author: Mattia Barbon and Vadim Zeitlin
+// Modified by:
+// Created: 07/07/03
+// Copyright: (c) 2003 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_ARRSTR_H
+#define _WX_ARRSTR_H
+
+#include "wx/defs.h"
+#include "wx/string.h"
+
+// these functions are only used in STL build now but we define them in any
+// case for compatibility with the existing code outside of the library which
+// could be using them
+inline int wxCMPFUNC_CONV wxStringSortAscending(wxString* s1, wxString* s2)
+{
+ return s1->Cmp(*s2);
+}
+
+inline int wxCMPFUNC_CONV wxStringSortDescending(wxString* s1, wxString* s2)
+{
+ return wxStringSortAscending(s2, s1);
+}
+
+#if wxUSE_STD_CONTAINERS
+
+#include "wx/dynarray.h"
+
+typedef int (wxCMPFUNC_CONV *CMPFUNCwxString)(wxString*, wxString*);
+typedef wxString _wxArraywxBaseArrayStringBase;
+_WX_DECLARE_BASEARRAY_2(_wxArraywxBaseArrayStringBase, wxBaseArrayStringBase,
+ wxArray_SortFunction<wxString>,
+ class WXDLLIMPEXP_BASE);
+WX_DEFINE_USER_EXPORTED_TYPEARRAY(wxString, wxArrayStringBase,
+ wxBaseArrayStringBase, WXDLLIMPEXP_BASE);
+_WX_DEFINE_SORTED_TYPEARRAY_2(wxString, wxSortedArrayStringBase,
+ wxBaseArrayStringBase, = wxStringSortAscending,
+ class WXDLLIMPEXP_BASE, CMPFUNCwxString);
+
+class WXDLLIMPEXP_BASE wxArrayString : public wxArrayStringBase
+{
+public:
+ // type of function used by wxArrayString::Sort()
+ typedef int (wxCMPFUNC_CONV *CompareFunction)(const wxString& first,
+ const wxString& second);
+
+ wxArrayString() { }
+ wxArrayString(const wxArrayString& a) : wxArrayStringBase(a) { }
+ wxArrayString(size_t sz, const char** a);
+ wxArrayString(size_t sz, const wchar_t** a);
+ wxArrayString(size_t sz, const wxString* a);
+
+ int Index(const wxString& str, bool bCase = true, bool bFromEnd = false) const;
+
+ void Sort(bool reverseOrder = false);
+ void Sort(CompareFunction function);
+ void Sort(CMPFUNCwxString function) { wxArrayStringBase::Sort(function); }
+
+ size_t Add(const wxString& string, size_t copies = 1)
+ {
+ wxArrayStringBase::Add(string, copies);
+ return size() - copies;
+ }
+};
+
+class WXDLLIMPEXP_BASE wxSortedArrayString : public wxSortedArrayStringBase
+{
+public:
+ wxSortedArrayString() : wxSortedArrayStringBase(wxStringSortAscending)
+ { }
+ wxSortedArrayString(const wxSortedArrayString& array)
+ : wxSortedArrayStringBase(array)
+ { }
+ wxSortedArrayString(const wxArrayString& src)
+ : wxSortedArrayStringBase(wxStringSortAscending)
+ {
+ reserve(src.size());
+
+ for ( size_t n = 0; n < src.size(); n++ )
+ Add(src[n]);
+ }
+
+ int Index(const wxString& str, bool bCase = true, bool bFromEnd = false) const;
+
+private:
+ void Insert()
+ {
+ wxFAIL_MSG( "wxSortedArrayString::Insert() is not to be used" );
+ }
+
+ void Sort()
+ {
+ wxFAIL_MSG( "wxSortedArrayString::Sort() is not to be used" );
+ }
+};
+
+#else // if !wxUSE_STD_CONTAINERS
+
+// this shouldn't be defined for compilers not supporting template methods or
+// without std::distance()
+//
+// FIXME-VC6: currently it's only not defined for VC6 in DLL build as it
+// doesn't export template methods from DLL correctly so even though
+// it compiles them fine, we get link errors when using wxArrayString
+#if !defined(__VISUALC6__) || !(defined(WXMAKINGDLL) || defined(WXUSINGDLL))
+ #define wxHAS_VECTOR_TEMPLATE_ASSIGN
+#endif
+
+#ifdef wxHAS_VECTOR_TEMPLATE_ASSIGN
+ #include "wx/beforestd.h"
+ #include <iterator>
+ #include "wx/afterstd.h"
+#endif // wxHAS_VECTOR_TEMPLATE_ASSIGN
+
+class WXDLLIMPEXP_BASE wxArrayString
+{
+public:
+ // type of function used by wxArrayString::Sort()
+ typedef int (wxCMPFUNC_CONV *CompareFunction)(const wxString& first,
+ const wxString& second);
+ // type of function used by wxArrayString::Sort(), for compatibility with
+ // wxArray
+ typedef int (wxCMPFUNC_CONV *CompareFunction2)(wxString* first,
+ wxString* second);
+
+ // constructors and destructor
+ // default ctor
+ wxArrayString() { Init(false); }
+ // if autoSort is true, the array is always sorted (in alphabetical order)
+ //
+ // NB: the reason for using int and not bool is that like this we can avoid
+ // using this ctor for implicit conversions from "const char *" (which
+ // we'd like to be implicitly converted to wxString instead!). This
+ // wouldn't be needed if the 'explicit' keyword was supported by all
+ // compilers, or if this was protected ctor for wxSortedArrayString,
+ // but we're stuck with it now.
+ wxEXPLICIT wxArrayString(int autoSort) { Init(autoSort != 0); }
+ // C string array ctor
+ wxArrayString(size_t sz, const char** a);
+ wxArrayString(size_t sz, const wchar_t** a);
+ // wxString string array ctor
+ wxArrayString(size_t sz, const wxString* a);
+ // copy ctor
+ wxArrayString(const wxArrayString& array);
+ // assignment operator
+ wxArrayString& operator=(const wxArrayString& src);
+ // not virtual, this class should not be derived from
+ ~wxArrayString();
+
+ // memory management
+ // empties the list, but doesn't release memory
+ void Empty();
+ // empties the list and releases memory
+ void Clear();
+ // preallocates memory for given number of items
+ void Alloc(size_t nCount);
+ // minimzes the memory usage (by freeing all extra memory)
+ void Shrink();
+
+ // simple accessors
+ // number of elements in the array
+ size_t GetCount() const { return m_nCount; }
+ // is it empty?
+ bool IsEmpty() const { return m_nCount == 0; }
+ // number of elements in the array (GetCount is preferred API)
+ size_t Count() const { return m_nCount; }
+
+ // items access (range checking is done in debug version)
+ // get item at position uiIndex
+ wxString& Item(size_t nIndex)
+ {
+ wxASSERT_MSG( nIndex < m_nCount,
+ wxT("wxArrayString: index out of bounds") );
+
+ return m_pItems[nIndex];
+ }
+ const wxString& Item(size_t nIndex) const { return const_cast<wxArrayString*>(this)->Item(nIndex); }
+
+ // same as Item()
+ wxString& operator[](size_t nIndex) { return Item(nIndex); }
+ const wxString& operator[](size_t nIndex) const { return Item(nIndex); }
+ // get last item
+ wxString& Last()
+ {
+ wxASSERT_MSG( !IsEmpty(),
+ wxT("wxArrayString: index out of bounds") );
+ return Item(GetCount() - 1);
+ }
+ const wxString& Last() const { return const_cast<wxArrayString*>(this)->Last(); }
+
+
+ // item management
+ // Search the element in the array, starting from the beginning if
+ // bFromEnd is false or from end otherwise. If bCase, comparison is case
+ // sensitive (default). Returns index of the first item matched or
+ // wxNOT_FOUND
+ int Index (const wxString& str, bool bCase = true, bool bFromEnd = false) const;
+ // add new element at the end (if the array is not sorted), return its
+ // index
+ size_t Add(const wxString& str, size_t nInsert = 1);
+ // add new element at given position
+ void Insert(const wxString& str, size_t uiIndex, size_t nInsert = 1);
+ // expand the array to have count elements
+ void SetCount(size_t count);
+ // remove first item matching this value
+ void Remove(const wxString& sz);
+ // remove item by index
+ void RemoveAt(size_t nIndex, size_t nRemove = 1);
+
+ // sorting
+ // sort array elements in alphabetical order (or reversed alphabetical
+ // order if reverseOrder parameter is true)
+ void Sort(bool reverseOrder = false);
+ // sort array elements using specified comparison function
+ void Sort(CompareFunction compareFunction);
+ void Sort(CompareFunction2 compareFunction);
+
+ // comparison
+ // compare two arrays case sensitively
+ bool operator==(const wxArrayString& a) const;
+ // compare two arrays case sensitively
+ bool operator!=(const wxArrayString& a) const { return !(*this == a); }
+
+ // STL-like interface
+ typedef wxString value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type* iterator;
+ typedef const value_type* const_iterator;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef int difference_type;
+ typedef size_t size_type;
+
+ // TODO: this code duplicates the one in dynarray.h
+ class reverse_iterator
+ {
+ typedef wxString value_type;
+ typedef value_type* pointer;
+ typedef value_type& reference;
+ typedef reverse_iterator itor;
+ friend itor operator+(int o, const itor& it);
+ friend itor operator+(const itor& it, int o);
+ friend itor operator-(const itor& it, int o);
+ friend difference_type operator -(const itor& i1, const itor& i2);
+ public:
+ pointer m_ptr;
+ reverse_iterator() : m_ptr(NULL) { }
+ wxEXPLICIT reverse_iterator(pointer ptr) : m_ptr(ptr) { }
+ reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { }
+ reference operator*() const { return *m_ptr; }
+ pointer operator->() const { return m_ptr; }
+ itor& operator++() { --m_ptr; return *this; }
+ const itor operator++(int)
+ { reverse_iterator tmp = *this; --m_ptr; return tmp; }
+ itor& operator--() { ++m_ptr; return *this; }
+ const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; }
+ bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; }
+ bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; }
+ };
+
+ class const_reverse_iterator
+ {
+ typedef wxString value_type;
+ typedef const value_type* pointer;
+ typedef const value_type& reference;
+ typedef const_reverse_iterator itor;
+ friend itor operator+(int o, const itor& it);
+ friend itor operator+(const itor& it, int o);
+ friend itor operator-(const itor& it, int o);
+ friend difference_type operator -(const itor& i1, const itor& i2);
+ public:
+ pointer m_ptr;
+ const_reverse_iterator() : m_ptr(NULL) { }
+ wxEXPLICIT const_reverse_iterator(pointer ptr) : m_ptr(ptr) { }
+ const_reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { }
+ const_reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { }
+ reference operator*() const { return *m_ptr; }
+ pointer operator->() const { return m_ptr; }
+ itor& operator++() { --m_ptr; return *this; }
+ const itor operator++(int)
+ { itor tmp = *this; --m_ptr; return tmp; }
+ itor& operator--() { ++m_ptr; return *this; }
+ const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; }
+ bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; }
+ bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; }
+ };
+
+ wxArrayString(const_iterator first, const_iterator last)
+ { Init(false); assign(first, last); }
+ wxArrayString(size_type n, const_reference v) { Init(false); assign(n, v); }
+
+#ifdef wxHAS_VECTOR_TEMPLATE_ASSIGN
+ template <class Iterator>
+ void assign(Iterator first, Iterator last)
+ {
+ clear();
+ reserve(std::distance(first, last));
+ for(; first != last; ++first)
+ push_back(*first);
+ }
+#else // !wxHAS_VECTOR_TEMPLATE_ASSIGN
+ void assign(const_iterator first, const_iterator last)
+ {
+ clear();
+ reserve(last - first);
+ for(; first != last; ++first)
+ push_back(*first);
+ }
+#endif // wxHAS_VECTOR_TEMPLATE_ASSIGN/!wxHAS_VECTOR_TEMPLATE_ASSIGN
+
+ void assign(size_type n, const_reference v)
+ { clear(); Add(v, n); }
+ reference back() { return *(end() - 1); }
+ const_reference back() const { return *(end() - 1); }
+ iterator begin() { return m_pItems; }
+ const_iterator begin() const { return m_pItems; }
+ size_type capacity() const { return m_nSize; }
+ void clear() { Clear(); }
+ bool empty() const { return IsEmpty(); }
+ iterator end() { return begin() + GetCount(); }
+ const_iterator end() const { return begin() + GetCount(); }
+ iterator erase(iterator first, iterator last)
+ {
+ size_t idx = first - begin();
+ RemoveAt(idx, last - first);
+ return begin() + idx;
+ }
+ iterator erase(iterator it) { return erase(it, it + 1); }
+ reference front() { return *begin(); }
+ const_reference front() const { return *begin(); }
+ void insert(iterator it, size_type n, const_reference v)
+ { Insert(v, it - begin(), n); }
+ iterator insert(iterator it, const_reference v = value_type())
+ { size_t idx = it - begin(); Insert(v, idx); return begin() + idx; }
+ void insert(iterator it, const_iterator first, const_iterator last);
+ size_type max_size() const { return INT_MAX; }
+ void pop_back() { RemoveAt(GetCount() - 1); }
+ void push_back(const_reference v) { Add(v); }
+ reverse_iterator rbegin() { return reverse_iterator(end() - 1); }
+ const_reverse_iterator rbegin() const
+ { return const_reverse_iterator(end() - 1); }
+ reverse_iterator rend() { return reverse_iterator(begin() - 1); }
+ const_reverse_iterator rend() const
+ { return const_reverse_iterator(begin() - 1); }
+ void reserve(size_type n) /* base::reserve*/;
+ void resize(size_type n, value_type v = value_type());
+ size_type size() const { return GetCount(); }
+ void swap(wxArrayString& other)
+ {
+ wxSwap(m_nSize, other.m_nSize);
+ wxSwap(m_nCount, other.m_nCount);
+ wxSwap(m_pItems, other.m_pItems);
+ wxSwap(m_autoSort, other.m_autoSort);
+ }
+
+protected:
+ void Init(bool autoSort); // common part of all ctors
+ void Copy(const wxArrayString& src); // copies the contents of another array
+
+private:
+ void Grow(size_t nIncrement = 0); // makes array bigger if needed
+
+ size_t m_nSize, // current size of the array
+ m_nCount; // current number of elements
+
+ wxString *m_pItems; // pointer to data
+
+ bool m_autoSort; // if true, keep the array always sorted
+};
+
+class WXDLLIMPEXP_BASE wxSortedArrayString : public wxArrayString
+{
+public:
+ wxSortedArrayString() : wxArrayString(true)
+ { }
+ wxSortedArrayString(const wxArrayString& array) : wxArrayString(true)
+ { Copy(array); }
+};
+
+#endif // !wxUSE_STD_CONTAINERS
+
+// this class provides a temporary wxString* from a
+// wxArrayString
+class WXDLLIMPEXP_BASE wxCArrayString
+{
+public:
+ wxCArrayString( const wxArrayString& array )
+ : m_array( array ), m_strings( NULL )
+ { }
+ ~wxCArrayString() { delete[] m_strings; }
+
+ size_t GetCount() const { return m_array.GetCount(); }
+ wxString* GetStrings()
+ {
+ if( m_strings ) return m_strings;
+ size_t count = m_array.GetCount();
+ m_strings = new wxString[count];
+ for( size_t i = 0; i < count; ++i )
+ m_strings[i] = m_array[i];
+ return m_strings;
+ }
+
+ wxString* Release()
+ {
+ wxString *r = GetStrings();
+ m_strings = NULL;
+ return r;
+ }
+
+private:
+ const wxArrayString& m_array;
+ wxString* m_strings;
+};
+
+
+// ----------------------------------------------------------------------------
+// helper functions for working with arrays
+// ----------------------------------------------------------------------------
+
+// by default, these functions use the escape character to escape the
+// separators occurring inside the string to be joined, this can be disabled by
+// passing '\0' as escape
+
+WXDLLIMPEXP_BASE wxString wxJoin(const wxArrayString& arr,
+ const wxChar sep,
+ const wxChar escape = wxT('\\'));
+
+WXDLLIMPEXP_BASE wxArrayString wxSplit(const wxString& str,
+ const wxChar sep,
+ const wxChar escape = wxT('\\'));
+
+
+// ----------------------------------------------------------------------------
+// This helper class allows to pass both C array of wxStrings or wxArrayString
+// using the same interface.
+//
+// Use it when you have two methods taking wxArrayString or (int, wxString[]),
+// that do the same thing. This class lets you iterate over input data in the
+// same way whether it is a raw array of strings or wxArrayString.
+//
+// The object does not take ownership of the data -- internally it keeps
+// pointers to the data, therefore the data must be disposed of by user
+// and only after this object is destroyed. Usually it is not a problem as
+// only temporary objects of this class are used.
+// ----------------------------------------------------------------------------
+
+class wxArrayStringsAdapter
+{
+public:
+ // construct an adapter from a wxArrayString
+ wxArrayStringsAdapter(const wxArrayString& strings)
+ : m_type(wxSTRING_ARRAY), m_size(strings.size())
+ {
+ m_data.array = &strings;
+ }
+
+ // construct an adapter from a wxString[]
+ wxArrayStringsAdapter(unsigned int n, const wxString *strings)
+ : m_type(wxSTRING_POINTER), m_size(n)
+ {
+ m_data.ptr = strings;
+ }
+
+ // construct an adapter from a single wxString
+ wxArrayStringsAdapter(const wxString& s)
+ : m_type(wxSTRING_POINTER), m_size(1)
+ {
+ m_data.ptr = &s;
+ }
+
+ // default copy constructor is ok
+
+ // iteration interface
+ size_t GetCount() const { return m_size; }
+ bool IsEmpty() const { return GetCount() == 0; }
+ const wxString& operator[] (unsigned int i) const
+ {
+ wxASSERT_MSG( i < GetCount(), wxT("index out of bounds") );
+ if(m_type == wxSTRING_POINTER)
+ return m_data.ptr[i];
+ return m_data.array->Item(i);
+ }
+ wxArrayString AsArrayString() const
+ {
+ if(m_type == wxSTRING_ARRAY)
+ return *m_data.array;
+ return wxArrayString(GetCount(), m_data.ptr);
+ }
+
+private:
+ // type of the data being held
+ enum wxStringContainerType
+ {
+ wxSTRING_ARRAY, // wxArrayString
+ wxSTRING_POINTER // wxString[]
+ };
+
+ wxStringContainerType m_type;
+ size_t m_size;
+ union
+ {
+ const wxString * ptr;
+ const wxArrayString * array;
+ } m_data;
+
+ wxDECLARE_NO_ASSIGN_CLASS(wxArrayStringsAdapter);
+};
+
+#endif // _WX_ARRSTR_H
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/artprov.h
+// Purpose: wxArtProvider class
+// Author: Vaclav Slavik
+// Modified by:
+// Created: 18/03/2002
+// Copyright: (c) Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_ARTPROV_H_
+#define _WX_ARTPROV_H_
+
+#include "wx/string.h"
+#include "wx/bitmap.h"
+#include "wx/icon.h"
+#include "wx/iconbndl.h"
+
+class WXDLLIMPEXP_FWD_CORE wxArtProvidersList;
+class WXDLLIMPEXP_FWD_CORE wxArtProviderCache;
+class wxArtProviderModule;
+
+// ----------------------------------------------------------------------------
+// Types
+// ----------------------------------------------------------------------------
+
+typedef wxString wxArtClient;
+typedef wxString wxArtID;
+
+#define wxART_MAKE_CLIENT_ID_FROM_STR(id) ((id) + "_C")
+#define wxART_MAKE_CLIENT_ID(id) (#id "_C")
+#define wxART_MAKE_ART_ID_FROM_STR(id) (id)
+#define wxART_MAKE_ART_ID(id) (#id)
+
+// ----------------------------------------------------------------------------
+// Art clients
+// ----------------------------------------------------------------------------
+
+#define wxART_TOOLBAR wxART_MAKE_CLIENT_ID(wxART_TOOLBAR)
+#define wxART_MENU wxART_MAKE_CLIENT_ID(wxART_MENU)
+#define wxART_FRAME_ICON wxART_MAKE_CLIENT_ID(wxART_FRAME_ICON)
+
+#define wxART_CMN_DIALOG wxART_MAKE_CLIENT_ID(wxART_CMN_DIALOG)
+#define wxART_HELP_BROWSER wxART_MAKE_CLIENT_ID(wxART_HELP_BROWSER)
+#define wxART_MESSAGE_BOX wxART_MAKE_CLIENT_ID(wxART_MESSAGE_BOX)
+#define wxART_BUTTON wxART_MAKE_CLIENT_ID(wxART_BUTTON)
+#define wxART_LIST wxART_MAKE_CLIENT_ID(wxART_LIST)
+
+#define wxART_OTHER wxART_MAKE_CLIENT_ID(wxART_OTHER)
+
+// ----------------------------------------------------------------------------
+// Art IDs
+// ----------------------------------------------------------------------------
+
+#define wxART_ADD_BOOKMARK wxART_MAKE_ART_ID(wxART_ADD_BOOKMARK)
+#define wxART_DEL_BOOKMARK wxART_MAKE_ART_ID(wxART_DEL_BOOKMARK)
+#define wxART_HELP_SIDE_PANEL wxART_MAKE_ART_ID(wxART_HELP_SIDE_PANEL)
+#define wxART_HELP_SETTINGS wxART_MAKE_ART_ID(wxART_HELP_SETTINGS)
+#define wxART_HELP_BOOK wxART_MAKE_ART_ID(wxART_HELP_BOOK)
+#define wxART_HELP_FOLDER wxART_MAKE_ART_ID(wxART_HELP_FOLDER)
+#define wxART_HELP_PAGE wxART_MAKE_ART_ID(wxART_HELP_PAGE)
+#define wxART_GO_BACK wxART_MAKE_ART_ID(wxART_GO_BACK)
+#define wxART_GO_FORWARD wxART_MAKE_ART_ID(wxART_GO_FORWARD)
+#define wxART_GO_UP wxART_MAKE_ART_ID(wxART_GO_UP)
+#define wxART_GO_DOWN wxART_MAKE_ART_ID(wxART_GO_DOWN)
+#define wxART_GO_TO_PARENT wxART_MAKE_ART_ID(wxART_GO_TO_PARENT)
+#define wxART_GO_HOME wxART_MAKE_ART_ID(wxART_GO_HOME)
+#define wxART_GOTO_FIRST wxART_MAKE_ART_ID(wxART_GOTO_FIRST)
+#define wxART_GOTO_LAST wxART_MAKE_ART_ID(wxART_GOTO_LAST)
+#define wxART_FILE_OPEN wxART_MAKE_ART_ID(wxART_FILE_OPEN)
+#define wxART_FILE_SAVE wxART_MAKE_ART_ID(wxART_FILE_SAVE)
+#define wxART_FILE_SAVE_AS wxART_MAKE_ART_ID(wxART_FILE_SAVE_AS)
+#define wxART_PRINT wxART_MAKE_ART_ID(wxART_PRINT)
+#define wxART_HELP wxART_MAKE_ART_ID(wxART_HELP)
+#define wxART_TIP wxART_MAKE_ART_ID(wxART_TIP)
+#define wxART_REPORT_VIEW wxART_MAKE_ART_ID(wxART_REPORT_VIEW)
+#define wxART_LIST_VIEW wxART_MAKE_ART_ID(wxART_LIST_VIEW)
+#define wxART_NEW_DIR wxART_MAKE_ART_ID(wxART_NEW_DIR)
+#define wxART_HARDDISK wxART_MAKE_ART_ID(wxART_HARDDISK)
+#define wxART_FLOPPY wxART_MAKE_ART_ID(wxART_FLOPPY)
+#define wxART_CDROM wxART_MAKE_ART_ID(wxART_CDROM)
+#define wxART_REMOVABLE wxART_MAKE_ART_ID(wxART_REMOVABLE)
+#define wxART_FOLDER wxART_MAKE_ART_ID(wxART_FOLDER)
+#define wxART_FOLDER_OPEN wxART_MAKE_ART_ID(wxART_FOLDER_OPEN)
+#define wxART_GO_DIR_UP wxART_MAKE_ART_ID(wxART_GO_DIR_UP)
+#define wxART_EXECUTABLE_FILE wxART_MAKE_ART_ID(wxART_EXECUTABLE_FILE)
+#define wxART_NORMAL_FILE wxART_MAKE_ART_ID(wxART_NORMAL_FILE)
+#define wxART_TICK_MARK wxART_MAKE_ART_ID(wxART_TICK_MARK)
+#define wxART_CROSS_MARK wxART_MAKE_ART_ID(wxART_CROSS_MARK)
+#define wxART_ERROR wxART_MAKE_ART_ID(wxART_ERROR)
+#define wxART_QUESTION wxART_MAKE_ART_ID(wxART_QUESTION)
+#define wxART_WARNING wxART_MAKE_ART_ID(wxART_WARNING)
+#define wxART_INFORMATION wxART_MAKE_ART_ID(wxART_INFORMATION)
+#define wxART_MISSING_IMAGE wxART_MAKE_ART_ID(wxART_MISSING_IMAGE)
+
+#define wxART_COPY wxART_MAKE_ART_ID(wxART_COPY)
+#define wxART_CUT wxART_MAKE_ART_ID(wxART_CUT)
+#define wxART_PASTE wxART_MAKE_ART_ID(wxART_PASTE)
+#define wxART_DELETE wxART_MAKE_ART_ID(wxART_DELETE)
+#define wxART_NEW wxART_MAKE_ART_ID(wxART_NEW)
+
+#define wxART_UNDO wxART_MAKE_ART_ID(wxART_UNDO)
+#define wxART_REDO wxART_MAKE_ART_ID(wxART_REDO)
+
+#define wxART_PLUS wxART_MAKE_ART_ID(wxART_PLUS)
+#define wxART_MINUS wxART_MAKE_ART_ID(wxART_MINUS)
+
+#define wxART_CLOSE wxART_MAKE_ART_ID(wxART_CLOSE)
+#define wxART_QUIT wxART_MAKE_ART_ID(wxART_QUIT)
+
+#define wxART_FIND wxART_MAKE_ART_ID(wxART_FIND)
+#define wxART_FIND_AND_REPLACE wxART_MAKE_ART_ID(wxART_FIND_AND_REPLACE)
+
+
+// ----------------------------------------------------------------------------
+// wxArtProvider class
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxArtProvider : public wxObject
+{
+public:
+ // Dtor removes the provider from providers stack if it's still on it
+ virtual ~wxArtProvider();
+
+ // Does this platform implement native icons theme?
+ static bool HasNativeProvider();
+
+ // Add new provider to the top of providers stack (i.e. the provider will
+ // be queried first of all).
+ static void Push(wxArtProvider *provider);
+
+ // Add new provider to the bottom of providers stack (i.e. the provider
+ // will be queried as the last one).
+ static void PushBack(wxArtProvider *provider);
+
+#if WXWIN_COMPATIBILITY_2_8
+ // use PushBack(), it's the same thing
+ static wxDEPRECATED( void Insert(wxArtProvider *provider) );
+#endif
+
+ // Remove latest added provider and delete it.
+ static bool Pop();
+
+ // Remove provider from providers stack but don't delete it.
+ static bool Remove(wxArtProvider *provider);
+
+ // Delete the given provider and remove it from the providers stack.
+ static bool Delete(wxArtProvider *provider);
+
+
+ // Query the providers for bitmap with given ID and return it. Return
+ // wxNullBitmap if no provider provides it.
+ static wxBitmap GetBitmap(const wxArtID& id,
+ const wxArtClient& client = wxART_OTHER,
+ const wxSize& size = wxDefaultSize);
+
+ // Query the providers for icon with given ID and return it. Return
+ // wxNullIcon if no provider provides it.
+ static wxIcon GetIcon(const wxArtID& id,
+ const wxArtClient& client = wxART_OTHER,
+ const wxSize& size = wxDefaultSize);
+
+ // Helper used by GetMessageBoxIcon(): return the art id corresponding to
+ // the standard wxICON_INFORMATION/WARNING/ERROR/QUESTION flags (only one
+ // can be set)
+ static wxArtID GetMessageBoxIconId(int flags);
+
+ // Helper used by several generic classes: return the icon corresponding to
+ // the standard wxICON_INFORMATION/WARNING/ERROR/QUESTION flags (only one
+ // can be set)
+ static wxIcon GetMessageBoxIcon(int flags)
+ {
+ return GetIcon(GetMessageBoxIconId(flags), wxART_MESSAGE_BOX);
+ }
+
+ // Query the providers for iconbundle with given ID and return it. Return
+ // wxNullIconBundle if no provider provides it.
+ static wxIconBundle GetIconBundle(const wxArtID& id,
+ const wxArtClient& client = wxART_OTHER);
+
+ // Gets native size for given 'client' or wxDefaultSize if it doesn't
+ // have native equivalent
+ static wxSize GetNativeSizeHint(const wxArtClient& client);
+
+ // Get the size hint of an icon from a specific wxArtClient, queries
+ // the topmost provider if platform_dependent = false
+ static wxSize GetSizeHint(const wxArtClient& client, bool platform_dependent = false);
+
+#if WXWIN_COMPATIBILITY_2_6
+ // use the corresponding methods without redundant "Provider" suffix
+ static wxDEPRECATED( void PushProvider(wxArtProvider *provider) );
+ static wxDEPRECATED( void InsertProvider(wxArtProvider *provider) );
+ static wxDEPRECATED( bool PopProvider() );
+
+ // use Delete() if this is what you really need, or just delete the
+ // provider pointer, do not use Remove() as it does not delete the pointer
+ // unlike RemoveProvider() which does
+ static wxDEPRECATED( bool RemoveProvider(wxArtProvider *provider) );
+#endif // WXWIN_COMPATIBILITY_2_6
+
+protected:
+ friend class wxArtProviderModule;
+#if wxUSE_ARTPROVIDER_STD
+ // Initializes default provider
+ static void InitStdProvider();
+#endif // wxUSE_ARTPROVIDER_STD
+ // Initializes Tango-based icon provider
+#if wxUSE_ARTPROVIDER_TANGO
+ static void InitTangoProvider();
+#endif // wxUSE_ARTPROVIDER_TANGO
+ // Initializes platform's native provider, if available (e.g. GTK2)
+ static void InitNativeProvider();
+ // Destroy caches & all providers
+ static void CleanUpProviders();
+
+ // Get the default size of an icon for a specific client
+ virtual wxSize DoGetSizeHint(const wxArtClient& client)
+ {
+ return GetSizeHint(client, true);
+ }
+
+ // Derived classes must override CreateBitmap or CreateIconBundle
+ // (or both) to create requested art resource. This method is called
+ // only once per instance's lifetime for each requested wxArtID.
+ virtual wxBitmap CreateBitmap(const wxArtID& WXUNUSED(id),
+ const wxArtClient& WXUNUSED(client),
+ const wxSize& WXUNUSED(size))
+ {
+ return wxNullBitmap;
+ }
+
+ virtual wxIconBundle CreateIconBundle(const wxArtID& WXUNUSED(id),
+ const wxArtClient& WXUNUSED(client))
+ {
+ return wxNullIconBundle;
+ }
+
+private:
+ static void CommonAddingProvider();
+ static wxIconBundle DoGetIconBundle(const wxArtID& id,
+ const wxArtClient& client);
+
+private:
+ // list of providers:
+ static wxArtProvidersList *sm_providers;
+ // art resources cache (so that CreateXXX is not called that often):
+ static wxArtProviderCache *sm_cache;
+
+ DECLARE_ABSTRACT_CLASS(wxArtProvider)
+};
+
+
+#if !defined(__WXUNIVERSAL__) && \
+ ((defined(__WXGTK__) && defined(__WXGTK20__)) || defined(__WXMSW__) || \
+ defined(__WXMAC__))
+ // *some* (partial) native implementation of wxArtProvider exists; this is
+ // not the same as wxArtProvider::HasNativeProvider()!
+ #define wxHAS_NATIVE_ART_PROVIDER_IMPL
+#endif
+
+#endif // _WX_ARTPROV_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/atomic.h
+// Purpose: functions to manipulate atomically integers and pointers
+// Author: Armel Asselin
+// Created: 12/13/2006
+// Copyright: (c) Armel Asselin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_ATOMIC_H_
+#define _WX_ATOMIC_H_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// get the value of wxUSE_THREADS configuration flag
+#include "wx/defs.h"
+
+// constraints on the various functions:
+// - wxAtomicDec must return a zero value if the value is zero once
+// decremented else it must return any non-zero value (the true value is OK
+// but not necessary).
+
+#if wxUSE_THREADS
+
+#if defined(HAVE_GCC_ATOMIC_BUILTINS)
+
+// NB: we intentionally don't use Linux's asm/atomic.h header, because it's
+// an internal kernel header that doesn't always work in userspace:
+// http://bugs.mysql.com/bug.php?id=28456
+// http://golubenco.org/blog/atomic-operations/
+
+inline void wxAtomicInc (wxUint32 &value)
+{
+ __sync_fetch_and_add(&value, 1);
+}
+
+inline wxUint32 wxAtomicDec (wxUint32 &value)
+{
+ return __sync_sub_and_fetch(&value, 1);
+}
+
+
+#elif defined(__WINDOWS__)
+
+// include standard Windows headers
+#include "wx/msw/wrapwin.h"
+
+inline void wxAtomicInc (wxUint32 &value)
+{
+ InterlockedIncrement ((LONG*)&value);
+}
+
+inline wxUint32 wxAtomicDec (wxUint32 &value)
+{
+ return InterlockedDecrement ((LONG*)&value);
+}
+
+#elif defined(__WXMAC__) || defined(__DARWIN__)
+
+#include "libkern/OSAtomic.h"
+inline void wxAtomicInc (wxUint32 &value)
+{
+ OSAtomicIncrement32 ((int32_t*)&value);
+}
+
+inline wxUint32 wxAtomicDec (wxUint32 &value)
+{
+ return OSAtomicDecrement32 ((int32_t*)&value);
+}
+
+#elif defined (__SOLARIS__)
+
+#include <atomic.h>
+
+inline void wxAtomicInc (wxUint32 &value)
+{
+ atomic_add_32 ((uint32_t*)&value, 1);
+}
+
+inline wxUint32 wxAtomicDec (wxUint32 &value)
+{
+ return atomic_add_32_nv ((uint32_t*)&value, (uint32_t)-1);
+}
+
+#else // unknown platform
+
+// it will result in inclusion if the generic implementation code a bit later in this page
+#define wxNEEDS_GENERIC_ATOMIC_OPS
+
+#endif // unknown platform
+
+#else // else of wxUSE_THREADS
+// if no threads are used we can safely use simple ++/--
+
+inline void wxAtomicInc (wxUint32 &value) { ++value; }
+inline wxUint32 wxAtomicDec (wxUint32 &value) { return --value; }
+
+#endif // !wxUSE_THREADS
+
+// ----------------------------------------------------------------------------
+// proxies to actual implementations, but for various other types with same
+// behaviour
+// ----------------------------------------------------------------------------
+
+#ifdef wxNEEDS_GENERIC_ATOMIC_OPS
+
+#include "wx/thread.h" // for wxCriticalSection
+
+class wxAtomicInt32
+{
+public:
+ wxAtomicInt32() { } // non initialized for consistency with basic int type
+ wxAtomicInt32(wxInt32 v) : m_value(v) { }
+ wxAtomicInt32(const wxAtomicInt32& a) : m_value(a.m_value) {}
+
+ operator wxInt32() const { return m_value; }
+ operator volatile wxInt32&() { return m_value; }
+
+ wxAtomicInt32& operator=(wxInt32 v) { m_value = v; return *this; }
+
+ void Inc()
+ {
+ wxCriticalSectionLocker lock(m_locker);
+ ++m_value;
+ }
+
+ wxInt32 Dec()
+ {
+ wxCriticalSectionLocker lock(m_locker);
+ return --m_value;
+ }
+
+private:
+ volatile wxInt32 m_value;
+ wxCriticalSection m_locker;
+};
+
+inline void wxAtomicInc(wxAtomicInt32 &value) { value.Inc(); }
+inline wxInt32 wxAtomicDec(wxAtomicInt32 &value) { return value.Dec(); }
+
+#else // !wxNEEDS_GENERIC_ATOMIC_OPS
+
+#define wxHAS_ATOMIC_OPS
+
+inline void wxAtomicInc(wxInt32 &value) { wxAtomicInc((wxUint32&)value); }
+inline wxInt32 wxAtomicDec(wxInt32 &value) { return wxAtomicDec((wxUint32&)value); }
+
+typedef wxInt32 wxAtomicInt32;
+
+#endif // wxNEEDS_GENERIC_ATOMIC_OPS
+
+// all the native implementations use 32 bits currently
+// for a 64 bits implementation we could use (a future) wxAtomicInt64 as
+// default type
+typedef wxAtomicInt32 wxAtomicInt;
+
+#endif // _WX_ATOMIC_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/aui/aui.h
+// Purpose: wxaui: wx advanced user interface - docking window manager
+// Author: Benjamin I. Williams
+// Modified by:
+// Created: 2005-05-17
+// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved.
+// Licence: wxWindows Library Licence, Version 3.1
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_AUI_H_
+#define _WX_AUI_H_
+
+#include "wx/aui/framemanager.h"
+#include "wx/aui/dockart.h"
+#include "wx/aui/floatpane.h"
+#include "wx/aui/auibar.h"
+#include "wx/aui/auibook.h"
+#include "wx/aui/tabmdi.h"
+
+#endif // _WX_AUI_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/aui/toolbar.h
+// Purpose: wxaui: wx advanced user interface - docking window manager
+// Author: Benjamin I. Williams
+// Modified by:
+// Created: 2008-08-04
+// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved.
+// Licence: wxWindows Library Licence, Version 3.1
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_AUIBAR_H_
+#define _WX_AUIBAR_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_AUI
+
+#include "wx/control.h"
+#include "wx/sizer.h"
+#include "wx/pen.h"
+
+class WXDLLIMPEXP_FWD_CORE wxClientDC;
+class WXDLLIMPEXP_FWD_AUI wxAuiPaneInfo;
+
+enum wxAuiToolBarStyle
+{
+ wxAUI_TB_TEXT = 1 << 0,
+ wxAUI_TB_NO_TOOLTIPS = 1 << 1,
+ wxAUI_TB_NO_AUTORESIZE = 1 << 2,
+ wxAUI_TB_GRIPPER = 1 << 3,
+ wxAUI_TB_OVERFLOW = 1 << 4,
+ // using this style forces the toolbar to be vertical and
+ // be only dockable to the left or right sides of the window
+ // whereas by default it can be horizontal or vertical and
+ // be docked anywhere
+ wxAUI_TB_VERTICAL = 1 << 5,
+ wxAUI_TB_HORZ_LAYOUT = 1 << 6,
+ // analogous to wxAUI_TB_VERTICAL, but forces the toolbar
+ // to be horizontal
+ wxAUI_TB_HORIZONTAL = 1 << 7,
+ wxAUI_TB_PLAIN_BACKGROUND = 1 << 8,
+ wxAUI_TB_HORZ_TEXT = (wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_TEXT),
+ wxAUI_ORIENTATION_MASK = (wxAUI_TB_VERTICAL | wxAUI_TB_HORIZONTAL),
+ wxAUI_TB_DEFAULT_STYLE = 0
+};
+
+enum wxAuiToolBarArtSetting
+{
+ wxAUI_TBART_SEPARATOR_SIZE = 0,
+ wxAUI_TBART_GRIPPER_SIZE = 1,
+ wxAUI_TBART_OVERFLOW_SIZE = 2
+};
+
+enum wxAuiToolBarToolTextOrientation
+{
+ wxAUI_TBTOOL_TEXT_LEFT = 0, // unused/unimplemented
+ wxAUI_TBTOOL_TEXT_RIGHT = 1,
+ wxAUI_TBTOOL_TEXT_TOP = 2, // unused/unimplemented
+ wxAUI_TBTOOL_TEXT_BOTTOM = 3
+};
+
+
+// aui toolbar event class
+
+class WXDLLIMPEXP_AUI wxAuiToolBarEvent : public wxNotifyEvent
+{
+public:
+ wxAuiToolBarEvent(wxEventType commandType = wxEVT_NULL,
+ int winId = 0)
+ : wxNotifyEvent(commandType, winId)
+ {
+ m_isDropdownClicked = false;
+ m_clickPt = wxPoint(-1, -1);
+ m_rect = wxRect(-1,-1, 0, 0);
+ m_toolId = -1;
+ }
+#ifndef SWIG
+ wxAuiToolBarEvent(const wxAuiToolBarEvent& c) : wxNotifyEvent(c)
+ {
+ m_isDropdownClicked = c.m_isDropdownClicked;
+ m_clickPt = c.m_clickPt;
+ m_rect = c.m_rect;
+ m_toolId = c.m_toolId;
+ }
+#endif
+ wxEvent *Clone() const { return new wxAuiToolBarEvent(*this); }
+
+ bool IsDropDownClicked() const { return m_isDropdownClicked; }
+ void SetDropDownClicked(bool c) { m_isDropdownClicked = c; }
+
+ wxPoint GetClickPoint() const { return m_clickPt; }
+ void SetClickPoint(const wxPoint& p) { m_clickPt = p; }
+
+ wxRect GetItemRect() const { return m_rect; }
+ void SetItemRect(const wxRect& r) { m_rect = r; }
+
+ int GetToolId() const { return m_toolId; }
+ void SetToolId(int toolId) { m_toolId = toolId; }
+
+private:
+
+ bool m_isDropdownClicked;
+ wxPoint m_clickPt;
+ wxRect m_rect;
+ int m_toolId;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiToolBarEvent)
+};
+
+
+class WXDLLIMPEXP_AUI wxAuiToolBarItem
+{
+ friend class wxAuiToolBar;
+
+public:
+
+ wxAuiToolBarItem()
+ {
+ m_window = NULL;
+ m_sizerItem = NULL;
+ m_spacerPixels = 0;
+ m_toolId = 0;
+ m_kind = wxITEM_NORMAL;
+ m_state = 0; // normal, enabled
+ m_proportion = 0;
+ m_active = true;
+ m_dropDown = true;
+ m_sticky = true;
+ m_userData = 0;
+ m_alignment = wxALIGN_CENTER;
+ }
+
+ wxAuiToolBarItem(const wxAuiToolBarItem& c)
+ {
+ Assign(c);
+ }
+
+ wxAuiToolBarItem& operator=(const wxAuiToolBarItem& c)
+ {
+ Assign(c);
+ return *this;
+ }
+
+ void Assign(const wxAuiToolBarItem& c)
+ {
+ m_window = c.m_window;
+ m_label = c.m_label;
+ m_bitmap = c.m_bitmap;
+ m_disabledBitmap = c.m_disabledBitmap;
+ m_hoverBitmap = c.m_hoverBitmap;
+ m_shortHelp = c.m_shortHelp;
+ m_longHelp = c.m_longHelp;
+ m_sizerItem = c.m_sizerItem;
+ m_minSize = c.m_minSize;
+ m_spacerPixels = c.m_spacerPixels;
+ m_toolId = c.m_toolId;
+ m_kind = c.m_kind;
+ m_state = c.m_state;
+ m_proportion = c.m_proportion;
+ m_active = c.m_active;
+ m_dropDown = c.m_dropDown;
+ m_sticky = c.m_sticky;
+ m_userData = c.m_userData;
+ m_alignment = c.m_alignment;
+ }
+
+
+ void SetWindow(wxWindow* w) { m_window = w; }
+ wxWindow* GetWindow() { return m_window; }
+
+ void SetId(int newId) { m_toolId = newId; }
+ int GetId() const { return m_toolId; }
+
+ void SetKind(int newKind) { m_kind = newKind; }
+ int GetKind() const { return m_kind; }
+
+ void SetState(int newState) { m_state = newState; }
+ int GetState() const { return m_state; }
+
+ void SetSizerItem(wxSizerItem* s) { m_sizerItem = s; }
+ wxSizerItem* GetSizerItem() const { return m_sizerItem; }
+
+ void SetLabel(const wxString& s) { m_label = s; }
+ const wxString& GetLabel() const { return m_label; }
+
+ void SetBitmap(const wxBitmap& bmp) { m_bitmap = bmp; }
+ const wxBitmap& GetBitmap() const { return m_bitmap; }
+
+ void SetDisabledBitmap(const wxBitmap& bmp) { m_disabledBitmap = bmp; }
+ const wxBitmap& GetDisabledBitmap() const { return m_disabledBitmap; }
+
+ void SetHoverBitmap(const wxBitmap& bmp) { m_hoverBitmap = bmp; }
+ const wxBitmap& GetHoverBitmap() const { return m_hoverBitmap; }
+
+ void SetShortHelp(const wxString& s) { m_shortHelp = s; }
+ const wxString& GetShortHelp() const { return m_shortHelp; }
+
+ void SetLongHelp(const wxString& s) { m_longHelp = s; }
+ const wxString& GetLongHelp() const { return m_longHelp; }
+
+ void SetMinSize(const wxSize& s) { m_minSize = s; }
+ const wxSize& GetMinSize() const { return m_minSize; }
+
+ void SetSpacerPixels(int s) { m_spacerPixels = s; }
+ int GetSpacerPixels() const { return m_spacerPixels; }
+
+ void SetProportion(int p) { m_proportion = p; }
+ int GetProportion() const { return m_proportion; }
+
+ void SetActive(bool b) { m_active = b; }
+ bool IsActive() const { return m_active; }
+
+ void SetHasDropDown(bool b)
+ {
+ wxCHECK_RET( !b || m_kind == wxITEM_NORMAL,
+ wxS("Only normal tools can have drop downs") );
+
+ m_dropDown = b;
+ }
+
+ bool HasDropDown() const { return m_dropDown; }
+
+ void SetSticky(bool b) { m_sticky = b; }
+ bool IsSticky() const { return m_sticky; }
+
+ void SetUserData(long l) { m_userData = l; }
+ long GetUserData() const { return m_userData; }
+
+ void SetAlignment(int l) { m_alignment = l; }
+ int GetAlignment() const { return m_alignment; }
+
+private:
+
+ wxWindow* m_window; // item's associated window
+ wxString m_label; // label displayed on the item
+ wxBitmap m_bitmap; // item's bitmap
+ wxBitmap m_disabledBitmap; // item's disabled bitmap
+ wxBitmap m_hoverBitmap; // item's hover bitmap
+ wxString m_shortHelp; // short help (for tooltip)
+ wxString m_longHelp; // long help (for status bar)
+ wxSizerItem* m_sizerItem; // sizer item
+ wxSize m_minSize; // item's minimum size
+ int m_spacerPixels; // size of a spacer
+ int m_toolId; // item's id
+ int m_kind; // item's kind
+ int m_state; // state
+ int m_proportion; // proportion
+ bool m_active; // true if the item is currently active
+ bool m_dropDown; // true if the item has a dropdown button
+ bool m_sticky; // overrides button states if true (always active)
+ long m_userData; // user-specified data
+ int m_alignment; // sizer alignment flag, defaults to wxCENTER, may be wxEXPAND or any other
+};
+
+#ifndef SWIG
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiToolBarItem, wxAuiToolBarItemArray, WXDLLIMPEXP_AUI);
+#endif
+
+
+
+
+// tab art class
+
+class WXDLLIMPEXP_AUI wxAuiToolBarArt
+{
+public:
+
+ wxAuiToolBarArt() { }
+ virtual ~wxAuiToolBarArt() { }
+
+ virtual wxAuiToolBarArt* Clone() = 0;
+ virtual void SetFlags(unsigned int flags) = 0;
+ virtual unsigned int GetFlags() = 0;
+ virtual void SetFont(const wxFont& font) = 0;
+ virtual wxFont GetFont() = 0;
+ virtual void SetTextOrientation(int orientation) = 0;
+ virtual int GetTextOrientation() = 0;
+
+ virtual void DrawBackground(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect) = 0;
+
+ virtual void DrawPlainBackground(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect) = 0;
+
+ virtual void DrawLabel(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxAuiToolBarItem& item,
+ const wxRect& rect) = 0;
+
+ virtual void DrawButton(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxAuiToolBarItem& item,
+ const wxRect& rect) = 0;
+
+ virtual void DrawDropDownButton(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxAuiToolBarItem& item,
+ const wxRect& rect) = 0;
+
+ virtual void DrawControlLabel(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxAuiToolBarItem& item,
+ const wxRect& rect) = 0;
+
+ virtual void DrawSeparator(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect) = 0;
+
+ virtual void DrawGripper(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect) = 0;
+
+ virtual void DrawOverflowButton(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect,
+ int state) = 0;
+
+ virtual wxSize GetLabelSize(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxAuiToolBarItem& item) = 0;
+
+ virtual wxSize GetToolSize(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxAuiToolBarItem& item) = 0;
+
+ virtual int GetElementSize(int elementId) = 0;
+ virtual void SetElementSize(int elementId, int size) = 0;
+
+ virtual int ShowDropDown(
+ wxWindow* wnd,
+ const wxAuiToolBarItemArray& items) = 0;
+};
+
+
+
+class WXDLLIMPEXP_AUI wxAuiDefaultToolBarArt : public wxAuiToolBarArt
+{
+
+public:
+
+ wxAuiDefaultToolBarArt();
+ virtual ~wxAuiDefaultToolBarArt();
+
+ virtual wxAuiToolBarArt* Clone();
+ virtual void SetFlags(unsigned int flags);
+ virtual unsigned int GetFlags();
+ virtual void SetFont(const wxFont& font);
+ virtual wxFont GetFont();
+ virtual void SetTextOrientation(int orientation);
+ virtual int GetTextOrientation();
+
+ virtual void DrawBackground(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect);
+
+ virtual void DrawPlainBackground(wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect);
+
+ virtual void DrawLabel(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxAuiToolBarItem& item,
+ const wxRect& rect);
+
+ virtual void DrawButton(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxAuiToolBarItem& item,
+ const wxRect& rect);
+
+ virtual void DrawDropDownButton(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxAuiToolBarItem& item,
+ const wxRect& rect);
+
+ virtual void DrawControlLabel(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxAuiToolBarItem& item,
+ const wxRect& rect);
+
+ virtual void DrawSeparator(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect);
+
+ virtual void DrawGripper(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect);
+
+ virtual void DrawOverflowButton(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect,
+ int state);
+
+ virtual wxSize GetLabelSize(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxAuiToolBarItem& item);
+
+ virtual wxSize GetToolSize(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxAuiToolBarItem& item);
+
+ virtual int GetElementSize(int element);
+ virtual void SetElementSize(int elementId, int size);
+
+ virtual int ShowDropDown(wxWindow* wnd,
+ const wxAuiToolBarItemArray& items);
+
+protected:
+
+ wxBitmap m_buttonDropDownBmp;
+ wxBitmap m_disabledButtonDropDownBmp;
+ wxBitmap m_overflowBmp;
+ wxBitmap m_disabledOverflowBmp;
+ wxColour m_baseColour;
+ wxColour m_highlightColour;
+ wxFont m_font;
+ unsigned int m_flags;
+ int m_textOrientation;
+
+ wxPen m_gripperPen1;
+ wxPen m_gripperPen2;
+ wxPen m_gripperPen3;
+
+ int m_separatorSize;
+ int m_gripperSize;
+ int m_overflowSize;
+};
+
+
+
+
+class WXDLLIMPEXP_AUI wxAuiToolBar : public wxControl
+{
+public:
+ wxAuiToolBar() { Init(); }
+
+ wxAuiToolBar(wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxAUI_TB_DEFAULT_STYLE)
+ {
+ Init();
+ Create(parent, id, pos, size, style);
+ }
+
+ virtual ~wxAuiToolBar();
+
+ bool Create(wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxAUI_TB_DEFAULT_STYLE);
+
+ virtual void SetWindowStyleFlag(long style);
+
+ void SetArtProvider(wxAuiToolBarArt* art);
+ wxAuiToolBarArt* GetArtProvider() const;
+
+ bool SetFont(const wxFont& font);
+
+
+ wxAuiToolBarItem* AddTool(int toolId,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxString& shortHelpString = wxEmptyString,
+ wxItemKind kind = wxITEM_NORMAL);
+
+ wxAuiToolBarItem* AddTool(int toolId,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxBitmap& disabledBitmap,
+ wxItemKind kind,
+ const wxString& shortHelpString,
+ const wxString& longHelpString,
+ wxObject* clientData);
+
+ wxAuiToolBarItem* AddTool(int toolId,
+ const wxBitmap& bitmap,
+ const wxBitmap& disabledBitmap,
+ bool toggle = false,
+ wxObject* clientData = NULL,
+ const wxString& shortHelpString = wxEmptyString,
+ const wxString& longHelpString = wxEmptyString)
+ {
+ return AddTool(toolId,
+ wxEmptyString,
+ bitmap,
+ disabledBitmap,
+ toggle ? wxITEM_CHECK : wxITEM_NORMAL,
+ shortHelpString,
+ longHelpString,
+ clientData);
+ }
+
+ wxAuiToolBarItem* AddLabel(int toolId,
+ const wxString& label = wxEmptyString,
+ const int width = -1);
+ wxAuiToolBarItem* AddControl(wxControl* control,
+ const wxString& label = wxEmptyString);
+ wxAuiToolBarItem* AddSeparator();
+ wxAuiToolBarItem* AddSpacer(int pixels);
+ wxAuiToolBarItem* AddStretchSpacer(int proportion = 1);
+
+ bool Realize();
+
+ wxControl* FindControl(int windowId);
+ wxAuiToolBarItem* FindToolByPosition(wxCoord x, wxCoord y) const;
+ wxAuiToolBarItem* FindToolByIndex(int idx) const;
+ wxAuiToolBarItem* FindTool(int toolId) const;
+
+ void ClearTools() { Clear() ; }
+ void Clear();
+ bool DeleteTool(int toolId);
+ bool DeleteByIndex(int toolId);
+
+ size_t GetToolCount() const;
+ int GetToolPos(int toolId) const { return GetToolIndex(toolId); }
+ int GetToolIndex(int toolId) const;
+ bool GetToolFits(int toolId) const;
+ wxRect GetToolRect(int toolId) const;
+ bool GetToolFitsByIndex(int toolId) const;
+ bool GetToolBarFits() const;
+
+ void SetMargins(const wxSize& size) { SetMargins(size.x, size.x, size.y, size.y); }
+ void SetMargins(int x, int y) { SetMargins(x, x, y, y); }
+ void SetMargins(int left, int right, int top, int bottom);
+
+ void SetToolBitmapSize(const wxSize& size);
+ wxSize GetToolBitmapSize() const;
+
+ bool GetOverflowVisible() const;
+ void SetOverflowVisible(bool visible);
+
+ bool GetGripperVisible() const;
+ void SetGripperVisible(bool visible);
+
+ void ToggleTool(int toolId, bool state);
+ bool GetToolToggled(int toolId) const;
+
+ void EnableTool(int toolId, bool state);
+ bool GetToolEnabled(int toolId) const;
+
+ void SetToolDropDown(int toolId, bool dropdown);
+ bool GetToolDropDown(int toolId) const;
+
+ void SetToolBorderPadding(int padding);
+ int GetToolBorderPadding() const;
+
+ void SetToolTextOrientation(int orientation);
+ int GetToolTextOrientation() const;
+
+ void SetToolPacking(int packing);
+ int GetToolPacking() const;
+
+ void SetToolProportion(int toolId, int proportion);
+ int GetToolProportion(int toolId) const;
+
+ void SetToolSeparation(int separation);
+ int GetToolSeparation() const;
+
+ void SetToolSticky(int toolId, bool sticky);
+ bool GetToolSticky(int toolId) const;
+
+ wxString GetToolLabel(int toolId) const;
+ void SetToolLabel(int toolId, const wxString& label);
+
+ wxBitmap GetToolBitmap(int toolId) const;
+ void SetToolBitmap(int toolId, const wxBitmap& bitmap);
+
+ wxString GetToolShortHelp(int toolId) const;
+ void SetToolShortHelp(int toolId, const wxString& helpString);
+
+ wxString GetToolLongHelp(int toolId) const;
+ void SetToolLongHelp(int toolId, const wxString& helpString);
+
+ void SetCustomOverflowItems(const wxAuiToolBarItemArray& prepend,
+ const wxAuiToolBarItemArray& append);
+
+ // get size of hint rectangle for a particular dock location
+ wxSize GetHintSize(int dockDirection) const;
+ bool IsPaneValid(const wxAuiPaneInfo& pane) const;
+
+ // Override to call DoIdleUpdate().
+ virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE);
+
+protected:
+ void Init();
+
+ virtual void OnCustomRender(wxDC& WXUNUSED(dc),
+ const wxAuiToolBarItem& WXUNUSED(item),
+ const wxRect& WXUNUSED(rect)) { }
+
+protected:
+
+ void DoIdleUpdate();
+ void SetOrientation(int orientation);
+ void SetHoverItem(wxAuiToolBarItem* item);
+ void SetPressedItem(wxAuiToolBarItem* item);
+ void RefreshOverflowState();
+
+ int GetOverflowState() const;
+ wxRect GetOverflowRect() const;
+ wxSize GetLabelSize(const wxString& label);
+ wxAuiToolBarItem* FindToolByPositionWithPacking(wxCoord x, wxCoord y) const;
+
+ void DoSetSize(int x,
+ int y,
+ int width,
+ int height,
+ int sizeFlags = wxSIZE_AUTO);
+
+protected: // handlers
+
+ void OnSize(wxSizeEvent& evt);
+ void OnIdle(wxIdleEvent& evt);
+ void OnPaint(wxPaintEvent& evt);
+ void OnEraseBackground(wxEraseEvent& evt);
+ void OnLeftDown(wxMouseEvent& evt);
+ void OnLeftUp(wxMouseEvent& evt);
+ void OnRightDown(wxMouseEvent& evt);
+ void OnRightUp(wxMouseEvent& evt);
+ void OnMiddleDown(wxMouseEvent& evt);
+ void OnMiddleUp(wxMouseEvent& evt);
+ void OnMotion(wxMouseEvent& evt);
+ void OnLeaveWindow(wxMouseEvent& evt);
+ void OnCaptureLost(wxMouseCaptureLostEvent& evt);
+ void OnSetCursor(wxSetCursorEvent& evt);
+
+protected:
+
+ wxAuiToolBarItemArray m_items; // array of toolbar items
+ wxAuiToolBarArt* m_art; // art provider
+ wxBoxSizer* m_sizer; // main sizer for toolbar
+ wxAuiToolBarItem* m_actionItem; // item that's being acted upon (pressed)
+ wxAuiToolBarItem* m_tipItem; // item that has its tooltip shown
+ wxBitmap m_bitmap; // double-buffer bitmap
+ wxSizerItem* m_gripperSizerItem;
+ wxSizerItem* m_overflowSizerItem;
+ wxSize m_absoluteMinSize;
+ wxPoint m_actionPos; // position of left-mouse down
+ wxAuiToolBarItemArray m_customOverflowPrepend;
+ wxAuiToolBarItemArray m_customOverflowAppend;
+
+ int m_buttonWidth;
+ int m_buttonHeight;
+ int m_sizerElementCount;
+ int m_leftPadding;
+ int m_rightPadding;
+ int m_topPadding;
+ int m_bottomPadding;
+ int m_toolPacking;
+ int m_toolBorderPadding;
+ int m_toolTextOrientation;
+ int m_overflowState;
+ bool m_dragging;
+ bool m_gripperVisible;
+ bool m_overflowVisible;
+
+ bool RealizeHelper(wxClientDC& dc, bool horizontal);
+ static bool IsPaneValid(long style, const wxAuiPaneInfo& pane);
+ bool IsPaneValid(long style) const;
+ void SetArtFlags() const;
+ wxOrientation m_orientation;
+ wxSize m_horzHintSize;
+ wxSize m_vertHintSize;
+
+private:
+ // Common part of OnLeaveWindow() and OnCaptureLost().
+ void DoResetMouseState();
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_CLASS(wxAuiToolBar)
+};
+
+
+
+
+// wx event machinery
+
+#ifndef SWIG
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUITOOLBAR_TOOL_DROPDOWN, wxAuiToolBarEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUITOOLBAR_OVERFLOW_CLICK, wxAuiToolBarEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUITOOLBAR_RIGHT_CLICK, wxAuiToolBarEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUITOOLBAR_MIDDLE_CLICK, wxAuiToolBarEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUITOOLBAR_BEGIN_DRAG, wxAuiToolBarEvent );
+
+typedef void (wxEvtHandler::*wxAuiToolBarEventFunction)(wxAuiToolBarEvent&);
+
+#define wxAuiToolBarEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxAuiToolBarEventFunction, func)
+
+#define EVT_AUITOOLBAR_TOOL_DROPDOWN(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, winid, wxAuiToolBarEventHandler(fn))
+#define EVT_AUITOOLBAR_OVERFLOW_CLICK(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_AUITOOLBAR_OVERFLOW_CLICK, winid, wxAuiToolBarEventHandler(fn))
+#define EVT_AUITOOLBAR_RIGHT_CLICK(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_AUITOOLBAR_RIGHT_CLICK, winid, wxAuiToolBarEventHandler(fn))
+#define EVT_AUITOOLBAR_MIDDLE_CLICK(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_AUITOOLBAR_MIDDLE_CLICK, winid, wxAuiToolBarEventHandler(fn))
+#define EVT_AUITOOLBAR_BEGIN_DRAG(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_AUITOOLBAR_BEGIN_DRAG, winid, wxAuiToolBarEventHandler(fn))
+
+#else
+
+// wxpython/swig event work
+%constant wxEventType wxEVT_AUITOOLBAR_TOOL_DROPDOWN;
+%constant wxEventType wxEVT_AUITOOLBAR_OVERFLOW_CLICK;
+%constant wxEventType wxEVT_AUITOOLBAR_RIGHT_CLICK;
+%constant wxEventType wxEVT_AUITOOLBAR_MIDDLE_CLICK;
+%constant wxEventType wxEVT_AUITOOLBAR_BEGIN_DRAG;
+
+%pythoncode {
+ EVT_AUITOOLBAR_TOOL_DROPDOWN = wx.PyEventBinder( wxEVT_AUITOOLBAR_TOOL_DROPDOWN, 1 )
+ EVT_AUITOOLBAR_OVERFLOW_CLICK = wx.PyEventBinder( wxEVT_AUITOOLBAR_OVERFLOW_CLICK, 1 )
+ EVT_AUITOOLBAR_RIGHT_CLICK = wx.PyEventBinder( wxEVT_AUITOOLBAR_RIGHT_CLICK, 1 )
+ EVT_AUITOOLBAR_MIDDLE_CLICK = wx.PyEventBinder( wxEVT_AUITOOLBAR_MIDDLE_CLICK, 1 )
+ EVT_AUITOOLBAR_BEGIN_DRAG = wx.PyEventBinder( wxEVT_AUITOOLBAR_BEGIN_DRAG, 1 )
+}
+#endif // SWIG
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_AUITOOLBAR_TOOL_DROPDOWN wxEVT_AUITOOLBAR_TOOL_DROPDOWN
+#define wxEVT_COMMAND_AUITOOLBAR_OVERFLOW_CLICK wxEVT_AUITOOLBAR_OVERFLOW_CLICK
+#define wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK wxEVT_AUITOOLBAR_RIGHT_CLICK
+#define wxEVT_COMMAND_AUITOOLBAR_MIDDLE_CLICK wxEVT_AUITOOLBAR_MIDDLE_CLICK
+#define wxEVT_COMMAND_AUITOOLBAR_BEGIN_DRAG wxEVT_AUITOOLBAR_BEGIN_DRAG
+
+#endif // wxUSE_AUI
+#endif // _WX_AUIBAR_H_
+
--- /dev/null
+//////////////////////////////////////////////////////////////////////////////
+// Name: wx/aui/auibook.h
+// Purpose: wxaui: wx advanced user interface - notebook
+// Author: Benjamin I. Williams
+// Modified by: Jens Lody
+// Created: 2006-06-28
+// Copyright: (C) Copyright 2006, Kirix Corporation, All Rights Reserved.
+// Licence: wxWindows Library Licence, Version 3.1
+///////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef _WX_AUINOTEBOOK_H_
+#define _WX_AUINOTEBOOK_H_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_AUI
+
+#include "wx/aui/tabart.h"
+#include "wx/aui/framemanager.h"
+#include "wx/bookctrl.h"
+#include "wx/containr.h"
+
+
+class wxAuiNotebook;
+
+
+enum wxAuiNotebookOption
+{
+ wxAUI_NB_TOP = 1 << 0,
+ wxAUI_NB_LEFT = 1 << 1, // not implemented yet
+ wxAUI_NB_RIGHT = 1 << 2, // not implemented yet
+ wxAUI_NB_BOTTOM = 1 << 3,
+ wxAUI_NB_TAB_SPLIT = 1 << 4,
+ wxAUI_NB_TAB_MOVE = 1 << 5,
+ wxAUI_NB_TAB_EXTERNAL_MOVE = 1 << 6,
+ wxAUI_NB_TAB_FIXED_WIDTH = 1 << 7,
+ wxAUI_NB_SCROLL_BUTTONS = 1 << 8,
+ wxAUI_NB_WINDOWLIST_BUTTON = 1 << 9,
+ wxAUI_NB_CLOSE_BUTTON = 1 << 10,
+ wxAUI_NB_CLOSE_ON_ACTIVE_TAB = 1 << 11,
+ wxAUI_NB_CLOSE_ON_ALL_TABS = 1 << 12,
+ wxAUI_NB_MIDDLE_CLICK_CLOSE = 1 << 13,
+
+ wxAUI_NB_DEFAULT_STYLE = wxAUI_NB_TOP |
+ wxAUI_NB_TAB_SPLIT |
+ wxAUI_NB_TAB_MOVE |
+ wxAUI_NB_SCROLL_BUTTONS |
+ wxAUI_NB_CLOSE_ON_ACTIVE_TAB |
+ wxAUI_NB_MIDDLE_CLICK_CLOSE
+};
+
+
+
+
+// aui notebook event class
+
+class WXDLLIMPEXP_AUI wxAuiNotebookEvent : public wxBookCtrlEvent
+{
+public:
+ wxAuiNotebookEvent(wxEventType commandType = wxEVT_NULL,
+ int winId = 0)
+ : wxBookCtrlEvent(commandType, winId)
+ {
+ m_dragSource = NULL;
+ }
+#ifndef SWIG
+ wxAuiNotebookEvent(const wxAuiNotebookEvent& c) : wxBookCtrlEvent(c)
+ {
+ m_dragSource = c.m_dragSource;
+ }
+#endif
+ wxEvent *Clone() const { return new wxAuiNotebookEvent(*this); }
+
+ void SetDragSource(wxAuiNotebook* s) { m_dragSource = s; }
+ wxAuiNotebook* GetDragSource() const { return m_dragSource; }
+
+private:
+ wxAuiNotebook* m_dragSource;
+
+#ifndef SWIG
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiNotebookEvent)
+#endif
+};
+
+
+class WXDLLIMPEXP_AUI wxAuiNotebookPage
+{
+public:
+ wxWindow* window; // page's associated window
+ wxString caption; // caption displayed on the tab
+ wxString tooltip; // tooltip displayed when hovering over tab title
+ wxBitmap bitmap; // tab's bitmap
+ wxRect rect; // tab's hit rectangle
+ bool active; // true if the page is currently active
+};
+
+class WXDLLIMPEXP_AUI wxAuiTabContainerButton
+{
+public:
+
+ int id; // button's id
+ int curState; // current state (normal, hover, pressed, etc.)
+ int location; // buttons location (wxLEFT, wxRIGHT, or wxCENTER)
+ wxBitmap bitmap; // button's hover bitmap
+ wxBitmap disBitmap; // button's disabled bitmap
+ wxRect rect; // button's hit rectangle
+};
+
+
+#ifndef SWIG
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiNotebookPage, wxAuiNotebookPageArray, WXDLLIMPEXP_AUI);
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiTabContainerButton, wxAuiTabContainerButtonArray, WXDLLIMPEXP_AUI);
+#endif
+
+
+class WXDLLIMPEXP_AUI wxAuiTabContainer
+{
+public:
+
+ wxAuiTabContainer();
+ virtual ~wxAuiTabContainer();
+
+ void SetArtProvider(wxAuiTabArt* art);
+ wxAuiTabArt* GetArtProvider() const;
+
+ void SetFlags(unsigned int flags);
+ unsigned int GetFlags() const;
+
+ bool AddPage(wxWindow* page, const wxAuiNotebookPage& info);
+ bool InsertPage(wxWindow* page, const wxAuiNotebookPage& info, size_t idx);
+ bool MovePage(wxWindow* page, size_t newIdx);
+ bool RemovePage(wxWindow* page);
+ bool SetActivePage(wxWindow* page);
+ bool SetActivePage(size_t page);
+ void SetNoneActive();
+ int GetActivePage() const;
+ bool TabHitTest(int x, int y, wxWindow** hit) const;
+ bool ButtonHitTest(int x, int y, wxAuiTabContainerButton** hit) const;
+ wxWindow* GetWindowFromIdx(size_t idx) const;
+ int GetIdxFromWindow(wxWindow* page) const;
+ size_t GetPageCount() const;
+ wxAuiNotebookPage& GetPage(size_t idx);
+ const wxAuiNotebookPage& GetPage(size_t idx) const;
+ wxAuiNotebookPageArray& GetPages();
+ void SetNormalFont(const wxFont& normalFont);
+ void SetSelectedFont(const wxFont& selectedFont);
+ void SetMeasuringFont(const wxFont& measuringFont);
+ void SetColour(const wxColour& colour);
+ void SetActiveColour(const wxColour& colour);
+ void DoShowHide();
+ void SetRect(const wxRect& rect);
+
+ void RemoveButton(int id);
+ void AddButton(int id,
+ int location,
+ const wxBitmap& normalBitmap = wxNullBitmap,
+ const wxBitmap& disabledBitmap = wxNullBitmap);
+
+ size_t GetTabOffset() const;
+ void SetTabOffset(size_t offset);
+
+ // Is the tab visible?
+ bool IsTabVisible(int tabPage, int tabOffset, wxDC* dc, wxWindow* wnd);
+
+ // Make the tab visible if it wasn't already
+ void MakeTabVisible(int tabPage, wxWindow* win);
+
+protected:
+
+ virtual void Render(wxDC* dc, wxWindow* wnd);
+
+protected:
+
+ wxAuiTabArt* m_art;
+ wxAuiNotebookPageArray m_pages;
+ wxAuiTabContainerButtonArray m_buttons;
+ wxAuiTabContainerButtonArray m_tabCloseButtons;
+ wxRect m_rect;
+ size_t m_tabOffset;
+ unsigned int m_flags;
+};
+
+
+
+class WXDLLIMPEXP_AUI wxAuiTabCtrl : public wxControl,
+ public wxAuiTabContainer
+{
+public:
+
+ wxAuiTabCtrl(wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0);
+
+ ~wxAuiTabCtrl();
+
+ bool IsDragging() const { return m_isDragging; }
+
+protected:
+ // choose the default border for this window
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ void OnPaint(wxPaintEvent& evt);
+ void OnEraseBackground(wxEraseEvent& evt);
+ void OnSize(wxSizeEvent& evt);
+ void OnLeftDown(wxMouseEvent& evt);
+ void OnLeftDClick(wxMouseEvent& evt);
+ void OnLeftUp(wxMouseEvent& evt);
+ void OnMiddleDown(wxMouseEvent& evt);
+ void OnMiddleUp(wxMouseEvent& evt);
+ void OnRightDown(wxMouseEvent& evt);
+ void OnRightUp(wxMouseEvent& evt);
+ void OnMotion(wxMouseEvent& evt);
+ void OnLeaveWindow(wxMouseEvent& evt);
+ void OnButton(wxAuiNotebookEvent& evt);
+ void OnSetFocus(wxFocusEvent& event);
+ void OnKillFocus(wxFocusEvent& event);
+ void OnChar(wxKeyEvent& event);
+ void OnCaptureLost(wxMouseCaptureLostEvent& evt);
+
+protected:
+
+ wxPoint m_clickPt;
+ wxWindow* m_clickTab;
+ bool m_isDragging;
+ wxAuiTabContainerButton* m_hoverButton;
+ wxAuiTabContainerButton* m_pressedButton;
+
+#ifndef SWIG
+ DECLARE_CLASS(wxAuiTabCtrl)
+ DECLARE_EVENT_TABLE()
+#endif
+};
+
+
+
+
+class WXDLLIMPEXP_AUI wxAuiNotebook : public wxNavigationEnabled<wxBookCtrlBase>
+{
+
+public:
+
+ wxAuiNotebook() { Init(); }
+
+ wxAuiNotebook(wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxAUI_NB_DEFAULT_STYLE)
+ {
+ Init();
+ Create(parent, id, pos, size, style);
+ }
+
+ virtual ~wxAuiNotebook();
+
+ bool Create(wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0);
+
+ void SetWindowStyleFlag(long style);
+ void SetArtProvider(wxAuiTabArt* art);
+ wxAuiTabArt* GetArtProvider() const;
+
+ virtual void SetUniformBitmapSize(const wxSize& size);
+ virtual void SetTabCtrlHeight(int height);
+
+ bool AddPage(wxWindow* page,
+ const wxString& caption,
+ bool select = false,
+ const wxBitmap& bitmap = wxNullBitmap);
+
+ bool InsertPage(size_t pageIdx,
+ wxWindow* page,
+ const wxString& caption,
+ bool select = false,
+ const wxBitmap& bitmap = wxNullBitmap);
+
+ bool DeletePage(size_t page);
+ bool RemovePage(size_t page);
+
+ virtual size_t GetPageCount() const;
+ virtual wxWindow* GetPage(size_t pageIdx) const;
+ int GetPageIndex(wxWindow* pageWnd) const;
+
+ bool SetPageText(size_t page, const wxString& text);
+ wxString GetPageText(size_t pageIdx) const;
+
+ bool SetPageToolTip(size_t page, const wxString& text);
+ wxString GetPageToolTip(size_t pageIdx) const;
+
+ bool SetPageBitmap(size_t page, const wxBitmap& bitmap);
+ wxBitmap GetPageBitmap(size_t pageIdx) const;
+
+ int SetSelection(size_t newPage);
+ int GetSelection() const;
+
+ virtual void Split(size_t page, int direction);
+
+ const wxAuiManager& GetAuiManager() const { return m_mgr; }
+
+ // Sets the normal font
+ void SetNormalFont(const wxFont& font);
+
+ // Sets the selected tab font
+ void SetSelectedFont(const wxFont& font);
+
+ // Sets the measuring font
+ void SetMeasuringFont(const wxFont& font);
+
+ // Sets the tab font
+ virtual bool SetFont(const wxFont& font);
+
+ // Gets the tab control height
+ int GetTabCtrlHeight() const;
+
+ // Gets the height of the notebook for a given page height
+ int GetHeightForPageHeight(int pageHeight);
+
+ // Shows the window menu
+ bool ShowWindowMenu();
+
+ // we do have multiple pages
+ virtual bool HasMultiplePages() const { return true; }
+
+ // we don't want focus for ourselves
+ // virtual bool AcceptsFocus() const { return false; }
+
+ //wxBookCtrlBase functions
+
+ virtual void SetPageSize (const wxSize &size);
+ virtual int HitTest (const wxPoint &pt, long *flags=NULL) const;
+
+ virtual int GetPageImage(size_t n) const;
+ virtual bool SetPageImage(size_t n, int imageId);
+
+ virtual int ChangeSelection(size_t n);
+
+ virtual bool AddPage(wxWindow *page, const wxString &text, bool select,
+ int imageId);
+ virtual bool DeleteAllPages();
+ virtual bool InsertPage(size_t index, wxWindow *page, const wxString &text,
+ bool select, int imageId);
+
+protected:
+ // Common part of all ctors.
+ void Init();
+
+ // choose the default border for this window
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ // Redo sizing after thawing
+ virtual void DoThaw();
+
+ // these can be overridden
+
+ // update the height, return true if it was done or false if the new height
+ // calculated by CalculateTabCtrlHeight() is the same as the old one
+ virtual bool UpdateTabCtrlHeight();
+
+ virtual int CalculateTabCtrlHeight();
+ virtual wxSize CalculateNewSplitSize();
+
+ // remove the page and return a pointer to it
+ virtual wxWindow *DoRemovePage(size_t WXUNUSED(page)) { return NULL; }
+
+ //A general selection function
+ virtual int DoModifySelection(size_t n, bool events);
+
+protected:
+
+ void DoSizing();
+ void InitNotebook(long style);
+ wxAuiTabCtrl* GetTabCtrlFromPoint(const wxPoint& pt);
+ wxWindow* GetTabFrameFromTabCtrl(wxWindow* tabCtrl);
+ wxAuiTabCtrl* GetActiveTabCtrl();
+ bool FindTab(wxWindow* page, wxAuiTabCtrl** ctrl, int* idx);
+ void RemoveEmptyTabFrames();
+ void UpdateHintWindowSize();
+
+protected:
+
+ void OnChildFocusNotebook(wxChildFocusEvent& evt);
+ void OnRender(wxAuiManagerEvent& evt);
+ void OnSize(wxSizeEvent& evt);
+ void OnTabClicked(wxAuiNotebookEvent& evt);
+ void OnTabBeginDrag(wxAuiNotebookEvent& evt);
+ void OnTabDragMotion(wxAuiNotebookEvent& evt);
+ void OnTabEndDrag(wxAuiNotebookEvent& evt);
+ void OnTabCancelDrag(wxAuiNotebookEvent& evt);
+ void OnTabButton(wxAuiNotebookEvent& evt);
+ void OnTabMiddleDown(wxAuiNotebookEvent& evt);
+ void OnTabMiddleUp(wxAuiNotebookEvent& evt);
+ void OnTabRightDown(wxAuiNotebookEvent& evt);
+ void OnTabRightUp(wxAuiNotebookEvent& evt);
+ void OnTabBgDClick(wxAuiNotebookEvent& evt);
+ void OnNavigationKeyNotebook(wxNavigationKeyEvent& event);
+
+ // set selection to the given window (which must be non-NULL and be one of
+ // our pages, otherwise an assert is raised)
+ void SetSelectionToWindow(wxWindow *win);
+ void SetSelectionToPage(const wxAuiNotebookPage& page)
+ {
+ SetSelectionToWindow(page.window);
+ }
+
+protected:
+
+ wxAuiManager m_mgr;
+ wxAuiTabContainer m_tabs;
+ int m_curPage;
+ int m_tabIdCounter;
+ wxWindow* m_dummyWnd;
+
+ wxSize m_requestedBmpSize;
+ int m_requestedTabCtrlHeight;
+ wxFont m_selectedFont;
+ wxFont m_normalFont;
+ int m_tabCtrlHeight;
+
+ int m_lastDragX;
+ unsigned int m_flags;
+
+#ifndef SWIG
+ DECLARE_CLASS(wxAuiNotebook)
+ DECLARE_EVENT_TABLE()
+#endif
+};
+
+
+
+
+// wx event machinery
+
+#ifndef SWIG
+
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_PAGE_CHANGING, wxAuiNotebookEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_PAGE_CLOSED, wxAuiNotebookEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_BUTTON, wxAuiNotebookEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_BEGIN_DRAG, wxAuiNotebookEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_END_DRAG, wxAuiNotebookEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_DRAG_MOTION, wxAuiNotebookEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_ALLOW_DND, wxAuiNotebookEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN, wxAuiNotebookEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP, wxAuiNotebookEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN, wxAuiNotebookEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_TAB_RIGHT_UP, wxAuiNotebookEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_DRAG_DONE, wxAuiNotebookEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_BG_DCLICK, wxAuiNotebookEvent);
+
+typedef void (wxEvtHandler::*wxAuiNotebookEventFunction)(wxAuiNotebookEvent&);
+
+#define wxAuiNotebookEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxAuiNotebookEventFunction, func)
+
+#define EVT_AUINOTEBOOK_PAGE_CLOSE(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_PAGE_CLOSE, winid, wxAuiNotebookEventHandler(fn))
+#define EVT_AUINOTEBOOK_PAGE_CLOSED(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_PAGE_CLOSED, winid, wxAuiNotebookEventHandler(fn))
+#define EVT_AUINOTEBOOK_PAGE_CHANGED(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_PAGE_CHANGED, winid, wxAuiNotebookEventHandler(fn))
+#define EVT_AUINOTEBOOK_PAGE_CHANGING(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_PAGE_CHANGING, winid, wxAuiNotebookEventHandler(fn))
+#define EVT_AUINOTEBOOK_BUTTON(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_BUTTON, winid, wxAuiNotebookEventHandler(fn))
+#define EVT_AUINOTEBOOK_BEGIN_DRAG(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_BEGIN_DRAG, winid, wxAuiNotebookEventHandler(fn))
+#define EVT_AUINOTEBOOK_END_DRAG(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_END_DRAG, winid, wxAuiNotebookEventHandler(fn))
+#define EVT_AUINOTEBOOK_DRAG_MOTION(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_DRAG_MOTION, winid, wxAuiNotebookEventHandler(fn))
+#define EVT_AUINOTEBOOK_ALLOW_DND(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_ALLOW_DND, winid, wxAuiNotebookEventHandler(fn))
+#define EVT_AUINOTEBOOK_DRAG_DONE(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_DRAG_DONE, winid, wxAuiNotebookEventHandler(fn))
+#define EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN, winid, wxAuiNotebookEventHandler(fn))
+#define EVT_AUINOTEBOOK_TAB_MIDDLE_UP(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP, winid, wxAuiNotebookEventHandler(fn))
+#define EVT_AUINOTEBOOK_TAB_RIGHT_DOWN(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN, winid, wxAuiNotebookEventHandler(fn))
+#define EVT_AUINOTEBOOK_TAB_RIGHT_UP(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_TAB_RIGHT_UP, winid, wxAuiNotebookEventHandler(fn))
+#define EVT_AUINOTEBOOK_BG_DCLICK(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_BG_DCLICK, winid, wxAuiNotebookEventHandler(fn))
+#else
+
+// wxpython/swig event work
+%constant wxEventType wxEVT_AUINOTEBOOK_PAGE_CLOSE;
+%constant wxEventType wxEVT_AUINOTEBOOK_PAGE_CLOSED;
+%constant wxEventType wxEVT_AUINOTEBOOK_PAGE_CHANGED;
+%constant wxEventType wxEVT_AUINOTEBOOK_PAGE_CHANGING;
+%constant wxEventType wxEVT_AUINOTEBOOK_BUTTON;
+%constant wxEventType wxEVT_AUINOTEBOOK_BEGIN_DRAG;
+%constant wxEventType wxEVT_AUINOTEBOOK_END_DRAG;
+%constant wxEventType wxEVT_AUINOTEBOOK_DRAG_MOTION;
+%constant wxEventType wxEVT_AUINOTEBOOK_ALLOW_DND;
+%constant wxEventType wxEVT_AUINOTEBOOK_DRAG_DONE;
+%constant wxEventType wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN;
+%constant wxEventType wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP;
+%constant wxEventType wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN;
+%constant wxEventType wxEVT_AUINOTEBOOK_TAB_RIGHT_UP;
+%constant wxEventType wxEVT_AUINOTEBOOK_BG_DCLICK;
+
+%pythoncode {
+ EVT_AUINOTEBOOK_PAGE_CLOSE = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CLOSE, 1 )
+ EVT_AUINOTEBOOK_PAGE_CLOSED = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CLOSED, 1 )
+ EVT_AUINOTEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CHANGED, 1 )
+ EVT_AUINOTEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CHANGING, 1 )
+ EVT_AUINOTEBOOK_BUTTON = wx.PyEventBinder( wxEVT_AUINOTEBOOK_BUTTON, 1 )
+ EVT_AUINOTEBOOK_BEGIN_DRAG = wx.PyEventBinder( wxEVT_AUINOTEBOOK_BEGIN_DRAG, 1 )
+ EVT_AUINOTEBOOK_END_DRAG = wx.PyEventBinder( wxEVT_AUINOTEBOOK_END_DRAG, 1 )
+ EVT_AUINOTEBOOK_DRAG_MOTION = wx.PyEventBinder( wxEVT_AUINOTEBOOK_DRAG_MOTION, 1 )
+ EVT_AUINOTEBOOK_ALLOW_DND = wx.PyEventBinder( wxEVT_AUINOTEBOOK_ALLOW_DND, 1 )
+ EVT_AUINOTEBOOK_DRAG_DONE = wx.PyEventBinder( wxEVT_AUINOTEBOOK_DRAG_DONE, 1 )
+ EVT__AUINOTEBOOK_TAB_MIDDLE_DOWN = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN, 1 )
+ EVT__AUINOTEBOOK_TAB_MIDDLE_UP = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP, 1 )
+ EVT__AUINOTEBOOK_TAB_RIGHT_DOWN = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN, 1 )
+ EVT__AUINOTEBOOK_TAB_RIGHT_UP = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_RIGHT_UP, 1 )
+ EVT_AUINOTEBOOK_BG_DCLICK = wx.PyEventBinder( wxEVT_AUINOTEBOOK_BG_DCLICK, 1 )
+}
+#endif
+
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE wxEVT_AUINOTEBOOK_PAGE_CLOSE
+#define wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED wxEVT_AUINOTEBOOK_PAGE_CLOSED
+#define wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED wxEVT_AUINOTEBOOK_PAGE_CHANGED
+#define wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING wxEVT_AUINOTEBOOK_PAGE_CHANGING
+#define wxEVT_COMMAND_AUINOTEBOOK_BUTTON wxEVT_AUINOTEBOOK_BUTTON
+#define wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG wxEVT_AUINOTEBOOK_BEGIN_DRAG
+#define wxEVT_COMMAND_AUINOTEBOOK_END_DRAG wxEVT_AUINOTEBOOK_END_DRAG
+#define wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION wxEVT_AUINOTEBOOK_DRAG_MOTION
+#define wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND wxEVT_AUINOTEBOOK_ALLOW_DND
+#define wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE wxEVT_AUINOTEBOOK_DRAG_DONE
+#define wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN
+#define wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP
+#define wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN
+#define wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP wxEVT_AUINOTEBOOK_TAB_RIGHT_UP
+#define wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK wxEVT_AUINOTEBOOK_BG_DCLICK
+#define wxEVT_COMMAND_AUINOTEBOOK_CANCEL_DRAG wxEVT_AUINOTEBOOK_CANCEL_DRAG
+
+#endif // wxUSE_AUI
+#endif // _WX_AUINOTEBOOK_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/aui/dockart.h
+// Purpose: wxaui: wx advanced user interface - docking window manager
+// Author: Benjamin I. Williams
+// Modified by:
+// Created: 2005-05-17
+// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved.
+// Licence: wxWindows Library Licence, Version 3.1
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DOCKART_H_
+#define _WX_DOCKART_H_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_AUI
+
+#include "wx/pen.h"
+#include "wx/brush.h"
+#include "wx/bitmap.h"
+#include "wx/colour.h"
+
+// dock art provider code - a dock provider provides all drawing
+// functionality to the wxAui dock manager. This allows the dock
+// manager to have plugable look-and-feels
+
+class WXDLLIMPEXP_AUI wxAuiDockArt
+{
+public:
+
+ wxAuiDockArt() { }
+ virtual ~wxAuiDockArt() { }
+
+ virtual int GetMetric(int id) = 0;
+ virtual void SetMetric(int id, int newVal) = 0;
+ virtual void SetFont(int id, const wxFont& font) = 0;
+ virtual wxFont GetFont(int id) = 0;
+ virtual wxColour GetColour(int id) = 0;
+ virtual void SetColour(int id, const wxColor& colour) = 0;
+ wxColour GetColor(int id) { return GetColour(id); }
+ void SetColor(int id, const wxColour& color) { SetColour(id, color); }
+
+ virtual void DrawSash(wxDC& dc,
+ wxWindow* window,
+ int orientation,
+ const wxRect& rect) = 0;
+
+ virtual void DrawBackground(wxDC& dc,
+ wxWindow* window,
+ int orientation,
+ const wxRect& rect) = 0;
+
+ virtual void DrawCaption(wxDC& dc,
+ wxWindow* window,
+ const wxString& text,
+ const wxRect& rect,
+ wxAuiPaneInfo& pane) = 0;
+
+ virtual void DrawGripper(wxDC& dc,
+ wxWindow* window,
+ const wxRect& rect,
+ wxAuiPaneInfo& pane) = 0;
+
+ virtual void DrawBorder(wxDC& dc,
+ wxWindow* window,
+ const wxRect& rect,
+ wxAuiPaneInfo& pane) = 0;
+
+ virtual void DrawPaneButton(wxDC& dc,
+ wxWindow* window,
+ int button,
+ int buttonState,
+ const wxRect& rect,
+ wxAuiPaneInfo& pane) = 0;
+};
+
+
+// this is the default art provider for wxAuiManager. Dock art
+// can be customized by creating a class derived from this one,
+// or replacing this class entirely
+
+class WXDLLIMPEXP_AUI wxAuiDefaultDockArt : public wxAuiDockArt
+{
+public:
+
+ wxAuiDefaultDockArt();
+
+ int GetMetric(int metricId);
+ void SetMetric(int metricId, int newVal);
+ wxColour GetColour(int id);
+ void SetColour(int id, const wxColor& colour);
+ void SetFont(int id, const wxFont& font);
+ wxFont GetFont(int id);
+
+ void DrawSash(wxDC& dc,
+ wxWindow *window,
+ int orientation,
+ const wxRect& rect);
+
+ void DrawBackground(wxDC& dc,
+ wxWindow *window,
+ int orientation,
+ const wxRect& rect);
+
+ void DrawCaption(wxDC& dc,
+ wxWindow *window,
+ const wxString& text,
+ const wxRect& rect,
+ wxAuiPaneInfo& pane);
+
+ void DrawGripper(wxDC& dc,
+ wxWindow *window,
+ const wxRect& rect,
+ wxAuiPaneInfo& pane);
+
+ void DrawBorder(wxDC& dc,
+ wxWindow *window,
+ const wxRect& rect,
+ wxAuiPaneInfo& pane);
+
+ void DrawPaneButton(wxDC& dc,
+ wxWindow *window,
+ int button,
+ int buttonState,
+ const wxRect& rect,
+ wxAuiPaneInfo& pane);
+
+ void DrawIcon(wxDC& dc,
+ const wxRect& rect,
+ wxAuiPaneInfo& pane);
+
+protected:
+
+ void DrawCaptionBackground(wxDC& dc, const wxRect& rect, bool active);
+
+ void InitBitmaps();
+
+protected:
+
+ wxPen m_borderPen;
+ wxBrush m_sashBrush;
+ wxBrush m_backgroundBrush;
+ wxBrush m_gripperBrush;
+ wxFont m_captionFont;
+ wxBitmap m_inactiveCloseBitmap;
+ wxBitmap m_inactivePinBitmap;
+ wxBitmap m_inactiveMaximizeBitmap;
+ wxBitmap m_inactiveRestoreBitmap;
+ wxBitmap m_activeCloseBitmap;
+ wxBitmap m_activePinBitmap;
+ wxBitmap m_activeMaximizeBitmap;
+ wxBitmap m_activeRestoreBitmap;
+ wxPen m_gripperPen1;
+ wxPen m_gripperPen2;
+ wxPen m_gripperPen3;
+ wxColour m_baseColour;
+ wxColour m_activeCaptionColour;
+ wxColour m_activeCaptionGradientColour;
+ wxColour m_activeCaptionTextColour;
+ wxColour m_inactiveCaptionColour;
+ wxColour m_inactiveCaptionGradientColour;
+ wxColour m_inactiveCaptionTextColour;
+ int m_borderSize;
+ int m_captionSize;
+ int m_sashSize;
+ int m_buttonSize;
+ int m_gripperSize;
+ int m_gradientType;
+};
+
+
+
+#endif // wxUSE_AUI
+#endif //_WX_DOCKART_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/aui/floatpane.h
+// Purpose: wxaui: wx advanced user interface - docking window manager
+// Author: Benjamin I. Williams
+// Modified by:
+// Created: 2005-05-17
+// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved.
+// Licence: wxWindows Library Licence, Version 3.1
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FLOATPANE_H_
+#define _WX_FLOATPANE_H_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+#include "wx/weakref.h"
+
+#if wxUSE_AUI
+
+#if wxUSE_MINIFRAME
+ #include "wx/minifram.h"
+ #define wxAuiFloatingFrameBaseClass wxMiniFrame
+#else
+ #include "wx/frame.h"
+ #define wxAuiFloatingFrameBaseClass wxFrame
+#endif
+
+class WXDLLIMPEXP_AUI wxAuiFloatingFrame : public wxAuiFloatingFrameBaseClass
+{
+public:
+ wxAuiFloatingFrame(wxWindow* parent,
+ wxAuiManager* ownerMgr,
+ const wxAuiPaneInfo& pane,
+ wxWindowID id = wxID_ANY,
+ long style = wxRESIZE_BORDER | wxSYSTEM_MENU | wxCAPTION |
+ wxFRAME_NO_TASKBAR | wxFRAME_FLOAT_ON_PARENT |
+ wxCLIP_CHILDREN
+ );
+ virtual ~wxAuiFloatingFrame();
+ void SetPaneWindow(const wxAuiPaneInfo& pane);
+ wxAuiManager* GetOwnerManager() const;
+
+protected:
+ virtual void OnMoveStart();
+ virtual void OnMoving(const wxRect& windowRect, wxDirection dir);
+ virtual void OnMoveFinished();
+
+private:
+ void OnSize(wxSizeEvent& event);
+ void OnClose(wxCloseEvent& event);
+ void OnMoveEvent(wxMoveEvent& event);
+ void OnIdle(wxIdleEvent& event);
+ void OnActivate(wxActivateEvent& event);
+ static bool isMouseDown();
+
+private:
+ wxWindow* m_paneWindow; // pane window being managed
+ bool m_solidDrag; // true if system uses solid window drag
+ bool m_moving;
+ wxRect m_lastRect;
+ wxRect m_last2Rect;
+ wxRect m_last3Rect;
+ wxSize m_lastSize;
+ wxDirection m_lastDirection;
+
+ wxWeakRef<wxAuiManager> m_ownerMgr;
+ wxAuiManager m_mgr;
+
+#ifndef SWIG
+ DECLARE_EVENT_TABLE()
+ DECLARE_CLASS(wxAuiFloatingFrame)
+#endif // SWIG
+};
+
+#endif // wxUSE_AUI
+#endif //_WX_FLOATPANE_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/aui/framemanager.h
+// Purpose: wxaui: wx advanced user interface - docking window manager
+// Author: Benjamin I. Williams
+// Modified by:
+// Created: 2005-05-17
+// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved.
+// Licence: wxWindows Library Licence, Version 3.1
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FRAMEMANAGER_H_
+#define _WX_FRAMEMANAGER_H_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_AUI
+
+#include "wx/dynarray.h"
+#include "wx/gdicmn.h"
+#include "wx/window.h"
+#include "wx/timer.h"
+#include "wx/sizer.h"
+#include "wx/bitmap.h"
+
+enum wxAuiManagerDock
+{
+ wxAUI_DOCK_NONE = 0,
+ wxAUI_DOCK_TOP = 1,
+ wxAUI_DOCK_RIGHT = 2,
+ wxAUI_DOCK_BOTTOM = 3,
+ wxAUI_DOCK_LEFT = 4,
+ wxAUI_DOCK_CENTER = 5,
+ wxAUI_DOCK_CENTRE = wxAUI_DOCK_CENTER
+};
+
+enum wxAuiManagerOption
+{
+ wxAUI_MGR_ALLOW_FLOATING = 1 << 0,
+ wxAUI_MGR_ALLOW_ACTIVE_PANE = 1 << 1,
+ wxAUI_MGR_TRANSPARENT_DRAG = 1 << 2,
+ wxAUI_MGR_TRANSPARENT_HINT = 1 << 3,
+ wxAUI_MGR_VENETIAN_BLINDS_HINT = 1 << 4,
+ wxAUI_MGR_RECTANGLE_HINT = 1 << 5,
+ wxAUI_MGR_HINT_FADE = 1 << 6,
+ wxAUI_MGR_NO_VENETIAN_BLINDS_FADE = 1 << 7,
+ wxAUI_MGR_LIVE_RESIZE = 1 << 8,
+
+ wxAUI_MGR_DEFAULT = wxAUI_MGR_ALLOW_FLOATING |
+ wxAUI_MGR_TRANSPARENT_HINT |
+ wxAUI_MGR_HINT_FADE |
+ wxAUI_MGR_NO_VENETIAN_BLINDS_FADE
+};
+
+
+enum wxAuiPaneDockArtSetting
+{
+ wxAUI_DOCKART_SASH_SIZE = 0,
+ wxAUI_DOCKART_CAPTION_SIZE = 1,
+ wxAUI_DOCKART_GRIPPER_SIZE = 2,
+ wxAUI_DOCKART_PANE_BORDER_SIZE = 3,
+ wxAUI_DOCKART_PANE_BUTTON_SIZE = 4,
+ wxAUI_DOCKART_BACKGROUND_COLOUR = 5,
+ wxAUI_DOCKART_SASH_COLOUR = 6,
+ wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR = 7,
+ wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR = 8,
+ wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR = 9,
+ wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR = 10,
+ wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR = 11,
+ wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR = 12,
+ wxAUI_DOCKART_BORDER_COLOUR = 13,
+ wxAUI_DOCKART_GRIPPER_COLOUR = 14,
+ wxAUI_DOCKART_CAPTION_FONT = 15,
+ wxAUI_DOCKART_GRADIENT_TYPE = 16
+};
+
+enum wxAuiPaneDockArtGradients
+{
+ wxAUI_GRADIENT_NONE = 0,
+ wxAUI_GRADIENT_VERTICAL = 1,
+ wxAUI_GRADIENT_HORIZONTAL = 2
+};
+
+enum wxAuiPaneButtonState
+{
+ wxAUI_BUTTON_STATE_NORMAL = 0,
+ wxAUI_BUTTON_STATE_HOVER = 1 << 1,
+ wxAUI_BUTTON_STATE_PRESSED = 1 << 2,
+ wxAUI_BUTTON_STATE_DISABLED = 1 << 3,
+ wxAUI_BUTTON_STATE_HIDDEN = 1 << 4,
+ wxAUI_BUTTON_STATE_CHECKED = 1 << 5
+};
+
+enum wxAuiButtonId
+{
+ wxAUI_BUTTON_CLOSE = 101,
+ wxAUI_BUTTON_MAXIMIZE_RESTORE = 102,
+ wxAUI_BUTTON_MINIMIZE = 103,
+ wxAUI_BUTTON_PIN = 104,
+ wxAUI_BUTTON_OPTIONS = 105,
+ wxAUI_BUTTON_WINDOWLIST = 106,
+ wxAUI_BUTTON_LEFT = 107,
+ wxAUI_BUTTON_RIGHT = 108,
+ wxAUI_BUTTON_UP = 109,
+ wxAUI_BUTTON_DOWN = 110,
+ wxAUI_BUTTON_CUSTOM1 = 201,
+ wxAUI_BUTTON_CUSTOM2 = 202,
+ wxAUI_BUTTON_CUSTOM3 = 203
+};
+
+enum wxAuiPaneInsertLevel
+{
+ wxAUI_INSERT_PANE = 0,
+ wxAUI_INSERT_ROW = 1,
+ wxAUI_INSERT_DOCK = 2
+};
+
+
+
+
+// forwards and array declarations
+class wxAuiDockUIPart;
+class wxAuiPaneButton;
+class wxAuiPaneInfo;
+class wxAuiDockInfo;
+class wxAuiDockArt;
+class wxAuiManagerEvent;
+
+#ifndef SWIG
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiDockInfo, wxAuiDockInfoArray, WXDLLIMPEXP_AUI);
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiDockUIPart, wxAuiDockUIPartArray, WXDLLIMPEXP_AUI);
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiPaneButton, wxAuiPaneButtonArray, WXDLLIMPEXP_AUI);
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiPaneInfo, wxAuiPaneInfoArray, WXDLLIMPEXP_AUI);
+WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxAuiPaneInfo*, wxAuiPaneInfoPtrArray, class WXDLLIMPEXP_AUI);
+WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxAuiDockInfo*, wxAuiDockInfoPtrArray, class WXDLLIMPEXP_AUI);
+#endif // SWIG
+
+extern WXDLLIMPEXP_AUI wxAuiDockInfo wxAuiNullDockInfo;
+extern WXDLLIMPEXP_AUI wxAuiPaneInfo wxAuiNullPaneInfo;
+
+
+
+class WXDLLIMPEXP_AUI wxAuiPaneInfo
+{
+public:
+
+ wxAuiPaneInfo()
+ {
+ window = NULL;
+ frame = NULL;
+ state = 0;
+ dock_direction = wxAUI_DOCK_LEFT;
+ dock_layer = 0;
+ dock_row = 0;
+ dock_pos = 0;
+ floating_pos = wxDefaultPosition;
+ floating_size = wxDefaultSize;
+ best_size = wxDefaultSize;
+ min_size = wxDefaultSize;
+ max_size = wxDefaultSize;
+ dock_proportion = 0;
+
+ DefaultPane();
+ }
+
+ ~wxAuiPaneInfo() {}
+
+#ifndef SWIG
+ wxAuiPaneInfo(const wxAuiPaneInfo& c)
+ {
+ name = c.name;
+ caption = c.caption;
+ icon = c.icon;
+ window = c.window;
+ frame = c.frame;
+ state = c.state;
+ dock_direction = c.dock_direction;
+ dock_layer = c.dock_layer;
+ dock_row = c.dock_row;
+ dock_pos = c.dock_pos;
+ best_size = c.best_size;
+ min_size = c.min_size;
+ max_size = c.max_size;
+ floating_pos = c.floating_pos;
+ floating_size = c.floating_size;
+ dock_proportion = c.dock_proportion;
+ buttons = c.buttons;
+ rect = c.rect;
+ }
+
+ wxAuiPaneInfo& operator=(const wxAuiPaneInfo& c)
+ {
+ name = c.name;
+ caption = c.caption;
+ window = c.window;
+ frame = c.frame;
+ state = c.state;
+ dock_direction = c.dock_direction;
+ dock_layer = c.dock_layer;
+ dock_row = c.dock_row;
+ dock_pos = c.dock_pos;
+ best_size = c.best_size;
+ min_size = c.min_size;
+ max_size = c.max_size;
+ floating_pos = c.floating_pos;
+ floating_size = c.floating_size;
+ dock_proportion = c.dock_proportion;
+ buttons = c.buttons;
+ rect = c.rect;
+ return *this;
+ }
+#endif // SWIG
+
+ // Write the safe parts of a newly loaded PaneInfo structure "source" into "this"
+ // used on loading perspectives etc.
+ void SafeSet(wxAuiPaneInfo source)
+ {
+ // note source is not passed by reference so we can overwrite, to keep the
+ // unsafe bits of "dest"
+ source.window = window;
+ source.frame = frame;
+ source.buttons = buttons;
+ wxCHECK_RET(source.IsValid(),
+ "window settings and pane settings are incompatible");
+ // now assign
+ *this = source;
+ }
+
+ bool IsOk() const { return window != NULL; }
+ bool IsFixed() const { return !HasFlag(optionResizable); }
+ bool IsResizable() const { return HasFlag(optionResizable); }
+ bool IsShown() const { return !HasFlag(optionHidden); }
+ bool IsFloating() const { return HasFlag(optionFloating); }
+ bool IsDocked() const { return !HasFlag(optionFloating); }
+ bool IsToolbar() const { return HasFlag(optionToolbar); }
+ bool IsTopDockable() const { return HasFlag(optionTopDockable); }
+ bool IsBottomDockable() const { return HasFlag(optionBottomDockable); }
+ bool IsLeftDockable() const { return HasFlag(optionLeftDockable); }
+ bool IsRightDockable() const { return HasFlag(optionRightDockable); }
+ bool IsDockable() const
+ {
+ return HasFlag(optionTopDockable | optionBottomDockable |
+ optionLeftDockable | optionRightDockable);
+ }
+ bool IsFloatable() const { return HasFlag(optionFloatable); }
+ bool IsMovable() const { return HasFlag(optionMovable); }
+ bool IsDestroyOnClose() const { return HasFlag(optionDestroyOnClose); }
+ bool IsMaximized() const { return HasFlag(optionMaximized); }
+ bool HasCaption() const { return HasFlag(optionCaption); }
+ bool HasGripper() const { return HasFlag(optionGripper); }
+ bool HasBorder() const { return HasFlag(optionPaneBorder); }
+ bool HasCloseButton() const { return HasFlag(buttonClose); }
+ bool HasMaximizeButton() const { return HasFlag(buttonMaximize); }
+ bool HasMinimizeButton() const { return HasFlag(buttonMinimize); }
+ bool HasPinButton() const { return HasFlag(buttonPin); }
+ bool HasGripperTop() const { return HasFlag(optionGripperTop); }
+
+#ifdef SWIG
+ %typemap(out) wxAuiPaneInfo& { $result = $self; Py_INCREF($result); }
+#endif
+ wxAuiPaneInfo& Window(wxWindow* w)
+ {
+ wxAuiPaneInfo test(*this);
+ test.window = w;
+ wxCHECK_MSG(test.IsValid(), *this,
+ "window settings and pane settings are incompatible");
+ *this = test;
+ return *this;
+ }
+ wxAuiPaneInfo& Name(const wxString& n) { name = n; return *this; }
+ wxAuiPaneInfo& Caption(const wxString& c) { caption = c; return *this; }
+ wxAuiPaneInfo& Icon(const wxBitmap& b) { icon = b; return *this; }
+ wxAuiPaneInfo& Left() { dock_direction = wxAUI_DOCK_LEFT; return *this; }
+ wxAuiPaneInfo& Right() { dock_direction = wxAUI_DOCK_RIGHT; return *this; }
+ wxAuiPaneInfo& Top() { dock_direction = wxAUI_DOCK_TOP; return *this; }
+ wxAuiPaneInfo& Bottom() { dock_direction = wxAUI_DOCK_BOTTOM; return *this; }
+ wxAuiPaneInfo& Center() { dock_direction = wxAUI_DOCK_CENTER; return *this; }
+ wxAuiPaneInfo& Centre() { dock_direction = wxAUI_DOCK_CENTRE; return *this; }
+ wxAuiPaneInfo& Direction(int direction) { dock_direction = direction; return *this; }
+ wxAuiPaneInfo& Layer(int layer) { dock_layer = layer; return *this; }
+ wxAuiPaneInfo& Row(int row) { dock_row = row; return *this; }
+ wxAuiPaneInfo& Position(int pos) { dock_pos = pos; return *this; }
+ wxAuiPaneInfo& BestSize(const wxSize& size) { best_size = size; return *this; }
+ wxAuiPaneInfo& MinSize(const wxSize& size) { min_size = size; return *this; }
+ wxAuiPaneInfo& MaxSize(const wxSize& size) { max_size = size; return *this; }
+ wxAuiPaneInfo& BestSize(int x, int y) { best_size.Set(x,y); return *this; }
+ wxAuiPaneInfo& MinSize(int x, int y) { min_size.Set(x,y); return *this; }
+ wxAuiPaneInfo& MaxSize(int x, int y) { max_size.Set(x,y); return *this; }
+ wxAuiPaneInfo& FloatingPosition(const wxPoint& pos) { floating_pos = pos; return *this; }
+ wxAuiPaneInfo& FloatingPosition(int x, int y) { floating_pos.x = x; floating_pos.y = y; return *this; }
+ wxAuiPaneInfo& FloatingSize(const wxSize& size) { floating_size = size; return *this; }
+ wxAuiPaneInfo& FloatingSize(int x, int y) { floating_size.Set(x,y); return *this; }
+ wxAuiPaneInfo& Fixed() { return SetFlag(optionResizable, false); }
+ wxAuiPaneInfo& Resizable(bool resizable = true) { return SetFlag(optionResizable, resizable); }
+ wxAuiPaneInfo& Dock() { return SetFlag(optionFloating, false); }
+ wxAuiPaneInfo& Float() { return SetFlag(optionFloating, true); }
+ wxAuiPaneInfo& Hide() { return SetFlag(optionHidden, true); }
+ wxAuiPaneInfo& Show(bool show = true) { return SetFlag(optionHidden, !show); }
+ wxAuiPaneInfo& CaptionVisible(bool visible = true) { return SetFlag(optionCaption, visible); }
+ wxAuiPaneInfo& Maximize() { return SetFlag(optionMaximized, true); }
+ wxAuiPaneInfo& Restore() { return SetFlag(optionMaximized, false); }
+ wxAuiPaneInfo& PaneBorder(bool visible = true) { return SetFlag(optionPaneBorder, visible); }
+ wxAuiPaneInfo& Gripper(bool visible = true) { return SetFlag(optionGripper, visible); }
+ wxAuiPaneInfo& GripperTop(bool attop = true) { return SetFlag(optionGripperTop, attop); }
+ wxAuiPaneInfo& CloseButton(bool visible = true) { return SetFlag(buttonClose, visible); }
+ wxAuiPaneInfo& MaximizeButton(bool visible = true) { return SetFlag(buttonMaximize, visible); }
+ wxAuiPaneInfo& MinimizeButton(bool visible = true) { return SetFlag(buttonMinimize, visible); }
+ wxAuiPaneInfo& PinButton(bool visible = true) { return SetFlag(buttonPin, visible); }
+ wxAuiPaneInfo& DestroyOnClose(bool b = true) { return SetFlag(optionDestroyOnClose, b); }
+ wxAuiPaneInfo& TopDockable(bool b = true) { return SetFlag(optionTopDockable, b); }
+ wxAuiPaneInfo& BottomDockable(bool b = true) { return SetFlag(optionBottomDockable, b); }
+ wxAuiPaneInfo& LeftDockable(bool b = true) { return SetFlag(optionLeftDockable, b); }
+ wxAuiPaneInfo& RightDockable(bool b = true) { return SetFlag(optionRightDockable, b); }
+ wxAuiPaneInfo& Floatable(bool b = true) { return SetFlag(optionFloatable, b); }
+ wxAuiPaneInfo& Movable(bool b = true) { return SetFlag(optionMovable, b); }
+ wxAuiPaneInfo& DockFixed(bool b = true) { return SetFlag(optionDockFixed, b); }
+
+ wxAuiPaneInfo& Dockable(bool b = true)
+ {
+ return TopDockable(b).BottomDockable(b).LeftDockable(b).RightDockable(b);
+ }
+
+ wxAuiPaneInfo& DefaultPane()
+ {
+ wxAuiPaneInfo test(*this);
+ test.state |= optionTopDockable | optionBottomDockable |
+ optionLeftDockable | optionRightDockable |
+ optionFloatable | optionMovable | optionResizable |
+ optionCaption | optionPaneBorder | buttonClose;
+ wxCHECK_MSG(test.IsValid(), *this,
+ "window settings and pane settings are incompatible");
+ *this = test;
+ return *this;
+ }
+
+ wxAuiPaneInfo& CentrePane() { return CenterPane(); }
+ wxAuiPaneInfo& CenterPane()
+ {
+ state = 0;
+ return Center().PaneBorder().Resizable();
+ }
+
+ wxAuiPaneInfo& ToolbarPane()
+ {
+ DefaultPane();
+ state |= (optionToolbar | optionGripper);
+ state &= ~(optionResizable | optionCaption);
+ if (dock_layer == 0)
+ dock_layer = 10;
+ return *this;
+ }
+
+ wxAuiPaneInfo& SetFlag(int flag, bool option_state)
+ {
+ wxAuiPaneInfo test(*this);
+ if (option_state)
+ test.state |= flag;
+ else
+ test.state &= ~flag;
+ wxCHECK_MSG(test.IsValid(), *this,
+ "window settings and pane settings are incompatible");
+ *this = test;
+ return *this;
+ }
+
+ bool HasFlag(int flag) const
+ {
+ return (state & flag) != 0;
+ }
+
+#ifdef SWIG
+ %typemap(out) wxAuiPaneInfo& ;
+#endif
+
+public:
+
+ // NOTE: You can add and subtract flags from this list,
+ // but do not change the values of the flags, because
+ // they are stored in a binary integer format in the
+ // perspective string. If you really need to change the
+ // values around, you'll have to ensure backwards-compatibility
+ // in the perspective loading code.
+ enum wxAuiPaneState
+ {
+ optionFloating = 1 << 0,
+ optionHidden = 1 << 1,
+ optionLeftDockable = 1 << 2,
+ optionRightDockable = 1 << 3,
+ optionTopDockable = 1 << 4,
+ optionBottomDockable = 1 << 5,
+ optionFloatable = 1 << 6,
+ optionMovable = 1 << 7,
+ optionResizable = 1 << 8,
+ optionPaneBorder = 1 << 9,
+ optionCaption = 1 << 10,
+ optionGripper = 1 << 11,
+ optionDestroyOnClose = 1 << 12,
+ optionToolbar = 1 << 13,
+ optionActive = 1 << 14,
+ optionGripperTop = 1 << 15,
+ optionMaximized = 1 << 16,
+ optionDockFixed = 1 << 17,
+
+ buttonClose = 1 << 21,
+ buttonMaximize = 1 << 22,
+ buttonMinimize = 1 << 23,
+ buttonPin = 1 << 24,
+
+ buttonCustom1 = 1 << 26,
+ buttonCustom2 = 1 << 27,
+ buttonCustom3 = 1 << 28,
+
+ savedHiddenState = 1 << 30, // used internally
+ actionPane = 1 << 31 // used internally
+ };
+
+public:
+ wxString name; // name of the pane
+ wxString caption; // caption displayed on the window
+ wxBitmap icon; // icon of the pane, may be invalid
+
+ wxWindow* window; // window that is in this pane
+ wxFrame* frame; // floating frame window that holds the pane
+ unsigned int state; // a combination of wxPaneState values
+
+ int dock_direction; // dock direction (top, bottom, left, right, center)
+ int dock_layer; // layer number (0 = innermost layer)
+ int dock_row; // row number on the docking bar (0 = first row)
+ int dock_pos; // position inside the row (0 = first position)
+
+ wxSize best_size; // size that the layout engine will prefer
+ wxSize min_size; // minimum size the pane window can tolerate
+ wxSize max_size; // maximum size the pane window can tolerate
+
+ wxPoint floating_pos; // position while floating
+ wxSize floating_size; // size while floating
+ int dock_proportion; // proportion while docked
+
+ wxAuiPaneButtonArray buttons; // buttons on the pane
+
+
+ wxRect rect; // current rectangle (populated by wxAUI)
+
+ bool IsValid() const;
+};
+
+
+
+class WXDLLIMPEXP_FWD_AUI wxAuiFloatingFrame;
+
+class WXDLLIMPEXP_AUI wxAuiManager : public wxEvtHandler
+{
+ friend class wxAuiFloatingFrame;
+
+public:
+
+ wxAuiManager(wxWindow* managedWnd = NULL,
+ unsigned int flags = wxAUI_MGR_DEFAULT);
+ virtual ~wxAuiManager();
+ void UnInit();
+
+ void SetFlags(unsigned int flags);
+ unsigned int GetFlags() const;
+
+ void SetManagedWindow(wxWindow* managedWnd);
+ wxWindow* GetManagedWindow() const;
+
+ static wxAuiManager* GetManager(wxWindow* window);
+
+ void SetArtProvider(wxAuiDockArt* artProvider);
+ wxAuiDockArt* GetArtProvider() const;
+
+ wxAuiPaneInfo& GetPane(wxWindow* window);
+ wxAuiPaneInfo& GetPane(const wxString& name);
+ wxAuiPaneInfoArray& GetAllPanes();
+
+ bool AddPane(wxWindow* window,
+ const wxAuiPaneInfo& paneInfo);
+
+ bool AddPane(wxWindow* window,
+ const wxAuiPaneInfo& paneInfo,
+ const wxPoint& dropPos);
+
+ bool AddPane(wxWindow* window,
+ int direction = wxLEFT,
+ const wxString& caption = wxEmptyString);
+
+ bool InsertPane(wxWindow* window,
+ const wxAuiPaneInfo& insertLocation,
+ int insertLevel = wxAUI_INSERT_PANE);
+
+ bool DetachPane(wxWindow* window);
+
+ void Update();
+
+ wxString SavePaneInfo(wxAuiPaneInfo& pane);
+ void LoadPaneInfo(wxString panePart, wxAuiPaneInfo &pane);
+ wxString SavePerspective();
+ bool LoadPerspective(const wxString& perspective, bool update = true);
+
+ void SetDockSizeConstraint(double widthPct, double heightPct);
+ void GetDockSizeConstraint(double* widthPct, double* heightPct) const;
+
+ void ClosePane(wxAuiPaneInfo& paneInfo);
+ void MaximizePane(wxAuiPaneInfo& paneInfo);
+ void RestorePane(wxAuiPaneInfo& paneInfo);
+ void RestoreMaximizedPane();
+
+public:
+
+ virtual wxAuiFloatingFrame* CreateFloatingFrame(wxWindow* parent, const wxAuiPaneInfo& p);
+ virtual bool CanDockPanel(const wxAuiPaneInfo & p);
+
+ void StartPaneDrag(
+ wxWindow* paneWindow,
+ const wxPoint& offset);
+
+ wxRect CalculateHintRect(
+ wxWindow* paneWindow,
+ const wxPoint& pt,
+ const wxPoint& offset);
+
+ void DrawHintRect(
+ wxWindow* paneWindow,
+ const wxPoint& pt,
+ const wxPoint& offset);
+
+ virtual void ShowHint(const wxRect& rect);
+ virtual void HideHint();
+
+ void OnHintActivate(wxActivateEvent& event);
+
+public:
+
+ // deprecated -- please use SetManagedWindow() and
+ // and GetManagedWindow() instead
+
+ wxDEPRECATED( void SetFrame(wxFrame* frame) );
+ wxDEPRECATED( wxFrame* GetFrame() const );
+
+protected:
+
+ void UpdateHintWindowConfig();
+
+ void DoFrameLayout();
+
+ void LayoutAddPane(wxSizer* container,
+ wxAuiDockInfo& dock,
+ wxAuiPaneInfo& pane,
+ wxAuiDockUIPartArray& uiparts,
+ bool spacerOnly);
+
+ void LayoutAddDock(wxSizer* container,
+ wxAuiDockInfo& dock,
+ wxAuiDockUIPartArray& uiParts,
+ bool spacerOnly);
+
+ wxSizer* LayoutAll(wxAuiPaneInfoArray& panes,
+ wxAuiDockInfoArray& docks,
+ wxAuiDockUIPartArray & uiParts,
+ bool spacerOnly = false);
+
+ virtual bool ProcessDockResult(wxAuiPaneInfo& target,
+ const wxAuiPaneInfo& newPos);
+
+ bool DoDrop(wxAuiDockInfoArray& docks,
+ wxAuiPaneInfoArray& panes,
+ wxAuiPaneInfo& drop,
+ const wxPoint& pt,
+ const wxPoint& actionOffset = wxPoint(0,0));
+
+ wxAuiDockUIPart* HitTest(int x, int y);
+ wxAuiDockUIPart* GetPanePart(wxWindow* pane);
+ int GetDockPixelOffset(wxAuiPaneInfo& test);
+ void OnFloatingPaneMoveStart(wxWindow* window);
+ void OnFloatingPaneMoving(wxWindow* window, wxDirection dir );
+ void OnFloatingPaneMoved(wxWindow* window, wxDirection dir);
+ void OnFloatingPaneActivated(wxWindow* window);
+ void OnFloatingPaneClosed(wxWindow* window, wxCloseEvent& evt);
+ void OnFloatingPaneResized(wxWindow* window, const wxRect& rect);
+ void Render(wxDC* dc);
+ void Repaint(wxDC* dc = NULL);
+ void ProcessMgrEvent(wxAuiManagerEvent& event);
+ void UpdateButtonOnScreen(wxAuiDockUIPart* buttonUiPart,
+ const wxMouseEvent& event);
+ void GetPanePositionsAndSizes(wxAuiDockInfo& dock,
+ wxArrayInt& positions,
+ wxArrayInt& sizes);
+
+ /// Ends a resize action, or for live update, resizes the sash
+ bool DoEndResizeAction(wxMouseEvent& event);
+
+ void SetActivePane(wxWindow* active_pane);
+
+public:
+
+ // public events (which can be invoked externally)
+ void OnRender(wxAuiManagerEvent& evt);
+ void OnPaneButton(wxAuiManagerEvent& evt);
+
+protected:
+
+ // protected events
+ void OnPaint(wxPaintEvent& evt);
+ void OnEraseBackground(wxEraseEvent& evt);
+ void OnSize(wxSizeEvent& evt);
+ void OnSetCursor(wxSetCursorEvent& evt);
+ void OnLeftDown(wxMouseEvent& evt);
+ void OnLeftUp(wxMouseEvent& evt);
+ void OnMotion(wxMouseEvent& evt);
+ void OnCaptureLost(wxMouseCaptureLostEvent& evt);
+ void OnLeaveWindow(wxMouseEvent& evt);
+ void OnChildFocus(wxChildFocusEvent& evt);
+ void OnHintFadeTimer(wxTimerEvent& evt);
+ void OnFindManager(wxAuiManagerEvent& evt);
+
+protected:
+
+ enum
+ {
+ actionNone = 0,
+ actionResize,
+ actionClickButton,
+ actionClickCaption,
+ actionDragToolbarPane,
+ actionDragFloatingPane
+ };
+
+protected:
+
+ wxWindow* m_frame; // the window being managed
+ wxAuiDockArt* m_art; // dock art object which does all drawing
+ unsigned int m_flags; // manager flags wxAUI_MGR_*
+
+ wxAuiPaneInfoArray m_panes; // array of panes structures
+ wxAuiDockInfoArray m_docks; // array of docks structures
+ wxAuiDockUIPartArray m_uiParts; // array of UI parts (captions, buttons, etc)
+
+ int m_action; // current mouse action
+ wxPoint m_actionStart; // position where the action click started
+ wxPoint m_actionOffset; // offset from upper left of the item clicked
+ wxAuiDockUIPart* m_actionPart; // ptr to the part the action happened to
+ wxWindow* m_actionWindow; // action frame or window (NULL if none)
+ wxRect m_actionHintRect; // hint rectangle for the action
+ wxRect m_lastRect;
+ wxAuiDockUIPart* m_hoverButton;// button uipart being hovered over
+ wxRect m_lastHint; // last hint rectangle
+ wxPoint m_lastMouseMove; // last mouse move position (see OnMotion)
+ int m_currentDragItem;
+ bool m_skipping;
+ bool m_hasMaximized;
+
+ double m_dockConstraintX; // 0.0 .. 1.0; max pct of window width a dock can consume
+ double m_dockConstraintY; // 0.0 .. 1.0; max pct of window height a dock can consume
+
+ wxFrame* m_hintWnd; // transparent hint window, if supported by platform
+ wxTimer m_hintFadeTimer; // transparent fade timer
+ wxByte m_hintFadeAmt; // transparent fade amount
+ wxByte m_hintFadeMax; // maximum value of hint fade
+
+ void* m_reserved;
+
+#ifndef SWIG
+ DECLARE_EVENT_TABLE()
+ DECLARE_CLASS(wxAuiManager)
+#endif // SWIG
+};
+
+
+
+// event declarations/classes
+
+class WXDLLIMPEXP_AUI wxAuiManagerEvent : public wxEvent
+{
+public:
+ wxAuiManagerEvent(wxEventType type=wxEVT_NULL) : wxEvent(0, type)
+ {
+ manager = NULL;
+ pane = NULL;
+ button = 0;
+ veto_flag = false;
+ canveto_flag = true;
+ dc = NULL;
+ }
+#ifndef SWIG
+ wxAuiManagerEvent(const wxAuiManagerEvent& c) : wxEvent(c)
+ {
+ manager = c.manager;
+ pane = c.pane;
+ button = c.button;
+ veto_flag = c.veto_flag;
+ canveto_flag = c.canveto_flag;
+ dc = c.dc;
+ }
+#endif
+ wxEvent *Clone() const { return new wxAuiManagerEvent(*this); }
+
+ void SetManager(wxAuiManager* mgr) { manager = mgr; }
+ void SetPane(wxAuiPaneInfo* p) { pane = p; }
+ void SetButton(int b) { button = b; }
+ void SetDC(wxDC* pdc) { dc = pdc; }
+
+ wxAuiManager* GetManager() const { return manager; }
+ wxAuiPaneInfo* GetPane() const { return pane; }
+ int GetButton() const { return button; }
+ wxDC* GetDC() const { return dc; }
+
+ void Veto(bool veto = true) { veto_flag = veto; }
+ bool GetVeto() const { return veto_flag; }
+ void SetCanVeto(bool can_veto) { canveto_flag = can_veto; }
+ bool CanVeto() const { return canveto_flag && veto_flag; }
+
+public:
+ wxAuiManager* manager;
+ wxAuiPaneInfo* pane;
+ int button;
+ bool veto_flag;
+ bool canveto_flag;
+ wxDC* dc;
+
+#ifndef SWIG
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiManagerEvent)
+#endif
+};
+
+
+class WXDLLIMPEXP_AUI wxAuiDockInfo
+{
+public:
+ wxAuiDockInfo()
+ {
+ dock_direction = 0;
+ dock_layer = 0;
+ dock_row = 0;
+ size = 0;
+ min_size = 0;
+ resizable = true;
+ fixed = false;
+ toolbar = false;
+ reserved1 = false;
+ }
+
+#ifndef SWIG
+ wxAuiDockInfo(const wxAuiDockInfo& c)
+ {
+ dock_direction = c.dock_direction;
+ dock_layer = c.dock_layer;
+ dock_row = c.dock_row;
+ size = c.size;
+ min_size = c.min_size;
+ resizable = c.resizable;
+ fixed = c.fixed;
+ toolbar = c.toolbar;
+ panes = c.panes;
+ rect = c.rect;
+ reserved1 = c.reserved1;
+ }
+
+ wxAuiDockInfo& operator=(const wxAuiDockInfo& c)
+ {
+ dock_direction = c.dock_direction;
+ dock_layer = c.dock_layer;
+ dock_row = c.dock_row;
+ size = c.size;
+ min_size = c.min_size;
+ resizable = c.resizable;
+ fixed = c.fixed;
+ toolbar = c.toolbar;
+ panes = c.panes;
+ rect = c.rect;
+ reserved1 = c.reserved1;
+ return *this;
+ }
+#endif // SWIG
+
+ bool IsOk() const { return dock_direction != 0; }
+ bool IsHorizontal() const { return dock_direction == wxAUI_DOCK_TOP ||
+ dock_direction == wxAUI_DOCK_BOTTOM; }
+ bool IsVertical() const { return dock_direction == wxAUI_DOCK_LEFT ||
+ dock_direction == wxAUI_DOCK_RIGHT ||
+ dock_direction == wxAUI_DOCK_CENTER; }
+public:
+ wxAuiPaneInfoPtrArray panes; // array of panes
+ wxRect rect; // current rectangle
+ int dock_direction; // dock direction (top, bottom, left, right, center)
+ int dock_layer; // layer number (0 = innermost layer)
+ int dock_row; // row number on the docking bar (0 = first row)
+ int size; // size of the dock
+ int min_size; // minimum size of a dock (0 if there is no min)
+ bool resizable; // flag indicating whether the dock is resizable
+ bool toolbar; // flag indicating dock contains only toolbars
+ bool fixed; // flag indicating that the dock operates on
+ // absolute coordinates as opposed to proportional
+ bool reserved1;
+};
+
+
+class WXDLLIMPEXP_AUI wxAuiDockUIPart
+{
+public:
+ enum
+ {
+ typeCaption,
+ typeGripper,
+ typeDock,
+ typeDockSizer,
+ typePane,
+ typePaneSizer,
+ typeBackground,
+ typePaneBorder,
+ typePaneButton
+ };
+
+ int type; // ui part type (see enum above)
+ int orientation; // orientation (either wxHORIZONTAL or wxVERTICAL)
+ wxAuiDockInfo* dock; // which dock the item is associated with
+ wxAuiPaneInfo* pane; // which pane the item is associated with
+ wxAuiPaneButton* button; // which pane button the item is associated with
+ wxSizer* cont_sizer; // the part's containing sizer
+ wxSizerItem* sizer_item; // the sizer item of the part
+ wxRect rect; // client coord rectangle of the part itself
+};
+
+
+class WXDLLIMPEXP_AUI wxAuiPaneButton
+{
+public:
+ int button_id; // id of the button (e.g. buttonClose)
+};
+
+
+
+#ifndef SWIG
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_BUTTON, wxAuiManagerEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_CLOSE, wxAuiManagerEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_RESTORE, wxAuiManagerEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_ACTIVATED, wxAuiManagerEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_RENDER, wxAuiManagerEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_FIND_MANAGER, wxAuiManagerEvent );
+
+typedef void (wxEvtHandler::*wxAuiManagerEventFunction)(wxAuiManagerEvent&);
+
+#define wxAuiManagerEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxAuiManagerEventFunction, func)
+
+#define EVT_AUI_PANE_BUTTON(func) \
+ wx__DECLARE_EVT0(wxEVT_AUI_PANE_BUTTON, wxAuiManagerEventHandler(func))
+#define EVT_AUI_PANE_CLOSE(func) \
+ wx__DECLARE_EVT0(wxEVT_AUI_PANE_CLOSE, wxAuiManagerEventHandler(func))
+#define EVT_AUI_PANE_MAXIMIZE(func) \
+ wx__DECLARE_EVT0(wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEventHandler(func))
+#define EVT_AUI_PANE_RESTORE(func) \
+ wx__DECLARE_EVT0(wxEVT_AUI_PANE_RESTORE, wxAuiManagerEventHandler(func))
+#define EVT_AUI_PANE_ACTIVATED(func) \
+ wx__DECLARE_EVT0(wxEVT_AUI_PANE_ACTIVATED, wxAuiManagerEventHandler(func))
+#define EVT_AUI_RENDER(func) \
+ wx__DECLARE_EVT0(wxEVT_AUI_RENDER, wxAuiManagerEventHandler(func))
+#define EVT_AUI_FIND_MANAGER(func) \
+ wx__DECLARE_EVT0(wxEVT_AUI_FIND_MANAGER, wxAuiManagerEventHandler(func))
+
+#else
+
+%constant wxEventType wxEVT_AUI_PANE_BUTTON;
+%constant wxEventType wxEVT_AUI_PANE_CLOSE;
+%constant wxEventType wxEVT_AUI_PANE_MAXIMIZE;
+%constant wxEventType wxEVT_AUI_PANE_RESTORE;
+%constant wxEventType wxEVT_AUI_PANE_ACTIVATED;
+%constant wxEventType wxEVT_AUI_RENDER;
+%constant wxEventType wxEVT_AUI_FIND_MANAGER;
+
+%pythoncode {
+ EVT_AUI_PANE_BUTTON = wx.PyEventBinder( wxEVT_AUI_PANE_BUTTON )
+ EVT_AUI_PANE_CLOSE = wx.PyEventBinder( wxEVT_AUI_PANE_CLOSE )
+ EVT_AUI_PANE_MAXIMIZE = wx.PyEventBinder( wxEVT_AUI_PANE_MAXIMIZE )
+ EVT_AUI_PANE_RESTORE = wx.PyEventBinder( wxEVT_AUI_PANE_RESTORE )
+ EVT_AUI_PANE_ACTIVATED = wx.PyEventBinder( wxEVT_AUI_PANE_ACTIVATED )
+ EVT_AUI_RENDER = wx.PyEventBinder( wxEVT_AUI_RENDER )
+ EVT_AUI_FIND_MANAGER = wx.PyEventBinder( wxEVT_AUI_FIND_MANAGER )
+}
+#endif // SWIG
+
+#endif // wxUSE_AUI
+#endif //_WX_FRAMEMANAGER_H_
+
--- /dev/null
+//////////////////////////////////////////////////////////////////////////////
+// Name: wx/aui/tabart.h
+// Purpose: wxaui: wx advanced user interface - notebook
+// Author: Benjamin I. Williams
+// Modified by: Jens Lody (extracted from wx/aui/auibook.h)
+// Created: 2012-03-21
+// Copyright: (C) Copyright 2006, Kirix Corporation, All Rights Reserved.
+// Licence: wxWindows Library Licence, Version 3.1
+///////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef _WX_AUI_TABART_H_
+#define _WX_AUI_TABART_H_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_AUI
+
+#include "wx/colour.h"
+#include "wx/gdicmn.h"
+#include "wx/font.h"
+#include "wx/pen.h"
+#include "wx/brush.h"
+#include "wx/bitmap.h"
+
+
+class wxAuiNotebookPage;
+class wxAuiNotebookPageArray;
+class wxWindow;
+class wxDC;
+
+
+// tab art class
+
+class WXDLLIMPEXP_AUI wxAuiTabArt
+{
+public:
+
+ wxAuiTabArt() { }
+ virtual ~wxAuiTabArt() { }
+
+ virtual wxAuiTabArt* Clone() = 0;
+ virtual void SetFlags(unsigned int flags) = 0;
+
+ virtual void SetSizingInfo(const wxSize& tabCtrlSize,
+ size_t tabCount) = 0;
+
+ virtual void SetNormalFont(const wxFont& font) = 0;
+ virtual void SetSelectedFont(const wxFont& font) = 0;
+ virtual void SetMeasuringFont(const wxFont& font) = 0;
+ virtual void SetColour(const wxColour& colour) = 0;
+ virtual void SetActiveColour(const wxColour& colour) = 0;
+
+ virtual void DrawBorder(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect) = 0;
+
+ virtual void DrawBackground(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect) = 0;
+
+ virtual void DrawTab(wxDC& dc,
+ wxWindow* wnd,
+ const wxAuiNotebookPage& pane,
+ const wxRect& inRect,
+ int closeButtonState,
+ wxRect* outTabRect,
+ wxRect* outButtonRect,
+ int* xExtent) = 0;
+
+ virtual void DrawButton(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& inRect,
+ int bitmapId,
+ int buttonState,
+ int orientation,
+ wxRect* outRect) = 0;
+
+ virtual wxSize GetTabSize(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxString& caption,
+ const wxBitmap& bitmap,
+ bool active,
+ int closeButtonState,
+ int* xExtent) = 0;
+
+ virtual int ShowDropDown(
+ wxWindow* wnd,
+ const wxAuiNotebookPageArray& items,
+ int activeIdx) = 0;
+
+ virtual int GetIndentSize() = 0;
+
+ virtual int GetBorderWidth(
+ wxWindow* wnd) = 0;
+
+ virtual int GetAdditionalBorderSpace(
+ wxWindow* wnd) = 0;
+
+ virtual int GetBestTabCtrlSize(
+ wxWindow* wnd,
+ const wxAuiNotebookPageArray& pages,
+ const wxSize& requiredBmpSize) = 0;
+};
+
+
+class WXDLLIMPEXP_AUI wxAuiGenericTabArt : public wxAuiTabArt
+{
+
+public:
+
+ wxAuiGenericTabArt();
+ virtual ~wxAuiGenericTabArt();
+
+ wxAuiTabArt* Clone();
+ void SetFlags(unsigned int flags);
+ void SetSizingInfo(const wxSize& tabCtrlSize,
+ size_t tabCount);
+
+ void SetNormalFont(const wxFont& font);
+ void SetSelectedFont(const wxFont& font);
+ void SetMeasuringFont(const wxFont& font);
+ void SetColour(const wxColour& colour);
+ void SetActiveColour(const wxColour& colour);
+
+ void DrawBorder(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect);
+
+ void DrawBackground(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect);
+
+ void DrawTab(wxDC& dc,
+ wxWindow* wnd,
+ const wxAuiNotebookPage& pane,
+ const wxRect& inRect,
+ int closeButtonState,
+ wxRect* outTabRect,
+ wxRect* outButtonRect,
+ int* xExtent);
+
+ void DrawButton(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& inRect,
+ int bitmapId,
+ int buttonState,
+ int orientation,
+ wxRect* outRect);
+
+ int GetIndentSize();
+
+ int GetBorderWidth(
+ wxWindow* wnd);
+
+ int GetAdditionalBorderSpace(
+ wxWindow* wnd);
+
+ wxSize GetTabSize(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxString& caption,
+ const wxBitmap& bitmap,
+ bool active,
+ int closeButtonState,
+ int* xExtent);
+
+ int ShowDropDown(
+ wxWindow* wnd,
+ const wxAuiNotebookPageArray& items,
+ int activeIdx);
+
+ int GetBestTabCtrlSize(wxWindow* wnd,
+ const wxAuiNotebookPageArray& pages,
+ const wxSize& requiredBmpSize);
+
+protected:
+
+ wxFont m_normalFont;
+ wxFont m_selectedFont;
+ wxFont m_measuringFont;
+ wxColour m_baseColour;
+ wxPen m_baseColourPen;
+ wxPen m_borderPen;
+ wxBrush m_baseColourBrush;
+ wxColour m_activeColour;
+ wxBitmap m_activeCloseBmp;
+ wxBitmap m_disabledCloseBmp;
+ wxBitmap m_activeLeftBmp;
+ wxBitmap m_disabledLeftBmp;
+ wxBitmap m_activeRightBmp;
+ wxBitmap m_disabledRightBmp;
+ wxBitmap m_activeWindowListBmp;
+ wxBitmap m_disabledWindowListBmp;
+
+ int m_fixedTabWidth;
+ int m_tabCtrlHeight;
+ unsigned int m_flags;
+};
+
+
+class WXDLLIMPEXP_AUI wxAuiSimpleTabArt : public wxAuiTabArt
+{
+
+public:
+
+ wxAuiSimpleTabArt();
+ virtual ~wxAuiSimpleTabArt();
+
+ wxAuiTabArt* Clone();
+ void SetFlags(unsigned int flags);
+
+ void SetSizingInfo(const wxSize& tabCtrlSize,
+ size_t tabCount);
+
+ void SetNormalFont(const wxFont& font);
+ void SetSelectedFont(const wxFont& font);
+ void SetMeasuringFont(const wxFont& font);
+ void SetColour(const wxColour& colour);
+ void SetActiveColour(const wxColour& colour);
+
+ void DrawBorder(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect);
+
+ void DrawBackground(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect);
+
+ void DrawTab(wxDC& dc,
+ wxWindow* wnd,
+ const wxAuiNotebookPage& pane,
+ const wxRect& inRect,
+ int closeButtonState,
+ wxRect* outTabRect,
+ wxRect* outButtonRect,
+ int* xExtent);
+
+ void DrawButton(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& inRect,
+ int bitmapId,
+ int buttonState,
+ int orientation,
+ wxRect* outRect);
+
+ int GetIndentSize();
+
+ int GetBorderWidth(
+ wxWindow* wnd);
+
+ int GetAdditionalBorderSpace(
+ wxWindow* wnd);
+
+ wxSize GetTabSize(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxString& caption,
+ const wxBitmap& bitmap,
+ bool active,
+ int closeButtonState,
+ int* xExtent);
+
+ int ShowDropDown(
+ wxWindow* wnd,
+ const wxAuiNotebookPageArray& items,
+ int activeIdx);
+
+ int GetBestTabCtrlSize(wxWindow* wnd,
+ const wxAuiNotebookPageArray& pages,
+ const wxSize& requiredBmpSize);
+
+protected:
+
+ wxFont m_normalFont;
+ wxFont m_selectedFont;
+ wxFont m_measuringFont;
+ wxPen m_normalBkPen;
+ wxPen m_selectedBkPen;
+ wxBrush m_normalBkBrush;
+ wxBrush m_selectedBkBrush;
+ wxBrush m_bkBrush;
+ wxBitmap m_activeCloseBmp;
+ wxBitmap m_disabledCloseBmp;
+ wxBitmap m_activeLeftBmp;
+ wxBitmap m_disabledLeftBmp;
+ wxBitmap m_activeRightBmp;
+ wxBitmap m_disabledRightBmp;
+ wxBitmap m_activeWindowListBmp;
+ wxBitmap m_disabledWindowListBmp;
+
+ int m_fixedTabWidth;
+ unsigned int m_flags;
+};
+
+#ifndef __WXUNIVERSAL__
+ #if defined(__WXGTK20__) && !defined(__WXGTK3__)
+ #define wxHAS_NATIVE_TABART
+ #include "wx/aui/tabartgtk.h"
+ #define wxAuiDefaultTabArt wxAuiGtkTabArt
+ #endif
+#endif // !__WXUNIVERSAL__
+
+#ifndef wxHAS_NATIVE_TABART
+ #define wxAuiDefaultTabArt wxAuiGenericTabArt
+#endif
+
+#endif // wxUSE_AUI
+
+#endif // _WX_AUI_TABART_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: include/wx/aui/tabartgtk.h
+// Purpose: declaration of the wxAuiGTKTabArt
+// Author: Jens Lody and Teodor Petrov
+// Modified by:
+// Created: 2012-03-23
+// Copyright: (c) 2012 Jens Lody <jens@codeblocks.org>
+// and Teodor Petrov
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_AUI_TABARTGTK_H_
+#define _WX_AUI_TABARTGTK_H_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_AUI
+
+#include "wx/aui/tabart.h"
+#include "wx/gdicmn.h"
+
+class wxWindow;
+class wxDC;
+
+class WXDLLIMPEXP_AUI wxAuiGtkTabArt : public wxAuiGenericTabArt
+{
+public:
+ wxAuiGtkTabArt();
+
+ virtual wxAuiTabArt* Clone();
+ virtual void DrawBorder(wxDC& dc, wxWindow* wnd, const wxRect& rect);
+ virtual void DrawBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect);
+ virtual void DrawTab(wxDC& dc,
+ wxWindow* wnd,
+ const wxAuiNotebookPage& page,
+ const wxRect& in_rect,
+ int close_button_state,
+ wxRect* out_tab_rect,
+ wxRect* out_button_rect,
+ int* x_extent);
+ void DrawButton(wxDC& dc, wxWindow* wnd, const wxRect& in_rect, int bitmap_id,
+ int button_state, int orientation, wxRect* out_rect);
+ int GetBestTabCtrlSize(wxWindow* wnd, const wxAuiNotebookPageArray& pages,
+ const wxSize& required_bmp_size);
+ int GetBorderWidth(wxWindow* wnd);
+ int GetAdditionalBorderSpace(wxWindow* wnd);
+ virtual wxSize GetTabSize(wxDC& dc, wxWindow* wnd, const wxString& caption,
+ const wxBitmap& bitmap, bool active,
+ int close_button_state, int* x_extent);
+};
+
+#endif // wxUSE_AUI
+
+#endif // _WX_AUI_TABARTGTK_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/aui/tabmdi.h
+// Purpose: Generic MDI (Multiple Document Interface) classes
+// Author: Hans Van Leemputten
+// Modified by: Benjamin I. Williams / Kirix Corporation
+// Created: 29/07/2002
+// Copyright: (c) Hans Van Leemputten
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_AUITABMDI_H_
+#define _WX_AUITABMDI_H_
+
+#if wxUSE_AUI
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/frame.h"
+#include "wx/panel.h"
+#include "wx/notebook.h"
+#include "wx/icon.h"
+#include "wx/aui/auibook.h"
+
+//-----------------------------------------------------------------------------
+// classes
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_AUI wxAuiMDIParentFrame;
+class WXDLLIMPEXP_FWD_AUI wxAuiMDIClientWindow;
+class WXDLLIMPEXP_FWD_AUI wxAuiMDIChildFrame;
+
+//-----------------------------------------------------------------------------
+// wxAuiMDIParentFrame
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_AUI wxAuiMDIParentFrame : public wxFrame
+{
+public:
+ wxAuiMDIParentFrame();
+ wxAuiMDIParentFrame(wxWindow *parent,
+ wxWindowID winid,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
+ const wxString& name = wxFrameNameStr);
+
+ ~wxAuiMDIParentFrame();
+
+ bool Create(wxWindow *parent,
+ wxWindowID winid,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
+ const wxString& name = wxFrameNameStr );
+
+ void SetArtProvider(wxAuiTabArt* provider);
+ wxAuiTabArt* GetArtProvider();
+ wxAuiNotebook* GetNotebook() const;
+
+#if wxUSE_MENUS
+ wxMenu* GetWindowMenu() const { return m_pWindowMenu; }
+ void SetWindowMenu(wxMenu* pMenu);
+
+ virtual void SetMenuBar(wxMenuBar *pMenuBar);
+#endif // wxUSE_MENUS
+
+ void SetChildMenuBar(wxAuiMDIChildFrame *pChild);
+
+ wxAuiMDIChildFrame *GetActiveChild() const;
+ void SetActiveChild(wxAuiMDIChildFrame* pChildFrame);
+
+ wxAuiMDIClientWindow *GetClientWindow() const;
+ virtual wxAuiMDIClientWindow *OnCreateClient();
+
+ virtual void Cascade() { /* Has no effect */ }
+ virtual void Tile(wxOrientation orient = wxHORIZONTAL);
+ virtual void ArrangeIcons() { /* Has no effect */ }
+ virtual void ActivateNext();
+ virtual void ActivatePrevious();
+
+protected:
+ wxAuiMDIClientWindow* m_pClientWindow;
+ wxEvent* m_pLastEvt;
+
+#if wxUSE_MENUS
+ wxMenu *m_pWindowMenu;
+ wxMenuBar *m_pMyMenuBar;
+#endif // wxUSE_MENUS
+
+protected:
+ void Init();
+
+#if wxUSE_MENUS
+ void RemoveWindowMenu(wxMenuBar *pMenuBar);
+ void AddWindowMenu(wxMenuBar *pMenuBar);
+
+ void DoHandleMenu(wxCommandEvent &event);
+ void DoHandleUpdateUI(wxUpdateUIEvent &event);
+#endif // wxUSE_MENUS
+
+ virtual bool ProcessEvent(wxEvent& event);
+
+ virtual void DoGetClientSize(int *width, int *height) const;
+
+private:
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxAuiMDIParentFrame)
+};
+
+//-----------------------------------------------------------------------------
+// wxAuiMDIChildFrame
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_AUI wxAuiMDIChildFrame : public wxPanel
+{
+public:
+ wxAuiMDIChildFrame();
+ wxAuiMDIChildFrame(wxAuiMDIParentFrame *parent,
+ wxWindowID winid,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr);
+
+ virtual ~wxAuiMDIChildFrame();
+ bool Create(wxAuiMDIParentFrame *parent,
+ wxWindowID winid,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr);
+
+#if wxUSE_MENUS
+ virtual void SetMenuBar(wxMenuBar *menuBar);
+ virtual wxMenuBar *GetMenuBar() const;
+#endif // wxUSE_MENUS
+
+ virtual void SetTitle(const wxString& title);
+ virtual wxString GetTitle() const;
+
+ virtual void SetIcons(const wxIconBundle& icons);
+ virtual const wxIconBundle& GetIcons() const;
+
+ virtual void SetIcon(const wxIcon& icon);
+ virtual const wxIcon& GetIcon() const;
+
+ virtual void Activate();
+ virtual bool Destroy();
+
+ virtual bool Show(bool show = true);
+
+#if wxUSE_STATUSBAR
+ // no status bars
+ virtual wxStatusBar* CreateStatusBar(int WXUNUSED(number) = 1,
+ long WXUNUSED(style) = 1,
+ wxWindowID WXUNUSED(winid) = 1,
+ const wxString& WXUNUSED(name) = wxEmptyString)
+ { return NULL; }
+
+ virtual wxStatusBar *GetStatusBar() const { return NULL; }
+ virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {}
+ virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {}
+#endif
+
+#if wxUSE_TOOLBAR
+ // no toolbar bars
+ virtual wxToolBar* CreateToolBar(long WXUNUSED(style),
+ wxWindowID WXUNUSED(winid),
+ const wxString& WXUNUSED(name))
+ { return NULL; }
+ virtual wxToolBar *GetToolBar() const { return NULL; }
+#endif
+
+
+ // no maximize etc
+ virtual void Maximize(bool WXUNUSED(maximize) = true) { /* Has no effect */ }
+ virtual void Restore() { /* Has no effect */ }
+ virtual void Iconize(bool WXUNUSED(iconize) = true) { /* Has no effect */ }
+ virtual bool IsMaximized() const { return true; }
+ virtual bool IsIconized() const { return false; }
+ virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style)) { return false; }
+ virtual bool IsFullScreen() const { return false; }
+
+ virtual bool IsTopLevel() const { return false; }
+
+ void OnMenuHighlight(wxMenuEvent& evt);
+ void OnActivate(wxActivateEvent& evt);
+ void OnCloseWindow(wxCloseEvent& evt);
+
+ void SetMDIParentFrame(wxAuiMDIParentFrame* parent);
+ wxAuiMDIParentFrame* GetMDIParentFrame() const;
+
+protected:
+ void Init();
+ virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags);
+ virtual void DoMoveWindow(int x, int y, int width, int height);
+
+ // no size hints
+ virtual void DoSetSizeHints(int WXUNUSED(minW), int WXUNUSED(minH),
+ int WXUNUSED(maxW), int WXUNUSED(maxH),
+ int WXUNUSED(incW), int WXUNUSED(incH)) {}
+public:
+ // This function needs to be called when a size change is confirmed,
+ // we needed this function to prevent anybody from the outside
+ // changing the panel... it messes the UI layout when we would allow it.
+ void ApplyMDIChildFrameRect();
+ void DoShow(bool show);
+
+protected:
+ wxAuiMDIParentFrame* m_pMDIParentFrame;
+ wxRect m_mdiNewRect;
+ wxRect m_mdiCurRect;
+ wxString m_title;
+ wxIcon m_icon;
+ wxIconBundle m_iconBundle;
+ bool m_activateOnCreate;
+
+#if wxUSE_MENUS
+ wxMenuBar* m_pMenuBar;
+#endif // wxUSE_MENUS
+
+
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxAuiMDIChildFrame)
+ DECLARE_EVENT_TABLE()
+
+ friend class wxAuiMDIClientWindow;
+};
+
+//-----------------------------------------------------------------------------
+// wxAuiMDIClientWindow
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_AUI wxAuiMDIClientWindow : public wxAuiNotebook
+{
+public:
+ wxAuiMDIClientWindow();
+ wxAuiMDIClientWindow(wxAuiMDIParentFrame *parent, long style = 0);
+
+ virtual bool CreateClient(wxAuiMDIParentFrame *parent,
+ long style = wxVSCROLL | wxHSCROLL);
+
+ virtual int SetSelection(size_t page);
+ virtual wxAuiMDIChildFrame* GetActiveChild();
+ virtual void SetActiveChild(wxAuiMDIChildFrame* pChildFrame)
+ {
+ SetSelection(GetPageIndex(pChildFrame));
+ }
+
+protected:
+
+ void PageChanged(int oldSelection, int newSelection);
+ void OnPageClose(wxAuiNotebookEvent& evt);
+ void OnPageChanged(wxAuiNotebookEvent& evt);
+ void OnSize(wxSizeEvent& evt);
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxAuiMDIClientWindow)
+ DECLARE_EVENT_TABLE()
+};
+#endif // wxUSE_AUI
+
+#endif // _WX_AUITABMDI_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/bannerwindow.h
+// Purpose: wxBannerWindow class declaration
+// Author: Vadim Zeitlin
+// Created: 2011-08-16
+// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_BANNERWINDOW_H_
+#define _WX_BANNERWINDOW_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_BANNERWINDOW
+
+#include "wx/bitmap.h"
+#include "wx/event.h"
+#include "wx/window.h"
+
+class WXDLLIMPEXP_FWD_CORE wxBitmap;
+class WXDLLIMPEXP_FWD_CORE wxColour;
+class WXDLLIMPEXP_FWD_CORE wxDC;
+
+extern WXDLLIMPEXP_DATA_ADV(const char) wxBannerWindowNameStr[];
+
+// ----------------------------------------------------------------------------
+// A simple banner window showing either a bitmap or text.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxBannerWindow : public wxWindow
+{
+public:
+ // Default constructor, use Create() later.
+ wxBannerWindow() { Init(); }
+
+ // Convenient constructor that should be used in the majority of cases.
+ //
+ // The banner orientation changes how the text in it is displayed and also
+ // defines where is the bitmap truncated if it's too big to fit but doesn't
+ // do anything for the banner position, this is supposed to be taken care
+ // of in the usual way, e.g. using sizers.
+ wxBannerWindow(wxWindow* parent, wxDirection dir = wxLEFT)
+ {
+ Init();
+
+ Create(parent, wxID_ANY, dir);
+ }
+
+ // Full constructor provided for consistency with the other classes only.
+ wxBannerWindow(wxWindow* parent,
+ wxWindowID winid,
+ wxDirection dir = wxLEFT,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxBannerWindowNameStr)
+ {
+ Init();
+
+ Create(parent, winid, dir, pos, size, style, name);
+ }
+
+ // Can be only called on objects created with the default constructor.
+ bool Create(wxWindow* parent,
+ wxWindowID winid,
+ wxDirection dir = wxLEFT,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxBannerWindowNameStr);
+
+
+ // Provide an existing bitmap to show. For wxLEFT orientation the bitmap is
+ // truncated from the top, for wxTOP and wxBOTTOM -- from the right and for
+ // wxRIGHT -- from the bottom, so put the most important part of the bitmap
+ // information in the opposite direction.
+ void SetBitmap(const wxBitmap& bmp);
+
+ // Set the text to display. This is mutually exclusive with SetBitmap().
+ // Title is rendered in bold and should be single line, message can have
+ // multiple lines but is not wrapped automatically.
+ void SetText(const wxString& title, const wxString& message);
+
+ // Set the colours between which the gradient runs. This can be combined
+ // with SetText() but not SetBitmap().
+ void SetGradient(const wxColour& start, const wxColour& end);
+
+protected:
+ virtual wxSize DoGetBestClientSize() const;
+
+private:
+ // Common part of all constructors.
+ void Init();
+
+ // Fully invalidates the window.
+ void OnSize(wxSizeEvent& event);
+
+ // Redraws the window using either m_bitmap or m_title/m_message.
+ void OnPaint(wxPaintEvent& event);
+
+ // Helper of OnPaint(): draw the bitmap at the correct position depending
+ // on our orientation.
+ void DrawBitmapBackground(wxDC& dc);
+
+ // Helper of OnPaint(): draw the text in the appropriate direction.
+ void DrawBannerTextLine(wxDC& dc, const wxString& str, const wxPoint& pos);
+
+ // Return the font to use for the title. Currently this is hardcoded as a
+ // larger bold version of the standard window font but could be made
+ // configurable in the future.
+ wxFont GetTitleFont() const;
+
+ // Return the colour to use for extending the bitmap. Non-const as it
+ // updates m_colBitmapBg if needed.
+ wxColour GetBitmapBg();
+
+
+ // The window side along which the banner is laid out.
+ wxDirection m_direction;
+
+ // If valid, this bitmap is drawn as is.
+ wxBitmap m_bitmap;
+
+ // If bitmap is valid, this is the colour we use to extend it if the bitmap
+ // is smaller than this window. It is computed on demand by GetBitmapBg().
+ wxColour m_colBitmapBg;
+
+ // The title and main message to draw, used if m_bitmap is invalid.
+ wxString m_title,
+ m_message;
+
+ // Start and stop gradient colours, only used when drawing text.
+ wxColour m_colStart,
+ m_colEnd;
+
+ wxDECLARE_EVENT_TABLE();
+
+ wxDECLARE_NO_COPY_CLASS(wxBannerWindow);
+};
+
+#endif // wxUSE_BANNERWINDOW
+
+#endif // _WX_BANNERWINDOW_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/base64.h
+// Purpose: declaration of BASE64 encoding/decoding functionality
+// Author: Charles Reimers, Vadim Zeitlin
+// Created: 2007-06-18
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_BASE64_H_
+#define _WX_BASE64_H_
+
+#if wxUSE_BASE64
+
+#include "wx/string.h"
+#include "wx/buffer.h"
+
+// ----------------------------------------------------------------------------
+// encoding functions
+// ----------------------------------------------------------------------------
+
+// return the size needed for the buffer containing the encoded representation
+// of a buffer of given length
+inline size_t wxBase64EncodedSize(size_t len) { return 4*((len+2)/3); }
+
+// raw base64 encoding function which encodes the contents of a buffer of the
+// specified length into the buffer of the specified size
+//
+// returns the length of the encoded data or wxCONV_FAILED if the buffer is not
+// large enough; to determine the needed size you can either allocate a buffer
+// of wxBase64EncodedSize(srcLen) size or call the function with NULL buffer in
+// which case the required size will be returned
+WXDLLIMPEXP_BASE size_t
+wxBase64Encode(char *dst, size_t dstLen, const void *src, size_t srcLen);
+
+// encode the contents of the given buffer using base64 and return as string
+// (there is no error return)
+inline wxString wxBase64Encode(const void *src, size_t srcLen)
+{
+ const size_t dstLen = wxBase64EncodedSize(srcLen);
+ wxCharBuffer dst(dstLen);
+ wxBase64Encode(dst.data(), dstLen, src, srcLen);
+
+ return dst;
+}
+
+inline wxString wxBase64Encode(const wxMemoryBuffer& buf)
+{
+ return wxBase64Encode(buf.GetData(), buf.GetDataLen());
+}
+
+// ----------------------------------------------------------------------------
+// decoding functions
+// ----------------------------------------------------------------------------
+
+// elements of this enum specify the possible behaviours of wxBase64Decode()
+// when an invalid character is encountered
+enum wxBase64DecodeMode
+{
+ // normal behaviour: stop at any invalid characters
+ wxBase64DecodeMode_Strict,
+
+ // skip whitespace characters
+ wxBase64DecodeMode_SkipWS,
+
+ // the most lenient behaviour: simply ignore all invalid characters
+ wxBase64DecodeMode_Relaxed
+};
+
+// return the buffer size necessary for decoding a base64 string of the given
+// length
+inline size_t wxBase64DecodedSize(size_t srcLen) { return 3*srcLen/4; }
+
+// raw decoding function which decodes the contents of the string of specified
+// length (or NUL-terminated by default) into the provided buffer of the given
+// size
+//
+// the function normally stops at any character invalid inside a base64-encoded
+// string (i.e. not alphanumeric nor '+' nor '/') but can be made to skip the
+// whitespace or all invalid characters using its mode argument
+//
+// returns the length of the decoded data or wxCONV_FAILED if an error occurs
+// such as the buffer is too small or the encoded string is invalid; in the
+// latter case the posErr is filled with the position where the decoding
+// stopped if it is not NULL
+WXDLLIMPEXP_BASE size_t
+wxBase64Decode(void *dst, size_t dstLen,
+ const char *src, size_t srcLen = wxNO_LEN,
+ wxBase64DecodeMode mode = wxBase64DecodeMode_Strict,
+ size_t *posErr = NULL);
+
+inline size_t
+wxBase64Decode(void *dst, size_t dstLen,
+ const wxString& src,
+ wxBase64DecodeMode mode = wxBase64DecodeMode_Strict,
+ size_t *posErr = NULL)
+{
+ // don't use str.length() here as the ASCII buffer is shorter than it for
+ // strings with embedded NULs
+ return wxBase64Decode(dst, dstLen, src.ToAscii(), wxNO_LEN, mode, posErr);
+}
+
+// decode the contents of the given string; the returned buffer is empty if an
+// error occurs during decoding
+WXDLLIMPEXP_BASE wxMemoryBuffer
+wxBase64Decode(const char *src, size_t srcLen = wxNO_LEN,
+ wxBase64DecodeMode mode = wxBase64DecodeMode_Strict,
+ size_t *posErr = NULL);
+
+inline wxMemoryBuffer
+wxBase64Decode(const wxString& src,
+ wxBase64DecodeMode mode = wxBase64DecodeMode_Strict,
+ size_t *posErr = NULL)
+{
+ // don't use str.length() here as the ASCII buffer is shorter than it for
+ // strings with embedded NULs
+ return wxBase64Decode(src.ToAscii(), wxNO_LEN, mode, posErr);
+}
+
+#endif // wxUSE_BASE64
+
+#endif // _WX_BASE64_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/beforestd.h
+// Purpose: #include before STL headers
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 07/07/03
+// Copyright: (c) 2003 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+/**
+ Unfortunately, when compiling at maximum warning level, the standard
+ headers themselves may generate warnings -- and really lots of them. So
+ before including them, this header should be included to temporarily
+ suppress the warnings and after this the header afterstd.h should be
+ included to enable them back again.
+
+ Note that there are intentionally no inclusion guards in this file, because
+ it can be included several times.
+ */
+
+// VC 7.x isn't as bad as VC6 and doesn't give these warnings but eVC (which
+// defines _MSC_VER as 1201) does need to be included as it's VC6-like
+#if defined(__VISUALC__) && __VISUALC__ <= 1201
+ // these warning have to be disabled and not just temporarily disabled
+ // because they will be given at the end of the compilation of the
+ // current source and there is absolutely nothing we can do about them so
+ // disable them before warning(push) below
+
+ // 'foo': unreferenced inline function has been removed
+ #pragma warning(disable:4514)
+
+ // 'function' : function not inlined
+ #pragma warning(disable:4710)
+
+ // 'id': identifier was truncated to 'num' characters in the debug info
+ #pragma warning(disable:4786)
+
+ // MSVC 5 does not have this
+ #if __VISUALC__ > 1100
+ // we have to disable (and reenable in afterstd.h) this one because,
+ // even though it is of level 4, it is not disabled by warning(push, 1)
+ // below for VC7.1!
+
+ // unreachable code
+ #pragma warning(disable:4702)
+
+ #pragma warning(push, 1)
+ #else // VC 5
+ // 'expression' : signed/unsigned mismatch
+ #pragma warning(disable:4018)
+
+ // 'identifier' : unreferenced formal parameter
+ #pragma warning(disable:4100)
+
+ // 'conversion' : conversion from 'type1' to 'type2',
+ // possible loss of data
+ #pragma warning(disable:4244)
+
+ // C++ language change: to explicitly specialize class template
+ // 'identifier' use the following syntax
+ #pragma warning(disable:4663)
+ #endif
+#endif // VC++ < 7
+
+/**
+ GCC's visibility support is broken for libstdc++ in some older versions
+ (namely Debian/Ubuntu's GCC 4.1, see
+ https://bugs.launchpad.net/ubuntu/+source/gcc-4.1/+bug/109262). We fix it
+ here by mimicking newer versions' behaviour of using default visibility
+ for libstdc++ code.
+ */
+#if defined(HAVE_VISIBILITY) && defined(HAVE_BROKEN_LIBSTDCXX_VISIBILITY)
+ #pragma GCC visibility push(default)
+#endif
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/bitmap.h
+// Purpose: wxBitmap class interface
+// Author: Vaclav Slavik
+// Modified by:
+// Created: 22.04.01
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_BITMAP_H_BASE_
+#define _WX_BITMAP_H_BASE_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/string.h"
+#include "wx/gdicmn.h" // for wxBitmapType
+#include "wx/colour.h"
+#include "wx/image.h"
+
+class WXDLLIMPEXP_FWD_CORE wxBitmap;
+class WXDLLIMPEXP_FWD_CORE wxBitmapHandler;
+class WXDLLIMPEXP_FWD_CORE wxIcon;
+class WXDLLIMPEXP_FWD_CORE wxMask;
+class WXDLLIMPEXP_FWD_CORE wxPalette;
+class WXDLLIMPEXP_FWD_CORE wxDC;
+
+// ----------------------------------------------------------------------------
+// wxVariant support
+// ----------------------------------------------------------------------------
+
+#if wxUSE_VARIANT
+#include "wx/variant.h"
+DECLARE_VARIANT_OBJECT_EXPORTED(wxBitmap,WXDLLIMPEXP_CORE)
+#endif
+
+// ----------------------------------------------------------------------------
+// wxMask represents the transparent area of the bitmap
+// ----------------------------------------------------------------------------
+
+// TODO: all implementation of wxMask, except the generic one,
+// do not derive from wxMaskBase,,, they should
+class WXDLLIMPEXP_CORE wxMaskBase : public wxObject
+{
+public:
+ // create the mask from bitmap pixels of the given colour
+ bool Create(const wxBitmap& bitmap, const wxColour& colour);
+
+#if wxUSE_PALETTE
+ // create the mask from bitmap pixels with the given palette index
+ bool Create(const wxBitmap& bitmap, int paletteIndex);
+#endif // wxUSE_PALETTE
+
+ // create the mask from the given mono bitmap
+ bool Create(const wxBitmap& bitmap);
+
+protected:
+ // this function is called from Create() to free the existing mask data
+ virtual void FreeData() = 0;
+
+ // these functions must be overridden to implement the corresponding public
+ // Create() methods, they shouldn't call FreeData() as it's already called
+ // by the public wrappers
+ virtual bool InitFromColour(const wxBitmap& bitmap,
+ const wxColour& colour) = 0;
+ virtual bool InitFromMonoBitmap(const wxBitmap& bitmap) = 0;
+};
+
+#if defined(__WXDFB__) || \
+ defined(__WXMAC__) || \
+ defined(__WXGTK__) || \
+ defined(__WXCOCOA__) || \
+ defined(__WXMOTIF__) || \
+ defined(__WXX11__)
+ #define wxUSE_BITMAP_BASE 1
+#else
+ #define wxUSE_BITMAP_BASE 0
+#endif
+
+// a more readable way to tell
+#define wxBITMAP_SCREEN_DEPTH (-1)
+
+
+// ----------------------------------------------------------------------------
+// wxBitmapHelpers: container for various bitmap methods common to all ports.
+// ----------------------------------------------------------------------------
+
+// Unfortunately, currently wxBitmap does not inherit from wxBitmapBase on all
+// platforms and this is not easy to fix. So we extract at least some common
+// methods into this class from which both wxBitmapBase (and hence wxBitmap on
+// all platforms where it does inherit from it) and wxBitmap in wxMSW and other
+// exceptional ports (only wxPM and old wxCocoa) inherit.
+class WXDLLIMPEXP_CORE wxBitmapHelpers
+{
+public:
+ // Create a new wxBitmap from the PNG data in the given buffer.
+ static wxBitmap NewFromPNGData(const void* data, size_t size);
+};
+
+
+// All ports except wxMSW and wxOS2 use wxBitmapHandler and wxBitmapBase as
+// base class for wxBitmapHandler; wxMSW and wxOS2 use wxGDIImageHandler as
+// base class since it allows some code reuse there.
+#if wxUSE_BITMAP_BASE
+
+// ----------------------------------------------------------------------------
+// wxBitmapHandler: class which knows how to create/load/save bitmaps in
+// different formats
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxBitmapHandler : public wxObject
+{
+public:
+ wxBitmapHandler() { m_type = wxBITMAP_TYPE_INVALID; }
+ virtual ~wxBitmapHandler() { }
+
+ // NOTE: the following functions should be pure virtuals, but they aren't
+ // because otherwise almost all ports would have to implement
+ // them as "return false"...
+
+ virtual bool Create(wxBitmap *WXUNUSED(bitmap), const void* WXUNUSED(data),
+ wxBitmapType WXUNUSED(type), int WXUNUSED(width), int WXUNUSED(height),
+ int WXUNUSED(depth) = 1)
+ { return false; }
+
+ virtual bool LoadFile(wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name),
+ wxBitmapType WXUNUSED(type), int WXUNUSED(desiredWidth),
+ int WXUNUSED(desiredHeight))
+ { return false; }
+
+ virtual bool SaveFile(const wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name),
+ wxBitmapType WXUNUSED(type), const wxPalette *WXUNUSED(palette) = NULL) const
+ { return false; }
+
+ void SetName(const wxString& name) { m_name = name; }
+ void SetExtension(const wxString& ext) { m_extension = ext; }
+ void SetType(wxBitmapType type) { m_type = type; }
+ const wxString& GetName() const { return m_name; }
+ const wxString& GetExtension() const { return m_extension; }
+ wxBitmapType GetType() const { return m_type; }
+
+private:
+ wxString m_name;
+ wxString m_extension;
+ wxBitmapType m_type;
+
+ DECLARE_ABSTRACT_CLASS(wxBitmapHandler)
+};
+
+// ----------------------------------------------------------------------------
+// wxBitmap: class which represents platform-dependent bitmap (unlike wxImage)
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxBitmapBase : public wxGDIObject,
+ public wxBitmapHelpers
+{
+public:
+ /*
+ Derived class must implement these:
+
+ wxBitmap();
+ wxBitmap(const wxBitmap& bmp);
+ wxBitmap(const char bits[], int width, int height, int depth = 1);
+ wxBitmap(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
+ wxBitmap(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH);
+ wxBitmap(const char* const* bits);
+ wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM);
+ wxBitmap(const wxImage& image, int depth = wxBITMAP_SCREEN_DEPTH);
+
+ static void InitStandardHandlers();
+ */
+
+ virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH) = 0;
+ virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) = 0;
+ virtual bool CreateScaled(int w, int h, int d, double logicalScale)
+ { return Create(w*logicalScale,h*logicalScale,d); }
+
+ virtual int GetHeight() const = 0;
+ virtual int GetWidth() const = 0;
+ virtual int GetDepth() const = 0;
+
+ wxSize GetSize() const
+ { return wxSize(GetWidth(), GetHeight()); }
+
+ // support for scaled bitmaps
+ virtual double GetScaleFactor() const { return 1.0; }
+ virtual double GetScaledWidth() const { return GetWidth() / GetScaleFactor(); }
+ virtual double GetScaledHeight() const { return GetHeight() / GetScaleFactor(); }
+ virtual wxSize GetScaledSize() const
+ { return wxSize(GetScaledWidth(), GetScaledHeight()); }
+
+#if wxUSE_IMAGE
+ virtual wxImage ConvertToImage() const = 0;
+
+ // Convert to disabled (dimmed) bitmap.
+ wxBitmap ConvertToDisabled(unsigned char brightness = 255) const;
+#endif // wxUSE_IMAGE
+
+ virtual wxMask *GetMask() const = 0;
+ virtual void SetMask(wxMask *mask) = 0;
+
+ virtual wxBitmap GetSubBitmap(const wxRect& rect) const = 0;
+
+ virtual bool SaveFile(const wxString &name, wxBitmapType type,
+ const wxPalette *palette = NULL) const = 0;
+ virtual bool LoadFile(const wxString &name, wxBitmapType type) = 0;
+
+ /*
+ If raw bitmap access is supported (see wx/rawbmp.h), the following
+ methods should be implemented:
+
+ virtual bool GetRawData(wxRawBitmapData *data) = 0;
+ virtual void UngetRawData(wxRawBitmapData *data) = 0;
+ */
+
+#if wxUSE_PALETTE
+ virtual wxPalette *GetPalette() const = 0;
+ virtual void SetPalette(const wxPalette& palette) = 0;
+#endif // wxUSE_PALETTE
+
+ // copies the contents and mask of the given (colour) icon to the bitmap
+ virtual bool CopyFromIcon(const wxIcon& icon) = 0;
+
+ // implementation:
+ virtual void SetHeight(int height) = 0;
+ virtual void SetWidth(int width) = 0;
+ virtual void SetDepth(int depth) = 0;
+
+ // Format handling
+ static inline wxList& GetHandlers() { return sm_handlers; }
+ static void AddHandler(wxBitmapHandler *handler);
+ static void InsertHandler(wxBitmapHandler *handler);
+ static bool RemoveHandler(const wxString& name);
+ static wxBitmapHandler *FindHandler(const wxString& name);
+ static wxBitmapHandler *FindHandler(const wxString& extension, wxBitmapType bitmapType);
+ static wxBitmapHandler *FindHandler(wxBitmapType bitmapType);
+
+ //static void InitStandardHandlers();
+ // (wxBitmap must implement this one)
+
+ static void CleanUpHandlers();
+
+ // this method is only used by the generic implementation of wxMask
+ // currently but could be useful elsewhere in the future: it can be
+ // overridden to quantize the colour to correspond to bitmap colour depth
+ // if necessary; default implementation simply returns the colour as is
+ virtual wxColour QuantizeColour(const wxColour& colour) const
+ {
+ return colour;
+ }
+
+protected:
+ static wxList sm_handlers;
+
+ DECLARE_ABSTRACT_CLASS(wxBitmapBase)
+};
+
+#endif // wxUSE_BITMAP_BASE
+
+
+// the wxBITMAP_DEFAULT_TYPE constant defines the default argument value
+// for wxBitmap's ctor and wxBitmap::LoadFile() functions.
+#if defined(__WXMSW__)
+ #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_BMP_RESOURCE
+ #include "wx/msw/bitmap.h"
+#elif defined(__WXMOTIF__)
+ #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_XPM
+ #include "wx/x11/bitmap.h"
+#elif defined(__WXGTK20__)
+ #ifdef __WINDOWS__
+ #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_BMP_RESOURCE
+ #else
+ #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_XPM
+ #endif
+ #include "wx/gtk/bitmap.h"
+#elif defined(__WXGTK__)
+ #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_XPM
+ #include "wx/gtk1/bitmap.h"
+#elif defined(__WXX11__)
+ #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_XPM
+ #include "wx/x11/bitmap.h"
+#elif defined(__WXDFB__)
+ #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_BMP_RESOURCE
+ #include "wx/dfb/bitmap.h"
+#elif defined(__WXMAC__)
+ #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_PICT_RESOURCE
+ #include "wx/osx/bitmap.h"
+#elif defined(__WXCOCOA__)
+ #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_BMP_RESOURCE
+ #include "wx/cocoa/bitmap.h"
+#elif defined(__WXPM__)
+ #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_BMP_RESOURCE
+ #include "wx/os2/bitmap.h"
+#endif
+
+#if wxUSE_IMAGE
+inline
+wxBitmap
+#if wxUSE_BITMAP_BASE
+wxBitmapBase::
+#else
+wxBitmap::
+#endif
+ConvertToDisabled(unsigned char brightness) const
+{
+ return ConvertToImage().ConvertToDisabled(brightness);
+}
+#endif // wxUSE_IMAGE
+
+// we must include generic mask.h after wxBitmap definition
+#if defined(__WXDFB__)
+ #define wxUSE_GENERIC_MASK 1
+#else
+ #define wxUSE_GENERIC_MASK 0
+#endif
+
+#if wxUSE_GENERIC_MASK
+ #include "wx/generic/mask.h"
+#endif
+
+#endif // _WX_BITMAP_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/bmpbuttn.h
+// Purpose: wxBitmapButton class interface
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 25.08.00
+// Copyright: (c) 2000 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_BMPBUTTON_H_BASE_
+#define _WX_BMPBUTTON_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_BMPBUTTON
+
+#include "wx/button.h"
+
+// FIXME: right now only wxMSW, wxGTK and wxOSX implement bitmap support in wxButton
+// itself, this shouldn't be used for the other platforms neither
+// when all of them do it
+#if (defined(__WXMSW__) || defined(__WXGTK20__) || defined(__WXOSX__)) && !defined(__WXUNIVERSAL__)
+ #define wxHAS_BUTTON_BITMAP
+#endif
+
+class WXDLLIMPEXP_FWD_CORE wxBitmapButton;
+
+// ----------------------------------------------------------------------------
+// wxBitmapButton: a button which shows bitmaps instead of the usual string.
+// It has different bitmaps for different states (focused/disabled/pressed)
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxBitmapButtonBase : public wxButton
+{
+public:
+ wxBitmapButtonBase()
+ {
+#ifndef wxHAS_BUTTON_BITMAP
+ m_marginX =
+ m_marginY = 0;
+#endif // wxHAS_BUTTON_BITMAP
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID winid,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxValidator& validator,
+ const wxString& name)
+ {
+ // We use wxBU_NOTEXT to let the base class Create() know that we are
+ // not going to show the label: this is a hack needed for wxGTK where
+ // we can show both label and bitmap only with GTK 2.6+ but we always
+ // can show just one of them and this style allows us to choose which
+ // one we need.
+ //
+ // And we also use wxBU_EXACTFIT to avoid being resized up to the
+ // standard button size as this doesn't make sense for bitmap buttons
+ // which are not standard anyhow and should fit their bitmap size.
+ return wxButton::Create(parent, winid, "",
+ pos, size,
+ style | wxBU_NOTEXT | wxBU_EXACTFIT,
+ validator, name);
+ }
+
+ // Special creation function for a standard "Close" bitmap. It allows to
+ // simply create a close button with the image appropriate for the common
+ // platform.
+ static wxBitmapButton* NewCloseButton(wxWindow* parent, wxWindowID winid);
+
+
+ // set/get the margins around the button
+ virtual void SetMargins(int x, int y)
+ {
+ DoSetBitmapMargins(x, y);
+ }
+
+ int GetMarginX() const { return DoGetBitmapMargins().x; }
+ int GetMarginY() const { return DoGetBitmapMargins().y; }
+
+ // deprecated synonym for SetBitmapLabel()
+#if WXWIN_COMPATIBILITY_2_6
+ wxDEPRECATED_INLINE( void SetLabel(const wxBitmap& bitmap),
+ SetBitmapLabel(bitmap); )
+
+ // prevent virtual function hiding
+ virtual void SetLabel(const wxString& label)
+ { wxWindow::SetLabel(label); }
+#endif // WXWIN_COMPATIBILITY_2_6
+
+protected:
+#ifndef wxHAS_BUTTON_BITMAP
+ // function called when any of the bitmaps changes
+ virtual void OnSetBitmap() { InvalidateBestSize(); Refresh(); }
+
+ virtual wxBitmap DoGetBitmap(State which) const { return m_bitmaps[which]; }
+ virtual void DoSetBitmap(const wxBitmap& bitmap, State which)
+ { m_bitmaps[which] = bitmap; OnSetBitmap(); }
+
+ virtual wxSize DoGetBitmapMargins() const
+ {
+ return wxSize(m_marginX, m_marginY);
+ }
+
+ virtual void DoSetBitmapMargins(int x, int y)
+ {
+ m_marginX = x;
+ m_marginY = y;
+ }
+
+ // the bitmaps for various states
+ wxBitmap m_bitmaps[State_Max];
+
+ // the margins around the bitmap
+ int m_marginX,
+ m_marginY;
+#endif // !wxHAS_BUTTON_BITMAP
+
+ wxDECLARE_NO_COPY_CLASS(wxBitmapButtonBase);
+};
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/bmpbuttn.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/bmpbuttn.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/bmpbuttn.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/bmpbuttn.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/bmpbuttn.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/bmpbuttn.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/bmpbuttn.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/bmpbuttn.h"
+#endif
+
+#endif // wxUSE_BMPBUTTON
+
+#endif // _WX_BMPBUTTON_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/bmpcbox.h
+// Purpose: wxBitmapComboBox base header
+// Author: Jaakko Salli
+// Modified by:
+// Created: Aug-31-2006
+// Copyright: (c) Jaakko Salli
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_BMPCBOX_H_BASE_
+#define _WX_BMPCBOX_H_BASE_
+
+
+#include "wx/defs.h"
+
+#if wxUSE_BITMAPCOMBOBOX
+
+#include "wx/bitmap.h"
+
+class WXDLLIMPEXP_FWD_CORE wxWindow;
+class WXDLLIMPEXP_FWD_CORE wxItemContainer;
+
+// Define wxBITMAPCOMBOBOX_OWNERDRAWN_BASED for platforms which
+// wxBitmapComboBox implementation utilizes ownerdrawn combobox
+// (either native or generic).
+#if !defined(__WXGTK20__) || defined(__WXUNIVERSAL__)
+ #define wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
+
+class WXDLLIMPEXP_FWD_CORE wxDC;
+#endif
+
+extern WXDLLIMPEXP_DATA_ADV(const char) wxBitmapComboBoxNameStr[];
+
+
+class WXDLLIMPEXP_ADV wxBitmapComboBoxBase
+{
+public:
+ // ctors and such
+ wxBitmapComboBoxBase() { Init(); }
+
+ virtual ~wxBitmapComboBoxBase() { }
+
+ // Sets the image for the given item.
+ virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap) = 0;
+
+#if !defined(wxBITMAPCOMBOBOX_OWNERDRAWN_BASED)
+
+ // Returns the image of the item with the given index.
+ virtual wxBitmap GetItemBitmap(unsigned int n) const = 0;
+
+ // Returns size of the image used in list
+ virtual wxSize GetBitmapSize() const = 0;
+
+private:
+ void Init() {}
+
+#else // wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
+
+ // Returns the image of the item with the given index.
+ virtual wxBitmap GetItemBitmap(unsigned int n) const;
+
+ // Returns size of the image used in list
+ virtual wxSize GetBitmapSize() const
+ {
+ return m_usedImgSize;
+ }
+
+protected:
+
+ // Returns pointer to the combobox item container
+ virtual wxItemContainer* GetItemContainer() = 0;
+
+ // Return pointer to the owner-drawn combobox control
+ virtual wxWindow* GetControl() = 0;
+
+ // wxItemContainer functions
+ void BCBDoClear();
+ void BCBDoDeleteOneItem(unsigned int n);
+
+ void DoSetItemBitmap(unsigned int n, const wxBitmap& bitmap);
+
+ void DrawBackground(wxDC& dc, const wxRect& rect, int item, int flags) const;
+ void DrawItem(wxDC& dc, const wxRect& rect, int item, const wxString& text,
+ int flags) const;
+ wxCoord MeasureItem(size_t item) const;
+
+ // Returns true if image size was affected
+ virtual bool OnAddBitmap(const wxBitmap& bitmap);
+
+ // Recalculates amount of empty space needed in front of text
+ // in control itself. Returns number that can be passed to
+ // wxOwnerDrawnComboBox::SetCustomPaintWidth() and similar
+ // functions.
+ virtual int DetermineIndent();
+
+ void UpdateInternals();
+
+ wxArrayPtrVoid m_bitmaps; // Images associated with items
+ wxSize m_usedImgSize; // Size of bitmaps
+
+ int m_imgAreaWidth; // Width and height of area next to text field
+ int m_fontHeight;
+ int m_indent;
+
+private:
+ void Init();
+#endif // !wxBITMAPCOMBOBOX_OWNERDRAWN_BASED/wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
+};
+
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/generic/bmpcbox.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/bmpcbox.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/bmpcbox.h"
+#else
+ #include "wx/generic/bmpcbox.h"
+#endif
+
+#endif // wxUSE_BITMAPCOMBOBOX
+
+#endif // _WX_BMPCBOX_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/bookctrl.h
+// Purpose: wxBookCtrlBase: common base class for wxList/Tree/Notebook
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 19.08.03
+// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_BOOKCTRL_H_
+#define _WX_BOOKCTRL_H_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_BOOKCTRL
+
+#include "wx/control.h"
+#include "wx/dynarray.h"
+#include "wx/withimages.h"
+
+WX_DEFINE_EXPORTED_ARRAY_PTR(wxWindow *, wxArrayPages);
+
+class WXDLLIMPEXP_FWD_CORE wxImageList;
+class WXDLLIMPEXP_FWD_CORE wxBookCtrlEvent;
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// wxBookCtrl hit results
+enum
+{
+ wxBK_HITTEST_NOWHERE = 1, // not on tab
+ wxBK_HITTEST_ONICON = 2, // on icon
+ wxBK_HITTEST_ONLABEL = 4, // on label
+ wxBK_HITTEST_ONITEM = wxBK_HITTEST_ONICON | wxBK_HITTEST_ONLABEL,
+ wxBK_HITTEST_ONPAGE = 8 // not on tab control, but over the selected page
+};
+
+// wxBookCtrl flags (common for wxNotebook, wxListbook, wxChoicebook, wxTreebook)
+#define wxBK_DEFAULT 0x0000
+#define wxBK_TOP 0x0010
+#define wxBK_BOTTOM 0x0020
+#define wxBK_LEFT 0x0040
+#define wxBK_RIGHT 0x0080
+#define wxBK_ALIGN_MASK (wxBK_TOP | wxBK_BOTTOM | wxBK_LEFT | wxBK_RIGHT)
+
+// ----------------------------------------------------------------------------
+// wxBookCtrlBase
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxBookCtrlBase : public wxControl,
+ public wxWithImages
+{
+public:
+ // construction
+ // ------------
+
+ wxBookCtrlBase()
+ {
+ Init();
+ }
+
+ wxBookCtrlBase(wxWindow *parent,
+ wxWindowID winid,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxEmptyString)
+ {
+ Init();
+
+ (void)Create(parent, winid, pos, size, style, name);
+ }
+
+ // quasi ctor
+ bool Create(wxWindow *parent,
+ wxWindowID winid,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxEmptyString);
+
+
+ // accessors
+ // ---------
+
+ // get number of pages in the dialog
+ virtual size_t GetPageCount() const { return m_pages.size(); }
+
+ // get the panel which represents the given page
+ virtual wxWindow *GetPage(size_t n) const { return m_pages[n]; }
+
+ // get the current page or NULL if none
+ wxWindow *GetCurrentPage() const
+ {
+ const int n = GetSelection();
+ return n == wxNOT_FOUND ? NULL : GetPage(n);
+ }
+
+ // get the currently selected page or wxNOT_FOUND if none
+ virtual int GetSelection() const { return m_selection; }
+
+ // set/get the title of a page
+ virtual bool SetPageText(size_t n, const wxString& strText) = 0;
+ virtual wxString GetPageText(size_t n) const = 0;
+
+
+ // image list stuff: each page may have an image associated with it (all
+ // images belong to the same image list)
+ // ---------------------------------------------------------------------
+
+ // sets/returns item's image index in the current image list
+ virtual int GetPageImage(size_t n) const = 0;
+ virtual bool SetPageImage(size_t n, int imageId) = 0;
+
+
+ // geometry
+ // --------
+
+ // resize the notebook so that all pages will have the specified size
+ virtual void SetPageSize(const wxSize& size);
+
+ // return the size of the area needed to accommodate the controller
+ wxSize GetControllerSize() const;
+
+ // calculate the size of the control from the size of its page
+ //
+ // by default this simply returns size enough to fit both the page and the
+ // controller
+ virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
+
+ // get/set size of area between book control area and page area
+ unsigned int GetInternalBorder() const { return m_internalBorder; }
+ void SetInternalBorder(unsigned int border) { m_internalBorder = border; }
+
+ // Sets/gets the margin around the controller
+ void SetControlMargin(int margin) { m_controlMargin = margin; }
+ int GetControlMargin() const { return m_controlMargin; }
+
+ // returns true if we have wxBK_TOP or wxBK_BOTTOM style
+ bool IsVertical() const { return HasFlag(wxBK_BOTTOM | wxBK_TOP); }
+
+ // set/get option to shrink to fit current page
+ void SetFitToCurrentPage(bool fit) { m_fitToCurrentPage = fit; }
+ bool GetFitToCurrentPage() const { return m_fitToCurrentPage; }
+
+ // returns the sizer containing the control, if any
+ wxSizer* GetControlSizer() const { return m_controlSizer; }
+
+
+ // operations
+ // ----------
+
+ // remove one page from the control and delete it
+ virtual bool DeletePage(size_t n);
+
+ // remove one page from the notebook, without deleting it
+ virtual bool RemovePage(size_t n)
+ {
+ DoInvalidateBestSize();
+ return DoRemovePage(n) != NULL;
+ }
+
+ // remove all pages and delete them
+ virtual bool DeleteAllPages()
+ {
+ m_selection = wxNOT_FOUND;
+ DoInvalidateBestSize();
+ WX_CLEAR_ARRAY(m_pages);
+ return true;
+ }
+
+ // adds a new page to the control
+ virtual bool AddPage(wxWindow *page,
+ const wxString& text,
+ bool bSelect = false,
+ int imageId = NO_IMAGE)
+ {
+ DoInvalidateBestSize();
+ return InsertPage(GetPageCount(), page, text, bSelect, imageId);
+ }
+
+ // the same as AddPage(), but adds the page at the specified position
+ virtual bool InsertPage(size_t n,
+ wxWindow *page,
+ const wxString& text,
+ bool bSelect = false,
+ int imageId = NO_IMAGE) = 0;
+
+ // set the currently selected page, return the index of the previously
+ // selected one (or wxNOT_FOUND on error)
+ //
+ // NB: this function will generate PAGE_CHANGING/ED events
+ virtual int SetSelection(size_t n) = 0;
+
+ // acts as SetSelection but does not generate events
+ virtual int ChangeSelection(size_t n) = 0;
+
+
+ // cycle thru the pages
+ void AdvanceSelection(bool forward = true)
+ {
+ int nPage = GetNextPage(forward);
+ if ( nPage != wxNOT_FOUND )
+ {
+ // cast is safe because of the check above
+ SetSelection((size_t)nPage);
+ }
+ }
+
+ // return the index of the given page or wxNOT_FOUND
+ int FindPage(const wxWindow* page) const;
+
+ // hit test: returns which page is hit and, optionally, where (icon, label)
+ virtual int HitTest(const wxPoint& WXUNUSED(pt),
+ long * WXUNUSED(flags) = NULL) const
+ {
+ return wxNOT_FOUND;
+ }
+
+
+ // we do have multiple pages
+ virtual bool HasMultiplePages() const { return true; }
+
+ // we don't want focus for ourselves
+ virtual bool AcceptsFocus() const { return false; }
+
+ // returns true if the platform should explicitly apply a theme border
+ virtual bool CanApplyThemeBorder() const { return false; }
+
+protected:
+ // flags for DoSetSelection()
+ enum
+ {
+ SetSelection_SendEvent = 1
+ };
+
+ // choose the default border for this window
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ // After the insertion of the page in the method InsertPage, calling this
+ // method sets the selection to the given page or the first one if there is
+ // still no selection. The "selection changed" event is sent only if
+ // bSelect is true, so when it is false, no event is sent even if the
+ // selection changed from wxNOT_FOUND to 0 when inserting the first page.
+ //
+ // Returns true if the selection was set to the specified page (explicitly
+ // because of bSelect == true or implicitly because it's the first page) or
+ // false otherwise.
+ bool DoSetSelectionAfterInsertion(size_t n, bool bSelect);
+
+ // Update the selection after removing the page at the given index,
+ // typically called from the derived class overridden DoRemovePage().
+ void DoSetSelectionAfterRemoval(size_t n);
+
+ // set the selection to the given page, sending the events (which can
+ // possibly prevent the page change from taking place) if SendEvent flag is
+ // included
+ virtual int DoSetSelection(size_t nPage, int flags = 0);
+
+ // if the derived class uses DoSetSelection() for implementing
+ // [Set|Change]Selection, it must override UpdateSelectedPage(),
+ // CreatePageChangingEvent() and MakeChangedEvent(), but as it might not
+ // use it, these functions are not pure virtual
+
+ // called to notify the control about a new current page
+ virtual void UpdateSelectedPage(size_t WXUNUSED(newsel))
+ { wxFAIL_MSG(wxT("Override this function!")); }
+
+ // create a new "page changing" event
+ virtual wxBookCtrlEvent* CreatePageChangingEvent() const
+ { wxFAIL_MSG(wxT("Override this function!")); return NULL; }
+
+ // modify the event created by CreatePageChangingEvent() to "page changed"
+ // event, usually by just calling SetEventType() on it
+ virtual void MakeChangedEvent(wxBookCtrlEvent& WXUNUSED(event))
+ { wxFAIL_MSG(wxT("Override this function!")); }
+
+
+ // The derived class also may override the following method, also called
+ // from DoSetSelection(), to show/hide pages differently.
+ virtual void DoShowPage(wxWindow* page, bool show) { page->Show(show); }
+
+
+ // Should we accept NULL page pointers in Add/InsertPage()?
+ //
+ // Default is no but derived classes may override it if they can treat NULL
+ // pages in some sensible way (e.g. wxTreebook overrides this to allow
+ // having nodes without any associated page)
+ virtual bool AllowNullPage() const { return false; }
+
+ // Remove the page and return a pointer to it.
+ //
+ // It also needs to update the current selection if necessary, i.e. if the
+ // page being removed comes before the selected one and the helper method
+ // DoSetSelectionAfterRemoval() can be used for this.
+ virtual wxWindow *DoRemovePage(size_t page) = 0;
+
+ // our best size is the size which fits all our pages
+ virtual wxSize DoGetBestSize() const;
+
+ // helper: get the next page wrapping if we reached the end
+ int GetNextPage(bool forward) const;
+
+ // Lay out controls
+ virtual void DoSize();
+
+ // This method also invalidates the size of the controller and should be
+ // called instead of just InvalidateBestSize() whenever pages are added or
+ // removed as this also affects the controller
+ void DoInvalidateBestSize();
+
+#if wxUSE_HELP
+ // Show the help for the corresponding page
+ void OnHelp(wxHelpEvent& event);
+#endif // wxUSE_HELP
+
+
+ // the array of all pages of this control
+ wxArrayPages m_pages;
+
+ // get the page area
+ virtual wxRect GetPageRect() const;
+
+ // event handlers
+ void OnSize(wxSizeEvent& event);
+
+ // controller buddy if available, NULL otherwise (usually for native book controls like wxNotebook)
+ wxControl *m_bookctrl;
+
+ // Whether to shrink to fit current page
+ bool m_fitToCurrentPage;
+
+ // the sizer containing the choice control
+ wxSizer *m_controlSizer;
+
+ // the margin around the choice control
+ int m_controlMargin;
+
+ // The currently selected page (in range 0..m_pages.size()-1 inclusive) or
+ // wxNOT_FOUND if none (this can normally only be the case for an empty
+ // control without any pages).
+ int m_selection;
+
+private:
+
+ // common part of all ctors
+ void Init();
+
+ // internal border
+ unsigned int m_internalBorder;
+
+ DECLARE_ABSTRACT_CLASS(wxBookCtrlBase)
+ wxDECLARE_NO_COPY_CLASS(wxBookCtrlBase);
+
+ DECLARE_EVENT_TABLE()
+};
+
+// ----------------------------------------------------------------------------
+// wxBookCtrlEvent: page changing events generated by book classes
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxBookCtrlEvent : public wxNotifyEvent
+{
+public:
+ wxBookCtrlEvent(wxEventType commandType = wxEVT_NULL, int winid = 0,
+ int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND)
+ : wxNotifyEvent(commandType, winid)
+ {
+ m_nSel = nSel;
+ m_nOldSel = nOldSel;
+ }
+
+ wxBookCtrlEvent(const wxBookCtrlEvent& event)
+ : wxNotifyEvent(event)
+ {
+ m_nSel = event.m_nSel;
+ m_nOldSel = event.m_nOldSel;
+ }
+
+ virtual wxEvent *Clone() const { return new wxBookCtrlEvent(*this); }
+
+ // accessors
+ // the currently selected page (wxNOT_FOUND if none)
+ int GetSelection() const { return m_nSel; }
+ void SetSelection(int nSel) { m_nSel = nSel; }
+ // the page that was selected before the change (wxNOT_FOUND if none)
+ int GetOldSelection() const { return m_nOldSel; }
+ void SetOldSelection(int nOldSel) { m_nOldSel = nOldSel; }
+
+private:
+ int m_nSel, // currently selected page
+ m_nOldSel; // previously selected page
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxBookCtrlEvent)
+};
+
+typedef void (wxEvtHandler::*wxBookCtrlEventFunction)(wxBookCtrlEvent&);
+
+#define wxBookCtrlEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxBookCtrlEventFunction, func)
+
+// obsolete name, defined for compatibility only
+#define wxBookCtrlBaseEvent wxBookCtrlEvent
+
+// make a default book control for given platform
+#if wxUSE_NOTEBOOK
+ // dedicated to majority of desktops
+ #include "wx/notebook.h"
+ #define wxBookCtrl wxNotebook
+ #define wxEVT_BOOKCTRL_PAGE_CHANGED wxEVT_NOTEBOOK_PAGE_CHANGED
+ #define wxEVT_BOOKCTRL_PAGE_CHANGING wxEVT_NOTEBOOK_PAGE_CHANGING
+ #define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_NOTEBOOK_PAGE_CHANGED(id, fn)
+ #define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_NOTEBOOK_PAGE_CHANGING(id, fn)
+#else
+ // dedicated to Smartphones
+ #include "wx/choicebk.h"
+ #define wxBookCtrl wxChoicebook
+ #define wxEVT_BOOKCTRL_PAGE_CHANGED wxEVT_CHOICEBOOK_PAGE_CHANGED
+ #define wxEVT_BOOKCTRL_PAGE_CHANGING wxEVT_CHOICEBOOK_PAGE_CHANGING
+ #define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_CHOICEBOOK_PAGE_CHANGED(id, fn)
+ #define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_CHOICEBOOK_PAGE_CHANGING(id, fn)
+#endif
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_BOOKCTRL_PAGE_CHANGED
+#define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_BOOKCTRL_PAGE_CHANGING
+
+#if WXWIN_COMPATIBILITY_2_6
+ #define wxBC_TOP wxBK_TOP
+ #define wxBC_BOTTOM wxBK_BOTTOM
+ #define wxBC_LEFT wxBK_LEFT
+ #define wxBC_RIGHT wxBK_RIGHT
+ #define wxBC_DEFAULT wxBK_DEFAULT
+#endif
+
+#endif // wxUSE_BOOKCTRL
+
+#endif // _WX_BOOKCTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/brush.h
+// Purpose: Includes platform-specific wxBrush file
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_BRUSH_H_BASE_
+#define _WX_BRUSH_H_BASE_
+
+#include "wx/defs.h"
+#include "wx/object.h"
+#include "wx/gdiobj.h"
+#include "wx/gdicmn.h" // for wxGDIObjListBase
+
+// NOTE: these values cannot be combined together!
+enum wxBrushStyle
+{
+ wxBRUSHSTYLE_INVALID = -1,
+
+ wxBRUSHSTYLE_SOLID = wxSOLID,
+ wxBRUSHSTYLE_TRANSPARENT = wxTRANSPARENT,
+ wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE = wxSTIPPLE_MASK_OPAQUE,
+ wxBRUSHSTYLE_STIPPLE_MASK = wxSTIPPLE_MASK,
+ wxBRUSHSTYLE_STIPPLE = wxSTIPPLE,
+ wxBRUSHSTYLE_BDIAGONAL_HATCH = wxHATCHSTYLE_BDIAGONAL,
+ wxBRUSHSTYLE_CROSSDIAG_HATCH = wxHATCHSTYLE_CROSSDIAG,
+ wxBRUSHSTYLE_FDIAGONAL_HATCH = wxHATCHSTYLE_FDIAGONAL,
+ wxBRUSHSTYLE_CROSS_HATCH = wxHATCHSTYLE_CROSS,
+ wxBRUSHSTYLE_HORIZONTAL_HATCH = wxHATCHSTYLE_HORIZONTAL,
+ wxBRUSHSTYLE_VERTICAL_HATCH = wxHATCHSTYLE_VERTICAL,
+ wxBRUSHSTYLE_FIRST_HATCH = wxHATCHSTYLE_FIRST,
+ wxBRUSHSTYLE_LAST_HATCH = wxHATCHSTYLE_LAST
+};
+
+
+// wxBrushBase
+class WXDLLIMPEXP_CORE wxBrushBase: public wxGDIObject
+{
+public:
+ virtual ~wxBrushBase() { }
+
+ virtual void SetColour(const wxColour& col) = 0;
+ virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) = 0;
+ virtual void SetStyle(wxBrushStyle style) = 0;
+ virtual void SetStipple(const wxBitmap& stipple) = 0;
+
+ virtual wxColour GetColour() const = 0;
+ virtual wxBrushStyle GetStyle() const = 0;
+ virtual wxBitmap *GetStipple() const = 0;
+
+ virtual bool IsHatch() const
+ { return (GetStyle()>=wxBRUSHSTYLE_FIRST_HATCH) && (GetStyle()<=wxBRUSHSTYLE_LAST_HATCH); }
+
+ // Convenient helpers for testing whether the brush is a transparent one:
+ // unlike GetStyle() == wxBRUSHSTYLE_TRANSPARENT, they work correctly even
+ // if the brush is invalid (they both return false in this case).
+ bool IsTransparent() const
+ {
+ return IsOk() && GetStyle() == wxBRUSHSTYLE_TRANSPARENT;
+ }
+
+ bool IsNonTransparent() const
+ {
+ return IsOk() && GetStyle() != wxBRUSHSTYLE_TRANSPARENT;
+ }
+};
+
+#if defined(__WXMSW__)
+ #include "wx/msw/brush.h"
+#elif defined(__WXMOTIF__) || defined(__WXX11__)
+ #include "wx/x11/brush.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/brush.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/brush.h"
+#elif defined(__WXDFB__)
+ #include "wx/dfb/brush.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/brush.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/brush.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/brush.h"
+#endif
+
+class WXDLLIMPEXP_CORE wxBrushList: public wxGDIObjListBase
+{
+public:
+ wxBrush *FindOrCreateBrush(const wxColour& colour,
+ wxBrushStyle style = wxBRUSHSTYLE_SOLID);
+
+#if FUTURE_WXWIN_COMPATIBILITY_3_0
+ wxBrush *FindOrCreateBrush(const wxColour& colour, int style)
+ { return FindOrCreateBrush(colour, (wxBrushStyle)style); }
+#endif
+
+#if WXWIN_COMPATIBILITY_2_6
+ wxDEPRECATED( void AddBrush(wxBrush*) );
+ wxDEPRECATED( void RemoveBrush(wxBrush*) );
+#endif
+};
+
+extern WXDLLIMPEXP_DATA_CORE(wxBrushList*) wxTheBrushList;
+
+// provide comparison operators to allow code such as
+//
+// if ( brush.GetStyle() == wxTRANSPARENT )
+//
+// to compile without warnings which it would otherwise provoke from some
+// compilers as it compares elements of different enums
+#if FUTURE_WXWIN_COMPATIBILITY_3_0
+
+// Unfortunately some compilers have ambiguity issues when enum comparisons are
+// overloaded so we have to disable the overloads in this case, see
+// wxCOMPILER_NO_OVERLOAD_ON_ENUM definition in wx/platform.h for more details.
+#ifndef wxCOMPILER_NO_OVERLOAD_ON_ENUM
+
+inline bool operator==(wxBrushStyle s, wxDeprecatedGUIConstants t)
+{
+ return static_cast<int>(s) == static_cast<int>(t);
+}
+
+inline bool operator!=(wxBrushStyle s, wxDeprecatedGUIConstants t)
+{
+ return !(s == t);
+}
+
+#endif // wxCOMPILER_NO_OVERLOAD_ON_ENUM
+
+#endif // FUTURE_WXWIN_COMPATIBILITY_3_0
+
+#endif // _WX_BRUSH_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/buffer.h
+// Purpose: auto buffer classes: buffers which automatically free memory
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 12.04.99
+// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_BUFFER_H
+#define _WX_BUFFER_H
+
+#include "wx/chartype.h"
+#include "wx/wxcrtbase.h"
+
+#include <stdlib.h> // malloc() and free()
+
+class WXDLLIMPEXP_FWD_BASE wxCStrData;
+
+// ----------------------------------------------------------------------------
+// Special classes for (wide) character strings: they use malloc/free instead
+// of new/delete
+// ----------------------------------------------------------------------------
+
+// helpers used by wxCharTypeBuffer
+namespace wxPrivate
+{
+
+struct UntypedBufferData
+{
+ enum Kind
+ {
+ Owned,
+ NonOwned
+ };
+
+ UntypedBufferData(void *str, size_t len, Kind kind = Owned)
+ : m_str(str), m_length(len), m_ref(1), m_owned(kind == Owned) {}
+
+ ~UntypedBufferData()
+ {
+ if ( m_owned )
+ free(m_str);
+ }
+
+ void *m_str;
+ size_t m_length;
+
+ // "short" to have sizeof(Data)=12 on 32bit archs
+ unsigned short m_ref;
+
+ bool m_owned;
+};
+
+// NB: this is defined in string.cpp and not the (non-existent) buffer.cpp
+WXDLLIMPEXP_BASE UntypedBufferData * GetUntypedNullData();
+
+} // namespace wxPrivate
+
+
+// Reference-counted character buffer for storing string data. The buffer
+// is only valid for as long as the "parent" object that provided the data
+// is valid; see wxCharTypeBuffer<T> for persistent variant.
+template <typename T>
+class wxScopedCharTypeBuffer
+{
+public:
+ typedef T CharType;
+
+ wxScopedCharTypeBuffer()
+ {
+ m_data = GetNullData();
+ }
+
+ // Creates "non-owned" buffer, i.e. 'str' is not owned by the buffer
+ // and doesn't get freed by dtor. Used e.g. to point to wxString's internal
+ // storage.
+ static
+ const wxScopedCharTypeBuffer CreateNonOwned(const CharType *str,
+ size_t len = wxNO_LEN)
+ {
+ if ( len == wxNO_LEN )
+ len = wxStrlen(str);
+
+ wxScopedCharTypeBuffer buf;
+ if ( str )
+ buf.m_data = new Data(const_cast<CharType*>(str), len, Data::NonOwned);
+ return buf;
+ }
+
+ // Creates "owned" buffer, i.e. takes over ownership of 'str' and frees it
+ // in dtor (if ref.count reaches 0).
+ static
+ const wxScopedCharTypeBuffer CreateOwned(CharType *str,
+ size_t len = wxNO_LEN )
+ {
+ if ( len == wxNO_LEN )
+ len = wxStrlen(str);
+
+ wxScopedCharTypeBuffer buf;
+ if ( str )
+ buf.m_data = new Data(str, len);
+ return buf;
+ }
+
+ wxScopedCharTypeBuffer(const wxScopedCharTypeBuffer& src)
+ {
+ m_data = src.m_data;
+ IncRef();
+ }
+
+ wxScopedCharTypeBuffer& operator=(const wxScopedCharTypeBuffer& src)
+ {
+ if ( &src == this )
+ return *this;
+
+ DecRef();
+ m_data = src.m_data;
+ IncRef();
+
+ return *this;
+ }
+
+ ~wxScopedCharTypeBuffer()
+ {
+ DecRef();
+ }
+
+ // NB: this method is only const for backward compatibility. It used to
+ // be needed for auto_ptr-like semantics of the copy ctor, but now
+ // that ref-counting is used, it's not really needed.
+ CharType *release() const
+ {
+ if ( m_data == GetNullData() )
+ return NULL;
+
+ wxASSERT_MSG( m_data->m_owned, wxT("can't release non-owned buffer") );
+ wxASSERT_MSG( m_data->m_ref == 1, wxT("can't release shared buffer") );
+
+ CharType * const p = m_data->Get();
+
+ wxScopedCharTypeBuffer *self = const_cast<wxScopedCharTypeBuffer*>(this);
+ self->m_data->Set(NULL, 0);
+ self->DecRef();
+
+ return p;
+ }
+
+ void reset()
+ {
+ DecRef();
+ }
+
+ CharType *data() { return m_data->Get(); }
+ const CharType *data() const { return m_data->Get(); }
+ operator const CharType *() const { return data(); }
+ CharType operator[](size_t n) const { return data()[n]; }
+
+ size_t length() const { return m_data->m_length; }
+
+protected:
+ // reference-counted data
+ struct Data : public wxPrivate::UntypedBufferData
+ {
+ Data(CharType *str, size_t len, Kind kind = Owned)
+ : wxPrivate::UntypedBufferData(str, len, kind)
+ {
+ }
+
+ CharType *Get() const { return static_cast<CharType *>(m_str); }
+ void Set(CharType *str, size_t len)
+ {
+ m_str = str;
+ m_length = len;
+ }
+ };
+
+ // placeholder for NULL string, to simplify this code
+ static Data *GetNullData()
+ {
+ return static_cast<Data *>(wxPrivate::GetUntypedNullData());
+ }
+
+ void IncRef()
+ {
+ if ( m_data == GetNullData() ) // exception, not ref-counted
+ return;
+ m_data->m_ref++;
+ }
+
+ void DecRef()
+ {
+ if ( m_data == GetNullData() ) // exception, not ref-counted
+ return;
+ if ( --m_data->m_ref == 0 )
+ delete m_data;
+ m_data = GetNullData();
+ }
+
+ // sets this object to a be copy of 'other'; if 'src' is non-owned,
+ // a deep copy is made and 'this' will contain new instance of the data
+ void MakeOwnedCopyOf(const wxScopedCharTypeBuffer& src)
+ {
+ this->DecRef();
+
+ if ( src.m_data == this->GetNullData() )
+ {
+ this->m_data = this->GetNullData();
+ }
+ else if ( src.m_data->m_owned )
+ {
+ this->m_data = src.m_data;
+ this->IncRef();
+ }
+ else
+ {
+ // if the scoped buffer had non-owned data, we have to make
+ // a copy here, because src.m_data->m_str is valid only for as long
+ // as 'src' exists
+ this->m_data = new Data
+ (
+ StrCopy(src.data(), src.length()),
+ src.length()
+ );
+ }
+ }
+
+ static CharType *StrCopy(const CharType *src, size_t len)
+ {
+ CharType *dst = (CharType*)malloc(sizeof(CharType) * (len + 1));
+ if ( dst )
+ memcpy(dst, src, sizeof(CharType) * (len + 1));
+ return dst;
+ }
+
+protected:
+ Data *m_data;
+};
+
+typedef wxScopedCharTypeBuffer<char> wxScopedCharBuffer;
+typedef wxScopedCharTypeBuffer<wchar_t> wxScopedWCharBuffer;
+
+
+// this buffer class always stores data in "owned" (persistent) manner
+template <typename T>
+class wxCharTypeBuffer : public wxScopedCharTypeBuffer<T>
+{
+protected:
+ typedef typename wxScopedCharTypeBuffer<T>::Data Data;
+
+public:
+ typedef T CharType;
+
+ wxCharTypeBuffer(const CharType *str = NULL, size_t len = wxNO_LEN)
+ {
+ if ( str )
+ {
+ if ( len == wxNO_LEN )
+ len = wxStrlen(str);
+ this->m_data = new Data(this->StrCopy(str, len), len);
+ }
+ else
+ {
+ this->m_data = this->GetNullData();
+ }
+ }
+
+ wxCharTypeBuffer(size_t len)
+ {
+ CharType* const str = (CharType *)malloc((len + 1)*sizeof(CharType));
+ if ( str )
+ {
+ str[len] = (CharType)0;
+
+ // There is a potential memory leak here if new throws because it
+ // fails to allocate Data, we ought to use new(nothrow) here, but
+ // this might fail to compile under some platforms so until this
+ // can be fully tested, just live with this (rather unlikely, as
+ // Data is a small object) potential leak.
+ this->m_data = new Data(str, len);
+ }
+ else
+ {
+ this->m_data = this->GetNullData();
+ }
+ }
+
+ wxCharTypeBuffer(const wxCharTypeBuffer& src)
+ : wxScopedCharTypeBuffer<T>(src) {}
+
+ wxCharTypeBuffer& operator=(const CharType *str)
+ {
+ this->DecRef();
+
+ if ( str )
+ this->m_data = new Data(wxStrdup(str), wxStrlen(str));
+ return *this;
+ }
+
+ wxCharTypeBuffer& operator=(const wxCharTypeBuffer& src)
+ {
+ wxScopedCharTypeBuffer<T>::operator=(src);
+ return *this;
+ }
+
+ wxCharTypeBuffer(const wxScopedCharTypeBuffer<T>& src)
+ {
+ this->MakeOwnedCopyOf(src);
+ }
+
+ wxCharTypeBuffer& operator=(const wxScopedCharTypeBuffer<T>& src)
+ {
+ MakeOwnedCopyOf(src);
+ return *this;
+ }
+
+ bool extend(size_t len)
+ {
+ wxASSERT_MSG( this->m_data->m_owned, "cannot extend non-owned buffer" );
+ wxASSERT_MSG( this->m_data->m_ref == 1, "can't extend shared buffer" );
+
+ CharType *str =
+ (CharType *)realloc(this->data(), (len + 1) * sizeof(CharType));
+ if ( !str )
+ return false;
+
+ // For consistency with the ctor taking just the length, NUL-terminate
+ // the buffer.
+ str[len] = (CharType)0;
+
+ if ( this->m_data == this->GetNullData() )
+ {
+ this->m_data = new Data(str, len);
+ }
+ else
+ {
+ this->m_data->Set(str, len);
+ this->m_data->m_owned = true;
+ }
+
+ return true;
+ }
+
+ void shrink(size_t len)
+ {
+ wxASSERT_MSG( this->m_data->m_owned, "cannot shrink non-owned buffer" );
+ wxASSERT_MSG( this->m_data->m_ref == 1, "can't shrink shared buffer" );
+
+ wxASSERT( len <= this->length() );
+
+ this->m_data->m_length = len;
+ this->data()[len] = 0;
+ }
+};
+
+WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxScopedCharTypeBuffer<char> )
+WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxCharTypeBuffer<char> )
+
+class wxCharBuffer : public wxCharTypeBuffer<char>
+{
+public:
+ typedef wxCharTypeBuffer<char> wxCharTypeBufferBase;
+ typedef wxScopedCharTypeBuffer<char> wxScopedCharTypeBufferBase;
+
+ wxCharBuffer(const wxCharTypeBufferBase& buf)
+ : wxCharTypeBufferBase(buf) {}
+ wxCharBuffer(const wxScopedCharTypeBufferBase& buf)
+ : wxCharTypeBufferBase(buf) {}
+
+ wxCharBuffer(const CharType *str = NULL) : wxCharTypeBufferBase(str) {}
+ wxCharBuffer(size_t len) : wxCharTypeBufferBase(len) {}
+
+ wxCharBuffer(const wxCStrData& cstr);
+};
+
+WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxScopedCharTypeBuffer<wchar_t> )
+WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxCharTypeBuffer<wchar_t> )
+
+class wxWCharBuffer : public wxCharTypeBuffer<wchar_t>
+{
+public:
+ typedef wxCharTypeBuffer<wchar_t> wxCharTypeBufferBase;
+ typedef wxScopedCharTypeBuffer<wchar_t> wxScopedCharTypeBufferBase;
+
+ wxWCharBuffer(const wxCharTypeBufferBase& buf)
+ : wxCharTypeBufferBase(buf) {}
+ wxWCharBuffer(const wxScopedCharTypeBufferBase& buf)
+ : wxCharTypeBufferBase(buf) {}
+
+ wxWCharBuffer(const CharType *str = NULL) : wxCharTypeBufferBase(str) {}
+ wxWCharBuffer(size_t len) : wxCharTypeBufferBase(len) {}
+
+ wxWCharBuffer(const wxCStrData& cstr);
+};
+
+// wxCharTypeBuffer<T> implicitly convertible to T*
+template <typename T>
+class wxWritableCharTypeBuffer : public wxCharTypeBuffer<T>
+{
+public:
+ typedef typename wxScopedCharTypeBuffer<T>::CharType CharType;
+
+ wxWritableCharTypeBuffer(const wxScopedCharTypeBuffer<T>& src)
+ : wxCharTypeBuffer<T>(src) {}
+ // FIXME-UTF8: this won't be needed after converting mb_str()/wc_str() to
+ // always return a buffer
+ // + we should derive this class from wxScopedCharTypeBuffer
+ // then
+ wxWritableCharTypeBuffer(const CharType *str = NULL)
+ : wxCharTypeBuffer<T>(str) {}
+
+ operator CharType*() { return this->data(); }
+};
+
+typedef wxWritableCharTypeBuffer<char> wxWritableCharBuffer;
+typedef wxWritableCharTypeBuffer<wchar_t> wxWritableWCharBuffer;
+
+
+#if wxUSE_UNICODE
+ #define wxWxCharBuffer wxWCharBuffer
+
+ #define wxMB2WXbuf wxWCharBuffer
+ #define wxWX2MBbuf wxCharBuffer
+ #if wxUSE_UNICODE_WCHAR
+ #define wxWC2WXbuf wxChar*
+ #define wxWX2WCbuf wxChar*
+ #elif wxUSE_UNICODE_UTF8
+ #define wxWC2WXbuf wxWCharBuffer
+ #define wxWX2WCbuf wxWCharBuffer
+ #endif
+#else // ANSI
+ #define wxWxCharBuffer wxCharBuffer
+
+ #define wxMB2WXbuf wxChar*
+ #define wxWX2MBbuf wxChar*
+ #define wxWC2WXbuf wxCharBuffer
+ #define wxWX2WCbuf wxWCharBuffer
+#endif // Unicode/ANSI
+
+// ----------------------------------------------------------------------------
+// A class for holding growable data buffers (not necessarily strings)
+// ----------------------------------------------------------------------------
+
+// This class manages the actual data buffer pointer and is ref-counted.
+class wxMemoryBufferData
+{
+public:
+ // the initial size and also the size added by ResizeIfNeeded()
+ enum { DefBufSize = 1024 };
+
+ friend class wxMemoryBuffer;
+
+ // everything is private as it can only be used by wxMemoryBuffer
+private:
+ wxMemoryBufferData(size_t size = wxMemoryBufferData::DefBufSize)
+ : m_data(size ? malloc(size) : NULL), m_size(size), m_len(0), m_ref(0)
+ {
+ }
+ ~wxMemoryBufferData() { free(m_data); }
+
+
+ void ResizeIfNeeded(size_t newSize)
+ {
+ if (newSize > m_size)
+ {
+ void *dataOld = m_data;
+ m_data = realloc(m_data, newSize + wxMemoryBufferData::DefBufSize);
+ if ( !m_data )
+ {
+ free(dataOld);
+ }
+
+ m_size = newSize + wxMemoryBufferData::DefBufSize;
+ }
+ }
+
+ void IncRef() { m_ref += 1; }
+ void DecRef()
+ {
+ m_ref -= 1;
+ if (m_ref == 0) // are there no more references?
+ delete this;
+ }
+
+ void *release()
+ {
+ if ( m_data == NULL )
+ return NULL;
+
+ wxASSERT_MSG( m_ref == 1, "can't release shared buffer" );
+
+ void *p = m_data;
+ m_data = NULL;
+ m_len =
+ m_size = 0;
+
+ return p;
+ }
+
+
+ // the buffer containing the data
+ void *m_data;
+
+ // the size of the buffer
+ size_t m_size;
+
+ // the amount of data currently in the buffer
+ size_t m_len;
+
+ // the reference count
+ size_t m_ref;
+
+ wxDECLARE_NO_COPY_CLASS(wxMemoryBufferData);
+};
+
+
+class wxMemoryBuffer
+{
+public:
+ // ctor and dtor
+ wxMemoryBuffer(size_t size = wxMemoryBufferData::DefBufSize)
+ {
+ m_bufdata = new wxMemoryBufferData(size);
+ m_bufdata->IncRef();
+ }
+
+ ~wxMemoryBuffer() { m_bufdata->DecRef(); }
+
+
+ // copy and assignment
+ wxMemoryBuffer(const wxMemoryBuffer& src)
+ : m_bufdata(src.m_bufdata)
+ {
+ m_bufdata->IncRef();
+ }
+
+ wxMemoryBuffer& operator=(const wxMemoryBuffer& src)
+ {
+ if (&src != this)
+ {
+ m_bufdata->DecRef();
+ m_bufdata = src.m_bufdata;
+ m_bufdata->IncRef();
+ }
+ return *this;
+ }
+
+
+ // Accessors
+ void *GetData() const { return m_bufdata->m_data; }
+ size_t GetBufSize() const { return m_bufdata->m_size; }
+ size_t GetDataLen() const { return m_bufdata->m_len; }
+
+ bool IsEmpty() const { return GetDataLen() == 0; }
+
+ void SetBufSize(size_t size) { m_bufdata->ResizeIfNeeded(size); }
+ void SetDataLen(size_t len)
+ {
+ wxASSERT(len <= m_bufdata->m_size);
+ m_bufdata->m_len = len;
+ }
+
+ void Clear() { SetDataLen(0); }
+
+ // Ensure the buffer is big enough and return a pointer to it
+ void *GetWriteBuf(size_t sizeNeeded)
+ {
+ m_bufdata->ResizeIfNeeded(sizeNeeded);
+ return m_bufdata->m_data;
+ }
+
+ // Update the length after the write
+ void UngetWriteBuf(size_t sizeUsed) { SetDataLen(sizeUsed); }
+
+ // Like the above, but appends to the buffer
+ void *GetAppendBuf(size_t sizeNeeded)
+ {
+ m_bufdata->ResizeIfNeeded(m_bufdata->m_len + sizeNeeded);
+ return (char*)m_bufdata->m_data + m_bufdata->m_len;
+ }
+
+ // Update the length after the append
+ void UngetAppendBuf(size_t sizeUsed)
+ {
+ SetDataLen(m_bufdata->m_len + sizeUsed);
+ }
+
+ // Other ways to append to the buffer
+ void AppendByte(char data)
+ {
+ wxCHECK_RET( m_bufdata->m_data, wxT("invalid wxMemoryBuffer") );
+
+ m_bufdata->ResizeIfNeeded(m_bufdata->m_len + 1);
+ *(((char*)m_bufdata->m_data) + m_bufdata->m_len) = data;
+ m_bufdata->m_len += 1;
+ }
+
+ void AppendData(const void *data, size_t len)
+ {
+ memcpy(GetAppendBuf(len), data, len);
+ UngetAppendBuf(len);
+ }
+
+ operator const char *() const { return (const char*)GetData(); }
+
+ // gives up ownership of data, returns the pointer; after this call,
+ // data isn't freed by the buffer and its content is resent to empty
+ void *release()
+ {
+ return m_bufdata->release();
+ }
+
+private:
+ wxMemoryBufferData* m_bufdata;
+};
+
+// ----------------------------------------------------------------------------
+// template class for any kind of data
+// ----------------------------------------------------------------------------
+
+// TODO
+
+#endif // _WX_BUFFER_H
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/build.h
+// Purpose: Runtime build options checking
+// Author: Vadim Zeitlin, Vaclav Slavik
+// Modified by:
+// Created: 07.05.02
+// Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_BUILD_H_
+#define _WX_BUILD_H_
+
+#include "wx/version.h"
+
+// NB: This file contains macros for checking binary compatibility of libraries
+// in multilib builds, plugins and user components.
+// The WX_BUILD_OPTIONS_SIGNATURE macro expands into string that should
+// uniquely identify binary compatible builds: i.e. if two builds of the
+// library are binary compatible, their signature string should be the
+// same; if two builds are binary incompatible, their signatures should
+// be different.
+//
+// Therefore, wxUSE_XXX flags that affect binary compatibility (vtables,
+// function signatures) should be accounted for here. So should compilers
+// and compiler versions (but note that binary compatible compiler versions
+// such as gcc-2.95.2 and gcc-2.95.3 should have same signature!).
+
+// ----------------------------------------------------------------------------
+// WX_BUILD_OPTIONS_SIGNATURE
+// ----------------------------------------------------------------------------
+
+#define __WX_BO_STRINGIZE(x) __WX_BO_STRINGIZE0(x)
+#define __WX_BO_STRINGIZE0(x) #x
+
+#if (wxMINOR_VERSION % 2) == 0
+ #define __WX_BO_VERSION(x,y,z) \
+ __WX_BO_STRINGIZE(x) "." __WX_BO_STRINGIZE(y)
+#else
+ #define __WX_BO_VERSION(x,y,z) \
+ __WX_BO_STRINGIZE(x) "." __WX_BO_STRINGIZE(y) "." __WX_BO_STRINGIZE(z)
+#endif
+
+#if wxUSE_UNICODE_UTF8
+ #define __WX_BO_UNICODE "UTF-8"
+#elif wxUSE_UNICODE_WCHAR
+ #define __WX_BO_UNICODE "wchar_t"
+#else
+ #define __WX_BO_UNICODE "ANSI"
+#endif
+
+// GCC and Intel C++ share same C++ ABI (and possibly others in the future),
+// check if compiler versions are compatible:
+#if defined(__GXX_ABI_VERSION)
+ #define __WX_BO_COMPILER \
+ ",compiler with C++ ABI " __WX_BO_STRINGIZE(__GXX_ABI_VERSION)
+#elif defined(__INTEL_COMPILER)
+ #define __WX_BO_COMPILER ",Intel C++"
+#elif defined(__GNUG__)
+ #define __WX_BO_COMPILER ",GCC " \
+ __WX_BO_STRINGIZE(__GNUC__) "." __WX_BO_STRINGIZE(__GNUC_MINOR__)
+#elif defined(__VISUALC__)
+ #define __WX_BO_COMPILER ",Visual C++ " __WX_BO_STRINGIZE(_MSC_VER)
+#elif defined(__BORLANDC__)
+ #define __WX_BO_COMPILER ",Borland C++"
+#elif defined(__DIGITALMARS__)
+ #define __WX_BO_COMPILER ",DigitalMars"
+#elif defined(__WATCOMC__)
+ #define __WX_BO_COMPILER ",Watcom C++"
+#else
+ #define __WX_BO_COMPILER
+#endif
+
+// WXWIN_COMPATIBILITY macros affect presence of virtual functions
+#if WXWIN_COMPATIBILITY_2_6
+ #define __WX_BO_WXWIN_COMPAT_2_6 ",compatible with 2.6"
+#else
+ #define __WX_BO_WXWIN_COMPAT_2_6
+#endif
+#if WXWIN_COMPATIBILITY_2_8
+ #define __WX_BO_WXWIN_COMPAT_2_8 ",compatible with 2.8"
+#else
+ #define __WX_BO_WXWIN_COMPAT_2_8
+#endif
+
+// deriving wxWin containers from STL ones changes them completely:
+#if wxUSE_STD_CONTAINERS
+ #define __WX_BO_STL ",STL containers"
+#else
+ #define __WX_BO_STL ",wx containers"
+#endif
+
+// This macro is passed as argument to wxConsoleApp::CheckBuildOptions()
+#define WX_BUILD_OPTIONS_SIGNATURE \
+ __WX_BO_VERSION(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) \
+ " (" __WX_BO_UNICODE \
+ __WX_BO_COMPILER \
+ __WX_BO_STL \
+ __WX_BO_WXWIN_COMPAT_2_6 __WX_BO_WXWIN_COMPAT_2_8 \
+ ")"
+
+
+// ----------------------------------------------------------------------------
+// WX_CHECK_BUILD_OPTIONS
+// ----------------------------------------------------------------------------
+
+// Use this macro to check build options. Adding it to a file in DLL will
+// ensure that the DLL checks build options in same way wxIMPLEMENT_APP() does.
+#define WX_CHECK_BUILD_OPTIONS(libName) \
+ static struct wxBuildOptionsChecker \
+ { \
+ wxBuildOptionsChecker() \
+ { \
+ wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \
+ libName); \
+ } \
+ } gs_buildOptionsCheck;
+
+
+#endif // _WX_BUILD_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/busyinfo.h
+// Purpose: Information window (when app is busy)
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __BUSYINFO_H_BASE__
+#define __BUSYINFO_H_BASE__
+
+#include "wx/defs.h"
+
+#if wxUSE_BUSYINFO
+
+#include "wx/generic/busyinfo.h"
+
+#endif // wxUSE_BUSYINFO
+
+#endif // __BUSYINFO_H_BASE__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/button.h
+// Purpose: wxButtonBase class
+// Author: Vadim Zetlin
+// Modified by:
+// Created: 15.08.00
+// Copyright: (c) Vadim Zetlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_BUTTON_H_BASE_
+#define _WX_BUTTON_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_BUTTON
+
+#include "wx/anybutton.h"
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxButtonNameStr[];
+
+// ----------------------------------------------------------------------------
+// wxButton: a push button
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxButtonBase : public wxAnyButton
+{
+public:
+ wxButtonBase() { }
+
+ // show the authentication needed symbol on the button: this is currently
+ // only implemented on Windows Vista and newer (on which it shows the UAC
+ // shield symbol)
+ void SetAuthNeeded(bool show = true) { DoSetAuthNeeded(show); }
+ bool GetAuthNeeded() const { return DoGetAuthNeeded(); }
+
+ // make this button the default button in its top level window
+ //
+ // returns the old default item (possibly NULL)
+ virtual wxWindow *SetDefault();
+
+ // returns the default button size for this platform
+ static wxSize GetDefaultSize();
+
+protected:
+ wxDECLARE_NO_COPY_CLASS(wxButtonBase);
+};
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/button.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/button.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/button.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/button.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/button.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/button.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/button.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/button.h"
+#endif
+
+#endif // wxUSE_BUTTON
+
+#endif // _WX_BUTTON_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/calctrl.h
+// Purpose: date-picker control
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 29.12.99
+// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CALCTRL_H_
+#define _WX_CALCTRL_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_CALENDARCTRL
+
+#include "wx/dateevt.h"
+#include "wx/colour.h"
+#include "wx/font.h"
+#include "wx/control.h"
+
+// ----------------------------------------------------------------------------
+// wxCalendarCtrl flags
+// ----------------------------------------------------------------------------
+
+enum
+{
+ // show Sunday as the first day of the week (default)
+ wxCAL_SUNDAY_FIRST = 0x0000,
+
+ // show Monday as the first day of the week
+ wxCAL_MONDAY_FIRST = 0x0001,
+
+ // highlight holidays
+ wxCAL_SHOW_HOLIDAYS = 0x0002,
+
+ // disable the year change control, show only the month change one
+ // deprecated
+ wxCAL_NO_YEAR_CHANGE = 0x0004,
+
+ // don't allow changing neither month nor year (implies
+ // wxCAL_NO_YEAR_CHANGE)
+ wxCAL_NO_MONTH_CHANGE = 0x000c,
+
+ // use MS-style month-selection instead of combo-spin combination
+ wxCAL_SEQUENTIAL_MONTH_SELECTION = 0x0010,
+
+ // show the neighbouring weeks in the previous and next month
+ wxCAL_SHOW_SURROUNDING_WEEKS = 0x0020,
+
+ // show week numbers on the left side of the calendar.
+ wxCAL_SHOW_WEEK_NUMBERS = 0x0040
+};
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// return values for the HitTest() method
+enum wxCalendarHitTestResult
+{
+ wxCAL_HITTEST_NOWHERE, // outside of anything
+ wxCAL_HITTEST_HEADER, // on the header (weekdays)
+ wxCAL_HITTEST_DAY, // on a day in the calendar
+ wxCAL_HITTEST_INCMONTH,
+ wxCAL_HITTEST_DECMONTH,
+ wxCAL_HITTEST_SURROUNDING_WEEK,
+ wxCAL_HITTEST_WEEK
+};
+
+// border types for a date
+enum wxCalendarDateBorder
+{
+ wxCAL_BORDER_NONE, // no border (default)
+ wxCAL_BORDER_SQUARE, // a rectangular border
+ wxCAL_BORDER_ROUND // a round border
+};
+
+// ----------------------------------------------------------------------------
+// wxCalendarDateAttr: custom attributes for a calendar date
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxCalendarDateAttr
+{
+public:
+ // ctors
+ wxCalendarDateAttr(const wxColour& colText = wxNullColour,
+ const wxColour& colBack = wxNullColour,
+ const wxColour& colBorder = wxNullColour,
+ const wxFont& font = wxNullFont,
+ wxCalendarDateBorder border = wxCAL_BORDER_NONE)
+ : m_colText(colText), m_colBack(colBack),
+ m_colBorder(colBorder), m_font(font)
+ {
+ Init(border);
+ }
+ wxCalendarDateAttr(wxCalendarDateBorder border,
+ const wxColour& colBorder = wxNullColour)
+ : m_colBorder(colBorder)
+ {
+ Init(border);
+ }
+
+ // setters
+ void SetTextColour(const wxColour& colText) { m_colText = colText; }
+ void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; }
+ void SetBorderColour(const wxColour& col) { m_colBorder = col; }
+ void SetFont(const wxFont& font) { m_font = font; }
+ void SetBorder(wxCalendarDateBorder border) { m_border = border; }
+ void SetHoliday(bool holiday) { m_holiday = holiday; }
+
+ // accessors
+ bool HasTextColour() const { return m_colText.IsOk(); }
+ bool HasBackgroundColour() const { return m_colBack.IsOk(); }
+ bool HasBorderColour() const { return m_colBorder.IsOk(); }
+ bool HasFont() const { return m_font.IsOk(); }
+ bool HasBorder() const { return m_border != wxCAL_BORDER_NONE; }
+
+ bool IsHoliday() const { return m_holiday; }
+
+ const wxColour& GetTextColour() const { return m_colText; }
+ const wxColour& GetBackgroundColour() const { return m_colBack; }
+ const wxColour& GetBorderColour() const { return m_colBorder; }
+ const wxFont& GetFont() const { return m_font; }
+ wxCalendarDateBorder GetBorder() const { return m_border; }
+
+ // get or change the "mark" attribute, i.e. the one used for the items
+ // marked with wxCalendarCtrl::Mark()
+ static const wxCalendarDateAttr& GetMark() { return m_mark; }
+ static void SetMark(wxCalendarDateAttr const& m) { m_mark = m; }
+
+protected:
+ void Init(wxCalendarDateBorder border = wxCAL_BORDER_NONE)
+ {
+ m_border = border;
+ m_holiday = false;
+ }
+
+private:
+ static wxCalendarDateAttr m_mark;
+
+ wxColour m_colText,
+ m_colBack,
+ m_colBorder;
+ wxFont m_font;
+ wxCalendarDateBorder m_border;
+ bool m_holiday;
+};
+
+// ----------------------------------------------------------------------------
+// wxCalendarCtrl events
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_ADV wxCalendarCtrl;
+
+class WXDLLIMPEXP_ADV wxCalendarEvent : public wxDateEvent
+{
+public:
+ wxCalendarEvent() : m_wday(wxDateTime::Inv_WeekDay) { }
+ wxCalendarEvent(wxWindow *win, const wxDateTime& dt, wxEventType type)
+ : wxDateEvent(win, dt, type),
+ m_wday(wxDateTime::Inv_WeekDay) { }
+ wxCalendarEvent(const wxCalendarEvent& event)
+ : wxDateEvent(event), m_wday(event.m_wday) { }
+
+ void SetWeekDay(const wxDateTime::WeekDay wd) { m_wday = wd; }
+ wxDateTime::WeekDay GetWeekDay() const { return m_wday; }
+
+ virtual wxEvent *Clone() const { return new wxCalendarEvent(*this); }
+
+private:
+ wxDateTime::WeekDay m_wday;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCalendarEvent)
+};
+
+// ----------------------------------------------------------------------------
+// wxCalendarCtrlBase
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxCalendarCtrlBase : public wxControl
+{
+public:
+ // do we allow changing the month/year?
+ bool AllowMonthChange() const { return !HasFlag(wxCAL_NO_MONTH_CHANGE); }
+
+ // get/set the current date
+ virtual wxDateTime GetDate() const = 0;
+ virtual bool SetDate(const wxDateTime& date) = 0;
+
+
+ // restricting the dates shown by the control to the specified range: only
+ // implemented in the generic and MSW versions for now
+
+ // if either date is set, the corresponding limit will be enforced and true
+ // returned; if none are set, the existing restrictions are removed and
+ // false is returned
+ virtual bool
+ SetDateRange(const wxDateTime& WXUNUSED(lowerdate) = wxDefaultDateTime,
+ const wxDateTime& WXUNUSED(upperdate) = wxDefaultDateTime)
+ {
+ return false;
+ }
+
+ // retrieves the limits currently in use (wxDefaultDateTime if none) in the
+ // provided pointers (which may be NULL) and returns true if there are any
+ // limits or false if none
+ virtual bool
+ GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const
+ {
+ if ( lowerdate )
+ *lowerdate = wxDefaultDateTime;
+ if ( upperdate )
+ *upperdate = wxDefaultDateTime;
+ return false;
+ }
+
+ // returns one of wxCAL_HITTEST_XXX constants and fills either date or wd
+ // with the corresponding value (none for NOWHERE, the date for DAY and wd
+ // for HEADER)
+ //
+ // notice that this is not implemented in all versions
+ virtual wxCalendarHitTestResult
+ HitTest(const wxPoint& WXUNUSED(pos),
+ wxDateTime* WXUNUSED(date) = NULL,
+ wxDateTime::WeekDay* WXUNUSED(wd) = NULL)
+ {
+ return wxCAL_HITTEST_NOWHERE;
+ }
+
+ // allow or disable changing the current month (and year), return true if
+ // the value of this option really changed or false if it was already set
+ // to the required value
+ //
+ // NB: we provide implementation for this pure virtual function, derived
+ // classes should call it
+ virtual bool EnableMonthChange(bool enable = true) = 0;
+
+
+ // an item without custom attributes is drawn with the default colours and
+ // font and without border, setting custom attributes allows to modify this
+ //
+ // the day parameter should be in 1..31 range, for days 29, 30, 31 the
+ // corresponding attribute is just unused if there is no such day in the
+ // current month
+ //
+ // notice that currently arbitrary attributes are supported only in the
+ // generic version, the native controls only support Mark() which assigns
+ // some special appearance (which can be customized using SetMark() for the
+ // generic version) to the given day
+
+ virtual void Mark(size_t day, bool mark) = 0;
+
+ virtual wxCalendarDateAttr *GetAttr(size_t WXUNUSED(day)) const
+ { return NULL; }
+ virtual void SetAttr(size_t WXUNUSED(day), wxCalendarDateAttr *attr)
+ { delete attr; }
+ virtual void ResetAttr(size_t WXUNUSED(day)) { }
+
+
+ // holidays support
+ //
+ // currently only the generic version implements all functions in this
+ // section; wxMSW implements simple support for holidays (they can be
+ // just enabled or disabled) and wxGTK doesn't support them at all
+
+ // equivalent to changing wxCAL_SHOW_HOLIDAYS flag but should be called
+ // instead of just changing it
+ virtual void EnableHolidayDisplay(bool display = true);
+
+ // set/get the colours to use for holidays (if they're enabled)
+ virtual void SetHolidayColours(const wxColour& WXUNUSED(colFg),
+ const wxColour& WXUNUSED(colBg)) { }
+
+ virtual const wxColour& GetHolidayColourFg() const { return wxNullColour; }
+ virtual const wxColour& GetHolidayColourBg() const { return wxNullColour; }
+
+ // mark the given day of the current month as being a holiday
+ virtual void SetHoliday(size_t WXUNUSED(day)) { }
+
+
+ // customizing the colours of the controls
+ //
+ // most of the methods in this section are only implemented by the native
+ // version of the control and do nothing in the native ones
+
+ // set/get the colours to use for the display of the week day names at the
+ // top of the controls
+ virtual void SetHeaderColours(const wxColour& WXUNUSED(colFg),
+ const wxColour& WXUNUSED(colBg)) { }
+
+ virtual const wxColour& GetHeaderColourFg() const { return wxNullColour; }
+ virtual const wxColour& GetHeaderColourBg() const { return wxNullColour; }
+
+ // set/get the colours used for the currently selected date
+ virtual void SetHighlightColours(const wxColour& WXUNUSED(colFg),
+ const wxColour& WXUNUSED(colBg)) { }
+
+ virtual const wxColour& GetHighlightColourFg() const { return wxNullColour; }
+ virtual const wxColour& GetHighlightColourBg() const { return wxNullColour; }
+
+
+ // implementation only from now on
+
+ // generate the given calendar event, return true if it was processed
+ //
+ // NB: this is public because it's used from GTK+ callbacks
+ bool GenerateEvent(wxEventType type)
+ {
+ wxCalendarEvent event(this, GetDate(), type);
+ return HandleWindowEvent(event);
+ }
+
+protected:
+ // generate all the events for the selection change from dateOld to current
+ // date: SEL_CHANGED, PAGE_CHANGED if necessary and also one of (deprecated)
+ // YEAR/MONTH/DAY_CHANGED ones
+ //
+ // returns true if page changed event was generated, false if the new date
+ // is still in the same month as before
+ bool GenerateAllChangeEvents(const wxDateTime& dateOld);
+
+ // call SetHoliday() for all holidays in the current month
+ //
+ // should be called on month change, does nothing if wxCAL_SHOW_HOLIDAYS is
+ // not set and returns false in this case, true if we do show them
+ bool SetHolidayAttrs();
+
+ // called by SetHolidayAttrs() to forget the previously set holidays
+ virtual void ResetHolidayAttrs() { }
+
+ // called by EnableHolidayDisplay()
+ virtual void RefreshHolidays() { }
+};
+
+// ----------------------------------------------------------------------------
+// wxCalendarCtrl
+// ----------------------------------------------------------------------------
+
+#define wxCalendarNameStr "CalendarCtrl"
+
+#ifndef __WXUNIVERSAL__
+ #if defined(__WXGTK20__)
+ #define wxHAS_NATIVE_CALENDARCTRL
+ #include "wx/gtk/calctrl.h"
+ #define wxCalendarCtrl wxGtkCalendarCtrl
+ #elif defined(__WXMSW__)
+ #define wxHAS_NATIVE_CALENDARCTRL
+ #include "wx/msw/calctrl.h"
+ #endif
+#endif // !__WXUNIVERSAL__
+
+#ifndef wxHAS_NATIVE_CALENDARCTRL
+ #include "wx/generic/calctrlg.h"
+ #define wxCalendarCtrl wxGenericCalendarCtrl
+#endif
+
+// ----------------------------------------------------------------------------
+// calendar event types and macros for handling them
+// ----------------------------------------------------------------------------
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_CALENDAR_SEL_CHANGED, wxCalendarEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_CALENDAR_PAGE_CHANGED, wxCalendarEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_CALENDAR_DOUBLECLICKED, wxCalendarEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_CALENDAR_WEEKDAY_CLICKED, wxCalendarEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_CALENDAR_WEEK_CLICKED, wxCalendarEvent );
+
+// deprecated events
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_CALENDAR_DAY_CHANGED, wxCalendarEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_CALENDAR_MONTH_CHANGED, wxCalendarEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_CALENDAR_YEAR_CHANGED, wxCalendarEvent );
+
+typedef void (wxEvtHandler::*wxCalendarEventFunction)(wxCalendarEvent&);
+
+#define wxCalendarEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxCalendarEventFunction, func)
+
+#define wx__DECLARE_CALEVT(evt, id, fn) \
+ wx__DECLARE_EVT1(wxEVT_CALENDAR_ ## evt, id, wxCalendarEventHandler(fn))
+
+#define EVT_CALENDAR(id, fn) wx__DECLARE_CALEVT(DOUBLECLICKED, id, fn)
+#define EVT_CALENDAR_SEL_CHANGED(id, fn) wx__DECLARE_CALEVT(SEL_CHANGED, id, fn)
+#define EVT_CALENDAR_PAGE_CHANGED(id, fn) wx__DECLARE_CALEVT(PAGE_CHANGED, id, fn)
+#define EVT_CALENDAR_WEEKDAY_CLICKED(id, fn) wx__DECLARE_CALEVT(WEEKDAY_CLICKED, id, fn)
+#define EVT_CALENDAR_WEEK_CLICKED(id, fn) wx__DECLARE_CALEVT(WEEK_CLICKED, id, fn)
+
+// deprecated events
+#define EVT_CALENDAR_DAY(id, fn) wx__DECLARE_CALEVT(DAY_CHANGED, id, fn)
+#define EVT_CALENDAR_MONTH(id, fn) wx__DECLARE_CALEVT(MONTH_CHANGED, id, fn)
+#define EVT_CALENDAR_YEAR(id, fn) wx__DECLARE_CALEVT(YEAR_CHANGED, id, fn)
+
+#endif // wxUSE_CALENDARCTRL
+
+#endif // _WX_CALCTRL_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/caret.h
+// Purpose: wxCaretBase class - the interface of wxCaret
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 23.05.99
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CARET_H_BASE_
+#define _WX_CARET_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_CARET
+
+// ---------------------------------------------------------------------------
+// forward declarations
+// ---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxWindow;
+class WXDLLIMPEXP_FWD_CORE wxWindowBase;
+
+// ----------------------------------------------------------------------------
+// headers we have to include
+// ----------------------------------------------------------------------------
+
+#include "wx/gdicmn.h" // for wxPoint, wxSize
+
+// ----------------------------------------------------------------------------
+// A caret is a blinking cursor showing the position where the typed text will
+// appear. It can be either a solid block or a custom bitmap (TODO)
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxCaretBase
+{
+public:
+ // ctors
+ // -----
+ // default - use Create
+ wxCaretBase() { Init(); }
+ // create the caret of given (in pixels) width and height and associate
+ // with the given window
+ wxCaretBase(wxWindowBase *window, int width, int height)
+ {
+ Init();
+
+ (void)Create(window, width, height);
+ }
+ // same as above
+ wxCaretBase(wxWindowBase *window, const wxSize& size)
+ {
+ Init();
+
+ (void)Create(window, size);
+ }
+
+ // a virtual dtor has been provided since this class has virtual members
+ virtual ~wxCaretBase() { }
+
+ // Create() functions - same as ctor but returns the success code
+ // --------------------------------------------------------------
+
+ // same as ctor
+ bool Create(wxWindowBase *window, int width, int height)
+ { return DoCreate(window, width, height); }
+ // same as ctor
+ bool Create(wxWindowBase *window, const wxSize& size)
+ { return DoCreate(window, size.x, size.y); }
+
+ // accessors
+ // ---------
+
+ // is the caret valid?
+ bool IsOk() const { return m_width != 0 && m_height != 0; }
+
+ // is the caret currently shown?
+ bool IsVisible() const { return m_countVisible > 0; }
+
+ // get the caret position
+ void GetPosition(int *x, int *y) const
+ {
+ if ( x ) *x = m_x;
+ if ( y ) *y = m_y;
+ }
+ wxPoint GetPosition() const { return wxPoint(m_x, m_y); }
+
+ // get the caret size
+ void GetSize(int *width, int *height) const
+ {
+ if ( width ) *width = m_width;
+ if ( height ) *height = m_height;
+ }
+ wxSize GetSize() const { return wxSize(m_width, m_height); }
+
+ // get the window we're associated with
+ wxWindow *GetWindow() const { return (wxWindow *)m_window; }
+
+ // change the size of the caret
+ void SetSize(int width, int height) {
+ m_width = width;
+ m_height = height;
+ DoSize();
+ }
+ void SetSize(const wxSize& size) { SetSize(size.x, size.y); }
+
+
+ // operations
+ // ----------
+
+ // move the caret to given position (in logical coords)
+ void Move(int x, int y) { m_x = x; m_y = y; DoMove(); }
+ void Move(const wxPoint& pt) { m_x = pt.x; m_y = pt.y; DoMove(); }
+
+ // show/hide the caret (should be called by wxWindow when needed):
+ // Show() must be called as many times as Hide() + 1 to make the caret
+ // visible
+ virtual void Show(bool show = true)
+ {
+ if ( show )
+ {
+ if ( m_countVisible++ == 0 )
+ DoShow();
+ }
+ else
+ {
+ if ( --m_countVisible == 0 )
+ DoHide();
+ }
+ }
+ virtual void Hide() { Show(false); }
+
+ // blink time is measured in milliseconds and is the time elapsed
+ // between 2 inversions of the caret (blink time of the caret is common
+ // to all carets in the Universe, so these functions are static)
+ static int GetBlinkTime();
+ static void SetBlinkTime(int milliseconds);
+
+ // implementation from now on
+ // --------------------------
+
+ // these functions should be called by wxWindow when the window gets/loses
+ // the focus - we create/show and hide/destroy the caret here
+ virtual void OnSetFocus() { }
+ virtual void OnKillFocus() { }
+
+protected:
+ // these functions may be overridden in the derived classes, but they
+ // should call the base class version first
+ virtual bool DoCreate(wxWindowBase *window, int width, int height)
+ {
+ m_window = window;
+ m_width = width;
+ m_height = height;
+
+ return true;
+ }
+
+ // pure virtuals to implement in the derived class
+ virtual void DoShow() = 0;
+ virtual void DoHide() = 0;
+ virtual void DoMove() = 0;
+ virtual void DoSize() { }
+
+ // the common initialization
+ void Init()
+ {
+ m_window = NULL;
+ m_x = m_y = 0;
+ m_width = m_height = 0;
+ m_countVisible = 0;
+ }
+
+ // the size of the caret
+ int m_width, m_height;
+
+ // the position of the caret
+ int m_x, m_y;
+
+ // the window we're associated with
+ wxWindowBase *m_window;
+
+ // visibility count: the caret is visible only if it's positive
+ int m_countVisible;
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxCaretBase);
+};
+
+// ---------------------------------------------------------------------------
+// now include the real thing
+// ---------------------------------------------------------------------------
+
+#if defined(__WXMSW__)
+ #include "wx/msw/caret.h"
+#else
+ #include "wx/generic/caret.h"
+#endif // platform
+
+// ----------------------------------------------------------------------------
+// wxCaretSuspend: a simple class which hides the caret in its ctor and
+// restores it in the dtor, this should be used when drawing on the screen to
+// avoid overdrawing the caret
+// ----------------------------------------------------------------------------
+
+#ifdef wxHAS_CARET_USING_OVERLAYS
+
+// we don't need to hide the caret if it's rendered using overlays
+class WXDLLIMPEXP_CORE wxCaretSuspend
+{
+public:
+ wxCaretSuspend(wxWindow *WXUNUSED(win)) {}
+
+ wxDECLARE_NO_COPY_CLASS(wxCaretSuspend);
+};
+
+#else // !wxHAS_CARET_USING_OVERLAYS
+
+class WXDLLIMPEXP_CORE wxCaretSuspend
+{
+public:
+ wxCaretSuspend(wxWindow *win)
+ {
+ m_caret = win->GetCaret();
+ m_show = false;
+ if ( m_caret && m_caret->IsVisible() )
+ {
+ m_caret->Hide();
+ m_show = true;
+ }
+ }
+
+ ~wxCaretSuspend()
+ {
+ if ( m_caret && m_show )
+ m_caret->Show();
+ }
+
+private:
+ wxCaret *m_caret;
+ bool m_show;
+
+ wxDECLARE_NO_COPY_CLASS(wxCaretSuspend);
+};
+
+#endif // wxHAS_CARET_USING_OVERLAYS/!wxHAS_CARET_USING_OVERLAYS
+
+#endif // wxUSE_CARET
+
+#endif // _WX_CARET_H_BASE_
--- /dev/null
+/*
+ * Name: wx/chartype.h
+ * Purpose: Declarations of wxChar and related types
+ * Author: Joel Farley, Ove KÃ¥ven
+ * Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee
+ * Created: 1998/06/12
+ * Copyright: (c) 1998-2006 wxWidgets dev team
+ * Licence: wxWindows licence
+ */
+
+/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
+
+#ifndef _WX_WXCHARTYPE_H_
+#define _WX_WXCHARTYPE_H_
+
+/* defs.h indirectly includes this file, so don't include it here */
+#include "wx/platform.h"
+
+/* check whether we have wchar_t and which size it is if we do */
+#if !defined(wxUSE_WCHAR_T)
+ #if defined(__UNIX__)
+ #if defined(HAVE_WCSTR_H) || defined(HAVE_WCHAR_H) || defined(__FreeBSD__) || defined(__DARWIN__)
+ #define wxUSE_WCHAR_T 1
+ #else
+ #define wxUSE_WCHAR_T 0
+ #endif
+ #elif defined(__GNUWIN32__) && !defined(__MINGW32__)
+ #define wxUSE_WCHAR_T 0
+ #elif defined(__WATCOMC__)
+ #define wxUSE_WCHAR_T 0
+ #elif defined(__VISAGECPP__) && (__IBMCPP__ < 400)
+ #define wxUSE_WCHAR_T 0
+ #else
+ /* add additional compiler checks if this fails */
+ #define wxUSE_WCHAR_T 1
+ #endif
+#endif /* !defined(wxUSE_WCHAR_T) */
+
+/* Unicode support requires wchar_t */
+#if !wxUSE_WCHAR_T
+ #error "wchar_t must be available"
+#endif /* Unicode */
+
+/*
+ non Unix compilers which do have wchar.h (but not tchar.h which is included
+ below and which includes wchar.h anyhow).
+
+ Actually MinGW has tchar.h, but it does not include wchar.h
+ */
+#if defined(__VISAGECPP__) || defined(__MINGW32__) || defined(__WATCOMC__)
+ #ifndef HAVE_WCHAR_H
+ #define HAVE_WCHAR_H
+ #endif
+#endif
+
+#ifdef HAVE_WCHAR_H
+ /* the current (as of Nov 2002) version of cygwin has a bug in its */
+ /* wchar.h -- there is no extern "C" around the declarations in it */
+ /* and this results in linking errors later; also, at least on some */
+ /* Cygwin versions, wchar.h requires sys/types.h */
+ #ifdef __CYGWIN__
+ #include <sys/types.h>
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+ #endif /* Cygwin */
+
+ #include <wchar.h>
+
+ #if defined(__CYGWIN__) && defined(__cplusplus)
+ }
+ #endif /* Cygwin and C++ */
+
+#elif defined(HAVE_WCSTR_H)
+ /* old compilers have relevant declarations here */
+ #include <wcstr.h>
+#elif defined(__FreeBSD__) || defined(__DARWIN__) || defined(__EMX__)
+ /* include stdlib.h for wchar_t */
+ #include <stdlib.h>
+#endif /* HAVE_WCHAR_H */
+
+#ifdef HAVE_WIDEC_H
+ #include <widec.h>
+#endif
+
+/* -------------------------------------------------------------------------- */
+/* define wxHAVE_TCHAR_SUPPORT for the compilers which support the TCHAR type */
+/* mapped to either char or wchar_t depending on the ASCII/Unicode mode and */
+/* have the function mapping _tfoo() -> foo() or wfoo() */
+/* -------------------------------------------------------------------------- */
+
+/* VC++ and BC++ starting with 5.2 have TCHAR support */
+#ifdef __VISUALC__
+ #define wxHAVE_TCHAR_SUPPORT
+#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x520)
+ #define wxHAVE_TCHAR_SUPPORT
+ #include <ctype.h>
+#elif defined(__WATCOMC__)
+ #define wxHAVE_TCHAR_SUPPORT
+#elif defined(__DMC__)
+ #define wxHAVE_TCHAR_SUPPORT
+#elif defined(__MINGW32__) && wxCHECK_W32API_VERSION( 1, 0 )
+ #define wxHAVE_TCHAR_SUPPORT
+ #include <stddef.h>
+ #include <string.h>
+ #include <ctype.h>
+#elif 0 && defined(__VISAGECPP__) && (__IBMCPP__ >= 400)
+ /* VZ: the old VisualAge definitions were completely wrong and had no */
+ /* chance at all to work in Unicode build anyhow so let's pretend */
+ /* that VisualAge does _not_ support TCHAR for the moment (as */
+ /* indicated by "0 &&" above) until someone really has time to delve */
+ /* into Unicode issues under OS/2 */
+
+ /* VisualAge 4.0+ supports TCHAR */
+ #define wxHAVE_TCHAR_SUPPORT
+#endif /* compilers with (good) TCHAR support */
+
+#ifdef wxHAVE_TCHAR_SUPPORT
+ /* get TCHAR definition if we've got it */
+ #include <tchar.h>
+
+ /* we surely do have wchar_t if we have TCHAR */
+ #ifndef wxUSE_WCHAR_T
+ #define wxUSE_WCHAR_T 1
+ #endif /* !defined(wxUSE_WCHAR_T) */
+#endif /* wxHAVE_TCHAR_SUPPORT */
+
+/* ------------------------------------------------------------------------- */
+/* define wxChar type */
+/* ------------------------------------------------------------------------- */
+
+/* TODO: define wxCharInt to be equal to either int or wint_t? */
+
+#if !wxUSE_UNICODE
+ typedef char wxChar;
+ typedef signed char wxSChar;
+ typedef unsigned char wxUChar;
+#else
+ /* VZ: note that VC++ defines _T[SU]CHAR simply as wchar_t and not as */
+ /* signed/unsigned version of it which (a) makes sense to me (unlike */
+ /* char wchar_t is always unsigned) and (b) was how the previous */
+ /* definitions worked so keep it like this */
+
+ /* Sun's SunPro compiler supports the wchar_t type and wide character */
+ /* functions, but does not define __WCHAR_TYPE__. Define it here to */
+ /* allow unicode enabled builds. */
+ #if (defined(__SUNPRO_CC) || defined(__SUNPRO_C)) && !defined(__WCHAR_TYPE__)
+ #define __WCHAR_TYPE__ wxchar_t
+ #endif
+
+ /* GNU libc has __WCHAR_TYPE__ which requires special treatment, see */
+ /* comment below */
+ #if !defined(__WCHAR_TYPE__) || \
+ (!defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 96))
+ /* standard case */
+ typedef wchar_t wxChar;
+ typedef wchar_t wxSChar;
+ typedef wchar_t wxUChar;
+ #else /* __WCHAR_TYPE__ and gcc < 2.96 */
+ /* VS: wxWidgets used to define wxChar as __WCHAR_TYPE__ here. */
+ /* However, this doesn't work with new GCC 3.x compilers because */
+ /* wchar_t is C++'s builtin type in the new standard. OTOH, old */
+ /* compilers (GCC 2.x) won't accept new definition of */
+ /* wx{S,U}CharType, so we have to define wxChar */
+ /* conditionally depending on detected compiler & compiler */
+ /* version. */
+
+ /* with old definition of wxChar. */
+ #define wchar_t __WCHAR_TYPE__
+ typedef __WCHAR_TYPE__ wxChar;
+ typedef __WCHAR_TYPE__ wxSChar;
+ typedef __WCHAR_TYPE__ wxUChar;
+ #endif /* __WCHAR_TYPE__ */
+#endif /* ASCII/Unicode */
+
+/* ------------------------------------------------------------------------- */
+/* define wxStringCharType */
+/* ------------------------------------------------------------------------- */
+
+/* depending on the platform, Unicode build can either store wxStrings as
+ wchar_t* or UTF-8 encoded char*: */
+#if wxUSE_UNICODE
+ /* FIXME-UTF8: what would be better place for this? */
+ #if defined(wxUSE_UTF8_LOCALE_ONLY) && !defined(wxUSE_UNICODE_UTF8)
+ #error "wxUSE_UTF8_LOCALE_ONLY only makes sense with wxUSE_UNICODE_UTF8"
+ #endif
+ #ifndef wxUSE_UTF8_LOCALE_ONLY
+ #define wxUSE_UTF8_LOCALE_ONLY 0
+ #endif
+
+ #ifndef wxUSE_UNICODE_UTF8
+ #define wxUSE_UNICODE_UTF8 0
+ #endif
+
+ #if wxUSE_UNICODE_UTF8
+ #define wxUSE_UNICODE_WCHAR 0
+ #else
+ #define wxUSE_UNICODE_WCHAR 1
+ #endif
+#else
+ #define wxUSE_UNICODE_WCHAR 0
+ #define wxUSE_UNICODE_UTF8 0
+ #define wxUSE_UTF8_LOCALE_ONLY 0
+#endif
+
+/* define char type used by wxString internal representation: */
+#if wxUSE_UNICODE_WCHAR
+ typedef wchar_t wxStringCharType;
+#else /* wxUSE_UNICODE_UTF8 || ANSI */
+ typedef char wxStringCharType;
+#endif
+
+
+/* ------------------------------------------------------------------------- */
+/* define wxT() and related macros */
+/* ------------------------------------------------------------------------- */
+
+/* BSD systems define _T() to be something different in ctype.h, override it */
+#if defined(__FreeBSD__) || defined(__DARWIN__)
+ #include <ctype.h>
+ #undef _T
+#endif
+
+/*
+ wxT ("wx text") macro turns a literal string constant into a wide char
+ constant. It is mostly unnecessary with wx 2.9 but defined for
+ compatibility.
+ */
+#ifndef wxT
+ #if !wxUSE_UNICODE
+ #define wxT(x) x
+ #else /* Unicode */
+ /*
+ Notice that we use an intermediate macro to allow x to be expanded
+ if it's a macro itself.
+ */
+ #ifndef wxCOMPILER_BROKEN_CONCAT_OPER
+ #define wxT(x) wxCONCAT_HELPER(L, x)
+ #else
+ #define wxT(x) wxPREPEND_L(x)
+ #endif
+ #endif /* ASCII/Unicode */
+#endif /* !defined(wxT) */
+
+/*
+ wxT_2 exists only for compatibility with wx 2.x and is the same as wxT() in
+ that version but nothing in the newer ones.
+ */
+#define wxT_2(x) x
+
+/*
+ wxS ("wx string") macro can be used to create literals using the same
+ representation as wxString does internally, i.e. wchar_t in Unicode build
+ under Windows or char in UTF-8-based Unicode builds and (deprecated) ANSI
+ builds everywhere (see wxStringCharType definition above).
+ */
+#if wxUSE_UNICODE_WCHAR
+ /*
+ As above with wxT(), wxS() argument is expanded if it's a macro.
+ */
+ #ifndef wxCOMPILER_BROKEN_CONCAT_OPER
+ #define wxS(x) wxCONCAT_HELPER(L, x)
+ #else
+ #define wxS(x) wxPREPEND_L(x)
+ #endif
+#else /* wxUSE_UNICODE_UTF8 || ANSI */
+ #define wxS(x) x
+#endif
+
+/*
+ _T() is a synonym for wxT() familiar to Windows programmers. As this macro
+ has even higher risk of conflicting with system headers, its use is
+ discouraged and you may predefine wxNO__T to disable it. Additionally, we
+ do it ourselves for Sun CC which is known to use it in its standard headers
+ (see #10660).
+ */
+#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+ #ifndef wxNO__T
+ #define wxNO__T
+ #endif
+#endif
+
+#if !defined(_T) && !defined(wxNO__T)
+ #define _T(x) wxT(x)
+#endif
+
+/* a helper macro allowing to make another macro Unicode-friendly, see below */
+#define wxAPPLY_T(x) wxT(x)
+
+/* Unicode-friendly __FILE__, __DATE__ and __TIME__ analogs */
+#ifndef __TFILE__
+ #define __TFILE__ wxAPPLY_T(__FILE__)
+#endif
+
+#ifndef __TDATE__
+ #define __TDATE__ wxAPPLY_T(__DATE__)
+#endif
+
+#ifndef __TTIME__
+ #define __TTIME__ wxAPPLY_T(__TIME__)
+#endif
+
+#endif /* _WX_WXCHARTYPE_H_ */
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/checkbox.h
+// Purpose: wxCheckBox class interface
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 07.09.00
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CHECKBOX_H_BASE_
+#define _WX_CHECKBOX_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_CHECKBOX
+
+#include "wx/control.h"
+
+
+/*
+ * wxCheckBox style flags
+ * (Using wxCHK_* because wxCB_* is used by wxComboBox).
+ * Determine whether to use a 3-state or 2-state
+ * checkbox. 3-state enables to differentiate
+ * between 'unchecked', 'checked' and 'undetermined'.
+ *
+ * In addition to the styles here it is also possible to specify just 0 which
+ * is treated the same as wxCHK_2STATE for compatibility (but using explicit
+ * flag is preferred).
+ */
+#define wxCHK_2STATE 0x4000
+#define wxCHK_3STATE 0x1000
+
+/*
+ * If this style is set the user can set the checkbox to the
+ * undetermined state. If not set the undetermined set can only
+ * be set programmatically.
+ * This style can only be used with 3 state checkboxes.
+ */
+#define wxCHK_ALLOW_3RD_STATE_FOR_USER 0x2000
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr[];
+
+// ----------------------------------------------------------------------------
+// wxCheckBox: a control which shows a label and a box which may be checked
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxCheckBoxBase : public wxControl
+{
+public:
+ wxCheckBoxBase() { }
+
+ // set/get the checked status of the listbox
+ virtual void SetValue(bool value) = 0;
+ virtual bool GetValue() const = 0;
+
+ bool IsChecked() const
+ {
+ wxASSERT_MSG( !Is3State(), wxT("Calling IsChecked() doesn't make sense for")
+ wxT(" a three state checkbox, Use Get3StateValue() instead") );
+
+ return GetValue();
+ }
+
+ wxCheckBoxState Get3StateValue() const
+ {
+ wxCheckBoxState state = DoGet3StateValue();
+
+ if ( state == wxCHK_UNDETERMINED && !Is3State() )
+ {
+ // Undetermined state with a 2-state checkbox??
+ wxFAIL_MSG( wxT("DoGet3StateValue() says the 2-state checkbox is ")
+ wxT("in an undetermined/third state") );
+
+ state = wxCHK_UNCHECKED;
+ }
+
+ return state;
+ }
+
+ void Set3StateValue(wxCheckBoxState state)
+ {
+ if ( state == wxCHK_UNDETERMINED && !Is3State() )
+ {
+ wxFAIL_MSG(wxT("Setting a 2-state checkbox to undetermined state"));
+ state = wxCHK_UNCHECKED;
+ }
+
+ DoSet3StateValue(state);
+ }
+
+ bool Is3State() const { return HasFlag(wxCHK_3STATE); }
+
+ bool Is3rdStateAllowedForUser() const
+ {
+ return HasFlag(wxCHK_ALLOW_3RD_STATE_FOR_USER);
+ }
+
+ virtual bool HasTransparentBackground() { return true; }
+
+ // wxCheckBox-specific processing after processing the update event
+ virtual void DoUpdateWindowUI(wxUpdateUIEvent& event)
+ {
+ wxControl::DoUpdateWindowUI(event);
+
+ if ( event.GetSetChecked() )
+ SetValue(event.GetChecked());
+ }
+
+protected:
+ // choose the default border for this window
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state)) { wxFAIL; }
+
+ virtual wxCheckBoxState DoGet3StateValue() const
+ {
+ wxFAIL;
+ return wxCHK_UNCHECKED;
+ }
+
+ // Helper function to be called from derived classes Create()
+ // implementations: it checks that the style doesn't contain any
+ // incompatible bits and modifies it to be sane if it does.
+ static void WXValidateStyle(long *stylePtr)
+ {
+ long& style = *stylePtr;
+
+ if ( !(style & (wxCHK_2STATE | wxCHK_3STATE)) )
+ {
+ // For compatibility we use absence of style flags as wxCHK_2STATE
+ // because wxCHK_2STATE used to have the value of 0 and some
+ // existing code uses 0 instead of it. Moreover, some code even
+ // uses some non-0 style, e.g. wxBORDER_XXX, but doesn't specify
+ // neither wxCHK_2STATE nor wxCHK_3STATE -- to avoid breaking it,
+ // assume (much more common) 2 state checkbox by default.
+ style |= wxCHK_2STATE;
+ }
+
+ if ( style & wxCHK_3STATE )
+ {
+ if ( style & wxCHK_2STATE )
+ {
+ wxFAIL_MSG( "wxCHK_2STATE and wxCHK_3STATE can't be used "
+ "together" );
+ style &= ~wxCHK_3STATE;
+ }
+ }
+ else // No wxCHK_3STATE
+ {
+ if ( style & wxCHK_ALLOW_3RD_STATE_FOR_USER )
+ {
+ wxFAIL_MSG( "wxCHK_ALLOW_3RD_STATE_FOR_USER doesn't make sense "
+ "without wxCHK_3STATE" );
+ style &= ~wxCHK_ALLOW_3RD_STATE_FOR_USER;
+ }
+ }
+ }
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxCheckBoxBase);
+};
+
+// Most ports support 3 state checkboxes so define this by default.
+#define wxHAS_3STATE_CHECKBOX
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/checkbox.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/checkbox.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/checkbox.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/checkbox.h"
+#elif defined(__WXGTK__)
+ #undef wxHAS_3STATE_CHECKBOX
+ #include "wx/gtk1/checkbox.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/checkbox.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/checkbox.h"
+#elif defined(__WXPM__)
+ #undef wxHAS_3STATE_CHECKBOX
+ #include "wx/os2/checkbox.h"
+#endif
+
+#endif // wxUSE_CHECKBOX
+
+#endif // _WX_CHECKBOX_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/checkeddelete.h
+// Purpose: wxCHECKED_DELETE() macro
+// Author: Vadim Zeitlin
+// Created: 2009-02-03
+// Copyright: (c) 2002-2009 wxWidgets dev team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CHECKEDDELETE_H_
+#define _WX_CHECKEDDELETE_H_
+
+#include "wx/cpp.h"
+
+// TODO: provide wxCheckedDelete[Array]() template functions too
+
+// ----------------------------------------------------------------------------
+// wxCHECKED_DELETE and wxCHECKED_DELETE_ARRAY macros
+// ----------------------------------------------------------------------------
+
+/*
+ checked deleters are used to make sure that the type being deleted is really
+ a complete type.: otherwise sizeof() would result in a compile-time error
+
+ do { ... } while ( 0 ) construct is used to have an anonymous scope
+ (otherwise we could have name clashes between different "complete"s) but
+ still force a semicolon after the macro
+*/
+
+#define wxCHECKED_DELETE(ptr) \
+ wxSTATEMENT_MACRO_BEGIN \
+ typedef char complete[sizeof(*ptr)] WX_ATTRIBUTE_UNUSED; \
+ delete ptr; \
+ wxSTATEMENT_MACRO_END
+
+#define wxCHECKED_DELETE_ARRAY(ptr) \
+ wxSTATEMENT_MACRO_BEGIN \
+ typedef char complete[sizeof(*ptr)] WX_ATTRIBUTE_UNUSED; \
+ delete [] ptr; \
+ wxSTATEMENT_MACRO_END
+
+
+#endif // _WX_CHECKEDDELETE_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/checklst.h
+// Purpose: wxCheckListBox class interface
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 12.09.00
+// Copyright: (c) Vadim Zeitlin
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CHECKLST_H_BASE_
+#define _WX_CHECKLST_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_CHECKLISTBOX
+
+#include "wx/listbox.h"
+
+// ----------------------------------------------------------------------------
+// wxCheckListBox: a listbox whose items may be checked
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxCheckListBoxBase : public
+ #ifdef __WXWINCE__
+ // keep virtuals synchronised
+ wxListBoxBase
+ #else
+ wxListBox
+ #endif
+{
+public:
+ wxCheckListBoxBase() { }
+
+ // check list box specific methods
+ virtual bool IsChecked(unsigned int item) const = 0;
+ virtual void Check(unsigned int item, bool check = true) = 0;
+
+ virtual unsigned int GetCheckedItems(wxArrayInt& checkedItems) const;
+
+ wxDECLARE_NO_COPY_CLASS(wxCheckListBoxBase);
+};
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/checklst.h"
+#elif defined(__WXWINCE__)
+ #include "wx/msw/wince/checklst.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/checklst.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/checklst.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/checklst.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/checklst.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/checklst.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/checklst.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/checklst.h"
+#endif
+
+#endif // wxUSE_CHECKLISTBOX
+
+#endif
+ // _WX_CHECKLST_H_BASE_
--- /dev/null
+/*
+ * Name: wx/chkconf.h
+ * Purpose: check the config settings for consistency
+ * Author: Vadim Zeitlin
+ * Modified by:
+ * Created: 09.08.00
+ * Copyright: (c) 2000 Vadim Zeitlin <vadim@wxwidgets.org>
+ * Licence: wxWindows licence
+ */
+
+/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
+#ifndef _WX_CHKCONF_H_
+#define _WX_CHKCONF_H_
+
+/*
+ **************************************************
+ PLEASE READ THIS IF YOU GET AN ERROR IN THIS FILE!
+ **************************************************
+
+ If you get an error saying "wxUSE_FOO must be defined", it means that you
+ are not using the correct up-to-date version of setup.h. This happens most
+ often when using svn or daily snapshots and a new symbol was added to
+ setup0.h and you haven't updated your local setup.h to reflect it. If
+ this is the case, you need to propagate the changes from setup0.h to your
+ setup.h and, if using makefiles under MSW, also remove setup.h under the
+ build directory (lib/$(COMPILER)_{lib,dll}/msw[u][d][dll]/wx) so that
+ the new setup.h is copied there.
+
+ If you get an error of the form "wxFoo requires wxBar", then the settings
+ in your setup.h are inconsistent. You have the choice between correcting
+ them manually or commenting out #define wxABORT_ON_CONFIG_ERROR below to
+ try to correct the problems automatically (not really recommended but
+ might work).
+ */
+
+/*
+ This file has the following sections:
+ 1. checks that all wxUSE_XXX symbols we use are defined
+ a) first the non-GUI ones
+ b) then the GUI-only ones
+ 2. platform-specific checks done in the platform headers
+ 3. generic consistency checks
+ a) first the non-GUI ones
+ b) then the GUI-only ones
+ */
+
+/*
+ this global setting determines what should we do if the setting FOO
+ requires BAR and BAR is not set: we can either silently unset FOO as well
+ (do this if you're trying to build the smallest possible library) or give an
+ error and abort (default as leads to least surprising behaviour)
+ */
+#define wxABORT_ON_CONFIG_ERROR
+
+/*
+ global features
+ */
+
+/*
+ If we're compiling without support for threads/exceptions we have to
+ disable the corresponding features.
+ */
+#ifdef wxNO_THREADS
+# undef wxUSE_THREADS
+# define wxUSE_THREADS 0
+#endif /* wxNO_THREADS */
+
+#ifdef wxNO_EXCEPTIONS
+# undef wxUSE_EXCEPTIONS
+# define wxUSE_EXCEPTIONS 0
+#endif /* wxNO_EXCEPTIONS */
+
+/* we also must disable exceptions if compiler doesn't support them */
+#if defined(_MSC_VER) && !defined(_CPPUNWIND)
+# undef wxUSE_EXCEPTIONS
+# define wxUSE_EXCEPTIONS 0
+#endif /* VC++ without exceptions support */
+
+
+/*
+ Section 1a: tests for non GUI features.
+
+ please keep the options in alphabetical order!
+ */
+
+#ifndef wxUSE_ANY
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_ANY must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_ANY 0
+# endif
+#endif /* wxUSE_ANY */
+
+#ifndef wxUSE_COMPILER_TLS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_COMPILER_TLS must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_COMPILER_TLS 0
+# endif
+#endif /* !defined(wxUSE_COMPILER_TLS) */
+
+#ifndef wxUSE_CONSOLE_EVENTLOOP
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_CONSOLE_EVENTLOOP must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_CONSOLE_EVENTLOOP 0
+# endif
+#endif /* !defined(wxUSE_CONSOLE_EVENTLOOP) */
+
+#ifndef wxUSE_DYNLIB_CLASS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_DYNLIB_CLASS must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_DYNLIB_CLASS 0
+# endif
+#endif /* !defined(wxUSE_DYNLIB_CLASS) */
+
+#ifndef wxUSE_EXCEPTIONS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_EXCEPTIONS must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_EXCEPTIONS 0
+# endif
+#endif /* !defined(wxUSE_EXCEPTIONS) */
+
+#ifndef wxUSE_FILE_HISTORY
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_FILE_HISTORY must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_FILE_HISTORY 0
+# endif
+#endif /* !defined(wxUSE_FILE_HISTORY) */
+
+#ifndef wxUSE_FILESYSTEM
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_FILESYSTEM must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_FILESYSTEM 0
+# endif
+#endif /* !defined(wxUSE_FILESYSTEM) */
+
+#ifndef wxUSE_FS_ARCHIVE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_FS_ARCHIVE must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_FS_ARCHIVE 0
+# endif
+#endif /* !defined(wxUSE_FS_ARCHIVE) */
+
+#ifndef wxUSE_FSVOLUME
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_FSVOLUME must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_FSVOLUME 0
+# endif
+#endif /* !defined(wxUSE_FSVOLUME) */
+
+#ifndef wxUSE_FSWATCHER
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_FSWATCHER must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_FSWATCHER 0
+# endif
+#endif /* !defined(wxUSE_FSWATCHER) */
+
+#ifndef wxUSE_DYNAMIC_LOADER
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_DYNAMIC_LOADER must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_DYNAMIC_LOADER 0
+# endif
+#endif /* !defined(wxUSE_DYNAMIC_LOADER) */
+
+#ifndef wxUSE_INTL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_INTL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_INTL 0
+# endif
+#endif /* !defined(wxUSE_INTL) */
+
+#ifndef wxUSE_IPV6
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_IPV6 must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_IPV6 0
+# endif
+#endif /* !defined(wxUSE_IPV6) */
+
+#ifndef wxUSE_LOG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_LOG must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_LOG 0
+# endif
+#endif /* !defined(wxUSE_LOG) */
+
+#ifndef wxUSE_LONGLONG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_LONGLONG must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_LONGLONG 0
+# endif
+#endif /* !defined(wxUSE_LONGLONG) */
+
+#ifndef wxUSE_MIMETYPE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_MIMETYPE must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_MIMETYPE 0
+# endif
+#endif /* !defined(wxUSE_MIMETYPE) */
+
+#ifndef wxUSE_ON_FATAL_EXCEPTION
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_ON_FATAL_EXCEPTION must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_ON_FATAL_EXCEPTION 0
+# endif
+#endif /* !defined(wxUSE_ON_FATAL_EXCEPTION) */
+
+#ifndef wxUSE_PRINTF_POS_PARAMS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_PRINTF_POS_PARAMS must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_PRINTF_POS_PARAMS 0
+# endif
+#endif /* !defined(wxUSE_PRINTF_POS_PARAMS) */
+
+#ifndef wxUSE_PROTOCOL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_PROTOCOL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_PROTOCOL 0
+# endif
+#endif /* !defined(wxUSE_PROTOCOL) */
+
+/* we may not define wxUSE_PROTOCOL_XXX if wxUSE_PROTOCOL is set to 0 */
+#if !wxUSE_PROTOCOL
+# undef wxUSE_PROTOCOL_HTTP
+# undef wxUSE_PROTOCOL_FTP
+# undef wxUSE_PROTOCOL_FILE
+# define wxUSE_PROTOCOL_HTTP 0
+# define wxUSE_PROTOCOL_FTP 0
+# define wxUSE_PROTOCOL_FILE 0
+#endif /* wxUSE_PROTOCOL */
+
+#ifndef wxUSE_PROTOCOL_HTTP
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_PROTOCOL_HTTP must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_PROTOCOL_HTTP 0
+# endif
+#endif /* !defined(wxUSE_PROTOCOL_HTTP) */
+
+#ifndef wxUSE_PROTOCOL_FTP
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_PROTOCOL_FTP must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_PROTOCOL_FTP 0
+# endif
+#endif /* !defined(wxUSE_PROTOCOL_FTP) */
+
+#ifndef wxUSE_PROTOCOL_FILE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_PROTOCOL_FILE must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_PROTOCOL_FILE 0
+# endif
+#endif /* !defined(wxUSE_PROTOCOL_FILE) */
+
+#ifndef wxUSE_REGEX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_REGEX must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_REGEX 0
+# endif
+#endif /* !defined(wxUSE_REGEX) */
+
+#ifndef wxUSE_STDPATHS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_STDPATHS must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_STDPATHS 1
+# endif
+#endif /* !defined(wxUSE_STDPATHS) */
+
+#ifndef wxUSE_XML
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_XML must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_XML 0
+# endif
+#endif /* !defined(wxUSE_XML) */
+
+#ifndef wxUSE_SOCKETS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_SOCKETS must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_SOCKETS 0
+# endif
+#endif /* !defined(wxUSE_SOCKETS) */
+
+#ifndef wxUSE_STD_CONTAINERS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_STD_CONTAINERS must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_STD_CONTAINERS 0
+# endif
+#endif /* !defined(wxUSE_STD_CONTAINERS) */
+
+#ifndef wxUSE_STD_STRING_CONV_IN_WXSTRING
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_STD_STRING_CONV_IN_WXSTRING must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_STD_STRING_CONV_IN_WXSTRING 0
+# endif
+#endif /* !defined(wxUSE_STD_STRING_CONV_IN_WXSTRING) */
+
+#ifndef wxUSE_STREAMS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_STREAMS must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_STREAMS 0
+# endif
+#endif /* !defined(wxUSE_STREAMS) */
+
+#ifndef wxUSE_STOPWATCH
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_STOPWATCH must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_STOPWATCH 0
+# endif
+#endif /* !defined(wxUSE_STOPWATCH) */
+
+#ifndef wxUSE_TEXTBUFFER
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TEXTBUFFER must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_TEXTBUFFER 0
+# endif
+#endif /* !defined(wxUSE_TEXTBUFFER) */
+
+#ifndef wxUSE_TEXTFILE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TEXTFILE must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_TEXTFILE 0
+# endif
+#endif /* !defined(wxUSE_TEXTFILE) */
+
+#ifndef wxUSE_UNICODE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_UNICODE must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_UNICODE 0
+# endif
+#endif /* !defined(wxUSE_UNICODE) */
+
+#ifndef wxUSE_URL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_URL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_URL 0
+# endif
+#endif /* !defined(wxUSE_URL) */
+
+#ifndef wxUSE_VARIANT
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_VARIANT must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_VARIANT 0
+# endif
+#endif /* wxUSE_VARIANT */
+
+#ifndef wxUSE_XLOCALE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_XLOCALE must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_XLOCALE 0
+# endif
+#endif /* !defined(wxUSE_XLOCALE) */
+
+/*
+ Section 1b: all these tests are for GUI only.
+
+ please keep the options in alphabetical order!
+ */
+#if wxUSE_GUI
+
+/*
+ all of the settings tested below must be defined or we'd get an error from
+ preprocessor about invalid integer expression
+ */
+
+#ifndef wxUSE_ABOUTDLG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_ABOUTDLG must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_ABOUTDLG 0
+# endif
+#endif /* !defined(wxUSE_ABOUTDLG) */
+
+#ifndef wxUSE_ACCEL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_ACCEL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_ACCEL 0
+# endif
+#endif /* !defined(wxUSE_ACCEL) */
+
+#ifndef wxUSE_ACCESSIBILITY
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_ACCESSIBILITY must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_ACCESSIBILITY 0
+# endif
+#endif /* !defined(wxUSE_ACCESSIBILITY) */
+
+#ifndef wxUSE_ANIMATIONCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_ANIMATIONCTRL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_ANIMATIONCTRL 0
+# endif
+#endif /* !defined(wxUSE_ANIMATIONCTRL) */
+
+#ifndef wxUSE_ARTPROVIDER_STD
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_ARTPROVIDER_STD must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_ARTPROVIDER_STD 0
+# endif
+#endif /* !defined(wxUSE_ARTPROVIDER_STD) */
+
+#ifndef wxUSE_ARTPROVIDER_TANGO
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_ARTPROVIDER_TANGO must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_ARTPROVIDER_TANGO 0
+# endif
+#endif /* !defined(wxUSE_ARTPROVIDER_TANGO) */
+
+#ifndef wxUSE_AUTOID_MANAGEMENT
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_AUTOID_MANAGEMENT must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_AUTOID_MANAGEMENT 0
+# endif
+#endif /* !defined(wxUSE_AUTOID_MANAGEMENT) */
+
+#ifndef wxUSE_BITMAPCOMBOBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_BITMAPCOMBOBOX must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_BITMAPCOMBOBOX 0
+# endif
+#endif /* !defined(wxUSE_BITMAPCOMBOBOX) */
+
+#ifndef wxUSE_BMPBUTTON
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_BMPBUTTON must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_BMPBUTTON 0
+# endif
+#endif /* !defined(wxUSE_BMPBUTTON) */
+
+#ifndef wxUSE_BUTTON
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_BUTTON must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_BUTTON 0
+# endif
+#endif /* !defined(wxUSE_BUTTON) */
+
+#ifndef wxUSE_CAIRO
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_CAIRO must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_CAIRO 0
+# endif
+#endif /* !defined(wxUSE_CAIRO) */
+
+#ifndef wxUSE_CALENDARCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_CALENDARCTRL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_CALENDARCTRL 0
+# endif
+#endif /* !defined(wxUSE_CALENDARCTRL) */
+
+#ifndef wxUSE_CARET
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_CARET must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_CARET 0
+# endif
+#endif /* !defined(wxUSE_CARET) */
+
+#ifndef wxUSE_CHECKBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_CHECKBOX must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_CHECKBOX 0
+# endif
+#endif /* !defined(wxUSE_CHECKBOX) */
+
+#ifndef wxUSE_CHECKLISTBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_CHECKLISTBOX must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_CHECKLISTBOX 0
+# endif
+#endif /* !defined(wxUSE_CHECKLISTBOX) */
+
+#ifndef wxUSE_CHOICE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_CHOICE must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_CHOICE 0
+# endif
+#endif /* !defined(wxUSE_CHOICE) */
+
+#ifndef wxUSE_CHOICEBOOK
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_CHOICEBOOK must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_CHOICEBOOK 0
+# endif
+#endif /* !defined(wxUSE_CHOICEBOOK) */
+
+#ifndef wxUSE_CHOICEDLG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_CHOICEDLG must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_CHOICEDLG 0
+# endif
+#endif /* !defined(wxUSE_CHOICEDLG) */
+
+#ifndef wxUSE_CLIPBOARD
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_CLIPBOARD must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_CLIPBOARD 0
+# endif
+#endif /* !defined(wxUSE_CLIPBOARD) */
+
+#ifndef wxUSE_COLLPANE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_COLLPANE must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_COLLPANE 0
+# endif
+#endif /* !defined(wxUSE_COLLPANE) */
+
+#ifndef wxUSE_COLOURDLG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_COLOURDLG must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_COLOURDLG 0
+# endif
+#endif /* !defined(wxUSE_COLOURDLG) */
+
+#ifndef wxUSE_COLOURPICKERCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_COLOURPICKERCTRL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_COLOURPICKERCTRL 0
+# endif
+#endif /* !defined(wxUSE_COLOURPICKERCTRL) */
+
+#ifndef wxUSE_COMBOBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_COMBOBOX must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_COMBOBOX 0
+# endif
+#endif /* !defined(wxUSE_COMBOBOX) */
+
+#ifndef wxUSE_COMMANDLINKBUTTON
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_COMMANDLINKBUTTON must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_COMMANDLINKBUTTON 0
+# endif
+#endif /* !defined(wxUSE_COMMANDLINKBUTTON) */
+
+#ifndef wxUSE_COMBOCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_COMBOCTRL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_COMBOCTRL 0
+# endif
+#endif /* !defined(wxUSE_COMBOCTRL) */
+
+#ifndef wxUSE_DATAOBJ
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_DATAOBJ must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_DATAOBJ 0
+# endif
+#endif /* !defined(wxUSE_DATAOBJ) */
+
+#ifndef wxUSE_DATAVIEWCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_DATAVIEWCTRL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_DATAVIEWCTRL 0
+# endif
+#endif /* !defined(wxUSE_DATAVIEWCTRL) */
+
+#ifndef wxUSE_DATEPICKCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_DATEPICKCTRL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_DATEPICKCTRL 0
+# endif
+#endif /* !defined(wxUSE_DATEPICKCTRL) */
+
+#ifndef wxUSE_DC_TRANSFORM_MATRIX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_DC_TRANSFORM_MATRIX must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_DC_TRANSFORM_MATRIX 1
+# endif
+#endif /* wxUSE_DC_TRANSFORM_MATRIX */
+
+#ifndef wxUSE_DIRPICKERCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_DIRPICKERCTRL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_DIRPICKERCTRL 0
+# endif
+#endif /* !defined(wxUSE_DIRPICKERCTRL) */
+
+#ifndef wxUSE_DISPLAY
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_DISPLAY must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_DISPLAY 0
+# endif
+#endif /* !defined(wxUSE_DISPLAY) */
+
+#ifndef wxUSE_DOC_VIEW_ARCHITECTURE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_DOC_VIEW_ARCHITECTURE must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_DOC_VIEW_ARCHITECTURE 0
+# endif
+#endif /* !defined(wxUSE_DOC_VIEW_ARCHITECTURE) */
+
+#ifndef wxUSE_FILECTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_FILECTRL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_FILECTRL 0
+# endif
+#endif /* !defined(wxUSE_FILECTRL) */
+
+#ifndef wxUSE_FILEDLG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_FILEDLG must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_FILEDLG 0
+# endif
+#endif /* !defined(wxUSE_FILEDLG) */
+
+#ifndef wxUSE_FILEPICKERCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_FILEPICKERCTRL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_FILEPICKERCTRL 0
+# endif
+#endif /* !defined(wxUSE_FILEPICKERCTRL) */
+
+#ifndef wxUSE_FONTDLG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_FONTDLG must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_FONTDLG 0
+# endif
+#endif /* !defined(wxUSE_FONTDLG) */
+
+#ifndef wxUSE_FONTMAP
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_FONTMAP must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_FONTMAP 0
+# endif
+#endif /* !defined(wxUSE_FONTMAP) */
+
+#ifndef wxUSE_FONTPICKERCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_FONTPICKERCTRL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_FONTPICKERCTRL 0
+# endif
+#endif /* !defined(wxUSE_FONTPICKERCTRL) */
+
+#ifndef wxUSE_GAUGE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_GAUGE must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_GAUGE 0
+# endif
+#endif /* !defined(wxUSE_GAUGE) */
+
+#ifndef wxUSE_GRAPHICS_CONTEXT
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_GRAPHICS_CONTEXT must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_GRAPHICS_CONTEXT 0
+# endif
+#endif /* !defined(wxUSE_GRAPHICS_CONTEXT) */
+
+
+#ifndef wxUSE_GRID
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_GRID must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_GRID 0
+# endif
+#endif /* !defined(wxUSE_GRID) */
+
+#ifndef wxUSE_HEADERCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_HEADERCTRL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_HEADERCTRL 0
+# endif
+#endif /* !defined(wxUSE_HEADERCTRL) */
+
+#ifndef wxUSE_HELP
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_HELP must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_HELP 0
+# endif
+#endif /* !defined(wxUSE_HELP) */
+
+#ifndef wxUSE_HYPERLINKCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_HYPERLINKCTRL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_HYPERLINKCTRL 0
+# endif
+#endif /* !defined(wxUSE_HYPERLINKCTRL) */
+
+#ifndef wxUSE_HTML
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_HTML must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_HTML 0
+# endif
+#endif /* !defined(wxUSE_HTML) */
+
+#ifndef wxUSE_LIBMSPACK
+# if !defined(__UNIX__)
+ /* set to 0 on platforms that don't have libmspack */
+# define wxUSE_LIBMSPACK 0
+# else
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_LIBMSPACK must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_LIBMSPACK 0
+# endif
+# endif
+#endif /* !defined(wxUSE_LIBMSPACK) */
+
+#ifndef wxUSE_ICO_CUR
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_ICO_CUR must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_ICO_CUR 0
+# endif
+#endif /* !defined(wxUSE_ICO_CUR) */
+
+#ifndef wxUSE_IFF
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_IFF must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_IFF 0
+# endif
+#endif /* !defined(wxUSE_IFF) */
+
+#ifndef wxUSE_IMAGLIST
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_IMAGLIST must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_IMAGLIST 0
+# endif
+#endif /* !defined(wxUSE_IMAGLIST) */
+
+#ifndef wxUSE_INFOBAR
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_INFOBAR must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_INFOBAR 0
+# endif
+#endif /* !defined(wxUSE_INFOBAR) */
+
+#ifndef wxUSE_JOYSTICK
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_JOYSTICK must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_JOYSTICK 0
+# endif
+#endif /* !defined(wxUSE_JOYSTICK) */
+
+#ifndef wxUSE_LISTBOOK
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_LISTBOOK must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_LISTBOOK 0
+# endif
+#endif /* !defined(wxUSE_LISTBOOK) */
+
+#ifndef wxUSE_LISTBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_LISTBOX must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_LISTBOX 0
+# endif
+#endif /* !defined(wxUSE_LISTBOX) */
+
+#ifndef wxUSE_LISTCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_LISTCTRL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_LISTCTRL 0
+# endif
+#endif /* !defined(wxUSE_LISTCTRL) */
+
+#ifndef wxUSE_LOGGUI
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_LOGGUI must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_LOGGUI 0
+# endif
+#endif /* !defined(wxUSE_LOGGUI) */
+
+#ifndef wxUSE_LOGWINDOW
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_LOGWINDOW must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_LOGWINDOW 0
+# endif
+#endif /* !defined(wxUSE_LOGWINDOW) */
+
+#ifndef wxUSE_LOG_DIALOG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_LOG_DIALOG must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_LOG_DIALOG 0
+# endif
+#endif /* !defined(wxUSE_LOG_DIALOG) */
+
+#ifndef wxUSE_MARKUP
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_MARKUP must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_MARKUP 0
+# endif
+#endif /* !defined(wxUSE_MARKUP) */
+
+#ifndef wxUSE_MDI
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_MDI must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_MDI 0
+# endif
+#endif /* !defined(wxUSE_MDI) */
+
+#ifndef wxUSE_MDI_ARCHITECTURE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_MDI_ARCHITECTURE must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_MDI_ARCHITECTURE 0
+# endif
+#endif /* !defined(wxUSE_MDI_ARCHITECTURE) */
+
+#ifndef wxUSE_MENUS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_MENUS must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_MENUS 0
+# endif
+#endif /* !defined(wxUSE_MENUS) */
+
+#ifndef wxUSE_MSGDLG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_MSGDLG must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_MSGDLG 0
+# endif
+#endif /* !defined(wxUSE_MSGDLG) */
+
+#ifndef wxUSE_NOTEBOOK
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_NOTEBOOK must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_NOTEBOOK 0
+# endif
+#endif /* !defined(wxUSE_NOTEBOOK) */
+
+#ifndef wxUSE_NOTIFICATION_MESSAGE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_NOTIFICATION_MESSAGE must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_NOTIFICATION_MESSAGE 0
+# endif
+#endif /* !defined(wxUSE_NOTIFICATION_MESSAGE) */
+
+#ifndef wxUSE_ODCOMBOBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_ODCOMBOBOX must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_ODCOMBOBOX 0
+# endif
+#endif /* !defined(wxUSE_ODCOMBOBOX) */
+
+#ifndef wxUSE_PALETTE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_PALETTE must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_PALETTE 0
+# endif
+#endif /* !defined(wxUSE_PALETTE) */
+
+#ifndef wxUSE_POPUPWIN
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_POPUPWIN must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_POPUPWIN 0
+# endif
+#endif /* !defined(wxUSE_POPUPWIN) */
+
+#ifndef wxUSE_PREFERENCES_EDITOR
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_PREFERENCES_EDITOR must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_PREFERENCES_EDITOR 0
+# endif
+#endif /* !defined(wxUSE_PREFERENCES_EDITOR) */
+
+#ifndef wxUSE_PRINTING_ARCHITECTURE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_PRINTING_ARCHITECTURE must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_PRINTING_ARCHITECTURE 0
+# endif
+#endif /* !defined(wxUSE_PRINTING_ARCHITECTURE) */
+
+#ifndef wxUSE_RADIOBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_RADIOBOX must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_RADIOBOX 0
+# endif
+#endif /* !defined(wxUSE_RADIOBOX) */
+
+#ifndef wxUSE_RADIOBTN
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_RADIOBTN must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_RADIOBTN 0
+# endif
+#endif /* !defined(wxUSE_RADIOBTN) */
+
+#ifndef wxUSE_REARRANGECTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_REARRANGECTRL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_REARRANGECTRL 0
+# endif
+#endif /* !defined(wxUSE_REARRANGECTRL) */
+
+#ifndef wxUSE_RIBBON
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_RIBBON must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_RIBBON 0
+# endif
+#endif /* !defined(wxUSE_RIBBON) */
+
+#ifndef wxUSE_RICHMSGDLG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_RICHMSGDLG must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_RICHMSGDLG 0
+# endif
+#endif /* !defined(wxUSE_RICHMSGDLG) */
+
+#ifndef wxUSE_RICHTOOLTIP
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_RICHTOOLTIP must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_RICHTOOLTIP 0
+# endif
+#endif /* !defined(wxUSE_RICHTOOLTIP) */
+
+#ifndef wxUSE_SASH
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_SASH must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_SASH 0
+# endif
+#endif /* !defined(wxUSE_SASH) */
+
+#ifndef wxUSE_SCROLLBAR
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_SCROLLBAR must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_SCROLLBAR 0
+# endif
+#endif /* !defined(wxUSE_SCROLLBAR) */
+
+#ifndef wxUSE_SLIDER
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_SLIDER must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_SLIDER 0
+# endif
+#endif /* !defined(wxUSE_SLIDER) */
+
+#ifndef wxUSE_SOUND
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_SOUND must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_SOUND 0
+# endif
+#endif /* !defined(wxUSE_SOUND) */
+
+#ifndef wxUSE_SPINBTN
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_SPINBTN must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_SPINBTN 0
+# endif
+#endif /* !defined(wxUSE_SPINBTN) */
+
+#ifndef wxUSE_SPINCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_SPINCTRL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_SPINCTRL 0
+# endif
+#endif /* !defined(wxUSE_SPINCTRL) */
+
+#ifndef wxUSE_SPLASH
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_SPLASH must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_SPLASH 0
+# endif
+#endif /* !defined(wxUSE_SPLASH) */
+
+#ifndef wxUSE_SPLITTER
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_SPLITTER must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_SPLITTER 0
+# endif
+#endif /* !defined(wxUSE_SPLITTER) */
+
+#ifndef wxUSE_STATBMP
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_STATBMP must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_STATBMP 0
+# endif
+#endif /* !defined(wxUSE_STATBMP) */
+
+#ifndef wxUSE_STATBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_STATBOX must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_STATBOX 0
+# endif
+#endif /* !defined(wxUSE_STATBOX) */
+
+#ifndef wxUSE_STATLINE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_STATLINE must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_STATLINE 0
+# endif
+#endif /* !defined(wxUSE_STATLINE) */
+
+#ifndef wxUSE_STATTEXT
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_STATTEXT must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_STATTEXT 0
+# endif
+#endif /* !defined(wxUSE_STATTEXT) */
+
+#ifndef wxUSE_STATUSBAR
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_STATUSBAR must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_STATUSBAR 0
+# endif
+#endif /* !defined(wxUSE_STATUSBAR) */
+
+#ifndef wxUSE_TASKBARICON
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TASKBARICON must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_TASKBARICON 0
+# endif
+#endif /* !defined(wxUSE_TASKBARICON) */
+
+#ifndef wxUSE_TEXTCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TEXTCTRL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_TEXTCTRL 0
+# endif
+#endif /* !defined(wxUSE_TEXTCTRL) */
+
+#ifndef wxUSE_TIMEPICKCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TIMEPICKCTRL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_TIMEPICKCTRL 0
+# endif
+#endif /* !defined(wxUSE_TIMEPICKCTRL) */
+
+#ifndef wxUSE_TIPWINDOW
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TIPWINDOW must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_TIPWINDOW 0
+# endif
+#endif /* !defined(wxUSE_TIPWINDOW) */
+
+#ifndef wxUSE_TOOLBAR
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TOOLBAR must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_TOOLBAR 0
+# endif
+#endif /* !defined(wxUSE_TOOLBAR) */
+
+#ifndef wxUSE_TOOLTIPS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TOOLTIPS must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_TOOLTIPS 0
+# endif
+#endif /* !defined(wxUSE_TOOLTIPS) */
+
+#ifndef wxUSE_TREECTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TREECTRL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_TREECTRL 0
+# endif
+#endif /* !defined(wxUSE_TREECTRL) */
+
+#ifndef wxUSE_TREELISTCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TREELISTCTRL must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_TREELISTCTRL 0
+# endif
+#endif /* !defined(wxUSE_TREELISTCTRL) */
+
+#ifndef wxUSE_UIACTIONSIMULATOR
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_UIACTIONSIMULATOR must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_UIACTIONSIMULATOR 0
+# endif
+#endif /* !defined(wxUSE_UIACTIONSIMULATOR) */
+
+#ifndef wxUSE_VALIDATORS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_VALIDATORS must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_VALIDATORS 0
+# endif
+#endif /* !defined(wxUSE_VALIDATORS) */
+
+#ifndef wxUSE_WEBVIEW
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_WEBVIEW must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_WEBVIEW 0
+# endif
+#endif /* !defined(wxUSE_WEBVIEW) */
+
+#ifndef wxUSE_WXHTML_HELP
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_WXHTML_HELP must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_WXHTML_HELP 0
+# endif
+#endif /* !defined(wxUSE_WXHTML_HELP) */
+
+#ifndef wxUSE_XRC
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_XRC must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_XRC 0
+# endif
+#endif /* !defined(wxUSE_XRC) */
+
+#endif /* wxUSE_GUI */
+
+/*
+ Section 2: platform-specific checks.
+
+ This must be done after checking that everything is defined as the platform
+ checks use wxUSE_XXX symbols in #if tests.
+ */
+
+#if defined(__WXWINCE__)
+# include "wx/msw/wince/chkconf.h"
+#elif defined(__WINDOWS__)
+# include "wx/msw/chkconf.h"
+# if defined(__WXGTK__)
+# include "wx/gtk/chkconf.h"
+# endif
+#elif defined(__WXGTK__)
+# include "wx/gtk/chkconf.h"
+#elif defined(__WXCOCOA__)
+# include "wx/cocoa/chkconf.h"
+#elif defined(__WXMAC__)
+# include "wx/osx/chkconf.h"
+#elif defined(__OS2__)
+# include "wx/os2/chkconf.h"
+#elif defined(__WXDFB__)
+# include "wx/dfb/chkconf.h"
+#elif defined(__WXMOTIF__)
+# include "wx/motif/chkconf.h"
+#elif defined(__WXX11__)
+# include "wx/x11/chkconf.h"
+#elif defined(__WXANDROID__)
+# include "wx/android/chkconf.h"
+#endif
+
+/*
+ __UNIX__ is also defined under Cygwin but we shouldn't perform these checks
+ there if we're building Windows ports.
+ */
+#if defined(__UNIX__) && !defined(__WINDOWS__)
+# include "wx/unix/chkconf.h"
+#endif
+
+#ifdef __WXUNIVERSAL__
+# include "wx/univ/chkconf.h"
+#endif
+
+/*
+ Section 3a: check consistency of the non-GUI settings.
+ */
+
+#if WXWIN_COMPATIBILITY_2_6
+# if !WXWIN_COMPATIBILITY_2_8
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "2.6.X compatibility requires 2.8.X compatibility"
+# else
+# undef WXWIN_COMPATIBILITY_2_8
+# define WXWIN_COMPATIBILITY_2_8 1
+# endif
+# endif
+#endif /* WXWIN_COMPATIBILITY_2_6 */
+
+#if wxUSE_ARCHIVE_STREAMS
+# if !wxUSE_DATETIME
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxArchive requires wxUSE_DATETIME"
+# else
+# undef wxUSE_ARCHIVE_STREAMS
+# define wxUSE_ARCHIVE_STREAMS 0
+# endif
+# endif
+#endif /* wxUSE_ARCHIVE_STREAMS */
+
+#if wxUSE_PROTOCOL_FILE || wxUSE_PROTOCOL_FTP || wxUSE_PROTOCOL_HTTP
+# if !wxUSE_PROTOCOL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_PROTOCOL_XXX requires wxUSE_PROTOCOL"
+# else
+# undef wxUSE_PROTOCOL
+# define wxUSE_PROTOCOL 1
+# endif
+# endif
+#endif /* wxUSE_PROTOCOL_XXX */
+
+#if wxUSE_URL
+# if !wxUSE_PROTOCOL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_URL requires wxUSE_PROTOCOL"
+# else
+# undef wxUSE_PROTOCOL
+# define wxUSE_PROTOCOL 1
+# endif
+# endif
+#endif /* wxUSE_URL */
+
+#if wxUSE_PROTOCOL
+# if !wxUSE_SOCKETS
+# if wxUSE_PROTOCOL_HTTP || wxUSE_PROTOCOL_FTP
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_PROTOCOL_FTP/HTTP requires wxUSE_SOCKETS"
+# else
+# undef wxUSE_SOCKETS
+# define wxUSE_SOCKETS 1
+# endif
+# endif
+# endif
+
+# if !wxUSE_STREAMS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_PROTOCOL requires wxUSE_STREAMS"
+# else
+# undef wxUSE_STREAMS
+# define wxUSE_STREAMS 1
+# endif
+# endif
+#endif /* wxUSE_PROTOCOL */
+
+/* have to test for wxUSE_HTML before wxUSE_FILESYSTEM */
+#if wxUSE_HTML
+# if !wxUSE_FILESYSTEM
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxHTML requires wxFileSystem"
+# else
+# undef wxUSE_FILESYSTEM
+# define wxUSE_FILESYSTEM 1
+# endif
+# endif
+#endif /* wxUSE_HTML */
+
+#if wxUSE_FS_ARCHIVE
+# if !wxUSE_FILESYSTEM
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxArchiveFSHandler requires wxFileSystem"
+# else
+# undef wxUSE_FILESYSTEM
+# define wxUSE_FILESYSTEM 1
+# endif
+# endif
+# if !wxUSE_ARCHIVE_STREAMS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxArchiveFSHandler requires wxArchive"
+# else
+# undef wxUSE_ARCHIVE_STREAMS
+# define wxUSE_ARCHIVE_STREAMS 1
+# endif
+# endif
+#endif /* wxUSE_FS_ARCHIVE */
+
+#if wxUSE_FILESYSTEM
+# if !wxUSE_STREAMS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_FILESYSTEM requires wxUSE_STREAMS"
+# else
+# undef wxUSE_STREAMS
+# define wxUSE_STREAMS 1
+# endif
+# endif
+# if !wxUSE_FILE && !wxUSE_FFILE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_FILESYSTEM requires either wxUSE_FILE or wxUSE_FFILE"
+# else
+# undef wxUSE_FILE
+# define wxUSE_FILE 1
+# undef wxUSE_FFILE
+# define wxUSE_FFILE 1
+# endif
+# endif
+#endif /* wxUSE_FILESYSTEM */
+
+#if wxUSE_FS_INET
+# if !wxUSE_PROTOCOL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_FS_INET requires wxUSE_PROTOCOL"
+# else
+# undef wxUSE_PROTOCOL
+# define wxUSE_PROTOCOL 1
+# endif
+# endif
+#endif /* wxUSE_FS_INET */
+
+#if wxUSE_STOPWATCH || wxUSE_DATETIME
+# if !wxUSE_LONGLONG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_STOPWATCH and wxUSE_DATETIME require wxUSE_LONGLONG"
+# else
+# undef wxUSE_LONGLONG
+# define wxUSE_LONGLONG 1
+# endif
+# endif
+#endif /* wxUSE_STOPWATCH */
+
+#if wxUSE_MIMETYPE && !wxUSE_TEXTFILE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_MIMETYPE requires wxUSE_TEXTFILE"
+# else
+# undef wxUSE_TEXTFILE
+# define wxUSE_TEXTFILE 1
+# endif
+#endif /* wxUSE_MIMETYPE */
+
+#if wxUSE_TEXTFILE && !wxUSE_TEXTBUFFER
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TEXTFILE requires wxUSE_TEXTBUFFER"
+# else
+# undef wxUSE_TEXTBUFFER
+# define wxUSE_TEXTBUFFER 1
+# endif
+#endif /* wxUSE_TEXTFILE */
+
+#if wxUSE_TEXTFILE && !wxUSE_FILE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TEXTFILE requires wxUSE_FILE"
+# else
+# undef wxUSE_FILE
+# define wxUSE_FILE 1
+# endif
+#endif /* wxUSE_TEXTFILE */
+
+#if !wxUSE_DYNLIB_CLASS
+# if wxUSE_DYNAMIC_LOADER
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_DYNAMIC_LOADER requires wxUSE_DYNLIB_CLASS."
+# else
+# define wxUSE_DYNLIB_CLASS 1
+# endif
+# endif
+#endif /* wxUSE_DYNLIB_CLASS */
+
+#if wxUSE_ZIPSTREAM
+# if !wxUSE_ZLIB
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxZip requires wxZlib"
+# else
+# undef wxUSE_ZLIB
+# define wxUSE_ZLIB 1
+# endif
+# endif
+# if !wxUSE_ARCHIVE_STREAMS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxZip requires wxArchive"
+# else
+# undef wxUSE_ARCHIVE_STREAMS
+# define wxUSE_ARCHIVE_STREAMS 1
+# endif
+# endif
+#endif /* wxUSE_ZIPSTREAM */
+
+#if wxUSE_TARSTREAM
+# if !wxUSE_ARCHIVE_STREAMS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxTar requires wxArchive"
+# else
+# undef wxUSE_ARCHIVE_STREAMS
+# define wxUSE_ARCHIVE_STREAMS 1
+# endif
+# endif
+#endif /* wxUSE_TARSTREAM */
+
+/*
+ Section 3b: the tests for the GUI settings only.
+ */
+#if wxUSE_GUI
+
+#if wxUSE_ACCESSIBILITY && !defined(__WXMSW__)
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_ACCESSIBILITY is currently only supported under wxMSW"
+# else
+# undef wxUSE_ACCESSIBILITY
+# define wxUSE_ACCESSIBILITY 0
+# endif
+#endif /* wxUSE_ACCESSIBILITY */
+
+#if wxUSE_BUTTON || \
+ wxUSE_CALENDARCTRL || \
+ wxUSE_CARET || \
+ wxUSE_COMBOBOX || \
+ wxUSE_BMPBUTTON || \
+ wxUSE_CHECKBOX || \
+ wxUSE_CHECKLISTBOX || \
+ wxUSE_CHOICE || \
+ wxUSE_GAUGE || \
+ wxUSE_GRID || \
+ wxUSE_HEADERCTRL || \
+ wxUSE_LISTBOX || \
+ wxUSE_LISTCTRL || \
+ wxUSE_NOTEBOOK || \
+ wxUSE_RADIOBOX || \
+ wxUSE_RADIOBTN || \
+ wxUSE_REARRANGECTRL || \
+ wxUSE_SCROLLBAR || \
+ wxUSE_SLIDER || \
+ wxUSE_SPINBTN || \
+ wxUSE_SPINCTRL || \
+ wxUSE_STATBMP || \
+ wxUSE_STATBOX || \
+ wxUSE_STATLINE || \
+ wxUSE_STATTEXT || \
+ wxUSE_STATUSBAR || \
+ wxUSE_TEXTCTRL || \
+ wxUSE_TOOLBAR || \
+ wxUSE_TREECTRL || \
+ wxUSE_TREELISTCTRL
+# if !wxUSE_CONTROLS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_CONTROLS unset but some controls used"
+# else
+# undef wxUSE_CONTROLS
+# define wxUSE_CONTROLS 1
+# endif
+# endif
+#endif /* controls */
+
+#if wxUSE_BMPBUTTON
+# if !wxUSE_BUTTON
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_BMPBUTTON requires wxUSE_BUTTON"
+# else
+# undef wxUSE_BUTTON
+# define wxUSE_BUTTON 1
+# endif
+# endif
+#endif /* wxUSE_BMPBUTTON */
+
+#if wxUSE_COMMANDLINKBUTTON
+# if !wxUSE_BUTTON
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_COMMANDLINKBUTTON requires wxUSE_BUTTON"
+# else
+# undef wxUSE_BUTTON
+# define wxUSE_BUTTON 1
+# endif
+# endif
+#endif /* wxUSE_COMMANDLINKBUTTON */
+
+/*
+ wxUSE_BOOKCTRL should be only used if any of the controls deriving from it
+ are used
+ */
+#ifdef wxUSE_BOOKCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_BOOKCTRL is defined automatically, don't define it"
+# else
+# undef wxUSE_BOOKCTRL
+# endif
+#endif
+
+#define wxUSE_BOOKCTRL (wxUSE_NOTEBOOK || \
+ wxUSE_LISTBOOK || \
+ wxUSE_CHOICEBOOK || \
+ wxUSE_TOOLBOOK || \
+ wxUSE_TREEBOOK)
+
+#if wxUSE_COLLPANE
+# if !wxUSE_BUTTON || !wxUSE_STATLINE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_COLLPANE requires wxUSE_BUTTON and wxUSE_STATLINE"
+# else
+# undef wxUSE_COLLPANE
+# define wxUSE_COLLPANE 0
+# endif
+# endif
+#endif /* wxUSE_COLLPANE */
+
+#if wxUSE_LISTBOOK
+# if !wxUSE_LISTCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxListbook requires wxListCtrl"
+# else
+# undef wxUSE_LISTCTRL
+# define wxUSE_LISTCTRL 1
+# endif
+# endif
+#endif /* wxUSE_LISTBOOK */
+
+#if wxUSE_CHOICEBOOK
+# if !wxUSE_CHOICE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxChoicebook requires wxChoice"
+# else
+# undef wxUSE_CHOICE
+# define wxUSE_CHOICE 1
+# endif
+# endif
+#endif /* wxUSE_CHOICEBOOK */
+
+#if wxUSE_TOOLBOOK
+# if !wxUSE_TOOLBAR
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxToolbook requires wxToolBar"
+# else
+# undef wxUSE_TOOLBAR
+# define wxUSE_TOOLBAR 1
+# endif
+# endif
+#endif /* wxUSE_TOOLBOOK */
+
+#if !wxUSE_ODCOMBOBOX
+# if wxUSE_BITMAPCOMBOBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxBitmapComboBox requires wxOwnerDrawnComboBox"
+# else
+# undef wxUSE_BITMAPCOMBOBOX
+# define wxUSE_BITMAPCOMBOBOX 0
+# endif
+# endif
+#endif /* !wxUSE_ODCOMBOBOX */
+
+#if !wxUSE_HEADERCTRL
+# if wxUSE_DATAVIEWCTRL || wxUSE_GRID
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxDataViewCtrl and wxGrid require wxHeaderCtrl"
+# else
+# undef wxUSE_HEADERCTRL
+# define wxUSE_HEADERCTRL 1
+# endif
+# endif
+#endif /* !wxUSE_HEADERCTRL */
+
+#if wxUSE_REARRANGECTRL
+# if !wxUSE_CHECKLISTBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxRearrangeCtrl requires wxCheckListBox"
+# else
+# undef wxUSE_REARRANGECTRL
+# define wxUSE_REARRANGECTRL 0
+# endif
+# endif
+#endif /* wxUSE_REARRANGECTRL */
+
+#if wxUSE_RICHMSGDLG
+# if !wxUSE_MSGDLG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_RICHMSGDLG requires wxUSE_MSGDLG"
+# else
+# undef wxUSE_MSGDLG
+# define wxUSE_MSGDLG 1
+# endif
+# endif
+#endif /* wxUSE_RICHMSGDLG */
+
+/* don't attempt to use native status bar on the platforms not having it */
+#ifndef wxUSE_NATIVE_STATUSBAR
+# define wxUSE_NATIVE_STATUSBAR 0
+#elif wxUSE_NATIVE_STATUSBAR
+# if defined(__WXUNIVERSAL__) || !(defined(__WXMSW__) || defined(__WXMAC__))
+# undef wxUSE_NATIVE_STATUSBAR
+# define wxUSE_NATIVE_STATUSBAR 0
+# endif
+#endif
+
+#if wxUSE_GRAPHICS_CONTEXT && !wxUSE_GEOMETRY
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_GRAPHICS_CONTEXT requires wxUSE_GEOMETRY"
+# else
+# undef wxUSE_GRAPHICS_CONTEXT
+# define wxUSE_GRAPHICS_CONTEXT 0
+# endif
+#endif /* wxUSE_GRAPHICS_CONTEXT */
+
+
+/* generic controls dependencies */
+#if !defined(__WXMSW__) || defined(__WXUNIVERSAL__)
+# if wxUSE_FONTDLG || wxUSE_FILEDLG || wxUSE_CHOICEDLG
+ /* all common controls are needed by these dialogs */
+# if !defined(wxUSE_CHOICE) || \
+ !defined(wxUSE_TEXTCTRL) || \
+ !defined(wxUSE_BUTTON) || \
+ !defined(wxUSE_CHECKBOX) || \
+ !defined(wxUSE_STATTEXT)
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "These common controls are needed by common dialogs"
+# else
+# undef wxUSE_CHOICE
+# define wxUSE_CHOICE 1
+# undef wxUSE_TEXTCTRL
+# define wxUSE_TEXTCTRL 1
+# undef wxUSE_BUTTON
+# define wxUSE_BUTTON 1
+# undef wxUSE_CHECKBOX
+# define wxUSE_CHECKBOX 1
+# undef wxUSE_STATTEXT
+# define wxUSE_STATTEXT 1
+# endif
+# endif
+# endif
+#endif /* !wxMSW || wxUniv */
+
+/* generic file dialog depends on (generic) file control */
+#if wxUSE_FILEDLG && !wxUSE_FILECTRL && \
+ (defined(__WXUNIVERSAL__) || defined(__WXGTK__))
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "Generic wxFileDialog requires wxFileCtrl"
+# else
+# undef wxUSE_FILECTRL
+# define wxUSE_FILECTRL 1
+# endif
+#endif /* wxUSE_FILEDLG */
+
+/* common dependencies */
+#if wxUSE_ARTPROVIDER_TANGO
+# if !(wxUSE_STREAMS && wxUSE_IMAGE && wxUSE_LIBPNG)
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "Tango art provider requires wxImage with streams and PNG support"
+# else
+# undef wxUSE_ARTPROVIDER_TANGO
+# define wxUSE_ARTPROVIDER_TANGO 0
+# endif
+# endif
+#endif /* wxUSE_ARTPROVIDER_TANGO */
+
+#if wxUSE_CALENDARCTRL
+# if !(wxUSE_SPINBTN && wxUSE_COMBOBOX)
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxCalendarCtrl requires wxSpinButton and wxComboBox"
+# else
+# undef wxUSE_SPINBTN
+# undef wxUSE_COMBOBOX
+# define wxUSE_SPINBTN 1
+# define wxUSE_COMBOBOX 1
+# endif
+# endif
+
+# if !wxUSE_DATETIME
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxCalendarCtrl requires wxUSE_DATETIME"
+# else
+# undef wxUSE_DATETIME
+# define wxUSE_DATETIME 1
+# endif
+# endif
+#endif /* wxUSE_CALENDARCTRL */
+
+#if wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL
+# if !wxUSE_DATETIME
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxDatePickerCtrl and wxTimePickerCtrl requires wxUSE_DATETIME"
+# else
+# undef wxUSE_DATETIME
+# define wxUSE_DATETIME 1
+# endif
+# endif
+#endif /* wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL */
+
+#if wxUSE_CHECKLISTBOX
+# if !wxUSE_LISTBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxCheckListBox requires wxListBox"
+# else
+# undef wxUSE_LISTBOX
+# define wxUSE_LISTBOX 1
+# endif
+# endif
+#endif /* wxUSE_CHECKLISTBOX */
+
+#if wxUSE_CHOICEDLG
+# if !wxUSE_LISTBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "Choice dialogs requires wxListBox"
+# else
+# undef wxUSE_LISTBOX
+# define wxUSE_LISTBOX 1
+# endif
+# endif
+#endif /* wxUSE_CHOICEDLG */
+
+#if wxUSE_FILECTRL
+# if !wxUSE_DATETIME
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxFileCtrl requires wxDateTime"
+# else
+# undef wxUSE_DATETIME
+# define wxUSE_DATETIME 1
+# endif
+# endif
+#endif /* wxUSE_FILECTRL */
+
+#if wxUSE_HELP
+# if !wxUSE_BMPBUTTON
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_HELP requires wxUSE_BMPBUTTON"
+# else
+# undef wxUSE_BMPBUTTON
+# define wxUSE_BMPBUTTON 1
+# endif
+# endif
+
+# if !wxUSE_CHOICEDLG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_HELP requires wxUSE_CHOICEDLG"
+# else
+# undef wxUSE_CHOICEDLG
+# define wxUSE_CHOICEDLG 1
+# endif
+# endif
+#endif /* wxUSE_HELP */
+
+#if wxUSE_MS_HTML_HELP
+ /*
+ this doesn't make sense for platforms other than MSW but we still
+ define it in wx/setup_inc.h so don't complain if it happens to be
+ defined under another platform but just silently fix it.
+ */
+# ifndef __WXMSW__
+# undef wxUSE_MS_HTML_HELP
+# define wxUSE_MS_HTML_HELP 0
+# endif
+#endif /* wxUSE_MS_HTML_HELP */
+
+#if wxUSE_WXHTML_HELP
+# if !wxUSE_HELP || !wxUSE_HTML || !wxUSE_COMBOBOX || !wxUSE_NOTEBOOK || !wxUSE_SPINCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "Built in help controller can't be compiled"
+# else
+# undef wxUSE_HELP
+# define wxUSE_HELP 1
+# undef wxUSE_HTML
+# define wxUSE_HTML 1
+# undef wxUSE_COMBOBOX
+# define wxUSE_COMBOBOX 1
+# undef wxUSE_NOTEBOOK
+# define wxUSE_NOTEBOOK 1
+# undef wxUSE_SPINCTRL
+# define wxUSE_SPINCTRL 1
+# endif
+# endif
+#endif /* wxUSE_WXHTML_HELP */
+
+#if !wxUSE_IMAGE
+/*
+ The default wxUSE_IMAGE setting is 1, so if it's set to 0 we assume the
+ user explicitly wants this and disable all other features that require
+ wxUSE_IMAGE.
+ */
+# if wxUSE_DRAGIMAGE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_DRAGIMAGE requires wxUSE_IMAGE"
+# else
+# undef wxUSE_DRAGIMAGE
+# define wxUSE_DRAGIMAGE 0
+# endif
+# endif
+
+# if wxUSE_LIBPNG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_LIBPNG requires wxUSE_IMAGE"
+# else
+# undef wxUSE_LIBPNG
+# define wxUSE_LIBPNG 0
+# endif
+# endif
+
+# if wxUSE_LIBJPEG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_LIBJPEG requires wxUSE_IMAGE"
+# else
+# undef wxUSE_LIBJPEG
+# define wxUSE_LIBJPEG 0
+# endif
+# endif
+
+# if wxUSE_LIBTIFF
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_LIBTIFF requires wxUSE_IMAGE"
+# else
+# undef wxUSE_LIBTIFF
+# define wxUSE_LIBTIFF 0
+# endif
+# endif
+
+# if wxUSE_GIF
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_GIF requires wxUSE_IMAGE"
+# else
+# undef wxUSE_GIF
+# define wxUSE_GIF 0
+# endif
+# endif
+
+# if wxUSE_PNM
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_PNM requires wxUSE_IMAGE"
+# else
+# undef wxUSE_PNM
+# define wxUSE_PNM 0
+# endif
+# endif
+
+# if wxUSE_PCX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_PCX requires wxUSE_IMAGE"
+# else
+# undef wxUSE_PCX
+# define wxUSE_PCX 0
+# endif
+# endif
+
+# if wxUSE_IFF
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_IFF requires wxUSE_IMAGE"
+# else
+# undef wxUSE_IFF
+# define wxUSE_IFF 0
+# endif
+# endif
+
+# if wxUSE_TOOLBAR
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TOOLBAR requires wxUSE_IMAGE"
+# else
+# undef wxUSE_TOOLBAR
+# define wxUSE_TOOLBAR 0
+# endif
+# endif
+
+# if wxUSE_XPM
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_XPM requires wxUSE_IMAGE"
+# else
+# undef wxUSE_XPM
+# define wxUSE_XPM 0
+# endif
+# endif
+
+#endif /* !wxUSE_IMAGE */
+
+#if wxUSE_DOC_VIEW_ARCHITECTURE
+# if !wxUSE_MENUS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "DocView requires wxUSE_MENUS"
+# else
+# undef wxUSE_MENUS
+# define wxUSE_MENUS 1
+# endif
+# endif
+
+# if !wxUSE_CHOICEDLG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "DocView requires wxUSE_CHOICEDLG"
+# else
+# undef wxUSE_CHOICEDLG
+# define wxUSE_CHOICEDLG 1
+# endif
+# endif
+
+# if !wxUSE_STREAMS && !wxUSE_STD_IOSTREAM
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "DocView requires wxUSE_STREAMS or wxUSE_STD_IOSTREAM"
+# else
+# undef wxUSE_STREAMS
+# define wxUSE_STREAMS 1
+# endif
+# endif
+
+# if !wxUSE_FILE_HISTORY
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "DocView requires wxUSE_FILE_HISTORY"
+# else
+# undef wxUSE_FILE_HISTORY
+# define wxUSE_FILE_HISTORY 1
+# endif
+# endif
+#endif /* wxUSE_DOC_VIEW_ARCHITECTURE */
+
+#if wxUSE_PRINTING_ARCHITECTURE
+# if !wxUSE_COMBOBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "Print dialog requires wxUSE_COMBOBOX"
+# else
+# undef wxUSE_COMBOBOX
+# define wxUSE_COMBOBOX 1
+# endif
+# endif
+#endif /* wxUSE_PRINTING_ARCHITECTURE */
+
+#if wxUSE_MDI_ARCHITECTURE
+# if !wxUSE_MDI
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "MDI requires wxUSE_MDI"
+# else
+# undef wxUSE_MDI
+# define wxUSE_MDI 1
+# endif
+# endif
+
+# if !wxUSE_DOC_VIEW_ARCHITECTURE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_MDI_ARCHITECTURE requires wxUSE_DOC_VIEW_ARCHITECTURE"
+# else
+# undef wxUSE_DOC_VIEW_ARCHITECTURE
+# define wxUSE_DOC_VIEW_ARCHITECTURE 1
+# endif
+# endif
+#endif /* wxUSE_MDI_ARCHITECTURE */
+
+#if !wxUSE_FILEDLG
+# if wxUSE_DOC_VIEW_ARCHITECTURE || wxUSE_WXHTML_HELP
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_FILEDLG is required by wxUSE_DOC_VIEW_ARCHITECTURE and wxUSE_WXHTML_HELP!"
+# else
+# undef wxUSE_FILEDLG
+# define wxUSE_FILEDLG 1
+# endif
+# endif
+#endif /* wxUSE_FILEDLG */
+
+#if !wxUSE_GAUGE || !wxUSE_BUTTON
+# if wxUSE_PROGRESSDLG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "Generic progress dialog requires wxUSE_GAUGE and wxUSE_BUTTON"
+# else
+# undef wxUSE_GAUGE
+# undef wxUSE_BUTTON
+# define wxUSE_GAUGE 1
+# define wxUSE_BUTTON 1
+# endif
+# endif
+#endif /* !wxUSE_GAUGE */
+
+#if !wxUSE_BUTTON
+# if wxUSE_FONTDLG || \
+ wxUSE_FILEDLG || \
+ wxUSE_CHOICEDLG || \
+ wxUSE_NUMBERDLG || \
+ wxUSE_TEXTDLG || \
+ wxUSE_DIRDLG || \
+ wxUSE_STARTUP_TIPS || \
+ wxUSE_WIZARDDLG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "Common and generic dialogs require wxUSE_BUTTON"
+# else
+# undef wxUSE_BUTTON
+# define wxUSE_BUTTON 1
+# endif
+# endif
+#endif /* !wxUSE_BUTTON */
+
+#if !wxUSE_TOOLBAR
+# if wxUSE_TOOLBAR_NATIVE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TOOLBAR is set to 0 but wxUSE_TOOLBAR_NATIVE is set to 1"
+# else
+# undef wxUSE_TOOLBAR_NATIVE
+# define wxUSE_TOOLBAR_NATIVE 0
+# endif
+# endif
+#endif
+
+#if !wxUSE_IMAGLIST
+# if wxUSE_TREECTRL || wxUSE_NOTEBOOK || wxUSE_LISTCTRL || wxUSE_TREELISTCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxImageList must be compiled as well"
+# else
+# undef wxUSE_IMAGLIST
+# define wxUSE_IMAGLIST 1
+# endif
+# endif
+#endif /* !wxUSE_IMAGLIST */
+
+#if wxUSE_RADIOBOX
+# if !wxUSE_RADIOBTN
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_RADIOBOX requires wxUSE_RADIOBTN"
+# else
+# undef wxUSE_RADIOBTN
+# define wxUSE_RADIOBTN 1
+# endif
+# endif
+# if !wxUSE_STATBOX
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_RADIOBOX requires wxUSE_STATBOX"
+# else
+# undef wxUSE_STATBOX
+# define wxUSE_STATBOX 1
+# endif
+# endif
+#endif /* wxUSE_RADIOBOX */
+
+#if wxUSE_LOGWINDOW
+# if !wxUSE_TEXTCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_LOGWINDOW requires wxUSE_TEXTCTRL"
+# else
+# undef wxUSE_TEXTCTRL
+# define wxUSE_TEXTCTRL 1
+# endif
+# endif
+#endif /* wxUSE_LOGWINDOW */
+
+#if wxUSE_LOG_DIALOG
+# if !wxUSE_LISTCTRL || !wxUSE_BUTTON
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_LOG_DIALOG requires wxUSE_LISTCTRL and wxUSE_BUTTON"
+# else
+# undef wxUSE_LISTCTRL
+# define wxUSE_LISTCTRL 1
+# undef wxUSE_BUTTON
+# define wxUSE_BUTTON 1
+# endif
+# endif
+#endif /* wxUSE_LOG_DIALOG */
+
+#if wxUSE_CLIPBOARD && !wxUSE_DATAOBJ
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxClipboard requires wxDataObject"
+# else
+# undef wxUSE_DATAOBJ
+# define wxUSE_DATAOBJ 1
+# endif
+#endif /* wxUSE_CLIPBOARD */
+
+#if wxUSE_XRC && !wxUSE_XML
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_XRC requires wxUSE_XML"
+# else
+# undef wxUSE_XRC
+# define wxUSE_XRC 0
+# endif
+#endif /* wxUSE_XRC */
+
+#if wxUSE_SOCKETS && !wxUSE_STOPWATCH
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_SOCKETS requires wxUSE_STOPWATCH"
+# else
+# undef wxUSE_SOCKETS
+# define wxUSE_SOCKETS 0
+# endif
+#endif /* wxUSE_SOCKETS */
+
+#if wxUSE_SVG && !wxUSE_STREAMS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_SVG requires wxUSE_STREAMS"
+# else
+# undef wxUSE_SVG
+# define wxUSE_SVG 0
+# endif
+#endif /* wxUSE_SVG */
+
+#if wxUSE_SVG && !wxUSE_IMAGE
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_SVG requires wxUSE_IMAGE"
+# else
+# undef wxUSE_SVG
+# define wxUSE_SVG 0
+# endif
+#endif /* wxUSE_SVG */
+
+#if wxUSE_SVG && !wxUSE_LIBPNG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_SVG requires wxUSE_LIBPNG"
+# else
+# undef wxUSE_SVG
+# define wxUSE_SVG 0
+# endif
+#endif /* wxUSE_SVG */
+
+#if wxUSE_TASKBARICON && !wxUSE_MENUS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TASKBARICON requires wxUSE_MENUS"
+# else
+# undef wxUSE_TASKBARICON
+# define wxUSE_TASKBARICON 0
+# endif
+#endif /* wxUSE_TASKBARICON */
+
+#if !wxUSE_VARIANT
+# if wxUSE_DATAVIEWCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxDataViewCtrl requires wxVariant"
+# else
+# undef wxUSE_DATAVIEWCTRL
+# define wxUSE_DATAVIEWCTRL 0
+# endif
+# endif
+#endif /* wxUSE_VARIANT */
+
+#if wxUSE_TREELISTCTRL && !wxUSE_DATAVIEWCTRL
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_TREELISTCTRL requires wxDataViewCtrl"
+# else
+# undef wxUSE_TREELISTCTRL
+# define wxUSE_TREELISTCTRL 0
+# endif
+#endif /* wxUSE_TREELISTCTRL */
+
+#if wxUSE_WEBVIEW && !(wxUSE_WEBVIEW_WEBKIT || wxUSE_WEBVIEW_IE)
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_WEBVIEW requires at least one backend"
+# else
+# undef wxUSE_WEBVIEW
+# define wxUSE_WEBVIEW 0
+# endif
+#endif /* wxUSE_WEBVIEW && !any web view backend */
+
+#if wxUSE_PREFERENCES_EDITOR
+ /*
+ We can use either a generic implementation, using wxNotebook, or a
+ native one under wxOSX/Cocoa but then we must be using the native
+ toolbar.
+ */
+# if !wxUSE_NOTEBOOK
+# ifdef __WXOSX_COCOA__
+# if !wxUSE_TOOLBAR || !wxOSX_USE_NATIVE_TOOLBAR
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_PREFERENCES_EDITOR requires native toolbar in wxOSX"
+# else
+# undef wxUSE_PREFERENCES_EDITOR
+# define wxUSE_PREFERENCES_EDITOR 0
+# endif
+# endif
+# else
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_PREFERENCES_EDITOR requires wxNotebook"
+# else
+# undef wxUSE_PREFERENCES_EDITOR
+# define wxUSE_PREFERENCES_EDITOR 0
+# endif
+# endif
+# endif
+#endif /* wxUSE_PREFERENCES_EDITOR */
+
+#endif /* wxUSE_GUI */
+
+#endif /* _WX_CHKCONF_H_ */
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/choicdlg.h
+// Purpose: Includes generic choice dialog file
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CHOICDLG_H_BASE_
+#define _WX_CHOICDLG_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_CHOICEDLG
+
+#include "wx/generic/choicdgg.h"
+
+#endif
+
+#endif // _WX_CHOICDLG_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/choice.h
+// Purpose: wxChoice class interface
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 26.07.99
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CHOICE_H_BASE_
+#define _WX_CHOICE_H_BASE_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_CHOICE
+
+#include "wx/ctrlsub.h" // the base class
+
+// ----------------------------------------------------------------------------
+// global data
+// ----------------------------------------------------------------------------
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxChoiceNameStr[];
+
+// ----------------------------------------------------------------------------
+// wxChoice allows to select one of a non-modifiable list of strings
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxChoiceBase : public wxControlWithItems
+{
+public:
+ wxChoiceBase() { }
+ virtual ~wxChoiceBase();
+
+ // all generic methods are in wxControlWithItems
+
+ // get the current selection: this can only be different from the normal
+ // selection if the popup items list is currently opened and the user
+ // selected some item in it but didn't close the list yet; otherwise (and
+ // currently always on platforms other than MSW) this is the same as
+ // GetSelection()
+ virtual int GetCurrentSelection() const { return GetSelection(); }
+
+ // set/get the number of columns in the control (as they're not supported on
+ // most platforms, they do nothing by default)
+ virtual void SetColumns(int WXUNUSED(n) = 1 ) { }
+ virtual int GetColumns() const { return 1 ; }
+
+ // emulate selecting the item event.GetInt()
+ void Command(wxCommandEvent& event);
+
+ // override wxItemContainer::IsSorted
+ virtual bool IsSorted() const { return HasFlag(wxCB_SORT); }
+
+protected:
+ // The generic implementation doesn't determine the height correctly and
+ // doesn't account for the width of the arrow but does take into account
+ // the string widths, so the derived classes should override it and set the
+ // height and add the arrow width to the size returned by this version.
+ virtual wxSize DoGetBestSize() const;
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxChoiceBase);
+};
+
+// ----------------------------------------------------------------------------
+// include the platform-dependent class definition
+// ----------------------------------------------------------------------------
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/choice.h"
+#elif defined(__SMARTPHONE__) && defined(__WXWINCE__)
+ #include "wx/msw/wince/choicece.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/choice.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/choice.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/choice.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/choice.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/choice.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/choice.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/choice.h"
+#endif
+
+#endif // wxUSE_CHOICE
+
+#endif // _WX_CHOICE_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/choicebk.h
+// Purpose: wxChoicebook: wxChoice and wxNotebook combination
+// Author: Vadim Zeitlin
+// Modified by: Wlodzimierz ABX Skiba from wx/listbook.h
+// Created: 15.09.04
+// Copyright: (c) Vadim Zeitlin, Wlodzimierz Skiba
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CHOICEBOOK_H_
+#define _WX_CHOICEBOOK_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_CHOICEBOOK
+
+#include "wx/bookctrl.h"
+#include "wx/choice.h"
+#include "wx/containr.h"
+
+class WXDLLIMPEXP_FWD_CORE wxChoice;
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CHOICEBOOK_PAGE_CHANGED, wxBookCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CHOICEBOOK_PAGE_CHANGING, wxBookCtrlEvent );
+
+// wxChoicebook flags
+#define wxCHB_DEFAULT wxBK_DEFAULT
+#define wxCHB_TOP wxBK_TOP
+#define wxCHB_BOTTOM wxBK_BOTTOM
+#define wxCHB_LEFT wxBK_LEFT
+#define wxCHB_RIGHT wxBK_RIGHT
+#define wxCHB_ALIGN_MASK wxBK_ALIGN_MASK
+
+// ----------------------------------------------------------------------------
+// wxChoicebook
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxChoicebook : public wxNavigationEnabled<wxBookCtrlBase>
+{
+public:
+ wxChoicebook() { }
+
+ wxChoicebook(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxEmptyString)
+ {
+ (void)Create(parent, id, pos, size, style, name);
+ }
+
+ // quasi ctor
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxEmptyString);
+
+
+ virtual bool SetPageText(size_t n, const wxString& strText);
+ virtual wxString GetPageText(size_t n) const;
+ virtual int GetPageImage(size_t n) const;
+ virtual bool SetPageImage(size_t n, int imageId);
+ virtual bool InsertPage(size_t n,
+ wxWindow *page,
+ const wxString& text,
+ bool bSelect = false,
+ int imageId = NO_IMAGE);
+ virtual int SetSelection(size_t n)
+ { return DoSetSelection(n, SetSelection_SendEvent); }
+ virtual int ChangeSelection(size_t n) { return DoSetSelection(n); }
+ virtual void SetImageList(wxImageList *imageList);
+
+ virtual bool DeleteAllPages();
+
+ // returns the choice control
+ wxChoice* GetChoiceCtrl() const { return (wxChoice*)m_bookctrl; }
+
+ // Override this to return true because the part of parent window
+ // background between our controlling wxChoice and the page area should
+ // show through.
+ virtual bool HasTransparentBackground() { return true; }
+
+protected:
+ virtual void DoSetWindowVariant(wxWindowVariant variant);
+
+ virtual wxWindow *DoRemovePage(size_t page);
+
+ void UpdateSelectedPage(size_t newsel)
+ {
+ m_selection = static_cast<int>(newsel);
+ GetChoiceCtrl()->Select(m_selection);
+ }
+
+ wxBookCtrlEvent* CreatePageChangingEvent() const;
+ void MakeChangedEvent(wxBookCtrlEvent &event);
+
+ // event handlers
+ void OnChoiceSelected(wxCommandEvent& event);
+
+private:
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebook)
+};
+
+// ----------------------------------------------------------------------------
+// choicebook event class and related stuff
+// ----------------------------------------------------------------------------
+
+// wxChoicebookEvent is obsolete and defined for compatibility only
+#define wxChoicebookEvent wxBookCtrlEvent
+typedef wxBookCtrlEventFunction wxChoicebookEventFunction;
+#define wxChoicebookEventHandler(func) wxBookCtrlEventHandler(func)
+
+#define EVT_CHOICEBOOK_PAGE_CHANGED(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_CHOICEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn))
+
+#define EVT_CHOICEBOOK_PAGE_CHANGING(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_CHOICEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn))
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED wxEVT_CHOICEBOOK_PAGE_CHANGED
+#define wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING wxEVT_CHOICEBOOK_PAGE_CHANGING
+
+#endif // wxUSE_CHOICEBOOK
+
+#endif // _WX_CHOICEBOOK_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/clipbrd.h
+// Purpose: wxClipboad class and clipboard functions
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 19.10.99
+// Copyright: (c) wxWidgets Team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CLIPBRD_H_BASE_
+#define _WX_CLIPBRD_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_CLIPBOARD
+
+
+#include "wx/event.h"
+#include "wx/chartype.h"
+#include "wx/dataobj.h" // for wxDataFormat
+#include "wx/vector.h"
+
+class WXDLLIMPEXP_FWD_CORE wxClipboard;
+
+// ----------------------------------------------------------------------------
+// wxClipboard represents the system clipboard. Normally, you should use
+// wxTheClipboard which is a global pointer to the (unique) clipboard.
+//
+// Clipboard can be used to copy data to/paste data from. It works together
+// with wxDataObject.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxClipboardBase : public wxObject
+{
+public:
+ wxClipboardBase() { m_usePrimary = false; }
+
+ // open the clipboard before Add/SetData() and GetData()
+ virtual bool Open() = 0;
+
+ // close the clipboard after Add/SetData() and GetData()
+ virtual void Close() = 0;
+
+ // query whether the clipboard is opened
+ virtual bool IsOpened() const = 0;
+
+ // add to the clipboard data
+ //
+ // NB: the clipboard owns the pointer and will delete it, so data must be
+ // allocated on the heap
+ virtual bool AddData( wxDataObject *data ) = 0;
+
+ // set the clipboard data, this is the same as Clear() followed by
+ // AddData()
+ virtual bool SetData( wxDataObject *data ) = 0;
+
+ // ask if data in correct format is available
+ virtual bool IsSupported( const wxDataFormat& format ) = 0;
+
+ // ask if data in correct format is available
+ virtual bool IsSupportedAsync( wxEvtHandler *sink );
+
+ // fill data with data on the clipboard (if available)
+ virtual bool GetData( wxDataObject& data ) = 0;
+
+ // clears wxTheClipboard and the system's clipboard if possible
+ virtual void Clear() = 0;
+
+ // flushes the clipboard: this means that the data which is currently on
+ // clipboard will stay available even after the application exits (possibly
+ // eating memory), otherwise the clipboard will be emptied on exit
+ virtual bool Flush() { return false; }
+
+ // this allows to choose whether we work with CLIPBOARD (default) or
+ // PRIMARY selection on X11-based systems
+ //
+ // on the other ones, working with primary selection does nothing: this
+ // allows to write code which sets the primary selection when something is
+ // selected without any ill effects (i.e. without overwriting the
+ // clipboard which would be wrong on the platforms without X11 PRIMARY)
+ virtual void UsePrimarySelection(bool usePrimary = false)
+ {
+ m_usePrimary = usePrimary;
+ }
+
+ // return true if we're using primary selection
+ bool IsUsingPrimarySelection() const { return m_usePrimary; }
+
+ // Returns global instance (wxTheClipboard) of the object:
+ static wxClipboard *Get();
+
+
+ // don't use this directly, it is public for compatibility with some ports
+ // (wxX11, wxMotif, ...) only
+ bool m_usePrimary;
+};
+
+// ----------------------------------------------------------------------------
+// asynchronous clipboard event
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxClipboardEvent : public wxEvent
+{
+public:
+ wxClipboardEvent(wxEventType evtType = wxEVT_NULL)
+ : wxEvent(0, evtType)
+ {
+ }
+
+ wxClipboardEvent(const wxClipboardEvent& event)
+ : wxEvent(event),
+ m_formats(event.m_formats)
+ {
+ }
+
+ bool SupportsFormat(const wxDataFormat& format) const;
+ void AddFormat(const wxDataFormat& format);
+
+ virtual wxEvent *Clone() const
+ {
+ return new wxClipboardEvent(*this);
+ }
+
+
+protected:
+ wxVector<wxDataFormat> m_formats;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxClipboardEvent)
+};
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CLIPBOARD_CHANGED, wxClipboardEvent );
+
+typedef void (wxEvtHandler::*wxClipboardEventFunction)(wxClipboardEvent&);
+
+#define wxClipboardEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxClipboardEventFunction, func)
+
+#define EVT_CLIPBOARD_CHANGED(func) wx__DECLARE_EVT0(wxEVT_CLIPBOARD_CHANGED, wxClipboardEventHandler(func))
+
+// ----------------------------------------------------------------------------
+// globals
+// ----------------------------------------------------------------------------
+
+// The global clipboard object - backward compatible access macro:
+#define wxTheClipboard (wxClipboard::Get())
+
+// ----------------------------------------------------------------------------
+// include platform-specific class declaration
+// ----------------------------------------------------------------------------
+
+#if defined(__WXMSW__)
+ #include "wx/msw/clipbrd.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/clipbrd.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/clipbrd.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/clipbrd.h"
+#elif defined(__WXX11__)
+ #include "wx/x11/clipbrd.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/clipbrd.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/clipbrd.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/clipbrd.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// helpful class for opening the clipboard and automatically closing it
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxClipboardLocker
+{
+public:
+ wxClipboardLocker(wxClipboard *clipboard = NULL)
+ {
+ m_clipboard = clipboard ? clipboard : wxTheClipboard;
+ if ( m_clipboard )
+ {
+ m_clipboard->Open();
+ }
+ }
+
+ bool operator!() const { return !m_clipboard->IsOpened(); }
+
+ ~wxClipboardLocker()
+ {
+ if ( m_clipboard )
+ {
+ m_clipboard->Close();
+ }
+ }
+
+private:
+ wxClipboard *m_clipboard;
+
+ wxDECLARE_NO_COPY_CLASS(wxClipboardLocker);
+};
+
+#endif // wxUSE_CLIPBOARD
+
+#endif // _WX_CLIPBRD_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/clntdata.h
+// Purpose: A mixin class for holding a wxClientData or void pointer
+// Author: Robin Dunn
+// Modified by:
+// Created: 9-Oct-2001
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CLNTDATAH__
+#define _WX_CLNTDATAH__
+
+#include "wx/defs.h"
+#include "wx/string.h"
+#include "wx/hashmap.h"
+
+typedef int (*wxShadowObjectMethod)(void*, void*);
+WX_DECLARE_STRING_HASH_MAP_WITH_DECL(
+ wxShadowObjectMethod,
+ wxShadowObjectMethods,
+ class WXDLLIMPEXP_BASE
+);
+WX_DECLARE_STRING_HASH_MAP_WITH_DECL(
+ void *,
+ wxShadowObjectFields,
+ class WXDLLIMPEXP_BASE
+);
+
+class WXDLLIMPEXP_BASE wxShadowObject
+{
+public:
+ wxShadowObject() { }
+
+ void AddMethod( const wxString &name, wxShadowObjectMethod method )
+ {
+ wxShadowObjectMethods::iterator it = m_methods.find( name );
+ if (it == m_methods.end())
+ m_methods[ name ] = method;
+ else
+ it->second = method;
+ }
+
+ bool InvokeMethod( const wxString &name, void* window, void* param, int* returnValue )
+ {
+ wxShadowObjectMethods::iterator it = m_methods.find( name );
+ if (it == m_methods.end())
+ return false;
+ wxShadowObjectMethod method = it->second;
+ int ret = (*method)(window, param);
+ if (returnValue)
+ *returnValue = ret;
+ return true;
+ }
+
+ void AddField( const wxString &name, void* initialValue = NULL )
+ {
+ wxShadowObjectFields::iterator it = m_fields.find( name );
+ if (it == m_fields.end())
+ m_fields[ name ] = initialValue;
+ else
+ it->second = initialValue;
+ }
+
+ void SetField( const wxString &name, void* value )
+ {
+ wxShadowObjectFields::iterator it = m_fields.find( name );
+ if (it == m_fields.end())
+ return;
+ it->second = value;
+ }
+
+ void* GetField( const wxString &name, void *defaultValue = NULL )
+ {
+ wxShadowObjectFields::iterator it = m_fields.find( name );
+ if (it == m_fields.end())
+ return defaultValue;
+ return it->second;
+ }
+
+private:
+ wxShadowObjectMethods m_methods;
+ wxShadowObjectFields m_fields;
+};
+
+
+// ----------------------------------------------------------------------------
+
+// what kind of client data do we have?
+enum wxClientDataType
+{
+ wxClientData_None, // we don't know yet because we don't have it at all
+ wxClientData_Object, // our client data is typed and we own it
+ wxClientData_Void // client data is untyped and we don't own it
+};
+
+class WXDLLIMPEXP_BASE wxClientData
+{
+public:
+ wxClientData() { }
+ virtual ~wxClientData() { }
+};
+
+class WXDLLIMPEXP_BASE wxStringClientData : public wxClientData
+{
+public:
+ wxStringClientData() : m_data() { }
+ wxStringClientData( const wxString &data ) : m_data(data) { }
+ void SetData( const wxString &data ) { m_data = data; }
+ const wxString& GetData() const { return m_data; }
+
+private:
+ wxString m_data;
+};
+
+// This class is a mixin that provides storage and management of "client
+// data." The client data stored can either be a pointer to a wxClientData
+// object in which case it is managed by the container (i.e. it will delete
+// the data when it's destroyed) or an untyped pointer which won't be deleted
+// by the container - but not both of them
+//
+// NOTE: This functionality is currently duplicated in wxEvtHandler in order
+// to avoid having more than one vtable in that class hierarchy.
+
+class WXDLLIMPEXP_BASE wxClientDataContainer
+{
+public:
+ wxClientDataContainer();
+ virtual ~wxClientDataContainer();
+
+ void SetClientObject( wxClientData *data ) { DoSetClientObject(data); }
+ wxClientData *GetClientObject() const { return DoGetClientObject(); }
+
+ void SetClientData( void *data ) { DoSetClientData(data); }
+ void *GetClientData() const { return DoGetClientData(); }
+
+protected:
+ // The user data: either an object which will be deleted by the container
+ // when it's deleted or some raw pointer which we do nothing with. Only
+ // one type of data can be used with the given window, i.e. you cannot set
+ // the void data and then associate the container with wxClientData or vice
+ // versa.
+ union
+ {
+ wxClientData *m_clientObject;
+ void *m_clientData;
+ };
+
+ // client data accessors
+ virtual void DoSetClientObject( wxClientData *data );
+ virtual wxClientData *DoGetClientObject() const;
+
+ virtual void DoSetClientData( void *data );
+ virtual void *DoGetClientData() const;
+
+ // what kind of data do we have?
+ wxClientDataType m_clientDataType;
+
+};
+
+#endif // _WX_CLNTDATAH__
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/clrpicker.h
+// Purpose: wxColourPickerCtrl base header
+// Author: Francesco Montorsi (based on Vadim Zeitlin's code)
+// Modified by:
+// Created: 14/4/2006
+// Copyright: (c) Vadim Zeitlin, Francesco Montorsi
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CLRPICKER_H_BASE_
+#define _WX_CLRPICKER_H_BASE_
+
+#include "wx/defs.h"
+
+
+#if wxUSE_COLOURPICKERCTRL
+
+#include "wx/pickerbase.h"
+
+
+class WXDLLIMPEXP_FWD_CORE wxColourPickerEvent;
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxColourPickerWidgetNameStr[];
+extern WXDLLIMPEXP_DATA_CORE(const char) wxColourPickerCtrlNameStr[];
+
+// show the colour in HTML form (#AABBCC) as colour button label
+#define wxCLRBTN_SHOW_LABEL 100
+
+// the default style
+#define wxCLRBTN_DEFAULT_STYLE (wxCLRBTN_SHOW_LABEL)
+
+
+
+// ----------------------------------------------------------------------------
+// wxColourPickerWidgetBase: a generic abstract interface which must be
+// implemented by controls used by wxColourPickerCtrl
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxColourPickerWidgetBase
+{
+public:
+ wxColourPickerWidgetBase() { m_colour = *wxBLACK; }
+ virtual ~wxColourPickerWidgetBase() {}
+
+ wxColour GetColour() const
+ { return m_colour; }
+ virtual void SetColour(const wxColour &col)
+ { m_colour = col; UpdateColour(); }
+ virtual void SetColour(const wxString &col)
+ { m_colour.Set(col); UpdateColour(); }
+
+protected:
+
+ virtual void UpdateColour() = 0;
+
+ // the current colour (may be invalid if none)
+ wxColour m_colour;
+};
+
+
+// Styles which must be supported by all controls implementing wxColourPickerWidgetBase
+// NB: these styles must be defined to carefully-chosen values to
+// avoid conflicts with wxButton's styles
+
+// show the colour in HTML form (#AABBCC) as colour button label
+// (instead of no label at all)
+// NOTE: this style is supported just by wxColourButtonGeneric and
+// thus is not exposed in wxColourPickerCtrl
+#define wxCLRP_SHOW_LABEL 0x0008
+
+// map platform-dependent controls which implement the wxColourPickerWidgetBase
+// under the name "wxColourPickerWidget".
+// NOTE: wxColourPickerCtrl allocates a wxColourPickerWidget and relies on the
+// fact that all classes being mapped as wxColourPickerWidget have the
+// same prototype for their contructor (and also explains why we use
+// define instead of a typedef)
+// since GTK > 2.4, there is GtkColorButton
+#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
+ #include "wx/gtk/clrpicker.h"
+ #define wxColourPickerWidget wxColourButton
+#else
+ #include "wx/generic/clrpickerg.h"
+ #define wxColourPickerWidget wxGenericColourButton
+#endif
+
+
+// ----------------------------------------------------------------------------
+// wxColourPickerCtrl: platform-independent class which embeds a
+// platform-dependent wxColourPickerWidget and, if wxCLRP_USE_TEXTCTRL style is
+// used, a textctrl next to it.
+// ----------------------------------------------------------------------------
+
+#define wxCLRP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL)
+#define wxCLRP_DEFAULT_STYLE 0
+
+class WXDLLIMPEXP_CORE wxColourPickerCtrl : public wxPickerBase
+{
+public:
+ wxColourPickerCtrl() {}
+ virtual ~wxColourPickerCtrl() {}
+
+
+ wxColourPickerCtrl(wxWindow *parent, wxWindowID id,
+ const wxColour& col = *wxBLACK, const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = wxCLRP_DEFAULT_STYLE,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxColourPickerCtrlNameStr)
+ { Create(parent, id, col, pos, size, style, validator, name); }
+
+ bool Create(wxWindow *parent, wxWindowID id,
+ const wxColour& col = *wxBLACK,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxCLRP_DEFAULT_STYLE,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxColourPickerCtrlNameStr);
+
+
+public: // public API
+
+ // get the colour chosen
+ wxColour GetColour() const
+ { return ((wxColourPickerWidget *)m_picker)->GetColour(); }
+
+ // set currently displayed color
+ void SetColour(const wxColour& col);
+
+ // set colour using RGB(r,g,b) syntax or considering given text as a colour name;
+ // returns true if the given text was successfully recognized.
+ bool SetColour(const wxString& text);
+
+
+public: // internal functions
+
+ // update the button colour to match the text control contents
+ void UpdatePickerFromTextCtrl();
+
+ // update the text control to match the button's colour
+ void UpdateTextCtrlFromPicker();
+
+ // event handler for our picker
+ void OnColourChange(wxColourPickerEvent &);
+
+protected:
+ virtual long GetPickerStyle(long style) const
+ { return (style & wxCLRP_SHOW_LABEL); }
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxColourPickerCtrl)
+};
+
+
+// ----------------------------------------------------------------------------
+// wxColourPickerEvent: used by wxColourPickerCtrl only
+// ----------------------------------------------------------------------------
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COLOURPICKER_CHANGED, wxColourPickerEvent );
+
+class WXDLLIMPEXP_CORE wxColourPickerEvent : public wxCommandEvent
+{
+public:
+ wxColourPickerEvent() {}
+ wxColourPickerEvent(wxObject *generator, int id, const wxColour &col)
+ : wxCommandEvent(wxEVT_COLOURPICKER_CHANGED, id),
+ m_colour(col)
+ {
+ SetEventObject(generator);
+ }
+
+ wxColour GetColour() const { return m_colour; }
+ void SetColour(const wxColour &c) { m_colour = c; }
+
+
+ // default copy ctor, assignment operator and dtor are ok
+ virtual wxEvent *Clone() const { return new wxColourPickerEvent(*this); }
+
+private:
+ wxColour m_colour;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxColourPickerEvent)
+};
+
+// ----------------------------------------------------------------------------
+// event types and macros
+// ----------------------------------------------------------------------------
+
+typedef void (wxEvtHandler::*wxColourPickerEventFunction)(wxColourPickerEvent&);
+
+#define wxColourPickerEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxColourPickerEventFunction, func)
+
+#define EVT_COLOURPICKER_CHANGED(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_COLOURPICKER_CHANGED, id, wxColourPickerEventHandler(fn))
+
+
+// old wxEVT_COMMAND_* constant
+#define wxEVT_COMMAND_COLOURPICKER_CHANGED wxEVT_COLOURPICKER_CHANGED
+
+#endif // wxUSE_COLOURPICKERCTRL
+
+#endif // _WX_CLRPICKER_H_BASE_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/cmdargs.h
+// Purpose: declaration of wxCmdLineArgsArray helper class
+// Author: Vadim Zeitlin
+// Created: 2007-11-12
+// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CMDARGS_H_
+#define _WX_CMDARGS_H_
+
+#include "wx/arrstr.h"
+
+// ----------------------------------------------------------------------------
+// wxCmdLineArgsArray: helper class used by wxApp::argv
+// ----------------------------------------------------------------------------
+
+#if wxUSE_UNICODE
+
+// this class is used instead of either "char **" or "wchar_t **" (neither of
+// which would be backwards compatible with all the existing code) for argv
+// field of wxApp
+//
+// as it's used for compatibility, it tries to look as much as traditional
+// (char **) argv as possible, in particular it provides implicit conversions
+// to "char **" and also array-like operator[]
+class WXDLLIMPEXP_BASE wxCmdLineArgsArray
+{
+public:
+ wxCmdLineArgsArray() { m_argsA = NULL; m_argsW = NULL; }
+
+ template <typename T>
+ wxCmdLineArgsArray& operator=(T **argv)
+ {
+ FreeArgs();
+
+ m_args.clear();
+
+ if ( argv )
+ {
+ while ( *argv )
+ m_args.push_back(*argv++);
+ }
+
+ return *this;
+ }
+
+ operator char**() const
+ {
+ if ( !m_argsA )
+ {
+ const size_t count = m_args.size();
+ m_argsA = new char *[count];
+ for ( size_t n = 0; n < count; n++ )
+ m_argsA[n] = wxStrdup(m_args[n].ToAscii());
+ }
+
+ return m_argsA;
+ }
+
+ operator wchar_t**() const
+ {
+ if ( !m_argsW )
+ {
+ const size_t count = m_args.size();
+ m_argsW = new wchar_t *[count];
+ for ( size_t n = 0; n < count; n++ )
+ m_argsW[n] = wxStrdup(m_args[n].wc_str());
+ }
+
+ return m_argsW;
+ }
+
+ // existing code does checks like "if ( argv )" and we want it to continue
+ // to compile, so provide this conversion even if it is pretty dangerous
+ operator bool() const
+ {
+ return !m_args.empty();
+ }
+
+ // and the same for "if ( !argv )" checks
+ bool operator!() const
+ {
+ return m_args.empty();
+ }
+
+ wxString operator[](size_t n) const
+ {
+ return m_args[n];
+ }
+
+ // we must provide this overload for g++ 3.4 which can't choose between
+ // our operator[](size_t) and ::operator[](char**, int) otherwise
+ wxString operator[](int n) const
+ {
+ return m_args[n];
+ }
+
+
+ // convenience methods, i.e. not existing only for backwards compatibility
+
+ // do we have any arguments at all?
+ bool IsEmpty() const { return m_args.empty(); }
+
+ // access the arguments as a convenient array of wxStrings
+ const wxArrayString& GetArguments() const { return m_args; }
+
+ ~wxCmdLineArgsArray()
+ {
+ FreeArgs();
+ }
+
+private:
+ template <typename T>
+ void Free(T **args)
+ {
+ if ( !args )
+ return;
+
+ const size_t count = m_args.size();
+ for ( size_t n = 0; n < count; n++ )
+ free(args[n]);
+
+ delete [] args;
+ }
+
+ void FreeArgs()
+ {
+ Free(m_argsA);
+ Free(m_argsW);
+ }
+
+ wxArrayString m_args;
+ mutable char **m_argsA;
+ mutable wchar_t **m_argsW;
+
+ wxDECLARE_NO_COPY_CLASS(wxCmdLineArgsArray);
+};
+
+// provide global operator overload for compatibility with the existing code
+// doing things like "if ( condition && argv )"
+inline bool operator&&(bool cond, const wxCmdLineArgsArray& array)
+{
+ return cond && !array.IsEmpty();
+}
+
+#endif // wxUSE_UNICODE
+
+#endif // _WX_CMDARGS_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/cmdline.h
+// Purpose: wxCmdLineParser and related classes for parsing the command
+// line options
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 04.01.00
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CMDLINE_H_
+#define _WX_CMDLINE_H_
+
+#include "wx/defs.h"
+
+#include "wx/string.h"
+#include "wx/arrstr.h"
+#include "wx/cmdargs.h"
+
+// determines ConvertStringToArgs() behaviour
+enum wxCmdLineSplitType
+{
+ wxCMD_LINE_SPLIT_DOS,
+ wxCMD_LINE_SPLIT_UNIX
+};
+
+#if wxUSE_CMDLINE_PARSER
+
+class WXDLLIMPEXP_FWD_BASE wxDateTime;
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// by default, options are optional (sic) and each call to AddParam() allows
+// one more parameter - this may be changed by giving non-default flags to it
+enum wxCmdLineEntryFlags
+{
+ wxCMD_LINE_OPTION_MANDATORY = 0x01, // this option must be given
+ wxCMD_LINE_PARAM_OPTIONAL = 0x02, // the parameter may be omitted
+ wxCMD_LINE_PARAM_MULTIPLE = 0x04, // the parameter may be repeated
+ wxCMD_LINE_OPTION_HELP = 0x08, // this option is a help request
+ wxCMD_LINE_NEEDS_SEPARATOR = 0x10, // must have sep before the value
+ wxCMD_LINE_SWITCH_NEGATABLE = 0x20 // this switch can be negated (e.g. /S-)
+};
+
+// an option value or parameter may be a string (the most common case), a
+// number or a date
+enum wxCmdLineParamType
+{
+ wxCMD_LINE_VAL_STRING, // should be 0 (default)
+ wxCMD_LINE_VAL_NUMBER,
+ wxCMD_LINE_VAL_DATE,
+ wxCMD_LINE_VAL_DOUBLE,
+ wxCMD_LINE_VAL_NONE
+};
+
+// for constructing the cmd line description using Init()
+enum wxCmdLineEntryType
+{
+ wxCMD_LINE_SWITCH,
+ wxCMD_LINE_OPTION,
+ wxCMD_LINE_PARAM,
+ wxCMD_LINE_USAGE_TEXT,
+ wxCMD_LINE_NONE // to terminate the list
+};
+
+// Possible return values of wxCmdLineParser::FoundSwitch()
+enum wxCmdLineSwitchState
+{
+ wxCMD_SWITCH_OFF = -1, // Found but turned off/negated.
+ wxCMD_SWITCH_NOT_FOUND, // Not found at all.
+ wxCMD_SWITCH_ON // Found in normal state.
+};
+
+// ----------------------------------------------------------------------------
+// wxCmdLineEntryDesc is a description of one command line
+// switch/option/parameter
+// ----------------------------------------------------------------------------
+
+struct wxCmdLineEntryDesc
+{
+ wxCmdLineEntryType kind;
+ const char *shortName;
+ const char *longName;
+ const char *description;
+ wxCmdLineParamType type;
+ int flags;
+};
+
+// the list of wxCmdLineEntryDesc objects should be terminated with this one
+#define wxCMD_LINE_DESC_END \
+ { wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, 0x0 }
+
+// ----------------------------------------------------------------------------
+// wxCmdLineParser is a class for parsing command line.
+//
+// It has the following features:
+//
+// 1. distinguishes options, switches and parameters; allows option grouping
+// 2. allows both short and long options
+// 3. automatically generates the usage message from the cmd line description
+// 4. does type checks on the options values (number, date, ...)
+//
+// To use it you should:
+//
+// 1. construct it giving it the cmd line to parse and optionally its desc
+// 2. construct the cmd line description using AddXXX() if not done in (1)
+// 3. call Parse()
+// 4. use GetXXX() to retrieve the parsed info
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxCmdLineParser
+{
+public:
+ // ctors and initializers
+ // ----------------------
+
+ // default ctor or ctor giving the cmd line in either Unix or Win form
+ wxCmdLineParser() { Init(); }
+ wxCmdLineParser(int argc, char **argv) { Init(); SetCmdLine(argc, argv); }
+#if wxUSE_UNICODE
+ wxCmdLineParser(int argc, wxChar **argv) { Init(); SetCmdLine(argc, argv); }
+ wxCmdLineParser(int argc, const wxCmdLineArgsArray& argv)
+ { Init(); SetCmdLine(argc, argv); }
+#endif // wxUSE_UNICODE
+ wxCmdLineParser(const wxString& cmdline) { Init(); SetCmdLine(cmdline); }
+
+ // the same as above, but also gives the cmd line description - otherwise,
+ // use AddXXX() later
+ wxCmdLineParser(const wxCmdLineEntryDesc *desc)
+ { Init(); SetDesc(desc); }
+ wxCmdLineParser(const wxCmdLineEntryDesc *desc, int argc, char **argv)
+ { Init(); SetCmdLine(argc, argv); SetDesc(desc); }
+#if wxUSE_UNICODE
+ wxCmdLineParser(const wxCmdLineEntryDesc *desc, int argc, wxChar **argv)
+ { Init(); SetCmdLine(argc, argv); SetDesc(desc); }
+ wxCmdLineParser(const wxCmdLineEntryDesc *desc,
+ int argc,
+ const wxCmdLineArgsArray& argv)
+ { Init(); SetCmdLine(argc, argv); SetDesc(desc); }
+#endif // wxUSE_UNICODE
+ wxCmdLineParser(const wxCmdLineEntryDesc *desc, const wxString& cmdline)
+ { Init(); SetCmdLine(cmdline); SetDesc(desc); }
+
+ // set cmd line to parse after using one of the ctors which don't do it
+ void SetCmdLine(int argc, char **argv);
+#if wxUSE_UNICODE
+ void SetCmdLine(int argc, wxChar **argv);
+ void SetCmdLine(int argc, const wxCmdLineArgsArray& argv);
+#endif // wxUSE_UNICODE
+ void SetCmdLine(const wxString& cmdline);
+
+ // not virtual, don't use this class polymorphically
+ ~wxCmdLineParser();
+
+ // set different parser options
+ // ----------------------------
+
+ // by default, '-' is switch char under Unix, '-' or '/' under Win:
+ // switchChars contains all characters with which an option or switch may
+ // start
+ void SetSwitchChars(const wxString& switchChars);
+
+ // long options are not POSIX-compliant, this option allows to disable them
+ void EnableLongOptions(bool enable = true);
+ void DisableLongOptions() { EnableLongOptions(false); }
+
+ bool AreLongOptionsEnabled() const;
+
+ // extra text may be shown by Usage() method if set by this function
+ void SetLogo(const wxString& logo);
+
+ // construct the cmd line description
+ // ----------------------------------
+
+ // take the cmd line description from the wxCMD_LINE_NONE terminated table
+ void SetDesc(const wxCmdLineEntryDesc *desc);
+
+ // a switch: i.e. an option without value
+ void AddSwitch(const wxString& name, const wxString& lng = wxEmptyString,
+ const wxString& desc = wxEmptyString,
+ int flags = 0);
+ void AddLongSwitch(const wxString& lng,
+ const wxString& desc = wxEmptyString,
+ int flags = 0)
+ {
+ AddSwitch(wxString(), lng, desc, flags);
+ }
+
+ // an option taking a value of the given type
+ void AddOption(const wxString& name, const wxString& lng = wxEmptyString,
+ const wxString& desc = wxEmptyString,
+ wxCmdLineParamType type = wxCMD_LINE_VAL_STRING,
+ int flags = 0);
+ void AddLongOption(const wxString& lng,
+ const wxString& desc = wxEmptyString,
+ wxCmdLineParamType type = wxCMD_LINE_VAL_STRING,
+ int flags = 0)
+ {
+ AddOption(wxString(), lng, desc, type, flags);
+ }
+
+ // a parameter
+ void AddParam(const wxString& desc = wxEmptyString,
+ wxCmdLineParamType type = wxCMD_LINE_VAL_STRING,
+ int flags = 0);
+
+ // add an explanatory text to be shown to the user in help
+ void AddUsageText(const wxString& text);
+
+ // actions
+ // -------
+
+ // parse the command line, return 0 if ok, -1 if "-h" or "--help" option
+ // was encountered and the help message was given or a positive value if a
+ // syntax error occurred
+ //
+ // if showUsage is true, Usage() is called in case of syntax error or if
+ // help was requested
+ int Parse(bool showUsage = true);
+
+ // give the usage message describing all program options
+ void Usage() const;
+
+ // return the usage string, call Usage() to directly show it to the user
+ wxString GetUsageString() const;
+
+ // get the command line arguments
+ // ------------------------------
+
+ // returns true if the given switch was found
+ bool Found(const wxString& name) const;
+
+ // Returns wxCMD_SWITCH_NOT_FOUND if the switch was not found at all,
+ // wxCMD_SWITCH_ON if it was found in normal state and wxCMD_SWITCH_OFF if
+ // it was found but negated (i.e. followed by "-", this can only happen for
+ // the switches with wxCMD_LINE_SWITCH_NEGATABLE flag).
+ wxCmdLineSwitchState FoundSwitch(const wxString& name) const;
+
+ // returns true if an option taking a string value was found and stores the
+ // value in the provided pointer
+ bool Found(const wxString& name, wxString *value) const;
+
+ // returns true if an option taking an integer value was found and stores
+ // the value in the provided pointer
+ bool Found(const wxString& name, long *value) const;
+
+ // returns true if an option taking a double value was found and stores
+ // the value in the provided pointer
+ bool Found(const wxString& name, double *value) const;
+
+#if wxUSE_DATETIME
+ // returns true if an option taking a date value was found and stores the
+ // value in the provided pointer
+ bool Found(const wxString& name, wxDateTime *value) const;
+#endif // wxUSE_DATETIME
+
+ // gets the number of parameters found
+ size_t GetParamCount() const;
+
+ // gets the value of Nth parameter (as string only for now)
+ wxString GetParam(size_t n = 0u) const;
+
+ // Resets switches and options
+ void Reset();
+
+ // break down the command line in arguments
+ static wxArrayString
+ ConvertStringToArgs(const wxString& cmdline,
+ wxCmdLineSplitType type = wxCMD_LINE_SPLIT_DOS);
+
+private:
+ // common part of all ctors
+ void Init();
+
+ struct wxCmdLineParserData *m_data;
+
+ wxDECLARE_NO_COPY_CLASS(wxCmdLineParser);
+};
+
+#else // !wxUSE_CMDLINE_PARSER
+
+// this function is always available (even if !wxUSE_CMDLINE_PARSER) because it
+// is used by wxWin itself under Windows
+class WXDLLIMPEXP_BASE wxCmdLineParser
+{
+public:
+ static wxArrayString
+ ConvertStringToArgs(const wxString& cmdline,
+ wxCmdLineSplitType type = wxCMD_LINE_SPLIT_DOS);
+};
+
+#endif // wxUSE_CMDLINE_PARSER/!wxUSE_CMDLINE_PARSER
+
+#endif // _WX_CMDLINE_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/cmdproc.h
+// Purpose: undo/redo capable command processing framework
+// Author: Julian Smart (extracted from docview.h by VZ)
+// Modified by:
+// Created: 05.11.00
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CMDPROC_H_
+#define _WX_CMDPROC_H_
+
+#include "wx/defs.h"
+#include "wx/object.h"
+#include "wx/list.h"
+
+class WXDLLIMPEXP_FWD_CORE wxMenu;
+
+// ----------------------------------------------------------------------------
+// wxCommand: a single command capable of performing itself
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxCommand : public wxObject
+{
+public:
+ wxCommand(bool canUndoIt = false, const wxString& name = wxEmptyString);
+ virtual ~wxCommand(){}
+
+ // Override this to perform a command
+ virtual bool Do() = 0;
+
+ // Override this to undo a command
+ virtual bool Undo() = 0;
+
+ virtual bool CanUndo() const { return m_canUndo; }
+ virtual wxString GetName() const { return m_commandName; }
+
+protected:
+ bool m_canUndo;
+ wxString m_commandName;
+
+private:
+ DECLARE_CLASS(wxCommand)
+};
+
+// ----------------------------------------------------------------------------
+// wxCommandProcessor: wxCommand manager
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxCommandProcessor : public wxObject
+{
+public:
+ // if max number of commands is -1, it is unlimited
+ wxCommandProcessor(int maxCommands = -1);
+ virtual ~wxCommandProcessor();
+
+ // Pass a command to the processor. The processor calls Do(); if
+ // successful, is appended to the command history unless storeIt is false.
+ virtual bool Submit(wxCommand *command, bool storeIt = true);
+
+ // just store the command without executing it
+ virtual void Store(wxCommand *command);
+
+ virtual bool Undo();
+ virtual bool Redo();
+ virtual bool CanUndo() const;
+ virtual bool CanRedo() const;
+
+ // Initialises the current command and menu strings.
+ virtual void Initialize();
+
+ // Sets the Undo/Redo menu strings for the current menu.
+ virtual void SetMenuStrings();
+
+ // Gets the current Undo menu label.
+ wxString GetUndoMenuLabel() const;
+
+ // Gets the current Undo menu label.
+ wxString GetRedoMenuLabel() const;
+
+#if wxUSE_MENUS
+ // Call this to manage an edit menu.
+ void SetEditMenu(wxMenu *menu) { m_commandEditMenu = menu; }
+ wxMenu *GetEditMenu() const { return m_commandEditMenu; }
+#endif // wxUSE_MENUS
+
+ // command list access
+ wxList& GetCommands() { return m_commands; }
+ const wxList& GetCommands() const { return m_commands; }
+ wxCommand *GetCurrentCommand() const
+ {
+ return (wxCommand *)(m_currentCommand ? m_currentCommand->GetData() : NULL);
+ }
+ int GetMaxCommands() const { return m_maxNoCommands; }
+ virtual void ClearCommands();
+
+ // Has the current project been changed?
+ virtual bool IsDirty() const;
+
+ // Mark the current command as the one where the last save took place
+ void MarkAsSaved()
+ {
+ m_lastSavedCommand = m_currentCommand;
+ }
+
+
+ // By default, the accelerators are "\tCtrl+Z" and "\tCtrl+Y"
+ const wxString& GetUndoAccelerator() const { return m_undoAccelerator; }
+ const wxString& GetRedoAccelerator() const { return m_redoAccelerator; }
+
+ void SetUndoAccelerator(const wxString& accel) { m_undoAccelerator = accel; }
+ void SetRedoAccelerator(const wxString& accel) { m_redoAccelerator = accel; }
+
+protected:
+ // for further flexibility, command processor doesn't call wxCommand::Do()
+ // and Undo() directly but uses these functions which can be overridden in
+ // the derived class
+ virtual bool DoCommand(wxCommand& cmd);
+ virtual bool UndoCommand(wxCommand& cmd);
+
+ int m_maxNoCommands;
+ wxList m_commands;
+ wxList::compatibility_iterator m_currentCommand,
+ m_lastSavedCommand;
+
+#if wxUSE_MENUS
+ wxMenu* m_commandEditMenu;
+#endif // wxUSE_MENUS
+
+ wxString m_undoAccelerator;
+ wxString m_redoAccelerator;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxCommandProcessor)
+ wxDECLARE_NO_COPY_CLASS(wxCommandProcessor);
+};
+
+#endif // _WX_CMDPROC_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/cmndata.h
+// Purpose: Common GDI data classes
+// Author: Julian Smart and others
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c)
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CMNDATA_H_BASE_
+#define _WX_CMNDATA_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_PRINTING_ARCHITECTURE
+
+#include "wx/gdicmn.h"
+
+#if wxUSE_STREAMS
+#include "wx/stream.h"
+#endif
+
+class WXDLLIMPEXP_FWD_CORE wxPrintNativeDataBase;
+
+/*
+ * wxPrintData
+ * Encapsulates printer information (not printer dialog information)
+ */
+
+enum wxPrintBin
+{
+ wxPRINTBIN_DEFAULT,
+
+ wxPRINTBIN_ONLYONE,
+ wxPRINTBIN_LOWER,
+ wxPRINTBIN_MIDDLE,
+ wxPRINTBIN_MANUAL,
+ wxPRINTBIN_ENVELOPE,
+ wxPRINTBIN_ENVMANUAL,
+ wxPRINTBIN_AUTO,
+ wxPRINTBIN_TRACTOR,
+ wxPRINTBIN_SMALLFMT,
+ wxPRINTBIN_LARGEFMT,
+ wxPRINTBIN_LARGECAPACITY,
+ wxPRINTBIN_CASSETTE,
+ wxPRINTBIN_FORMSOURCE,
+
+ wxPRINTBIN_USER
+};
+
+const int wxPRINTMEDIA_DEFAULT = 0;
+
+class WXDLLIMPEXP_CORE wxPrintData: public wxObject
+{
+public:
+ wxPrintData();
+ wxPrintData(const wxPrintData& printData);
+ virtual ~wxPrintData();
+
+ int GetNoCopies() const { return m_printNoCopies; }
+ bool GetCollate() const { return m_printCollate; }
+ wxPrintOrientation GetOrientation() const { return m_printOrientation; }
+ bool IsOrientationReversed() const { return m_printOrientationReversed; }
+
+ // Is this data OK for showing the print dialog?
+ bool Ok() const { return IsOk(); }
+ bool IsOk() const ;
+
+ const wxString& GetPrinterName() const { return m_printerName; }
+ bool GetColour() const { return m_colour; }
+ wxDuplexMode GetDuplex() const { return m_duplexMode; }
+ wxPaperSize GetPaperId() const { return m_paperId; }
+ const wxSize& GetPaperSize() const { return m_paperSize; } // Not used yet: confusable with paper size
+ // in wxPageSetupDialogData
+ wxPrintQuality GetQuality() const { return m_printQuality; }
+ wxPrintBin GetBin() const { return m_bin; }
+ wxPrintMode GetPrintMode() const { return m_printMode; }
+ int GetMedia() const { return m_media; }
+
+ void SetNoCopies(int v) { m_printNoCopies = v; }
+ void SetCollate(bool flag) { m_printCollate = flag; }
+
+ // Please use the overloaded method below
+ wxDEPRECATED_INLINE(void SetOrientation(int orient),
+ m_printOrientation = (wxPrintOrientation)orient; )
+ void SetOrientation(wxPrintOrientation orient) { m_printOrientation = orient; }
+ void SetOrientationReversed(bool reversed) { m_printOrientationReversed = reversed; }
+
+ void SetPrinterName(const wxString& name) { m_printerName = name; }
+ void SetColour(bool colour) { m_colour = colour; }
+ void SetDuplex(wxDuplexMode duplex) { m_duplexMode = duplex; }
+ void SetPaperId(wxPaperSize sizeId) { m_paperId = sizeId; }
+ void SetPaperSize(const wxSize& sz) { m_paperSize = sz; }
+ void SetQuality(wxPrintQuality quality) { m_printQuality = quality; }
+ void SetBin(wxPrintBin bin) { m_bin = bin; }
+ void SetMedia(int media) { m_media = media; }
+ void SetPrintMode(wxPrintMode printMode) { m_printMode = printMode; }
+
+ wxString GetFilename() const { return m_filename; }
+ void SetFilename( const wxString &filename ) { m_filename = filename; }
+
+ wxPrintData& operator=(const wxPrintData& data);
+
+ char* GetPrivData() const { return m_privData; }
+ int GetPrivDataLen() const { return m_privDataLen; }
+ void SetPrivData( char *privData, int len );
+
+
+ // Convert between wxPrintData and native data
+ void ConvertToNative();
+ void ConvertFromNative();
+ // Holds the native print data
+ wxPrintNativeDataBase *GetNativeData() const { return m_nativeData; }
+
+private:
+ wxPrintBin m_bin;
+ int m_media;
+ wxPrintMode m_printMode;
+
+ int m_printNoCopies;
+ wxPrintOrientation m_printOrientation;
+ bool m_printOrientationReversed;
+ bool m_printCollate;
+
+ wxString m_printerName;
+ bool m_colour;
+ wxDuplexMode m_duplexMode;
+ wxPrintQuality m_printQuality;
+ wxPaperSize m_paperId;
+ wxSize m_paperSize;
+
+ wxString m_filename;
+
+ char* m_privData;
+ int m_privDataLen;
+
+ wxPrintNativeDataBase *m_nativeData;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPrintData)
+};
+
+/*
+ * wxPrintDialogData
+ * Encapsulates information displayed and edited in the printer dialog box.
+ * Contains a wxPrintData object which is filled in according to the values retrieved
+ * from the dialog.
+ */
+
+class WXDLLIMPEXP_CORE wxPrintDialogData: public wxObject
+{
+public:
+ wxPrintDialogData();
+ wxPrintDialogData(const wxPrintDialogData& dialogData);
+ wxPrintDialogData(const wxPrintData& printData);
+ virtual ~wxPrintDialogData();
+
+ int GetFromPage() const { return m_printFromPage; }
+ int GetToPage() const { return m_printToPage; }
+ int GetMinPage() const { return m_printMinPage; }
+ int GetMaxPage() const { return m_printMaxPage; }
+ int GetNoCopies() const { return m_printNoCopies; }
+ bool GetAllPages() const { return m_printAllPages; }
+ bool GetSelection() const { return m_printSelection; }
+ bool GetCollate() const { return m_printCollate; }
+ bool GetPrintToFile() const { return m_printToFile; }
+
+ void SetFromPage(int v) { m_printFromPage = v; }
+ void SetToPage(int v) { m_printToPage = v; }
+ void SetMinPage(int v) { m_printMinPage = v; }
+ void SetMaxPage(int v) { m_printMaxPage = v; }
+ void SetNoCopies(int v) { m_printNoCopies = v; }
+ void SetAllPages(bool flag) { m_printAllPages = flag; }
+ void SetSelection(bool flag) { m_printSelection = flag; }
+ void SetCollate(bool flag) { m_printCollate = flag; }
+ void SetPrintToFile(bool flag) { m_printToFile = flag; }
+
+ void EnablePrintToFile(bool flag) { m_printEnablePrintToFile = flag; }
+ void EnableSelection(bool flag) { m_printEnableSelection = flag; }
+ void EnablePageNumbers(bool flag) { m_printEnablePageNumbers = flag; }
+ void EnableHelp(bool flag) { m_printEnableHelp = flag; }
+
+ bool GetEnablePrintToFile() const { return m_printEnablePrintToFile; }
+ bool GetEnableSelection() const { return m_printEnableSelection; }
+ bool GetEnablePageNumbers() const { return m_printEnablePageNumbers; }
+ bool GetEnableHelp() const { return m_printEnableHelp; }
+
+ // Is this data OK for showing the print dialog?
+ bool Ok() const { return IsOk(); }
+ bool IsOk() const { return m_printData.IsOk() ; }
+
+ wxPrintData& GetPrintData() { return m_printData; }
+ void SetPrintData(const wxPrintData& printData) { m_printData = printData; }
+
+ void operator=(const wxPrintDialogData& data);
+ void operator=(const wxPrintData& data); // Sets internal m_printData member
+
+private:
+ int m_printFromPage;
+ int m_printToPage;
+ int m_printMinPage;
+ int m_printMaxPage;
+ int m_printNoCopies;
+ bool m_printAllPages;
+ bool m_printCollate;
+ bool m_printToFile;
+ bool m_printSelection;
+ bool m_printEnableSelection;
+ bool m_printEnablePageNumbers;
+ bool m_printEnableHelp;
+ bool m_printEnablePrintToFile;
+ wxPrintData m_printData;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPrintDialogData)
+};
+
+/*
+* This is the data used (and returned) by the wxPageSetupDialog.
+*/
+
+// Compatibility with old name
+#define wxPageSetupData wxPageSetupDialogData
+
+class WXDLLIMPEXP_CORE wxPageSetupDialogData: public wxObject
+{
+public:
+ wxPageSetupDialogData();
+ wxPageSetupDialogData(const wxPageSetupDialogData& dialogData);
+ wxPageSetupDialogData(const wxPrintData& printData);
+ virtual ~wxPageSetupDialogData();
+
+ wxSize GetPaperSize() const { return m_paperSize; }
+ wxPaperSize GetPaperId() const { return m_printData.GetPaperId(); }
+ wxPoint GetMinMarginTopLeft() const { return m_minMarginTopLeft; }
+ wxPoint GetMinMarginBottomRight() const { return m_minMarginBottomRight; }
+ wxPoint GetMarginTopLeft() const { return m_marginTopLeft; }
+ wxPoint GetMarginBottomRight() const { return m_marginBottomRight; }
+
+ bool GetDefaultMinMargins() const { return m_defaultMinMargins; }
+ bool GetEnableMargins() const { return m_enableMargins; }
+ bool GetEnableOrientation() const { return m_enableOrientation; }
+ bool GetEnablePaper() const { return m_enablePaper; }
+ bool GetEnablePrinter() const { return m_enablePrinter; }
+ bool GetDefaultInfo() const { return m_getDefaultInfo; }
+ bool GetEnableHelp() const { return m_enableHelp; }
+
+ // Is this data OK for showing the page setup dialog?
+ bool Ok() const { return IsOk(); }
+ bool IsOk() const { return m_printData.IsOk() ; }
+
+ // If a corresponding paper type is found in the paper database, will set the m_printData
+ // paper size id member as well.
+ void SetPaperSize(const wxSize& sz);
+
+ void SetPaperId(wxPaperSize id) { m_printData.SetPaperId(id); }
+
+ // Sets the wxPrintData id, plus the paper width/height if found in the paper database.
+ void SetPaperSize(wxPaperSize id);
+
+ void SetMinMarginTopLeft(const wxPoint& pt) { m_minMarginTopLeft = pt; }
+ void SetMinMarginBottomRight(const wxPoint& pt) { m_minMarginBottomRight = pt; }
+ void SetMarginTopLeft(const wxPoint& pt) { m_marginTopLeft = pt; }
+ void SetMarginBottomRight(const wxPoint& pt) { m_marginBottomRight = pt; }
+ void SetDefaultMinMargins(bool flag) { m_defaultMinMargins = flag; }
+ void SetDefaultInfo(bool flag) { m_getDefaultInfo = flag; }
+
+ void EnableMargins(bool flag) { m_enableMargins = flag; }
+ void EnableOrientation(bool flag) { m_enableOrientation = flag; }
+ void EnablePaper(bool flag) { m_enablePaper = flag; }
+ void EnablePrinter(bool flag) { m_enablePrinter = flag; }
+ void EnableHelp(bool flag) { m_enableHelp = flag; }
+
+ // Use paper size defined in this object to set the wxPrintData
+ // paper id
+ void CalculateIdFromPaperSize();
+
+ // Use paper id in wxPrintData to set this object's paper size
+ void CalculatePaperSizeFromId();
+
+ wxPageSetupDialogData& operator=(const wxPageSetupDialogData& data);
+ wxPageSetupDialogData& operator=(const wxPrintData& data);
+
+ wxPrintData& GetPrintData() { return m_printData; }
+ const wxPrintData& GetPrintData() const { return m_printData; }
+ void SetPrintData(const wxPrintData& printData);
+
+private:
+ wxSize m_paperSize; // The dimensions selected by the user (on return, same as in wxPrintData?)
+ wxPoint m_minMarginTopLeft;
+ wxPoint m_minMarginBottomRight;
+ wxPoint m_marginTopLeft;
+ wxPoint m_marginBottomRight;
+ bool m_defaultMinMargins;
+ bool m_enableMargins;
+ bool m_enableOrientation;
+ bool m_enablePaper;
+ bool m_enablePrinter;
+ bool m_getDefaultInfo; // Equiv. to PSD_RETURNDEFAULT
+ bool m_enableHelp;
+ wxPrintData m_printData;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData)
+};
+
+#endif // wxUSE_PRINTING_ARCHITECTURE
+
+#endif
+// _WX_CMNDATA_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/collpane.h
+// Purpose: wxCollapsiblePane
+// Author: Francesco Montorsi
+// Modified by:
+// Created: 8/10/2006
+// Copyright: (c) Francesco Montorsi
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_COLLAPSABLE_PANE_H_BASE_
+#define _WX_COLLAPSABLE_PANE_H_BASE_
+
+#include "wx/defs.h"
+
+
+#if wxUSE_COLLPANE
+
+#include "wx/control.h"
+
+// class name
+extern WXDLLIMPEXP_DATA_CORE(const char) wxCollapsiblePaneNameStr[];
+
+// ----------------------------------------------------------------------------
+// wxCollapsiblePaneBase: interface for wxCollapsiblePane
+// ----------------------------------------------------------------------------
+
+#define wxCP_DEFAULT_STYLE (wxTAB_TRAVERSAL | wxNO_BORDER)
+#define wxCP_NO_TLW_RESIZE (0x0002)
+
+class WXDLLIMPEXP_CORE wxCollapsiblePaneBase : public wxControl
+{
+public:
+ wxCollapsiblePaneBase() {}
+
+ virtual void Collapse(bool collapse = true) = 0;
+ void Expand() { Collapse(false); }
+
+ virtual bool IsCollapsed() const = 0;
+ bool IsExpanded() const { return !IsCollapsed(); }
+
+ virtual wxWindow *GetPane() const = 0;
+
+ virtual wxString GetLabel() const = 0;
+ virtual void SetLabel(const wxString& label) = 0;
+};
+
+
+// ----------------------------------------------------------------------------
+// event types and macros
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxCollapsiblePaneEvent;
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COLLAPSIBLEPANE_CHANGED, wxCollapsiblePaneEvent );
+
+class WXDLLIMPEXP_CORE wxCollapsiblePaneEvent : public wxCommandEvent
+{
+public:
+ wxCollapsiblePaneEvent() {}
+ wxCollapsiblePaneEvent(wxObject *generator, int id, bool collapsed)
+ : wxCommandEvent(wxEVT_COLLAPSIBLEPANE_CHANGED, id),
+ m_bCollapsed(collapsed)
+ {
+ SetEventObject(generator);
+ }
+
+ bool GetCollapsed() const { return m_bCollapsed; }
+ void SetCollapsed(bool c) { m_bCollapsed = c; }
+
+
+ // default copy ctor, assignment operator and dtor are ok
+ virtual wxEvent *Clone() const { return new wxCollapsiblePaneEvent(*this); }
+
+private:
+ bool m_bCollapsed;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCollapsiblePaneEvent)
+};
+
+// ----------------------------------------------------------------------------
+// event types and macros
+// ----------------------------------------------------------------------------
+
+typedef void (wxEvtHandler::*wxCollapsiblePaneEventFunction)(wxCollapsiblePaneEvent&);
+
+#define wxCollapsiblePaneEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxCollapsiblePaneEventFunction, func)
+
+#define EVT_COLLAPSIBLEPANE_CHANGED(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_COLLAPSIBLEPANE_CHANGED, id, wxCollapsiblePaneEventHandler(fn))
+
+
+#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
+ #include "wx/gtk/collpane.h"
+#else
+ #include "wx/generic/collpaneg.h"
+
+ // use #define and not a typedef to allow forward declaring the class
+ #define wxCollapsiblePane wxGenericCollapsiblePane
+#endif
+
+// old wxEVT_COMMAND_* constant
+#define wxEVT_COMMAND_COLLPANE_CHANGED wxEVT_COLLAPSIBLEPANE_CHANGED
+
+#endif // wxUSE_COLLPANE
+
+#endif // _WX_COLLAPSABLE_PANE_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/colordlg.h
+// Purpose: wxColourDialog
+// Author: Vadim Zeitiln
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_COLORDLG_H_BASE_
+#define _WX_COLORDLG_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_COLOURDLG
+
+#include "wx/colourdata.h"
+
+#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
+ #include "wx/msw/colordlg.h"
+#elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__)
+ #include "wx/osx/colordlg.h"
+#elif defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
+ #include "wx/gtk/colordlg.h"
+#else
+ #include "wx/generic/colrdlgg.h"
+
+ #define wxColourDialog wxGenericColourDialog
+#endif
+
+// get the colour from user and return it
+WXDLLIMPEXP_CORE wxColour wxGetColourFromUser(wxWindow *parent = NULL,
+ const wxColour& colInit = wxNullColour,
+ const wxString& caption = wxEmptyString,
+ wxColourData *data = NULL);
+
+#endif // wxUSE_COLOURDLG
+
+#endif
+ // _WX_COLORDLG_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/colour.h
+// Purpose: wxColourBase definition
+// Author: Julian Smart
+// Modified by: Francesco Montorsi
+// Created:
+// Copyright: Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_COLOUR_H_BASE_
+#define _WX_COLOUR_H_BASE_
+
+#include "wx/defs.h"
+#include "wx/gdiobj.h"
+
+class WXDLLIMPEXP_FWD_CORE wxColour;
+
+// A macro to define the standard wxColour constructors:
+//
+// It avoids the need to repeat these lines across all colour.h files, since
+// Set() is a virtual function and thus cannot be called by wxColourBase ctors
+#define DEFINE_STD_WXCOLOUR_CONSTRUCTORS \
+ wxColour() { Init(); } \
+ wxColour(ChannelType red, \
+ ChannelType green, \
+ ChannelType blue, \
+ ChannelType alpha = wxALPHA_OPAQUE) \
+ { Init(); Set(red, green, blue, alpha); } \
+ wxColour(unsigned long colRGB) { Init(); Set(colRGB ); } \
+ wxColour(const wxString& colourName) { Init(); Set(colourName); } \
+ wxColour(const char *colourName) { Init(); Set(colourName); } \
+ wxColour(const wchar_t *colourName) { Init(); Set(colourName); }
+
+
+// flags for wxColour -> wxString conversion (see wxColour::GetAsString)
+enum {
+ wxC2S_NAME = 1, // return colour name, when possible
+ wxC2S_CSS_SYNTAX = 2, // return colour in rgb(r,g,b) syntax
+ wxC2S_HTML_SYNTAX = 4 // return colour in #rrggbb syntax
+};
+
+const unsigned char wxALPHA_TRANSPARENT = 0;
+const unsigned char wxALPHA_OPAQUE = 0xff;
+
+// a valid but fully transparent colour
+#define wxTransparentColour wxColour(0, 0, 0, wxALPHA_TRANSPARENT)
+#define wxTransparentColor wxTransparentColour
+
+// ----------------------------------------------------------------------------
+// wxVariant support
+// ----------------------------------------------------------------------------
+
+#if wxUSE_VARIANT
+#include "wx/variant.h"
+DECLARE_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLIMPEXP_CORE)
+#endif
+
+//-----------------------------------------------------------------------------
+// wxColourBase: this class has no data members, just some functions to avoid
+// code redundancy in all native wxColour implementations
+//-----------------------------------------------------------------------------
+
+/* Transition from wxGDIObject to wxObject is incomplete. If your port does
+ not need the wxGDIObject machinery to handle colors, please add it to the
+ list of ports which do not need it.
+ */
+#if defined( __WXMAC__ ) || defined( __WXMSW__ ) || defined( __WXPM__ ) || defined( __WXCOCOA__ )
+#define wxCOLOUR_IS_GDIOBJECT 0
+#else
+#define wxCOLOUR_IS_GDIOBJECT 1
+#endif
+
+class WXDLLIMPEXP_CORE wxColourBase : public
+#if wxCOLOUR_IS_GDIOBJECT
+ wxGDIObject
+#else
+ wxObject
+#endif
+{
+public:
+ // type of a single colour component
+ typedef unsigned char ChannelType;
+
+ wxColourBase() {}
+ virtual ~wxColourBase() {}
+
+
+ // Set() functions
+ // ---------------
+
+ void Set(ChannelType red,
+ ChannelType green,
+ ChannelType blue,
+ ChannelType alpha = wxALPHA_OPAQUE)
+ { InitRGBA(red, green, blue, alpha); }
+
+ // implemented in colourcmn.cpp
+ bool Set(const wxString &str)
+ { return FromString(str); }
+
+ void Set(unsigned long colRGB)
+ {
+ // we don't need to know sizeof(long) here because we assume that the three
+ // least significant bytes contain the R, G and B values
+ Set((ChannelType)(0xFF & colRGB),
+ (ChannelType)(0xFF & (colRGB >> 8)),
+ (ChannelType)(0xFF & (colRGB >> 16)));
+ }
+
+
+
+ // accessors
+ // ---------
+
+ virtual ChannelType Red() const = 0;
+ virtual ChannelType Green() const = 0;
+ virtual ChannelType Blue() const = 0;
+ virtual ChannelType Alpha() const
+ { return wxALPHA_OPAQUE ; }
+
+ // implemented in colourcmn.cpp
+ virtual wxString GetAsString(long flags = wxC2S_NAME | wxC2S_CSS_SYNTAX) const;
+
+ void SetRGB(wxUint32 colRGB)
+ {
+ Set((ChannelType)(0xFF & colRGB),
+ (ChannelType)(0xFF & (colRGB >> 8)),
+ (ChannelType)(0xFF & (colRGB >> 16)));
+ }
+
+ void SetRGBA(wxUint32 colRGBA)
+ {
+ Set((ChannelType)(0xFF & colRGBA),
+ (ChannelType)(0xFF & (colRGBA >> 8)),
+ (ChannelType)(0xFF & (colRGBA >> 16)),
+ (ChannelType)(0xFF & (colRGBA >> 24)));
+ }
+
+ wxUint32 GetRGB() const
+ { return Red() | (Green() << 8) | (Blue() << 16); }
+
+ wxUint32 GetRGBA() const
+ { return Red() | (Green() << 8) | (Blue() << 16) | (Alpha() << 24); }
+
+#if !wxCOLOUR_IS_GDIOBJECT
+ virtual bool IsOk() const= 0;
+
+ // older version, for backwards compatibility only (but not deprecated
+ // because it's still widely used)
+ bool Ok() const { return IsOk(); }
+#endif
+
+ // manipulation
+ // ------------
+
+ // These methods are static because they are mostly used
+ // within tight loops (where we don't want to instantiate wxColour's)
+
+ static void MakeMono (unsigned char* r, unsigned char* g, unsigned char* b, bool on);
+ static void MakeDisabled(unsigned char* r, unsigned char* g, unsigned char* b, unsigned char brightness = 255);
+ static void MakeGrey (unsigned char* r, unsigned char* g, unsigned char* b); // integer version
+ static void MakeGrey (unsigned char* r, unsigned char* g, unsigned char* b,
+ double weight_r, double weight_g, double weight_b); // floating point version
+ static unsigned char AlphaBlend (unsigned char fg, unsigned char bg, double alpha);
+ static void ChangeLightness(unsigned char* r, unsigned char* g, unsigned char* b, int ialpha);
+
+ wxColour ChangeLightness(int ialpha) const;
+ wxColour& MakeDisabled(unsigned char brightness = 255);
+
+ // old, deprecated
+ // ---------------
+
+#if WXWIN_COMPATIBILITY_2_6
+ static wxDEPRECATED( wxColour CreateByName(const wxString& name) );
+ wxDEPRECATED( void InitFromName(const wxString& col) );
+#endif
+
+protected:
+ // Some ports need Init() and while we don't, provide a stub so that the
+ // ports which don't need it are not forced to define it
+ void Init() { }
+
+ virtual void
+ InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a) = 0;
+
+ virtual bool FromString(const wxString& s);
+
+#if wxCOLOUR_IS_GDIOBJECT
+ // wxColour doesn't use reference counted data (at least not in all ports)
+ // so provide stubs for the functions which need to be defined if we do use
+ // them
+ virtual wxGDIRefData *CreateGDIRefData() const
+ {
+ wxFAIL_MSG( "must be overridden if used" );
+
+ return NULL;
+ }
+
+ virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *WXUNUSED(data)) const
+ {
+ wxFAIL_MSG( "must be overridden if used" );
+
+ return NULL;
+ }
+#endif
+};
+
+
+// wxColour <-> wxString utilities, used by wxConfig, defined in colourcmn.cpp
+WXDLLIMPEXP_CORE wxString wxToString(const wxColourBase& col);
+WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxColourBase* col);
+
+
+
+#if defined(__WXMSW__)
+ #include "wx/msw/colour.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/colour.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/colour.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/colour.h"
+#elif defined(__WXDFB__)
+ #include "wx/generic/colour.h"
+#elif defined(__WXX11__)
+ #include "wx/x11/colour.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/colour.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/colour.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/colour.h"
+#endif
+
+#define wxColor wxColour
+
+#endif // _WX_COLOUR_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/colourdata.h
+// Author: Julian Smart
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_COLOURDATA_H_
+#define _WX_COLOURDATA_H_
+
+#include "wx/colour.h"
+
+class WXDLLIMPEXP_CORE wxColourData : public wxObject
+{
+public:
+ // number of custom colours we store
+ enum
+ {
+ NUM_CUSTOM = 16
+ };
+
+ wxColourData();
+ wxColourData(const wxColourData& data);
+ wxColourData& operator=(const wxColourData& data);
+ virtual ~wxColourData();
+
+ void SetChooseFull(bool flag) { m_chooseFull = flag; }
+ bool GetChooseFull() const { return m_chooseFull; }
+ void SetColour(const wxColour& colour) { m_dataColour = colour; }
+ const wxColour& GetColour() const { return m_dataColour; }
+ wxColour& GetColour() { return m_dataColour; }
+
+ // SetCustomColour() modifies colours in an internal array of NUM_CUSTOM
+ // custom colours;
+ void SetCustomColour(int i, const wxColour& colour);
+ wxColour GetCustomColour(int i) const;
+
+ // Serialize the object to a string and restore it from it
+ wxString ToString() const;
+ bool FromString(const wxString& str);
+
+
+ // public for backwards compatibility only: don't use directly
+ wxColour m_dataColour;
+ wxColour m_custColours[NUM_CUSTOM];
+ bool m_chooseFull;
+
+ DECLARE_DYNAMIC_CLASS(wxColourData)
+};
+
+#endif // _WX_COLOURDATA_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/combo.h
+// Purpose: wxComboCtrl declaration
+// Author: Jaakko Salli
+// Modified by:
+// Created: Apr-30-2006
+// Copyright: (c) Jaakko Salli
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_COMBOCONTROL_H_BASE_
+#define _WX_COMBOCONTROL_H_BASE_
+
+
+/*
+ A few words about all the classes defined in this file are probably in
+ order: why do we need extra wxComboCtrl and wxComboPopup classes?
+
+ This is because a traditional combobox is a combination of a text control
+ (with a button allowing to open the pop down list) with a listbox and
+ wxComboBox class is exactly such control, however we want to also have other
+ combinations - in fact, we want to allow anything at all to be used as pop
+ down list, not just a wxListBox.
+
+ So we define a base wxComboCtrl which can use any control as pop down
+ list and wxComboBox deriving from it which implements the standard wxWidgets
+ combobox API. wxComboCtrl needs to be told somehow which control to use
+ and this is done by SetPopupControl(). However, we need something more than
+ just a wxControl in this method as, for example, we need to call
+ SetSelection("initial text value") and wxControl doesn't have such method.
+ So we also need a wxComboPopup which is just a very simple interface which
+ must be implemented by a control to be usable as a popup.
+
+ We couldn't derive wxComboPopup from wxControl as this would make it
+ impossible to have a class deriving from both wxListBx and from it, so
+ instead it is just a mix-in.
+ */
+
+
+#include "wx/defs.h"
+
+#if wxUSE_COMBOCTRL
+
+#include "wx/control.h"
+#include "wx/renderer.h" // this is needed for wxCONTROL_XXX flags
+#include "wx/bitmap.h" // wxBitmap used by-value
+#include "wx/textentry.h"
+
+class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
+class WXDLLIMPEXP_FWD_CORE wxComboPopup;
+
+//
+// New window styles for wxComboCtrlBase
+//
+enum
+{
+ // Double-clicking a read-only combo triggers call to popup's OnComboPopup.
+ // In wxOwnerDrawnComboBox, for instance, it cycles item.
+ wxCC_SPECIAL_DCLICK = 0x0100,
+
+ // Dropbutton acts like standard push button.
+ wxCC_STD_BUTTON = 0x0200
+};
+
+
+// wxComboCtrl internal flags
+enum
+{
+ // First those that can be passed to Customize.
+ // It is Windows style for all flags to be clear.
+
+ // Button is preferred outside the border (GTK style)
+ wxCC_BUTTON_OUTSIDE_BORDER = 0x0001,
+ // Show popup on mouse up instead of mouse down (which is the Windows style)
+ wxCC_POPUP_ON_MOUSE_UP = 0x0002,
+ // All text is not automatically selected on click
+ wxCC_NO_TEXT_AUTO_SELECT = 0x0004,
+ // Drop-button stays down as long as popup is displayed.
+ wxCC_BUTTON_STAYS_DOWN = 0x0008,
+ // Drop-button covers the entire control.
+ wxCC_FULL_BUTTON = 0x0010,
+ // Drop-button goes over the custom-border (used under WinVista).
+ wxCC_BUTTON_COVERS_BORDER = 0x0020,
+
+ // Internal use: signals creation is complete
+ wxCC_IFLAG_CREATED = 0x0100,
+ // Internal use: really put button outside
+ wxCC_IFLAG_BUTTON_OUTSIDE = 0x0200,
+ // Internal use: SetMargins has been successfully called
+ wxCC_IFLAG_LEFT_MARGIN_SET = 0x0400,
+ // Internal use: Set wxTAB_TRAVERSAL to parent when popup is dismissed
+ wxCC_IFLAG_PARENT_TAB_TRAVERSAL = 0x0800,
+ // Internal use: Secondary popup window type should be used (if available).
+ wxCC_IFLAG_USE_ALT_POPUP = 0x1000,
+ // Internal use: Skip popup animation.
+ wxCC_IFLAG_DISABLE_POPUP_ANIM = 0x2000,
+ // Internal use: Drop-button is a bitmap button or has non-default size
+ // (but can still be on either side of the control), regardless whether
+ // specified by the platform or the application.
+ wxCC_IFLAG_HAS_NONSTANDARD_BUTTON = 0x4000
+};
+
+
+// Flags used by PreprocessMouseEvent and HandleButtonMouseEvent
+enum
+{
+ wxCC_MF_ON_BUTTON = 0x0001, // cursor is on dropbutton area
+ wxCC_MF_ON_CLICK_AREA = 0x0002 // cursor is on dropbutton or other area
+ // that can be clicked to show the popup.
+};
+
+
+// Namespace for wxComboCtrl feature flags
+struct wxComboCtrlFeatures
+{
+ enum
+ {
+ MovableButton = 0x0001, // Button can be on either side of control
+ BitmapButton = 0x0002, // Button may be replaced with bitmap
+ ButtonSpacing = 0x0004, // Button can have spacing from the edge
+ // of the control
+ TextIndent = 0x0008, // SetMargins can be used to control
+ // left margin.
+ PaintControl = 0x0010, // Combo control itself can be custom painted
+ PaintWritable = 0x0020, // A variable-width area in front of writable
+ // combo control's textctrl can be custom
+ // painted
+ Borderless = 0x0040, // wxNO_BORDER window style works
+
+ // There are no feature flags for...
+ // PushButtonBitmapBackground - if its in wxRendererNative, then it should be
+ // not an issue to have it automatically under the bitmap.
+
+ All = MovableButton|BitmapButton|
+ ButtonSpacing|TextIndent|
+ PaintControl|PaintWritable|
+ Borderless
+ };
+};
+
+
+class WXDLLIMPEXP_CORE wxComboCtrlBase : public wxControl,
+ public wxTextEntry
+{
+ friend class wxComboPopup;
+ friend class wxComboPopupEvtHandler;
+public:
+ // ctors and such
+ wxComboCtrlBase() : wxControl(), wxTextEntry() { Init(); }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxValidator& validator,
+ const wxString& name);
+
+ virtual ~wxComboCtrlBase();
+
+ // Show/hide popup window (wxComboBox-compatible methods)
+ virtual void Popup();
+ virtual void Dismiss()
+ {
+ HidePopup(true);
+ }
+
+ // Show/hide popup window.
+ // TODO: Maybe deprecate in favor of Popup()/Dismiss().
+ // However, these functions are still called internally
+ // so it is not straightforward.
+ virtual void ShowPopup();
+ virtual void HidePopup(bool generateEvent=false);
+
+ // Override for totally custom combo action
+ virtual void OnButtonClick();
+
+ // return true if the popup is currently shown
+ bool IsPopupShown() const { return m_popupWinState == Visible; }
+
+ // set interface class instance derived from wxComboPopup
+ // NULL popup can be used to indicate default in a derived class
+ void SetPopupControl( wxComboPopup* popup )
+ {
+ DoSetPopupControl(popup);
+ }
+
+ // get interface class instance derived from wxComboPopup
+ wxComboPopup* GetPopupControl()
+ {
+ EnsurePopupControl();
+ return m_popupInterface;
+ }
+
+ // get the popup window containing the popup control
+ wxWindow *GetPopupWindow() const { return m_winPopup; }
+
+ // Get the text control which is part of the combobox.
+ wxTextCtrl *GetTextCtrl() const { return m_text; }
+
+ // get the dropdown button which is part of the combobox
+ // note: its not necessarily a wxButton or wxBitmapButton
+ wxWindow *GetButton() const { return m_btn; }
+
+ // forward these methods to all subcontrols
+ virtual bool Enable(bool enable = true);
+ virtual bool Show(bool show = true);
+ virtual bool SetFont(const wxFont& font);
+
+ //
+ // wxTextEntry methods
+ //
+ // NB: We basically need to override all of them because there is
+ // no guarantee how platform-specific wxTextEntry is implemented.
+ //
+ virtual void SetValue(const wxString& value)
+ { wxTextEntryBase::SetValue(value); }
+ virtual void ChangeValue(const wxString& value)
+ { wxTextEntryBase::ChangeValue(value); }
+
+ virtual void WriteText(const wxString& text);
+ virtual void AppendText(const wxString& text)
+ { wxTextEntryBase::AppendText(text); }
+
+ virtual wxString GetValue() const
+ { return wxTextEntryBase::GetValue(); }
+
+ virtual wxString GetRange(long from, long to) const
+ { return wxTextEntryBase::GetRange(from, to); }
+
+ // Replace() and DoSetValue() need to be fully re-implemented since
+ // EventSuppressor utility class does not work with the way
+ // wxComboCtrl is implemented.
+ virtual void Replace(long from, long to, const wxString& value);
+
+ virtual void Remove(long from, long to);
+
+ virtual void Copy();
+ virtual void Cut();
+ virtual void Paste();
+
+ virtual void Undo();
+ virtual void Redo();
+ virtual bool CanUndo() const;
+ virtual bool CanRedo() const;
+
+ virtual void SetInsertionPoint(long pos);
+ virtual long GetInsertionPoint() const;
+ virtual long GetLastPosition() const;
+
+ virtual void SetSelection(long from, long to);
+ virtual void GetSelection(long *from, long *to) const;
+
+ virtual bool IsEditable() const;
+ virtual void SetEditable(bool editable);
+
+ virtual bool SetHint(const wxString& hint);
+ virtual wxString GetHint() const;
+
+ // This method sets the text without affecting list selection
+ // (ie. wxComboPopup::SetStringValue doesn't get called).
+ void SetText(const wxString& value);
+
+ // This method sets value and also optionally sends EVT_TEXT
+ // (needed by combo popups)
+ wxDEPRECATED( void SetValueWithEvent(const wxString& value,
+ bool withEvent = true) );
+
+ // Changes value of the control as if user had done it by selecting an
+ // item from a combo box drop-down list. Needs to be public so that
+ // derived popup classes can call it.
+ void SetValueByUser(const wxString& value);
+
+ //
+ // Popup customization methods
+ //
+
+ // Sets minimum width of the popup. If wider than combo control, it will extend to the left.
+ // Remarks:
+ // * Value -1 indicates the default.
+ // * Custom popup may choose to ignore this (wxOwnerDrawnComboBox does not).
+ void SetPopupMinWidth( int width )
+ {
+ m_widthMinPopup = width;
+ }
+
+ // Sets preferred maximum height of the popup.
+ // Remarks:
+ // * Value -1 indicates the default.
+ // * Custom popup may choose to ignore this (wxOwnerDrawnComboBox does not).
+ void SetPopupMaxHeight( int height )
+ {
+ m_heightPopup = height;
+ }
+
+ // Extends popup size horizontally, relative to the edges of the combo control.
+ // Remarks:
+ // * Popup minimum width may override extLeft (ie. it has higher precedence).
+ // * Values 0 indicate default.
+ // * Custom popup may not take this fully into account (wxOwnerDrawnComboBox takes).
+ void SetPopupExtents( int extLeft, int extRight )
+ {
+ m_extLeft = extLeft;
+ m_extRight = extRight;
+ }
+
+ // Set width, in pixels, of custom paint area in writable combo.
+ // In read-only, used to indicate area that is not covered by the
+ // focus rectangle (which may or may not be drawn, depending on the
+ // popup type).
+ void SetCustomPaintWidth( int width );
+ int GetCustomPaintWidth() const { return m_widthCustomPaint; }
+
+ // Set side of the control to which the popup will align itself.
+ // Valid values are wxLEFT, wxRIGHT and 0. The default value 0 wmeans
+ // that the side of the button will be used.
+ void SetPopupAnchor( int anchorSide )
+ {
+ m_anchorSide = anchorSide;
+ }
+
+ // Set position of dropdown button.
+ // width: button width. <= 0 for default.
+ // height: button height. <= 0 for default.
+ // side: wxLEFT or wxRIGHT, indicates on which side the button will be placed.
+ // spacingX: empty space on sides of the button. Default is 0.
+ // Remarks:
+ // There is no spacingY - the button will be centered vertically.
+ void SetButtonPosition( int width = -1,
+ int height = -1,
+ int side = wxRIGHT,
+ int spacingX = 0 );
+
+ // Returns current size of the dropdown button.
+ wxSize GetButtonSize();
+
+ //
+ // Sets dropbutton to be drawn with custom bitmaps.
+ //
+ // bmpNormal: drawn when cursor is not on button
+ // pushButtonBg: Draw push button background below the image.
+ // NOTE! This is usually only properly supported on platforms with appropriate
+ // method in wxRendererNative.
+ // bmpPressed: drawn when button is depressed
+ // bmpHover: drawn when cursor hovers on button. This is ignored on platforms
+ // that do not generally display hover differently.
+ // bmpDisabled: drawn when combobox is disabled.
+ void SetButtonBitmaps( const wxBitmap& bmpNormal,
+ bool pushButtonBg = false,
+ const wxBitmap& bmpPressed = wxNullBitmap,
+ const wxBitmap& bmpHover = wxNullBitmap,
+ const wxBitmap& bmpDisabled = wxNullBitmap );
+
+#if WXWIN_COMPATIBILITY_2_8
+ //
+ // This will set the space in pixels between left edge of the control and the
+ // text, regardless whether control is read-only (ie. no wxTextCtrl) or not.
+ // Platform-specific default can be set with value-1.
+ // Remarks
+ // * This method may do nothing on some native implementations.
+ wxDEPRECATED( void SetTextIndent( int indent ) );
+
+ // Returns actual indentation in pixels.
+ wxDEPRECATED( wxCoord GetTextIndent() const );
+#endif
+
+ // Returns area covered by the text field.
+ const wxRect& GetTextRect() const
+ {
+ return m_tcArea;
+ }
+
+ // Call with enable as true to use a type of popup window that guarantees ability
+ // to focus the popup control, and normal function of common native controls.
+ // This alternative popup window is usually a wxDialog, and as such it's parent
+ // frame will appear as if the focus has been lost from it.
+ void UseAltPopupWindow( bool enable = true )
+ {
+ wxASSERT_MSG( !m_winPopup,
+ wxT("call this only before SetPopupControl") );
+
+ if ( enable )
+ m_iFlags |= wxCC_IFLAG_USE_ALT_POPUP;
+ else
+ m_iFlags &= ~wxCC_IFLAG_USE_ALT_POPUP;
+ }
+
+ // Call with false to disable popup animation, if any.
+ void EnablePopupAnimation( bool enable = true )
+ {
+ if ( enable )
+ m_iFlags &= ~wxCC_IFLAG_DISABLE_POPUP_ANIM;
+ else
+ m_iFlags |= wxCC_IFLAG_DISABLE_POPUP_ANIM;
+ }
+
+ //
+ // Utilies needed by the popups or native implementations
+ //
+
+ // Returns true if given key combination should toggle the popup.
+ // NB: This is a separate from other keyboard handling because:
+ // 1) Replaceability.
+ // 2) Centralized code (otherwise it'd be split up between
+ // wxComboCtrl key handler and wxVListBoxComboPopup's
+ // key handler).
+ virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const = 0;
+
+ // Prepare background of combo control or an item in a dropdown list
+ // in a way typical on platform. This includes painting the focus/disabled
+ // background and setting the clipping region.
+ // Unless you plan to paint your own focus indicator, you should always call this
+ // in your wxComboPopup::PaintComboControl implementation.
+ // In addition, it sets pen and text colour to what looks good and proper
+ // against the background.
+ // flags: wxRendererNative flags: wxCONTROL_ISSUBMENU: is drawing a list item instead of combo control
+ // wxCONTROL_SELECTED: list item is selected
+ // wxCONTROL_DISABLED: control/item is disabled
+ virtual void PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const;
+
+ // Returns true if focus indicator should be drawn in the control.
+ bool ShouldDrawFocus() const
+ {
+ const wxWindow* curFocus = FindFocus();
+ return ( IsPopupWindowState(Hidden) &&
+ (curFocus == m_mainCtrlWnd || (m_btn && curFocus == m_btn)) &&
+ (m_windowStyle & wxCB_READONLY) );
+ }
+
+ // These methods return references to appropriate dropbutton bitmaps
+ const wxBitmap& GetBitmapNormal() const { return m_bmpNormal; }
+ const wxBitmap& GetBitmapPressed() const { return m_bmpPressed; }
+ const wxBitmap& GetBitmapHover() const { return m_bmpHover; }
+ const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; }
+
+ // Set custom style flags for embedded wxTextCtrl. Usually must be used
+ // with two-step creation, before Create() call.
+ void SetTextCtrlStyle( int style );
+
+ // Return internal flags
+ wxUint32 GetInternalFlags() const { return m_iFlags; }
+
+ // Return true if Create has finished
+ bool IsCreated() const { return m_iFlags & wxCC_IFLAG_CREATED ? true : false; }
+
+ // Need to override to return text area background colour
+ wxColour GetBackgroundColour() const;
+
+ // common code to be called on popup hide/dismiss
+ void OnPopupDismiss(bool generateEvent);
+
+ // PopupShown states
+ enum
+ {
+ Hidden = 0,
+ //Closing = 1,
+ Animating = 2,
+ Visible = 3
+ };
+
+ bool IsPopupWindowState( int state ) const { return (state == m_popupWinState) ? true : false; }
+
+ wxByte GetPopupWindowState() const { return m_popupWinState; }
+
+ // Set value returned by GetMainWindowOfCompositeControl
+ void SetCtrlMainWnd( wxWindow* wnd ) { m_mainCtrlWnd = wnd; }
+
+ // This is public so we can access it from wxComboCtrlTextCtrl
+ virtual wxWindow *GetMainWindowOfCompositeControl()
+ { return m_mainCtrlWnd; }
+
+ // also set the embedded wxTextCtrl colours
+ virtual bool SetForegroundColour(const wxColour& colour);
+ virtual bool SetBackgroundColour(const wxColour& colour);
+
+protected:
+
+ // Returns true if hint text should be drawn in the control
+ bool ShouldUseHintText(int flags = 0) const
+ {
+ return ( !m_text &&
+ !(flags & wxCONTROL_ISSUBMENU) &&
+ !m_valueString.length() &&
+ m_hintText.length() &&
+ !ShouldDrawFocus() );
+ }
+
+ //
+ // Override these for customization purposes
+ //
+
+ // called from wxSizeEvent handler
+ virtual void OnResize() = 0;
+
+ // Return native text identation
+ // (i.e. text margin, for pure text, not textctrl)
+ virtual wxCoord GetNativeTextIndent() const;
+
+ // Called in syscolourchanged handler and base create
+ virtual void OnThemeChange();
+
+ // Creates wxTextCtrl.
+ // extraStyle: Extra style parameters
+ void CreateTextCtrl( int extraStyle );
+
+ // Called when text was changed programmatically
+ // (e.g. from WriteText())
+ void OnSetValue(const wxString& value);
+
+ // Installs standard input handler to combo (and optionally to the textctrl)
+ void InstallInputHandlers();
+
+ // Flags for DrawButton
+ enum
+ {
+ Button_PaintBackground = 0x0001, // Paints control background below the button
+ Button_BitmapOnly = 0x0002 // Only paints the bitmap
+ };
+
+ // Draws dropbutton. Using wxRenderer or bitmaps, as appropriate.
+ // Flags are defined above.
+ virtual void DrawButton( wxDC& dc, const wxRect& rect, int flags = Button_PaintBackground );
+
+ // Call if cursor is on button area or mouse is captured for the button.
+ //bool HandleButtonMouseEvent( wxMouseEvent& event, bool isInside );
+ bool HandleButtonMouseEvent( wxMouseEvent& event, int flags );
+
+ // returns true if event was consumed or filtered (event type is also set to 0 in this case)
+ bool PreprocessMouseEvent( wxMouseEvent& event, int flags );
+
+ //
+ // This will handle left_down and left_dclick events outside button in a Windows-like manner.
+ // If you need alternate behaviour, it is recommended you manipulate and filter events to it
+ // instead of building your own handling routine (for reference, on wxEVT_LEFT_DOWN it will
+ // toggle popup and on wxEVT_LEFT_DCLICK it will do the same or run the popup's dclick method,
+ // if defined - you should pass events of other types of it for common processing).
+ void HandleNormalMouseEvent( wxMouseEvent& event );
+
+ // Creates popup window, calls interface->Create(), etc
+ void CreatePopup();
+
+ // Destroy popup window and all related constructs
+ void DestroyPopup();
+
+ // override the base class virtuals involved in geometry calculations
+ // The common version only sets a default width, so the derived classes
+ // should override it and set the height and change the width as needed.
+ virtual wxSize DoGetBestSize() const;
+ virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const;
+
+ // NULL popup can be used to indicate default in a derived class
+ virtual void DoSetPopupControl(wxComboPopup* popup);
+
+ // ensures there is atleast the default popup
+ void EnsurePopupControl();
+
+ // Recalculates button and textctrl areas. Called when size or button setup change.
+ // btnWidth: default/calculated width of the dropbutton. 0 means unchanged,
+ // just recalculate.
+ void CalculateAreas( int btnWidth = 0 );
+
+ // Standard textctrl positioning routine. Just give it platform-dependent
+ // textctrl coordinate adjustment.
+ virtual void PositionTextCtrl( int textCtrlXAdjust = 0,
+ int textCtrlYAdjust = 0);
+
+ // event handlers
+ void OnSizeEvent( wxSizeEvent& event );
+ void OnFocusEvent(wxFocusEvent& event);
+ void OnIdleEvent(wxIdleEvent& event);
+ void OnTextCtrlEvent(wxCommandEvent& event);
+ void OnSysColourChanged(wxSysColourChangedEvent& event);
+ void OnKeyEvent(wxKeyEvent& event);
+ void OnCharEvent(wxKeyEvent& event);
+
+ // Set customization flags (directs how wxComboCtrlBase helpers behave)
+ void Customize( wxUint32 flags ) { m_iFlags |= flags; }
+
+ // Dispatches size event and refreshes
+ void RecalcAndRefresh();
+
+ // Flags for DoShowPopup and AnimateShow
+ enum
+ {
+ ShowBelow = 0x0000, // Showing popup below the control
+ ShowAbove = 0x0001, // Showing popup above the control
+ CanDeferShow = 0x0002 // Can only return true from AnimateShow if this is set
+ };
+
+ // Shows and positions the popup.
+ virtual void DoShowPopup( const wxRect& rect, int flags );
+
+ // Implement in derived class to create a drop-down animation.
+ // Return true if finished immediately. Otherwise popup is only
+ // shown when the derived class call DoShowPopup.
+ // Flags are same as for DoShowPopup.
+ virtual bool AnimateShow( const wxRect& rect, int flags );
+
+#if wxUSE_TOOLTIPS
+ virtual void DoSetToolTip( wxToolTip *tip );
+#endif
+
+ // protected wxTextEntry methods
+ virtual void DoSetValue(const wxString& value, int flags);
+ virtual wxString DoGetValue() const;
+ virtual wxWindow *GetEditableWindow() { return this; }
+
+ // margins functions
+ virtual bool DoSetMargins(const wxPoint& pt);
+ virtual wxPoint DoGetMargins() const;
+
+ // This is used when m_text is hidden (readonly).
+ wxString m_valueString;
+
+ // This is used when control is unfocused and m_valueString is empty
+ wxString m_hintText;
+
+ // the text control and button we show all the time
+ wxTextCtrl* m_text;
+ wxWindow* m_btn;
+
+ // wxPopupWindow or similar containing the window managed by the interface.
+ wxWindow* m_winPopup;
+
+ // the popup control/panel
+ wxWindow* m_popup;
+
+ // popup interface
+ wxComboPopup* m_popupInterface;
+
+ // this is input etc. handler for the text control
+ wxEvtHandler* m_textEvtHandler;
+
+ // this is for the top level window
+ wxEvtHandler* m_toplevEvtHandler;
+
+ // this is for the control in popup
+ wxEvtHandler* m_popupEvtHandler;
+
+ // this is for the popup window
+ wxEvtHandler* m_popupWinEvtHandler;
+
+ // main (ie. topmost) window of a composite control (default = this)
+ wxWindow* m_mainCtrlWnd;
+
+ // used to prevent immediate re-popupping in case closed popup
+ // by clicking on the combo control (needed because of inconsistent
+ // transient implementation across platforms).
+ wxLongLong m_timeCanAcceptClick;
+
+ // how much popup should expand to the left/right of the control
+ wxCoord m_extLeft;
+ wxCoord m_extRight;
+
+ // minimum popup width
+ wxCoord m_widthMinPopup;
+
+ // preferred popup height
+ wxCoord m_heightPopup;
+
+ // how much of writable combo is custom-paint by callback?
+ // also used to indicate area that is not covered by "blue"
+ // selection indicator.
+ wxCoord m_widthCustomPaint;
+
+ // left margin, in pixels
+ wxCoord m_marginLeft;
+
+ // side on which the popup is aligned
+ int m_anchorSide;
+
+ // Width of the "fake" border
+ wxCoord m_widthCustomBorder;
+
+ // The button and textctrl click/paint areas
+ wxRect m_tcArea;
+ wxRect m_btnArea;
+
+ // Colour of the text area, in case m_text is NULL
+ wxColour m_tcBgCol;
+
+ // current button state (uses renderer flags)
+ int m_btnState;
+
+ // button position
+ int m_btnWid;
+ int m_btnHei;
+ int m_btnSide;
+ int m_btnSpacingX;
+
+ // last default button width
+ int m_btnWidDefault;
+
+ // custom dropbutton bitmaps
+ wxBitmap m_bmpNormal;
+ wxBitmap m_bmpPressed;
+ wxBitmap m_bmpHover;
+ wxBitmap m_bmpDisabled;
+
+ // area used by the button
+ wxSize m_btnSize;
+
+ // platform-dependent customization and other flags
+ wxUint32 m_iFlags;
+
+ // custom style for m_text
+ int m_textCtrlStyle;
+
+ // draw blank button background under bitmap?
+ bool m_blankButtonBg;
+
+ // is the popup window currenty shown?
+ wxByte m_popupWinState;
+
+ // should the focus be reset to the textctrl in idle time?
+ bool m_resetFocus;
+
+ // is the text-area background colour overridden?
+ bool m_hasTcBgCol;
+
+private:
+ void Init();
+
+ wxByte m_ignoreEvtText; // Number of next EVT_TEXTs to ignore
+
+ // Is popup window wxPopupTransientWindow, wxPopupWindow or wxDialog?
+ wxByte m_popupWinType;
+
+ DECLARE_EVENT_TABLE()
+
+ DECLARE_ABSTRACT_CLASS(wxComboCtrlBase)
+};
+
+
+// ----------------------------------------------------------------------------
+// wxComboPopup is the interface which must be implemented by a control to be
+// used as a popup by wxComboCtrl
+// ----------------------------------------------------------------------------
+
+
+// wxComboPopup internal flags
+enum
+{
+ wxCP_IFLAG_CREATED = 0x0001 // Set by wxComboCtrlBase after Create is called
+};
+
+class WXDLLIMPEXP_FWD_CORE wxComboCtrl;
+
+
+class WXDLLIMPEXP_CORE wxComboPopup
+{
+ friend class wxComboCtrlBase;
+public:
+ wxComboPopup()
+ {
+ m_combo = NULL;
+ m_iFlags = 0;
+ }
+
+ // This is called immediately after construction finishes. m_combo member
+ // variable has been initialized before the call.
+ // NOTE: It is not in constructor so the derived class doesn't need to redefine
+ // a default constructor of its own.
+ virtual void Init() { }
+
+ virtual ~wxComboPopup();
+
+ // Create the popup child control.
+ // Return true for success.
+ virtual bool Create(wxWindow* parent) = 0;
+
+ // Calls Destroy() for the popup control (i.e. one returned by
+ // GetControl()) and makes sure that 'this' is deleted at the end.
+ // Default implementation works for both cases where popup control
+ // class is multiple inherited or created on heap as a separate
+ // object.
+ virtual void DestroyPopup();
+
+ // We must have an associated control which is subclassed by the combobox.
+ virtual wxWindow *GetControl() = 0;
+
+ // Called immediately after the popup is shown
+ virtual void OnPopup();
+
+ // Called when popup is dismissed
+ virtual void OnDismiss();
+
+ // Called just prior to displaying popup.
+ // Default implementation does nothing.
+ virtual void SetStringValue( const wxString& value );
+
+ // Gets displayed string representation of the value.
+ virtual wxString GetStringValue() const = 0;
+
+ // Called to check if the popup - when an item container - actually
+ // has matching item. Case-sensitivity checking etc. is up to the
+ // implementation. If the found item matched the string, but is
+ // different, it should be written back to pItem. Default implementation
+ // always return true and does not alter trueItem.
+ virtual bool FindItem(const wxString& item, wxString* trueItem=NULL);
+
+ // This is called to custom paint in the combo control itself (ie. not the popup).
+ // Default implementation draws value as string.
+ virtual void PaintComboControl( wxDC& dc, const wxRect& rect );
+
+ // Receives wxEVT_KEY_DOWN key events from the parent wxComboCtrl.
+ // Events not handled should be skipped, as usual.
+ virtual void OnComboKeyEvent( wxKeyEvent& event );
+
+ // Receives wxEVT_CHAR key events from the parent wxComboCtrl.
+ // Events not handled should be skipped, as usual.
+ virtual void OnComboCharEvent( wxKeyEvent& event );
+
+ // Implement if you need to support special action when user
+ // double-clicks on the parent wxComboCtrl.
+ virtual void OnComboDoubleClick();
+
+ // Return final size of popup. Called on every popup, just prior to OnShow.
+ // minWidth = preferred minimum width for window
+ // prefHeight = preferred height. Only applies if > 0,
+ // maxHeight = max height for window, as limited by screen size
+ // and should only be rounded down, if necessary.
+ virtual wxSize GetAdjustedSize( int minWidth, int prefHeight, int maxHeight );
+
+ // Return true if you want delay call to Create until the popup is shown
+ // for the first time. It is more efficient, but note that it is often
+ // more convenient to have the control created immediately.
+ // Default returns false.
+ virtual bool LazyCreate();
+
+ //
+ // Utilies
+ //
+
+ // Hides the popup
+ void Dismiss();
+
+ // Returns true if Create has been called.
+ bool IsCreated() const
+ {
+ return (m_iFlags & wxCP_IFLAG_CREATED) ? true : false;
+ }
+
+ // Returns pointer to the associated parent wxComboCtrl.
+ wxComboCtrl* GetComboCtrl() const;
+
+ // Default PaintComboControl behaviour
+ static void DefaultPaintComboControl( wxComboCtrlBase* combo,
+ wxDC& dc,
+ const wxRect& rect );
+
+protected:
+ wxComboCtrlBase* m_combo;
+ wxUint32 m_iFlags;
+
+private:
+ // Called in wxComboCtrlBase::SetPopupControl
+ void InitBase(wxComboCtrlBase *combo)
+ {
+ m_combo = combo;
+ }
+};
+
+
+// ----------------------------------------------------------------------------
+// include the platform-dependent header defining the real class
+// ----------------------------------------------------------------------------
+
+#if defined(__WXUNIVERSAL__)
+ // No native universal (but it must still be first in the list)
+#elif defined(__WXMSW__)
+ #include "wx/msw/combo.h"
+#endif
+
+// Any ports may need generic as an alternative
+#include "wx/generic/combo.h"
+
+#endif // wxUSE_COMBOCTRL
+
+#endif
+ // _WX_COMBOCONTROL_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/combobox.h
+// Purpose: wxComboBox declaration
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 24.12.00
+// Copyright: (c) 1996-2000 wxWidgets team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_COMBOBOX_H_BASE_
+#define _WX_COMBOBOX_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_COMBOBOX
+
+// For compatibility with 2.8 include this header to allow using wxTE_XXX
+// styles with wxComboBox without explicitly including it in the user code.
+#include "wx/textctrl.h"
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[];
+
+// ----------------------------------------------------------------------------
+// wxComboBoxBase: this interface defines the methods wxComboBox must implement
+// ----------------------------------------------------------------------------
+
+#include "wx/ctrlsub.h"
+#include "wx/textentry.h"
+
+class WXDLLIMPEXP_CORE wxComboBoxBase : public wxItemContainer,
+ public wxTextEntry
+{
+public:
+ // override these methods to disambiguate between two base classes versions
+ virtual void Clear()
+ {
+ wxTextEntry::Clear();
+ wxItemContainer::Clear();
+ }
+
+ // IsEmpty() is ambiguous because we inherit it from both wxItemContainer
+ // and wxTextEntry, and even if defined it here to help the compiler with
+ // choosing one of them, it would still be confusing for the human users of
+ // this class. So instead define the clearly named methods below and leave
+ // IsEmpty() ambiguous to trigger a compilation error if it's used.
+ bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
+ bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
+
+ // also bring in GetSelection() versions of both base classes in scope
+ //
+ // NB: GetSelection(from, to) could be already implemented in wxTextEntry
+ // but still make it pure virtual because for some platforms it's not
+ // implemented there and also because the derived class has to override
+ // it anyhow to avoid ambiguity with the other GetSelection()
+ virtual int GetSelection() const = 0;
+ virtual void GetSelection(long *from, long *to) const = 0;
+
+ virtual void Popup() { wxFAIL_MSG( wxT("Not implemented") ); }
+ virtual void Dismiss() { wxFAIL_MSG( wxT("Not implemented") ); }
+
+ // may return value different from GetSelection() when the combobox
+ // dropdown is shown and the user selected, but not yet accepted, a value
+ // different from the old one in it
+ virtual int GetCurrentSelection() const { return GetSelection(); }
+};
+
+// ----------------------------------------------------------------------------
+// include the platform-dependent header defining the real class
+// ----------------------------------------------------------------------------
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/combobox.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/combobox.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/combobox.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/combobox.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/combobox.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/combobox.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/combobox.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/combobox.h"
+#endif
+
+#endif // wxUSE_COMBOBOX
+
+#endif // _WX_COMBOBOX_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/commandlinkbutton.h
+// Purpose: wxCommandLinkButtonBase and wxGenericCommandLinkButton classes
+// Author: Rickard Westerlund
+// Created: 2010-06-11
+// Copyright: (c) 2010 wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_COMMANDLINKBUTTON_H_
+#define _WX_COMMANDLINKBUTTON_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_COMMANDLINKBUTTON
+
+#include "wx/button.h"
+
+// ----------------------------------------------------------------------------
+// Command link button common base class
+// ----------------------------------------------------------------------------
+
+// This class has separate "main label" (title-like string) and (possibly
+// multiline) "note" which can be set and queried separately but can also be
+// set both at once by joining them with a new line and setting them as a
+// label and queried by breaking the label into the parts before the first new
+// line and after it.
+
+class WXDLLIMPEXP_ADV wxCommandLinkButtonBase : public wxButton
+{
+public:
+ wxCommandLinkButtonBase() : wxButton() { }
+
+ wxCommandLinkButtonBase(wxWindow *parent,
+ wxWindowID id,
+ const wxString& mainLabel = wxEmptyString,
+ const wxString& note = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator =
+ wxDefaultValidator,
+ const wxString& name = wxButtonNameStr)
+ : wxButton(parent,
+ id,
+ mainLabel + '\n' + note,
+ pos,
+ size,
+ style,
+ validator,
+ name)
+ { }
+
+ virtual void SetMainLabelAndNote(const wxString& mainLabel,
+ const wxString& note) = 0;
+
+ virtual void SetMainLabel(const wxString& mainLabel)
+ {
+ SetMainLabelAndNote(mainLabel, GetNote());
+ }
+
+ virtual void SetNote(const wxString& note)
+ {
+ SetMainLabelAndNote(GetMainLabel(), note);
+ }
+
+ virtual wxString GetMainLabel() const
+ {
+ return GetLabel().BeforeFirst('\n');
+ }
+
+ virtual wxString GetNote() const
+ {
+ return GetLabel().AfterFirst('\n');
+ }
+
+protected:
+ virtual bool HasNativeBitmap() const { return false; }
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxCommandLinkButtonBase);
+};
+
+// ----------------------------------------------------------------------------
+// Generic command link button
+// ----------------------------------------------------------------------------
+
+// Trivial generic implementation simply using a multiline label to show both
+// the main label and the note.
+
+class WXDLLIMPEXP_ADV wxGenericCommandLinkButton
+ : public wxCommandLinkButtonBase
+{
+public:
+ wxGenericCommandLinkButton() : wxCommandLinkButtonBase() { }
+
+
+ wxGenericCommandLinkButton(wxWindow *parent,
+ wxWindowID id,
+ const wxString& mainLabel = wxEmptyString,
+ const wxString& note = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr)
+ : wxCommandLinkButtonBase()
+ {
+ Create(parent, id, mainLabel, note, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& mainLabel = wxEmptyString,
+ const wxString& note = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr);
+
+ virtual void SetMainLabelAndNote(const wxString& mainLabel,
+ const wxString& note)
+ {
+ wxButton::SetLabel(mainLabel + '\n' + note);
+ }
+
+private:
+ void SetDefaultBitmap();
+
+ wxDECLARE_NO_COPY_CLASS(wxGenericCommandLinkButton);
+};
+
+#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
+ #include "wx/msw/commandlinkbutton.h"
+#else
+ class WXDLLIMPEXP_ADV wxCommandLinkButton : public wxGenericCommandLinkButton
+ {
+ public:
+ wxCommandLinkButton() : wxGenericCommandLinkButton() { }
+
+ wxCommandLinkButton(wxWindow *parent,
+ wxWindowID id,
+ const wxString& mainLabel = wxEmptyString,
+ const wxString& note = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr)
+ : wxGenericCommandLinkButton(parent,
+ id,
+ mainLabel,
+ note,
+ pos,
+ size,
+ style,
+ validator,
+ name)
+ { }
+
+ private:
+ wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxCommandLinkButton);
+ };
+#endif // __WXMSW__/!__WXMSW__
+
+#endif // wxUSE_COMMANDLINKBUTTON
+
+#endif // _WX_COMMANDLINKBUTTON_H_
--- /dev/null
+/*
+ * Name: wx/compiler.h
+ * Purpose: Compiler-specific macro definitions.
+ * Author: Vadim Zeitlin
+ * Created: 2013-07-13 (extracted from wx/platform.h)
+ * Copyright: (c) 1997-2013 Vadim Zeitlin <vadim@wxwidgets.org>
+ * Licence: wxWindows licence
+ */
+
+/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
+
+#ifndef _WX_COMPILER_H_
+#define _WX_COMPILER_H_
+
+/*
+ Compiler detection and related helpers.
+ */
+
+/*
+ Notice that Intel compiler can be used as Microsoft Visual C++ add-on and
+ so we should define both __INTELC__ and __VISUALC__ for it.
+*/
+#ifdef __INTEL_COMPILER
+# define __INTELC__
+#endif
+
+#if defined(_MSC_VER)
+ /*
+ define another standard symbol for Microsoft Visual C++: the standard
+ one (_MSC_VER) is also defined by some other compilers.
+ */
+# define __VISUALC__ _MSC_VER
+
+ /*
+ define special symbols for different VC version instead of writing tests
+ for magic numbers such as 1200, 1300 &c repeatedly
+ */
+#if __VISUALC__ < 1100
+# error "This Visual C++ version is too old and not supported any longer."
+#elif __VISUALC__ < 1200
+# define __VISUALC5__
+#elif __VISUALC__ < 1300
+# define __VISUALC6__
+#elif __VISUALC__ < 1400
+# define __VISUALC7__
+#elif __VISUALC__ < 1500
+# define __VISUALC8__
+#elif __VISUALC__ < 1600
+# define __VISUALC9__
+#elif __VISUALC__ < 1700
+# define __VISUALC10__
+#elif __VISUALC__ < 1800
+# define __VISUALC11__
+#elif __VISUALC__ < 1900
+# define __VISUALC12__
+#else
+# pragma message("Please update wx/compiler.h to recognize this VC++ version")
+#endif
+
+#elif defined(__BCPLUSPLUS__) && !defined(__BORLANDC__)
+# define __BORLANDC__
+#elif defined(__WATCOMC__)
+#elif defined(__SC__)
+# define __SYMANTECC__
+#elif defined(__SUNPRO_CC)
+# ifndef __SUNCC__
+# define __SUNCC__ __SUNPRO_CC
+# endif /* Sun CC */
+#elif defined(__SC__)
+# ifdef __DMC__
+# define __DIGITALMARS__
+# else
+# define __SYMANTEC__
+# endif
+#endif /* compiler */
+
+/*
+ Macros for checking compiler version.
+*/
+
+/*
+ This macro can be used to test the gcc version and can be used like this:
+
+# if wxCHECK_GCC_VERSION(3, 1)
+ ... we have gcc 3.1 or later ...
+# else
+ ... no gcc at all or gcc < 3.1 ...
+# endif
+*/
+#if defined(__GNUC__) && defined(__GNUC_MINOR__)
+ #define wxCHECK_GCC_VERSION( major, minor ) \
+ ( ( __GNUC__ > (major) ) \
+ || ( __GNUC__ == (major) && __GNUC_MINOR__ >= (minor) ) )
+#else
+ #define wxCHECK_GCC_VERSION( major, minor ) 0
+#endif
+
+/*
+ This macro can be used to test the Visual C++ version.
+*/
+#ifndef __VISUALC__
+# define wxVISUALC_VERSION(major) 0
+# define wxCHECK_VISUALC_VERSION(major) 0
+#else
+# define wxVISUALC_VERSION(major) ( (6 + major) * 100 )
+# define wxCHECK_VISUALC_VERSION(major) ( __VISUALC__ >= wxVISUALC_VERSION(major) )
+#endif
+
+/**
+ This is similar to wxCHECK_GCC_VERSION but for Sun CC compiler.
+ */
+#ifdef __SUNCC__
+ /*
+ __SUNCC__ is 0xVRP where V is major version, R release and P patch level
+ */
+ #define wxCHECK_SUNCC_VERSION(maj, min) (__SUNCC__ >= (((maj)<<8) | ((min)<<4)))
+#else
+ #define wxCHECK_SUNCC_VERSION(maj, min) (0)
+#endif
+
+#ifndef __WATCOMC__
+# define wxWATCOM_VERSION(major,minor) 0
+# define wxCHECK_WATCOM_VERSION(major,minor) 0
+# define wxONLY_WATCOM_EARLIER_THAN(major,minor) 0
+# define WX_WATCOM_ONLY_CODE( x )
+#else
+# if __WATCOMC__ < 1200
+# error "Only Open Watcom is supported in this release"
+# endif
+
+# define wxWATCOM_VERSION(major,minor) ( major * 100 + minor * 10 + 1100 )
+# define wxCHECK_WATCOM_VERSION(major,minor) ( __WATCOMC__ >= wxWATCOM_VERSION(major,minor) )
+# define wxONLY_WATCOM_EARLIER_THAN(major,minor) ( __WATCOMC__ < wxWATCOM_VERSION(major,minor) )
+# define WX_WATCOM_ONLY_CODE( x ) x
+#endif
+
+/*
+ This macro can be used to check that the version of mingw32 compiler is
+ at least maj.min
+ */
+
+/* Check for Mingw runtime version: */
+#if defined(__MINGW32_MAJOR_VERSION) && defined(__MINGW32_MINOR_VERSION)
+ #define wxCHECK_MINGW32_VERSION( major, minor ) \
+ ( ( ( __MINGW32_MAJOR_VERSION > (major) ) \
+ || ( __MINGW32_MAJOR_VERSION == (major) && __MINGW32_MINOR_VERSION >= (minor) ) ) )
+
+/*
+ MinGW-w64 project provides compilers for both Win32 and Win64 but only
+ defines the same __MINGW32__ symbol for the former as MinGW32 toolchain
+ which is quite different (notably doesn't provide many SDK headers that
+ MinGW-w64 does include). So we define a separate symbol which, unlike the
+ predefined __MINGW64__, can be used to detect this toolchain in both 32 and
+ 64 bit builds.
+
+ And define __MINGW32_TOOLCHAIN__ for consistency and also because it's
+ convenient as we often want to have some workarounds only for the (old)
+ MinGW32 but not (newer) MinGW-w64, which still predefines __MINGW32__.
+ */
+# ifdef __MINGW64_VERSION_MAJOR
+# ifndef __MINGW64_TOOLCHAIN__
+# define __MINGW64_TOOLCHAIN__
+# endif
+# else
+# ifndef __MINGW32_TOOLCHAIN__
+# define __MINGW32_TOOLCHAIN__
+# endif
+# endif
+#else
+ #define wxCHECK_MINGW32_VERSION( major, minor ) (0)
+#endif
+
+#endif // _WX_COMPILER_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/compositewin.h
+// Purpose: wxCompositeWindow<> declaration
+// Author: Vadim Zeitlin
+// Created: 2011-01-02
+// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_COMPOSITEWIN_H_
+#define _WX_COMPOSITEWIN_H_
+
+#include "wx/window.h"
+#include "wx/containr.h"
+
+class WXDLLIMPEXP_FWD_CORE wxToolTip;
+
+// NB: This is an experimental and, as for now, undocumented class used only by
+// wxWidgets itself internally. Don't use it in your code until its API is
+// officially stabilized unless you are ready to change it with the next
+// wxWidgets release.
+
+// ----------------------------------------------------------------------------
+// wxCompositeWindow is a helper for implementing composite windows: to define
+// a class using subwindows, simply inherit from it specialized with the real
+// base class name and implement GetCompositeWindowParts() pure virtual method.
+// ----------------------------------------------------------------------------
+
+// The template parameter W must be a wxWindow-derived class.
+template <class W>
+class wxCompositeWindow : public W
+{
+public:
+ typedef W BaseWindowClass;
+
+ // Default ctor doesn't do anything.
+ wxCompositeWindow()
+ {
+ this->Connect
+ (
+ wxEVT_CREATE,
+ wxWindowCreateEventHandler(wxCompositeWindow::OnWindowCreate)
+ );
+
+ }
+
+#ifndef __VISUALC6__
+ // FIXME-VC6: This compiler can't compile DoSetForAllParts() template function,
+ // it can't determine whether the deduced type should be "T" or "const T&". And
+ // without this function wxCompositeWindow is pretty useless so simply disable
+ // this code for it, this does mean that setting colours/fonts/... for
+ // composite controls won't work in the library compiled with it but so far
+ // this only affects the generic wxDatePickerCtrl which is not used by default
+ // under MSW anyhow so it doesn't seem to be worth it to spend time and uglify
+ // the code to fix it.
+
+ // Override all wxWindow methods which must be forwarded to the composite
+ // window parts.
+
+ // Attribute setters group.
+ //
+ // NB: Unfortunately we can't factor out the call for the setter itself
+ // into DoSetForAllParts() because we can't call the function passed to
+ // it non-virtually and we need to do this to avoid infinite recursion,
+ // so we work around this by calling the method of this object itself
+ // manually in each function.
+ virtual bool SetForegroundColour(const wxColour& colour)
+ {
+ if ( !BaseWindowClass::SetForegroundColour(colour) )
+ return false;
+
+ SetForAllParts(&wxWindowBase::SetForegroundColour, colour);
+
+ return true;
+ }
+
+ virtual bool SetBackgroundColour(const wxColour& colour)
+ {
+ if ( !BaseWindowClass::SetBackgroundColour(colour) )
+ return false;
+
+ SetForAllParts(&wxWindowBase::SetBackgroundColour, colour);
+
+ return true;
+ }
+
+ virtual bool SetFont(const wxFont& font)
+ {
+ if ( !BaseWindowClass::SetFont(font) )
+ return false;
+
+ SetForAllParts(&wxWindowBase::SetFont, font);
+
+ return true;
+ }
+
+ virtual bool SetCursor(const wxCursor& cursor)
+ {
+ if ( !BaseWindowClass::SetCursor(cursor) )
+ return false;
+
+ SetForAllParts(&wxWindowBase::SetCursor, cursor);
+
+ return true;
+ }
+
+#if wxUSE_TOOLTIPS
+ virtual void DoSetToolTip(wxToolTip *tip)
+ {
+ BaseWindowClass::DoSetToolTip(tip);
+
+ SetForAllParts(&wxWindowBase::CopyToolTip, tip);
+ }
+#endif // wxUSE_TOOLTIPS
+
+#endif // !__VISUALC6__
+
+ virtual void SetFocus()
+ {
+ wxSetFocusToChild(this, NULL);
+ }
+
+private:
+ // Must be implemented by the derived class to return all children to which
+ // the public methods we override should forward to.
+ virtual wxWindowList GetCompositeWindowParts() const = 0;
+
+ void OnWindowCreate(wxWindowCreateEvent& event)
+ {
+ event.Skip();
+
+ // Attach a few event handlers to all parts of the composite window.
+ // This makes the composite window behave more like a simple control
+ // and allows other code (such as wxDataViewCtrl's inline editing
+ // support) to hook into its event processing.
+
+ wxWindow *child = event.GetWindow();
+ if ( child == this )
+ return; // not a child, we don't want to Connect() to ourselves
+
+ // Always capture wxEVT_KILL_FOCUS:
+ child->Connect(wxEVT_KILL_FOCUS,
+ wxFocusEventHandler(wxCompositeWindow::OnKillFocus),
+ NULL, this);
+
+ // Some events should be only handled for non-toplevel children. For
+ // example, we want to close the control in wxDataViewCtrl when Enter
+ // is pressed in the inline editor, but not when it's pressed in a
+ // popup dialog it opens.
+ wxWindow *win = child;
+ while ( win && win != this )
+ {
+ if ( win->IsTopLevel() )
+ return;
+ win = win->GetParent();
+ }
+
+ child->Connect(wxEVT_CHAR,
+ wxKeyEventHandler(wxCompositeWindow::OnChar),
+ NULL, this);
+ }
+
+ void OnChar(wxKeyEvent& event)
+ {
+ if ( !this->ProcessWindowEvent(event) )
+ event.Skip();
+ }
+
+ void OnKillFocus(wxFocusEvent& event)
+ {
+ // Ignore focus changes within the composite control:
+ wxWindow *win = event.GetWindow();
+ while ( win )
+ {
+ if ( win == this )
+ {
+ event.Skip();
+ return;
+ }
+
+ // Note that we don't use IsTopLevel() check here, because we do
+ // want to ignore focus changes going to toplevel window that have
+ // the composite control as its parent; these would typically be
+ // some kind of control's popup window.
+ win = win->GetParent();
+ }
+
+ // The event shouldn't be ignored, forward it to the main control:
+ if ( !this->ProcessWindowEvent(event) )
+ event.Skip();
+ }
+
+#ifndef __VISUALC6__
+ template <class T>
+ void SetForAllParts(bool (wxWindowBase::*func)(const T&), const T& arg)
+ {
+ DoSetForAllParts<const T&>(func, arg);
+ }
+
+ template <class T>
+ void SetForAllParts(bool (wxWindowBase::*func)(T*), T* arg)
+ {
+ DoSetForAllParts<T*>(func, arg);
+ }
+
+ template <class T>
+ void DoSetForAllParts(bool (wxWindowBase::*func)(T), T arg)
+ {
+ // Simply call the setters for all parts of this composite window.
+ const wxWindowList parts = GetCompositeWindowParts();
+ for ( wxWindowList::const_iterator i = parts.begin();
+ i != parts.end();
+ ++i )
+ {
+ wxWindow * const child = *i;
+
+ // Allow NULL elements in the list, this makes the code of derived
+ // composite controls which may have optionally shown children
+ // simpler and it doesn't cost us much here.
+ if ( child )
+ (child->*func)(arg);
+ }
+ }
+#endif // !__VISUALC6__
+
+ wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCompositeWindow, W);
+};
+
+#endif // _WX_COMPOSITEWIN_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/confbase.h
+// Purpose: declaration of the base class of all config implementations
+// (see also: fileconf.h and msw/regconf.h and iniconf.h)
+// Author: Karsten Ballueder & Vadim Zeitlin
+// Modified by:
+// Created: 07.04.98 (adapted from appconf.h)
+// Copyright: (c) 1997 Karsten Ballueder Ballueder@usa.net
+// Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CONFBASE_H_
+#define _WX_CONFBASE_H_
+
+#include "wx/defs.h"
+#include "wx/string.h"
+#include "wx/object.h"
+#include "wx/base64.h"
+
+class WXDLLIMPEXP_FWD_BASE wxArrayString;
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+/// shall we be case sensitive in parsing variable names?
+#ifndef wxCONFIG_CASE_SENSITIVE
+ #define wxCONFIG_CASE_SENSITIVE 0
+#endif
+
+/// separates group and entry names (probably shouldn't be changed)
+#ifndef wxCONFIG_PATH_SEPARATOR
+ #define wxCONFIG_PATH_SEPARATOR wxT('/')
+#endif
+
+/// introduces immutable entries
+// (i.e. the ones which can't be changed from the local config file)
+#ifndef wxCONFIG_IMMUTABLE_PREFIX
+ #define wxCONFIG_IMMUTABLE_PREFIX wxT('!')
+#endif
+
+#if wxUSE_CONFIG
+
+/// should we use registry instead of configuration files under Windows?
+// (i.e. whether wxConfigBase::Create() will create a wxFileConfig (if it's
+// false) or wxRegConfig (if it's true and we're under Win32))
+#ifndef wxUSE_CONFIG_NATIVE
+ #define wxUSE_CONFIG_NATIVE 1
+#endif
+
+// not all compilers can deal with template Read/Write() methods, define this
+// symbol if the template functions are available
+#if (!defined(__VISUALC__) || __VISUALC__ > 1200) && \
+ !defined( __VMS ) && \
+ !(defined(__HP_aCC) && defined(__hppa)) && \
+ !defined (__DMC__)
+ #define wxHAS_CONFIG_TEMPLATE_RW
+#endif
+
+// Style flags for constructor style parameter
+enum
+{
+ wxCONFIG_USE_LOCAL_FILE = 1,
+ wxCONFIG_USE_GLOBAL_FILE = 2,
+ wxCONFIG_USE_RELATIVE_PATH = 4,
+ wxCONFIG_USE_NO_ESCAPE_CHARACTERS = 8,
+ wxCONFIG_USE_SUBDIR = 16
+};
+
+// ----------------------------------------------------------------------------
+// abstract base class wxConfigBase which defines the interface for derived
+// classes
+//
+// wxConfig organizes the items in a tree-like structure (modelled after the
+// Unix/Dos filesystem). There are groups (directories) and keys (files).
+// There is always one current group given by the current path.
+//
+// Keys are pairs "key_name = value" where value may be of string or integer
+// (long) type (TODO doubles and other types such as wxDate coming soon).
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxConfigBase : public wxObject
+{
+public:
+ // constants
+ // the type of an entry
+ enum EntryType
+ {
+ Type_Unknown,
+ Type_String,
+ Type_Boolean,
+ Type_Integer, // use Read(long *)
+ Type_Float // use Read(double *)
+ };
+
+ // static functions
+ // sets the config object, returns the previous pointer
+ static wxConfigBase *Set(wxConfigBase *pConfig);
+ // get the config object, creates it on demand unless DontCreateOnDemand
+ // was called
+ static wxConfigBase *Get(bool createOnDemand = true)
+ { if ( createOnDemand && (!ms_pConfig) ) Create(); return ms_pConfig; }
+ // create a new config object: this function will create the "best"
+ // implementation of wxConfig available for the current platform, see
+ // comments near definition wxUSE_CONFIG_NATIVE for details. It returns
+ // the created object and also sets it as ms_pConfig.
+ static wxConfigBase *Create();
+ // should Get() try to create a new log object if the current one is NULL?
+ static void DontCreateOnDemand() { ms_bAutoCreate = false; }
+
+ // ctor & virtual dtor
+ // ctor (can be used as default ctor too)
+ //
+ // Not all args will always be used by derived classes, but including
+ // them all in each class ensures compatibility. If appName is empty,
+ // uses wxApp name
+ wxConfigBase(const wxString& appName = wxEmptyString,
+ const wxString& vendorName = wxEmptyString,
+ const wxString& localFilename = wxEmptyString,
+ const wxString& globalFilename = wxEmptyString,
+ long style = 0);
+
+ // empty but ensures that dtor of all derived classes is virtual
+ virtual ~wxConfigBase();
+
+ // path management
+ // set current path: if the first character is '/', it's the absolute path,
+ // otherwise it's a relative path. '..' is supported. If the strPath
+ // doesn't exist it is created.
+ virtual void SetPath(const wxString& strPath) = 0;
+ // retrieve the current path (always as absolute path)
+ virtual const wxString& GetPath() const = 0;
+
+ // enumeration: all functions here return false when there are no more items.
+ // you must pass the same lIndex to GetNext and GetFirst (don't modify it)
+ // enumerate subgroups
+ virtual bool GetFirstGroup(wxString& str, long& lIndex) const = 0;
+ virtual bool GetNextGroup (wxString& str, long& lIndex) const = 0;
+ // enumerate entries
+ virtual bool GetFirstEntry(wxString& str, long& lIndex) const = 0;
+ virtual bool GetNextEntry (wxString& str, long& lIndex) const = 0;
+ // get number of entries/subgroups in the current group, with or without
+ // it's subgroups
+ virtual size_t GetNumberOfEntries(bool bRecursive = false) const = 0;
+ virtual size_t GetNumberOfGroups(bool bRecursive = false) const = 0;
+
+ // tests of existence
+ // returns true if the group by this name exists
+ virtual bool HasGroup(const wxString& strName) const = 0;
+ // same as above, but for an entry
+ virtual bool HasEntry(const wxString& strName) const = 0;
+ // returns true if either a group or an entry with a given name exist
+ bool Exists(const wxString& strName) const
+ { return HasGroup(strName) || HasEntry(strName); }
+
+ // get the entry type
+ virtual EntryType GetEntryType(const wxString& name) const
+ {
+ // by default all entries are strings
+ return HasEntry(name) ? Type_String : Type_Unknown;
+ }
+
+ // key access: returns true if value was really read, false if default used
+ // (and if the key is not found the default value is returned.)
+
+ // read a string from the key
+ bool Read(const wxString& key, wxString *pStr) const;
+ bool Read(const wxString& key, wxString *pStr, const wxString& defVal) const;
+
+ // read a number (long)
+ bool Read(const wxString& key, long *pl) const;
+ bool Read(const wxString& key, long *pl, long defVal) const;
+
+ // read an int (wrapper around `long' version)
+ bool Read(const wxString& key, int *pi) const;
+ bool Read(const wxString& key, int *pi, int defVal) const;
+
+ // read a double
+ bool Read(const wxString& key, double* val) const;
+ bool Read(const wxString& key, double* val, double defVal) const;
+
+ // read a float
+ bool Read(const wxString& key, float* val) const;
+ bool Read(const wxString& key, float* val, float defVal) const;
+
+ // read a bool
+ bool Read(const wxString& key, bool* val) const;
+ bool Read(const wxString& key, bool* val, bool defVal) const;
+
+#if wxUSE_BASE64
+ // read a binary data block
+ bool Read(const wxString& key, wxMemoryBuffer* data) const
+ { return DoReadBinary(key, data); }
+ // no default version since it does not make sense for binary data
+#endif // wxUSE_BASE64
+
+#ifdef wxHAS_CONFIG_TEMPLATE_RW
+ // read other types, for which wxFromString is defined
+ template <typename T>
+ bool Read(const wxString& key, T* value) const
+ {
+ wxString s;
+ if ( !Read(key, &s) )
+ return false;
+ return wxFromString(s, value);
+ }
+
+ template <typename T>
+ bool Read(const wxString& key, T* value, const T& defVal) const
+ {
+ const bool found = Read(key, value);
+ if ( !found )
+ {
+ if (IsRecordingDefaults())
+ ((wxConfigBase *)this)->Write(key, defVal);
+ *value = defVal;
+ }
+ return found;
+ }
+#endif // wxHAS_CONFIG_TEMPLATE_RW
+
+ // convenience functions returning directly the value
+ wxString Read(const wxString& key,
+ const wxString& defVal = wxEmptyString) const
+ { wxString s; (void)Read(key, &s, defVal); return s; }
+
+ // we have to provide a separate version for C strings as otherwise the
+ // template Read() would be used
+ wxString Read(const wxString& key, const char* defVal) const
+ { return Read(key, wxString(defVal)); }
+ wxString Read(const wxString& key, const wchar_t* defVal) const
+ { return Read(key, wxString(defVal)); }
+
+ long ReadLong(const wxString& key, long defVal) const
+ { long l; (void)Read(key, &l, defVal); return l; }
+
+ double ReadDouble(const wxString& key, double defVal) const
+ { double d; (void)Read(key, &d, defVal); return d; }
+
+ bool ReadBool(const wxString& key, bool defVal) const
+ { bool b; (void)Read(key, &b, defVal); return b; }
+
+ template <typename T>
+ T ReadObject(const wxString& key, T const& defVal) const
+ { T t; (void)Read(key, &t, defVal); return t; }
+
+ // for compatibility with wx 2.8
+ long Read(const wxString& key, long defVal) const
+ { return ReadLong(key, defVal); }
+
+
+ // write the value (return true on success)
+ bool Write(const wxString& key, const wxString& value)
+ { return DoWriteString(key, value); }
+
+ bool Write(const wxString& key, long value)
+ { return DoWriteLong(key, value); }
+
+ bool Write(const wxString& key, double value)
+ { return DoWriteDouble(key, value); }
+
+ bool Write(const wxString& key, bool value)
+ { return DoWriteBool(key, value); }
+
+#if wxUSE_BASE64
+ bool Write(const wxString& key, const wxMemoryBuffer& buf)
+ { return DoWriteBinary(key, buf); }
+#endif // wxUSE_BASE64
+
+ // we have to provide a separate version for C strings as otherwise they
+ // would be converted to bool and not to wxString as expected!
+ bool Write(const wxString& key, const char *value)
+ { return Write(key, wxString(value)); }
+ bool Write(const wxString& key, const unsigned char *value)
+ { return Write(key, wxString(value)); }
+ bool Write(const wxString& key, const wchar_t *value)
+ { return Write(key, wxString(value)); }
+
+
+ // we also have to provide specializations for other types which we want to
+ // handle using the specialized DoWriteXXX() instead of the generic template
+ // version below
+ bool Write(const wxString& key, char value)
+ { return DoWriteLong(key, value); }
+
+ bool Write(const wxString& key, unsigned char value)
+ { return DoWriteLong(key, value); }
+
+ bool Write(const wxString& key, short value)
+ { return DoWriteLong(key, value); }
+
+ bool Write(const wxString& key, unsigned short value)
+ { return DoWriteLong(key, value); }
+
+ bool Write(const wxString& key, unsigned int value)
+ { return DoWriteLong(key, value); }
+
+ bool Write(const wxString& key, int value)
+ { return DoWriteLong(key, value); }
+
+ bool Write(const wxString& key, unsigned long value)
+ { return DoWriteLong(key, value); }
+
+ bool Write(const wxString& key, float value)
+ { return DoWriteDouble(key, value); }
+
+ // Causes ambiguities in VC++ 6 and OpenVMS (at least)
+#if ( (!defined(__VISUALC__) || __VISUALC__ > 1200) && !defined( __VMS ) && !defined (__DMC__))
+ // for other types, use wxToString()
+ template <typename T>
+ bool Write(const wxString& key, T const& value)
+ { return Write(key, wxToString(value)); }
+#endif
+
+ // permanently writes all changes
+ virtual bool Flush(bool bCurrentOnly = false) = 0;
+
+ // renaming, all functions return false on failure (probably because the new
+ // name is already taken by an existing entry)
+ // rename an entry
+ virtual bool RenameEntry(const wxString& oldName,
+ const wxString& newName) = 0;
+ // rename a group
+ virtual bool RenameGroup(const wxString& oldName,
+ const wxString& newName) = 0;
+
+ // delete entries/groups
+ // deletes the specified entry and the group it belongs to if
+ // it was the last key in it and the second parameter is true
+ virtual bool DeleteEntry(const wxString& key,
+ bool bDeleteGroupIfEmpty = true) = 0;
+ // delete the group (with all subgroups)
+ virtual bool DeleteGroup(const wxString& key) = 0;
+ // delete the whole underlying object (disk file, registry key, ...)
+ // primarily for use by uninstallation routine.
+ virtual bool DeleteAll() = 0;
+
+ // options
+ // we can automatically expand environment variables in the config entries
+ // (this option is on by default, you can turn it on/off at any time)
+ bool IsExpandingEnvVars() const { return m_bExpandEnvVars; }
+ void SetExpandEnvVars(bool bDoIt = true) { m_bExpandEnvVars = bDoIt; }
+ // recording of default values
+ void SetRecordDefaults(bool bDoIt = true) { m_bRecordDefaults = bDoIt; }
+ bool IsRecordingDefaults() const { return m_bRecordDefaults; }
+ // does expansion only if needed
+ wxString ExpandEnvVars(const wxString& str) const;
+
+ // misc accessors
+ wxString GetAppName() const { return m_appName; }
+ wxString GetVendorName() const { return m_vendorName; }
+
+ // Used wxIniConfig to set members in constructor
+ void SetAppName(const wxString& appName) { m_appName = appName; }
+ void SetVendorName(const wxString& vendorName) { m_vendorName = vendorName; }
+
+ void SetStyle(long style) { m_style = style; }
+ long GetStyle() const { return m_style; }
+
+protected:
+ static bool IsImmutable(const wxString& key)
+ { return !key.IsEmpty() && key[0] == wxCONFIG_IMMUTABLE_PREFIX; }
+
+ // return the path without trailing separator, if any: this should be called
+ // to sanitize paths referring to the group names before passing them to
+ // wxConfigPathChanger as "/foo/bar/" should be the same as "/foo/bar" and it
+ // isn't interpreted in the same way by it (and this can't be changed there
+ // as it's not the same for the entries names)
+ static wxString RemoveTrailingSeparator(const wxString& key);
+
+ // do read/write the values of different types
+ virtual bool DoReadString(const wxString& key, wxString *pStr) const = 0;
+ virtual bool DoReadLong(const wxString& key, long *pl) const = 0;
+ virtual bool DoReadDouble(const wxString& key, double* val) const;
+ virtual bool DoReadBool(const wxString& key, bool* val) const;
+#if wxUSE_BASE64
+ virtual bool DoReadBinary(const wxString& key, wxMemoryBuffer* buf) const = 0;
+#endif // wxUSE_BASE64
+
+ virtual bool DoWriteString(const wxString& key, const wxString& value) = 0;
+ virtual bool DoWriteLong(const wxString& key, long value) = 0;
+ virtual bool DoWriteDouble(const wxString& key, double value);
+ virtual bool DoWriteBool(const wxString& key, bool value);
+#if wxUSE_BASE64
+ virtual bool DoWriteBinary(const wxString& key, const wxMemoryBuffer& buf) = 0;
+#endif // wxUSE_BASE64
+
+private:
+ // are we doing automatic environment variable expansion?
+ bool m_bExpandEnvVars;
+ // do we record default values?
+ bool m_bRecordDefaults;
+
+ // static variables
+ static wxConfigBase *ms_pConfig;
+ static bool ms_bAutoCreate;
+
+ // Application name and organisation name
+ wxString m_appName;
+ wxString m_vendorName;
+
+ // Style flag
+ long m_style;
+
+ DECLARE_ABSTRACT_CLASS(wxConfigBase)
+};
+
+// a handy little class which changes current path to the path of given entry
+// and restores it in dtor: so if you declare a local variable of this type,
+// you work in the entry directory and the path is automatically restored
+// when the function returns
+// Taken out of wxConfig since not all compilers can cope with nested classes.
+class WXDLLIMPEXP_BASE wxConfigPathChanger
+{
+public:
+ // ctor/dtor do path changing/restoring of the path
+ wxConfigPathChanger(const wxConfigBase *pContainer, const wxString& strEntry);
+ ~wxConfigPathChanger();
+
+ // get the key name
+ const wxString& Name() const { return m_strName; }
+
+ // this method must be called if the original path (i.e. the current path at
+ // the moment of creation of this object) could have been deleted to prevent
+ // us from restoring the not existing (any more) path
+ //
+ // if the original path doesn't exist any more, the path will be restored to
+ // the deepest still existing component of the old path
+ void UpdateIfDeleted();
+
+private:
+ wxConfigBase *m_pContainer; // object we live in
+ wxString m_strName, // name of entry (i.e. name only)
+ m_strOldPath; // saved path
+ bool m_bChanged; // was the path changed?
+
+ wxDECLARE_NO_COPY_CLASS(wxConfigPathChanger);
+};
+
+
+#endif // wxUSE_CONFIG
+
+/*
+ Replace environment variables ($SOMETHING) with their values. The format is
+ $VARNAME or ${VARNAME} where VARNAME contains alphanumeric characters and
+ '_' only. '$' must be escaped ('\$') in order to be taken literally.
+*/
+
+WXDLLIMPEXP_BASE wxString wxExpandEnvVars(const wxString &sz);
+
+/*
+ Split path into parts removing '..' in progress
+ */
+WXDLLIMPEXP_BASE void wxSplitPath(wxArrayString& aParts, const wxString& path);
+
+#endif // _WX_CONFBASE_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/config.h
+// Purpose: wxConfig base header
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CONFIG_H_BASE_
+#define _WX_CONFIG_H_BASE_
+
+#include "wx/confbase.h"
+
+#if wxUSE_CONFIG
+
+// ----------------------------------------------------------------------------
+// define the native wxConfigBase implementation
+// ----------------------------------------------------------------------------
+
+// under Windows we prefer to use the native implementation but can be forced
+// to use the file-based one
+#if defined(__WINDOWS__) && wxUSE_CONFIG_NATIVE
+ #include "wx/msw/regconf.h"
+ #define wxConfig wxRegConfig
+#elif defined(__WXOS2__) && wxUSE_CONFIG_NATIVE
+ #include "wx/os2/iniconf.h"
+ #define wxConfig wxIniConfig
+#else // either we're under Unix or wish to always use config files
+ #include "wx/fileconf.h"
+ #define wxConfig wxFileConfig
+#endif
+
+#endif // wxUSE_CONFIG
+
+#endif // _WX_CONFIG_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/containr.h
+// Purpose: wxControlContainer and wxNavigationEnabled declarations
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 06.08.01
+// Copyright: (c) 2001, 2011 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CONTAINR_H_
+#define _WX_CONTAINR_H_
+
+#include "wx/defs.h"
+
+#ifndef wxHAS_NATIVE_TAB_TRAVERSAL
+ // We need wxEVT_XXX declarations in this case.
+ #include "wx/event.h"
+#endif
+
+class WXDLLIMPEXP_FWD_CORE wxWindow;
+class WXDLLIMPEXP_FWD_CORE wxWindowBase;
+
+/*
+ This header declares wxControlContainer class however it's not a real
+ container of controls but rather just a helper used to implement TAB
+ navigation among the window children. You should rarely need to use it
+ directly, derive from the documented public wxNavigationEnabled<> class to
+ implement TAB navigation in a custom composite window.
+ */
+
+// ----------------------------------------------------------------------------
+// wxControlContainerBase: common part used in both native and generic cases
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxControlContainerBase
+{
+public:
+ // default ctor, SetContainerWindow() must be called later
+ wxControlContainerBase()
+ {
+ m_winParent = NULL;
+
+ // By default, we accept focus ourselves.
+ m_acceptsFocusSelf = true;
+
+ // But we don't have any children accepting it yet.
+ m_acceptsFocusChildren = false;
+
+ m_inSetFocus = false;
+ m_winLastFocused = NULL;
+ }
+ virtual ~wxControlContainerBase() {}
+
+ void SetContainerWindow(wxWindow *winParent)
+ {
+ wxASSERT_MSG( !m_winParent, wxT("shouldn't be called twice") );
+
+ m_winParent = winParent;
+ }
+
+ // This can be called by the window to indicate that it never wants to have
+ // the focus for itself.
+ void DisableSelfFocus()
+ { m_acceptsFocusSelf = false; UpdateParentCanFocus(); }
+
+ // This can be called to undo the effect of a previous DisableSelfFocus()
+ // (otherwise calling it is not necessary as the window does accept focus
+ // by default).
+ void EnableSelfFocus()
+ { m_acceptsFocusSelf = true; UpdateParentCanFocus(); }
+
+ // should be called from SetFocus(), returns false if we did nothing with
+ // the focus and the default processing should take place
+ bool DoSetFocus();
+
+ // returns whether we should accept focus ourselves or not
+ bool AcceptsFocus() const;
+
+ // Returns whether we or one of our children accepts focus.
+ bool AcceptsFocusRecursively() const
+ { return AcceptsFocus() ||
+ (m_acceptsFocusChildren && HasAnyChildrenAcceptingFocus()); }
+
+ // We accept focus from keyboard if we accept it at all.
+ bool AcceptsFocusFromKeyboard() const { return AcceptsFocusRecursively(); }
+
+ // Call this when the number of children of the window changes.
+ //
+ // Returns true if we have any focusable children, false otherwise.
+ bool UpdateCanFocusChildren();
+
+protected:
+ // set the focus to the child which had it the last time
+ virtual bool SetFocusToChild();
+
+ // return true if we have any children accepting focus
+ bool HasAnyFocusableChildren() const;
+
+ // return true if we have any children that do accept focus right now
+ bool HasAnyChildrenAcceptingFocus() const;
+
+
+ // the parent window we manage the children for
+ wxWindow *m_winParent;
+
+ // the child which had the focus last time this panel was activated
+ wxWindow *m_winLastFocused;
+
+private:
+ // Update the window status to reflect whether it is getting focus or not.
+ void UpdateParentCanFocus();
+
+ // Indicates whether the associated window can ever have focus itself.
+ //
+ // Usually this is the case, e.g. a wxPanel can be used either as a
+ // container for its children or just as a normal window which can be
+ // focused. But sometimes, e.g. for wxStaticBox, we can never have focus
+ // ourselves and can only get it if we have any focusable children.
+ bool m_acceptsFocusSelf;
+
+ // Cached value remembering whether we have any children accepting focus.
+ bool m_acceptsFocusChildren;
+
+ // a guard against infinite recursion
+ bool m_inSetFocus;
+};
+
+#ifdef wxHAS_NATIVE_TAB_TRAVERSAL
+
+// ----------------------------------------------------------------------------
+// wxControlContainer for native TAB navigation
+// ----------------------------------------------------------------------------
+
+// this must be a real class as we forward-declare it elsewhere
+class WXDLLIMPEXP_CORE wxControlContainer : public wxControlContainerBase
+{
+protected:
+ // set the focus to the child which had it the last time
+ virtual bool SetFocusToChild();
+};
+
+#else // !wxHAS_NATIVE_TAB_TRAVERSAL
+
+// ----------------------------------------------------------------------------
+// wxControlContainer for TAB navigation implemented in wx itself
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxControlContainer : public wxControlContainerBase
+{
+public:
+ // default ctor, SetContainerWindow() must be called later
+ wxControlContainer();
+
+ // the methods to be called from the window event handlers
+ void HandleOnNavigationKey(wxNavigationKeyEvent& event);
+ void HandleOnFocus(wxFocusEvent& event);
+ void HandleOnWindowDestroy(wxWindowBase *child);
+
+ // called from OnChildFocus() handler, i.e. when one of our (grand)
+ // children gets the focus
+ void SetLastFocus(wxWindow *win);
+
+protected:
+
+ wxDECLARE_NO_COPY_CLASS(wxControlContainer);
+};
+
+#endif // wxHAS_NATIVE_TAB_TRAVERSAL/!wxHAS_NATIVE_TAB_TRAVERSAL
+
+// this function is for wxWidgets internal use only
+extern WXDLLIMPEXP_CORE bool wxSetFocusToChild(wxWindow *win, wxWindow **child);
+
+// ----------------------------------------------------------------------------
+// wxNavigationEnabled: Derive from this class to support keyboard navigation
+// among window children in a wxWindow-derived class. The details of this class
+// don't matter, you just need to derive from it to make navigation work.
+// ----------------------------------------------------------------------------
+
+// The template parameter W must be a wxWindow-derived class.
+template <class W>
+class wxNavigationEnabled : public W
+{
+public:
+ typedef W BaseWindowClass;
+
+ wxNavigationEnabled()
+ {
+ m_container.SetContainerWindow(this);
+
+#ifndef wxHAS_NATIVE_TAB_TRAVERSAL
+ BaseWindowClass::Connect(wxEVT_NAVIGATION_KEY,
+ wxNavigationKeyEventHandler(wxNavigationEnabled::OnNavigationKey));
+
+ BaseWindowClass::Connect(wxEVT_SET_FOCUS,
+ wxFocusEventHandler(wxNavigationEnabled::OnFocus));
+
+ BaseWindowClass::Connect(wxEVT_CHILD_FOCUS,
+ wxChildFocusEventHandler(wxNavigationEnabled::OnChildFocus));
+#endif // !wxHAS_NATIVE_TAB_TRAVERSAL
+ }
+
+ WXDLLIMPEXP_INLINE_CORE virtual bool AcceptsFocus() const
+ {
+ return m_container.AcceptsFocus();
+ }
+
+ WXDLLIMPEXP_INLINE_CORE virtual bool AcceptsFocusRecursively() const
+ {
+ return m_container.AcceptsFocusRecursively();
+ }
+
+ WXDLLIMPEXP_INLINE_CORE virtual bool AcceptsFocusFromKeyboard() const
+ {
+ return m_container.AcceptsFocusFromKeyboard();
+ }
+
+ WXDLLIMPEXP_INLINE_CORE virtual void AddChild(wxWindowBase *child)
+ {
+ BaseWindowClass::AddChild(child);
+
+ if ( m_container.UpdateCanFocusChildren() )
+ {
+ // Under MSW we must have wxTAB_TRAVERSAL style for TAB navigation
+ // to work.
+ if ( !BaseWindowClass::HasFlag(wxTAB_TRAVERSAL) )
+ BaseWindowClass::ToggleWindowStyle(wxTAB_TRAVERSAL);
+ }
+ }
+
+ WXDLLIMPEXP_INLINE_CORE virtual void RemoveChild(wxWindowBase *child)
+ {
+#ifndef wxHAS_NATIVE_TAB_TRAVERSAL
+ m_container.HandleOnWindowDestroy(child);
+#endif // !wxHAS_NATIVE_TAB_TRAVERSAL
+
+ BaseWindowClass::RemoveChild(child);
+
+ // We could reset wxTAB_TRAVERSAL here but it doesn't seem to do any
+ // harm to keep it.
+ m_container.UpdateCanFocusChildren();
+ }
+
+ WXDLLIMPEXP_INLINE_CORE virtual void SetFocus()
+ {
+ if ( !m_container.DoSetFocus() )
+ BaseWindowClass::SetFocus();
+ }
+
+ void SetFocusIgnoringChildren()
+ {
+ BaseWindowClass::SetFocus();
+ }
+
+protected:
+#ifndef wxHAS_NATIVE_TAB_TRAVERSAL
+ void OnNavigationKey(wxNavigationKeyEvent& event)
+ {
+ m_container.HandleOnNavigationKey(event);
+ }
+
+ void OnFocus(wxFocusEvent& event)
+ {
+ m_container.HandleOnFocus(event);
+ }
+
+ void OnChildFocus(wxChildFocusEvent& event)
+ {
+ m_container.SetLastFocus(event.GetWindow());
+ event.Skip();
+ }
+#endif // !wxHAS_NATIVE_TAB_TRAVERSAL
+
+ wxControlContainer m_container;
+
+
+ wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxNavigationEnabled, W);
+};
+
+// ----------------------------------------------------------------------------
+// Compatibility macros from now on, do NOT use them and preferably do not even
+// look at them.
+// ----------------------------------------------------------------------------
+
+#if WXWIN_COMPATIBILITY_2_8
+
+// common part of WX_DECLARE_CONTROL_CONTAINER in the native and generic cases,
+// it should be used in the wxWindow-derived class declaration
+#define WX_DECLARE_CONTROL_CONTAINER_BASE() \
+public: \
+ virtual bool AcceptsFocus() const; \
+ virtual bool AcceptsFocusRecursively() const; \
+ virtual bool AcceptsFocusFromKeyboard() const; \
+ virtual void AddChild(wxWindowBase *child); \
+ virtual void RemoveChild(wxWindowBase *child); \
+ virtual void SetFocus(); \
+ void SetFocusIgnoringChildren(); \
+ \
+protected: \
+ wxControlContainer m_container
+
+// this macro must be used in the derived class ctor
+#define WX_INIT_CONTROL_CONTAINER() \
+ m_container.SetContainerWindow(this)
+
+// common part of WX_DELEGATE_TO_CONTROL_CONTAINER in the native and generic
+// cases, must be used in the wxWindow-derived class implementation
+#define WX_DELEGATE_TO_CONTROL_CONTAINER_BASE(classname, basename) \
+ void classname::AddChild(wxWindowBase *child) \
+ { \
+ basename::AddChild(child); \
+ \
+ m_container.UpdateCanFocusChildren(); \
+ } \
+ \
+ bool classname::AcceptsFocusRecursively() const \
+ { \
+ return m_container.AcceptsFocusRecursively(); \
+ } \
+ \
+ void classname::SetFocus() \
+ { \
+ if ( !m_container.DoSetFocus() ) \
+ basename::SetFocus(); \
+ } \
+ \
+ bool classname::AcceptsFocus() const \
+ { \
+ return m_container.AcceptsFocus(); \
+ } \
+ \
+ bool classname::AcceptsFocusFromKeyboard() const \
+ { \
+ return m_container.AcceptsFocusFromKeyboard(); \
+ }
+
+
+#ifdef wxHAS_NATIVE_TAB_TRAVERSAL
+
+#define WX_EVENT_TABLE_CONTROL_CONTAINER(classname)
+
+#define WX_DECLARE_CONTROL_CONTAINER WX_DECLARE_CONTROL_CONTAINER_BASE
+
+#define WX_DELEGATE_TO_CONTROL_CONTAINER(classname, basename) \
+ WX_DELEGATE_TO_CONTROL_CONTAINER_BASE(classname, basename) \
+ \
+ void classname::RemoveChild(wxWindowBase *child) \
+ { \
+ basename::RemoveChild(child); \
+ \
+ m_container.UpdateCanFocusChildren(); \
+ } \
+ \
+ void classname::SetFocusIgnoringChildren() \
+ { \
+ basename::SetFocus(); \
+ }
+
+#else // !wxHAS_NATIVE_TAB_TRAVERSAL
+
+// declare the methods to be forwarded
+#define WX_DECLARE_CONTROL_CONTAINER() \
+ WX_DECLARE_CONTROL_CONTAINER_BASE(); \
+ \
+public: \
+ void OnNavigationKey(wxNavigationKeyEvent& event); \
+ void OnFocus(wxFocusEvent& event); \
+ virtual void OnChildFocus(wxChildFocusEvent& event)
+
+// implement the event table entries for wxControlContainer
+#define WX_EVENT_TABLE_CONTROL_CONTAINER(classname) \
+ EVT_SET_FOCUS(classname::OnFocus) \
+ EVT_CHILD_FOCUS(classname::OnChildFocus) \
+ EVT_NAVIGATION_KEY(classname::OnNavigationKey)
+
+// implement the methods forwarding to the wxControlContainer
+#define WX_DELEGATE_TO_CONTROL_CONTAINER(classname, basename) \
+ WX_DELEGATE_TO_CONTROL_CONTAINER_BASE(classname, basename) \
+ \
+ void classname::RemoveChild(wxWindowBase *child) \
+ { \
+ m_container.HandleOnWindowDestroy(child); \
+ \
+ basename::RemoveChild(child); \
+ \
+ m_container.UpdateCanFocusChildren(); \
+ } \
+ \
+ void classname::OnNavigationKey( wxNavigationKeyEvent& event ) \
+ { \
+ m_container.HandleOnNavigationKey(event); \
+ } \
+ \
+ void classname::SetFocusIgnoringChildren() \
+ { \
+ basename::SetFocus(); \
+ } \
+ \
+ void classname::OnChildFocus(wxChildFocusEvent& event) \
+ { \
+ m_container.SetLastFocus(event.GetWindow()); \
+ event.Skip(); \
+ } \
+ \
+ void classname::OnFocus(wxFocusEvent& event) \
+ { \
+ m_container.HandleOnFocus(event); \
+ }
+
+#endif // wxHAS_NATIVE_TAB_TRAVERSAL/!wxHAS_NATIVE_TAB_TRAVERSAL
+
+#endif // WXWIN_COMPATIBILITY_2_8
+
+#endif // _WX_CONTAINR_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/control.h
+// Purpose: wxControl common interface
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 26.07.99
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CONTROL_H_BASE_
+#define _WX_CONTROL_H_BASE_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_CONTROLS
+
+#include "wx/window.h" // base class
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxControlNameStr[];
+
+
+// ----------------------------------------------------------------------------
+// Ellipsize() constants
+// ----------------------------------------------------------------------------
+
+enum wxEllipsizeFlags
+{
+ wxELLIPSIZE_FLAGS_NONE = 0,
+ wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS = 1,
+ wxELLIPSIZE_FLAGS_EXPAND_TABS = 2,
+
+ wxELLIPSIZE_FLAGS_DEFAULT = wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS |
+ wxELLIPSIZE_FLAGS_EXPAND_TABS
+};
+
+// NB: Don't change the order of these values, they're the same as in
+// PangoEllipsizeMode enum.
+enum wxEllipsizeMode
+{
+ wxELLIPSIZE_NONE,
+ wxELLIPSIZE_START,
+ wxELLIPSIZE_MIDDLE,
+ wxELLIPSIZE_END
+};
+
+// ----------------------------------------------------------------------------
+// wxControl is the base class for all controls
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxControlBase : public wxWindow
+{
+public:
+ wxControlBase() { }
+
+ virtual ~wxControlBase();
+
+ // Create() function adds the validator parameter
+ bool Create(wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxControlNameStr);
+
+ // get the control alignment (left/right/centre, top/bottom/centre)
+ int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; }
+
+ // set label with mnemonics
+ virtual void SetLabel(const wxString& label)
+ {
+ m_labelOrig = label;
+
+ InvalidateBestSize();
+
+ wxWindow::SetLabel(label);
+ }
+
+ // return the original string, as it was passed to SetLabel()
+ // (i.e. with wx-style mnemonics)
+ virtual wxString GetLabel() const { return m_labelOrig; }
+
+ // set label text (mnemonics will be escaped)
+ virtual void SetLabelText(const wxString& text)
+ {
+ SetLabel(EscapeMnemonics(text));
+ }
+
+ // get just the text of the label, without mnemonic characters ('&')
+ virtual wxString GetLabelText() const { return GetLabelText(GetLabel()); }
+
+
+#if wxUSE_MARKUP
+ // Set the label with markup (and mnemonics). Markup is a simple subset of
+ // HTML with tags such as <b>, <i> and <span>. By default it is not
+ // supported i.e. all the markup is simply stripped and SetLabel() is
+ // called but some controls in some ports do support this already and in
+ // the future most of them should.
+ //
+ // Notice that, being HTML-like, markup also supports XML entities so '<'
+ // should be encoded as "<" and so on, a bare '<' in the input will
+ // likely result in an error. As an exception, a bare '&' is allowed and
+ // indicates that the next character is a mnemonic. To insert a literal '&'
+ // in the control you need to use "&" in the input string.
+ //
+ // Returns true if the label was set, even if the markup in it was ignored.
+ // False is only returned if we failed to parse the label.
+ bool SetLabelMarkup(const wxString& markup)
+ {
+ return DoSetLabelMarkup(markup);
+ }
+#endif // wxUSE_MARKUP
+
+
+ // controls by default inherit the colours of their parents, if a
+ // particular control class doesn't want to do it, it can override
+ // ShouldInheritColours() to return false
+ virtual bool ShouldInheritColours() const { return true; }
+
+
+ // WARNING: this doesn't work for all controls nor all platforms!
+ //
+ // simulates the event of given type (i.e. wxButton::Command() is just as
+ // if the button was clicked)
+ virtual void Command(wxCommandEvent &event);
+
+ virtual bool SetFont(const wxFont& font);
+
+ // wxControl-specific processing after processing the update event
+ virtual void DoUpdateWindowUI(wxUpdateUIEvent& event);
+
+ wxSize GetSizeFromTextSize(int xlen, int ylen = -1) const
+ { return DoGetSizeFromTextSize(xlen, ylen); }
+ wxSize GetSizeFromTextSize(const wxSize& tsize) const
+ { return DoGetSizeFromTextSize(tsize.x, tsize.y); }
+
+
+ // static utilities for mnemonics char (&) handling
+ // ------------------------------------------------
+
+ // returns the given string without mnemonic characters ('&')
+ static wxString GetLabelText(const wxString& label);
+
+ // returns the given string without mnemonic characters ('&')
+ // this function is identic to GetLabelText() and is provided for clarity
+ // and for symmetry with the wxStaticText::RemoveMarkup() function.
+ static wxString RemoveMnemonics(const wxString& str);
+
+ // escapes (by doubling them) the mnemonics
+ static wxString EscapeMnemonics(const wxString& str);
+
+
+ // miscellaneous static utilities
+ // ------------------------------
+
+ // replaces parts of the given (multiline) string with an ellipsis if needed
+ static wxString Ellipsize(const wxString& label, const wxDC& dc,
+ wxEllipsizeMode mode, int maxWidth,
+ int flags = wxELLIPSIZE_FLAGS_DEFAULT);
+
+ // return the accel index in the string or -1 if none and puts the modified
+ // string into second parameter if non NULL
+ static int FindAccelIndex(const wxString& label,
+ wxString *labelOnly = NULL);
+
+ // this is a helper for the derived class GetClassDefaultAttributes()
+ // implementation: it returns the right colours for the classes which
+ // contain something else (e.g. wxListBox, wxTextCtrl, ...) instead of
+ // being simple controls (such as wxButton, wxCheckBox, ...)
+ static wxVisualAttributes
+ GetCompositeControlsDefaultAttributes(wxWindowVariant variant);
+
+protected:
+ // choose the default border for this window
+ virtual wxBorder GetDefaultBorder() const;
+
+ // creates the control (calls wxWindowBase::CreateBase inside) and adds it
+ // to the list of parents children
+ bool CreateControl(wxWindowBase *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxValidator& validator,
+ const wxString& name);
+
+#if wxUSE_MARKUP
+ // This function may be overridden in the derived classes to implement
+ // support for labels with markup. The base class version simply strips the
+ // markup and calls SetLabel() with the remaining text.
+ virtual bool DoSetLabelMarkup(const wxString& markup);
+#endif // wxUSE_MARKUP
+
+ // override this to return the total control's size from a string size
+ virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const;
+
+ // initialize the common fields of wxCommandEvent
+ void InitCommandEvent(wxCommandEvent& event) const;
+
+ // Ellipsize() helper:
+ static wxString DoEllipsizeSingleLine(const wxString& label, const wxDC& dc,
+ wxEllipsizeMode mode, int maxWidth,
+ int replacementWidth);
+
+#if wxUSE_MARKUP
+ // Remove markup from the given string, returns empty string on error i.e.
+ // if markup was syntactically invalid.
+ static wxString RemoveMarkup(const wxString& markup);
+#endif // wxUSE_MARKUP
+
+
+ // this field contains the label in wx format, i.e. with '&' mnemonics,
+ // as it was passed to the last SetLabel() call
+ wxString m_labelOrig;
+
+ wxDECLARE_NO_COPY_CLASS(wxControlBase);
+};
+
+// ----------------------------------------------------------------------------
+// include platform-dependent wxControl declarations
+// ----------------------------------------------------------------------------
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/control.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/control.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/control.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/control.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/control.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/control.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/control.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/control.h"
+#endif
+
+#endif // wxUSE_CONTROLS
+
+#endif
+ // _WX_CONTROL_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/convauto.h
+// Purpose: wxConvAuto class declaration
+// Author: Vadim Zeitlin
+// Created: 2006-04-03
+// Copyright: (c) 2006 Vadim Zeitlin
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CONVAUTO_H_
+#define _WX_CONVAUTO_H_
+
+#include "wx/strconv.h"
+#include "wx/fontenc.h"
+
+// ----------------------------------------------------------------------------
+// wxConvAuto: uses BOM to automatically detect input encoding
+// ----------------------------------------------------------------------------
+
+// All currently recognized BOM values.
+enum wxBOM
+{
+ wxBOM_Unknown = -1,
+ wxBOM_None,
+ wxBOM_UTF32BE,
+ wxBOM_UTF32LE,
+ wxBOM_UTF16BE,
+ wxBOM_UTF16LE,
+ wxBOM_UTF8
+};
+
+class WXDLLIMPEXP_BASE wxConvAuto : public wxMBConv
+{
+public:
+ // default ctor, the real conversion will be created on demand
+ wxConvAuto(wxFontEncoding enc = wxFONTENCODING_DEFAULT)
+ {
+ Init();
+
+ m_encDefault = enc;
+ }
+
+ // copy ctor doesn't initialize anything neither as conversion can only be
+ // deduced on first use
+ wxConvAuto(const wxConvAuto& other) : wxMBConv()
+ {
+ Init();
+
+ m_encDefault = other.m_encDefault;
+ }
+
+ virtual ~wxConvAuto()
+ {
+ if ( m_ownsConv )
+ delete m_conv;
+ }
+
+ // get/set the fall-back encoding used when the input text doesn't have BOM
+ // and isn't UTF-8
+ //
+ // special values are wxFONTENCODING_MAX meaning not to use any fall back
+ // at all (but just fail to convert in this case) and wxFONTENCODING_SYSTEM
+ // meaning to use the encoding of the system locale
+ static wxFontEncoding GetFallbackEncoding() { return ms_defaultMBEncoding; }
+ static void SetFallbackEncoding(wxFontEncoding enc);
+ static void DisableFallbackEncoding()
+ {
+ SetFallbackEncoding(wxFONTENCODING_MAX);
+ }
+
+
+ // override the base class virtual function(s) to use our m_conv
+ virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
+ const char *src, size_t srcLen = wxNO_LEN) const;
+
+ virtual size_t FromWChar(char *dst, size_t dstLen,
+ const wchar_t *src, size_t srcLen = wxNO_LEN) const;
+
+ virtual size_t GetMBNulLen() const { return m_conv->GetMBNulLen(); }
+
+ virtual wxMBConv *Clone() const { return new wxConvAuto(*this); }
+
+ // return the BOM type of this buffer
+ static wxBOM DetectBOM(const char *src, size_t srcLen);
+
+ // return the characters composing the given BOM.
+ static const char* GetBOMChars(wxBOM bomType, size_t* count);
+
+ wxBOM GetBOM() const
+ {
+ return m_bomType;
+ }
+
+private:
+ // common part of all ctors
+ void Init()
+ {
+ // We don't initialize m_encDefault here as different ctors do it
+ // differently.
+ m_conv = NULL;
+ m_bomType = wxBOM_Unknown;
+ m_ownsConv = false;
+ m_consumedBOM = false;
+ }
+
+ // initialize m_conv with the UTF-8 conversion
+ void InitWithUTF8()
+ {
+ m_conv = &wxConvUTF8;
+ m_ownsConv = false;
+ }
+
+ // create the correct conversion object for the given BOM type
+ void InitFromBOM(wxBOM bomType);
+
+ // create the correct conversion object for the BOM present in the
+ // beginning of the buffer
+ //
+ // return false if the buffer is too short to allow us to determine if we
+ // have BOM or not
+ bool InitFromInput(const char *src, size_t len);
+
+ // adjust src and len to skip over the BOM (identified by m_bomType) at the
+ // start of the buffer
+ void SkipBOM(const char **src, size_t *len) const;
+
+
+ // fall-back multibyte encoding to use, may be wxFONTENCODING_SYSTEM or
+ // wxFONTENCODING_MAX but not wxFONTENCODING_DEFAULT
+ static wxFontEncoding ms_defaultMBEncoding;
+
+ // conversion object which we really use, NULL until the first call to
+ // either ToWChar() or FromWChar()
+ wxMBConv *m_conv;
+
+ // the multibyte encoding to use by default if input isn't Unicode
+ wxFontEncoding m_encDefault;
+
+ // our BOM type
+ wxBOM m_bomType;
+
+ // true if we allocated m_conv ourselves, false if we just use an existing
+ // global conversion
+ bool m_ownsConv;
+
+ // true if we already skipped BOM when converting (and not just calculating
+ // the size)
+ bool m_consumedBOM;
+
+
+ wxDECLARE_NO_ASSIGN_CLASS(wxConvAuto);
+};
+
+#endif // _WX_CONVAUTO_H_
+
--- /dev/null
+/*
+ * Name: wx/cpp.h
+ * Purpose: Various preprocessor helpers
+ * Author: Vadim Zeitlin
+ * Created: 2006-09-30
+ * Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
+ * Licence: wxWindows licence
+ */
+
+/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
+
+#ifndef _WX_CPP_H_
+#define _WX_CPP_H_
+
+#include "wx/compiler.h" /* wxCHECK_XXX_VERSION() macros */
+
+/* wxCONCAT works like preprocessor ## operator but also works with macros */
+#define wxCONCAT_HELPER(text, line) text ## line
+
+#define wxCONCAT(x1, x2) \
+ wxCONCAT_HELPER(x1, x2)
+#define wxCONCAT3(x1, x2, x3) \
+ wxCONCAT(wxCONCAT(x1, x2), x3)
+#define wxCONCAT4(x1, x2, x3, x4) \
+ wxCONCAT(wxCONCAT3(x1, x2, x3), x4)
+#define wxCONCAT5(x1, x2, x3, x4, x5) \
+ wxCONCAT(wxCONCAT4(x1, x2, x3, x4), x5)
+#define wxCONCAT6(x1, x2, x3, x4, x5, x6) \
+ wxCONCAT(wxCONCAT5(x1, x2, x3, x4, x5), x6)
+#define wxCONCAT7(x1, x2, x3, x4, x5, x6, x7) \
+ wxCONCAT(wxCONCAT6(x1, x2, x3, x4, x5, x6), x7)
+#define wxCONCAT8(x1, x2, x3, x4, x5, x6, x7, x8) \
+ wxCONCAT(wxCONCAT7(x1, x2, x3, x4, x5, x6, x7), x8)
+#define wxCONCAT9(x1, x2, x3, x4, x5, x6, x7, x8, x9) \
+ wxCONCAT(wxCONCAT8(x1, x2, x3, x4, x5, x6, x7, x8), x9)
+
+/* wxSTRINGIZE works as the preprocessor # operator but also works with macros */
+#define wxSTRINGIZE_HELPER(x) #x
+#define wxSTRINGIZE(x) wxSTRINGIZE_HELPER(x)
+
+/* a Unicode-friendly version of wxSTRINGIZE_T */
+#define wxSTRINGIZE_T(x) wxAPPLY_T(wxSTRINGIZE(x))
+
+/*
+ Special workarounds for compilers with broken "##" operator. For all the
+ other ones we can just use it directly.
+ */
+#ifdef wxCOMPILER_BROKEN_CONCAT_OPER
+ #define wxPREPEND_L(x) L ## x
+ #define wxAPPEND_i64(x) x ## i64
+ #define wxAPPEND_ui64(x) x ## ui64
+#endif /* wxCOMPILER_BROKEN_CONCAT_OPER */
+
+/*
+ Helper macros for wxMAKE_UNIQUE_NAME: normally this works by appending the
+ current line number to the given identifier to reduce the probability of the
+ conflict (it may still happen if this is used in the headers, hence you
+ should avoid doing it or provide unique prefixes then) but we have to do it
+ differently for VC++
+ */
+#if defined(__VISUALC__) && (__VISUALC__ >= 1300)
+ /*
+ __LINE__ handling is completely broken in VC++ when using "Edit and
+ Continue" (/ZI option) and results in preprocessor errors if we use it
+ inside the macros. Luckily VC7 has another standard macro which can be
+ used like this and is even better than __LINE__ because it is globally
+ unique.
+ */
+# define wxCONCAT_LINE(text) wxCONCAT(text, __COUNTER__)
+#else /* normal compilers */
+# define wxCONCAT_LINE(text) wxCONCAT(text, __LINE__)
+#endif
+
+/* Create a "unique" name with the given prefix */
+#define wxMAKE_UNIQUE_NAME(text) wxCONCAT_LINE(text)
+
+/*
+ This macro can be passed as argument to another macro when you don't have
+ anything to pass in fact.
+ */
+#define wxEMPTY_PARAMETER_VALUE /* Fake macro parameter value */
+
+/*
+ Helpers for defining macros that expand into a single statement.
+
+ The standatd solution is to use "do { ... } while (0)" statement but MSVC
+ generates a C4127 "condition expression is constant" warning for it so we
+ use something which is just complicated enough to not be recognized as a
+ constant but still simple enough to be optimized away.
+
+ Another solution would be to use __pragma() to temporarily disable C4127.
+
+ Notice that wxASSERT_ARG_TYPE in wx/strvargarg.h relies on these macros
+ creating some kind of a loop because it uses "break".
+ */
+#ifdef __WATCOMC__
+ #define wxFOR_ONCE(name) for(int name=0; name<1; name++)
+ #define wxSTATEMENT_MACRO_BEGIN wxFOR_ONCE(wxMAKE_UNIQUE_NAME(wxmacro)) {
+ #define wxSTATEMENT_MACRO_END }
+#else
+ #define wxSTATEMENT_MACRO_BEGIN do {
+ #define wxSTATEMENT_MACRO_END } while ( (void)0, 0 )
+#endif
+
+/*
+ Define __WXFUNCTION__ which is like standard __FUNCTION__ but defined as
+ NULL for the compilers which don't support the latter.
+ */
+#ifndef __WXFUNCTION__
+ /* TODO: add more compilers supporting __FUNCTION__ */
+ #if defined(__DMC__)
+ /*
+ __FUNCTION__ happens to be not defined within class members
+ http://www.digitalmars.com/drn-bin/wwwnews?c%2B%2B.beta/485
+ */
+ #define __WXFUNCTION__ (NULL)
+ #elif defined(__GNUC__) || \
+ (defined(_MSC_VER) && _MSC_VER >= 1300) || \
+ defined(__FUNCTION__)
+ #define __WXFUNCTION__ __FUNCTION__
+ #else
+ /* still define __WXFUNCTION__ to avoid #ifdefs elsewhere */
+ #define __WXFUNCTION__ (NULL)
+ #endif
+#endif /* __WXFUNCTION__ already defined */
+
+
+/* Auto-detect variadic macros support unless explicitly disabled. */
+#if !defined(HAVE_VARIADIC_MACROS) && !defined(wxNO_VARIADIC_MACROS)
+ /* Any C99 or C++11 compiler should have them. */
+ #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
+ (defined(__cplusplus) && __cplusplus >= 201103L)
+ #define HAVE_VARIADIC_MACROS
+ #elif wxCHECK_GCC_VERSION(3,0)
+ #define HAVE_VARIADIC_MACROS
+ #elif wxCHECK_VISUALC_VERSION(8)
+ #define HAVE_VARIADIC_MACROS
+ #elif wxCHECK_WATCOM_VERSION(1,2)
+ #define HAVE_VARIADIC_MACROS
+ #endif
+#endif /* !HAVE_VARIADIC_MACROS */
+
+
+
+#ifdef HAVE_VARIADIC_MACROS
+/*
+ wxCALL_FOR_EACH(what, ...) calls the macro from its first argument, what(pos, x),
+ for every remaining argument 'x', with 'pos' being its 1-based index in
+ *reverse* order (with the last argument being numbered 1).
+
+ For example, wxCALL_FOR_EACH(test, a, b, c) expands into this:
+
+ test(3, a) \
+ test(2, b) \
+ test(1, c)
+
+ Up to eight arguments are supported.
+
+ (With thanks to https://groups.google.com/d/topic/comp.std.c/d-6Mj5Lko_s/discussion
+ and http://stackoverflow.com/questions/1872220/is-it-possible-to-iterate-over-arguments-in-variadic-macros)
+*/
+#define wxCALL_FOR_EACH_NARG(...) wxCALL_FOR_EACH_NARG_((__VA_ARGS__, wxCALL_FOR_EACH_RSEQ_N()))
+#define wxCALL_FOR_EACH_NARG_(args) wxCALL_FOR_EACH_ARG_N args
+#define wxCALL_FOR_EACH_ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, N, ...) N
+#define wxCALL_FOR_EACH_RSEQ_N() 8, 7, 6, 5, 4, 3, 2, 1, 0
+
+#define wxCALL_FOR_EACH_1(what, x) what(1, x)
+#define wxCALL_FOR_EACH_2(what, x, ...) what(2, x) wxCALL_FOR_EACH_1(what, __VA_ARGS__)
+#define wxCALL_FOR_EACH_3(what, x, ...) what(3, x) wxCALL_FOR_EACH_2(what, __VA_ARGS__)
+#define wxCALL_FOR_EACH_4(what, x, ...) what(4, x) wxCALL_FOR_EACH_3(what, __VA_ARGS__)
+#define wxCALL_FOR_EACH_5(what, x, ...) what(5, x) wxCALL_FOR_EACH_4(what, __VA_ARGS__)
+#define wxCALL_FOR_EACH_6(what, x, ...) what(6, x) wxCALL_FOR_EACH_5(what, __VA_ARGS__)
+#define wxCALL_FOR_EACH_7(what, x, ...) what(7, x) wxCALL_FOR_EACH_6(what, __VA_ARGS__)
+#define wxCALL_FOR_EACH_8(what, x, ...) what(8, x) wxCALL_FOR_EACH_7(what, __VA_ARGS__)
+
+#define wxCALL_FOR_EACH_(N, args) \
+ wxCONCAT(wxCALL_FOR_EACH_, N) args
+
+#define wxCALL_FOR_EACH(what, ...) \
+ wxCALL_FOR_EACH_(wxCALL_FOR_EACH_NARG(__VA_ARGS__), (what, __VA_ARGS__))
+
+#else
+ #define wxCALL_FOR_EACH Error_wx_CALL_FOR_EACH_requires_variadic_macros_support
+#endif /* HAVE_VARIADIC_MACROS */
+
+#endif /* _WX_CPP_H_ */
+
--- /dev/null
+//////////////////////////////////////////////////////////////////////////////
+// Name: wx/crt.h
+// Purpose: Header to include all headers with wrappers for CRT functions
+// Author: Robert Roebling
+// Created: 2007-05-30
+// Copyright: (c) 2007 wxWidgets dev team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CRT_H_
+#define _WX_CRT_H_
+
+#include "wx/defs.h"
+
+// include wxChar type definition:
+#include "wx/chartype.h"
+
+// and wrappers for CRT functions:
+#include "wx/wxcrt.h"
+#include "wx/wxcrtvararg.h"
+
+#endif // _WX_CRT_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/cshelp.h
+// Purpose: Context-sensitive help support classes
+// Author: Julian Smart, Vadim Zeitlin
+// Modified by:
+// Created: 08/09/2000
+// Copyright: (c) 2000 Julian Smart, Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CSHELP_H_
+#define _WX_CSHELP_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_HELP
+
+#include "wx/help.h"
+
+#include "wx/hashmap.h"
+#if wxUSE_BMPBUTTON
+#include "wx/bmpbuttn.h"
+#endif
+
+#include "wx/event.h"
+
+// ----------------------------------------------------------------------------
+// classes used to implement context help UI
+// ----------------------------------------------------------------------------
+
+/*
+ * wxContextHelp
+ * Invokes context-sensitive help. When the user
+ * clicks on a window, a wxEVT_HELP event will be sent to that
+ * window for the application to display help for.
+ */
+
+class WXDLLIMPEXP_CORE wxContextHelp : public wxObject
+{
+public:
+ wxContextHelp(wxWindow* win = NULL, bool beginHelp = true);
+ virtual ~wxContextHelp();
+
+ bool BeginContextHelp(wxWindow* win);
+ bool EndContextHelp();
+
+ bool EventLoop();
+ bool DispatchEvent(wxWindow* win, const wxPoint& pt);
+
+ void SetStatus(bool status) { m_status = status; }
+
+protected:
+ bool m_inHelp;
+ bool m_status; // true if the user left-clicked
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxContextHelp)
+};
+
+#if wxUSE_BMPBUTTON
+/*
+ * wxContextHelpButton
+ * You can add this to your dialogs (especially on non-Windows platforms)
+ * to put the application into context help mode.
+ */
+
+class WXDLLIMPEXP_CORE wxContextHelpButton : public wxBitmapButton
+{
+public:
+ wxContextHelpButton(wxWindow* parent,
+ wxWindowID id = wxID_CONTEXT_HELP,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxBU_AUTODRAW);
+
+ void OnContextHelp(wxCommandEvent& event);
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxContextHelpButton)
+ DECLARE_EVENT_TABLE()
+};
+
+#endif
+
+// ----------------------------------------------------------------------------
+// classes used to implement context help support
+// ----------------------------------------------------------------------------
+
+// wxHelpProvider is an abstract class used by the program implementing context help to
+// show the help text (or whatever: it may be HTML page or anything else) for
+// the given window.
+//
+// The current help provider must be explicitly set by the application using
+// wxHelpProvider::Set().
+//
+// Special note about ShowHelpAtPoint() and ShowHelp(): we want to be able to
+// override ShowHelpAtPoint() when we need to use different help messages for
+// different parts of the window, but it should also be possible to override
+// just ShowHelp() both for backwards compatibility and just because most
+// often the help does not, in fact, depend on the position and so
+// implementing just ShowHelp() is simpler and more natural, so by default
+// ShowHelpAtPoint() forwards to ShowHelp(). But this means that
+// wxSimpleHelpProvider has to override ShowHelp() and not ShowHelpAtPoint()
+// for backwards compatibility as otherwise the existing code deriving from it
+// and overriding ShowHelp() but calling the base class version wouldn't work
+// any more, which forces us to use a rather ugly hack and pass the extra
+// parameters of ShowHelpAtPoint() to ShowHelp() via member variables.
+class WXDLLIMPEXP_CORE wxHelpProvider
+{
+public:
+ // get/set the current (application-global) help provider (Set() returns
+ // the previous one)
+ static wxHelpProvider *Set(wxHelpProvider *helpProvider)
+ {
+ wxHelpProvider *helpProviderOld = ms_helpProvider;
+ ms_helpProvider = helpProvider;
+ return helpProviderOld;
+ }
+
+ // unlike some other class, the help provider is not created on demand,
+ // this must be explicitly done by the application
+ static wxHelpProvider *Get() { return ms_helpProvider; }
+
+ // get the help string (whose interpretation is help provider dependent
+ // except that empty string always means that no help is associated with
+ // the window) for this window
+ virtual wxString GetHelp(const wxWindowBase *window) = 0;
+
+ // do show help for the given window (uses window->GetHelpAtPoint()
+ // internally if applicable), return true if it was done or false
+ // if no help available for this window
+ virtual bool ShowHelpAtPoint(wxWindowBase *window,
+ const wxPoint& pt,
+ wxHelpEvent::Origin origin)
+ {
+ wxCHECK_MSG( window, false, wxT("window must not be NULL") );
+
+ m_helptextAtPoint = pt;
+ m_helptextOrigin = origin;
+
+ return ShowHelp(window);
+ }
+
+ // show help for the given window, see ShowHelpAtPoint() above
+ virtual bool ShowHelp(wxWindowBase * WXUNUSED(window)) { return false; }
+
+ // associate the text with the given window or id: although all help
+ // providers have these functions to allow making wxWindow::SetHelpText()
+ // work, not all of them implement them
+ virtual void AddHelp(wxWindowBase *window, const wxString& text);
+
+ // this version associates the given text with all window with this id
+ // (may be used to set the same help string for all [Cancel] buttons in
+ // the application, for example)
+ virtual void AddHelp(wxWindowID id, const wxString& text);
+
+ // removes the association
+ virtual void RemoveHelp(wxWindowBase* window);
+
+ // virtual dtor for any base class
+ virtual ~wxHelpProvider();
+
+protected:
+ wxHelpProvider()
+ : m_helptextAtPoint(wxDefaultPosition),
+ m_helptextOrigin(wxHelpEvent::Origin_Unknown)
+ {
+ }
+
+ // helper method used by ShowHelp(): returns the help string to use by
+ // using m_helptextAtPoint/m_helptextOrigin if they're set or just GetHelp
+ // otherwise
+ wxString GetHelpTextMaybeAtPoint(wxWindowBase *window);
+
+
+ // parameters of the last ShowHelpAtPoint() call, used by ShowHelp()
+ wxPoint m_helptextAtPoint;
+ wxHelpEvent::Origin m_helptextOrigin;
+
+private:
+ static wxHelpProvider *ms_helpProvider;
+};
+
+WX_DECLARE_EXPORTED_HASH_MAP( wxUIntPtr, wxString, wxIntegerHash,
+ wxIntegerEqual, wxSimpleHelpProviderHashMap );
+
+// wxSimpleHelpProvider is an implementation of wxHelpProvider which supports
+// only plain text help strings and shows the string associated with the
+// control (if any) in a tooltip
+class WXDLLIMPEXP_CORE wxSimpleHelpProvider : public wxHelpProvider
+{
+public:
+ // implement wxHelpProvider methods
+ virtual wxString GetHelp(const wxWindowBase *window);
+
+ // override ShowHelp() and not ShowHelpAtPoint() as explained above
+ virtual bool ShowHelp(wxWindowBase *window);
+
+ virtual void AddHelp(wxWindowBase *window, const wxString& text);
+ virtual void AddHelp(wxWindowID id, const wxString& text);
+ virtual void RemoveHelp(wxWindowBase* window);
+
+protected:
+ // we use 2 hashes for storing the help strings associated with windows
+ // and the ids
+ wxSimpleHelpProviderHashMap m_hashWindows,
+ m_hashIds;
+};
+
+// wxHelpControllerHelpProvider is an implementation of wxHelpProvider which supports
+// both context identifiers and plain text help strings. If the help text is an integer,
+// it is passed to wxHelpController::DisplayContextPopup. Otherwise, it shows the string
+// in a tooltip as per wxSimpleHelpProvider.
+class WXDLLIMPEXP_CORE wxHelpControllerHelpProvider : public wxSimpleHelpProvider
+{
+public:
+ // Note that it doesn't own the help controller. The help controller
+ // should be deleted separately.
+ wxHelpControllerHelpProvider(wxHelpControllerBase* hc = NULL);
+
+ // implement wxHelpProvider methods
+
+ // again (see above): this should be ShowHelpAtPoint() but we need to
+ // override ShowHelp() to avoid breaking existing code
+ virtual bool ShowHelp(wxWindowBase *window);
+
+ // Other accessors
+ void SetHelpController(wxHelpControllerBase* hc) { m_helpController = hc; }
+ wxHelpControllerBase* GetHelpController() const { return m_helpController; }
+
+protected:
+ wxHelpControllerBase* m_helpController;
+
+ wxDECLARE_NO_COPY_CLASS(wxHelpControllerHelpProvider);
+};
+
+// Convenience function for turning context id into wxString
+WXDLLIMPEXP_CORE wxString wxContextId(int id);
+
+#endif // wxUSE_HELP
+
+#endif // _WX_CSHELP_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/ctrlsub.h (read: "wxConTRoL with SUBitems")
+// Purpose: wxControlWithItems interface
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 22.10.99
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CTRLSUB_H_BASE_
+#define _WX_CTRLSUB_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_CONTROLS
+
+#include "wx/arrstr.h"
+#include "wx/control.h" // base class
+
+// ----------------------------------------------------------------------------
+// wxItemContainer defines an interface which is implemented by all controls
+// which have string subitems each of which may be selected.
+//
+// It is decomposed in wxItemContainerImmutable which omits all methods
+// adding/removing items and is used by wxRadioBox and wxItemContainer itself.
+//
+// Examples: wxListBox, wxCheckListBox, wxChoice and wxComboBox (which
+// implements an extended interface deriving from this one)
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxItemContainerImmutable
+{
+public:
+ wxItemContainerImmutable() { }
+ virtual ~wxItemContainerImmutable();
+
+ // accessing strings
+ // -----------------
+
+ virtual unsigned int GetCount() const = 0;
+ bool IsEmpty() const { return GetCount() == 0; }
+
+ virtual wxString GetString(unsigned int n) const = 0;
+ wxArrayString GetStrings() const;
+ virtual void SetString(unsigned int n, const wxString& s) = 0;
+
+ // finding string natively is either case sensitive or insensitive
+ // but never both so fall back to this base version for not
+ // supported search type
+ virtual int FindString(const wxString& s, bool bCase = false) const
+ {
+ unsigned int count = GetCount();
+
+ for ( unsigned int i = 0; i < count ; ++i )
+ {
+ if (GetString(i).IsSameAs( s , bCase ))
+ return (int)i;
+ }
+
+ return wxNOT_FOUND;
+ }
+
+
+ // selection
+ // ---------
+
+ virtual void SetSelection(int n) = 0;
+ virtual int GetSelection() const = 0;
+
+ // set selection to the specified string, return false if not found
+ bool SetStringSelection(const wxString& s);
+
+ // return the selected string or empty string if none
+ virtual wxString GetStringSelection() const;
+
+ // this is the same as SetSelection( for single-selection controls but
+ // reads better for multi-selection ones
+ void Select(int n) { SetSelection(n); }
+
+
+protected:
+ // check that the index is valid
+ bool IsValid(unsigned int n) const { return n < GetCount(); }
+ bool IsValidInsert(unsigned int n) const { return n <= GetCount(); }
+};
+
+// ----------------------------------------------------------------------------
+// wxItemContainer extends wxItemContainerImmutable interface with methods
+// for adding/removing items.
+//
+// Classes deriving from this one must override DoInsertItems() to implement
+// adding items to the control. This can often be implemented more efficiently
+// than simply looping over the elements and inserting them but if this is not
+// the case, the generic DoInsertItemsInLoop can be used in implementation, but
+// in this case DoInsertItem() needs to be overridden.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxItemContainer : public wxItemContainerImmutable
+{
+private:
+ // AppendItems() and InsertItems() helpers just call DoAppend/InsertItems()
+ // after doing some checks
+ //
+ // NB: they're defined here so that they're inlined when used in public part
+ int AppendItems(const wxArrayStringsAdapter& items,
+ void **clientData,
+ wxClientDataType type)
+ {
+ if ( items.IsEmpty() )
+ return wxNOT_FOUND;
+
+ return DoAppendItems(items, clientData, type);
+ }
+
+ int AppendItems(const wxArrayStringsAdapter& items)
+ {
+ return AppendItems(items, NULL, wxClientData_None);
+ }
+
+ int AppendItems(const wxArrayStringsAdapter& items, void **clientData)
+ {
+ wxASSERT_MSG( GetClientDataType() != wxClientData_Object,
+ wxT("can't mix different types of client data") );
+
+ return AppendItems(items, clientData, wxClientData_Void);
+ }
+
+ int AppendItems(const wxArrayStringsAdapter& items,
+ wxClientData **clientData)
+ {
+ wxASSERT_MSG( GetClientDataType() != wxClientData_Void,
+ wxT("can't mix different types of client data") );
+
+ return AppendItems(items, reinterpret_cast<void **>(clientData),
+ wxClientData_Object);
+ }
+
+ int InsertItems(const wxArrayStringsAdapter& items,
+ unsigned int pos,
+ void **clientData,
+ wxClientDataType type)
+ {
+ wxASSERT_MSG( !IsSorted(), wxT("can't insert items in sorted control") );
+
+ wxCHECK_MSG( pos <= GetCount(), wxNOT_FOUND,
+ wxT("position out of range") );
+
+ // not all derived classes handle empty arrays correctly in
+ // DoInsertItems() and besides it really doesn't make much sense to do
+ // this (for append it could correspond to creating an initially empty
+ // control but why would anybody need to insert 0 items?)
+ wxCHECK_MSG( !items.IsEmpty(), wxNOT_FOUND,
+ wxT("need something to insert") );
+
+ return DoInsertItems(items, pos, clientData, type);
+ }
+
+ int InsertItems(const wxArrayStringsAdapter& items, unsigned int pos)
+ {
+ return InsertItems(items, pos, NULL, wxClientData_None);
+ }
+
+ int InsertItems(const wxArrayStringsAdapter& items,
+ unsigned int pos,
+ void **clientData)
+ {
+ wxASSERT_MSG( GetClientDataType() != wxClientData_Object,
+ wxT("can't mix different types of client data") );
+
+ return InsertItems(items, pos, clientData, wxClientData_Void);
+ }
+
+ int InsertItems(const wxArrayStringsAdapter& items,
+ unsigned int pos,
+ wxClientData **clientData)
+ {
+ wxASSERT_MSG( GetClientDataType() != wxClientData_Void,
+ wxT("can't mix different types of client data") );
+
+ return InsertItems(items, pos,
+ reinterpret_cast<void **>(clientData),
+ wxClientData_Object);
+ }
+
+public:
+ wxItemContainer() { m_clientDataItemsType = wxClientData_None; }
+ virtual ~wxItemContainer();
+
+ // adding items
+ // ------------
+
+ // append single item, return its position in the control (which can be
+ // different from the last one if the control is sorted)
+ int Append(const wxString& item)
+ { return AppendItems(item); }
+ int Append(const wxString& item, void *clientData)
+ { return AppendItems(item, &clientData); }
+ int Append(const wxString& item, wxClientData *clientData)
+ { return AppendItems(item, &clientData); }
+
+ // append several items at once to the control, return the position of the
+ // last item appended
+ int Append(const wxArrayString& items)
+ { return AppendItems(items); }
+ int Append(const wxArrayString& items, void **clientData)
+ { return AppendItems(items, clientData); }
+ int Append(const wxArrayString& items, wxClientData **clientData)
+ { return AppendItems(items, clientData); }
+ int Append(unsigned int n, const wxString *items)
+ { return AppendItems(wxArrayStringsAdapter(n, items)); }
+ int Append(unsigned int n, const wxString *items, void **clientData)
+ { return AppendItems(wxArrayStringsAdapter(n, items), clientData); }
+ int Append(unsigned int n,
+ const wxString *items,
+ wxClientData **clientData)
+ { return AppendItems(wxArrayStringsAdapter(n, items), clientData); }
+
+ // only for RTTI needs (separate name)
+ void AppendString(const wxString& item)
+ { Append(item); }
+
+
+ // inserting items: not for sorted controls!
+ // -----------------------------------------
+
+ // insert single item at the given position, return its effective position
+ int Insert(const wxString& item, unsigned int pos)
+ { return InsertItems(item, pos); }
+ int Insert(const wxString& item, unsigned int pos, void *clientData)
+ { return InsertItems(item, pos, &clientData); }
+ int Insert(const wxString& item, unsigned int pos, wxClientData *clientData)
+ { return InsertItems(item, pos, &clientData); }
+
+ // insert several items at once into the control, return the index of the
+ // last item inserted
+ int Insert(const wxArrayString& items, unsigned int pos)
+ { return InsertItems(items, pos); }
+ int Insert(const wxArrayString& items, unsigned int pos, void **clientData)
+ { return InsertItems(items, pos, clientData); }
+ int Insert(const wxArrayString& items,
+ unsigned int pos,
+ wxClientData **clientData)
+ { return InsertItems(items, pos, clientData); }
+ int Insert(unsigned int n, const wxString *items, unsigned int pos)
+ { return InsertItems(wxArrayStringsAdapter(n, items), pos); }
+ int Insert(unsigned int n,
+ const wxString *items,
+ unsigned int pos,
+ void **clientData)
+ { return InsertItems(wxArrayStringsAdapter(n, items), pos, clientData); }
+ int Insert(unsigned int n,
+ const wxString *items,
+ unsigned int pos,
+ wxClientData **clientData)
+ { return InsertItems(wxArrayStringsAdapter(n, items), pos, clientData); }
+
+
+ // replacing items
+ // ---------------
+
+ void Set(const wxArrayString& items)
+ { Clear(); Append(items); }
+ void Set(const wxArrayString& items, void **clientData)
+ { Clear(); Append(items, clientData); }
+ void Set(const wxArrayString& items, wxClientData **clientData)
+ { Clear(); Append(items, clientData); }
+ void Set(unsigned int n, const wxString *items)
+ { Clear(); Append(n, items); }
+ void Set(unsigned int n, const wxString *items, void **clientData)
+ { Clear(); Append(n, items, clientData); }
+ void Set(unsigned int n, const wxString *items, wxClientData **clientData)
+ { Clear(); Append(n, items, clientData); }
+
+ // deleting items
+ // --------------
+
+ void Clear();
+ void Delete(unsigned int pos);
+
+
+ // various accessors
+ // -----------------
+
+ // The control may maintain its items in a sorted order in which case
+ // items are automatically inserted at the right position when they are
+ // inserted or appended. Derived classes have to override this method if
+ // they implement sorting, typically by returning HasFlag(wxXX_SORT)
+ virtual bool IsSorted() const { return false; }
+
+
+ // client data stuff
+ // -----------------
+
+ void SetClientData(unsigned int n, void* clientData);
+ void* GetClientData(unsigned int n) const;
+
+ // SetClientObject() takes ownership of the pointer, GetClientObject()
+ // returns it but keeps the ownership while DetachClientObject() expects
+ // the caller to delete the pointer and also resets the internally stored
+ // one to NULL for this item
+ void SetClientObject(unsigned int n, wxClientData* clientData);
+ wxClientData* GetClientObject(unsigned int n) const;
+ wxClientData* DetachClientObject(unsigned int n);
+
+ // return the type of client data stored in this control: usually it just
+ // returns m_clientDataItemsType but must be overridden in the controls
+ // which delegate their client data storage to another one (e.g. wxChoice
+ // in wxUniv which stores data in wxListBox which it uses anyhow); don't
+ // forget to override SetClientDataType() if you override this one
+ //
+ // NB: for this to work no code should ever access m_clientDataItemsType
+ // directly but only via this function!
+ virtual wxClientDataType GetClientDataType() const
+ { return m_clientDataItemsType; }
+
+ bool HasClientData() const
+ { return GetClientDataType() != wxClientData_None; }
+ bool HasClientObjectData() const
+ { return GetClientDataType() == wxClientData_Object; }
+ bool HasClientUntypedData() const
+ { return GetClientDataType() == wxClientData_Void; }
+
+protected:
+ // there is usually no need to override this method but you can do it if it
+ // is more convenient to only do "real" insertions in DoInsertItems() and
+ // to implement items appending here (in which case DoInsertItems() should
+ // call this method if pos == GetCount() as it can still be called in this
+ // case if public Insert() is called with such position)
+ virtual int DoAppendItems(const wxArrayStringsAdapter& items,
+ void **clientData,
+ wxClientDataType type)
+ {
+ return DoInsertItems(items, GetCount(), clientData, type);
+ }
+
+ // this method must be implemented to insert the items into the control at
+ // position pos which can be GetCount() meaning that the items should be
+ // appended; for the sorted controls the position can be ignored
+ //
+ // the derived classes typically use AssignNewItemClientData() to
+ // associate the data with the items as they're being inserted
+ //
+ // the method should return the index of the position the last item was
+ // inserted into or wxNOT_FOUND if an error occurred
+ virtual int DoInsertItems(const wxArrayStringsAdapter & items,
+ unsigned int pos,
+ void **clientData,
+ wxClientDataType type) = 0;
+
+ // before the client data is set for the first time for the control which
+ // hadn't had it before, DoInitItemClientData() is called which gives the
+ // derived class the possibility to initialize its client data storage only
+ // when client data is really used
+ virtual void DoInitItemClientData() { }
+ virtual void DoSetItemClientData(unsigned int n, void *clientData) = 0;
+ virtual void *DoGetItemClientData(unsigned int n) const = 0;
+
+ virtual void DoClear() = 0;
+ virtual void DoDeleteOneItem(unsigned int pos) = 0;
+
+
+ // methods useful for the derived classes which don't have any better way
+ // of adding multiple items to the control than doing it one by one: such
+ // classes should call DoInsertItemsInLoop() from their DoInsert() and
+ // override DoInsertOneItem() to perform the real insertion
+ virtual int DoInsertOneItem(const wxString& item, unsigned int pos);
+ int DoInsertItemsInLoop(const wxArrayStringsAdapter& items,
+ unsigned int pos,
+ void **clientData,
+ wxClientDataType type);
+
+
+ // helper for DoInsertItems(): n is the index into clientData, pos is the
+ // position of the item in the control
+ void AssignNewItemClientData(unsigned int pos,
+ void **clientData,
+ unsigned int n,
+ wxClientDataType type);
+
+ // free the client object associated with the item at given position and
+ // set it to NULL (must only be called if HasClientObjectData())
+ void ResetItemClientObject(unsigned int n);
+
+ // set the type of the client data stored in this control: override this if
+ // you override GetClientDataType()
+ virtual void SetClientDataType(wxClientDataType clientDataItemsType)
+ {
+ m_clientDataItemsType = clientDataItemsType;
+ }
+
+private:
+ // the type of the client data for the items
+ wxClientDataType m_clientDataItemsType;
+};
+
+// Inheriting directly from a wxWindow-derived class and wxItemContainer
+// unfortunately introduces an ambiguity for all GetClientXXX() methods as they
+// are inherited twice: the "global" versions from wxWindow and the per-item
+// versions taking the index from wxItemContainer.
+//
+// So we need to explicitly resolve them and this helper template class is
+// provided to do it. To use it, simply inherit from wxWindowWithItems<Window,
+// Container> instead of Window and Container interface directly.
+template <class W, class C>
+class wxWindowWithItems : public W, public C
+{
+public:
+ typedef W BaseWindowClass;
+ typedef C BaseContainerInterface;
+
+ wxWindowWithItems() { }
+
+ void SetClientData(void *data)
+ { BaseWindowClass::SetClientData(data); }
+ void *GetClientData() const
+ { return BaseWindowClass::GetClientData(); }
+ void SetClientObject(wxClientData *data)
+ { BaseWindowClass::SetClientObject(data); }
+ wxClientData *GetClientObject() const
+ { return BaseWindowClass::GetClientObject(); }
+
+ void SetClientData(unsigned int n, void* clientData)
+ { wxItemContainer::SetClientData(n, clientData); }
+ void* GetClientData(unsigned int n) const
+ { return wxItemContainer::GetClientData(n); }
+ void SetClientObject(unsigned int n, wxClientData* clientData)
+ { wxItemContainer::SetClientObject(n, clientData); }
+ wxClientData* GetClientObject(unsigned int n) const
+ { return wxItemContainer::GetClientObject(n); }
+};
+
+class WXDLLIMPEXP_CORE wxControlWithItemsBase :
+ public wxWindowWithItems<wxControl, wxItemContainer>
+{
+public:
+ wxControlWithItemsBase() { }
+
+ // usually the controls like list/combo boxes have their own background
+ // colour
+ virtual bool ShouldInheritColours() const { return false; }
+
+
+ // Implementation only from now on.
+
+ // Generate an event of the given type for the selection change.
+ void SendSelectionChangedEvent(wxEventType eventType);
+
+protected:
+ // fill in the client object or data field of the event as appropriate
+ //
+ // calls InitCommandEvent() and, if n != wxNOT_FOUND, also sets the per
+ // item client data
+ void InitCommandEventWithItems(wxCommandEvent& event, int n);
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxControlWithItemsBase);
+};
+
+// define the platform-specific wxControlWithItems class
+#if defined(__WXMSW__)
+ #include "wx/msw/ctrlsub.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/ctrlsub.h"
+#else
+ class WXDLLIMPEXP_CORE wxControlWithItems : public wxControlWithItemsBase
+ {
+ public:
+ wxControlWithItems() { }
+
+ private:
+ DECLARE_ABSTRACT_CLASS(wxControlWithItems)
+ wxDECLARE_NO_COPY_CLASS(wxControlWithItems);
+ };
+#endif
+
+#endif // wxUSE_CONTROLS
+
+#endif // _WX_CTRLSUB_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/cursor.h
+// Purpose: wxCursor base header
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CURSOR_H_BASE_
+#define _WX_CURSOR_H_BASE_
+
+#include "wx/defs.h"
+
+/*
+ wxCursor classes should have the following public API:
+
+class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject
+{
+public:
+ wxCursor();
+ wxCursor(const wxImage& image);
+ wxCursor(const wxString& name,
+ wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
+ int hotSpotX = 0, int hotSpotY = 0);
+ wxCursor(wxStockCursor id) { InitFromStock(id); }
+#if WXWIN_COMPATIBILITY_2_8
+ wxCursor(int id) { InitFromStock((wxStockCursor)id); }
+#endif
+ virtual ~wxCursor();
+};
+
+*/
+
+#if defined(__WXMSW__)
+ #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE
+ #include "wx/msw/cursor.h"
+#elif defined(__WXMOTIF__)
+ #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XBM
+ #include "wx/motif/cursor.h"
+#elif defined(__WXGTK20__)
+ #ifdef __WINDOWS__
+ #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE
+ #else
+ #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM
+ #endif
+ #include "wx/gtk/cursor.h"
+#elif defined(__WXGTK__)
+ #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM
+ #include "wx/gtk1/cursor.h"
+#elif defined(__WXX11__)
+ #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM
+ #include "wx/x11/cursor.h"
+#elif defined(__WXDFB__)
+ #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE
+ #include "wx/dfb/cursor.h"
+#elif defined(__WXMAC__)
+ #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_MACCURSOR_RESOURCE
+ #include "wx/osx/cursor.h"
+#elif defined(__WXCOCOA__)
+ #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_MACCURSOR_RESOURCE
+ #include "wx/cocoa/cursor.h"
+#elif defined(__WXPM__)
+ #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE
+ #include "wx/os2/cursor.h"
+#endif
+
+#include "wx/utils.h"
+
+/* This is a small class which can be used by all ports
+ to temporarily suspend the busy cursor. Useful in modal
+ dialogs.
+
+ Actually that is not (any longer) quite true.. currently it is
+ only used in wxGTK Dialog::ShowModal() and now uses static
+ wxBusyCursor methods that are only implemented for wxGTK so far.
+ The BusyCursor handling code should probably be implemented in
+ common code somewhere instead of the separate implementations we
+ currently have. Also the name BusyCursorSuspender is a little
+ misleading since it doesn't actually suspend the BusyCursor, just
+ masks one that is already showing.
+ If another call to wxBeginBusyCursor is made while this is active
+ the Busy Cursor will again be shown. But at least now it doesn't
+ interfere with the state of wxIsBusy() -- RL
+
+*/
+class wxBusyCursorSuspender
+{
+public:
+ wxBusyCursorSuspender()
+ {
+ if( wxIsBusy() )
+ {
+ wxSetCursor( wxBusyCursor::GetStoredCursor() );
+ }
+ }
+ ~wxBusyCursorSuspender()
+ {
+ if( wxIsBusy() )
+ {
+ wxSetCursor( wxBusyCursor::GetBusyCursor() );
+ }
+ }
+};
+#endif
+ // _WX_CURSOR_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/custombgwin.h
+// Purpose: Class adding support for custom window backgrounds.
+// Author: Vadim Zeitlin
+// Created: 2011-10-10
+// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CUSTOMBGWIN_H_
+#define _WX_CUSTOMBGWIN_H_
+
+// ----------------------------------------------------------------------------
+// wxCustomBackgroundWindow: Adds support for custom backgrounds to any
+// wxWindow-derived class.
+// ----------------------------------------------------------------------------
+
+class wxCustomBackgroundWindowBase
+{
+public:
+ // Trivial default ctor.
+ wxCustomBackgroundWindowBase() { }
+
+ // Also a trivial but virtual -- to suppress g++ warnings -- dtor.
+ virtual ~wxCustomBackgroundWindowBase() { }
+
+ // Use the given bitmap to tile the background of this window. This bitmap
+ // will show through any transparent children.
+ //
+ // Notice that you must not prevent the base class EVT_ERASE_BACKGROUND
+ // handler from running (i.e. not to handle this event yourself) for this
+ // to work.
+ void SetBackgroundBitmap(const wxBitmap& bmp)
+ {
+ DoSetBackgroundBitmap(bmp);
+ }
+
+protected:
+ virtual void DoSetBackgroundBitmap(const wxBitmap& bmp) = 0;
+
+ wxDECLARE_NO_COPY_CLASS(wxCustomBackgroundWindowBase);
+};
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/custombgwin.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/custombgwin.h"
+#else
+ #include "wx/generic/custombgwin.h"
+#endif
+
+#endif // _WX_CUSTOMBGWIN_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/dataobj.h
+// Purpose: common data object classes
+// Author: Vadim Zeitlin, Robert Roebling
+// Modified by:
+// Created: 26.05.99
+// Copyright: (c) wxWidgets Team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DATAOBJ_H_BASE_
+#define _WX_DATAOBJ_H_BASE_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+#include "wx/defs.h"
+
+#if wxUSE_DATAOBJ
+
+#include "wx/string.h"
+#include "wx/bitmap.h"
+#include "wx/list.h"
+#include "wx/arrstr.h"
+
+// ============================================================================
+/*
+ Generic data transfer related classes. The class hierarchy is as follows:
+
+ - wxDataObject-
+ / \
+ / \
+ wxDataObjectSimple wxDataObjectComposite
+ / | \
+ / | \
+ wxTextDataObject | wxBitmapDataObject
+ |
+ wxCustomDataObject
+
+*/
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxDataFormat class is declared in platform-specific headers: it represents
+// a format for data which may be either one of the standard ones (text,
+// bitmap, ...) or a custom one which is then identified by a unique string.
+// ----------------------------------------------------------------------------
+
+/* the class interface looks like this (pseudo code):
+
+class wxDataFormat
+{
+public:
+ typedef <integral type> NativeFormat;
+
+ wxDataFormat(NativeFormat format = wxDF_INVALID);
+ wxDataFormat(const wxString& format);
+
+ wxDataFormat& operator=(NativeFormat format);
+ wxDataFormat& operator=(const wxDataFormat& format);
+
+ bool operator==(NativeFormat format) const;
+ bool operator!=(NativeFormat format) const;
+
+ void SetType(NativeFormat format);
+ NativeFormat GetType() const;
+
+ wxString GetId() const;
+ void SetId(const wxString& format);
+};
+
+*/
+
+#if defined(__WXMSW__)
+ #include "wx/msw/ole/dataform.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/dataform.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/dataform.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/dataform.h"
+#elif defined(__WXX11__)
+ #include "wx/x11/dataform.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/dataform.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/dataform.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/dataform.h"
+#endif
+
+// the value for default argument to some functions (corresponds to
+// wxDF_INVALID)
+extern WXDLLIMPEXP_CORE const wxDataFormat& wxFormatInvalid;
+
+// ----------------------------------------------------------------------------
+// wxDataObject represents a piece of data which knows which formats it
+// supports and knows how to render itself in each of them - GetDataHere(),
+// and how to restore data from the buffer (SetData()).
+//
+// Although this class may be used directly (i.e. custom classes may be
+// derived from it), in many cases it might be simpler to use either
+// wxDataObjectSimple or wxDataObjectComposite classes.
+//
+// A data object may be "read only", i.e. support only GetData() functions or
+// "read-write", i.e. support both GetData() and SetData() (in principle, it
+// might be "write only" too, but this is rare). Moreover, it doesn't have to
+// support the same formats in Get() and Set() directions: for example, a data
+// object containing JPEG image might accept BMPs in GetData() because JPEG
+// image may be easily transformed into BMP but not in SetData(). Accordingly,
+// all methods dealing with formats take an additional "direction" argument
+// which is either SET or GET and which tells the function if the format needs
+// to be supported by SetData() or GetDataHere().
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDataObjectBase
+{
+public:
+ enum Direction
+ {
+ Get = 0x01, // format is supported by GetDataHere()
+ Set = 0x02, // format is supported by SetData()
+ Both = 0x03 // format is supported by both (unused currently)
+ };
+
+ // this class is polymorphic, hence it needs a virtual dtor
+ virtual ~wxDataObjectBase();
+
+ // get the best suited format for rendering our data
+ virtual wxDataFormat GetPreferredFormat(Direction dir = Get) const = 0;
+
+ // get the number of formats we support
+ virtual size_t GetFormatCount(Direction dir = Get) const = 0;
+
+ // return all formats in the provided array (of size GetFormatCount())
+ virtual void GetAllFormats(wxDataFormat *formats,
+ Direction dir = Get) const = 0;
+
+ // get the (total) size of data for the given format
+ virtual size_t GetDataSize(const wxDataFormat& format) const = 0;
+
+ // copy raw data (in the specified format) to the provided buffer, return
+ // true if data copied successfully, false otherwise
+ virtual bool GetDataHere(const wxDataFormat& format, void *buf) const = 0;
+
+ // get data from the buffer of specified length (in the given format),
+ // return true if the data was read successfully, false otherwise
+ virtual bool SetData(const wxDataFormat& WXUNUSED(format),
+ size_t WXUNUSED(len), const void * WXUNUSED(buf))
+ {
+ return false;
+ }
+
+ // returns true if this format is supported
+ bool IsSupported(const wxDataFormat& format, Direction dir = Get) const;
+};
+
+// ----------------------------------------------------------------------------
+// include the platform-specific declarations of wxDataObject
+// ----------------------------------------------------------------------------
+
+#if defined(__WXMSW__)
+ #include "wx/msw/ole/dataobj.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/dataobj.h"
+#elif defined(__WXX11__)
+ #include "wx/x11/dataobj.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/dataobj.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/dataobj.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/dataobj.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/dataobj.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/dataobj.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// wxDataObjectSimple is a wxDataObject which only supports one format (in
+// both Get and Set directions, but you may return false from GetDataHere() or
+// SetData() if one of them is not supported). This is the simplest possible
+// wxDataObject implementation.
+//
+// This is still an "abstract base class" (although it doesn't have any pure
+// virtual functions), to use it you should derive from it and implement
+// GetDataSize(), GetDataHere() and SetData() functions because the base class
+// versions don't do anything - they just return "not implemented".
+//
+// This class should be used when you provide data in only one format (no
+// conversion to/from other formats), either a standard or a custom one.
+// Otherwise, you should use wxDataObjectComposite or wxDataObject directly.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDataObjectSimple : public wxDataObject
+{
+public:
+ // ctor takes the format we support, but it can also be set later with
+ // SetFormat()
+ wxDataObjectSimple(const wxDataFormat& format = wxFormatInvalid)
+ : m_format(format)
+ {
+ }
+
+ // get/set the format we support
+ const wxDataFormat& GetFormat() const { return m_format; }
+ void SetFormat(const wxDataFormat& format) { m_format = format; }
+
+ // virtual functions to override in derived class (the base class versions
+ // just return "not implemented")
+ // -----------------------------------------------------------------------
+
+ // get the size of our data
+ virtual size_t GetDataSize() const
+ { return 0; }
+
+ // copy our data to the buffer
+ virtual bool GetDataHere(void *WXUNUSED(buf)) const
+ { return false; }
+
+ // copy data from buffer to our data
+ virtual bool SetData(size_t WXUNUSED(len), const void *WXUNUSED(buf))
+ { return false; }
+
+ // implement base class pure virtuals
+ // ----------------------------------
+ virtual wxDataFormat GetPreferredFormat(wxDataObjectBase::Direction WXUNUSED(dir) = Get) const
+ { return m_format; }
+ virtual size_t GetFormatCount(wxDataObjectBase::Direction WXUNUSED(dir) = Get) const
+ { return 1; }
+ virtual void GetAllFormats(wxDataFormat *formats,
+ wxDataObjectBase::Direction WXUNUSED(dir) = Get) const
+ { *formats = m_format; }
+ virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const
+ { return GetDataSize(); }
+ virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format),
+ void *buf) const
+ { return GetDataHere(buf); }
+ virtual bool SetData(const wxDataFormat& WXUNUSED(format),
+ size_t len, const void *buf)
+ { return SetData(len, buf); }
+
+private:
+ // the one and only format we support
+ wxDataFormat m_format;
+
+ wxDECLARE_NO_COPY_CLASS(wxDataObjectSimple);
+};
+
+// ----------------------------------------------------------------------------
+// wxDataObjectComposite is the simplest way to implement wxDataObject
+// supporting multiple formats. It contains several wxDataObjectSimple and
+// supports all formats supported by any of them.
+//
+// This class shouldn't be (normally) derived from, but may be used directly.
+// If you need more flexibility than what it provides, you should probably use
+// wxDataObject directly.
+// ----------------------------------------------------------------------------
+
+WX_DECLARE_EXPORTED_LIST(wxDataObjectSimple, wxSimpleDataObjectList);
+
+class WXDLLIMPEXP_CORE wxDataObjectComposite : public wxDataObject
+{
+public:
+ // ctor
+ wxDataObjectComposite();
+ virtual ~wxDataObjectComposite();
+
+ // add data object (it will be deleted by wxDataObjectComposite, hence it
+ // must be allocated on the heap) whose format will become the preferred
+ // one if preferred == true
+ void Add(wxDataObjectSimple *dataObject, bool preferred = false);
+
+ // Report the format passed to the SetData method. This should be the
+ // format of the data object within the composite that received data from
+ // the clipboard or the DnD operation. You can use this method to find
+ // out what kind of data object was received.
+ wxDataFormat GetReceivedFormat() const;
+
+ // Returns the pointer to the object which supports this format or NULL.
+ // The returned pointer is owned by wxDataObjectComposite and must
+ // therefore not be destroyed by the caller.
+ wxDataObjectSimple *GetObject(const wxDataFormat& format,
+ wxDataObjectBase::Direction dir = Get) const;
+
+ // implement base class pure virtuals
+ // ----------------------------------
+ virtual wxDataFormat GetPreferredFormat(wxDataObjectBase::Direction dir = Get) const;
+ virtual size_t GetFormatCount(wxDataObjectBase::Direction dir = Get) const;
+ virtual void GetAllFormats(wxDataFormat *formats, wxDataObjectBase::Direction dir = Get) const;
+ virtual size_t GetDataSize(const wxDataFormat& format) const;
+ virtual bool GetDataHere(const wxDataFormat& format, void *buf) const;
+ virtual bool SetData(const wxDataFormat& format, size_t len, const void *buf);
+#if defined(__WXMSW__)
+ virtual const void* GetSizeFromBuffer( const void* buffer, size_t* size,
+ const wxDataFormat& format );
+ virtual void* SetSizeInBuffer( void* buffer, size_t size,
+ const wxDataFormat& format );
+ virtual size_t GetBufferOffset( const wxDataFormat& format );
+#endif
+
+private:
+ // the list of all (simple) data objects whose formats we support
+ wxSimpleDataObjectList m_dataObjects;
+
+ // the index of the preferred one (0 initially, so by default the first
+ // one is the preferred)
+ size_t m_preferred;
+
+ wxDataFormat m_receivedFormat;
+
+ wxDECLARE_NO_COPY_CLASS(wxDataObjectComposite);
+};
+
+// ============================================================================
+// Standard implementations of wxDataObjectSimple which can be used directly
+// (i.e. without having to derive from them) for standard data type transfers.
+//
+// Note that although all of them can work with provided data, you can also
+// override their virtual GetXXX() functions to only provide data on demand.
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxTextDataObject contains text data
+// ----------------------------------------------------------------------------
+
+#if wxUSE_UNICODE
+ #if defined(__WXGTK20__)
+ #define wxNEEDS_UTF8_FOR_TEXT_DATAOBJ
+ #elif defined(__WXMAC__)
+ #define wxNEEDS_UTF16_FOR_TEXT_DATAOBJ
+ #endif
+#endif // wxUSE_UNICODE
+
+class WXDLLIMPEXP_CORE wxHTMLDataObject : public wxDataObjectSimple
+{
+public:
+ // ctor: you can specify the text here or in SetText(), or override
+ // GetText()
+ wxHTMLDataObject(const wxString& html = wxEmptyString)
+ : wxDataObjectSimple(wxDF_HTML),
+ m_html(html)
+ {
+ }
+
+ // virtual functions which you may override if you want to provide text on
+ // demand only - otherwise, the trivial default versions will be used
+ virtual size_t GetLength() const { return m_html.Len() + 1; }
+ virtual wxString GetHTML() const { return m_html; }
+ virtual void SetHTML(const wxString& html) { m_html = html; }
+
+ virtual size_t GetDataSize() const;
+ virtual bool GetDataHere(void *buf) const;
+ virtual bool SetData(size_t len, const void *buf);
+
+ // Must provide overloads to avoid hiding them (and warnings about it)
+ virtual size_t GetDataSize(const wxDataFormat&) const
+ {
+ return GetDataSize();
+ }
+ virtual bool GetDataHere(const wxDataFormat&, void *buf) const
+ {
+ return GetDataHere(buf);
+ }
+ virtual bool SetData(const wxDataFormat&, size_t len, const void *buf)
+ {
+ return SetData(len, buf);
+ }
+
+private:
+ wxString m_html;
+};
+
+class WXDLLIMPEXP_CORE wxTextDataObject : public wxDataObjectSimple
+{
+public:
+ // ctor: you can specify the text here or in SetText(), or override
+ // GetText()
+ wxTextDataObject(const wxString& text = wxEmptyString)
+ : wxDataObjectSimple(
+#if wxUSE_UNICODE
+ wxDF_UNICODETEXT
+#else
+ wxDF_TEXT
+#endif
+ ),
+ m_text(text)
+ {
+ }
+
+ // virtual functions which you may override if you want to provide text on
+ // demand only - otherwise, the trivial default versions will be used
+ virtual size_t GetTextLength() const { return m_text.Len() + 1; }
+ virtual wxString GetText() const { return m_text; }
+ virtual void SetText(const wxString& text) { m_text = text; }
+
+ // implement base class pure virtuals
+ // ----------------------------------
+
+ // some platforms have 2 and not 1 format for text data
+#if defined(wxNEEDS_UTF8_FOR_TEXT_DATAOBJ) || defined(wxNEEDS_UTF16_FOR_TEXT_DATAOBJ)
+ virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const { return 2; }
+ virtual void GetAllFormats(wxDataFormat *formats,
+ wxDataObjectBase::Direction WXUNUSED(dir) = Get) const;
+
+ virtual size_t GetDataSize() const { return GetDataSize(GetPreferredFormat()); }
+ virtual bool GetDataHere(void *buf) const { return GetDataHere(GetPreferredFormat(), buf); }
+ virtual bool SetData(size_t len, const void *buf) { return SetData(GetPreferredFormat(), len, buf); }
+
+ size_t GetDataSize(const wxDataFormat& format) const;
+ bool GetDataHere(const wxDataFormat& format, void *pBuf) const;
+ bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf);
+#else // !wxNEEDS_UTF{8,16}_FOR_TEXT_DATAOBJ
+ virtual size_t GetDataSize() const;
+ virtual bool GetDataHere(void *buf) const;
+ virtual bool SetData(size_t len, const void *buf);
+ // Must provide overloads to avoid hiding them (and warnings about it)
+ virtual size_t GetDataSize(const wxDataFormat&) const
+ {
+ return GetDataSize();
+ }
+ virtual bool GetDataHere(const wxDataFormat&, void *buf) const
+ {
+ return GetDataHere(buf);
+ }
+ virtual bool SetData(const wxDataFormat&, size_t len, const void *buf)
+ {
+ return SetData(len, buf);
+ }
+#endif // different wxTextDataObject implementations
+
+private:
+ wxString m_text;
+
+ wxDECLARE_NO_COPY_CLASS(wxTextDataObject);
+};
+
+// ----------------------------------------------------------------------------
+// wxBitmapDataObject contains a bitmap
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxBitmapDataObjectBase : public wxDataObjectSimple
+{
+public:
+ // ctor: you can specify the bitmap here or in SetBitmap(), or override
+ // GetBitmap()
+ wxBitmapDataObjectBase(const wxBitmap& bitmap = wxNullBitmap)
+ : wxDataObjectSimple(wxDF_BITMAP), m_bitmap(bitmap)
+ {
+ }
+
+ // virtual functions which you may override if you want to provide data on
+ // demand only - otherwise, the trivial default versions will be used
+ virtual wxBitmap GetBitmap() const { return m_bitmap; }
+ virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
+
+protected:
+ wxBitmap m_bitmap;
+
+ wxDECLARE_NO_COPY_CLASS(wxBitmapDataObjectBase);
+};
+
+// ----------------------------------------------------------------------------
+// wxFileDataObject contains a list of filenames
+//
+// NB: notice that this is a "write only" object, it can only be filled with
+// data from drag and drop operation.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFileDataObjectBase : public wxDataObjectSimple
+{
+public:
+ // ctor: use AddFile() later to fill the array
+ wxFileDataObjectBase() : wxDataObjectSimple(wxDF_FILENAME) { }
+
+ // get a reference to our array
+ const wxArrayString& GetFilenames() const { return m_filenames; }
+
+protected:
+ wxArrayString m_filenames;
+
+ wxDECLARE_NO_COPY_CLASS(wxFileDataObjectBase);
+};
+
+// ----------------------------------------------------------------------------
+// wxCustomDataObject contains arbitrary untyped user data.
+//
+// It is understood that this data can be copied bitwise.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxCustomDataObject : public wxDataObjectSimple
+{
+public:
+ // if you don't specify the format in the ctor, you can still use
+ // SetFormat() later
+ wxCustomDataObject(const wxDataFormat& format = wxFormatInvalid);
+
+ // the dtor calls Free()
+ virtual ~wxCustomDataObject();
+
+ // you can call SetData() to set m_data: it will make a copy of the data
+ // you pass - or you can use TakeData() which won't copy anything, but
+ // will take ownership of data (i.e. will call Free() on it later)
+ void TakeData(size_t size, void *data);
+
+ // this function is called to allocate "size" bytes of memory from
+ // SetData(). The default version uses operator new[].
+ virtual void *Alloc(size_t size);
+
+ // this function is called when the data is freed, you may override it to
+ // anything you want (or may be nothing at all). The default version calls
+ // operator delete[] on m_data
+ virtual void Free();
+
+ // get data: you may override these functions if you wish to provide data
+ // only when it's requested
+ virtual size_t GetSize() const { return m_size; }
+ virtual void *GetData() const { return m_data; }
+
+ // implement base class pure virtuals
+ // ----------------------------------
+ virtual size_t GetDataSize() const;
+ virtual bool GetDataHere(void *buf) const;
+ virtual bool SetData(size_t size, const void *buf);
+ // Must provide overloads to avoid hiding them (and warnings about it)
+ virtual size_t GetDataSize(const wxDataFormat&) const
+ {
+ return GetDataSize();
+ }
+ virtual bool GetDataHere(const wxDataFormat&, void *buf) const
+ {
+ return GetDataHere(buf);
+ }
+ virtual bool SetData(const wxDataFormat&, size_t len, const void *buf)
+ {
+ return SetData(len, buf);
+ }
+
+private:
+ size_t m_size;
+ void *m_data;
+
+ wxDECLARE_NO_COPY_CLASS(wxCustomDataObject);
+};
+
+// ----------------------------------------------------------------------------
+// include platform-specific declarations of wxXXXBase classes
+// ----------------------------------------------------------------------------
+
+#if defined(__WXMSW__)
+ #include "wx/msw/ole/dataobj2.h"
+ // wxURLDataObject defined in msw/ole/dataobj2.h
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/dataobj2.h"
+ // wxURLDataObject defined in msw/ole/dataobj2.h
+
+#else
+ #if defined(__WXGTK__)
+ #include "wx/gtk1/dataobj2.h"
+ #elif defined(__WXX11__)
+ #include "wx/x11/dataobj2.h"
+ #elif defined(__WXMOTIF__)
+ #include "wx/motif/dataobj2.h"
+ #elif defined(__WXMAC__)
+ #include "wx/osx/dataobj2.h"
+ #elif defined(__WXCOCOA__)
+ #include "wx/cocoa/dataobj2.h"
+ #elif defined(__WXPM__)
+ #include "wx/os2/dataobj2.h"
+ #endif
+
+ // wxURLDataObject is simply wxTextDataObject with a different name
+ class WXDLLIMPEXP_CORE wxURLDataObject : public wxTextDataObject
+ {
+ public:
+ wxURLDataObject(const wxString& url = wxEmptyString)
+ : wxTextDataObject(url)
+ {
+ }
+
+ wxString GetURL() const { return GetText(); }
+ void SetURL(const wxString& url) { SetText(url); }
+ };
+#endif
+
+#endif // wxUSE_DATAOBJ
+
+#endif // _WX_DATAOBJ_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/dataview.h
+// Purpose: wxDataViewCtrl base classes
+// Author: Robert Roebling
+// Modified by: Bo Yang
+// Created: 08.01.06
+// Copyright: (c) Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DATAVIEW_H_BASE_
+#define _WX_DATAVIEW_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_DATAVIEWCTRL
+
+#include "wx/textctrl.h"
+#include "wx/headercol.h"
+#include "wx/variant.h"
+#include "wx/dnd.h" // For wxDragResult declaration only.
+#include "wx/dynarray.h"
+#include "wx/icon.h"
+#include "wx/itemid.h"
+#include "wx/weakref.h"
+#include "wx/vector.h"
+#include "wx/dataobj.h"
+#include "wx/withimages.h"
+
+class WXDLLIMPEXP_FWD_CORE wxImageList;
+
+#if !(defined(__WXGTK20__) || defined(__WXOSX__)) || defined(__WXUNIVERSAL__)
+// #if !(defined(__WXOSX__)) || defined(__WXUNIVERSAL__)
+ #define wxHAS_GENERIC_DATAVIEWCTRL
+#endif
+
+#ifdef wxHAS_GENERIC_DATAVIEWCTRL
+ // this symbol doesn't follow the convention for wxUSE_XXX symbols which
+ // are normally always defined as either 0 or 1, so its use is deprecated
+ // and it only exists for backwards compatibility, don't use it any more
+ // and use wxHAS_GENERIC_DATAVIEWCTRL instead
+ #define wxUSE_GENERICDATAVIEWCTRL
+#endif
+
+// ----------------------------------------------------------------------------
+// wxDataViewCtrl globals
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_ADV wxDataViewModel;
+class WXDLLIMPEXP_FWD_ADV wxDataViewCtrl;
+class WXDLLIMPEXP_FWD_ADV wxDataViewColumn;
+class WXDLLIMPEXP_FWD_ADV wxDataViewRenderer;
+class WXDLLIMPEXP_FWD_ADV wxDataViewModelNotifier;
+
+extern WXDLLIMPEXP_DATA_ADV(const char) wxDataViewCtrlNameStr[];
+
+// ----------------------------------------------------------------------------
+// wxDataViewCtrl flags
+// ----------------------------------------------------------------------------
+
+// size of a wxDataViewRenderer without contents:
+#define wxDVC_DEFAULT_RENDERER_SIZE 20
+
+// the default width of new (text) columns:
+#define wxDVC_DEFAULT_WIDTH 80
+
+// the default width of new toggle columns:
+#define wxDVC_TOGGLE_DEFAULT_WIDTH 30
+
+// the default minimal width of the columns:
+#define wxDVC_DEFAULT_MINWIDTH 30
+
+// The default alignment of wxDataViewRenderers is to take
+// the alignment from the column it owns.
+#define wxDVR_DEFAULT_ALIGNMENT -1
+
+
+// ---------------------------------------------------------
+// wxDataViewItem
+// ---------------------------------------------------------
+
+// Make it a class and not a typedef to allow forward declaring it.
+class wxDataViewItem : public wxItemId<void*>
+{
+public:
+ wxDataViewItem() : wxItemId<void*>() { }
+ wxEXPLICIT wxDataViewItem(void* pItem) : wxItemId<void*>(pItem) { }
+};
+
+WX_DEFINE_ARRAY(wxDataViewItem, wxDataViewItemArray);
+
+// ---------------------------------------------------------
+// wxDataViewModelNotifier
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewModelNotifier
+{
+public:
+ wxDataViewModelNotifier() { m_owner = NULL; }
+ virtual ~wxDataViewModelNotifier() { m_owner = NULL; }
+
+ virtual bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item ) = 0;
+ virtual bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item ) = 0;
+ virtual bool ItemChanged( const wxDataViewItem &item ) = 0;
+ virtual bool ItemsAdded( const wxDataViewItem &parent, const wxDataViewItemArray &items );
+ virtual bool ItemsDeleted( const wxDataViewItem &parent, const wxDataViewItemArray &items );
+ virtual bool ItemsChanged( const wxDataViewItemArray &items );
+ virtual bool ValueChanged( const wxDataViewItem &item, unsigned int col ) = 0;
+ virtual bool Cleared() = 0;
+
+ // some platforms, such as GTK+, may need a two step procedure for ::Reset()
+ virtual bool BeforeReset() { return true; }
+ virtual bool AfterReset() { return Cleared(); }
+
+ virtual void Resort() = 0;
+
+ void SetOwner( wxDataViewModel *owner ) { m_owner = owner; }
+ wxDataViewModel *GetOwner() const { return m_owner; }
+
+private:
+ wxDataViewModel *m_owner;
+};
+
+
+
+// ----------------------------------------------------------------------------
+// wxDataViewItemAttr: a structure containing the visual attributes of an item
+// ----------------------------------------------------------------------------
+
+// TODO: this should be renamed to wxItemAttr or something general like this
+
+class WXDLLIMPEXP_ADV wxDataViewItemAttr
+{
+public:
+ // ctors
+ wxDataViewItemAttr()
+ {
+ m_bold = false;
+ m_italic = false;
+ }
+
+ // setters
+ void SetColour(const wxColour& colour) { m_colour = colour; }
+ void SetBold( bool set ) { m_bold = set; }
+ void SetItalic( bool set ) { m_italic = set; }
+ void SetBackgroundColour(const wxColour& colour) { m_bgColour = colour; }
+
+ // accessors
+ bool HasColour() const { return m_colour.IsOk(); }
+ const wxColour& GetColour() const { return m_colour; }
+
+ bool HasFont() const { return m_bold || m_italic; }
+ bool GetBold() const { return m_bold; }
+ bool GetItalic() const { return m_italic; }
+
+ bool HasBackgroundColour() const { return m_bgColour.IsOk(); }
+ const wxColour& GetBackgroundColour() const { return m_bgColour; }
+
+ bool IsDefault() const { return !(HasColour() || HasFont() || HasBackgroundColour()); }
+
+ // Return the font based on the given one with this attribute applied to it.
+ wxFont GetEffectiveFont(const wxFont& font) const;
+
+private:
+ wxColour m_colour;
+ bool m_bold;
+ bool m_italic;
+ wxColour m_bgColour;
+};
+
+
+// ---------------------------------------------------------
+// wxDataViewModel
+// ---------------------------------------------------------
+
+WX_DECLARE_LIST_WITH_DECL(wxDataViewModelNotifier, wxDataViewModelNotifiers,
+ class WXDLLIMPEXP_ADV);
+
+class WXDLLIMPEXP_ADV wxDataViewModel: public wxRefCounter
+{
+public:
+ wxDataViewModel();
+
+ virtual unsigned int GetColumnCount() const = 0;
+
+ // return type as reported by wxVariant
+ virtual wxString GetColumnType( unsigned int col ) const = 0;
+
+ // get value into a wxVariant
+ virtual void GetValue( wxVariant &variant,
+ const wxDataViewItem &item, unsigned int col ) const = 0;
+
+ // return true if the given item has a value to display in the given
+ // column: this is always true except for container items which by default
+ // only show their label in the first column (but see HasContainerColumns())
+ bool HasValue(const wxDataViewItem& item, unsigned col) const
+ {
+ return col == 0 || !IsContainer(item) || HasContainerColumns(item);
+ }
+
+ // usually ValueChanged() should be called after changing the value in the
+ // model to update the control, ChangeValue() does it on its own while
+ // SetValue() does not -- so while you will override SetValue(), you should
+ // be usually calling ChangeValue()
+ virtual bool SetValue(const wxVariant &variant,
+ const wxDataViewItem &item,
+ unsigned int col) = 0;
+
+ bool ChangeValue(const wxVariant& variant,
+ const wxDataViewItem& item,
+ unsigned int col)
+ {
+ return SetValue(variant, item, col) && ValueChanged(item, col);
+ }
+
+ // Get text attribute, return false of default attributes should be used
+ virtual bool GetAttr(const wxDataViewItem &WXUNUSED(item),
+ unsigned int WXUNUSED(col),
+ wxDataViewItemAttr &WXUNUSED(attr)) const
+ {
+ return false;
+ }
+
+ // Override this if you want to disable specific items
+ virtual bool IsEnabled(const wxDataViewItem &WXUNUSED(item),
+ unsigned int WXUNUSED(col)) const
+ {
+ return true;
+ }
+
+ // define hierarchy
+ virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const = 0;
+ virtual bool IsContainer( const wxDataViewItem &item ) const = 0;
+ // Is the container just a header or an item with all columns
+ virtual bool HasContainerColumns(const wxDataViewItem& WXUNUSED(item)) const
+ { return false; }
+ virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const = 0;
+
+ // delegated notifiers
+ bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item );
+ bool ItemsAdded( const wxDataViewItem &parent, const wxDataViewItemArray &items );
+ bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item );
+ bool ItemsDeleted( const wxDataViewItem &parent, const wxDataViewItemArray &items );
+ bool ItemChanged( const wxDataViewItem &item );
+ bool ItemsChanged( const wxDataViewItemArray &items );
+ bool ValueChanged( const wxDataViewItem &item, unsigned int col );
+ bool Cleared();
+
+ // some platforms, such as GTK+, may need a two step procedure for ::Reset()
+ bool BeforeReset();
+ bool AfterReset();
+
+
+ // delegated action
+ virtual void Resort();
+
+ void AddNotifier( wxDataViewModelNotifier *notifier );
+ void RemoveNotifier( wxDataViewModelNotifier *notifier );
+
+ // default compare function
+ virtual int Compare( const wxDataViewItem &item1, const wxDataViewItem &item2,
+ unsigned int column, bool ascending ) const;
+ virtual bool HasDefaultCompare() const { return false; }
+
+ // internal
+ virtual bool IsListModel() const { return false; }
+ virtual bool IsVirtualListModel() const { return false; }
+
+protected:
+ // the user should not delete this class directly: he should use DecRef() instead!
+ virtual ~wxDataViewModel() { }
+
+ wxDataViewModelNotifiers m_notifiers;
+};
+
+// ----------------------------------------------------------------------------
+// wxDataViewListModel: a model of a list, i.e. flat data structure without any
+// branches/containers, used as base class by wxDataViewIndexListModel and
+// wxDataViewVirtualListModel
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewListModel : public wxDataViewModel
+{
+public:
+ // derived classes should override these methods instead of
+ // {Get,Set}Value() and GetAttr() inherited from the base class
+
+ virtual void GetValueByRow(wxVariant &variant,
+ unsigned row, unsigned col) const = 0;
+
+ virtual bool SetValueByRow(const wxVariant &variant,
+ unsigned row, unsigned col) = 0;
+
+ virtual bool
+ GetAttrByRow(unsigned WXUNUSED(row), unsigned WXUNUSED(col),
+ wxDataViewItemAttr &WXUNUSED(attr)) const
+ {
+ return false;
+ }
+
+ virtual bool IsEnabledByRow(unsigned int WXUNUSED(row),
+ unsigned int WXUNUSED(col)) const
+ {
+ return true;
+ }
+
+
+ // helper methods provided by list models only
+ virtual unsigned GetRow( const wxDataViewItem &item ) const = 0;
+
+ // returns the number of rows
+ virtual unsigned int GetCount() const = 0;
+
+ // implement some base class pure virtual directly
+ virtual wxDataViewItem
+ GetParent( const wxDataViewItem & WXUNUSED(item) ) const
+ {
+ // items never have valid parent in this model
+ return wxDataViewItem();
+ }
+
+ virtual bool IsContainer( const wxDataViewItem &item ) const
+ {
+ // only the invisible (and invalid) root item has children
+ return !item.IsOk();
+ }
+
+ // and implement some others by forwarding them to our own ones
+ virtual void GetValue( wxVariant &variant,
+ const wxDataViewItem &item, unsigned int col ) const
+ {
+ GetValueByRow(variant, GetRow(item), col);
+ }
+
+ virtual bool SetValue( const wxVariant &variant,
+ const wxDataViewItem &item, unsigned int col )
+ {
+ return SetValueByRow( variant, GetRow(item), col );
+ }
+
+ virtual bool GetAttr(const wxDataViewItem &item, unsigned int col,
+ wxDataViewItemAttr &attr) const
+ {
+ return GetAttrByRow( GetRow(item), col, attr );
+ }
+
+ virtual bool IsEnabled(const wxDataViewItem &item, unsigned int col) const
+ {
+ return IsEnabledByRow( GetRow(item), col );
+ }
+
+
+ virtual bool IsListModel() const { return true; }
+};
+
+// ---------------------------------------------------------
+// wxDataViewIndexListModel
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewIndexListModel: public wxDataViewListModel
+{
+public:
+ wxDataViewIndexListModel( unsigned int initial_size = 0 );
+
+ void RowPrepended();
+ void RowInserted( unsigned int before );
+ void RowAppended();
+ void RowDeleted( unsigned int row );
+ void RowsDeleted( const wxArrayInt &rows );
+ void RowChanged( unsigned int row );
+ void RowValueChanged( unsigned int row, unsigned int col );
+ void Reset( unsigned int new_size );
+
+ // convert to/from row/wxDataViewItem
+
+ virtual unsigned GetRow( const wxDataViewItem &item ) const;
+ wxDataViewItem GetItem( unsigned int row ) const;
+
+ // implement base methods
+ virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const;
+
+ unsigned int GetCount() const { return m_hash.GetCount(); }
+
+private:
+ wxDataViewItemArray m_hash;
+ unsigned int m_nextFreeID;
+ bool m_ordered;
+};
+
+// ---------------------------------------------------------
+// wxDataViewVirtualListModel
+// ---------------------------------------------------------
+
+#ifdef __WXMAC__
+// better than nothing
+typedef wxDataViewIndexListModel wxDataViewVirtualListModel;
+#else
+
+class WXDLLIMPEXP_ADV wxDataViewVirtualListModel: public wxDataViewListModel
+{
+public:
+ wxDataViewVirtualListModel( unsigned int initial_size = 0 );
+
+ void RowPrepended();
+ void RowInserted( unsigned int before );
+ void RowAppended();
+ void RowDeleted( unsigned int row );
+ void RowsDeleted( const wxArrayInt &rows );
+ void RowChanged( unsigned int row );
+ void RowValueChanged( unsigned int row, unsigned int col );
+ void Reset( unsigned int new_size );
+
+ // convert to/from row/wxDataViewItem
+
+ virtual unsigned GetRow( const wxDataViewItem &item ) const;
+ wxDataViewItem GetItem( unsigned int row ) const;
+
+ // compare based on index
+
+ virtual int Compare( const wxDataViewItem &item1, const wxDataViewItem &item2,
+ unsigned int column, bool ascending ) const;
+ virtual bool HasDefaultCompare() const;
+
+ // implement base methods
+ virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const;
+
+ unsigned int GetCount() const { return m_size; }
+
+ // internal
+ virtual bool IsVirtualListModel() const { return true; }
+
+private:
+ unsigned int m_size;
+};
+#endif
+
+// ----------------------------------------------------------------------------
+// wxDataViewRenderer and related classes
+// ----------------------------------------------------------------------------
+
+#include "wx/dvrenderers.h"
+
+// ---------------------------------------------------------
+// wxDataViewColumnBase
+// ---------------------------------------------------------
+
+// for compatibility only, do not use
+enum wxDataViewColumnFlags
+{
+ wxDATAVIEW_COL_RESIZABLE = wxCOL_RESIZABLE,
+ wxDATAVIEW_COL_SORTABLE = wxCOL_SORTABLE,
+ wxDATAVIEW_COL_REORDERABLE = wxCOL_REORDERABLE,
+ wxDATAVIEW_COL_HIDDEN = wxCOL_HIDDEN
+};
+
+class WXDLLIMPEXP_ADV wxDataViewColumnBase : public wxSettableHeaderColumn
+{
+public:
+ // ctor for the text columns: takes ownership of renderer
+ wxDataViewColumnBase(wxDataViewRenderer *renderer,
+ unsigned int model_column)
+ {
+ Init(renderer, model_column);
+ }
+
+ // ctor for the bitmap columns
+ wxDataViewColumnBase(const wxBitmap& bitmap,
+ wxDataViewRenderer *renderer,
+ unsigned int model_column)
+ : m_bitmap(bitmap)
+ {
+ Init(renderer, model_column);
+ }
+
+ virtual ~wxDataViewColumnBase();
+
+ // setters:
+ virtual void SetOwner( wxDataViewCtrl *owner )
+ { m_owner = owner; }
+
+ // getters:
+ unsigned int GetModelColumn() const { return static_cast<unsigned int>(m_model_column); }
+ wxDataViewCtrl *GetOwner() const { return m_owner; }
+ wxDataViewRenderer* GetRenderer() const { return m_renderer; }
+
+ // implement some of base class pure virtuals (the rest is port-dependent
+ // and done differently in generic and native versions)
+ virtual void SetBitmap( const wxBitmap& bitmap ) { m_bitmap = bitmap; }
+ virtual wxBitmap GetBitmap() const { return m_bitmap; }
+
+protected:
+ wxDataViewRenderer *m_renderer;
+ int m_model_column;
+ wxBitmap m_bitmap;
+ wxDataViewCtrl *m_owner;
+
+private:
+ // common part of all ctors
+ void Init(wxDataViewRenderer *renderer, unsigned int model_column);
+};
+
+// ---------------------------------------------------------
+// wxDataViewCtrlBase
+// ---------------------------------------------------------
+
+#define wxDV_SINGLE 0x0000 // for convenience
+#define wxDV_MULTIPLE 0x0001 // can select multiple items
+
+#define wxDV_NO_HEADER 0x0002 // column titles not visible
+#define wxDV_HORIZ_RULES 0x0004 // light horizontal rules between rows
+#define wxDV_VERT_RULES 0x0008 // light vertical rules between columns
+
+#define wxDV_ROW_LINES 0x0010 // alternating colour in rows
+#define wxDV_VARIABLE_LINE_HEIGHT 0x0020 // variable line height
+
+class WXDLLIMPEXP_ADV wxDataViewCtrlBase: public wxControl
+{
+public:
+ wxDataViewCtrlBase();
+ virtual ~wxDataViewCtrlBase();
+
+ // model
+ // -----
+
+ virtual bool AssociateModel( wxDataViewModel *model );
+ wxDataViewModel* GetModel();
+ const wxDataViewModel* GetModel() const;
+
+
+ // column management
+ // -----------------
+
+ wxDataViewColumn *PrependTextColumn( const wxString &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
+ wxAlignment align = wxALIGN_NOT,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *PrependIconTextColumn( const wxString &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
+ wxAlignment align = wxALIGN_NOT,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *PrependToggleColumn( const wxString &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *PrependProgressColumn( const wxString &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *PrependDateColumn( const wxString &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1,
+ wxAlignment align = wxALIGN_NOT,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *PrependBitmapColumn( const wxString &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *PrependTextColumn( const wxBitmap &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
+ wxAlignment align = wxALIGN_NOT,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *PrependIconTextColumn( const wxBitmap &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
+ wxAlignment align = wxALIGN_NOT,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *PrependToggleColumn( const wxBitmap &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *PrependProgressColumn( const wxBitmap &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *PrependDateColumn( const wxBitmap &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1,
+ wxAlignment align = wxALIGN_NOT,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *PrependBitmapColumn( const wxBitmap &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+
+ wxDataViewColumn *AppendTextColumn( const wxString &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
+ wxAlignment align = wxALIGN_NOT,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *AppendIconTextColumn( const wxString &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
+ wxAlignment align = wxALIGN_NOT,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *AppendToggleColumn( const wxString &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *AppendProgressColumn( const wxString &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *AppendDateColumn( const wxString &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1,
+ wxAlignment align = wxALIGN_NOT,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *AppendBitmapColumn( const wxString &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *AppendTextColumn( const wxBitmap &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
+ wxAlignment align = wxALIGN_NOT,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *AppendIconTextColumn( const wxBitmap &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
+ wxAlignment align = wxALIGN_NOT,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *AppendToggleColumn( const wxBitmap &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *AppendProgressColumn( const wxBitmap &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *AppendDateColumn( const wxBitmap &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1,
+ wxAlignment align = wxALIGN_NOT,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *AppendBitmapColumn( const wxBitmap &label, unsigned int model_column,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+
+ virtual bool PrependColumn( wxDataViewColumn *col );
+ virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col );
+ virtual bool AppendColumn( wxDataViewColumn *col );
+
+ virtual unsigned int GetColumnCount() const = 0;
+ virtual wxDataViewColumn* GetColumn( unsigned int pos ) const = 0;
+ virtual int GetColumnPosition( const wxDataViewColumn *column ) const = 0;
+
+ virtual bool DeleteColumn( wxDataViewColumn *column ) = 0;
+ virtual bool ClearColumns() = 0;
+
+ void SetExpanderColumn( wxDataViewColumn *col )
+ { m_expander_column = col ; DoSetExpanderColumn(); }
+ wxDataViewColumn *GetExpanderColumn() const
+ { return m_expander_column; }
+
+ virtual wxDataViewColumn *GetSortingColumn() const = 0;
+
+
+ // items management
+ // ----------------
+
+ void SetIndent( int indent )
+ { m_indent = indent ; DoSetIndent(); }
+ int GetIndent() const
+ { return m_indent; }
+
+ // Current item is the one used by the keyboard navigation, it is the same
+ // as the (unique) selected item in single selection mode so these
+ // functions are mostly useful for controls with wxDV_MULTIPLE style.
+ wxDataViewItem GetCurrentItem() const;
+ void SetCurrentItem(const wxDataViewItem& item);
+
+ // Currently focused column of the current item or NULL if no column has focus
+ virtual wxDataViewColumn *GetCurrentColumn() const = 0;
+
+ // Selection: both GetSelection() and GetSelections() can be used for the
+ // controls both with and without wxDV_MULTIPLE style. For single selection
+ // controls GetSelections() is not very useful however. And for multi
+ // selection controls GetSelection() returns an invalid item if more than
+ // one item is selected. Use GetSelectedItemsCount() or HasSelection() to
+ // check if any items are selected at all.
+ virtual int GetSelectedItemsCount() const = 0;
+ bool HasSelection() const { return GetSelectedItemsCount() != 0; }
+ wxDataViewItem GetSelection() const;
+ virtual int GetSelections( wxDataViewItemArray & sel ) const = 0;
+ virtual void SetSelections( const wxDataViewItemArray & sel ) = 0;
+ virtual void Select( const wxDataViewItem & item ) = 0;
+ virtual void Unselect( const wxDataViewItem & item ) = 0;
+ virtual bool IsSelected( const wxDataViewItem & item ) const = 0;
+
+ virtual void SelectAll() = 0;
+ virtual void UnselectAll() = 0;
+
+ virtual void Expand( const wxDataViewItem & item ) = 0;
+ virtual void ExpandAncestors( const wxDataViewItem & item );
+ virtual void Collapse( const wxDataViewItem & item ) = 0;
+ virtual bool IsExpanded( const wxDataViewItem & item ) const = 0;
+
+ virtual void EnsureVisible( const wxDataViewItem & item,
+ const wxDataViewColumn *column = NULL ) = 0;
+ virtual void HitTest( const wxPoint & point, wxDataViewItem &item, wxDataViewColumn* &column ) const = 0;
+ virtual wxRect GetItemRect( const wxDataViewItem & item, const wxDataViewColumn *column = NULL ) const = 0;
+
+ virtual bool SetRowHeight( int WXUNUSED(rowHeight) ) { return false; }
+
+ virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column) = 0;
+
+ // Use EditItem() instead
+ wxDEPRECATED( void StartEditor(const wxDataViewItem& item, unsigned int column) );
+
+#if wxUSE_DRAG_AND_DROP
+ virtual bool EnableDragSource(const wxDataFormat& WXUNUSED(format))
+ { return false; }
+ virtual bool EnableDropTarget(const wxDataFormat& WXUNUSED(format))
+ { return false; }
+#endif // wxUSE_DRAG_AND_DROP
+
+ // define control visual attributes
+ // --------------------------------
+
+ virtual wxVisualAttributes GetDefaultAttributes() const
+ {
+ return GetClassDefaultAttributes(GetWindowVariant());
+ }
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL)
+ {
+ return wxControl::GetCompositeControlsDefaultAttributes(variant);
+ }
+
+protected:
+ virtual void DoSetExpanderColumn() = 0 ;
+ virtual void DoSetIndent() = 0;
+
+private:
+ // Implementation of the public Set/GetCurrentItem() methods which are only
+ // called in multi selection case (for single selection controls their
+ // implementation is trivial and is done in the base class itself).
+ virtual wxDataViewItem DoGetCurrentItem() const = 0;
+ virtual void DoSetCurrentItem(const wxDataViewItem& item) = 0;
+
+ wxDataViewModel *m_model;
+ wxDataViewColumn *m_expander_column;
+ int m_indent ;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase)
+};
+
+// ----------------------------------------------------------------------------
+// wxDataViewEvent - the event class for the wxDataViewCtrl notifications
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewEvent : public wxNotifyEvent
+{
+public:
+ wxDataViewEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
+ : wxNotifyEvent(commandType, winid),
+ m_item(0),
+ m_col(-1),
+ m_model(NULL),
+ m_value(wxNullVariant),
+ m_column(NULL),
+ m_pos(-1,-1),
+ m_cacheFrom(0),
+ m_cacheTo(0),
+ m_editCancelled(false)
+#if wxUSE_DRAG_AND_DROP
+ , m_dataObject(NULL),
+ m_dataBuffer(NULL),
+ m_dataSize(0),
+ m_dragFlags(0),
+ m_dropEffect(wxDragNone)
+#endif
+ { }
+
+ wxDataViewEvent(const wxDataViewEvent& event)
+ : wxNotifyEvent(event),
+ m_item(event.m_item),
+ m_col(event.m_col),
+ m_model(event.m_model),
+ m_value(event.m_value),
+ m_column(event.m_column),
+ m_pos(event.m_pos),
+ m_cacheFrom(event.m_cacheFrom),
+ m_cacheTo(event.m_cacheTo),
+ m_editCancelled(event.m_editCancelled)
+#if wxUSE_DRAG_AND_DROP
+ , m_dataObject(event.m_dataObject),
+ m_dataFormat(event.m_dataFormat),
+ m_dataBuffer(event.m_dataBuffer),
+ m_dataSize(event.m_dataSize),
+ m_dragFlags(event.m_dragFlags),
+ m_dropEffect(event.m_dropEffect)
+#endif
+ { }
+
+ wxDataViewItem GetItem() const { return m_item; }
+ void SetItem( const wxDataViewItem &item ) { m_item = item; }
+
+ int GetColumn() const { return m_col; }
+ void SetColumn( int col ) { m_col = col; }
+
+ wxDataViewModel* GetModel() const { return m_model; }
+ void SetModel( wxDataViewModel *model ) { m_model = model; }
+
+ const wxVariant &GetValue() const { return m_value; }
+ void SetValue( const wxVariant &value ) { m_value = value; }
+
+ // for wxEVT_DATAVIEW_ITEM_EDITING_DONE only
+ bool IsEditCancelled() const { return m_editCancelled; }
+ void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; }
+
+ // for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only
+ void SetDataViewColumn( wxDataViewColumn *col ) { m_column = col; }
+ wxDataViewColumn *GetDataViewColumn() const { return m_column; }
+
+ // for wxEVT_DATAVIEW_CONTEXT_MENU only
+ wxPoint GetPosition() const { return m_pos; }
+ void SetPosition( int x, int y ) { m_pos.x = x; m_pos.y = y; }
+
+ // For wxEVT_DATAVIEW_CACHE_HINT
+ int GetCacheFrom() const { return m_cacheFrom; }
+ int GetCacheTo() const { return m_cacheTo; }
+ void SetCache(int from, int to) { m_cacheFrom = from; m_cacheTo = to; }
+
+
+#if wxUSE_DRAG_AND_DROP
+ // For drag operations
+ void SetDataObject( wxDataObject *obj ) { m_dataObject = obj; }
+ wxDataObject *GetDataObject() const { return m_dataObject; }
+
+ // For drop operations
+ void SetDataFormat( const wxDataFormat &format ) { m_dataFormat = format; }
+ wxDataFormat GetDataFormat() const { return m_dataFormat; }
+ void SetDataSize( size_t size ) { m_dataSize = size; }
+ size_t GetDataSize() const { return m_dataSize; }
+ void SetDataBuffer( void* buf ) { m_dataBuffer = buf;}
+ void *GetDataBuffer() const { return m_dataBuffer; }
+ void SetDragFlags( int flags ) { m_dragFlags = flags; }
+ int GetDragFlags() const { return m_dragFlags; }
+ void SetDropEffect( wxDragResult effect ) { m_dropEffect = effect; }
+ wxDragResult GetDropEffect() const { return m_dropEffect; }
+#endif // wxUSE_DRAG_AND_DROP
+
+ virtual wxEvent *Clone() const { return new wxDataViewEvent(*this); }
+
+protected:
+ wxDataViewItem m_item;
+ int m_col;
+ wxDataViewModel *m_model;
+ wxVariant m_value;
+ wxDataViewColumn *m_column;
+ wxPoint m_pos;
+ int m_cacheFrom;
+ int m_cacheTo;
+ bool m_editCancelled;
+
+#if wxUSE_DRAG_AND_DROP
+ wxDataObject *m_dataObject;
+
+ wxDataFormat m_dataFormat;
+ void* m_dataBuffer;
+ size_t m_dataSize;
+
+ int m_dragFlags;
+ wxDragResult m_dropEffect;
+#endif // wxUSE_DRAG_AND_DROP
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent)
+};
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_DATAVIEW_SELECTION_CHANGED, wxDataViewEvent );
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_DATAVIEW_ITEM_ACTIVATED, wxDataViewEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_DATAVIEW_ITEM_COLLAPSED, wxDataViewEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_DATAVIEW_ITEM_EXPANDED, wxDataViewEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_DATAVIEW_ITEM_COLLAPSING, wxDataViewEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_DATAVIEW_ITEM_EXPANDING, wxDataViewEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_DATAVIEW_ITEM_START_EDITING, wxDataViewEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_DATAVIEW_ITEM_EDITING_STARTED, wxDataViewEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_DATAVIEW_ITEM_EDITING_DONE, wxDataViewEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEvent );
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_DATAVIEW_ITEM_CONTEXT_MENU, wxDataViewEvent );
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_DATAVIEW_COLUMN_HEADER_CLICK, wxDataViewEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, wxDataViewEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_DATAVIEW_COLUMN_SORTED, wxDataViewEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_DATAVIEW_COLUMN_REORDERED, wxDataViewEvent );
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_DATAVIEW_CACHE_HINT, wxDataViewEvent );
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, wxDataViewEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE, wxDataViewEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_DATAVIEW_ITEM_DROP, wxDataViewEvent );
+
+typedef void (wxEvtHandler::*wxDataViewEventFunction)(wxDataViewEvent&);
+
+#define wxDataViewEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxDataViewEventFunction, func)
+
+#define wx__DECLARE_DATAVIEWEVT(evt, id, fn) \
+ wx__DECLARE_EVT1(wxEVT_DATAVIEW_ ## evt, id, wxDataViewEventHandler(fn))
+
+#define EVT_DATAVIEW_SELECTION_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(SELECTION_CHANGED, id, fn)
+
+#define EVT_DATAVIEW_ITEM_ACTIVATED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_ACTIVATED, id, fn)
+#define EVT_DATAVIEW_ITEM_COLLAPSING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSING, id, fn)
+#define EVT_DATAVIEW_ITEM_COLLAPSED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSED, id, fn)
+#define EVT_DATAVIEW_ITEM_EXPANDING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDING, id, fn)
+#define EVT_DATAVIEW_ITEM_EXPANDED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDED, id, fn)
+#define EVT_DATAVIEW_ITEM_START_EDITING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_START_EDITING, id, fn)
+#define EVT_DATAVIEW_ITEM_EDITING_STARTED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_STARTED, id, fn)
+#define EVT_DATAVIEW_ITEM_EDITING_DONE(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_DONE, id, fn)
+#define EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_VALUE_CHANGED, id, fn)
+
+#define EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_CONTEXT_MENU, id, fn)
+
+#define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn)
+#define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn)
+#define EVT_DATAVIEW_COLUMN_SORTED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_SORTED, id, fn)
+#define EVT_DATAVIEW_COLUMN_REORDERED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_REORDERED, id, fn)
+#define EVT_DATAVIEW_CACHE_HINT(id, fn) wx__DECLARE_DATAVIEWEVT(CACHE_HINT, id, fn)
+
+#define EVT_DATAVIEW_ITEM_BEGIN_DRAG(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_BEGIN_DRAG, id, fn)
+#define EVT_DATAVIEW_ITEM_DROP_POSSIBLE(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_DROP_POSSIBLE, id, fn)
+#define EVT_DATAVIEW_ITEM_DROP(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_DROP, id, fn)
+
+// Old and not documented synonym, don't use.
+#define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(id, fn)
+
+#ifdef wxHAS_GENERIC_DATAVIEWCTRL
+ #include "wx/generic/dataview.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/dataview.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/dataview.h"
+#else
+ #error "unknown native wxDataViewCtrl implementation"
+#endif
+
+//-----------------------------------------------------------------------------
+// wxDataViewListStore
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewListStoreLine
+{
+public:
+ wxDataViewListStoreLine( wxUIntPtr data = 0 )
+ {
+ m_data = data;
+ }
+
+ void SetData( wxUIntPtr data )
+ { m_data = data; }
+ wxUIntPtr GetData() const
+ { return m_data; }
+
+ wxVector<wxVariant> m_values;
+
+private:
+ wxUIntPtr m_data;
+};
+
+
+class WXDLLIMPEXP_ADV wxDataViewListStore: public wxDataViewIndexListModel
+{
+public:
+ wxDataViewListStore();
+ ~wxDataViewListStore();
+
+ void PrependColumn( const wxString &varianttype );
+ void InsertColumn( unsigned int pos, const wxString &varianttype );
+ void AppendColumn( const wxString &varianttype );
+
+ void AppendItem( const wxVector<wxVariant> &values, wxUIntPtr data = 0 );
+ void PrependItem( const wxVector<wxVariant> &values, wxUIntPtr data = 0 );
+ void InsertItem( unsigned int row, const wxVector<wxVariant> &values, wxUIntPtr data = 0 );
+ void DeleteItem( unsigned int pos );
+ void DeleteAllItems();
+
+ unsigned int GetItemCount() const;
+
+ void SetItemData( const wxDataViewItem& item, wxUIntPtr data );
+ wxUIntPtr GetItemData( const wxDataViewItem& item ) const;
+
+ // override base virtuals
+
+ virtual unsigned int GetColumnCount() const;
+
+ virtual wxString GetColumnType( unsigned int col ) const;
+
+ virtual void GetValueByRow( wxVariant &value,
+ unsigned int row, unsigned int col ) const;
+
+ virtual bool SetValueByRow( const wxVariant &value,
+ unsigned int row, unsigned int col );
+
+
+public:
+ wxVector<wxDataViewListStoreLine*> m_data;
+ wxArrayString m_cols;
+};
+
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewListCtrl: public wxDataViewCtrl
+{
+public:
+ wxDataViewListCtrl();
+ wxDataViewListCtrl( wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = wxDV_ROW_LINES,
+ const wxValidator& validator = wxDefaultValidator );
+ ~wxDataViewListCtrl();
+
+ bool Create( wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = wxDV_ROW_LINES,
+ const wxValidator& validator = wxDefaultValidator );
+
+ wxDataViewListStore *GetStore()
+ { return (wxDataViewListStore*) GetModel(); }
+ const wxDataViewListStore *GetStore() const
+ { return (const wxDataViewListStore*) GetModel(); }
+
+ int ItemToRow(const wxDataViewItem &item) const
+ { return item.IsOk() ? (int)GetStore()->GetRow(item) : wxNOT_FOUND; }
+ wxDataViewItem RowToItem(int row) const
+ { return row == wxNOT_FOUND ? wxDataViewItem() : GetStore()->GetItem(row); }
+
+ int GetSelectedRow() const
+ { return ItemToRow(GetSelection()); }
+ void SelectRow(unsigned row)
+ { Select(RowToItem(row)); }
+ void UnselectRow(unsigned row)
+ { Unselect(RowToItem(row)); }
+ bool IsRowSelected(unsigned row) const
+ { return IsSelected(RowToItem(row)); }
+
+ bool AppendColumn( wxDataViewColumn *column, const wxString &varianttype );
+ bool PrependColumn( wxDataViewColumn *column, const wxString &varianttype );
+ bool InsertColumn( unsigned int pos, wxDataViewColumn *column, const wxString &varianttype );
+
+ // overridden from base class
+ virtual bool PrependColumn( wxDataViewColumn *col );
+ virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col );
+ virtual bool AppendColumn( wxDataViewColumn *col );
+
+ wxDataViewColumn *AppendTextColumn( const wxString &label,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *AppendToggleColumn( const wxString &label,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
+ int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *AppendProgressColumn( const wxString &label,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *AppendIconTextColumn( const wxString &label,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE );
+
+ void AppendItem( const wxVector<wxVariant> &values, wxUIntPtr data = 0 )
+ { GetStore()->AppendItem( values, data ); }
+ void PrependItem( const wxVector<wxVariant> &values, wxUIntPtr data = 0 )
+ { GetStore()->PrependItem( values, data ); }
+ void InsertItem( unsigned int row, const wxVector<wxVariant> &values, wxUIntPtr data = 0 )
+ { GetStore()->InsertItem( row, values, data ); }
+ void DeleteItem( unsigned row )
+ { GetStore()->DeleteItem( row ); }
+ void DeleteAllItems()
+ { GetStore()->DeleteAllItems(); }
+
+ void SetValue( const wxVariant &value, unsigned int row, unsigned int col )
+ { GetStore()->SetValueByRow( value, row, col );
+ GetStore()->RowValueChanged( row, col); }
+ void GetValue( wxVariant &value, unsigned int row, unsigned int col )
+ { GetStore()->GetValueByRow( value, row, col ); }
+
+ void SetTextValue( const wxString &value, unsigned int row, unsigned int col )
+ { GetStore()->SetValueByRow( value, row, col );
+ GetStore()->RowValueChanged( row, col); }
+ wxString GetTextValue( unsigned int row, unsigned int col ) const
+ { wxVariant value; GetStore()->GetValueByRow( value, row, col ); return value.GetString(); }
+
+ void SetToggleValue( bool value, unsigned int row, unsigned int col )
+ { GetStore()->SetValueByRow( value, row, col );
+ GetStore()->RowValueChanged( row, col); }
+ bool GetToggleValue( unsigned int row, unsigned int col ) const
+ { wxVariant value; GetStore()->GetValueByRow( value, row, col ); return value.GetBool(); }
+
+ void SetItemData( const wxDataViewItem& item, wxUIntPtr data )
+ { GetStore()->SetItemData( item, data ); }
+ wxUIntPtr GetItemData( const wxDataViewItem& item ) const
+ { return GetStore()->GetItemData( item ); }
+
+ int GetItemCount() const
+ { return GetStore()->GetItemCount(); }
+
+ void OnSize( wxSizeEvent &event );
+
+private:
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewListCtrl)
+};
+
+//-----------------------------------------------------------------------------
+// wxDataViewTreeStore
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewTreeStoreNode
+{
+public:
+ wxDataViewTreeStoreNode( wxDataViewTreeStoreNode *parent,
+ const wxString &text, const wxIcon &icon = wxNullIcon, wxClientData *data = NULL );
+ virtual ~wxDataViewTreeStoreNode();
+
+ void SetText( const wxString &text )
+ { m_text = text; }
+ wxString GetText() const
+ { return m_text; }
+ void SetIcon( const wxIcon &icon )
+ { m_icon = icon; }
+ const wxIcon &GetIcon() const
+ { return m_icon; }
+ void SetData( wxClientData *data )
+ { if (m_data) delete m_data; m_data = data; }
+ wxClientData *GetData() const
+ { return m_data; }
+
+ wxDataViewItem GetItem() const
+ { return wxDataViewItem( (void*) this ); }
+
+ virtual bool IsContainer()
+ { return false; }
+
+ wxDataViewTreeStoreNode *GetParent()
+ { return m_parent; }
+
+private:
+ wxDataViewTreeStoreNode *m_parent;
+ wxString m_text;
+ wxIcon m_icon;
+ wxClientData *m_data;
+};
+
+WX_DECLARE_LIST_WITH_DECL(wxDataViewTreeStoreNode, wxDataViewTreeStoreNodeList,
+ class WXDLLIMPEXP_ADV);
+
+class WXDLLIMPEXP_ADV wxDataViewTreeStoreContainerNode: public wxDataViewTreeStoreNode
+{
+public:
+ wxDataViewTreeStoreContainerNode( wxDataViewTreeStoreNode *parent,
+ const wxString &text, const wxIcon &icon = wxNullIcon, const wxIcon &expanded = wxNullIcon,
+ wxClientData *data = NULL );
+ virtual ~wxDataViewTreeStoreContainerNode();
+
+ const wxDataViewTreeStoreNodeList &GetChildren() const
+ { return m_children; }
+ wxDataViewTreeStoreNodeList &GetChildren()
+ { return m_children; }
+
+ void SetExpandedIcon( const wxIcon &icon )
+ { m_iconExpanded = icon; }
+ const wxIcon &GetExpandedIcon() const
+ { return m_iconExpanded; }
+
+ void SetExpanded( bool expanded = true )
+ { m_isExpanded = expanded; }
+ bool IsExpanded() const
+ { return m_isExpanded; }
+
+ virtual bool IsContainer()
+ { return true; }
+
+private:
+ wxDataViewTreeStoreNodeList m_children;
+ wxIcon m_iconExpanded;
+ bool m_isExpanded;
+};
+
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewTreeStore: public wxDataViewModel
+{
+public:
+ wxDataViewTreeStore();
+ ~wxDataViewTreeStore();
+
+ wxDataViewItem AppendItem( const wxDataViewItem& parent,
+ const wxString &text, const wxIcon &icon = wxNullIcon, wxClientData *data = NULL );
+ wxDataViewItem PrependItem( const wxDataViewItem& parent,
+ const wxString &text, const wxIcon &icon = wxNullIcon, wxClientData *data = NULL );
+ wxDataViewItem InsertItem( const wxDataViewItem& parent, const wxDataViewItem& previous,
+ const wxString &text, const wxIcon &icon = wxNullIcon, wxClientData *data = NULL );
+
+ wxDataViewItem PrependContainer( const wxDataViewItem& parent,
+ const wxString &text, const wxIcon &icon = wxNullIcon, const wxIcon &expanded = wxNullIcon,
+ wxClientData *data = NULL );
+ wxDataViewItem AppendContainer( const wxDataViewItem& parent,
+ const wxString &text, const wxIcon &icon = wxNullIcon, const wxIcon &expanded = wxNullIcon,
+ wxClientData *data = NULL );
+ wxDataViewItem InsertContainer( const wxDataViewItem& parent, const wxDataViewItem& previous,
+ const wxString &text, const wxIcon &icon = wxNullIcon, const wxIcon &expanded = wxNullIcon,
+ wxClientData *data = NULL );
+
+ wxDataViewItem GetNthChild( const wxDataViewItem& parent, unsigned int pos ) const;
+ int GetChildCount( const wxDataViewItem& parent ) const;
+
+ void SetItemText( const wxDataViewItem& item, const wxString &text );
+ wxString GetItemText( const wxDataViewItem& item ) const;
+ void SetItemIcon( const wxDataViewItem& item, const wxIcon &icon );
+ const wxIcon &GetItemIcon( const wxDataViewItem& item ) const;
+ void SetItemExpandedIcon( const wxDataViewItem& item, const wxIcon &icon );
+ const wxIcon &GetItemExpandedIcon( const wxDataViewItem& item ) const;
+ void SetItemData( const wxDataViewItem& item, wxClientData *data );
+ wxClientData *GetItemData( const wxDataViewItem& item ) const;
+
+ void DeleteItem( const wxDataViewItem& item );
+ void DeleteChildren( const wxDataViewItem& item );
+ void DeleteAllItems();
+
+ // implement base methods
+
+ virtual void GetValue( wxVariant &variant,
+ const wxDataViewItem &item, unsigned int col ) const;
+ virtual bool SetValue( const wxVariant &variant,
+ const wxDataViewItem &item, unsigned int col );
+ virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const;
+ virtual bool IsContainer( const wxDataViewItem &item ) const;
+ virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const;
+
+ virtual int Compare( const wxDataViewItem &item1, const wxDataViewItem &item2,
+ unsigned int column, bool ascending ) const;
+
+ virtual bool HasDefaultCompare() const
+ { return true; }
+ virtual unsigned int GetColumnCount() const
+ { return 1; }
+ virtual wxString GetColumnType( unsigned int WXUNUSED(col) ) const
+ { return wxT("wxDataViewIconText"); }
+
+ wxDataViewTreeStoreNode *FindNode( const wxDataViewItem &item ) const;
+ wxDataViewTreeStoreContainerNode *FindContainerNode( const wxDataViewItem &item ) const;
+ wxDataViewTreeStoreNode *GetRoot() const { return m_root; }
+
+public:
+ wxDataViewTreeStoreNode *m_root;
+};
+
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewTreeCtrl: public wxDataViewCtrl,
+ public wxWithImages
+{
+public:
+ wxDataViewTreeCtrl() { }
+ wxDataViewTreeCtrl(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDV_NO_HEADER | wxDV_ROW_LINES,
+ const wxValidator& validator = wxDefaultValidator)
+ {
+ Create(parent, id, pos, size, style, validator);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDV_NO_HEADER | wxDV_ROW_LINES,
+ const wxValidator& validator = wxDefaultValidator);
+
+ wxDataViewTreeStore *GetStore()
+ { return (wxDataViewTreeStore*) GetModel(); }
+ const wxDataViewTreeStore *GetStore() const
+ { return (const wxDataViewTreeStore*) GetModel(); }
+
+ bool IsContainer( const wxDataViewItem& item ) const
+ { return GetStore()->IsContainer(item); }
+
+ wxDataViewItem AppendItem( const wxDataViewItem& parent,
+ const wxString &text, int icon = NO_IMAGE, wxClientData *data = NULL );
+ wxDataViewItem PrependItem( const wxDataViewItem& parent,
+ const wxString &text, int icon = NO_IMAGE, wxClientData *data = NULL );
+ wxDataViewItem InsertItem( const wxDataViewItem& parent, const wxDataViewItem& previous,
+ const wxString &text, int icon = NO_IMAGE, wxClientData *data = NULL );
+
+ wxDataViewItem PrependContainer( const wxDataViewItem& parent,
+ const wxString &text, int icon = NO_IMAGE, int expanded = NO_IMAGE,
+ wxClientData *data = NULL );
+ wxDataViewItem AppendContainer( const wxDataViewItem& parent,
+ const wxString &text, int icon = NO_IMAGE, int expanded = NO_IMAGE,
+ wxClientData *data = NULL );
+ wxDataViewItem InsertContainer( const wxDataViewItem& parent, const wxDataViewItem& previous,
+ const wxString &text, int icon = NO_IMAGE, int expanded = NO_IMAGE,
+ wxClientData *data = NULL );
+
+ wxDataViewItem GetNthChild( const wxDataViewItem& parent, unsigned int pos ) const
+ { return GetStore()->GetNthChild(parent, pos); }
+ int GetChildCount( const wxDataViewItem& parent ) const
+ { return GetStore()->GetChildCount(parent); }
+
+ void SetItemText( const wxDataViewItem& item, const wxString &text );
+ wxString GetItemText( const wxDataViewItem& item ) const
+ { return GetStore()->GetItemText(item); }
+ void SetItemIcon( const wxDataViewItem& item, const wxIcon &icon );
+ const wxIcon &GetItemIcon( const wxDataViewItem& item ) const
+ { return GetStore()->GetItemIcon(item); }
+ void SetItemExpandedIcon( const wxDataViewItem& item, const wxIcon &icon );
+ const wxIcon &GetItemExpandedIcon( const wxDataViewItem& item ) const
+ { return GetStore()->GetItemExpandedIcon(item); }
+ void SetItemData( const wxDataViewItem& item, wxClientData *data )
+ { GetStore()->SetItemData(item,data); }
+ wxClientData *GetItemData( const wxDataViewItem& item ) const
+ { return GetStore()->GetItemData(item); }
+
+ void DeleteItem( const wxDataViewItem& item );
+ void DeleteChildren( const wxDataViewItem& item );
+ void DeleteAllItems();
+
+ void OnExpanded( wxDataViewEvent &event );
+ void OnCollapsed( wxDataViewEvent &event );
+ void OnSize( wxSizeEvent &event );
+
+private:
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewTreeCtrl)
+};
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED wxEVT_DATAVIEW_SELECTION_CHANGED
+#define wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED wxEVT_DATAVIEW_ITEM_ACTIVATED
+#define wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED wxEVT_DATAVIEW_ITEM_COLLAPSED
+#define wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED wxEVT_DATAVIEW_ITEM_EXPANDED
+#define wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING wxEVT_DATAVIEW_ITEM_COLLAPSING
+#define wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING wxEVT_DATAVIEW_ITEM_EXPANDING
+#define wxEVT_COMMAND_DATAVIEW_ITEM_START_EDITING wxEVT_DATAVIEW_ITEM_START_EDITING
+#define wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED wxEVT_DATAVIEW_ITEM_EDITING_STARTED
+#define wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE wxEVT_DATAVIEW_ITEM_EDITING_DONE
+#define wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED wxEVT_DATAVIEW_ITEM_VALUE_CHANGED
+#define wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU wxEVT_DATAVIEW_ITEM_CONTEXT_MENU
+#define wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK wxEVT_DATAVIEW_COLUMN_HEADER_CLICK
+#define wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK wxEVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK
+#define wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED wxEVT_DATAVIEW_COLUMN_SORTED
+#define wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED wxEVT_DATAVIEW_COLUMN_REORDERED
+#define wxEVT_COMMAND_DATAVIEW_CACHE_HINT wxEVT_DATAVIEW_CACHE_HINT
+#define wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG wxEVT_DATAVIEW_ITEM_BEGIN_DRAG
+#define wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE
+#define wxEVT_COMMAND_DATAVIEW_ITEM_DROP wxEVT_DATAVIEW_ITEM_DROP
+
+#endif // wxUSE_DATAVIEWCTRL
+
+#endif
+ // _WX_DATAVIEW_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/datectrl.h
+// Purpose: implements wxDatePickerCtrl
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 2005-01-09
+// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DATECTRL_H_
+#define _WX_DATECTRL_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_DATEPICKCTRL
+
+#include "wx/datetimectrl.h" // the base class
+
+#define wxDatePickerCtrlNameStr wxT("datectrl")
+
+// wxDatePickerCtrl styles
+enum
+{
+ // default style on this platform, either wxDP_SPIN or wxDP_DROPDOWN
+ wxDP_DEFAULT = 0,
+
+ // a spin control-like date picker (not supported in generic version)
+ wxDP_SPIN = 1,
+
+ // a combobox-like date picker (not supported in mac version)
+ wxDP_DROPDOWN = 2,
+
+ // always show century in the default date display (otherwise it depends on
+ // the system date format which may include the century or not)
+ wxDP_SHOWCENTURY = 4,
+
+ // allow not having any valid date in the control (by default it always has
+ // some date, today initially if no valid date specified in ctor)
+ wxDP_ALLOWNONE = 8
+};
+
+// ----------------------------------------------------------------------------
+// wxDatePickerCtrl: allow the user to enter the date
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDatePickerCtrlBase : public wxDateTimePickerCtrl
+{
+public:
+ /*
+ The derived classes should implement ctor and Create() method with the
+ following signature:
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxDateTime& dt = wxDefaultDateTime,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxDatePickerCtrlNameStr);
+ */
+
+ /*
+ We inherit the methods to set/get the date from the base class.
+
+ virtual void SetValue(const wxDateTime& dt) = 0;
+ virtual wxDateTime GetValue() const = 0;
+ */
+
+ // And add methods to set/get the allowed valid range for the dates. If
+ // either/both of them are invalid, there is no corresponding limit and if
+ // neither is set, GetRange() returns false.
+ virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2) = 0;
+ virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const = 0;
+};
+
+#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
+ #include "wx/msw/datectrl.h"
+
+ #define wxHAS_NATIVE_DATEPICKCTRL
+#elif defined(__WXOSX_COCOA__) && !defined(__WXUNIVERSAL__)
+ #include "wx/osx/datectrl.h"
+
+ #define wxHAS_NATIVE_DATEPICKCTRL
+#else
+ #include "wx/generic/datectrl.h"
+
+ class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlGeneric
+ {
+ public:
+ wxDatePickerCtrl() { }
+ wxDatePickerCtrl(wxWindow *parent,
+ wxWindowID id,
+ const wxDateTime& date = wxDefaultDateTime,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxDatePickerCtrlNameStr)
+ : wxDatePickerCtrlGeneric(parent, id, date, pos, size, style, validator, name)
+ {
+ }
+
+ private:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl)
+ };
+#endif
+
+#endif // wxUSE_DATEPICKCTRL
+
+#endif // _WX_DATECTRL_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/dateevt.h
+// Purpose: declares wxDateEvent class
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 2005-01-10
+// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DATEEVT_H_
+#define _WX_DATEEVT_H_
+
+#include "wx/event.h"
+#include "wx/datetime.h"
+#include "wx/window.h"
+
+// ----------------------------------------------------------------------------
+// wxDateEvent: used by wxCalendarCtrl, wxDatePickerCtrl and wxTimePickerCtrl.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDateEvent : public wxCommandEvent
+{
+public:
+ wxDateEvent() { }
+ wxDateEvent(wxWindow *win, const wxDateTime& dt, wxEventType type)
+ : wxCommandEvent(type, win->GetId()),
+ m_date(dt)
+ {
+ SetEventObject(win);
+ }
+
+ const wxDateTime& GetDate() const { return m_date; }
+ void SetDate(const wxDateTime &date) { m_date = date; }
+
+ // default copy ctor, assignment operator and dtor are ok
+ virtual wxEvent *Clone() const { return new wxDateEvent(*this); }
+
+private:
+ wxDateTime m_date;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDateEvent)
+};
+
+// ----------------------------------------------------------------------------
+// event types and macros for handling them
+// ----------------------------------------------------------------------------
+
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_ADV, wxEVT_DATE_CHANGED, wxDateEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_ADV, wxEVT_TIME_CHANGED, wxDateEvent);
+
+typedef void (wxEvtHandler::*wxDateEventFunction)(wxDateEvent&);
+
+#define wxDateEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxDateEventFunction, func)
+
+#define EVT_DATE_CHANGED(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_DATE_CHANGED, id, wxDateEventHandler(fn))
+
+#define EVT_TIME_CHANGED(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_TIME_CHANGED, id, wxDateEventHandler(fn))
+
+#endif // _WX_DATEEVT_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/datetime.h
+// Purpose: declarations of time/date related classes (wxDateTime,
+// wxTimeSpan)
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 10.02.99
+// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DATETIME_H
+#define _WX_DATETIME_H
+
+#include "wx/defs.h"
+
+#if wxUSE_DATETIME
+
+#ifdef __WXWINCE__
+ #include "wx/msw/wince/time.h"
+#else
+ #include <time.h>
+#endif // OS
+
+#include <limits.h> // for INT_MIN
+
+#include "wx/longlong.h"
+#include "wx/anystr.h"
+
+class WXDLLIMPEXP_FWD_BASE wxDateTime;
+class WXDLLIMPEXP_FWD_BASE wxTimeSpan;
+class WXDLLIMPEXP_FWD_BASE wxDateSpan;
+#ifdef __WINDOWS__
+struct _SYSTEMTIME;
+#endif
+
+#include "wx/dynarray.h"
+
+// not all c-runtimes are based on 1/1/1970 being (time_t) 0
+// set this to the corresponding value in seconds 1/1/1970 has on your
+// systems c-runtime
+
+#define WX_TIME_BASE_OFFSET 0
+
+/*
+ * TODO
+ *
+ * + 1. Time zones with minutes (make TimeZone a class)
+ * ? 2. getdate() function like under Solaris
+ * + 3. text conversion for wxDateSpan
+ * + 4. pluggable modules for the workdays calculations
+ * 5. wxDateTimeHolidayAuthority for Easter and other christian feasts
+ */
+
+/*
+ The three (main) classes declared in this header represent:
+
+ 1. An absolute moment in the time (wxDateTime)
+ 2. A difference between two moments in the time, positive or negative
+ (wxTimeSpan)
+ 3. A logical difference between two dates expressed in
+ years/months/weeks/days (wxDateSpan)
+
+ The following arithmetic operations are permitted (all others are not):
+
+ addition
+ --------
+
+ wxDateTime + wxTimeSpan = wxDateTime
+ wxDateTime + wxDateSpan = wxDateTime
+ wxTimeSpan + wxTimeSpan = wxTimeSpan
+ wxDateSpan + wxDateSpan = wxDateSpan
+
+ subtraction
+ ------------
+ wxDateTime - wxDateTime = wxTimeSpan
+ wxDateTime - wxTimeSpan = wxDateTime
+ wxDateTime - wxDateSpan = wxDateTime
+ wxTimeSpan - wxTimeSpan = wxTimeSpan
+ wxDateSpan - wxDateSpan = wxDateSpan
+
+ multiplication
+ --------------
+ wxTimeSpan * number = wxTimeSpan
+ number * wxTimeSpan = wxTimeSpan
+ wxDateSpan * number = wxDateSpan
+ number * wxDateSpan = wxDateSpan
+
+ unitary minus
+ -------------
+ -wxTimeSpan = wxTimeSpan
+ -wxDateSpan = wxDateSpan
+
+ For each binary operation OP (+, -, *) we have the following operatorOP=() as
+ a method and the method with a symbolic name OPER (Add, Subtract, Multiply)
+ as a synonym for it and another const method with the same name which returns
+ the changed copy of the object and operatorOP() as a global function which is
+ implemented in terms of the const version of OPEN. For the unary - we have
+ operator-() as a method, Neg() as synonym for it and Negate() which returns
+ the copy of the object with the changed sign.
+*/
+
+// an invalid/default date time object which may be used as the default
+// argument for arguments of type wxDateTime; it is also returned by all
+// functions returning wxDateTime on failure (this is why it is also called
+// wxInvalidDateTime)
+class WXDLLIMPEXP_FWD_BASE wxDateTime;
+
+extern WXDLLIMPEXP_DATA_BASE(const char) wxDefaultDateTimeFormat[];
+extern WXDLLIMPEXP_DATA_BASE(const char) wxDefaultTimeSpanFormat[];
+extern WXDLLIMPEXP_DATA_BASE(const wxDateTime) wxDefaultDateTime;
+
+#define wxInvalidDateTime wxDefaultDateTime
+
+
+// ----------------------------------------------------------------------------
+// conditional compilation
+// ----------------------------------------------------------------------------
+
+// if configure detected strftime(), we have it too
+#ifdef HAVE_STRFTIME
+ #define wxHAS_STRFTIME
+// suppose everyone else has strftime except Win CE unless VC8 is used
+#elif !defined(__WXWINCE__) || defined(__VISUALC8__)
+ #define wxHAS_STRFTIME
+#endif
+
+// ----------------------------------------------------------------------------
+// wxDateTime represents an absolute moment in the time
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxDateTime
+{
+public:
+ // types
+ // ------------------------------------------------------------------------
+
+ // a small unsigned integer type for storing things like minutes,
+ // seconds &c. It should be at least short (i.e. not char) to contain
+ // the number of milliseconds - it may also be 'int' because there is
+ // no size penalty associated with it in our code, we don't store any
+ // data in this format
+ typedef unsigned short wxDateTime_t;
+
+ // constants
+ // ------------------------------------------------------------------------
+
+ // the timezones
+ enum TZ
+ {
+ // the time in the current time zone
+ Local,
+
+ // zones from GMT (= Greenwich Mean Time): they're guaranteed to be
+ // consequent numbers, so writing something like `GMT0 + offset' is
+ // safe if abs(offset) <= 12
+
+ // underscore stands for minus
+ GMT_12, GMT_11, GMT_10, GMT_9, GMT_8, GMT_7,
+ GMT_6, GMT_5, GMT_4, GMT_3, GMT_2, GMT_1,
+ GMT0,
+ GMT1, GMT2, GMT3, GMT4, GMT5, GMT6,
+ GMT7, GMT8, GMT9, GMT10, GMT11, GMT12, GMT13,
+ // Note that GMT12 and GMT_12 are not the same: there is a difference
+ // of exactly one day between them
+
+ // some symbolic names for TZ
+
+ // Europe
+ WET = GMT0, // Western Europe Time
+ WEST = GMT1, // Western Europe Summer Time
+ CET = GMT1, // Central Europe Time
+ CEST = GMT2, // Central Europe Summer Time
+ EET = GMT2, // Eastern Europe Time
+ EEST = GMT3, // Eastern Europe Summer Time
+ MSK = GMT3, // Moscow Time
+ MSD = GMT4, // Moscow Summer Time
+
+ // US and Canada
+ AST = GMT_4, // Atlantic Standard Time
+ ADT = GMT_3, // Atlantic Daylight Time
+ EST = GMT_5, // Eastern Standard Time
+ EDT = GMT_4, // Eastern Daylight Saving Time
+ CST = GMT_6, // Central Standard Time
+ CDT = GMT_5, // Central Daylight Saving Time
+ MST = GMT_7, // Mountain Standard Time
+ MDT = GMT_6, // Mountain Daylight Saving Time
+ PST = GMT_8, // Pacific Standard Time
+ PDT = GMT_7, // Pacific Daylight Saving Time
+ HST = GMT_10, // Hawaiian Standard Time
+ AKST = GMT_9, // Alaska Standard Time
+ AKDT = GMT_8, // Alaska Daylight Saving Time
+
+ // Australia
+
+ A_WST = GMT8, // Western Standard Time
+ A_CST = GMT13 + 1, // Central Standard Time (+9.5)
+ A_EST = GMT10, // Eastern Standard Time
+ A_ESST = GMT11, // Eastern Summer Time
+
+ // New Zealand
+ NZST = GMT12, // Standard Time
+ NZDT = GMT13, // Daylight Saving Time
+
+ // TODO add more symbolic timezone names here
+
+ // Universal Coordinated Time = the new and politically correct name
+ // for GMT
+ UTC = GMT0
+ };
+
+ // the calendar systems we know about: notice that it's valid (for
+ // this classes purpose anyhow) to work with any of these calendars
+ // even with the dates before the historical appearance of the
+ // calendar
+ enum Calendar
+ {
+ Gregorian, // current calendar
+ Julian // calendar in use since -45 until the 1582 (or later)
+
+ // TODO Hebrew, Chinese, Maya, ... (just kidding) (or then may be not?)
+ };
+
+ // the country parameter is used so far for calculating the start and
+ // the end of DST period and for deciding whether the date is a work
+ // day or not
+ //
+ // TODO move this to intl.h
+
+// Required for WinCE
+#ifdef USA
+#undef USA
+#endif
+
+ enum Country
+ {
+ Country_Unknown, // no special information for this country
+ Country_Default, // set the default country with SetCountry() method
+ // or use the default country with any other
+
+ // TODO add more countries (for this we must know about DST and/or
+ // holidays for this country)
+
+ // Western European countries: we assume that they all follow the same
+ // DST rules (true or false?)
+ Country_WesternEurope_Start,
+ Country_EEC = Country_WesternEurope_Start,
+ France,
+ Germany,
+ UK,
+ Country_WesternEurope_End = UK,
+
+ Russia,
+ USA
+ };
+ // symbolic names for the months
+ enum Month
+ {
+ Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec, Inv_Month
+ };
+
+ // symbolic names for the weekdays
+ enum WeekDay
+ {
+ Sun, Mon, Tue, Wed, Thu, Fri, Sat, Inv_WeekDay
+ };
+
+ // invalid value for the year
+ enum Year
+ {
+ Inv_Year = SHRT_MIN // should hold in wxDateTime_t
+ };
+
+ // flags for GetWeekDayName and GetMonthName
+ enum NameFlags
+ {
+ Name_Full = 0x01, // return full name
+ Name_Abbr = 0x02 // return abbreviated name
+ };
+
+ // flags for GetWeekOfYear and GetWeekOfMonth
+ enum WeekFlags
+ {
+ Default_First, // Sunday_First for US, Monday_First for the rest
+ Monday_First, // week starts with a Monday
+ Sunday_First // week starts with a Sunday
+ };
+
+ // helper classes
+ // ------------------------------------------------------------------------
+
+ // a class representing a time zone: basically, this is just an offset
+ // (in seconds) from GMT
+ class WXDLLIMPEXP_BASE TimeZone
+ {
+ public:
+ TimeZone(TZ tz);
+
+ // create time zone object with the given offset
+ TimeZone(long offset = 0) { m_offset = offset; }
+
+ static TimeZone Make(long offset)
+ {
+ TimeZone tz;
+ tz.m_offset = offset;
+ return tz;
+ }
+
+ long GetOffset() const { return m_offset; }
+
+ private:
+ // offset for this timezone from GMT in seconds
+ long m_offset;
+ };
+
+ // standard struct tm is limited to the years from 1900 (because
+ // tm_year field is the offset from 1900), so we use our own struct
+ // instead to represent broken down time
+ //
+ // NB: this struct should always be kept normalized (i.e. mon should
+ // be < 12, 1 <= day <= 31 &c), so use AddMonths(), AddDays()
+ // instead of modifying the member fields directly!
+ struct WXDLLIMPEXP_BASE Tm
+ {
+ wxDateTime_t msec, sec, min, hour,
+ mday, // Day of the month in 1..31 range.
+ yday; // Day of the year in 0..365 range.
+ Month mon;
+ int year;
+
+ // default ctor inits the object to an invalid value
+ Tm();
+
+ // ctor from struct tm and the timezone
+ Tm(const struct tm& tm, const TimeZone& tz);
+
+ // check that the given date/time is valid (in Gregorian calendar)
+ bool IsValid() const;
+
+ // get the week day
+ WeekDay GetWeekDay() // not const because wday may be changed
+ {
+ if ( wday == Inv_WeekDay )
+ ComputeWeekDay();
+
+ return (WeekDay)wday;
+ }
+
+ // add the given number of months to the date keeping it normalized
+ void AddMonths(int monDiff);
+
+ // add the given number of months to the date keeping it normalized
+ void AddDays(int dayDiff);
+
+ private:
+ // compute the weekday from other fields
+ void ComputeWeekDay();
+
+ // the timezone we correspond to
+ TimeZone m_tz;
+
+ // This value can only be accessed via GetWeekDay() and not directly
+ // because it's not always computed when creating this object and may
+ // need to be calculated on demand.
+ wxDateTime_t wday;
+ };
+
+ // static methods
+ // ------------------------------------------------------------------------
+
+ // set the current country
+ static void SetCountry(Country country);
+ // get the current country
+ static Country GetCountry();
+
+ // return true if the country is a West European one (in practice,
+ // this means that the same DST rules as for EEC apply)
+ static bool IsWestEuropeanCountry(Country country = Country_Default);
+
+ // return the current year
+ static int GetCurrentYear(Calendar cal = Gregorian);
+
+ // convert the year as returned by wxDateTime::GetYear() to a year
+ // suitable for BC/AD notation. The difference is that BC year 1
+ // corresponds to the year 0 (while BC year 0 didn't exist) and AD
+ // year N is just year N.
+ static int ConvertYearToBC(int year);
+
+ // return the current month
+ static Month GetCurrentMonth(Calendar cal = Gregorian);
+
+ // returns true if the given year is a leap year in the given calendar
+ static bool IsLeapYear(int year = Inv_Year, Calendar cal = Gregorian);
+
+ // get the century (19 for 1999, 20 for 2000 and -5 for 492 BC)
+ static int GetCentury(int year);
+
+ // returns the number of days in this year (356 or 355 for Gregorian
+ // calendar usually :-)
+ static wxDateTime_t GetNumberOfDays(int year, Calendar cal = Gregorian);
+
+ // get the number of the days in the given month (default value for
+ // the year means the current one)
+ static wxDateTime_t GetNumberOfDays(Month month,
+ int year = Inv_Year,
+ Calendar cal = Gregorian);
+
+
+ // get the full (default) or abbreviated month name in the current
+ // locale, returns empty string on error
+ static wxString GetMonthName(Month month,
+ NameFlags flags = Name_Full);
+
+ // get the standard English full (default) or abbreviated month name
+ static wxString GetEnglishMonthName(Month month,
+ NameFlags flags = Name_Full);
+
+ // get the full (default) or abbreviated weekday name in the current
+ // locale, returns empty string on error
+ static wxString GetWeekDayName(WeekDay weekday,
+ NameFlags flags = Name_Full);
+
+ // get the standard English full (default) or abbreviated weekday name
+ static wxString GetEnglishWeekDayName(WeekDay weekday,
+ NameFlags flags = Name_Full);
+
+ // get the AM and PM strings in the current locale (may be empty)
+ static void GetAmPmStrings(wxString *am, wxString *pm);
+
+ // return true if the given country uses DST for this year
+ static bool IsDSTApplicable(int year = Inv_Year,
+ Country country = Country_Default);
+
+ // get the beginning of DST for this year, will return invalid object
+ // if no DST applicable in this year. The default value of the
+ // parameter means to take the current year.
+ static wxDateTime GetBeginDST(int year = Inv_Year,
+ Country country = Country_Default);
+ // get the end of DST for this year, will return invalid object
+ // if no DST applicable in this year. The default value of the
+ // parameter means to take the current year.
+ static wxDateTime GetEndDST(int year = Inv_Year,
+ Country country = Country_Default);
+
+ // return the wxDateTime object for the current time
+ static inline wxDateTime Now();
+
+ // return the wxDateTime object for the current time with millisecond
+ // precision (if available on this platform)
+ static wxDateTime UNow();
+
+ // return the wxDateTime object for today midnight: i.e. as Now() but
+ // with time set to 0
+ static inline wxDateTime Today();
+
+ // constructors: you should test whether the constructor succeeded with
+ // IsValid() function. The values Inv_Month and Inv_Year for the
+ // parameters mean take current month and/or year values.
+ // ------------------------------------------------------------------------
+
+ // default ctor does not initialize the object, use Set()!
+ wxDateTime() { m_time = wxLongLong(wxINT32_MIN, 0); }
+
+ // from time_t: seconds since the Epoch 00:00:00 UTC, Jan 1, 1970)
+#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
+// VA C++ confuses this with wxDateTime(double jdn) thinking it is a duplicate declaration
+ inline wxDateTime(time_t timet);
+#endif
+ // from broken down time/date (only for standard Unix range)
+ inline wxDateTime(const struct tm& tm);
+ // from broken down time/date (any range)
+ inline wxDateTime(const Tm& tm);
+
+ // from JDN (beware of rounding errors)
+ inline wxDateTime(double jdn);
+
+ // from separate values for each component, date set to today
+ inline wxDateTime(wxDateTime_t hour,
+ wxDateTime_t minute = 0,
+ wxDateTime_t second = 0,
+ wxDateTime_t millisec = 0);
+ // from separate values for each component with explicit date
+ inline wxDateTime(wxDateTime_t day, // day of the month
+ Month month,
+ int year = Inv_Year, // 1999, not 99 please!
+ wxDateTime_t hour = 0,
+ wxDateTime_t minute = 0,
+ wxDateTime_t second = 0,
+ wxDateTime_t millisec = 0);
+#ifdef __WINDOWS__
+ wxDateTime(const struct _SYSTEMTIME& st)
+ {
+ SetFromMSWSysTime(st);
+ }
+#endif
+
+ // default copy ctor ok
+
+ // no dtor
+
+ // assignment operators and Set() functions: all non const methods return
+ // the reference to this object. IsValid() should be used to test whether
+ // the function succeeded.
+ // ------------------------------------------------------------------------
+
+ // set to the current time
+ inline wxDateTime& SetToCurrent();
+
+#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
+// VA C++ confuses this with wxDateTime(double jdn) thinking it is a duplicate declaration
+ // set to given time_t value
+ inline wxDateTime& Set(time_t timet);
+#endif
+
+ // set to given broken down time/date
+ wxDateTime& Set(const struct tm& tm);
+
+ // set to given broken down time/date
+ inline wxDateTime& Set(const Tm& tm);
+
+ // set to given JDN (beware of rounding errors)
+ wxDateTime& Set(double jdn);
+
+ // set to given time, date = today
+ wxDateTime& Set(wxDateTime_t hour,
+ wxDateTime_t minute = 0,
+ wxDateTime_t second = 0,
+ wxDateTime_t millisec = 0);
+
+ // from separate values for each component with explicit date
+ // (defaults for month and year are the current values)
+ wxDateTime& Set(wxDateTime_t day,
+ Month month,
+ int year = Inv_Year, // 1999, not 99 please!
+ wxDateTime_t hour = 0,
+ wxDateTime_t minute = 0,
+ wxDateTime_t second = 0,
+ wxDateTime_t millisec = 0);
+
+ // resets time to 00:00:00, doesn't change the date
+ wxDateTime& ResetTime();
+
+ // get the date part of this object only, i.e. the object which has the
+ // same date as this one but time of 00:00:00
+ wxDateTime GetDateOnly() const;
+
+ // the following functions don't change the values of the other
+ // fields, i.e. SetMinute() won't change either hour or seconds value
+
+ // set the year
+ wxDateTime& SetYear(int year);
+ // set the month
+ wxDateTime& SetMonth(Month month);
+ // set the day of the month
+ wxDateTime& SetDay(wxDateTime_t day);
+ // set hour
+ wxDateTime& SetHour(wxDateTime_t hour);
+ // set minute
+ wxDateTime& SetMinute(wxDateTime_t minute);
+ // set second
+ wxDateTime& SetSecond(wxDateTime_t second);
+ // set millisecond
+ wxDateTime& SetMillisecond(wxDateTime_t millisecond);
+
+ // assignment operator from time_t
+ wxDateTime& operator=(time_t timet) { return Set(timet); }
+
+ // assignment operator from broken down time/date
+ wxDateTime& operator=(const struct tm& tm) { return Set(tm); }
+
+ // assignment operator from broken down time/date
+ wxDateTime& operator=(const Tm& tm) { return Set(tm); }
+
+ // default assignment operator is ok
+
+ // calendar calculations (functions which set the date only leave the time
+ // unchanged, e.g. don't explicitly zero it): SetXXX() functions modify the
+ // object itself, GetXXX() ones return a new object.
+ // ------------------------------------------------------------------------
+
+ // set to the given week day in the same week as this one
+ wxDateTime& SetToWeekDayInSameWeek(WeekDay weekday,
+ WeekFlags flags = Monday_First);
+ inline wxDateTime GetWeekDayInSameWeek(WeekDay weekday,
+ WeekFlags flags = Monday_First) const;
+
+ // set to the next week day following this one
+ wxDateTime& SetToNextWeekDay(WeekDay weekday);
+ inline wxDateTime GetNextWeekDay(WeekDay weekday) const;
+
+ // set to the previous week day before this one
+ wxDateTime& SetToPrevWeekDay(WeekDay weekday);
+ inline wxDateTime GetPrevWeekDay(WeekDay weekday) const;
+
+ // set to Nth occurrence of given weekday in the given month of the
+ // given year (time is set to 0), return true on success and false on
+ // failure. n may be positive (1..5) or negative to count from the end
+ // of the month (see helper function SetToLastWeekDay())
+ bool SetToWeekDay(WeekDay weekday,
+ int n = 1,
+ Month month = Inv_Month,
+ int year = Inv_Year);
+ inline wxDateTime GetWeekDay(WeekDay weekday,
+ int n = 1,
+ Month month = Inv_Month,
+ int year = Inv_Year) const;
+
+ // sets to the last weekday in the given month, year
+ inline bool SetToLastWeekDay(WeekDay weekday,
+ Month month = Inv_Month,
+ int year = Inv_Year);
+ inline wxDateTime GetLastWeekDay(WeekDay weekday,
+ Month month = Inv_Month,
+ int year = Inv_Year);
+
+#if WXWIN_COMPATIBILITY_2_6
+ // sets the date to the given day of the given week in the year,
+ // returns true on success and false if given date doesn't exist (e.g.
+ // numWeek is > 53)
+ //
+ // these functions are badly defined as they're not the reverse of
+ // GetWeekOfYear(), use SetToTheWeekOfYear() instead
+ wxDEPRECATED( bool SetToTheWeek(wxDateTime_t numWeek,
+ WeekDay weekday = Mon,
+ WeekFlags flags = Monday_First) );
+ wxDEPRECATED( wxDateTime GetWeek(wxDateTime_t numWeek,
+ WeekDay weekday = Mon,
+ WeekFlags flags = Monday_First) const );
+#endif // WXWIN_COMPATIBILITY_2_6
+
+ // returns the date corresponding to the given week day of the given
+ // week (in ISO notation) of the specified year
+ static wxDateTime SetToWeekOfYear(int year,
+ wxDateTime_t numWeek,
+ WeekDay weekday = Mon);
+
+ // sets the date to the last day of the given (or current) month or the
+ // given (or current) year
+ wxDateTime& SetToLastMonthDay(Month month = Inv_Month,
+ int year = Inv_Year);
+ inline wxDateTime GetLastMonthDay(Month month = Inv_Month,
+ int year = Inv_Year) const;
+
+ // sets to the given year day (1..365 or 366)
+ wxDateTime& SetToYearDay(wxDateTime_t yday);
+ inline wxDateTime GetYearDay(wxDateTime_t yday) const;
+
+ // The definitions below were taken verbatim from
+ //
+ // http://www.capecod.net/~pbaum/date/date0.htm
+ //
+ // (Peter Baum's home page)
+ //
+ // definition: The Julian Day Number, Julian Day, or JD of a
+ // particular instant of time is the number of days and fractions of a
+ // day since 12 hours Universal Time (Greenwich mean noon) on January
+ // 1 of the year -4712, where the year is given in the Julian
+ // proleptic calendar. The idea of using this reference date was
+ // originally proposed by Joseph Scalizer in 1582 to count years but
+ // it was modified by 19th century astronomers to count days. One
+ // could have equivalently defined the reference time to be noon of
+ // November 24, -4713 if were understood that Gregorian calendar rules
+ // were applied. Julian days are Julian Day Numbers and are not to be
+ // confused with Julian dates.
+ //
+ // definition: The Rata Die number is a date specified as the number
+ // of days relative to a base date of December 31 of the year 0. Thus
+ // January 1 of the year 1 is Rata Die day 1.
+
+ // get the Julian Day number (the fractional part specifies the time of
+ // the day, related to noon - beware of rounding errors!)
+ double GetJulianDayNumber() const;
+ double GetJDN() const { return GetJulianDayNumber(); }
+
+ // get the Modified Julian Day number: it is equal to JDN - 2400000.5
+ // and so integral MJDs correspond to the midnights (and not noons).
+ // MJD 0 is Nov 17, 1858
+ double GetModifiedJulianDayNumber() const { return GetJDN() - 2400000.5; }
+ double GetMJD() const { return GetModifiedJulianDayNumber(); }
+
+ // get the Rata Die number
+ double GetRataDie() const;
+
+ // TODO algorithms for calculating some important dates, such as
+ // religious holidays (Easter...) or moon/solar eclipses? Some
+ // algorithms can be found in the calendar FAQ
+
+
+ // Timezone stuff: a wxDateTime object constructed using given
+ // day/month/year/hour/min/sec values is interpreted as this moment in
+ // local time. Using the functions below, it may be converted to another
+ // time zone (e.g., the Unix epoch is wxDateTime(1, Jan, 1970).ToGMT()).
+ //
+ // These functions try to handle DST internally, but there is no magical
+ // way to know all rules for it in all countries in the world, so if the
+ // program can handle it itself (or doesn't want to handle it at all for
+ // whatever reason), the DST handling can be disabled with noDST.
+ // ------------------------------------------------------------------------
+
+ // transform to any given timezone
+ inline wxDateTime ToTimezone(const TimeZone& tz, bool noDST = false) const;
+ wxDateTime& MakeTimezone(const TimeZone& tz, bool noDST = false);
+
+ // interpret current value as being in another timezone and transform
+ // it to local one
+ inline wxDateTime FromTimezone(const TimeZone& tz, bool noDST = false) const;
+ wxDateTime& MakeFromTimezone(const TimeZone& tz, bool noDST = false);
+
+ // transform to/from GMT/UTC
+ wxDateTime ToUTC(bool noDST = false) const { return ToTimezone(UTC, noDST); }
+ wxDateTime& MakeUTC(bool noDST = false) { return MakeTimezone(UTC, noDST); }
+
+ wxDateTime ToGMT(bool noDST = false) const { return ToUTC(noDST); }
+ wxDateTime& MakeGMT(bool noDST = false) { return MakeUTC(noDST); }
+
+ wxDateTime FromUTC(bool noDST = false) const
+ { return FromTimezone(UTC, noDST); }
+ wxDateTime& MakeFromUTC(bool noDST = false)
+ { return MakeFromTimezone(UTC, noDST); }
+
+ // is daylight savings time in effect at this moment according to the
+ // rules of the specified country?
+ //
+ // Return value is > 0 if DST is in effect, 0 if it is not and -1 if
+ // the information is not available (this is compatible with ANSI C)
+ int IsDST(Country country = Country_Default) const;
+
+
+ // accessors: many of them take the timezone parameter which indicates the
+ // timezone for which to make the calculations and the default value means
+ // to do it for the current timezone of this machine (even if the function
+ // only operates with the date it's necessary because a date may wrap as
+ // result of timezone shift)
+ // ------------------------------------------------------------------------
+
+ // is the date valid?
+ inline bool IsValid() const { return m_time != wxInvalidDateTime.m_time; }
+
+ // get the broken down date/time representation in the given timezone
+ //
+ // If you wish to get several time components (day, month and year),
+ // consider getting the whole Tm strcuture first and retrieving the
+ // value from it - this is much more efficient
+ Tm GetTm(const TimeZone& tz = Local) const;
+
+ // get the number of seconds since the Unix epoch - returns (time_t)-1
+ // if the value is out of range
+ inline time_t GetTicks() const;
+
+ // get the century, same as GetCentury(GetYear())
+ int GetCentury(const TimeZone& tz = Local) const
+ { return GetCentury(GetYear(tz)); }
+ // get the year (returns Inv_Year if date is invalid)
+ int GetYear(const TimeZone& tz = Local) const
+ { return GetTm(tz).year; }
+ // get the month (Inv_Month if date is invalid)
+ Month GetMonth(const TimeZone& tz = Local) const
+ { return (Month)GetTm(tz).mon; }
+ // get the month day (in 1..31 range, 0 if date is invalid)
+ wxDateTime_t GetDay(const TimeZone& tz = Local) const
+ { return GetTm(tz).mday; }
+ // get the day of the week (Inv_WeekDay if date is invalid)
+ WeekDay GetWeekDay(const TimeZone& tz = Local) const
+ { return GetTm(tz).GetWeekDay(); }
+ // get the hour of the day
+ wxDateTime_t GetHour(const TimeZone& tz = Local) const
+ { return GetTm(tz).hour; }
+ // get the minute
+ wxDateTime_t GetMinute(const TimeZone& tz = Local) const
+ { return GetTm(tz).min; }
+ // get the second
+ wxDateTime_t GetSecond(const TimeZone& tz = Local) const
+ { return GetTm(tz).sec; }
+ // get milliseconds
+ wxDateTime_t GetMillisecond(const TimeZone& tz = Local) const
+ { return GetTm(tz).msec; }
+
+ // get the day since the year start (1..366, 0 if date is invalid)
+ wxDateTime_t GetDayOfYear(const TimeZone& tz = Local) const;
+ // get the week number since the year start (1..52 or 53, 0 if date is
+ // invalid)
+ wxDateTime_t GetWeekOfYear(WeekFlags flags = Monday_First,
+ const TimeZone& tz = Local) const;
+ // get the week number since the month start (1..5, 0 if date is
+ // invalid)
+ wxDateTime_t GetWeekOfMonth(WeekFlags flags = Monday_First,
+ const TimeZone& tz = Local) const;
+
+ // is this date a work day? This depends on a country, of course,
+ // because the holidays are different in different countries
+ bool IsWorkDay(Country country = Country_Default) const;
+
+ // dos date and time format
+ // ------------------------------------------------------------------------
+
+ // set from the DOS packed format
+ wxDateTime& SetFromDOS(unsigned long ddt);
+
+ // pack the date in DOS format
+ unsigned long GetAsDOS() const;
+
+ // SYSTEMTIME format
+ // ------------------------------------------------------------------------
+#ifdef __WINDOWS__
+ // convert SYSTEMTIME to wxDateTime
+ wxDateTime& SetFromMSWSysTime(const struct _SYSTEMTIME& st);
+
+ // convert wxDateTime to SYSTEMTIME
+ void GetAsMSWSysTime(struct _SYSTEMTIME* st) const;
+
+ // same as above but only take date part into account, time is always zero
+ wxDateTime& SetFromMSWSysDate(const struct _SYSTEMTIME& st);
+ void GetAsMSWSysDate(struct _SYSTEMTIME* st) const;
+#endif // __WINDOWS__
+
+ // comparison (see also functions below for operator versions)
+ // ------------------------------------------------------------------------
+
+ // returns true if the two moments are strictly identical
+ inline bool IsEqualTo(const wxDateTime& datetime) const;
+
+ // returns true if the date is strictly earlier than the given one
+ inline bool IsEarlierThan(const wxDateTime& datetime) const;
+
+ // returns true if the date is strictly later than the given one
+ inline bool IsLaterThan(const wxDateTime& datetime) const;
+
+ // returns true if the date is strictly in the given range
+ inline bool IsStrictlyBetween(const wxDateTime& t1,
+ const wxDateTime& t2) const;
+
+ // returns true if the date is in the given range
+ inline bool IsBetween(const wxDateTime& t1, const wxDateTime& t2) const;
+
+ // do these two objects refer to the same date?
+ inline bool IsSameDate(const wxDateTime& dt) const;
+
+ // do these two objects have the same time?
+ inline bool IsSameTime(const wxDateTime& dt) const;
+
+ // are these two objects equal up to given timespan?
+ inline bool IsEqualUpTo(const wxDateTime& dt, const wxTimeSpan& ts) const;
+
+ inline bool operator<(const wxDateTime& dt) const
+ {
+ wxASSERT_MSG( IsValid() && dt.IsValid(), wxT("invalid wxDateTime") );
+ return GetValue() < dt.GetValue();
+ }
+
+ inline bool operator<=(const wxDateTime& dt) const
+ {
+ wxASSERT_MSG( IsValid() && dt.IsValid(), wxT("invalid wxDateTime") );
+ return GetValue() <= dt.GetValue();
+ }
+
+ inline bool operator>(const wxDateTime& dt) const
+ {
+ wxASSERT_MSG( IsValid() && dt.IsValid(), wxT("invalid wxDateTime") );
+ return GetValue() > dt.GetValue();
+ }
+
+ inline bool operator>=(const wxDateTime& dt) const
+ {
+ wxASSERT_MSG( IsValid() && dt.IsValid(), wxT("invalid wxDateTime") );
+ return GetValue() >= dt.GetValue();
+ }
+
+ inline bool operator==(const wxDateTime& dt) const
+ {
+ wxASSERT_MSG( IsValid() && dt.IsValid(), wxT("invalid wxDateTime") );
+ return GetValue() == dt.GetValue();
+ }
+
+ inline bool operator!=(const wxDateTime& dt) const
+ {
+ wxASSERT_MSG( IsValid() && dt.IsValid(), wxT("invalid wxDateTime") );
+ return GetValue() != dt.GetValue();
+ }
+
+ // arithmetics with dates (see also below for more operators)
+ // ------------------------------------------------------------------------
+
+ // return the sum of the date with a time span (positive or negative)
+ inline wxDateTime Add(const wxTimeSpan& diff) const;
+ // add a time span (positive or negative)
+ inline wxDateTime& Add(const wxTimeSpan& diff);
+ // add a time span (positive or negative)
+ inline wxDateTime& operator+=(const wxTimeSpan& diff);
+ inline wxDateTime operator+(const wxTimeSpan& ts) const
+ {
+ wxDateTime dt(*this);
+ dt.Add(ts);
+ return dt;
+ }
+
+ // return the difference of the date with a time span
+ inline wxDateTime Subtract(const wxTimeSpan& diff) const;
+ // subtract a time span (positive or negative)
+ inline wxDateTime& Subtract(const wxTimeSpan& diff);
+ // subtract a time span (positive or negative)
+ inline wxDateTime& operator-=(const wxTimeSpan& diff);
+ inline wxDateTime operator-(const wxTimeSpan& ts) const
+ {
+ wxDateTime dt(*this);
+ dt.Subtract(ts);
+ return dt;
+ }
+
+ // return the sum of the date with a date span
+ inline wxDateTime Add(const wxDateSpan& diff) const;
+ // add a date span (positive or negative)
+ wxDateTime& Add(const wxDateSpan& diff);
+ // add a date span (positive or negative)
+ inline wxDateTime& operator+=(const wxDateSpan& diff);
+ inline wxDateTime operator+(const wxDateSpan& ds) const
+ {
+ wxDateTime dt(*this);
+ dt.Add(ds);
+ return dt;
+ }
+
+ // return the difference of the date with a date span
+ inline wxDateTime Subtract(const wxDateSpan& diff) const;
+ // subtract a date span (positive or negative)
+ inline wxDateTime& Subtract(const wxDateSpan& diff);
+ // subtract a date span (positive or negative)
+ inline wxDateTime& operator-=(const wxDateSpan& diff);
+ inline wxDateTime operator-(const wxDateSpan& ds) const
+ {
+ wxDateTime dt(*this);
+ dt.Subtract(ds);
+ return dt;
+ }
+
+ // return the difference between two dates
+ inline wxTimeSpan Subtract(const wxDateTime& dt) const;
+ inline wxTimeSpan operator-(const wxDateTime& dt2) const;
+
+ wxDateSpan DiffAsDateSpan(const wxDateTime& dt) const;
+
+ // conversion to/from text
+ // ------------------------------------------------------------------------
+
+ // all conversions functions return true to indicate whether parsing
+ // succeeded or failed and fill in the provided end iterator, which must
+ // not be NULL, with the location of the character where the parsing
+ // stopped (this will be end() of the passed string if everything was
+ // parsed)
+
+ // parse a string in RFC 822 format (found e.g. in mail headers and
+ // having the form "Wed, 10 Feb 1999 19:07:07 +0100")
+ bool ParseRfc822Date(const wxString& date,
+ wxString::const_iterator *end);
+
+ // parse a date/time in the given format (see strptime(3)), fill in
+ // the missing (in the string) fields with the values of dateDef (by
+ // default, they will not change if they had valid values or will
+ // default to Today() otherwise)
+ bool ParseFormat(const wxString& date,
+ const wxString& format,
+ const wxDateTime& dateDef,
+ wxString::const_iterator *end);
+
+ bool ParseFormat(const wxString& date,
+ const wxString& format,
+ wxString::const_iterator *end)
+ {
+ return ParseFormat(date, format, wxDefaultDateTime, end);
+ }
+
+ bool ParseFormat(const wxString& date,
+ wxString::const_iterator *end)
+ {
+ return ParseFormat(date, wxDefaultDateTimeFormat, wxDefaultDateTime, end);
+ }
+
+ // parse a string containing date, time or both in ISO 8601 format
+ //
+ // notice that these functions are new in wx 3.0 and so we don't
+ // provide compatibility overloads for them
+ bool ParseISODate(const wxString& date)
+ {
+ wxString::const_iterator end;
+ return ParseFormat(date, wxS("%Y-%m-%d"), &end) && end == date.end();
+ }
+
+ bool ParseISOTime(const wxString& time)
+ {
+ wxString::const_iterator end;
+ return ParseFormat(time, wxS("%H:%M:%S"), &end) && end == time.end();
+ }
+
+ bool ParseISOCombined(const wxString& datetime, char sep = 'T')
+ {
+ wxString::const_iterator end;
+ const wxString fmt = wxS("%Y-%m-%d") + wxString(sep) + wxS("%H:%M:%S");
+ return ParseFormat(datetime, fmt, &end) && end == datetime.end();
+ }
+
+ // parse a string containing the date/time in "free" format, this
+ // function will try to make an educated guess at the string contents
+ bool ParseDateTime(const wxString& datetime,
+ wxString::const_iterator *end);
+
+ // parse a string containing the date only in "free" format (less
+ // flexible than ParseDateTime)
+ bool ParseDate(const wxString& date,
+ wxString::const_iterator *end);
+
+ // parse a string containing the time only in "free" format
+ bool ParseTime(const wxString& time,
+ wxString::const_iterator *end);
+
+
+ // this function accepts strftime()-like format string (default
+ // argument corresponds to the preferred date and time representation
+ // for the current locale) and returns the string containing the
+ // resulting text representation
+ wxString Format(const wxString& format = wxDefaultDateTimeFormat,
+ const TimeZone& tz = Local) const;
+ // preferred date representation for the current locale
+ wxString FormatDate() const { return Format(wxS("%x")); }
+ // preferred time representation for the current locale
+ wxString FormatTime() const { return Format(wxS("%X")); }
+ // returns the string representing the date in ISO 8601 format
+ // (YYYY-MM-DD)
+ wxString FormatISODate() const { return Format(wxS("%Y-%m-%d")); }
+ // returns the string representing the time in ISO 8601 format
+ // (HH:MM:SS)
+ wxString FormatISOTime() const { return Format(wxS("%H:%M:%S")); }
+ // return the combined date time representation in ISO 8601 format; the
+ // separator character should be 'T' according to the standard but it
+ // can also be useful to set it to ' '
+ wxString FormatISOCombined(char sep = 'T') const
+ { return FormatISODate() + sep + FormatISOTime(); }
+
+
+ // backwards compatible versions of the parsing functions: they return an
+ // object representing the next character following the date specification
+ // (i.e. the one where the scan had to stop) or a special NULL-like object
+ // on failure
+ //
+ // they're not deprecated because a lot of existing code uses them and
+ // there is no particular harm in keeping them but you should still prefer
+ // the versions above in the new code
+ wxAnyStrPtr ParseRfc822Date(const wxString& date)
+ {
+ wxString::const_iterator end;
+ return ParseRfc822Date(date, &end) ? wxAnyStrPtr(date, end)
+ : wxAnyStrPtr();
+ }
+
+ wxAnyStrPtr ParseFormat(const wxString& date,
+ const wxString& format = wxDefaultDateTimeFormat,
+ const wxDateTime& dateDef = wxDefaultDateTime)
+ {
+ wxString::const_iterator end;
+ return ParseFormat(date, format, dateDef, &end) ? wxAnyStrPtr(date, end)
+ : wxAnyStrPtr();
+ }
+
+ wxAnyStrPtr ParseDateTime(const wxString& datetime)
+ {
+ wxString::const_iterator end;
+ return ParseDateTime(datetime, &end) ? wxAnyStrPtr(datetime, end)
+ : wxAnyStrPtr();
+ }
+
+ wxAnyStrPtr ParseDate(const wxString& date)
+ {
+ wxString::const_iterator end;
+ return ParseDate(date, &end) ? wxAnyStrPtr(date, end)
+ : wxAnyStrPtr();
+ }
+
+ wxAnyStrPtr ParseTime(const wxString& time)
+ {
+ wxString::const_iterator end;
+ return ParseTime(time, &end) ? wxAnyStrPtr(time, end)
+ : wxAnyStrPtr();
+ }
+
+ // In addition to wxAnyStrPtr versions above we also must provide the
+ // overloads for C strings as we must return a pointer into the original
+ // string and not inside a temporary wxString which would have been created
+ // if the overloads above were used.
+ //
+ // And then we also have to provide the overloads for wxCStrData, as usual.
+ // Unfortunately those ones can't return anything as we don't have any
+ // sufficiently long-lived wxAnyStrPtr to return from them: any temporary
+ // strings it would point to would be destroyed when this function returns
+ // making it impossible to dereference the return value. So we just don't
+ // return anything from here which at least allows to keep compatibility
+ // with the code not testing the return value. Other uses of this method
+ // need to be converted to use one of the new bool-returning overloads
+ // above.
+ void ParseRfc822Date(const wxCStrData& date)
+ { ParseRfc822Date(wxString(date)); }
+ const char* ParseRfc822Date(const char* date);
+ const wchar_t* ParseRfc822Date(const wchar_t* date);
+
+ void ParseFormat(const wxCStrData& date,
+ const wxString& format = wxDefaultDateTimeFormat,
+ const wxDateTime& dateDef = wxDefaultDateTime)
+ { ParseFormat(wxString(date), format, dateDef); }
+ const char* ParseFormat(const char* date,
+ const wxString& format = wxDefaultDateTimeFormat,
+ const wxDateTime& dateDef = wxDefaultDateTime);
+ const wchar_t* ParseFormat(const wchar_t* date,
+ const wxString& format = wxDefaultDateTimeFormat,
+ const wxDateTime& dateDef = wxDefaultDateTime);
+
+ void ParseDateTime(const wxCStrData& datetime)
+ { ParseDateTime(wxString(datetime)); }
+ const char* ParseDateTime(const char* datetime);
+ const wchar_t* ParseDateTime(const wchar_t* datetime);
+
+ void ParseDate(const wxCStrData& date)
+ { ParseDate(wxString(date)); }
+ const char* ParseDate(const char* date);
+ const wchar_t* ParseDate(const wchar_t* date);
+
+ void ParseTime(const wxCStrData& time)
+ { ParseTime(wxString(time)); }
+ const char* ParseTime(const char* time);
+ const wchar_t* ParseTime(const wchar_t* time);
+
+
+ // implementation
+ // ------------------------------------------------------------------------
+
+ // construct from internal representation
+ wxDateTime(const wxLongLong& time) { m_time = time; }
+
+ // get the internal representation
+ inline wxLongLong GetValue() const;
+
+ // a helper function to get the current time_t
+ static time_t GetTimeNow() { return time(NULL); }
+
+ // another one to get the current time broken down
+ static struct tm *GetTmNow()
+ {
+ static struct tm l_CurrentTime;
+ return GetTmNow(&l_CurrentTime);
+ }
+
+ // get current time using thread-safe function
+ static struct tm *GetTmNow(struct tm *tmstruct);
+
+private:
+ // the current country - as it's the same for all program objects (unless
+ // it runs on a _really_ big cluster system :-), this is a static member:
+ // see SetCountry() and GetCountry()
+ static Country ms_country;
+
+ // this constant is used to transform a time_t value to the internal
+ // representation, as time_t is in seconds and we use milliseconds it's
+ // fixed to 1000
+ static const long TIME_T_FACTOR;
+
+ // returns true if we fall in range in which we can use standard ANSI C
+ // functions
+ inline bool IsInStdRange() const;
+
+ // the internal representation of the time is the amount of milliseconds
+ // elapsed since the origin which is set by convention to the UNIX/C epoch
+ // value: the midnight of January 1, 1970 (UTC)
+ wxLongLong m_time;
+};
+
+// ----------------------------------------------------------------------------
+// This class contains a difference between 2 wxDateTime values, so it makes
+// sense to add it to wxDateTime and it is the result of subtraction of 2
+// objects of that class. See also wxDateSpan.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxTimeSpan
+{
+public:
+ // constructors
+ // ------------------------------------------------------------------------
+
+ // return the timespan for the given number of milliseconds
+ static wxTimeSpan Milliseconds(wxLongLong ms) { return wxTimeSpan(0, 0, 0, ms); }
+ static wxTimeSpan Millisecond() { return Milliseconds(1); }
+
+ // return the timespan for the given number of seconds
+ static wxTimeSpan Seconds(wxLongLong sec) { return wxTimeSpan(0, 0, sec); }
+ static wxTimeSpan Second() { return Seconds(1); }
+
+ // return the timespan for the given number of minutes
+ static wxTimeSpan Minutes(long min) { return wxTimeSpan(0, min, 0 ); }
+ static wxTimeSpan Minute() { return Minutes(1); }
+
+ // return the timespan for the given number of hours
+ static wxTimeSpan Hours(long hours) { return wxTimeSpan(hours, 0, 0); }
+ static wxTimeSpan Hour() { return Hours(1); }
+
+ // return the timespan for the given number of days
+ static wxTimeSpan Days(long days) { return Hours(24 * days); }
+ static wxTimeSpan Day() { return Days(1); }
+
+ // return the timespan for the given number of weeks
+ static wxTimeSpan Weeks(long days) { return Days(7 * days); }
+ static wxTimeSpan Week() { return Weeks(1); }
+
+ // default ctor constructs the 0 time span
+ wxTimeSpan() { }
+
+ // from separate values for each component, date set to 0 (hours are
+ // not restricted to 0..24 range, neither are minutes, seconds or
+ // milliseconds)
+ inline wxTimeSpan(long hours,
+ long minutes = 0,
+ wxLongLong seconds = 0,
+ wxLongLong milliseconds = 0);
+
+ // default copy ctor is ok
+
+ // no dtor
+
+ // arithmetics with time spans (see also below for more operators)
+ // ------------------------------------------------------------------------
+
+ // return the sum of two timespans
+ inline wxTimeSpan Add(const wxTimeSpan& diff) const;
+ // add two timespans together
+ inline wxTimeSpan& Add(const wxTimeSpan& diff);
+ // add two timespans together
+ wxTimeSpan& operator+=(const wxTimeSpan& diff) { return Add(diff); }
+ inline wxTimeSpan operator+(const wxTimeSpan& ts) const
+ {
+ return wxTimeSpan(GetValue() + ts.GetValue());
+ }
+
+ // return the difference of two timespans
+ inline wxTimeSpan Subtract(const wxTimeSpan& diff) const;
+ // subtract another timespan
+ inline wxTimeSpan& Subtract(const wxTimeSpan& diff);
+ // subtract another timespan
+ wxTimeSpan& operator-=(const wxTimeSpan& diff) { return Subtract(diff); }
+ inline wxTimeSpan operator-(const wxTimeSpan& ts)
+ {
+ return wxTimeSpan(GetValue() - ts.GetValue());
+ }
+
+ // multiply timespan by a scalar
+ inline wxTimeSpan Multiply(int n) const;
+ // multiply timespan by a scalar
+ inline wxTimeSpan& Multiply(int n);
+ // multiply timespan by a scalar
+ wxTimeSpan& operator*=(int n) { return Multiply(n); }
+ inline wxTimeSpan operator*(int n) const
+ {
+ return wxTimeSpan(*this).Multiply(n);
+ }
+
+ // return this timespan with opposite sign
+ wxTimeSpan Negate() const { return wxTimeSpan(-GetValue()); }
+ // negate the value of the timespan
+ wxTimeSpan& Neg() { m_diff = -GetValue(); return *this; }
+ // negate the value of the timespan
+ wxTimeSpan& operator-() { return Neg(); }
+
+ // return the absolute value of the timespan: does _not_ modify the
+ // object
+ inline wxTimeSpan Abs() const;
+
+ // there is intentionally no division because we don't want to
+ // introduce rounding errors in time calculations
+
+ // comparaison (see also operator versions below)
+ // ------------------------------------------------------------------------
+
+ // is the timespan null?
+ bool IsNull() const { return m_diff == 0l; }
+ // returns true if the timespan is null
+ bool operator!() const { return !IsNull(); }
+
+ // is the timespan positive?
+ bool IsPositive() const { return m_diff > 0l; }
+
+ // is the timespan negative?
+ bool IsNegative() const { return m_diff < 0l; }
+
+ // are two timespans equal?
+ inline bool IsEqualTo(const wxTimeSpan& ts) const;
+ // compare two timestamps: works with the absolute values, i.e. -2
+ // hours is longer than 1 hour. Also, it will return false if the
+ // timespans are equal in absolute value.
+ inline bool IsLongerThan(const wxTimeSpan& ts) const;
+ // compare two timestamps: works with the absolute values, i.e. 1
+ // hour is shorter than -2 hours. Also, it will return false if the
+ // timespans are equal in absolute value.
+ bool IsShorterThan(const wxTimeSpan& t) const;
+
+ inline bool operator<(const wxTimeSpan &ts) const
+ {
+ return GetValue() < ts.GetValue();
+ }
+
+ inline bool operator<=(const wxTimeSpan &ts) const
+ {
+ return GetValue() <= ts.GetValue();
+ }
+
+ inline bool operator>(const wxTimeSpan &ts) const
+ {
+ return GetValue() > ts.GetValue();
+ }
+
+ inline bool operator>=(const wxTimeSpan &ts) const
+ {
+ return GetValue() >= ts.GetValue();
+ }
+
+ inline bool operator==(const wxTimeSpan &ts) const
+ {
+ return GetValue() == ts.GetValue();
+ }
+
+ inline bool operator!=(const wxTimeSpan &ts) const
+ {
+ return GetValue() != ts.GetValue();
+ }
+
+ // breaking into days, hours, minutes and seconds
+ // ------------------------------------------------------------------------
+
+ // get the max number of weeks in this timespan
+ inline int GetWeeks() const;
+ // get the max number of days in this timespan
+ inline int GetDays() const;
+ // get the max number of hours in this timespan
+ inline int GetHours() const;
+ // get the max number of minutes in this timespan
+ inline int GetMinutes() const;
+ // get the max number of seconds in this timespan
+ inline wxLongLong GetSeconds() const;
+ // get the number of milliseconds in this timespan
+ wxLongLong GetMilliseconds() const { return m_diff; }
+
+ // conversion to text
+ // ------------------------------------------------------------------------
+
+ // this function accepts strftime()-like format string (default
+ // argument corresponds to the preferred date and time representation
+ // for the current locale) and returns the string containing the
+ // resulting text representation. Notice that only some of format
+ // specifiers valid for wxDateTime are valid for wxTimeSpan: hours,
+ // minutes and seconds make sense, but not "PM/AM" string for example.
+ wxString Format(const wxString& format = wxDefaultTimeSpanFormat) const;
+
+ // implementation
+ // ------------------------------------------------------------------------
+
+ // construct from internal representation
+ wxTimeSpan(const wxLongLong& diff) { m_diff = diff; }
+
+ // get the internal representation
+ wxLongLong GetValue() const { return m_diff; }
+
+private:
+ // the (signed) time span in milliseconds
+ wxLongLong m_diff;
+};
+
+// ----------------------------------------------------------------------------
+// This class is a "logical time span" and is useful for implementing program
+// logic for such things as "add one month to the date" which, in general,
+// doesn't mean to add 60*60*24*31 seconds to it, but to take the same date
+// the next month (to understand that this is indeed different consider adding
+// one month to Feb, 15 - we want to get Mar, 15, of course).
+//
+// When adding a month to the date, all lesser components (days, hours, ...)
+// won't be changed unless the resulting date would be invalid: for example,
+// Jan 31 + 1 month will be Feb 28, not (non existing) Feb 31.
+//
+// Because of this feature, adding and subtracting back again the same
+// wxDateSpan will *not*, in general give back the original date: Feb 28 - 1
+// month will be Jan 28, not Jan 31!
+//
+// wxDateSpan can be either positive or negative. They may be
+// multiplied by scalars which multiply all deltas by the scalar: i.e. 2*(1
+// month and 1 day) is 2 months and 2 days. They can be added together and
+// with wxDateTime or wxTimeSpan, but the type of result is different for each
+// case.
+//
+// Beware about weeks: if you specify both weeks and days, the total number of
+// days added will be 7*weeks + days! See also GetTotalDays() function.
+//
+// Equality operators are defined for wxDateSpans. Two datespans are equal if
+// they both give the same target date when added to *every* source date.
+// Thus wxDateSpan::Months(1) is not equal to wxDateSpan::Days(30), because
+// they not give the same date when added to 1 Feb. But wxDateSpan::Days(14) is
+// equal to wxDateSpan::Weeks(2)
+//
+// Finally, notice that for adding hours, minutes &c you don't need this
+// class: wxTimeSpan will do the job because there are no subtleties
+// associated with those.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxDateSpan
+{
+public:
+ // constructors
+ // ------------------------------------------------------------------------
+
+ // this many years/months/weeks/days
+ wxDateSpan(int years = 0, int months = 0, int weeks = 0, int days = 0)
+ {
+ m_years = years;
+ m_months = months;
+ m_weeks = weeks;
+ m_days = days;
+ }
+
+ // get an object for the given number of days
+ static wxDateSpan Days(int days) { return wxDateSpan(0, 0, 0, days); }
+ static wxDateSpan Day() { return Days(1); }
+
+ // get an object for the given number of weeks
+ static wxDateSpan Weeks(int weeks) { return wxDateSpan(0, 0, weeks, 0); }
+ static wxDateSpan Week() { return Weeks(1); }
+
+ // get an object for the given number of months
+ static wxDateSpan Months(int mon) { return wxDateSpan(0, mon, 0, 0); }
+ static wxDateSpan Month() { return Months(1); }
+
+ // get an object for the given number of years
+ static wxDateSpan Years(int years) { return wxDateSpan(years, 0, 0, 0); }
+ static wxDateSpan Year() { return Years(1); }
+
+ // default copy ctor is ok
+
+ // no dtor
+
+ // accessors (all SetXXX() return the (modified) wxDateSpan object)
+ // ------------------------------------------------------------------------
+
+ // set number of years
+ wxDateSpan& SetYears(int n) { m_years = n; return *this; }
+ // set number of months
+ wxDateSpan& SetMonths(int n) { m_months = n; return *this; }
+ // set number of weeks
+ wxDateSpan& SetWeeks(int n) { m_weeks = n; return *this; }
+ // set number of days
+ wxDateSpan& SetDays(int n) { m_days = n; return *this; }
+
+ // get number of years
+ int GetYears() const { return m_years; }
+ // get number of months
+ int GetMonths() const { return m_months; }
+ // returns 12*GetYears() + GetMonths()
+ int GetTotalMonths() const { return 12*m_years + m_months; }
+ // get number of weeks
+ int GetWeeks() const { return m_weeks; }
+ // get number of days
+ int GetDays() const { return m_days; }
+ // returns 7*GetWeeks() + GetDays()
+ int GetTotalDays() const { return 7*m_weeks + m_days; }
+
+ // arithmetics with date spans (see also below for more operators)
+ // ------------------------------------------------------------------------
+
+ // return sum of two date spans
+ inline wxDateSpan Add(const wxDateSpan& other) const;
+ // add another wxDateSpan to us
+ inline wxDateSpan& Add(const wxDateSpan& other);
+ // add another wxDateSpan to us
+ inline wxDateSpan& operator+=(const wxDateSpan& other);
+ inline wxDateSpan operator+(const wxDateSpan& ds) const
+ {
+ return wxDateSpan(GetYears() + ds.GetYears(),
+ GetMonths() + ds.GetMonths(),
+ GetWeeks() + ds.GetWeeks(),
+ GetDays() + ds.GetDays());
+ }
+
+ // return difference of two date spans
+ inline wxDateSpan Subtract(const wxDateSpan& other) const;
+ // subtract another wxDateSpan from us
+ inline wxDateSpan& Subtract(const wxDateSpan& other);
+ // subtract another wxDateSpan from us
+ inline wxDateSpan& operator-=(const wxDateSpan& other);
+ inline wxDateSpan operator-(const wxDateSpan& ds) const
+ {
+ return wxDateSpan(GetYears() - ds.GetYears(),
+ GetMonths() - ds.GetMonths(),
+ GetWeeks() - ds.GetWeeks(),
+ GetDays() - ds.GetDays());
+ }
+
+ // return a copy of this time span with changed sign
+ inline wxDateSpan Negate() const;
+ // inverse the sign of this timespan
+ inline wxDateSpan& Neg();
+ // inverse the sign of this timespan
+ wxDateSpan& operator-() { return Neg(); }
+
+ // return the date span proportional to this one with given factor
+ inline wxDateSpan Multiply(int factor) const;
+ // multiply all components by a (signed) number
+ inline wxDateSpan& Multiply(int factor);
+ // multiply all components by a (signed) number
+ inline wxDateSpan& operator*=(int factor) { return Multiply(factor); }
+ inline wxDateSpan operator*(int n) const
+ {
+ return wxDateSpan(*this).Multiply(n);
+ }
+
+ // ds1 == d2 if and only if for every wxDateTime t t + ds1 == t + ds2
+ inline bool operator==(const wxDateSpan& ds) const
+ {
+ return GetYears() == ds.GetYears() &&
+ GetMonths() == ds.GetMonths() &&
+ GetTotalDays() == ds.GetTotalDays();
+ }
+
+ inline bool operator!=(const wxDateSpan& ds) const
+ {
+ return !(*this == ds);
+ }
+
+private:
+ int m_years,
+ m_months,
+ m_weeks,
+ m_days;
+};
+
+// ----------------------------------------------------------------------------
+// wxDateTimeArray: array of dates.
+// ----------------------------------------------------------------------------
+
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDateTime, wxDateTimeArray, WXDLLIMPEXP_BASE);
+
+// ----------------------------------------------------------------------------
+// wxDateTimeHolidayAuthority: an object of this class will decide whether a
+// given date is a holiday and is used by all functions working with "work
+// days".
+//
+// NB: the base class is an ABC, derived classes must implement the pure
+// virtual methods to work with the holidays they correspond to.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_BASE wxDateTimeHolidayAuthority;
+WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxDateTimeHolidayAuthority *,
+ wxHolidayAuthoritiesArray,
+ class WXDLLIMPEXP_BASE);
+
+class wxDateTimeHolidaysModule;
+class WXDLLIMPEXP_BASE wxDateTimeHolidayAuthority
+{
+friend class wxDateTimeHolidaysModule;
+public:
+ // returns true if the given date is a holiday
+ static bool IsHoliday(const wxDateTime& dt);
+
+ // fills the provided array with all holidays in the given range, returns
+ // the number of them
+ static size_t GetHolidaysInRange(const wxDateTime& dtStart,
+ const wxDateTime& dtEnd,
+ wxDateTimeArray& holidays);
+
+ // clear the list of holiday authorities
+ static void ClearAllAuthorities();
+
+ // add a new holiday authority (the pointer will be deleted by
+ // wxDateTimeHolidayAuthority)
+ static void AddAuthority(wxDateTimeHolidayAuthority *auth);
+
+ // the base class must have a virtual dtor
+ virtual ~wxDateTimeHolidayAuthority();
+
+protected:
+ // this function is called to determine whether a given day is a holiday
+ virtual bool DoIsHoliday(const wxDateTime& dt) const = 0;
+
+ // this function should fill the array with all holidays between the two
+ // given dates - it is implemented in the base class, but in a very
+ // inefficient way (it just iterates over all days and uses IsHoliday() for
+ // each of them), so it must be overridden in the derived class where the
+ // base class version may be explicitly used if needed
+ //
+ // returns the number of holidays in the given range and fills holidays
+ // array
+ virtual size_t DoGetHolidaysInRange(const wxDateTime& dtStart,
+ const wxDateTime& dtEnd,
+ wxDateTimeArray& holidays) const = 0;
+
+private:
+ // all holiday authorities
+ static wxHolidayAuthoritiesArray ms_authorities;
+};
+
+// the holidays for this class are all Saturdays and Sundays
+class WXDLLIMPEXP_BASE wxDateTimeWorkDays : public wxDateTimeHolidayAuthority
+{
+protected:
+ virtual bool DoIsHoliday(const wxDateTime& dt) const;
+ virtual size_t DoGetHolidaysInRange(const wxDateTime& dtStart,
+ const wxDateTime& dtEnd,
+ wxDateTimeArray& holidays) const;
+};
+
+// ============================================================================
+// inline functions implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// private macros
+// ----------------------------------------------------------------------------
+
+#define MILLISECONDS_PER_DAY 86400000l
+
+// some broken compilers (HP-UX CC) refuse to compile the "normal" version, but
+// using a temp variable always might prevent other compilers from optimising
+// it away - hence use of this ugly macro
+#ifndef __HPUX__
+ #define MODIFY_AND_RETURN(op) return wxDateTime(*this).op
+#else
+ #define MODIFY_AND_RETURN(op) wxDateTime dt(*this); dt.op; return dt
+#endif
+
+// ----------------------------------------------------------------------------
+// wxDateTime construction
+// ----------------------------------------------------------------------------
+
+inline bool wxDateTime::IsInStdRange() const
+{
+ // currently we don't know what is the real type of time_t so prefer to err
+ // on the safe side and limit it to 32 bit values which is safe everywhere
+ return m_time >= 0l && (m_time / TIME_T_FACTOR) < wxINT32_MAX;
+}
+
+/* static */
+inline wxDateTime wxDateTime::Now()
+{
+ struct tm tmstruct;
+ return wxDateTime(*GetTmNow(&tmstruct));
+}
+
+/* static */
+inline wxDateTime wxDateTime::Today()
+{
+ wxDateTime dt(Now());
+ dt.ResetTime();
+
+ return dt;
+}
+
+#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
+inline wxDateTime& wxDateTime::Set(time_t timet)
+{
+ if ( timet == (time_t)-1 )
+ {
+ m_time = wxInvalidDateTime.m_time;
+ }
+ else
+ {
+ // assign first to avoid long multiplication overflow!
+ m_time = timet - WX_TIME_BASE_OFFSET;
+ m_time *= TIME_T_FACTOR;
+ }
+
+ return *this;
+}
+#endif
+
+inline wxDateTime& wxDateTime::SetToCurrent()
+{
+ *this = Now();
+ return *this;
+}
+
+#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
+inline wxDateTime::wxDateTime(time_t timet)
+{
+ Set(timet);
+}
+#endif
+
+inline wxDateTime::wxDateTime(const struct tm& tm)
+{
+ Set(tm);
+}
+
+inline wxDateTime::wxDateTime(const Tm& tm)
+{
+ Set(tm);
+}
+
+inline wxDateTime::wxDateTime(double jdn)
+{
+ Set(jdn);
+}
+
+inline wxDateTime& wxDateTime::Set(const Tm& tm)
+{
+ wxASSERT_MSG( tm.IsValid(), wxT("invalid broken down date/time") );
+
+ return Set(tm.mday, (Month)tm.mon, tm.year,
+ tm.hour, tm.min, tm.sec, tm.msec);
+}
+
+inline wxDateTime::wxDateTime(wxDateTime_t hour,
+ wxDateTime_t minute,
+ wxDateTime_t second,
+ wxDateTime_t millisec)
+{
+ Set(hour, minute, second, millisec);
+}
+
+inline wxDateTime::wxDateTime(wxDateTime_t day,
+ Month month,
+ int year,
+ wxDateTime_t hour,
+ wxDateTime_t minute,
+ wxDateTime_t second,
+ wxDateTime_t millisec)
+{
+ Set(day, month, year, hour, minute, second, millisec);
+}
+
+// ----------------------------------------------------------------------------
+// wxDateTime accessors
+// ----------------------------------------------------------------------------
+
+inline wxLongLong wxDateTime::GetValue() const
+{
+ wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime"));
+
+ return m_time;
+}
+
+inline time_t wxDateTime::GetTicks() const
+{
+ wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime"));
+ if ( !IsInStdRange() )
+ {
+ return (time_t)-1;
+ }
+
+ return (time_t)((m_time / (long)TIME_T_FACTOR).ToLong()) + WX_TIME_BASE_OFFSET;
+}
+
+inline bool wxDateTime::SetToLastWeekDay(WeekDay weekday,
+ Month month,
+ int year)
+{
+ return SetToWeekDay(weekday, -1, month, year);
+}
+
+inline wxDateTime
+wxDateTime::GetWeekDayInSameWeek(WeekDay weekday,
+ WeekFlags WXUNUSED(flags)) const
+{
+ MODIFY_AND_RETURN( SetToWeekDayInSameWeek(weekday) );
+}
+
+inline wxDateTime wxDateTime::GetNextWeekDay(WeekDay weekday) const
+{
+ MODIFY_AND_RETURN( SetToNextWeekDay(weekday) );
+}
+
+inline wxDateTime wxDateTime::GetPrevWeekDay(WeekDay weekday) const
+{
+ MODIFY_AND_RETURN( SetToPrevWeekDay(weekday) );
+}
+
+inline wxDateTime wxDateTime::GetWeekDay(WeekDay weekday,
+ int n,
+ Month month,
+ int year) const
+{
+ wxDateTime dt(*this);
+
+ return dt.SetToWeekDay(weekday, n, month, year) ? dt : wxInvalidDateTime;
+}
+
+inline wxDateTime wxDateTime::GetLastWeekDay(WeekDay weekday,
+ Month month,
+ int year)
+{
+ wxDateTime dt(*this);
+
+ return dt.SetToLastWeekDay(weekday, month, year) ? dt : wxInvalidDateTime;
+}
+
+inline wxDateTime wxDateTime::GetLastMonthDay(Month month, int year) const
+{
+ MODIFY_AND_RETURN( SetToLastMonthDay(month, year) );
+}
+
+inline wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const
+{
+ MODIFY_AND_RETURN( SetToYearDay(yday) );
+}
+
+// ----------------------------------------------------------------------------
+// wxDateTime comparison
+// ----------------------------------------------------------------------------
+
+inline bool wxDateTime::IsEqualTo(const wxDateTime& datetime) const
+{
+ wxASSERT_MSG( IsValid() && datetime.IsValid(), wxT("invalid wxDateTime"));
+
+ return m_time == datetime.m_time;
+}
+
+inline bool wxDateTime::IsEarlierThan(const wxDateTime& datetime) const
+{
+ wxASSERT_MSG( IsValid() && datetime.IsValid(), wxT("invalid wxDateTime"));
+
+ return m_time < datetime.m_time;
+}
+
+inline bool wxDateTime::IsLaterThan(const wxDateTime& datetime) const
+{
+ wxASSERT_MSG( IsValid() && datetime.IsValid(), wxT("invalid wxDateTime"));
+
+ return m_time > datetime.m_time;
+}
+
+inline bool wxDateTime::IsStrictlyBetween(const wxDateTime& t1,
+ const wxDateTime& t2) const
+{
+ // no need for assert, will be checked by the functions we call
+ return IsLaterThan(t1) && IsEarlierThan(t2);
+}
+
+inline bool wxDateTime::IsBetween(const wxDateTime& t1,
+ const wxDateTime& t2) const
+{
+ // no need for assert, will be checked by the functions we call
+ return IsEqualTo(t1) || IsEqualTo(t2) || IsStrictlyBetween(t1, t2);
+}
+
+inline bool wxDateTime::IsSameDate(const wxDateTime& dt) const
+{
+ Tm tm1 = GetTm(),
+ tm2 = dt.GetTm();
+
+ return tm1.year == tm2.year &&
+ tm1.mon == tm2.mon &&
+ tm1.mday == tm2.mday;
+}
+
+inline bool wxDateTime::IsSameTime(const wxDateTime& dt) const
+{
+ // notice that we can't do something like this:
+ //
+ // m_time % MILLISECONDS_PER_DAY == dt.m_time % MILLISECONDS_PER_DAY
+ //
+ // because we have also to deal with (possibly) different DST settings!
+ Tm tm1 = GetTm(),
+ tm2 = dt.GetTm();
+
+ return tm1.hour == tm2.hour &&
+ tm1.min == tm2.min &&
+ tm1.sec == tm2.sec &&
+ tm1.msec == tm2.msec;
+}
+
+inline bool wxDateTime::IsEqualUpTo(const wxDateTime& dt,
+ const wxTimeSpan& ts) const
+{
+ return IsBetween(dt.Subtract(ts), dt.Add(ts));
+}
+
+// ----------------------------------------------------------------------------
+// wxDateTime arithmetics
+// ----------------------------------------------------------------------------
+
+inline wxDateTime wxDateTime::Add(const wxTimeSpan& diff) const
+{
+ wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime"));
+
+ return wxDateTime(m_time + diff.GetValue());
+}
+
+inline wxDateTime& wxDateTime::Add(const wxTimeSpan& diff)
+{
+ wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime"));
+
+ m_time += diff.GetValue();
+
+ return *this;
+}
+
+inline wxDateTime& wxDateTime::operator+=(const wxTimeSpan& diff)
+{
+ return Add(diff);
+}
+
+inline wxDateTime wxDateTime::Subtract(const wxTimeSpan& diff) const
+{
+ wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime"));
+
+ return wxDateTime(m_time - diff.GetValue());
+}
+
+inline wxDateTime& wxDateTime::Subtract(const wxTimeSpan& diff)
+{
+ wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime"));
+
+ m_time -= diff.GetValue();
+
+ return *this;
+}
+
+inline wxDateTime& wxDateTime::operator-=(const wxTimeSpan& diff)
+{
+ return Subtract(diff);
+}
+
+inline wxTimeSpan wxDateTime::Subtract(const wxDateTime& datetime) const
+{
+ wxASSERT_MSG( IsValid() && datetime.IsValid(), wxT("invalid wxDateTime"));
+
+ return wxTimeSpan(GetValue() - datetime.GetValue());
+}
+
+inline wxTimeSpan wxDateTime::operator-(const wxDateTime& dt2) const
+{
+ return this->Subtract(dt2);
+}
+
+inline wxDateTime wxDateTime::Add(const wxDateSpan& diff) const
+{
+ return wxDateTime(*this).Add(diff);
+}
+
+inline wxDateTime& wxDateTime::Subtract(const wxDateSpan& diff)
+{
+ return Add(diff.Negate());
+}
+
+inline wxDateTime wxDateTime::Subtract(const wxDateSpan& diff) const
+{
+ return wxDateTime(*this).Subtract(diff);
+}
+
+inline wxDateTime& wxDateTime::operator-=(const wxDateSpan& diff)
+{
+ return Subtract(diff);
+}
+
+inline wxDateTime& wxDateTime::operator+=(const wxDateSpan& diff)
+{
+ return Add(diff);
+}
+
+// ----------------------------------------------------------------------------
+// wxDateTime and timezones
+// ----------------------------------------------------------------------------
+
+inline wxDateTime
+wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz, bool noDST) const
+{
+ MODIFY_AND_RETURN( MakeTimezone(tz, noDST) );
+}
+
+inline wxDateTime
+wxDateTime::FromTimezone(const wxDateTime::TimeZone& tz, bool noDST) const
+{
+ MODIFY_AND_RETURN( MakeFromTimezone(tz, noDST) );
+}
+
+// ----------------------------------------------------------------------------
+// wxTimeSpan construction
+// ----------------------------------------------------------------------------
+
+inline wxTimeSpan::wxTimeSpan(long hours,
+ long minutes,
+ wxLongLong seconds,
+ wxLongLong milliseconds)
+{
+ // assign first to avoid precision loss
+ m_diff = hours;
+ m_diff *= 60l;
+ m_diff += minutes;
+ m_diff *= 60l;
+ m_diff += seconds;
+ m_diff *= 1000l;
+ m_diff += milliseconds;
+}
+
+// ----------------------------------------------------------------------------
+// wxTimeSpan accessors
+// ----------------------------------------------------------------------------
+
+inline wxLongLong wxTimeSpan::GetSeconds() const
+{
+ return m_diff / 1000l;
+}
+
+inline int wxTimeSpan::GetMinutes() const
+{
+ // For compatibility, this method (and the other accessors) return int,
+ // even though GetLo() actually returns unsigned long with greater range.
+ return static_cast<int>((GetSeconds() / 60l).GetLo());
+}
+
+inline int wxTimeSpan::GetHours() const
+{
+ return GetMinutes() / 60;
+}
+
+inline int wxTimeSpan::GetDays() const
+{
+ return GetHours() / 24;
+}
+
+inline int wxTimeSpan::GetWeeks() const
+{
+ return GetDays() / 7;
+}
+
+// ----------------------------------------------------------------------------
+// wxTimeSpan arithmetics
+// ----------------------------------------------------------------------------
+
+inline wxTimeSpan wxTimeSpan::Add(const wxTimeSpan& diff) const
+{
+ return wxTimeSpan(m_diff + diff.GetValue());
+}
+
+inline wxTimeSpan& wxTimeSpan::Add(const wxTimeSpan& diff)
+{
+ m_diff += diff.GetValue();
+
+ return *this;
+}
+
+inline wxTimeSpan wxTimeSpan::Subtract(const wxTimeSpan& diff) const
+{
+ return wxTimeSpan(m_diff - diff.GetValue());
+}
+
+inline wxTimeSpan& wxTimeSpan::Subtract(const wxTimeSpan& diff)
+{
+ m_diff -= diff.GetValue();
+
+ return *this;
+}
+
+inline wxTimeSpan& wxTimeSpan::Multiply(int n)
+{
+ m_diff *= (long)n;
+
+ return *this;
+}
+
+inline wxTimeSpan wxTimeSpan::Multiply(int n) const
+{
+ return wxTimeSpan(m_diff * (long)n);
+}
+
+inline wxTimeSpan wxTimeSpan::Abs() const
+{
+ return wxTimeSpan(GetValue().Abs());
+}
+
+inline bool wxTimeSpan::IsEqualTo(const wxTimeSpan& ts) const
+{
+ return GetValue() == ts.GetValue();
+}
+
+inline bool wxTimeSpan::IsLongerThan(const wxTimeSpan& ts) const
+{
+ return GetValue().Abs() > ts.GetValue().Abs();
+}
+
+inline bool wxTimeSpan::IsShorterThan(const wxTimeSpan& ts) const
+{
+ return GetValue().Abs() < ts.GetValue().Abs();
+}
+
+// ----------------------------------------------------------------------------
+// wxDateSpan
+// ----------------------------------------------------------------------------
+
+inline wxDateSpan& wxDateSpan::operator+=(const wxDateSpan& other)
+{
+ m_years += other.m_years;
+ m_months += other.m_months;
+ m_weeks += other.m_weeks;
+ m_days += other.m_days;
+
+ return *this;
+}
+
+inline wxDateSpan& wxDateSpan::Add(const wxDateSpan& other)
+{
+ return *this += other;
+}
+
+inline wxDateSpan wxDateSpan::Add(const wxDateSpan& other) const
+{
+ wxDateSpan ds(*this);
+ ds.Add(other);
+ return ds;
+}
+
+inline wxDateSpan& wxDateSpan::Multiply(int factor)
+{
+ m_years *= factor;
+ m_months *= factor;
+ m_weeks *= factor;
+ m_days *= factor;
+
+ return *this;
+}
+
+inline wxDateSpan wxDateSpan::Multiply(int factor) const
+{
+ wxDateSpan ds(*this);
+ ds.Multiply(factor);
+ return ds;
+}
+
+inline wxDateSpan wxDateSpan::Negate() const
+{
+ return wxDateSpan(-m_years, -m_months, -m_weeks, -m_days);
+}
+
+inline wxDateSpan& wxDateSpan::Neg()
+{
+ m_years = -m_years;
+ m_months = -m_months;
+ m_weeks = -m_weeks;
+ m_days = -m_days;
+
+ return *this;
+}
+
+inline wxDateSpan& wxDateSpan::operator-=(const wxDateSpan& other)
+{
+ return *this += other.Negate();
+}
+
+inline wxDateSpan& wxDateSpan::Subtract(const wxDateSpan& other)
+{
+ return *this -= other;
+}
+
+inline wxDateSpan wxDateSpan::Subtract(const wxDateSpan& other) const
+{
+ wxDateSpan ds(*this);
+ ds.Subtract(other);
+ return ds;
+}
+
+#undef MILLISECONDS_PER_DAY
+
+#undef MODIFY_AND_RETURN
+
+// ============================================================================
+// binary operators
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxTimeSpan operators
+// ----------------------------------------------------------------------------
+
+wxTimeSpan WXDLLIMPEXP_BASE operator*(int n, const wxTimeSpan& ts);
+
+// ----------------------------------------------------------------------------
+// wxDateSpan
+// ----------------------------------------------------------------------------
+
+wxDateSpan WXDLLIMPEXP_BASE operator*(int n, const wxDateSpan& ds);
+
+// ============================================================================
+// other helper functions
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// iteration helpers: can be used to write a for loop over enum variable like
+// this:
+// for ( m = wxDateTime::Jan; m < wxDateTime::Inv_Month; wxNextMonth(m) )
+// ----------------------------------------------------------------------------
+
+WXDLLIMPEXP_BASE void wxNextMonth(wxDateTime::Month& m);
+WXDLLIMPEXP_BASE void wxPrevMonth(wxDateTime::Month& m);
+WXDLLIMPEXP_BASE void wxNextWDay(wxDateTime::WeekDay& wd);
+WXDLLIMPEXP_BASE void wxPrevWDay(wxDateTime::WeekDay& wd);
+
+#endif // wxUSE_DATETIME
+
+#endif // _WX_DATETIME_H
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/timectrl.h
+// Purpose: Declaration of wxDateTimePickerCtrl class.
+// Author: Vadim Zeitlin
+// Created: 2011-09-22
+// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DATETIME_CTRL_H_
+#define _WX_DATETIME_CTRL_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL
+
+#define wxNEEDS_DATETIMEPICKCTRL
+
+#include "wx/control.h" // the base class
+
+#include "wx/datetime.h"
+
+// ----------------------------------------------------------------------------
+// wxDateTimePickerCtrl: Private common base class of wx{Date,Time}PickerCtrl.
+// ----------------------------------------------------------------------------
+
+// This class is an implementation detail and should not be used directly, only
+// use the documented API of wxDateTimePickerCtrl and wxTimePickerCtrl.
+class WXDLLIMPEXP_ADV wxDateTimePickerCtrlBase : public wxControl
+{
+public:
+ // Set/get the date or time (in the latter case, time part is ignored).
+ virtual void SetValue(const wxDateTime& dt) = 0;
+ virtual wxDateTime GetValue() const = 0;
+};
+
+#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
+ #include "wx/msw/datetimectrl.h"
+#elif defined(__WXOSX_COCOA__) && !defined(__WXUNIVERSAL__)
+ #include "wx/osx/datetimectrl.h"
+#else
+ typedef wxDateTimePickerCtrlBase wxDateTimePickerCtrl;
+#endif
+
+#endif // wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL
+
+#endif // _WX_DATETIME_CTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/datstrm.h
+// Purpose: Data stream classes
+// Author: Guilhem Lavaux
+// Modified by: Mickael Gilabert
+// Created: 28/06/1998
+// Copyright: (c) Guilhem Lavaux
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DATSTREAM_H_
+#define _WX_DATSTREAM_H_
+
+#include "wx/stream.h"
+#include "wx/longlong.h"
+#include "wx/convauto.h"
+
+#if wxUSE_STREAMS
+
+// Common wxDataInputStream and wxDataOutputStream parameters.
+class WXDLLIMPEXP_BASE wxDataStreamBase
+{
+public:
+ void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
+
+ // By default we use extended precision (80 bit) format for both float and
+ // doubles. Call this function to switch to alternative representation in
+ // which IEEE 754 single precision (32 bits) is used for floats and double
+ // precision (64 bits) is used for doubles.
+ void UseBasicPrecisions()
+ {
+#if wxUSE_APPLE_IEEE
+ m_useExtendedPrecision = false;
+#endif // wxUSE_APPLE_IEEE
+ }
+
+ // UseExtendedPrecision() is not very useful as it corresponds to the
+ // default value, only call it in your code if you want the compilation
+ // fail with the error when using wxWidgets library compiled without
+ // extended precision support.
+#if wxUSE_APPLE_IEEE
+ void UseExtendedPrecision()
+ {
+ m_useExtendedPrecision = true;
+ }
+#endif // wxUSE_APPLE_IEEE
+
+#if wxUSE_UNICODE
+ void SetConv( const wxMBConv &conv );
+ wxMBConv *GetConv() const { return m_conv; }
+#endif
+
+protected:
+ // Ctor and dtor are both protected, this class is never used directly but
+ // only by its derived classes.
+ wxDataStreamBase(const wxMBConv& conv);
+ ~wxDataStreamBase();
+
+
+ bool m_be_order;
+
+#if wxUSE_APPLE_IEEE
+ bool m_useExtendedPrecision;
+#endif // wxUSE_APPLE_IEEE
+
+#if wxUSE_UNICODE
+ wxMBConv *m_conv;
+#endif
+
+ wxDECLARE_NO_COPY_CLASS(wxDataStreamBase);
+};
+
+
+class WXDLLIMPEXP_BASE wxDataInputStream : public wxDataStreamBase
+{
+public:
+ wxDataInputStream(wxInputStream& s, const wxMBConv& conv = wxConvUTF8);
+
+ bool IsOk() { return m_input->IsOk(); }
+
+#if wxHAS_INT64
+ wxUint64 Read64();
+#endif
+#if wxUSE_LONGLONG
+ wxLongLong ReadLL();
+#endif
+ wxUint32 Read32();
+ wxUint16 Read16();
+ wxUint8 Read8();
+ double ReadDouble();
+ float ReadFloat();
+ wxString ReadString();
+
+#if wxHAS_INT64
+ void Read64(wxUint64 *buffer, size_t size);
+ void Read64(wxInt64 *buffer, size_t size);
+#endif
+#if defined(wxLongLong_t) && wxUSE_LONGLONG
+ void Read64(wxULongLong *buffer, size_t size);
+ void Read64(wxLongLong *buffer, size_t size);
+#endif
+#if wxUSE_LONGLONG
+ void ReadLL(wxULongLong *buffer, size_t size);
+ void ReadLL(wxLongLong *buffer, size_t size);
+#endif
+ void Read32(wxUint32 *buffer, size_t size);
+ void Read16(wxUint16 *buffer, size_t size);
+ void Read8(wxUint8 *buffer, size_t size);
+ void ReadDouble(double *buffer, size_t size);
+ void ReadFloat(float *buffer, size_t size);
+
+ wxDataInputStream& operator>>(wxString& s);
+ wxDataInputStream& operator>>(wxInt8& c);
+ wxDataInputStream& operator>>(wxInt16& i);
+ wxDataInputStream& operator>>(wxInt32& i);
+ wxDataInputStream& operator>>(wxUint8& c);
+ wxDataInputStream& operator>>(wxUint16& i);
+ wxDataInputStream& operator>>(wxUint32& i);
+#if wxHAS_INT64
+ wxDataInputStream& operator>>(wxUint64& i);
+ wxDataInputStream& operator>>(wxInt64& i);
+#endif
+#if defined(wxLongLong_t) && wxUSE_LONGLONG
+ wxDataInputStream& operator>>(wxULongLong& i);
+ wxDataInputStream& operator>>(wxLongLong& i);
+#endif
+ wxDataInputStream& operator>>(double& d);
+ wxDataInputStream& operator>>(float& f);
+
+protected:
+ wxInputStream *m_input;
+
+ wxDECLARE_NO_COPY_CLASS(wxDataInputStream);
+};
+
+class WXDLLIMPEXP_BASE wxDataOutputStream : public wxDataStreamBase
+{
+public:
+ wxDataOutputStream(wxOutputStream& s, const wxMBConv& conv = wxConvUTF8);
+
+ bool IsOk() { return m_output->IsOk(); }
+
+#if wxHAS_INT64
+ void Write64(wxUint64 i);
+ void Write64(wxInt64 i);
+#endif
+#if wxUSE_LONGLONG
+ void WriteLL(const wxLongLong &ll);
+ void WriteLL(const wxULongLong &ll);
+#endif
+ void Write32(wxUint32 i);
+ void Write16(wxUint16 i);
+ void Write8(wxUint8 i);
+ void WriteDouble(double d);
+ void WriteFloat(float f);
+ void WriteString(const wxString& string);
+
+#if wxHAS_INT64
+ void Write64(const wxUint64 *buffer, size_t size);
+ void Write64(const wxInt64 *buffer, size_t size);
+#endif
+#if defined(wxLongLong_t) && wxUSE_LONGLONG
+ void Write64(const wxULongLong *buffer, size_t size);
+ void Write64(const wxLongLong *buffer, size_t size);
+#endif
+#if wxUSE_LONGLONG
+ void WriteLL(const wxULongLong *buffer, size_t size);
+ void WriteLL(const wxLongLong *buffer, size_t size);
+#endif
+ void Write32(const wxUint32 *buffer, size_t size);
+ void Write16(const wxUint16 *buffer, size_t size);
+ void Write8(const wxUint8 *buffer, size_t size);
+ void WriteDouble(const double *buffer, size_t size);
+ void WriteFloat(const float *buffer, size_t size);
+
+ wxDataOutputStream& operator<<(const wxString& string);
+ wxDataOutputStream& operator<<(wxInt8 c);
+ wxDataOutputStream& operator<<(wxInt16 i);
+ wxDataOutputStream& operator<<(wxInt32 i);
+ wxDataOutputStream& operator<<(wxUint8 c);
+ wxDataOutputStream& operator<<(wxUint16 i);
+ wxDataOutputStream& operator<<(wxUint32 i);
+#if wxHAS_INT64
+ wxDataOutputStream& operator<<(wxUint64 i);
+ wxDataOutputStream& operator<<(wxInt64 i);
+#endif
+#if defined(wxLongLong_t) && wxUSE_LONGLONG
+ wxDataOutputStream& operator<<(const wxULongLong &i);
+ wxDataOutputStream& operator<<(const wxLongLong &i);
+#endif
+ wxDataOutputStream& operator<<(double d);
+ wxDataOutputStream& operator<<(float f);
+
+protected:
+ wxOutputStream *m_output;
+
+ wxDECLARE_NO_COPY_CLASS(wxDataOutputStream);
+};
+
+#endif
+ // wxUSE_STREAMS
+
+#endif
+ // _WX_DATSTREAM_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/dc.h
+// Purpose: wxDC class
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 05/25/99
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DC_H_BASE_
+#define _WX_DC_H_BASE_
+
+// ----------------------------------------------------------------------------
+// headers which we must include here
+// ----------------------------------------------------------------------------
+
+#include "wx/object.h" // the base class
+
+#include "wx/intl.h" // for wxLayoutDirection
+#include "wx/cursor.h" // we have member variables of these classes
+#include "wx/font.h" // so we can't do without them
+#include "wx/colour.h"
+#include "wx/bitmap.h" // for wxNullBitmap
+#include "wx/brush.h"
+#include "wx/pen.h"
+#include "wx/palette.h"
+#include "wx/dynarray.h"
+#include "wx/math.h"
+#include "wx/image.h"
+#include "wx/region.h"
+#include "wx/affinematrix2d.h"
+
+#define wxUSE_NEW_DC 1
+
+class WXDLLIMPEXP_FWD_CORE wxDC;
+class WXDLLIMPEXP_FWD_CORE wxClientDC;
+class WXDLLIMPEXP_FWD_CORE wxPaintDC;
+class WXDLLIMPEXP_FWD_CORE wxWindowDC;
+class WXDLLIMPEXP_FWD_CORE wxScreenDC;
+class WXDLLIMPEXP_FWD_CORE wxMemoryDC;
+class WXDLLIMPEXP_FWD_CORE wxPrinterDC;
+class WXDLLIMPEXP_FWD_CORE wxPrintData;
+
+#if wxUSE_GRAPHICS_CONTEXT
+class WXDLLIMPEXP_FWD_CORE wxGraphicsContext;
+#endif
+
+// Logical ops
+enum wxRasterOperationMode
+{
+ wxCLEAR, // 0
+ wxXOR, // src XOR dst
+ wxINVERT, // NOT dst
+ wxOR_REVERSE, // src OR (NOT dst)
+ wxAND_REVERSE, // src AND (NOT dst)
+ wxCOPY, // src
+ wxAND, // src AND dst
+ wxAND_INVERT, // (NOT src) AND dst
+ wxNO_OP, // dst
+ wxNOR, // (NOT src) AND (NOT dst)
+ wxEQUIV, // (NOT src) XOR dst
+ wxSRC_INVERT, // (NOT src)
+ wxOR_INVERT, // (NOT src) OR dst
+ wxNAND, // (NOT src) OR (NOT dst)
+ wxOR, // src OR dst
+ wxSET // 1
+#if WXWIN_COMPATIBILITY_2_8
+ ,wxROP_BLACK = wxCLEAR,
+ wxBLIT_BLACKNESS = wxCLEAR,
+ wxROP_XORPEN = wxXOR,
+ wxBLIT_SRCINVERT = wxXOR,
+ wxROP_NOT = wxINVERT,
+ wxBLIT_DSTINVERT = wxINVERT,
+ wxROP_MERGEPENNOT = wxOR_REVERSE,
+ wxBLIT_00DD0228 = wxOR_REVERSE,
+ wxROP_MASKPENNOT = wxAND_REVERSE,
+ wxBLIT_SRCERASE = wxAND_REVERSE,
+ wxROP_COPYPEN = wxCOPY,
+ wxBLIT_SRCCOPY = wxCOPY,
+ wxROP_MASKPEN = wxAND,
+ wxBLIT_SRCAND = wxAND,
+ wxROP_MASKNOTPEN = wxAND_INVERT,
+ wxBLIT_00220326 = wxAND_INVERT,
+ wxROP_NOP = wxNO_OP,
+ wxBLIT_00AA0029 = wxNO_OP,
+ wxROP_NOTMERGEPEN = wxNOR,
+ wxBLIT_NOTSRCERASE = wxNOR,
+ wxROP_NOTXORPEN = wxEQUIV,
+ wxBLIT_00990066 = wxEQUIV,
+ wxROP_NOTCOPYPEN = wxSRC_INVERT,
+ wxBLIT_NOTSCRCOPY = wxSRC_INVERT,
+ wxROP_MERGENOTPEN = wxOR_INVERT,
+ wxBLIT_MERGEPAINT = wxOR_INVERT,
+ wxROP_NOTMASKPEN = wxNAND,
+ wxBLIT_007700E6 = wxNAND,
+ wxROP_MERGEPEN = wxOR,
+ wxBLIT_SRCPAINT = wxOR,
+ wxROP_WHITE = wxSET,
+ wxBLIT_WHITENESS = wxSET
+#endif //WXWIN_COMPATIBILITY_2_8
+};
+
+// Flood styles
+enum wxFloodFillStyle
+{
+ wxFLOOD_SURFACE = 1,
+ wxFLOOD_BORDER
+};
+
+// Mapping modes
+enum wxMappingMode
+{
+ wxMM_TEXT = 1,
+ wxMM_METRIC,
+ wxMM_LOMETRIC,
+ wxMM_TWIPS,
+ wxMM_POINTS
+};
+
+// Description of text characteristics.
+struct wxFontMetrics
+{
+ wxFontMetrics()
+ {
+ height =
+ ascent =
+ descent =
+ internalLeading =
+ externalLeading =
+ averageWidth = 0;
+ }
+
+ int height, // Total character height.
+ ascent, // Part of the height above the baseline.
+ descent, // Part of the height below the baseline.
+ internalLeading, // Intra-line spacing.
+ externalLeading, // Inter-line spacing.
+ averageWidth; // Average font width, a.k.a. "x-width".
+};
+
+#if WXWIN_COMPATIBILITY_2_8
+
+//-----------------------------------------------------------------------------
+// wxDrawObject helper class
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDrawObject
+{
+public:
+ wxDEPRECATED_CONSTRUCTOR(wxDrawObject)()
+ : m_isBBoxValid(false)
+ , m_minX(0), m_minY(0), m_maxX(0), m_maxY(0)
+ { }
+
+ virtual ~wxDrawObject() { }
+
+ virtual void Draw(wxDC&) const { }
+
+ virtual void CalcBoundingBox(wxCoord x, wxCoord y)
+ {
+ if ( m_isBBoxValid )
+ {
+ if ( x < m_minX ) m_minX = x;
+ if ( y < m_minY ) m_minY = y;
+ if ( x > m_maxX ) m_maxX = x;
+ if ( y > m_maxY ) m_maxY = y;
+ }
+ else
+ {
+ m_isBBoxValid = true;
+
+ m_minX = x;
+ m_minY = y;
+ m_maxX = x;
+ m_maxY = y;
+ }
+ }
+
+ void ResetBoundingBox()
+ {
+ m_isBBoxValid = false;
+
+ m_minX = m_maxX = m_minY = m_maxY = 0;
+ }
+
+ // Get the final bounding box of the PostScript or Metafile picture.
+
+ wxCoord MinX() const { return m_minX; }
+ wxCoord MaxX() const { return m_maxX; }
+ wxCoord MinY() const { return m_minY; }
+ wxCoord MaxY() const { return m_maxY; }
+
+ //to define the type of object for derived objects
+ virtual int GetType()=0;
+
+protected:
+ //for boundingbox calculation
+ bool m_isBBoxValid:1;
+ //for boundingbox calculation
+ wxCoord m_minX, m_minY, m_maxX, m_maxY;
+};
+
+#endif // WXWIN_COMPATIBILITY_2_8
+
+
+//-----------------------------------------------------------------------------
+// wxDCFactory
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxDCImpl;
+
+class WXDLLIMPEXP_CORE wxDCFactory
+{
+public:
+ wxDCFactory() {}
+ virtual ~wxDCFactory() {}
+
+ virtual wxDCImpl* CreateWindowDC( wxWindowDC *owner, wxWindow *window ) = 0;
+ virtual wxDCImpl* CreateClientDC( wxClientDC *owner, wxWindow *window ) = 0;
+ virtual wxDCImpl* CreatePaintDC( wxPaintDC *owner, wxWindow *window ) = 0;
+ virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner ) = 0;
+ virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap ) = 0;
+ virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxDC *dc ) = 0;
+ virtual wxDCImpl* CreateScreenDC( wxScreenDC *owner ) = 0;
+#if wxUSE_PRINTING_ARCHITECTURE
+ virtual wxDCImpl* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data ) = 0;
+#endif
+
+ static void Set(wxDCFactory *factory);
+ static wxDCFactory *Get();
+
+private:
+ static wxDCFactory *m_factory;
+};
+
+//-----------------------------------------------------------------------------
+// wxNativeDCFactory
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxNativeDCFactory: public wxDCFactory
+{
+public:
+ wxNativeDCFactory() {}
+
+ virtual wxDCImpl* CreateWindowDC( wxWindowDC *owner, wxWindow *window );
+ virtual wxDCImpl* CreateClientDC( wxClientDC *owner, wxWindow *window );
+ virtual wxDCImpl* CreatePaintDC( wxPaintDC *owner, wxWindow *window );
+ virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner );
+ virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap );
+ virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxDC *dc );
+ virtual wxDCImpl* CreateScreenDC( wxScreenDC *owner );
+#if wxUSE_PRINTING_ARCHITECTURE
+ virtual wxDCImpl* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data );
+#endif
+};
+
+//-----------------------------------------------------------------------------
+// wxDCImpl
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDCImpl: public wxObject
+{
+public:
+ wxDCImpl( wxDC *owner );
+ virtual ~wxDCImpl();
+
+ wxDC *GetOwner() const { return m_owner; }
+
+ wxWindow* GetWindow() const { return m_window; }
+
+ virtual bool IsOk() const { return m_ok; }
+
+ // query capabilities
+
+ virtual bool CanDrawBitmap() const = 0;
+ virtual bool CanGetTextExtent() const = 0;
+
+ // get Cairo context
+ virtual void* GetCairoContext() const
+ {
+ return NULL;
+ }
+
+ virtual void* GetHandle() const { return NULL; }
+
+ // query dimension, colour deps, resolution
+
+ virtual void DoGetSize(int *width, int *height) const = 0;
+ void GetSize(int *width, int *height) const
+ {
+ DoGetSize(width, height);
+ return ;
+ }
+
+ wxSize GetSize() const
+ {
+ int w, h;
+ DoGetSize(&w, &h);
+ return wxSize(w, h);
+ }
+
+ virtual void DoGetSizeMM(int* width, int* height) const = 0;
+
+ virtual int GetDepth() const = 0;
+ virtual wxSize GetPPI() const = 0;
+
+ // Right-To-Left (RTL) modes
+
+ virtual void SetLayoutDirection(wxLayoutDirection WXUNUSED(dir)) { }
+ virtual wxLayoutDirection GetLayoutDirection() const { return wxLayout_Default; }
+
+ // page and document
+
+ virtual bool StartDoc(const wxString& WXUNUSED(message)) { return true; }
+ virtual void EndDoc() { }
+
+ virtual void StartPage() { }
+ virtual void EndPage() { }
+
+ // flushing the content of this dc immediately eg onto screen
+ virtual void Flush() { }
+
+ // bounding box
+
+ virtual void CalcBoundingBox(wxCoord x, wxCoord y)
+ {
+ if ( m_isBBoxValid )
+ {
+ if ( x < m_minX ) m_minX = x;
+ if ( y < m_minY ) m_minY = y;
+ if ( x > m_maxX ) m_maxX = x;
+ if ( y > m_maxY ) m_maxY = y;
+ }
+ else
+ {
+ m_isBBoxValid = true;
+
+ m_minX = x;
+ m_minY = y;
+ m_maxX = x;
+ m_maxY = y;
+ }
+ }
+ void ResetBoundingBox()
+ {
+ m_isBBoxValid = false;
+
+ m_minX = m_maxX = m_minY = m_maxY = 0;
+ }
+
+ wxCoord MinX() const { return m_minX; }
+ wxCoord MaxX() const { return m_maxX; }
+ wxCoord MinY() const { return m_minY; }
+ wxCoord MaxY() const { return m_maxY; }
+
+ // setters and getters
+
+ virtual void SetFont(const wxFont& font) = 0;
+ virtual const wxFont& GetFont() const { return m_font; }
+
+ virtual void SetPen(const wxPen& pen) = 0;
+ virtual const wxPen& GetPen() const { return m_pen; }
+
+ virtual void SetBrush(const wxBrush& brush) = 0;
+ virtual const wxBrush& GetBrush() const { return m_brush; }
+
+ virtual void SetBackground(const wxBrush& brush) = 0;
+ virtual const wxBrush& GetBackground() const { return m_backgroundBrush; }
+
+ virtual void SetBackgroundMode(int mode) = 0;
+ virtual int GetBackgroundMode() const { return m_backgroundMode; }
+
+ virtual void SetTextForeground(const wxColour& colour)
+ { m_textForegroundColour = colour; }
+ virtual const wxColour& GetTextForeground() const
+ { return m_textForegroundColour; }
+
+ virtual void SetTextBackground(const wxColour& colour)
+ { m_textBackgroundColour = colour; }
+ virtual const wxColour& GetTextBackground() const
+ { return m_textBackgroundColour; }
+
+#if wxUSE_PALETTE
+ virtual void SetPalette(const wxPalette& palette) = 0;
+#endif // wxUSE_PALETTE
+
+ // inherit the DC attributes (font and colours) from the given window
+ //
+ // this is called automatically when a window, client or paint DC is
+ // created
+ virtual void InheritAttributes(wxWindow *win);
+
+
+ // logical functions
+
+ virtual void SetLogicalFunction(wxRasterOperationMode function) = 0;
+ virtual wxRasterOperationMode GetLogicalFunction() const
+ { return m_logicalFunction; }
+
+ // text measurement
+
+ virtual wxCoord GetCharHeight() const = 0;
+ virtual wxCoord GetCharWidth() const = 0;
+
+ // The derived classes should really override DoGetFontMetrics() to return
+ // the correct values in the future but for now provide a default
+ // implementation in terms of DoGetTextExtent() to avoid breaking the
+ // compilation of all other ports as wxMSW is the only one to implement it.
+ virtual void DoGetFontMetrics(int *height,
+ int *ascent,
+ int *descent,
+ int *internalLeading,
+ int *externalLeading,
+ int *averageWidth) const;
+
+ virtual void DoGetTextExtent(const wxString& string,
+ wxCoord *x, wxCoord *y,
+ wxCoord *descent = NULL,
+ wxCoord *externalLeading = NULL,
+ const wxFont *theFont = NULL) const = 0;
+ virtual void GetMultiLineTextExtent(const wxString& string,
+ wxCoord *width,
+ wxCoord *height,
+ wxCoord *heightLine = NULL,
+ const wxFont *font = NULL) const;
+ virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const;
+
+ // clearing
+
+ virtual void Clear() = 0;
+
+ // clipping
+
+ // Note that this pure virtual method has an implementation that updates
+ // the values returned by DoGetClippingBox() and so can be called from the
+ // derived class overridden version if it makes sense (i.e. if the clipping
+ // box coordinates are not already updated in some other way).
+ virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
+ wxCoord w, wxCoord h) = 0;
+
+ // NB: this function works with device coordinates, not the logical ones!
+ virtual void DoSetDeviceClippingRegion(const wxRegion& region) = 0;
+
+ virtual void DoGetClippingBox(wxCoord *x, wxCoord *y,
+ wxCoord *w, wxCoord *h) const
+ {
+ if ( x )
+ *x = m_clipX1;
+ if ( y )
+ *y = m_clipY1;
+ if ( w )
+ *w = m_clipX2 - m_clipX1;
+ if ( h )
+ *h = m_clipY2 - m_clipY1;
+ }
+
+ virtual void DestroyClippingRegion() { ResetClipping(); }
+
+
+ // coordinates conversions and transforms
+
+ virtual wxCoord DeviceToLogicalX(wxCoord x) const;
+ virtual wxCoord DeviceToLogicalY(wxCoord y) const;
+ virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
+ virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
+ virtual wxCoord LogicalToDeviceX(wxCoord x) const;
+ virtual wxCoord LogicalToDeviceY(wxCoord y) const;
+ virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
+ virtual wxCoord LogicalToDeviceYRel(wxCoord y) const;
+
+ virtual void SetMapMode(wxMappingMode mode);
+ virtual wxMappingMode GetMapMode() const { return m_mappingMode; }
+
+ virtual void SetUserScale(double x, double y);
+ virtual void GetUserScale(double *x, double *y) const
+ {
+ if ( x ) *x = m_userScaleX;
+ if ( y ) *y = m_userScaleY;
+ }
+
+ virtual void SetLogicalScale(double x, double y);
+ virtual void GetLogicalScale(double *x, double *y) const
+ {
+ if ( x ) *x = m_logicalScaleX;
+ if ( y ) *y = m_logicalScaleY;
+ }
+
+ virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
+ virtual void DoGetLogicalOrigin(wxCoord *x, wxCoord *y) const
+ {
+ if ( x ) *x = m_logicalOriginX;
+ if ( y ) *y = m_logicalOriginY;
+ }
+
+ virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
+ virtual void DoGetDeviceOrigin(wxCoord *x, wxCoord *y) const
+ {
+ if ( x ) *x = m_deviceOriginX;
+ if ( y ) *y = m_deviceOriginY;
+ }
+
+#if wxUSE_DC_TRANSFORM_MATRIX
+ // Transform matrix support is not available in most ports right now
+ // (currently only wxMSW provides it) so do nothing in these methods by
+ // default.
+ virtual bool CanUseTransformMatrix() const
+ { return false; }
+ virtual bool SetTransformMatrix(const wxAffineMatrix2D& WXUNUSED(matrix))
+ { return false; }
+ virtual wxAffineMatrix2D GetTransformMatrix() const
+ { return wxAffineMatrix2D(); }
+ virtual void ResetTransformMatrix()
+ { }
+#endif // wxUSE_DC_TRANSFORM_MATRIX
+
+ virtual void SetDeviceLocalOrigin( wxCoord x, wxCoord y );
+
+ virtual void ComputeScaleAndOrigin();
+
+ // this needs to overidden if the axis is inverted
+ virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
+
+ virtual double GetContentScaleFactor() const { return m_contentScaleFactor; }
+
+#ifdef __WXMSW__
+ // Native Windows functions using the underlying HDC don't honour GDI+
+ // transformations which may be applied to it. Using this function we can
+ // transform the coordinates manually before passing them to such functions
+ // (as in e.g. wxRendererMSW code). It doesn't do anything if this is not a
+ // wxGCDC.
+ virtual wxRect MSWApplyGDIPlusTransform(const wxRect& r) const
+ {
+ return r;
+ }
+#endif // __WXMSW__
+
+
+ // ---------------------------------------------------------
+ // the actual drawing API
+
+ virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
+ wxFloodFillStyle style = wxFLOOD_SURFACE) = 0;
+
+ virtual void DoGradientFillLinear(const wxRect& rect,
+ const wxColour& initialColour,
+ const wxColour& destColour,
+ wxDirection nDirection = wxEAST);
+
+ virtual void DoGradientFillConcentric(const wxRect& rect,
+ const wxColour& initialColour,
+ const wxColour& destColour,
+ const wxPoint& circleCenter);
+
+ virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const = 0;
+
+ virtual void DoDrawPoint(wxCoord x, wxCoord y) = 0;
+ virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) = 0;
+
+ virtual void DoDrawArc(wxCoord x1, wxCoord y1,
+ wxCoord x2, wxCoord y2,
+ wxCoord xc, wxCoord yc) = 0;
+ virtual void DoDrawCheckMark(wxCoord x, wxCoord y,
+ wxCoord width, wxCoord height);
+ virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
+ double sa, double ea) = 0;
+
+ virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) = 0;
+ virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
+ wxCoord width, wxCoord height,
+ double radius) = 0;
+ virtual void DoDrawEllipse(wxCoord x, wxCoord y,
+ wxCoord width, wxCoord height) = 0;
+
+ virtual void DoCrossHair(wxCoord x, wxCoord y) = 0;
+
+ virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) = 0;
+ virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
+ bool useMask = false) = 0;
+
+ virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) = 0;
+ virtual void DoDrawRotatedText(const wxString& text,
+ wxCoord x, wxCoord y, double angle) = 0;
+
+ virtual bool DoBlit(wxCoord xdest, wxCoord ydest,
+ wxCoord width, wxCoord height,
+ wxDC *source,
+ wxCoord xsrc, wxCoord ysrc,
+ wxRasterOperationMode rop = wxCOPY,
+ bool useMask = false,
+ wxCoord xsrcMask = wxDefaultCoord,
+ wxCoord ysrcMask = wxDefaultCoord) = 0;
+
+ virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest,
+ wxCoord dstWidth, wxCoord dstHeight,
+ wxDC *source,
+ wxCoord xsrc, wxCoord ysrc,
+ wxCoord srcWidth, wxCoord srcHeight,
+ wxRasterOperationMode rop = wxCOPY,
+ bool useMask = false,
+ wxCoord xsrcMask = wxDefaultCoord,
+ wxCoord ysrcMask = wxDefaultCoord);
+
+ virtual wxBitmap DoGetAsBitmap(const wxRect *WXUNUSED(subrect)) const
+ { return wxNullBitmap; }
+
+
+ virtual void DoDrawLines(int n, const wxPoint points[],
+ wxCoord xoffset, wxCoord yoffset ) = 0;
+ virtual void DrawLines(const wxPointList *list,
+ wxCoord xoffset, wxCoord yoffset );
+
+ virtual void DoDrawPolygon(int n, const wxPoint points[],
+ wxCoord xoffset, wxCoord yoffset,
+ wxPolygonFillMode fillStyle = wxODDEVEN_RULE) = 0;
+ virtual void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[],
+ wxCoord xoffset, wxCoord yoffset,
+ wxPolygonFillMode fillStyle);
+ void DrawPolygon(const wxPointList *list,
+ wxCoord xoffset, wxCoord yoffset,
+ wxPolygonFillMode fillStyle );
+
+
+#if wxUSE_SPLINES
+ void DrawSpline(wxCoord x1, wxCoord y1,
+ wxCoord x2, wxCoord y2,
+ wxCoord x3, wxCoord y3);
+ void DrawSpline(int n, const wxPoint points[]);
+ void DrawSpline(const wxPointList *points) { DoDrawSpline(points); }
+
+ virtual void DoDrawSpline(const wxPointList *points);
+#endif
+
+ // ---------------------------------------------------------
+ // wxMemoryDC Impl API
+
+ virtual void DoSelect(const wxBitmap& WXUNUSED(bmp))
+ { }
+
+ virtual const wxBitmap& GetSelectedBitmap() const
+ { return wxNullBitmap; }
+ virtual wxBitmap& GetSelectedBitmap()
+ { return wxNullBitmap; }
+
+ // ---------------------------------------------------------
+ // wxPrinterDC Impl API
+
+ virtual wxRect GetPaperRect() const
+ { int w = 0; int h = 0; DoGetSize( &w, &h ); return wxRect(0,0,w,h); }
+
+ virtual int GetResolution() const
+ { return -1; }
+
+#if wxUSE_GRAPHICS_CONTEXT
+ virtual wxGraphicsContext* GetGraphicsContext() const
+ { return NULL; }
+ virtual void SetGraphicsContext( wxGraphicsContext* WXUNUSED(ctx) )
+ {}
+#endif
+
+private:
+ wxDC *m_owner;
+
+protected:
+ // unset clipping variables (after clipping region was destroyed)
+ void ResetClipping()
+ {
+ m_clipping = false;
+
+ m_clipX1 = m_clipX2 = m_clipY1 = m_clipY2 = 0;
+ }
+
+#ifdef __WXWINCE__
+ //! Generic method to draw ellipses, circles and arcs with current pen and brush.
+ /*! \param x Upper left corner of bounding box.
+ * \param y Upper left corner of bounding box.
+ * \param w Width of bounding box.
+ * \param h Height of bounding box.
+ * \param sa Starting angle of arc
+ * (counterclockwise, start at 3 o'clock, 360 is full circle).
+ * \param ea Ending angle of arc.
+ * \param angle Rotation angle, the Arc will be rotated after
+ * calculating begin and end.
+ */
+ void DrawEllipticArcRot( wxCoord x, wxCoord y,
+ wxCoord width, wxCoord height,
+ double sa = 0, double ea = 0, double angle = 0 )
+ { DoDrawEllipticArcRot( x, y, width, height, sa, ea, angle ); }
+
+ void DrawEllipticArcRot( const wxPoint& pt,
+ const wxSize& sz,
+ double sa = 0, double ea = 0, double angle = 0 )
+ { DoDrawEllipticArcRot( pt.x, pt.y, sz.x, sz.y, sa, ea, angle ); }
+
+ void DrawEllipticArcRot( const wxRect& rect,
+ double sa = 0, double ea = 0, double angle = 0 )
+ { DoDrawEllipticArcRot( rect.x, rect.y, rect.width, rect.height, sa, ea, angle ); }
+
+ virtual void DoDrawEllipticArcRot( wxCoord x, wxCoord y,
+ wxCoord w, wxCoord h,
+ double sa = 0, double ea = 0, double angle = 0 );
+
+ //! Rotates points around center.
+ /*! This is a quite straight method, it calculates in pixels
+ * and so it produces rounding errors.
+ * \param points The points inside will be rotated.
+ * \param angle Rotating angle (counterclockwise, start at 3 o'clock, 360 is full circle).
+ * \param center Center of rotation.
+ */
+ void Rotate( wxPointList* points, double angle, wxPoint center = wxPoint(0,0) );
+
+ // used by DrawEllipticArcRot
+ // Careful: wxList gets filled with points you have to delete later.
+ void CalculateEllipticPoints( wxPointList* points,
+ wxCoord xStart, wxCoord yStart,
+ wxCoord w, wxCoord h,
+ double sa, double ea );
+#endif // __WXWINCE__
+
+ // returns adjustment factor for converting wxFont "point size"; in wx
+ // it is point size on screen and needs to be multiplied by this value
+ // for rendering on higher-resolution DCs such as printer ones
+ static float GetFontPointSizeAdjustment(float dpi);
+
+ // window on which the DC draws or NULL
+ wxWindow *m_window;
+
+ // flags
+ bool m_colour:1;
+ bool m_ok:1;
+ bool m_clipping:1;
+ bool m_isInteractive:1;
+ bool m_isBBoxValid:1;
+
+ // coordinate system variables
+
+ wxCoord m_logicalOriginX, m_logicalOriginY;
+ wxCoord m_deviceOriginX, m_deviceOriginY; // Usually 0,0, can be change by user
+
+ wxCoord m_deviceLocalOriginX, m_deviceLocalOriginY; // non-zero if native top-left corner
+ // is not at 0,0. This was the case under
+ // Mac's GrafPorts (coordinate system
+ // used toplevel window's origin) and
+ // e.g. for Postscript, where the native
+ // origin in the bottom left corner.
+ double m_logicalScaleX, m_logicalScaleY;
+ double m_userScaleX, m_userScaleY;
+ double m_scaleX, m_scaleY; // calculated from logical scale and user scale
+
+ int m_signX, m_signY; // Used by SetAxisOrientation() to invert the axes
+
+ double m_contentScaleFactor; // used by high resolution displays (retina)
+
+ // what is a mm on a screen you don't know the size of?
+ double m_mm_to_pix_x,
+ m_mm_to_pix_y;
+
+ // bounding and clipping boxes
+ wxCoord m_minX, m_minY, m_maxX, m_maxY;
+ wxCoord m_clipX1, m_clipY1, m_clipX2, m_clipY2;
+
+ wxRasterOperationMode m_logicalFunction;
+ int m_backgroundMode;
+ wxMappingMode m_mappingMode;
+
+ wxPen m_pen;
+ wxBrush m_brush;
+ wxBrush m_backgroundBrush;
+ wxColour m_textForegroundColour;
+ wxColour m_textBackgroundColour;
+ wxFont m_font;
+
+#if wxUSE_PALETTE
+ wxPalette m_palette;
+ bool m_hasCustomPalette;
+#endif // wxUSE_PALETTE
+
+private:
+ DECLARE_ABSTRACT_CLASS(wxDCImpl)
+};
+
+
+class WXDLLIMPEXP_CORE wxDC : public wxObject
+{
+public:
+ // copy attributes (font, colours and writing direction) from another DC
+ void CopyAttributes(const wxDC& dc);
+
+ virtual ~wxDC() { delete m_pimpl; }
+
+ wxDCImpl *GetImpl()
+ { return m_pimpl; }
+ const wxDCImpl *GetImpl() const
+ { return m_pimpl; }
+
+ wxWindow *GetWindow() const
+ { return m_pimpl->GetWindow(); }
+
+ void *GetHandle() const
+ { return m_pimpl->GetHandle(); }
+
+ bool IsOk() const
+ { return m_pimpl && m_pimpl->IsOk(); }
+
+ // query capabilities
+
+ bool CanDrawBitmap() const
+ { return m_pimpl->CanDrawBitmap(); }
+ bool CanGetTextExtent() const
+ { return m_pimpl->CanGetTextExtent(); }
+
+ // query dimension, colour deps, resolution
+
+ void GetSize(int *width, int *height) const
+ { m_pimpl->DoGetSize(width, height); }
+ wxSize GetSize() const
+ { return m_pimpl->GetSize(); }
+
+ void GetSizeMM(int* width, int* height) const
+ { m_pimpl->DoGetSizeMM(width, height); }
+ wxSize GetSizeMM() const
+ {
+ int w, h;
+ m_pimpl->DoGetSizeMM(&w, &h);
+ return wxSize(w, h);
+ }
+
+ int GetDepth() const
+ { return m_pimpl->GetDepth(); }
+ wxSize GetPPI() const
+ { return m_pimpl->GetPPI(); }
+
+ virtual int GetResolution() const
+ { return m_pimpl->GetResolution(); }
+
+ double GetContentScaleFactor() const
+ { return m_pimpl->GetContentScaleFactor(); }
+
+ // Right-To-Left (RTL) modes
+
+ void SetLayoutDirection(wxLayoutDirection dir)
+ { m_pimpl->SetLayoutDirection( dir ); }
+ wxLayoutDirection GetLayoutDirection() const
+ { return m_pimpl->GetLayoutDirection(); }
+
+ // page and document
+
+ bool StartDoc(const wxString& message)
+ { return m_pimpl->StartDoc(message); }
+ void EndDoc()
+ { m_pimpl->EndDoc(); }
+
+ void StartPage()
+ { m_pimpl->StartPage(); }
+ void EndPage()
+ { m_pimpl->EndPage(); }
+
+ // bounding box
+
+ void CalcBoundingBox(wxCoord x, wxCoord y)
+ { m_pimpl->CalcBoundingBox(x,y); }
+ void ResetBoundingBox()
+ { m_pimpl->ResetBoundingBox(); }
+
+ wxCoord MinX() const
+ { return m_pimpl->MinX(); }
+ wxCoord MaxX() const
+ { return m_pimpl->MaxX(); }
+ wxCoord MinY() const
+ { return m_pimpl->MinY(); }
+ wxCoord MaxY() const
+ { return m_pimpl->MaxY(); }
+
+ // setters and getters
+
+ void SetFont(const wxFont& font)
+ { m_pimpl->SetFont( font ); }
+ const wxFont& GetFont() const
+ { return m_pimpl->GetFont(); }
+
+ void SetPen(const wxPen& pen)
+ { m_pimpl->SetPen( pen ); }
+ const wxPen& GetPen() const
+ { return m_pimpl->GetPen(); }
+
+ void SetBrush(const wxBrush& brush)
+ { m_pimpl->SetBrush( brush ); }
+ const wxBrush& GetBrush() const
+ { return m_pimpl->GetBrush(); }
+
+ void SetBackground(const wxBrush& brush)
+ { m_pimpl->SetBackground( brush ); }
+ const wxBrush& GetBackground() const
+ { return m_pimpl->GetBackground(); }
+
+ void SetBackgroundMode(int mode)
+ { m_pimpl->SetBackgroundMode( mode ); }
+ int GetBackgroundMode() const
+ { return m_pimpl->GetBackgroundMode(); }
+
+ void SetTextForeground(const wxColour& colour)
+ { m_pimpl->SetTextForeground(colour); }
+ const wxColour& GetTextForeground() const
+ { return m_pimpl->GetTextForeground(); }
+
+ void SetTextBackground(const wxColour& colour)
+ { m_pimpl->SetTextBackground(colour); }
+ const wxColour& GetTextBackground() const
+ { return m_pimpl->GetTextBackground(); }
+
+#if wxUSE_PALETTE
+ void SetPalette(const wxPalette& palette)
+ { m_pimpl->SetPalette(palette); }
+#endif // wxUSE_PALETTE
+
+ // logical functions
+
+ void SetLogicalFunction(wxRasterOperationMode function)
+ { m_pimpl->SetLogicalFunction(function); }
+ wxRasterOperationMode GetLogicalFunction() const
+ { return m_pimpl->GetLogicalFunction(); }
+
+ // text measurement
+
+ wxCoord GetCharHeight() const
+ { return m_pimpl->GetCharHeight(); }
+ wxCoord GetCharWidth() const
+ { return m_pimpl->GetCharWidth(); }
+
+ wxFontMetrics GetFontMetrics() const
+ {
+ wxFontMetrics fm;
+ m_pimpl->DoGetFontMetrics(&fm.height, &fm.ascent, &fm.descent,
+ &fm.internalLeading, &fm.externalLeading,
+ &fm.averageWidth);
+ return fm;
+ }
+
+ void GetTextExtent(const wxString& string,
+ wxCoord *x, wxCoord *y,
+ wxCoord *descent = NULL,
+ wxCoord *externalLeading = NULL,
+ const wxFont *theFont = NULL) const
+ { m_pimpl->DoGetTextExtent(string, x, y, descent, externalLeading, theFont); }
+
+ wxSize GetTextExtent(const wxString& string) const
+ {
+ wxCoord w, h;
+ m_pimpl->DoGetTextExtent(string, &w, &h);
+ return wxSize(w, h);
+ }
+
+ void GetMultiLineTextExtent(const wxString& string,
+ wxCoord *width,
+ wxCoord *height,
+ wxCoord *heightLine = NULL,
+ const wxFont *font = NULL) const
+ { m_pimpl->GetMultiLineTextExtent( string, width, height, heightLine, font ); }
+
+ wxSize GetMultiLineTextExtent(const wxString& string) const
+ {
+ wxCoord w, h;
+ m_pimpl->GetMultiLineTextExtent(string, &w, &h);
+ return wxSize(w, h);
+ }
+
+ bool GetPartialTextExtents(const wxString& text, wxArrayInt& widths) const
+ { return m_pimpl->DoGetPartialTextExtents(text, widths); }
+
+ // clearing
+
+ void Clear()
+ { m_pimpl->Clear(); }
+
+ // clipping
+
+ void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+ { m_pimpl->DoSetClippingRegion(x, y, width, height); }
+ void SetClippingRegion(const wxPoint& pt, const wxSize& sz)
+ { m_pimpl->DoSetClippingRegion(pt.x, pt.y, sz.x, sz.y); }
+ void SetClippingRegion(const wxRect& rect)
+ { m_pimpl->DoSetClippingRegion(rect.x, rect.y, rect.width, rect.height); }
+
+ // unlike the functions above, the coordinates of the region used in this
+ // one are in device coordinates, not the logical ones
+ void SetDeviceClippingRegion(const wxRegion& region)
+ { m_pimpl->DoSetDeviceClippingRegion(region); }
+
+ // this function is deprecated because its name is confusing: you may
+ // expect it to work with logical coordinates but, in fact, it does exactly
+ // the same thing as SetDeviceClippingRegion()
+ //
+ // please review the code using it and either replace it with calls to
+ // SetDeviceClippingRegion() or correct it if it was [wrongly] passing
+ // logical coordinates to this function
+ wxDEPRECATED_INLINE(void SetClippingRegion(const wxRegion& region),
+ SetDeviceClippingRegion(region); )
+
+ void DestroyClippingRegion()
+ { m_pimpl->DestroyClippingRegion(); }
+
+ void GetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const
+ { m_pimpl->DoGetClippingBox(x, y, w, h); }
+ void GetClippingBox(wxRect& rect) const
+ { m_pimpl->DoGetClippingBox(&rect.x, &rect.y, &rect.width, &rect.height); }
+
+ // coordinates conversions and transforms
+
+ wxCoord DeviceToLogicalX(wxCoord x) const
+ { return m_pimpl->DeviceToLogicalX(x); }
+ wxCoord DeviceToLogicalY(wxCoord y) const
+ { return m_pimpl->DeviceToLogicalY(y); }
+ wxCoord DeviceToLogicalXRel(wxCoord x) const
+ { return m_pimpl->DeviceToLogicalXRel(x); }
+ wxCoord DeviceToLogicalYRel(wxCoord y) const
+ { return m_pimpl->DeviceToLogicalYRel(y); }
+ wxCoord LogicalToDeviceX(wxCoord x) const
+ { return m_pimpl->LogicalToDeviceX(x); }
+ wxCoord LogicalToDeviceY(wxCoord y) const
+ { return m_pimpl->LogicalToDeviceY(y); }
+ wxCoord LogicalToDeviceXRel(wxCoord x) const
+ { return m_pimpl->LogicalToDeviceXRel(x); }
+ wxCoord LogicalToDeviceYRel(wxCoord y) const
+ { return m_pimpl->LogicalToDeviceYRel(y); }
+
+ void SetMapMode(wxMappingMode mode)
+ { m_pimpl->SetMapMode(mode); }
+ wxMappingMode GetMapMode() const
+ { return m_pimpl->GetMapMode(); }
+
+ void SetUserScale(double x, double y)
+ { m_pimpl->SetUserScale(x,y); }
+ void GetUserScale(double *x, double *y) const
+ { m_pimpl->GetUserScale( x, y ); }
+
+ void SetLogicalScale(double x, double y)
+ { m_pimpl->SetLogicalScale( x, y ); }
+ void GetLogicalScale(double *x, double *y) const
+ { m_pimpl->GetLogicalScale( x, y ); }
+
+ void SetLogicalOrigin(wxCoord x, wxCoord y)
+ { m_pimpl->SetLogicalOrigin(x,y); }
+ void GetLogicalOrigin(wxCoord *x, wxCoord *y) const
+ { m_pimpl->DoGetLogicalOrigin(x, y); }
+ wxPoint GetLogicalOrigin() const
+ { wxCoord x, y; m_pimpl->DoGetLogicalOrigin(&x, &y); return wxPoint(x, y); }
+
+ void SetDeviceOrigin(wxCoord x, wxCoord y)
+ { m_pimpl->SetDeviceOrigin( x, y); }
+ void GetDeviceOrigin(wxCoord *x, wxCoord *y) const
+ { m_pimpl->DoGetDeviceOrigin(x, y); }
+ wxPoint GetDeviceOrigin() const
+ { wxCoord x, y; m_pimpl->DoGetDeviceOrigin(&x, &y); return wxPoint(x, y); }
+
+ void SetAxisOrientation(bool xLeftRight, bool yBottomUp)
+ { m_pimpl->SetAxisOrientation(xLeftRight, yBottomUp); }
+
+#if wxUSE_DC_TRANSFORM_MATRIX
+ bool CanUseTransformMatrix() const
+ { return m_pimpl->CanUseTransformMatrix(); }
+
+ bool SetTransformMatrix(const wxAffineMatrix2D &matrix)
+ { return m_pimpl->SetTransformMatrix(matrix); }
+
+ wxAffineMatrix2D GetTransformMatrix() const
+ { return m_pimpl->GetTransformMatrix(); }
+
+ void ResetTransformMatrix()
+ { m_pimpl->ResetTransformMatrix(); }
+#endif // wxUSE_DC_TRANSFORM_MATRIX
+
+ // mostly internal
+ void SetDeviceLocalOrigin( wxCoord x, wxCoord y )
+ { m_pimpl->SetDeviceLocalOrigin( x, y ); }
+
+
+ // -----------------------------------------------
+ // the actual drawing API
+
+ bool FloodFill(wxCoord x, wxCoord y, const wxColour& col,
+ wxFloodFillStyle style = wxFLOOD_SURFACE)
+ { return m_pimpl->DoFloodFill(x, y, col, style); }
+ bool FloodFill(const wxPoint& pt, const wxColour& col,
+ wxFloodFillStyle style = wxFLOOD_SURFACE)
+ { return m_pimpl->DoFloodFill(pt.x, pt.y, col, style); }
+
+ // fill the area specified by rect with a radial gradient, starting from
+ // initialColour in the centre of the cercle and fading to destColour.
+ void GradientFillConcentric(const wxRect& rect,
+ const wxColour& initialColour,
+ const wxColour& destColour)
+ { m_pimpl->DoGradientFillConcentric( rect, initialColour, destColour,
+ wxPoint(rect.GetWidth() / 2,
+ rect.GetHeight() / 2)); }
+
+ void GradientFillConcentric(const wxRect& rect,
+ const wxColour& initialColour,
+ const wxColour& destColour,
+ const wxPoint& circleCenter)
+ { m_pimpl->DoGradientFillConcentric(rect, initialColour, destColour, circleCenter); }
+
+ // fill the area specified by rect with a linear gradient
+ void GradientFillLinear(const wxRect& rect,
+ const wxColour& initialColour,
+ const wxColour& destColour,
+ wxDirection nDirection = wxEAST)
+ { m_pimpl->DoGradientFillLinear(rect, initialColour, destColour, nDirection); }
+
+ bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const
+ { return m_pimpl->DoGetPixel(x, y, col); }
+ bool GetPixel(const wxPoint& pt, wxColour *col) const
+ { return m_pimpl->DoGetPixel(pt.x, pt.y, col); }
+
+ void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
+ { m_pimpl->DoDrawLine(x1, y1, x2, y2); }
+ void DrawLine(const wxPoint& pt1, const wxPoint& pt2)
+ { m_pimpl->DoDrawLine(pt1.x, pt1.y, pt2.x, pt2.y); }
+
+ void CrossHair(wxCoord x, wxCoord y)
+ { m_pimpl->DoCrossHair(x, y); }
+ void CrossHair(const wxPoint& pt)
+ { m_pimpl->DoCrossHair(pt.x, pt.y); }
+
+ void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
+ wxCoord xc, wxCoord yc)
+ { m_pimpl->DoDrawArc(x1, y1, x2, y2, xc, yc); }
+ void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre)
+ { m_pimpl->DoDrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y); }
+
+ void DrawCheckMark(wxCoord x, wxCoord y,
+ wxCoord width, wxCoord height)
+ { m_pimpl->DoDrawCheckMark(x, y, width, height); }
+ void DrawCheckMark(const wxRect& rect)
+ { m_pimpl->DoDrawCheckMark(rect.x, rect.y, rect.width, rect.height); }
+
+ void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
+ double sa, double ea)
+ { m_pimpl->DoDrawEllipticArc(x, y, w, h, sa, ea); }
+ void DrawEllipticArc(const wxPoint& pt, const wxSize& sz,
+ double sa, double ea)
+ { m_pimpl->DoDrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea); }
+
+ void DrawPoint(wxCoord x, wxCoord y)
+ { m_pimpl->DoDrawPoint(x, y); }
+ void DrawPoint(const wxPoint& pt)
+ { m_pimpl->DoDrawPoint(pt.x, pt.y); }
+
+ void DrawLines(int n, const wxPoint points[],
+ wxCoord xoffset = 0, wxCoord yoffset = 0)
+ { m_pimpl->DoDrawLines(n, points, xoffset, yoffset); }
+ void DrawLines(const wxPointList *list,
+ wxCoord xoffset = 0, wxCoord yoffset = 0)
+ { m_pimpl->DrawLines( list, xoffset, yoffset ); }
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED( void DrawLines(const wxList *list,
+ wxCoord xoffset = 0, wxCoord yoffset = 0) );
+#endif // WXWIN_COMPATIBILITY_2_8
+
+ void DrawPolygon(int n, const wxPoint points[],
+ wxCoord xoffset = 0, wxCoord yoffset = 0,
+ wxPolygonFillMode fillStyle = wxODDEVEN_RULE)
+ { m_pimpl->DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); }
+ void DrawPolygon(const wxPointList *list,
+ wxCoord xoffset = 0, wxCoord yoffset = 0,
+ wxPolygonFillMode fillStyle = wxODDEVEN_RULE)
+ { m_pimpl->DrawPolygon( list, xoffset, yoffset, fillStyle ); }
+ void DrawPolyPolygon(int n, const int count[], const wxPoint points[],
+ wxCoord xoffset = 0, wxCoord yoffset = 0,
+ wxPolygonFillMode fillStyle = wxODDEVEN_RULE)
+ { m_pimpl->DoDrawPolyPolygon(n, count, points, xoffset, yoffset, fillStyle); }
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED( void DrawPolygon(const wxList *list,
+ wxCoord xoffset = 0, wxCoord yoffset = 0,
+ wxPolygonFillMode fillStyle = wxODDEVEN_RULE) );
+#endif // WXWIN_COMPATIBILITY_2_8
+
+ void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+ { m_pimpl->DoDrawRectangle(x, y, width, height); }
+ void DrawRectangle(const wxPoint& pt, const wxSize& sz)
+ { m_pimpl->DoDrawRectangle(pt.x, pt.y, sz.x, sz.y); }
+ void DrawRectangle(const wxRect& rect)
+ { m_pimpl->DoDrawRectangle(rect.x, rect.y, rect.width, rect.height); }
+
+ void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height,
+ double radius)
+ { m_pimpl->DoDrawRoundedRectangle(x, y, width, height, radius); }
+ void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz,
+ double radius)
+ { m_pimpl->DoDrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius); }
+ void DrawRoundedRectangle(const wxRect& r, double radius)
+ { m_pimpl->DoDrawRoundedRectangle(r.x, r.y, r.width, r.height, radius); }
+
+ void DrawCircle(wxCoord x, wxCoord y, wxCoord radius)
+ { m_pimpl->DoDrawEllipse(x - radius, y - radius, 2*radius, 2*radius); }
+ void DrawCircle(const wxPoint& pt, wxCoord radius)
+ { m_pimpl->DoDrawEllipse(pt.x - radius, pt.y - radius, 2*radius, 2*radius); }
+
+ void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+ { m_pimpl->DoDrawEllipse(x, y, width, height); }
+ void DrawEllipse(const wxPoint& pt, const wxSize& sz)
+ { m_pimpl->DoDrawEllipse(pt.x, pt.y, sz.x, sz.y); }
+ void DrawEllipse(const wxRect& rect)
+ { m_pimpl->DoDrawEllipse(rect.x, rect.y, rect.width, rect.height); }
+
+ void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
+ { m_pimpl->DoDrawIcon(icon, x, y); }
+ void DrawIcon(const wxIcon& icon, const wxPoint& pt)
+ { m_pimpl->DoDrawIcon(icon, pt.x, pt.y); }
+
+ void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
+ bool useMask = false)
+ { m_pimpl->DoDrawBitmap(bmp, x, y, useMask); }
+ void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt,
+ bool useMask = false)
+ { m_pimpl->DoDrawBitmap(bmp, pt.x, pt.y, useMask); }
+
+ void DrawText(const wxString& text, wxCoord x, wxCoord y)
+ { m_pimpl->DoDrawText(text, x, y); }
+ void DrawText(const wxString& text, const wxPoint& pt)
+ { m_pimpl->DoDrawText(text, pt.x, pt.y); }
+
+ void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle)
+ { m_pimpl->DoDrawRotatedText(text, x, y, angle); }
+ void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle)
+ { m_pimpl->DoDrawRotatedText(text, pt.x, pt.y, angle); }
+
+ // this version puts both optional bitmap and the text into the given
+ // rectangle and aligns is as specified by alignment parameter; it also
+ // will emphasize the character with the given index if it is != -1 and
+ // return the bounding rectangle if required
+ void DrawLabel(const wxString& text,
+ const wxBitmap& image,
+ const wxRect& rect,
+ int alignment = wxALIGN_LEFT | wxALIGN_TOP,
+ int indexAccel = -1,
+ wxRect *rectBounding = NULL);
+
+ void DrawLabel(const wxString& text, const wxRect& rect,
+ int alignment = wxALIGN_LEFT | wxALIGN_TOP,
+ int indexAccel = -1)
+ { DrawLabel(text, wxNullBitmap, rect, alignment, indexAccel); }
+
+ bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
+ wxDC *source, wxCoord xsrc, wxCoord ysrc,
+ wxRasterOperationMode rop = wxCOPY, bool useMask = false,
+ wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord)
+ {
+ return m_pimpl->DoBlit(xdest, ydest, width, height,
+ source, xsrc, ysrc, rop, useMask, xsrcMask, ysrcMask);
+ }
+ bool Blit(const wxPoint& destPt, const wxSize& sz,
+ wxDC *source, const wxPoint& srcPt,
+ wxRasterOperationMode rop = wxCOPY, bool useMask = false,
+ const wxPoint& srcPtMask = wxDefaultPosition)
+ {
+ return m_pimpl->DoBlit(destPt.x, destPt.y, sz.x, sz.y,
+ source, srcPt.x, srcPt.y, rop, useMask, srcPtMask.x, srcPtMask.y);
+ }
+
+ bool StretchBlit(wxCoord dstX, wxCoord dstY,
+ wxCoord dstWidth, wxCoord dstHeight,
+ wxDC *source,
+ wxCoord srcX, wxCoord srcY,
+ wxCoord srcWidth, wxCoord srcHeight,
+ wxRasterOperationMode rop = wxCOPY, bool useMask = false,
+ wxCoord srcMaskX = wxDefaultCoord, wxCoord srcMaskY = wxDefaultCoord)
+ {
+ return m_pimpl->DoStretchBlit(dstX, dstY, dstWidth, dstHeight,
+ source, srcX, srcY, srcWidth, srcHeight, rop, useMask, srcMaskX, srcMaskY);
+ }
+ bool StretchBlit(const wxPoint& dstPt, const wxSize& dstSize,
+ wxDC *source, const wxPoint& srcPt, const wxSize& srcSize,
+ wxRasterOperationMode rop = wxCOPY, bool useMask = false,
+ const wxPoint& srcMaskPt = wxDefaultPosition)
+ {
+ return m_pimpl->DoStretchBlit(dstPt.x, dstPt.y, dstSize.x, dstSize.y,
+ source, srcPt.x, srcPt.y, srcSize.x, srcSize.y, rop, useMask, srcMaskPt.x, srcMaskPt.y);
+ }
+
+ wxBitmap GetAsBitmap(const wxRect *subrect = (const wxRect *) NULL) const
+ {
+ return m_pimpl->DoGetAsBitmap(subrect);
+ }
+
+#if wxUSE_SPLINES
+ void DrawSpline(wxCoord x1, wxCoord y1,
+ wxCoord x2, wxCoord y2,
+ wxCoord x3, wxCoord y3)
+ { m_pimpl->DrawSpline(x1,y1,x2,y2,x3,y3); }
+ void DrawSpline(int n, const wxPoint points[])
+ { m_pimpl->DrawSpline(n,points); }
+ void DrawSpline(const wxPointList *points)
+ { m_pimpl->DrawSpline(points); }
+#endif // wxUSE_SPLINES
+
+
+#if WXWIN_COMPATIBILITY_2_8
+ // for compatibility with the old code when wxCoord was long everywhere
+ wxDEPRECATED( void GetTextExtent(const wxString& string,
+ long *x, long *y,
+ long *descent = NULL,
+ long *externalLeading = NULL,
+ const wxFont *theFont = NULL) const );
+ wxDEPRECATED( void GetLogicalOrigin(long *x, long *y) const );
+ wxDEPRECATED( void GetDeviceOrigin(long *x, long *y) const );
+ wxDEPRECATED( void GetClippingBox(long *x, long *y, long *w, long *h) const );
+
+ wxDEPRECATED( void DrawObject(wxDrawObject* drawobject) );
+#endif // WXWIN_COMPATIBILITY_2_8
+
+#ifdef __WXMSW__
+ // GetHDC() is the simplest way to retrieve an HDC From a wxDC but only
+ // works if this wxDC is GDI-based and fails for GDI+ contexts (and
+ // anything else without HDC, e.g. wxPostScriptDC)
+ WXHDC GetHDC() const;
+
+ // don't use these methods manually, use GetTempHDC() instead
+ virtual WXHDC AcquireHDC() { return GetHDC(); }
+ virtual void ReleaseHDC(WXHDC WXUNUSED(hdc)) { }
+
+ // helper class holding the result of GetTempHDC() with std::auto_ptr<>-like
+ // semantics, i.e. it is moved when copied
+ class TempHDC
+ {
+ public:
+ TempHDC(wxDC& dc)
+ : m_dc(dc),
+ m_hdc(dc.AcquireHDC())
+ {
+ }
+
+ TempHDC(const TempHDC& thdc)
+ : m_dc(thdc.m_dc),
+ m_hdc(thdc.m_hdc)
+ {
+ const_cast<TempHDC&>(thdc).m_hdc = 0;
+ }
+
+ ~TempHDC()
+ {
+ if ( m_hdc )
+ m_dc.ReleaseHDC(m_hdc);
+ }
+
+ WXHDC GetHDC() const { return m_hdc; }
+
+ private:
+ wxDC& m_dc;
+ WXHDC m_hdc;
+
+ wxDECLARE_NO_ASSIGN_CLASS(TempHDC);
+ };
+
+ // GetTempHDC() also works for wxGCDC (but still not for wxPostScriptDC &c)
+ TempHDC GetTempHDC() { return TempHDC(*this); }
+#endif // __WXMSW__
+
+#if wxUSE_GRAPHICS_CONTEXT
+ virtual wxGraphicsContext* GetGraphicsContext() const
+ {
+ return m_pimpl->GetGraphicsContext();
+ }
+ virtual void SetGraphicsContext( wxGraphicsContext* ctx )
+ {
+ m_pimpl->SetGraphicsContext(ctx);
+ }
+#endif
+
+protected:
+ // ctor takes ownership of the pointer
+ wxDC(wxDCImpl *pimpl) : m_pimpl(pimpl) { }
+
+ wxDCImpl * const m_pimpl;
+
+private:
+ DECLARE_ABSTRACT_CLASS(wxDC)
+ wxDECLARE_NO_COPY_CLASS(wxDC);
+};
+
+// ----------------------------------------------------------------------------
+// helper class: you can use it to temporarily change the DC text colour and
+// restore it automatically when the object goes out of scope
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDCTextColourChanger
+{
+public:
+ wxDCTextColourChanger(wxDC& dc) : m_dc(dc), m_colFgOld() { }
+
+ wxDCTextColourChanger(wxDC& dc, const wxColour& col) : m_dc(dc)
+ {
+ Set(col);
+ }
+
+ ~wxDCTextColourChanger()
+ {
+ if ( m_colFgOld.IsOk() )
+ m_dc.SetTextForeground(m_colFgOld);
+ }
+
+ void Set(const wxColour& col)
+ {
+ if ( !m_colFgOld.IsOk() )
+ m_colFgOld = m_dc.GetTextForeground();
+ m_dc.SetTextForeground(col);
+ }
+
+private:
+ wxDC& m_dc;
+
+ wxColour m_colFgOld;
+
+ wxDECLARE_NO_COPY_CLASS(wxDCTextColourChanger);
+};
+
+// ----------------------------------------------------------------------------
+// helper class: you can use it to temporarily change the DC pen and
+// restore it automatically when the object goes out of scope
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDCPenChanger
+{
+public:
+ wxDCPenChanger(wxDC& dc, const wxPen& pen) : m_dc(dc), m_penOld(dc.GetPen())
+ {
+ m_dc.SetPen(pen);
+ }
+
+ ~wxDCPenChanger()
+ {
+ if ( m_penOld.IsOk() )
+ m_dc.SetPen(m_penOld);
+ }
+
+private:
+ wxDC& m_dc;
+
+ wxPen m_penOld;
+
+ wxDECLARE_NO_COPY_CLASS(wxDCPenChanger);
+};
+
+// ----------------------------------------------------------------------------
+// helper class: you can use it to temporarily change the DC brush and
+// restore it automatically when the object goes out of scope
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDCBrushChanger
+{
+public:
+ wxDCBrushChanger(wxDC& dc, const wxBrush& brush) : m_dc(dc), m_brushOld(dc.GetBrush())
+ {
+ m_dc.SetBrush(brush);
+ }
+
+ ~wxDCBrushChanger()
+ {
+ if ( m_brushOld.IsOk() )
+ m_dc.SetBrush(m_brushOld);
+ }
+
+private:
+ wxDC& m_dc;
+
+ wxBrush m_brushOld;
+
+ wxDECLARE_NO_COPY_CLASS(wxDCBrushChanger);
+};
+
+// ----------------------------------------------------------------------------
+// another small helper class: sets the clipping region in its ctor and
+// destroys it in the dtor
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDCClipper
+{
+public:
+ wxDCClipper(wxDC& dc, const wxRegion& r) : m_dc(dc)
+ { dc.SetClippingRegion(r.GetBox()); }
+ wxDCClipper(wxDC& dc, const wxRect& r) : m_dc(dc)
+ { dc.SetClippingRegion(r.x, r.y, r.width, r.height); }
+ wxDCClipper(wxDC& dc, wxCoord x, wxCoord y, wxCoord w, wxCoord h) : m_dc(dc)
+ { dc.SetClippingRegion(x, y, w, h); }
+
+ ~wxDCClipper() { m_dc.DestroyClippingRegion(); }
+
+private:
+ wxDC& m_dc;
+
+ wxDECLARE_NO_COPY_CLASS(wxDCClipper);
+};
+
+// ----------------------------------------------------------------------------
+// helper class: you can use it to temporarily change the DC font and
+// restore it automatically when the object goes out of scope
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDCFontChanger
+{
+public:
+ wxDCFontChanger(wxDC& dc)
+ : m_dc(dc), m_fontOld()
+ {
+ }
+
+ wxDCFontChanger(wxDC& dc, const wxFont& font)
+ : m_dc(dc), m_fontOld(dc.GetFont())
+ {
+ m_dc.SetFont(font);
+ }
+
+ void Set(const wxFont& font)
+ {
+ if ( !m_fontOld.IsOk() )
+ m_fontOld = m_dc.GetFont();
+ m_dc.SetFont(font);
+ }
+
+ ~wxDCFontChanger()
+ {
+ if ( m_fontOld.IsOk() )
+ m_dc.SetFont(m_fontOld);
+ }
+
+private:
+ wxDC& m_dc;
+
+ wxFont m_fontOld;
+
+ wxDECLARE_NO_COPY_CLASS(wxDCFontChanger);
+};
+
+
+#endif // _WX_DC_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/dcbuffer.h
+// Purpose: wxBufferedDC class
+// Author: Ron Lee <ron@debian.org>
+// Modified by: Vadim Zeitlin (refactored, added bg preservation)
+// Created: 16/03/02
+// Copyright: (c) Ron Lee
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DCBUFFER_H_
+#define _WX_DCBUFFER_H_
+
+#include "wx/dcmemory.h"
+#include "wx/dcclient.h"
+#include "wx/window.h"
+
+// Split platforms into two groups - those which have well-working
+// double-buffering by default, and those which do not.
+#if defined(__WXMAC__) || defined(__WXGTK20__) || defined(__WXDFB__)
+ #define wxALWAYS_NATIVE_DOUBLE_BUFFER 1
+#else
+ #define wxALWAYS_NATIVE_DOUBLE_BUFFER 0
+#endif
+
+
+// ----------------------------------------------------------------------------
+// Double buffering helper.
+// ----------------------------------------------------------------------------
+
+// Assumes the buffer bitmap covers the entire scrolled window,
+// and prepares the window DC accordingly
+#define wxBUFFER_VIRTUAL_AREA 0x01
+
+// Assumes the buffer bitmap only covers the client area;
+// does not prepare the window DC
+#define wxBUFFER_CLIENT_AREA 0x02
+
+// Set when not using specific buffer bitmap. Note that this
+// is private style and not returned by GetStyle.
+#define wxBUFFER_USES_SHARED_BUFFER 0x04
+
+class WXDLLIMPEXP_CORE wxBufferedDC : public wxMemoryDC
+{
+public:
+ // Default ctor, must subsequently call Init for two stage construction.
+ wxBufferedDC()
+ : m_dc(NULL),
+ m_buffer(NULL),
+ m_style(0)
+ {
+ }
+
+ // Construct a wxBufferedDC using a user supplied buffer.
+ wxBufferedDC(wxDC *dc,
+ wxBitmap& buffer = wxNullBitmap,
+ int style = wxBUFFER_CLIENT_AREA)
+ : m_dc(NULL), m_buffer(NULL)
+ {
+ Init(dc, buffer, style);
+ }
+
+ // Construct a wxBufferedDC with an internal buffer of 'area'
+ // (where area is usually something like the size of the window
+ // being buffered)
+ wxBufferedDC(wxDC *dc, const wxSize& area, int style = wxBUFFER_CLIENT_AREA)
+ : m_dc(NULL), m_buffer(NULL)
+ {
+ Init(dc, area, style);
+ }
+
+ // The usually desired action in the dtor is to blit the buffer.
+ virtual ~wxBufferedDC()
+ {
+ if ( m_dc )
+ UnMask();
+ }
+
+ // These reimplement the actions of the ctors for two stage creation
+ void Init(wxDC *dc,
+ wxBitmap& buffer = wxNullBitmap,
+ int style = wxBUFFER_CLIENT_AREA)
+ {
+ InitCommon(dc, style);
+
+ m_buffer = &buffer;
+
+ UseBuffer();
+ }
+
+ void Init(wxDC *dc, const wxSize &area, int style = wxBUFFER_CLIENT_AREA)
+ {
+ InitCommon(dc, style);
+
+ UseBuffer(area.x, area.y);
+ }
+
+ // Blits the buffer to the dc, and detaches the dc from the buffer (so it
+ // can be effectively used once only).
+ //
+ // Usually called in the dtor or by the dtor of derived classes if the
+ // BufferedDC must blit before the derived class (which may own the dc it's
+ // blitting to) is destroyed.
+ void UnMask();
+
+ // Set and get the style
+ void SetStyle(int style) { m_style = style; }
+ int GetStyle() const { return m_style & ~wxBUFFER_USES_SHARED_BUFFER; }
+
+private:
+ // common part of Init()s
+ void InitCommon(wxDC *dc, int style)
+ {
+ wxASSERT_MSG( !m_dc, wxT("wxBufferedDC already initialised") );
+
+ m_dc = dc;
+ m_style = style;
+ }
+
+ // check that the bitmap is valid and use it
+ void UseBuffer(wxCoord w = -1, wxCoord h = -1);
+
+ // the underlying DC to which we copy everything drawn on this one in
+ // UnMask()
+ //
+ // NB: Without the existence of a wxNullDC, this must be a pointer, else it
+ // could probably be a reference.
+ wxDC *m_dc;
+
+ // the buffer (selected in this DC), initially invalid
+ wxBitmap *m_buffer;
+
+ // the buffering style
+ int m_style;
+
+ wxSize m_area;
+
+ DECLARE_DYNAMIC_CLASS(wxBufferedDC)
+ wxDECLARE_NO_COPY_CLASS(wxBufferedDC);
+};
+
+
+// ----------------------------------------------------------------------------
+// Double buffered PaintDC.
+// ----------------------------------------------------------------------------
+
+// Creates a double buffered wxPaintDC, optionally allowing the
+// user to specify their own buffer to use.
+class WXDLLIMPEXP_CORE wxBufferedPaintDC : public wxBufferedDC
+{
+public:
+ // If no bitmap is supplied by the user, a temporary one will be created.
+ wxBufferedPaintDC(wxWindow *window, wxBitmap& buffer, int style = wxBUFFER_CLIENT_AREA)
+ : m_paintdc(window)
+ {
+ // If we're buffering the virtual window, scale the paint DC as well
+ if (style & wxBUFFER_VIRTUAL_AREA)
+ window->PrepareDC( m_paintdc );
+
+ if( buffer.IsOk() )
+ Init(&m_paintdc, buffer, style);
+ else
+ Init(&m_paintdc, GetBufferedSize(window, style), style);
+ }
+
+ // If no bitmap is supplied by the user, a temporary one will be created.
+ wxBufferedPaintDC(wxWindow *window, int style = wxBUFFER_CLIENT_AREA)
+ : m_paintdc(window)
+ {
+ // If we're using the virtual window, scale the paint DC as well
+ if (style & wxBUFFER_VIRTUAL_AREA)
+ window->PrepareDC( m_paintdc );
+
+ Init(&m_paintdc, GetBufferedSize(window, style), style);
+ }
+
+ // default copy ctor ok.
+
+ virtual ~wxBufferedPaintDC()
+ {
+ // We must UnMask here, else by the time the base class
+ // does it, the PaintDC will have already been destroyed.
+ UnMask();
+ }
+
+protected:
+ // return the size needed by the buffer: this depends on whether we're
+ // buffering just the currently shown part or the total (scrolled) window
+ static wxSize GetBufferedSize(wxWindow *window, int style)
+ {
+ return style & wxBUFFER_VIRTUAL_AREA ? window->GetVirtualSize()
+ : window->GetClientSize();
+ }
+
+private:
+ wxPaintDC m_paintdc;
+
+ DECLARE_ABSTRACT_CLASS(wxBufferedPaintDC)
+ wxDECLARE_NO_COPY_CLASS(wxBufferedPaintDC);
+};
+
+
+
+//
+// wxAutoBufferedPaintDC is a wxPaintDC in toolkits which have double-
+// buffering by default. Otherwise it is a wxBufferedPaintDC. Thus,
+// you can only expect it work with a simple constructor that
+// accepts single wxWindow* argument.
+//
+#if wxALWAYS_NATIVE_DOUBLE_BUFFER
+ #define wxAutoBufferedPaintDCBase wxPaintDC
+#else
+ #define wxAutoBufferedPaintDCBase wxBufferedPaintDC
+#endif
+
+class WXDLLIMPEXP_CORE wxAutoBufferedPaintDC : public wxAutoBufferedPaintDCBase
+{
+public:
+
+ wxAutoBufferedPaintDC(wxWindow* win)
+ : wxAutoBufferedPaintDCBase(win)
+ {
+ wxASSERT_MSG( win->GetBackgroundStyle() == wxBG_STYLE_PAINT,
+ "You need to call SetBackgroundStyle(wxBG_STYLE_PAINT) in ctor, "
+ "and also, if needed, paint the background in wxEVT_PAINT handler."
+ );
+ }
+
+ virtual ~wxAutoBufferedPaintDC() { }
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxAutoBufferedPaintDC);
+};
+
+
+
+// Check if the window is natively double buffered and will return a wxPaintDC
+// if it is, a wxBufferedPaintDC otherwise. It is the caller's responsibility
+// to delete the wxDC pointer when finished with it.
+inline wxDC* wxAutoBufferedPaintDCFactory(wxWindow* window)
+{
+ if ( window->IsDoubleBuffered() )
+ return new wxPaintDC(window);
+ else
+ return new wxBufferedPaintDC(window);
+}
+
+#endif // _WX_DCBUFFER_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/dcclient.h
+// Purpose: wxClientDC base header
+// Author: Julian Smart
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DCCLIENT_H_BASE_
+#define _WX_DCCLIENT_H_BASE_
+
+#include "wx/dc.h"
+
+//-----------------------------------------------------------------------------
+// wxWindowDC
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxWindowDC : public wxDC
+{
+public:
+ wxWindowDC(wxWindow *win);
+
+protected:
+ wxWindowDC(wxDCImpl *impl) : wxDC(impl) { }
+
+private:
+ DECLARE_ABSTRACT_CLASS(wxWindowDC)
+};
+
+//-----------------------------------------------------------------------------
+// wxClientDC
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxClientDC : public wxWindowDC
+{
+public:
+ wxClientDC(wxWindow *win);
+
+protected:
+ wxClientDC(wxDCImpl *impl) : wxWindowDC(impl) { }
+
+private:
+ DECLARE_ABSTRACT_CLASS(wxClientDC)
+};
+
+//-----------------------------------------------------------------------------
+// wxPaintDC
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPaintDC : public wxClientDC
+{
+public:
+ wxPaintDC(wxWindow *win);
+
+protected:
+ wxPaintDC(wxDCImpl *impl) : wxClientDC(impl) { }
+
+private:
+ DECLARE_ABSTRACT_CLASS(wxPaintDC)
+};
+
+#endif // _WX_DCCLIENT_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/dcgraph.h
+// Purpose: graphics context device bridge header
+// Author: Stefan Csomor
+// Modified by:
+// Created:
+// Copyright: (c) Stefan Csomor
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GRAPHICS_DC_H_
+#define _WX_GRAPHICS_DC_H_
+
+#if wxUSE_GRAPHICS_CONTEXT
+
+#include "wx/dc.h"
+#include "wx/geometry.h"
+#include "wx/graphics.h"
+
+class WXDLLIMPEXP_FWD_CORE wxWindowDC;
+
+
+class WXDLLIMPEXP_CORE wxGCDC: public wxDC
+{
+public:
+ wxGCDC( const wxWindowDC& dc );
+ wxGCDC( const wxMemoryDC& dc );
+#if wxUSE_PRINTING_ARCHITECTURE
+ wxGCDC( const wxPrinterDC& dc );
+#endif
+#if defined(__WXMSW__) && wxUSE_ENH_METAFILE
+ wxGCDC( const wxEnhMetaFileDC& dc );
+#endif
+ wxGCDC(wxGraphicsContext* context);
+
+ wxGCDC();
+ virtual ~wxGCDC();
+
+ wxGraphicsContext* GetGraphicsContext() const;
+ void SetGraphicsContext( wxGraphicsContext* ctx );
+
+#ifdef __WXMSW__
+ // override wxDC virtual functions to provide access to HDC associated with
+ // this Graphics object (implemented in src/msw/graphics.cpp)
+ virtual WXHDC AcquireHDC();
+ virtual void ReleaseHDC(WXHDC hdc);
+#endif // __WXMSW__
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxGCDC)
+ wxDECLARE_NO_COPY_CLASS(wxGCDC);
+};
+
+
+class WXDLLIMPEXP_CORE wxGCDCImpl: public wxDCImpl
+{
+public:
+ wxGCDCImpl( wxDC *owner, const wxWindowDC& dc );
+ wxGCDCImpl( wxDC *owner, const wxMemoryDC& dc );
+#if wxUSE_PRINTING_ARCHITECTURE
+ wxGCDCImpl( wxDC *owner, const wxPrinterDC& dc );
+#endif
+#if defined(__WXMSW__) && wxUSE_ENH_METAFILE
+ wxGCDCImpl( wxDC *owner, const wxEnhMetaFileDC& dc );
+#endif
+ wxGCDCImpl( wxDC *owner );
+
+ virtual ~wxGCDCImpl();
+
+ // implement base class pure virtuals
+ // ----------------------------------
+
+ virtual void Clear();
+
+ virtual bool StartDoc( const wxString& message );
+ virtual void EndDoc();
+
+ virtual void StartPage();
+ virtual void EndPage();
+
+ // flushing the content of this dc immediately onto screen
+ virtual void Flush();
+
+ virtual void SetFont(const wxFont& font);
+ virtual void SetPen(const wxPen& pen);
+ virtual void SetBrush(const wxBrush& brush);
+ virtual void SetBackground(const wxBrush& brush);
+ virtual void SetBackgroundMode(int mode);
+ virtual void SetPalette(const wxPalette& palette);
+
+ virtual void DestroyClippingRegion();
+
+ virtual wxCoord GetCharHeight() const;
+ virtual wxCoord GetCharWidth() const;
+
+ virtual bool CanDrawBitmap() const;
+ virtual bool CanGetTextExtent() const;
+ virtual int GetDepth() const;
+ virtual wxSize GetPPI() const;
+
+ virtual void SetLogicalFunction(wxRasterOperationMode function);
+
+ virtual void SetTextForeground(const wxColour& colour);
+ virtual void SetTextBackground(const wxColour& colour);
+
+ virtual void ComputeScaleAndOrigin();
+
+ wxGraphicsContext* GetGraphicsContext() const { return m_graphicContext; }
+ virtual void SetGraphicsContext( wxGraphicsContext* ctx );
+
+ virtual void* GetHandle() const;
+
+ // the true implementations
+ virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
+ wxFloodFillStyle style = wxFLOOD_SURFACE);
+
+ virtual void DoGradientFillLinear(const wxRect& rect,
+ const wxColour& initialColour,
+ const wxColour& destColour,
+ wxDirection nDirection = wxEAST);
+
+ virtual void DoGradientFillConcentric(const wxRect& rect,
+ const wxColour& initialColour,
+ const wxColour& destColour,
+ const wxPoint& circleCenter);
+
+ virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const;
+
+ virtual void DoDrawPoint(wxCoord x, wxCoord y);
+
+#if wxUSE_SPLINES
+ virtual void DoDrawSpline(const wxPointList *points);
+#endif
+
+ virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
+
+ virtual void DoDrawArc(wxCoord x1, wxCoord y1,
+ wxCoord x2, wxCoord y2,
+ wxCoord xc, wxCoord yc);
+
+ virtual void DoDrawCheckMark(wxCoord x, wxCoord y,
+ wxCoord width, wxCoord height);
+
+ virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
+ double sa, double ea);
+
+ virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
+ virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
+ wxCoord width, wxCoord height,
+ double radius);
+ virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
+
+ virtual void DoCrossHair(wxCoord x, wxCoord y);
+
+ virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
+ virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
+ bool useMask = false);
+
+ virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
+ virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
+ double angle);
+
+ virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
+ wxDC *source, wxCoord xsrc, wxCoord ysrc,
+ wxRasterOperationMode rop = wxCOPY, bool useMask = false,
+ wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
+
+ virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest,
+ wxCoord dstWidth, wxCoord dstHeight,
+ wxDC *source,
+ wxCoord xsrc, wxCoord ysrc,
+ wxCoord srcWidth, wxCoord srcHeight,
+ wxRasterOperationMode = wxCOPY, bool useMask = false,
+ wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
+
+ virtual void DoGetSize(int *,int *) const;
+ virtual void DoGetSizeMM(int* width, int* height) const;
+
+ virtual void DoDrawLines(int n, const wxPoint points[],
+ wxCoord xoffset, wxCoord yoffset);
+ virtual void DoDrawPolygon(int n, const wxPoint points[],
+ wxCoord xoffset, wxCoord yoffset,
+ wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
+ virtual void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[],
+ wxCoord xoffset, wxCoord yoffset,
+ wxPolygonFillMode fillStyle);
+
+ virtual void DoSetDeviceClippingRegion(const wxRegion& region);
+ virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
+ wxCoord width, wxCoord height);
+
+ virtual void DoGetTextExtent(const wxString& string,
+ wxCoord *x, wxCoord *y,
+ wxCoord *descent = NULL,
+ wxCoord *externalLeading = NULL,
+ const wxFont *theFont = NULL) const;
+
+ virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const;
+
+#ifdef __WXMSW__
+ virtual wxRect MSWApplyGDIPlusTransform(const wxRect& r) const;
+#endif // __WXMSW__
+
+protected:
+ // unused int parameter distinguishes this version, which does not create a
+ // wxGraphicsContext, in the expectation that the derived class will do it
+ wxGCDCImpl(wxDC* owner, int);
+
+ // scaling variables
+ bool m_logicalFunctionSupported;
+ wxGraphicsMatrix m_matrixOriginal;
+ wxGraphicsMatrix m_matrixCurrent;
+
+ double m_formerScaleX, m_formerScaleY;
+
+ wxGraphicsContext* m_graphicContext;
+
+private:
+ void Init(wxGraphicsContext*);
+
+ DECLARE_CLASS(wxGCDCImpl)
+ wxDECLARE_NO_COPY_CLASS(wxGCDCImpl);
+};
+
+#endif // wxUSE_GRAPHICS_CONTEXT
+#endif // _WX_GRAPHICS_DC_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/dcmemory.h
+// Purpose: wxMemoryDC base header
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DCMEMORY_H_BASE_
+#define _WX_DCMEMORY_H_BASE_
+
+#include "wx/dc.h"
+#include "wx/bitmap.h"
+
+//-----------------------------------------------------------------------------
+// wxMemoryDC
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxMemoryDC: public wxDC
+{
+public:
+ wxMemoryDC();
+ wxMemoryDC( wxBitmap& bitmap );
+ wxMemoryDC( wxDC *dc );
+
+ // select the given bitmap to draw on it
+ void SelectObject(wxBitmap& bmp);
+
+ // select the given bitmap for read-only
+ void SelectObjectAsSource(const wxBitmap& bmp);
+
+ // get selected bitmap
+ const wxBitmap& GetSelectedBitmap() const;
+ wxBitmap& GetSelectedBitmap();
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxMemoryDC)
+};
+
+
+#endif
+ // _WX_DCMEMORY_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/dcmirror.h
+// Purpose: wxMirrorDC class
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 21.07.2003
+// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DCMIRROR_H_
+#define _WX_DCMIRROR_H_
+
+#include "wx/dc.h"
+
+// ----------------------------------------------------------------------------
+// wxMirrorDC allows to write the same code for horz/vertical layout
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxMirrorDCImpl : public wxDCImpl
+{
+public:
+ // constructs a mirror DC associated with the given real DC
+ //
+ // if mirror parameter is true, all vertical and horizontal coordinates are
+ // exchanged, otherwise this class behaves in exactly the same way as a
+ // plain DC
+ wxMirrorDCImpl(wxDC *owner, wxDCImpl& dc, bool mirror)
+ : wxDCImpl(owner),
+ m_dc(dc)
+ {
+ m_mirror = mirror;
+ }
+
+ // wxDCBase operations
+ virtual void Clear() { m_dc.Clear(); }
+ virtual void SetFont(const wxFont& font) { m_dc.SetFont(font); }
+ virtual void SetPen(const wxPen& pen) { m_dc.SetPen(pen); }
+ virtual void SetBrush(const wxBrush& brush) { m_dc.SetBrush(brush); }
+ virtual void SetBackground(const wxBrush& brush)
+ { m_dc.SetBackground(brush); }
+ virtual void SetBackgroundMode(int mode) { m_dc.SetBackgroundMode(mode); }
+#if wxUSE_PALETTE
+ virtual void SetPalette(const wxPalette& palette)
+ { m_dc.SetPalette(palette); }
+#endif // wxUSE_PALETTE
+ virtual void DestroyClippingRegion() { m_dc.DestroyClippingRegion(); }
+ virtual wxCoord GetCharHeight() const { return m_dc.GetCharHeight(); }
+ virtual wxCoord GetCharWidth() const { return m_dc.GetCharWidth(); }
+ virtual bool CanDrawBitmap() const { return m_dc.CanDrawBitmap(); }
+ virtual bool CanGetTextExtent() const { return m_dc.CanGetTextExtent(); }
+ virtual int GetDepth() const { return m_dc.GetDepth(); }
+ virtual wxSize GetPPI() const { return m_dc.GetPPI(); }
+ virtual bool IsOk() const { return m_dc.IsOk(); }
+ virtual void SetMapMode(wxMappingMode mode) { m_dc.SetMapMode(mode); }
+ virtual void SetUserScale(double x, double y)
+ { m_dc.SetUserScale(GetX(x, y), GetY(x, y)); }
+ virtual void SetLogicalOrigin(wxCoord x, wxCoord y)
+ { m_dc.SetLogicalOrigin(GetX(x, y), GetY(x, y)); }
+ virtual void SetDeviceOrigin(wxCoord x, wxCoord y)
+ { m_dc.SetDeviceOrigin(GetX(x, y), GetY(x, y)); }
+ virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp)
+ { m_dc.SetAxisOrientation(GetX(xLeftRight, yBottomUp),
+ GetY(xLeftRight, yBottomUp)); }
+ virtual void SetLogicalFunction(wxRasterOperationMode function)
+ { m_dc.SetLogicalFunction(function); }
+
+ virtual void* GetHandle() const
+ { return m_dc.GetHandle(); }
+
+protected:
+ // returns x and y if not mirroring or y and x if mirroring
+ wxCoord GetX(wxCoord x, wxCoord y) const { return m_mirror ? y : x; }
+ wxCoord GetY(wxCoord x, wxCoord y) const { return m_mirror ? x : y; }
+ double GetX(double x, double y) const { return m_mirror ? y : x; }
+ double GetY(double x, double y) const { return m_mirror ? x : y; }
+ bool GetX(bool x, bool y) const { return m_mirror ? y : x; }
+ bool GetY(bool x, bool y) const { return m_mirror ? x : y; }
+
+ // same thing but for pointers
+ wxCoord *GetX(wxCoord *x, wxCoord *y) const { return m_mirror ? y : x; }
+ wxCoord *GetY(wxCoord *x, wxCoord *y) const { return m_mirror ? x : y; }
+
+ // exchange x and y components of all points in the array if necessary
+ wxPoint* Mirror(int n, const wxPoint*& points) const
+ {
+ wxPoint* points_alloc = NULL;
+ if ( m_mirror )
+ {
+ points_alloc = new wxPoint[n];
+ for ( int i = 0; i < n; i++ )
+ {
+ points_alloc[i].x = points[i].y;
+ points_alloc[i].y = points[i].x;
+ }
+ points = points_alloc;
+ }
+ return points_alloc;
+ }
+
+ // wxDCBase functions
+ virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
+ wxFloodFillStyle style = wxFLOOD_SURFACE)
+ {
+ return m_dc.DoFloodFill(GetX(x, y), GetY(x, y), col, style);
+ }
+
+ virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const
+ {
+ return m_dc.DoGetPixel(GetX(x, y), GetY(x, y), col);
+ }
+
+
+ virtual void DoDrawPoint(wxCoord x, wxCoord y)
+ {
+ m_dc.DoDrawPoint(GetX(x, y), GetY(x, y));
+ }
+
+ virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
+ {
+ m_dc.DoDrawLine(GetX(x1, y1), GetY(x1, y1), GetX(x2, y2), GetY(x2, y2));
+ }
+
+ virtual void DoDrawArc(wxCoord x1, wxCoord y1,
+ wxCoord x2, wxCoord y2,
+ wxCoord xc, wxCoord yc)
+ {
+ wxFAIL_MSG( wxT("this is probably wrong") );
+
+ m_dc.DoDrawArc(GetX(x1, y1), GetY(x1, y1),
+ GetX(x2, y2), GetY(x2, y2),
+ xc, yc);
+ }
+
+ virtual void DoDrawCheckMark(wxCoord x, wxCoord y,
+ wxCoord w, wxCoord h)
+ {
+ m_dc.DoDrawCheckMark(GetX(x, y), GetY(x, y),
+ GetX(w, h), GetY(w, h));
+ }
+
+ virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
+ double sa, double ea)
+ {
+ wxFAIL_MSG( wxT("this is probably wrong") );
+
+ m_dc.DoDrawEllipticArc(GetX(x, y), GetY(x, y),
+ GetX(w, h), GetY(w, h),
+ sa, ea);
+ }
+
+ virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
+ {
+ m_dc.DoDrawRectangle(GetX(x, y), GetY(x, y), GetX(w, h), GetY(w, h));
+ }
+
+ virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
+ wxCoord w, wxCoord h,
+ double radius)
+ {
+ m_dc.DoDrawRoundedRectangle(GetX(x, y), GetY(x, y),
+ GetX(w, h), GetY(w, h),
+ radius);
+ }
+
+ virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
+ {
+ m_dc.DoDrawEllipse(GetX(x, y), GetY(x, y), GetX(w, h), GetY(w, h));
+ }
+
+ virtual void DoCrossHair(wxCoord x, wxCoord y)
+ {
+ m_dc.DoCrossHair(GetX(x, y), GetY(x, y));
+ }
+
+ virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
+ {
+ m_dc.DoDrawIcon(icon, GetX(x, y), GetY(x, y));
+ }
+
+ virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
+ bool useMask = false)
+ {
+ m_dc.DoDrawBitmap(bmp, GetX(x, y), GetY(x, y), useMask);
+ }
+
+ virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y)
+ {
+ // this is never mirrored
+ m_dc.DoDrawText(text, x, y);
+ }
+
+ virtual void DoDrawRotatedText(const wxString& text,
+ wxCoord x, wxCoord y, double angle)
+ {
+ // this is never mirrored
+ m_dc.DoDrawRotatedText(text, x, y, angle);
+ }
+
+ virtual bool DoBlit(wxCoord xdest, wxCoord ydest,
+ wxCoord w, wxCoord h,
+ wxDC *source, wxCoord xsrc, wxCoord ysrc,
+ wxRasterOperationMode rop = wxCOPY,
+ bool useMask = false,
+ wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord)
+ {
+ return m_dc.DoBlit(GetX(xdest, ydest), GetY(xdest, ydest),
+ GetX(w, h), GetY(w, h),
+ source, GetX(xsrc, ysrc), GetY(xsrc, ysrc),
+ rop, useMask,
+ GetX(xsrcMask, ysrcMask), GetX(xsrcMask, ysrcMask));
+ }
+
+ virtual void DoGetSize(int *w, int *h) const
+ {
+ m_dc.DoGetSize(GetX(w, h), GetY(w, h));
+ }
+
+ virtual void DoGetSizeMM(int *w, int *h) const
+ {
+ m_dc.DoGetSizeMM(GetX(w, h), GetY(w, h));
+ }
+
+ virtual void DoDrawLines(int n, const wxPoint points[],
+ wxCoord xoffset, wxCoord yoffset)
+ {
+ wxPoint* points_alloc = Mirror(n, points);
+
+ m_dc.DoDrawLines(n, points,
+ GetX(xoffset, yoffset), GetY(xoffset, yoffset));
+
+ delete[] points_alloc;
+ }
+
+ virtual void DoDrawPolygon(int n, const wxPoint points[],
+ wxCoord xoffset, wxCoord yoffset,
+ wxPolygonFillMode fillStyle = wxODDEVEN_RULE)
+ {
+ wxPoint* points_alloc = Mirror(n, points);
+
+ m_dc.DoDrawPolygon(n, points,
+ GetX(xoffset, yoffset), GetY(xoffset, yoffset),
+ fillStyle);
+
+ delete[] points_alloc;
+ }
+
+ virtual void DoSetDeviceClippingRegion(const wxRegion& WXUNUSED(region))
+ {
+ wxFAIL_MSG( wxT("not implemented") );
+ }
+
+ virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
+ wxCoord w, wxCoord h)
+ {
+ m_dc.DoSetClippingRegion(GetX(x, y), GetY(x, y), GetX(w, h), GetY(w, h));
+ }
+
+ virtual void DoGetTextExtent(const wxString& string,
+ wxCoord *x, wxCoord *y,
+ wxCoord *descent = NULL,
+ wxCoord *externalLeading = NULL,
+ const wxFont *theFont = NULL) const
+ {
+ // never mirrored
+ m_dc.DoGetTextExtent(string, x, y, descent, externalLeading, theFont);
+ }
+
+private:
+ wxDCImpl& m_dc;
+
+ bool m_mirror;
+
+ wxDECLARE_NO_COPY_CLASS(wxMirrorDCImpl);
+};
+
+class WXDLLIMPEXP_CORE wxMirrorDC : public wxDC
+{
+public:
+ wxMirrorDC(wxDC& dc, bool mirror)
+ : wxDC(new wxMirrorDCImpl(this, *dc.GetImpl(), mirror))
+ {
+ m_mirror = mirror;
+ }
+
+ // helper functions which may be useful for the users of this class
+ wxSize Reflect(const wxSize& sizeOrig)
+ {
+ return m_mirror ? wxSize(sizeOrig.y, sizeOrig.x) : sizeOrig;
+ }
+
+private:
+ bool m_mirror;
+
+ wxDECLARE_NO_COPY_CLASS(wxMirrorDC);
+};
+
+#endif // _WX_DCMIRROR_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/dcprint.h
+// Purpose: wxPrinterDC base header
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DCPRINT_H_BASE_
+#define _WX_DCPRINT_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_PRINTING_ARCHITECTURE
+
+#include "wx/dc.h"
+
+//-----------------------------------------------------------------------------
+// wxPrinterDC
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPrinterDC : public wxDC
+{
+public:
+ wxPrinterDC();
+ wxPrinterDC(const wxPrintData& data);
+
+ wxRect GetPaperRect() const;
+ int GetResolution() const;
+
+protected:
+ wxPrinterDC(wxDCImpl *impl) : wxDC(impl) { }
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPrinterDC)
+};
+
+#endif // wxUSE_PRINTING_ARCHITECTURE
+
+#endif // _WX_DCPRINT_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/dcps.h
+// Purpose: wxPostScriptDC base header
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DCPS_H_BASE_
+#define _WX_DCPS_H_BASE_
+
+#include "wx/generic/dcpsg.h"
+
+#endif
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/dcscreen.h
+// Purpose: wxScreenDC base header
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DCSCREEN_H_BASE_
+#define _WX_DCSCREEN_H_BASE_
+
+#include "wx/defs.h"
+#include "wx/dc.h"
+
+class WXDLLIMPEXP_CORE wxScreenDC : public wxDC
+{
+public:
+ wxScreenDC();
+
+ static bool StartDrawingOnTop(wxWindow * WXUNUSED(window))
+ { return true; }
+ static bool StartDrawingOnTop(wxRect * WXUNUSED(rect) = NULL)
+ { return true; }
+ static bool EndDrawingOnTop()
+ { return true; }
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxScreenDC)
+};
+
+
+#endif
+ // _WX_DCSCREEN_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/dcsvg.h
+// Purpose: wxSVGFileDC
+// Author: Chris Elliott
+// Modified by:
+// Created:
+// Copyright: (c) Chris Elliott
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DCSVG_H_
+#define _WX_DCSVG_H_
+
+#include "wx/string.h"
+#include "wx/dc.h"
+
+#if wxUSE_SVG
+
+#define wxSVGVersion wxT("v0100")
+
+#ifdef __BORLANDC__
+#pragma warn -8008
+#pragma warn -8066
+#endif
+
+class WXDLLIMPEXP_FWD_BASE wxFileOutputStream;
+
+
+
+class WXDLLIMPEXP_FWD_CORE wxSVGFileDC;
+
+class WXDLLIMPEXP_CORE wxSVGFileDCImpl : public wxDCImpl
+{
+public:
+ wxSVGFileDCImpl( wxSVGFileDC *owner, const wxString &filename,
+ int width=320, int height=240, double dpi=72.0 );
+
+ virtual ~wxSVGFileDCImpl();
+
+ bool IsOk() const { return m_OK; }
+
+ virtual bool CanDrawBitmap() const { return true; }
+ virtual bool CanGetTextExtent() const { return true; }
+
+ virtual int GetDepth() const
+ {
+ wxFAIL_MSG(wxT("wxSVGFILEDC::GetDepth Call not implemented"));
+ return -1;
+ }
+
+ virtual void Clear()
+ {
+ wxFAIL_MSG(wxT("wxSVGFILEDC::Clear() Call not implemented \nNot sensible for an output file?"));
+ }
+
+ virtual void DestroyClippingRegion();
+
+ virtual wxCoord GetCharHeight() const;
+ virtual wxCoord GetCharWidth() const;
+
+ virtual void SetClippingRegion(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
+ wxCoord WXUNUSED(w), wxCoord WXUNUSED(h))
+ {
+ wxFAIL_MSG(wxT("wxSVGFILEDC::SetClippingRegion not implemented"));
+ }
+
+ virtual void SetPalette(const wxPalette& WXUNUSED(palette))
+ {
+ wxFAIL_MSG(wxT("wxSVGFILEDC::SetPalette not implemented"));
+ }
+
+ virtual void GetClippingBox(wxCoord *WXUNUSED(x), wxCoord *WXUNUSED(y),
+ wxCoord *WXUNUSED(w), wxCoord *WXUNUSED(h))
+ {
+ wxFAIL_MSG(wxT("wxSVGFILEDC::GetClippingBox not implemented"));
+ }
+
+ virtual void SetLogicalFunction(wxRasterOperationMode WXUNUSED(function))
+ {
+ wxFAIL_MSG(wxT("wxSVGFILEDC::SetLogicalFunction Call not implemented"));
+ }
+
+ virtual wxRasterOperationMode GetLogicalFunction() const
+ {
+ wxFAIL_MSG(wxT("wxSVGFILEDC::GetLogicalFunction() not implemented"));
+ return wxCOPY;
+ }
+
+ virtual void SetBackground( const wxBrush &brush );
+ virtual void SetBackgroundMode( int mode );
+ virtual void SetBrush(const wxBrush& brush);
+ virtual void SetFont(const wxFont& font);
+ virtual void SetPen(const wxPen& pen);
+
+ virtual void* GetHandle() const { return NULL; }
+
+private:
+ virtual bool DoGetPixel(wxCoord, wxCoord, wxColour *) const
+ {
+ wxFAIL_MSG(wxT("wxSVGFILEDC::DoGetPixel Call not implemented"));
+ return true;
+ }
+
+ virtual bool DoBlit(wxCoord, wxCoord, wxCoord, wxCoord, wxDC *,
+ wxCoord, wxCoord, wxRasterOperationMode = wxCOPY,
+ bool = 0, int = -1, int = -1);
+
+ virtual void DoCrossHair(wxCoord, wxCoord)
+ {
+ wxFAIL_MSG(wxT("wxSVGFILEDC::CrossHair Call not implemented"));
+ }
+
+ virtual void DoDrawArc(wxCoord, wxCoord, wxCoord, wxCoord, wxCoord, wxCoord);
+
+ virtual void DoDrawBitmap(const wxBitmap &, wxCoord, wxCoord, bool = false);
+
+ virtual void DoDrawCheckMark(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
+
+ virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
+
+ virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
+ double sa, double ea);
+
+ virtual void DoDrawIcon(const wxIcon &, wxCoord, wxCoord);
+
+ virtual void DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
+
+ virtual void DoDrawLines(int n, const wxPoint points[],
+ wxCoord xoffset = 0, wxCoord yoffset = 0);
+
+ virtual void DoDrawPoint(wxCoord, wxCoord);
+
+ virtual void DoDrawPolygon(int n, const wxPoint points[],
+ wxCoord xoffset, wxCoord yoffset,
+ wxPolygonFillMode fillStyle);
+
+ virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
+
+ virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
+ double angle);
+
+ virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
+ wxCoord w, wxCoord h,
+ double radius = 20) ;
+
+ virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
+
+ virtual bool DoFloodFill(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
+ const wxColour& WXUNUSED(col),
+ wxFloodFillStyle WXUNUSED(style) = wxFLOOD_SURFACE)
+ {
+ wxFAIL_MSG(wxT("wxSVGFILEDC::DoFloodFill Call not implemented"));
+ return false;
+ }
+
+ virtual void DoGetSize(int * x, int *y) const
+ {
+ if ( x )
+ *x = m_width;
+ if ( y )
+ *y = m_height;
+ }
+
+ virtual void DoGetTextExtent(const wxString& string, wxCoord *w, wxCoord *h,
+ wxCoord *descent = NULL,
+ wxCoord *externalLeading = NULL,
+ const wxFont *font = NULL) const;
+
+ virtual void DoSetDeviceClippingRegion(const wxRegion& WXUNUSED(region))
+ {
+ wxFAIL_MSG(wxT("wxSVGFILEDC::DoSetDeviceClippingRegion not yet implemented"));
+ }
+
+ virtual void DoSetClippingRegion(int x, int y, int width, int height);
+
+ virtual void DoGetSizeMM( int *width, int *height ) const;
+
+ virtual wxSize GetPPI() const;
+
+ void Init (const wxString &filename, int width, int height, double dpi);
+
+ void write( const wxString &s );
+
+private:
+ // If m_graphics_changed is true, close the current <g> element and start a
+ // new one for the last pen/brush change.
+ void NewGraphicsIfNeeded();
+
+ // Open a new graphics group setting up all the attributes according to
+ // their current values in wxDC.
+ void DoStartNewGraphics();
+
+ wxFileOutputStream *m_outfile;
+ wxString m_filename;
+ int m_sub_images; // number of png format images we have
+ bool m_OK;
+ bool m_graphics_changed; // set by Set{Brush,Pen}()
+ int m_width, m_height;
+ double m_dpi;
+
+ // The clipping nesting level is incremented by every call to
+ // SetClippingRegion() and reset when DestroyClippingRegion() is called.
+ size_t m_clipNestingLevel;
+
+ // Unique ID for every clipping graphics group: this is simply always
+ // incremented in each SetClippingRegion() call.
+ size_t m_clipUniqueId;
+
+ DECLARE_ABSTRACT_CLASS(wxSVGFileDCImpl)
+};
+
+
+class WXDLLIMPEXP_CORE wxSVGFileDC : public wxDC
+{
+public:
+ wxSVGFileDC(const wxString& filename,
+ int width = 320,
+ int height = 240,
+ double dpi = 72.0)
+ : wxDC(new wxSVGFileDCImpl(this, filename, width, height, dpi))
+ {
+ }
+};
+
+#endif // wxUSE_SVG
+
+#endif // _WX_DCSVG_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/dde.h
+// Purpose: DDE base header
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DDE_H_BASE_
+#define _WX_DDE_H_BASE_
+
+#include "wx/list.h"
+
+class WXDLLIMPEXP_FWD_BASE wxDDEClient;
+class WXDLLIMPEXP_FWD_BASE wxDDEServer;
+class WXDLLIMPEXP_FWD_BASE wxDDEConnection;
+
+WX_DECLARE_USER_EXPORTED_LIST(wxDDEClient, wxDDEClientList, WXDLLIMPEXP_BASE);
+WX_DECLARE_USER_EXPORTED_LIST(wxDDEServer, wxDDEServerList, WXDLLIMPEXP_BASE);
+WX_DECLARE_USER_EXPORTED_LIST(wxDDEConnection, wxDDEConnectionList, WXDLLIMPEXP_BASE);
+
+#if defined(__WINDOWS__)
+ #include "wx/msw/dde.h"
+#else
+ #error DDE is only supported under Windows
+#endif
+
+#endif
+ // _WX_DDE_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/debug.h
+// Purpose: Misc debug functions and macros
+// Author: Vadim Zeitlin
+// Created: 29/01/98
+// Copyright: (c) 1998-2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DEBUG_H_
+#define _WX_DEBUG_H_
+
+#if !defined(__WXWINCE__)
+ #include <assert.h>
+#endif // systems without assert.h
+
+#include <limits.h> // for CHAR_BIT used below
+
+#include "wx/chartype.h" // for __TFILE__ and wxChar
+#include "wx/cpp.h" // for __WXFUNCTION__
+#include "wx/dlimpexp.h" // for WXDLLIMPEXP_FWD_BASE
+
+class WXDLLIMPEXP_FWD_BASE wxString;
+class WXDLLIMPEXP_FWD_BASE wxCStrData;
+
+// ----------------------------------------------------------------------------
+// Defines controlling the debugging macros
+// ----------------------------------------------------------------------------
+
+/*
+ wxWidgets can be built with several different levels of debug support
+ specified by the value of wxDEBUG_LEVEL constant:
+
+ 0: No assertion macros at all, this should only be used when optimizing
+ for resource-constrained systems (typically embedded ones).
+ 1: Default level, most of the assertions are enabled.
+ 2: Maximal (at least for now): asserts which are "expensive"
+ (performance-wise) or only make sense for finding errors in wxWidgets
+ itself, as opposed to bugs in applications using it, are also enabled.
+ */
+
+// unless wxDEBUG_LEVEL is predefined (by configure or via wx/setup.h under
+// Windows), use the default
+#if !defined(wxDEBUG_LEVEL)
+ #define wxDEBUG_LEVEL 1
+#endif // !defined(wxDEBUG_LEVEL)
+
+/*
+ __WXDEBUG__ is defined when wxDEBUG_LEVEL != 0. This is done mostly for
+ compatibility but it also provides a simpler way to check if asserts and
+ debug logging is enabled at all.
+ */
+#if wxDEBUG_LEVEL > 0
+ #ifndef __WXDEBUG__
+ #define __WXDEBUG__
+ #endif
+#else
+ #undef __WXDEBUG__
+#endif
+
+// Finally there is also a very old WXDEBUG macro not used anywhere at all, it
+// is only defined for compatibility.
+#ifdef __WXDEBUG__
+ #if !defined(WXDEBUG) || !WXDEBUG
+ #undef WXDEBUG
+ #define WXDEBUG 1
+ #endif // !WXDEBUG
+#endif // __WXDEBUG__
+
+// ----------------------------------------------------------------------------
+// Handling assertion failures
+// ----------------------------------------------------------------------------
+
+/*
+ Type for the function called in case of assert failure, see
+ wxSetAssertHandler().
+ */
+typedef void (*wxAssertHandler_t)(const wxString& file,
+ int line,
+ const wxString& func,
+ const wxString& cond,
+ const wxString& msg);
+
+#if wxDEBUG_LEVEL
+
+// the global assert handler function, if it is NULL asserts don't check their
+// conditions
+extern WXDLLIMPEXP_DATA_BASE(wxAssertHandler_t) wxTheAssertHandler;
+
+/*
+ Sets the function to be called in case of assertion failure.
+
+ The default assert handler forwards to wxApp::OnAssertFailure() whose
+ default behaviour is, in turn, to show the standard assertion failure
+ dialog if a wxApp object exists or shows the same dialog itself directly
+ otherwise.
+
+ While usually it is enough -- and more convenient -- to just override
+ OnAssertFailure(), to handle all assertion failures, including those
+ occurring even before wxApp object creation or after its destruction you
+ need to provide your assertion handler function.
+
+ This function also provides a simple way to disable all asserts: simply
+ pass NULL pointer to it. Doing this will result in not even evaluating
+ assert conditions at all, avoiding almost all run-time cost of asserts.
+
+ Notice that this function is not MT-safe, so you should call it before
+ starting any other threads.
+
+ The return value of this function is the previous assertion handler. It can
+ be called after any pre-processing by your handler and can also be restored
+ later if you uninstall your handler.
+ */
+inline wxAssertHandler_t wxSetAssertHandler(wxAssertHandler_t handler)
+{
+ const wxAssertHandler_t old = wxTheAssertHandler;
+ wxTheAssertHandler = handler;
+ return old;
+}
+
+/*
+ Reset the default assert handler.
+
+ This may be used to enable asserts, which are disabled by default in this
+ case, for programs built in release build (NDEBUG defined).
+ */
+extern void WXDLLIMPEXP_BASE wxSetDefaultAssertHandler();
+
+#else // !wxDEBUG_LEVEL
+
+// provide empty stubs in case assertions are completely disabled
+//
+// NB: can't use WXUNUSED() here as we're included from wx/defs.h before it is
+// defined
+inline wxAssertHandler_t wxSetAssertHandler(wxAssertHandler_t /* handler */)
+{
+ return NULL;
+}
+
+inline void wxSetDefaultAssertHandler() { }
+
+#endif // wxDEBUG_LEVEL/!wxDEBUG_LEVEL
+
+// simply a synonym for wxSetAssertHandler(NULL)
+inline void wxDisableAsserts() { wxSetAssertHandler(NULL); }
+
+/*
+ A macro which disables asserts for applications compiled in release build.
+
+ By default, wxIMPLEMENT_APP (or rather wxIMPLEMENT_WXWIN_MAIN) disable the
+ asserts in the applications compiled in the release build by calling this.
+ It does nothing if NDEBUG is not defined.
+ */
+#ifdef NDEBUG
+ #define wxDISABLE_ASSERTS_IN_RELEASE_BUILD() wxDisableAsserts()
+#else
+ #define wxDISABLE_ASSERTS_IN_RELEASE_BUILD()
+#endif
+
+#if wxDEBUG_LEVEL
+
+/*
+ wxOnAssert() is used by the debugging macros defined below. Different
+ overloads are needed because these macros can be used with or without wxT().
+
+ All of them are implemented in src/common/appcmn.cpp and unconditionally
+ call wxTheAssertHandler so the caller must check that it is non-NULL
+ (assert macros do it).
+ */
+
+#if wxUSE_UNICODE
+
+// these overloads are the ones typically used by debugging macros: we have to
+// provide wxChar* msg version because it's common to use wxT() in the macros
+// and finally, we can't use const wx(char)* msg = NULL, because that would
+// be ambiguous
+//
+// also notice that these functions can't be inline as wxString is not defined
+// yet (and can't be as wxString code itself may use assertions)
+extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file,
+ int line,
+ const char *func,
+ const char *cond);
+
+extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file,
+ int line,
+ const char *func,
+ const char *cond,
+ const char *msg);
+
+extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file,
+ int line,
+ const char *func,
+ const char *cond,
+ const wxChar *msg) ;
+#endif /* wxUSE_UNICODE */
+
+// this version is for compatibility with wx 2.8 Unicode build only, we don't
+// use it ourselves any more except in ANSI-only build in which case it is all
+// we need
+extern WXDLLIMPEXP_BASE void wxOnAssert(const wxChar *file,
+ int line,
+ const char *func,
+ const wxChar *cond,
+ const wxChar *msg = NULL);
+
+// these overloads work when msg passed to debug macro is a string and we
+// also have to provide wxCStrData overload to resolve ambiguity which would
+// otherwise arise from wxASSERT( s.c_str() )
+extern WXDLLIMPEXP_BASE void wxOnAssert(const wxString& file,
+ int line,
+ const wxString& func,
+ const wxString& cond,
+ const wxString& msg);
+
+extern WXDLLIMPEXP_BASE void wxOnAssert(const wxString& file,
+ int line,
+ const wxString& func,
+ const wxString& cond);
+
+extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file,
+ int line,
+ const char *func,
+ const char *cond,
+ const wxCStrData& msg);
+
+extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file,
+ int line,
+ const char *func,
+ const char *cond,
+ const wxString& msg);
+
+#endif // wxDEBUG_LEVEL
+
+
+// ----------------------------------------------------------------------------
+// Debugging macros
+// ----------------------------------------------------------------------------
+
+/*
+ Assertion macros: check if the condition is true and call assert handler
+ (which will by default notify the user about failure) if it isn't.
+
+ wxASSERT and wxFAIL macros as well as wxTrap() function do nothing at all
+ if wxDEBUG_LEVEL is 0 however they do check their conditions at default
+ debug level 1, unlike the previous wxWidgets versions.
+
+ wxASSERT_LEVEL_2 is meant to be used for "expensive" asserts which should
+ normally be disabled because they have a big impact on performance and so
+ this macro only does anything if wxDEBUG_LEVEL >= 2.
+ */
+#if wxDEBUG_LEVEL
+ // wxTrap() can be used to break into the debugger unconditionally
+ // (assuming the program is running under debugger, of course).
+ //
+ // If possible, we prefer to define it as a macro rather than as a function
+ // to open the debugger at the position where we trapped and not inside the
+ // trap function itself which is not very useful.
+ #if wxCHECK_VISUALC_VERSION(7)
+ #define wxTrap() __debugbreak()
+ #else
+ extern WXDLLIMPEXP_BASE void wxTrap();
+ #endif // Win VisualC
+
+ // Global flag used to indicate that assert macros should call wxTrap(): it
+ // is set by the default assert handler if the user answers yes to the
+ // question of whether to trap.
+ extern WXDLLIMPEXP_DATA_BASE(bool) wxTrapInAssert;
+
+ // This macro checks if the condition is true and calls the assert handler
+ // with the provided message if it isn't and finally traps if the special
+ // flag indicating that it should do it was set by the handler.
+ //
+ // Notice that we don't use the handler return value for compatibility
+ // reasons (if we changed its return type, we'd need to change wxApp::
+ // OnAssertFailure() too which would break user code overriding it), hence
+ // the need for the ugly global flag.
+ #define wxASSERT_MSG(cond, msg) \
+ wxSTATEMENT_MACRO_BEGIN \
+ if ( wxTheAssertHandler && !(cond) && \
+ (wxOnAssert(__FILE__, __LINE__, __WXFUNCTION__, \
+ #cond, msg), wxTrapInAssert) ) \
+ { \
+ wxTrapInAssert = false; \
+ wxTrap(); \
+ } \
+ wxSTATEMENT_MACRO_END
+
+ // a version without any additional message, don't use unless condition
+ // itself is fully self-explanatory
+ #define wxASSERT(cond) wxASSERT_MSG(cond, (const char*)NULL)
+
+ // wxFAIL is a special form of assert: it always triggers (and so is
+ // usually used in normally unreachable code)
+ #define wxFAIL_COND_MSG(cond, msg) \
+ wxSTATEMENT_MACRO_BEGIN \
+ if ( wxTheAssertHandler && \
+ (wxOnAssert(__FILE__, __LINE__, __WXFUNCTION__, \
+ cond, msg), wxTrapInAssert) ) \
+ { \
+ wxTrapInAssert = false; \
+ wxTrap(); \
+ } \
+ wxSTATEMENT_MACRO_END
+
+ #define wxFAIL_MSG(msg) wxFAIL_COND_MSG("Assert failure", msg)
+ #define wxFAIL wxFAIL_MSG((const char*)NULL)
+#else // !wxDEBUG_LEVEL
+ #define wxTrap()
+
+ #define wxASSERT(cond)
+ #define wxASSERT_MSG(cond, msg)
+ #define wxFAIL
+ #define wxFAIL_MSG(msg)
+ #define wxFAIL_COND_MSG(cond, msg)
+#endif // wxDEBUG_LEVEL
+
+#if wxDEBUG_LEVEL >= 2
+ #define wxASSERT_LEVEL_2_MSG(cond, msg) wxASSERT_MSG(cond, msg)
+ #define wxASSERT_LEVEL_2(cond) wxASSERT(cond)
+#else // wxDEBUG_LEVEL < 2
+ #define wxASSERT_LEVEL_2_MSG(cond, msg)
+ #define wxASSERT_LEVEL_2(cond)
+#endif
+
+// This is simply a wrapper for the standard abort() which is not available
+// under all platforms.
+//
+// It isn't really debug-related but there doesn't seem to be any better place
+// for it, so declare it here and define it in appbase.cpp, together with
+// wxTrap().
+extern void WXDLLIMPEXP_BASE wxAbort();
+
+/*
+ wxCHECK macros always check their conditions, setting debug level to 0 only
+ makes them silent in case of failure, otherwise -- including at default
+ debug level 1 -- they call the assert handler if the condition is false
+
+ They are supposed to be used only in invalid situation: for example, an
+ invalid parameter (e.g. a NULL pointer) is passed to a function. Instead of
+ dereferencing it and causing core dump the function might use
+
+ wxCHECK_RET( p != NULL, "pointer can't be NULL" )
+*/
+
+// the generic macro: takes the condition to check, the statement to be executed
+// in case the condition is false and the message to pass to the assert handler
+#define wxCHECK2_MSG(cond, op, msg) \
+ if ( cond ) \
+ {} \
+ else \
+ { \
+ wxFAIL_COND_MSG(#cond, msg); \
+ op; \
+ } \
+ struct wxDummyCheckStruct /* just to force a semicolon */
+
+// check which returns with the specified return code if the condition fails
+#define wxCHECK_MSG(cond, rc, msg) wxCHECK2_MSG(cond, return rc, msg)
+
+// check that expression is true, "return" if not (also FAILs in debug mode)
+#define wxCHECK(cond, rc) wxCHECK_MSG(cond, rc, (const char*)NULL)
+
+// check that expression is true, perform op if not
+#define wxCHECK2(cond, op) wxCHECK2_MSG(cond, op, (const char*)NULL)
+
+// special form of wxCHECK2: as wxCHECK, but for use in void functions
+//
+// NB: there is only one form (with msg parameter) and it's intentional:
+// there is no other way to tell the caller what exactly went wrong
+// from the void function (of course, the function shouldn't be void
+// to begin with...)
+#define wxCHECK_RET(cond, msg) wxCHECK2_MSG(cond, return, msg)
+
+
+// ----------------------------------------------------------------------------
+// Compile time asserts
+//
+// Unlike the normal assert and related macros above which are checked during
+// the program run-time the macros below will result in a compilation error if
+// the condition they check is false. This is usually used to check the
+// expressions containing sizeof()s which cannot be tested with the
+// preprocessor. If you can use the #if's, do use them as you can give a more
+// detailed error message then.
+// ----------------------------------------------------------------------------
+
+/*
+ How this works (you don't have to understand it to be able to use the
+ macros): we rely on the fact that it is invalid to define a named bit field
+ in a struct of width 0. All the rest are just the hacks to minimize the
+ possibility of the compiler warnings when compiling this macro: in
+ particular, this is why we define a struct and not an object (which would
+ result in a warning about unused variable) and a named struct (otherwise we'd
+ get a warning about an unnamed struct not used to define an object!).
+ */
+
+#define wxMAKE_UNIQUE_ASSERT_NAME wxMAKE_UNIQUE_NAME(wxAssert_)
+
+/*
+ The second argument of this macro must be a valid C++ identifier and not a
+ string. I.e. you should use it like this:
+
+ wxCOMPILE_TIME_ASSERT( sizeof(int) >= 2, YourIntsAreTooSmall );
+
+ It may be used both within a function and in the global scope.
+*/
+#if defined(__WATCOMC__)
+ /* avoid "unused symbol" warning */
+ #define wxCOMPILE_TIME_ASSERT(expr, msg) \
+ class wxMAKE_UNIQUE_ASSERT_NAME { \
+ unsigned int msg: expr; \
+ wxMAKE_UNIQUE_ASSERT_NAME() { wxUnusedVar(msg); } \
+ }
+#elif defined( __VMS )
+namespace wxdebug{
+
+// HP aCC cannot deal with missing names for template value parameters
+template <bool x> struct STATIC_ASSERTION_FAILURE;
+
+template <> struct STATIC_ASSERTION_FAILURE<true> { enum { value = 1 }; };
+
+// HP aCC cannot deal with missing names for template value parameters
+template<int x> struct static_assert_test{};
+
+}
+ #define WX_JOIN( X, Y ) X##Y
+ #define WX_STATIC_ASSERT_BOOL_CAST(x) (bool)(x)
+ #define wxCOMPILE_TIME_ASSERT(expr, msg) \
+ typedef ::wxdebug::static_assert_test<\
+ sizeof(::wxdebug::STATIC_ASSERTION_FAILURE< WX_STATIC_ASSERT_BOOL_CAST( expr ) >)>\
+ WX_JOIN(wx_static_assert_typedef_, __LINE__)
+#else
+ #define wxCOMPILE_TIME_ASSERT(expr, msg) \
+ struct wxMAKE_UNIQUE_ASSERT_NAME { unsigned int msg: expr; }
+#endif
+
+/*
+ When using VC++ 6 with "Edit and Continue" on, the compiler completely
+ mishandles __LINE__ and so wxCOMPILE_TIME_ASSERT() doesn't work, provide a
+ way to make "unique" assert names by specifying a unique prefix explicitly
+ */
+#define wxMAKE_UNIQUE_ASSERT_NAME2(text) wxCONCAT(wxAssert_, text)
+
+#define wxCOMPILE_TIME_ASSERT2(expr, msg, text) \
+ struct wxMAKE_UNIQUE_ASSERT_NAME2(text) { unsigned int msg: expr; }
+
+// helpers for wxCOMPILE_TIME_ASSERT below, for private use only
+#define wxMAKE_BITSIZE_MSG(type, size) type ## SmallerThan ## size ## Bits
+
+// a special case of compile time assert: check that the size of the given type
+// is at least the given number of bits
+#define wxASSERT_MIN_BITSIZE(type, size) \
+ wxCOMPILE_TIME_ASSERT(sizeof(type) * CHAR_BIT >= size, \
+ wxMAKE_BITSIZE_MSG(type, size))
+
+
+// ----------------------------------------------------------------------------
+// other miscellaneous debugger-related functions
+// ----------------------------------------------------------------------------
+
+/*
+ Return true if we're running under debugger.
+
+ Currently only really works under Win32 and just returns false elsewhere.
+ */
+#if defined(__WIN32__)
+ extern bool WXDLLIMPEXP_BASE wxIsDebuggerRunning();
+#else // !Mac
+ inline bool wxIsDebuggerRunning() { return false; }
+#endif // Mac/!Mac
+
+// An assert helper used to avoid warning when testing constant expressions,
+// i.e. wxASSERT( sizeof(int) == 4 ) can generate a compiler warning about
+// expression being always true, but not using
+// wxASSERT( wxAssertIsEqual(sizeof(int), 4) )
+//
+// NB: this is made obsolete by wxCOMPILE_TIME_ASSERT() and should no
+// longer be used.
+extern bool WXDLLIMPEXP_BASE wxAssertIsEqual(int x, int y);
+
+// Use of wxFalse instead of false suppresses compiler warnings about testing
+// constant expression
+extern WXDLLIMPEXP_DATA_BASE(const bool) wxFalse;
+
+#define wxAssertFailure wxFalse
+
+// This is similar to WXUNUSED() and useful for parameters which are only used
+// in assertions.
+#if wxDEBUG_LEVEL
+ #define WXUNUSED_UNLESS_DEBUG(param) param
+#else
+ #define WXUNUSED_UNLESS_DEBUG(param) WXUNUSED(param)
+#endif
+
+
+#endif // _WX_DEBUG_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/debugrpt.h
+// Purpose: declaration of wxDebugReport class
+// Author: Vadim Zeitlin
+// Created: 2005-01-17
+// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DEBUGRPT_H_
+#define _WX_DEBUGRPT_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_DEBUGREPORT && wxUSE_XML
+
+#include "wx/string.h"
+#include "wx/arrstr.h"
+
+class WXDLLIMPEXP_FWD_XML wxXmlNode;
+
+// ----------------------------------------------------------------------------
+// wxDebugReport: generate a debug report, processing is done in derived class
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_QA wxDebugReport
+{
+public:
+ // this is used for the functions which may report either the current state
+ // or the state during the last (fatal) exception
+ enum Context { Context_Current, Context_Exception };
+
+
+ // ctor creates a temporary directory where we create the files which will
+ // be included in the report, use IsOk() to check for errors
+ wxDebugReport();
+
+ // dtor normally destroys the temporary directory created in the ctor (with
+ // all the files it contains), call Reset() to prevent this from happening
+ virtual ~wxDebugReport();
+
+ // return the name of the directory used for this report
+ const wxString& GetDirectory() const { return m_dir; }
+
+ // return true if the object was successfully initialized
+ bool IsOk() const { return !GetDirectory().empty(); }
+
+ // reset the directory name we use, the object can't be used any more after
+ // this as it becomes invalid/uninitialized
+ void Reset() { m_dir.clear(); }
+
+
+ // add another file to the report: the file must already exist, its name
+ // can be either absolute in which case it is copied to the debug report
+ // directory or relative to GetDirectory()
+ //
+ // description is shown to the user in the report summary
+ virtual void AddFile(const wxString& filename, const wxString& description);
+
+ // convenience function: write the given text to a file with the given name
+ // and then add it to the report (the difference with AddFile() is that the
+ // file will be created by this function and doesn't have to already exist)
+ bool AddText(const wxString& filename,
+ const wxString& text,
+ const wxString& description);
+
+#if wxUSE_STACKWALKER
+ // add an XML file containing the current or exception context and the
+ // stack trace
+ bool AddCurrentContext() { return AddContext(Context_Current); }
+ bool AddExceptionContext() { return AddContext(Context_Exception); }
+ virtual bool AddContext(Context ctx);
+#endif
+
+#if wxUSE_CRASHREPORT
+ // add a file with crash report
+ bool AddCurrentDump() { return AddDump(Context_Current); }
+ bool AddExceptionDump() { return AddDump(Context_Exception); }
+ virtual bool AddDump(Context ctx);
+#endif // wxUSE_CRASHREPORT
+
+ // add all available information to the report
+ void AddAll(Context context = Context_Exception);
+
+
+ // process this report: the base class simply notifies the user that the
+ // report has been generated, this is usually not enough -- instead you
+ // should override this method to do something more useful to you
+ bool Process();
+
+ // get the name used as base name for various files, by default
+ // wxApp::GetName()
+ virtual wxString GetReportName() const;
+
+ // get the files in this report
+ size_t GetFilesCount() const { return m_files.GetCount(); }
+ bool GetFile(size_t n, wxString *name, wxString *desc) const;
+
+ // remove the file from report: this is used by wxDebugReportPreview to
+ // allow the user to remove files potentially containing private
+ // information from the report
+ void RemoveFile(const wxString& name);
+
+protected:
+#if wxUSE_STACKWALKER
+ // used by AddContext()
+ virtual bool DoAddSystemInfo(wxXmlNode *nodeSystemInfo);
+ virtual bool DoAddLoadedModules(wxXmlNode *nodeModules);
+ virtual bool DoAddExceptionInfo(wxXmlNode *nodeContext);
+ virtual void DoAddCustomContext(wxXmlNode * WXUNUSED(nodeRoot)) { }
+#endif
+
+ // used by Process()
+ virtual bool DoProcess();
+
+private:
+ // name of the report directory
+ wxString m_dir;
+
+ // the arrays of files in this report and their descriptions
+ wxArrayString m_files,
+ m_descriptions;
+};
+
+#if wxUSE_ZIPSTREAM
+
+// ----------------------------------------------------------------------------
+// wxDebugReportCompress: compress all files of this debug report in a .ZIP
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_QA wxDebugReportCompress : public wxDebugReport
+{
+public:
+ wxDebugReportCompress() { }
+
+ // you can optionally specify the directory and/or name of the file where
+ // the debug report should be generated, a default location under the
+ // directory containing temporary files will be used if you don't
+ //
+ // both of these functions should be called before Process()ing the report
+ // if they're called at all
+ void SetCompressedFileDirectory(const wxString& dir);
+ void SetCompressedFileBaseName(const wxString& name);
+
+ // returns the full path of the compressed file (empty if creation failed)
+ const wxString& GetCompressedFileName() const { return m_zipfile; }
+
+protected:
+ virtual bool DoProcess();
+
+private:
+ // user-specified file directory/base name, use defaults if empty
+ wxString m_zipDir,
+ m_zipName;
+
+ // full path to the ZIP file we created
+ wxString m_zipfile;
+};
+
+// ----------------------------------------------------------------------------
+// wxDebugReportUploader: uploads compressed file using HTTP POST request
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_QA wxDebugReportUpload : public wxDebugReportCompress
+{
+public:
+ // this class will upload the compressed file created by its base class to
+ // an HTML multipart/form-data form at the specified address
+ //
+ // the URL is the base address, input is the name of the "type=file"
+ // control on the form used for the file name and action is the value of
+ // the form action field
+ wxDebugReportUpload(const wxString& url,
+ const wxString& input,
+ const wxString& action,
+ const wxString& curl = wxT("curl"));
+
+protected:
+ virtual bool DoProcess();
+
+ // this function may be overridden in a derived class to show the output
+ // from curl: this may be an HTML page or anything else that the server
+ // returned
+ //
+ // return value becomes the return value of Process()
+ virtual bool OnServerReply(const wxArrayString& WXUNUSED(reply))
+ {
+ return true;
+ }
+
+private:
+ // the full URL to use with HTTP POST request
+ wxString m_uploadURL;
+
+ // the name of the input field containing the file name in the form at
+ // above URL
+ wxString m_inputField;
+
+ // the curl command (by default it is just "curl" but could be full path to
+ // curl or a wrapper script with curl-compatible syntax)
+ wxString m_curlCmd;
+};
+
+#endif // wxUSE_ZIPSTREAM
+
+
+// ----------------------------------------------------------------------------
+// wxDebugReportPreview: presents the debug report to the user and allows him
+// to veto report entirely or remove some parts of it
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_QA wxDebugReportPreview
+{
+public:
+ // ctor is trivial
+ wxDebugReportPreview() { }
+
+ // present the report to the user and allow him to modify it by removing
+ // some or all of the files and, potentially, adding some notes
+ //
+ // return true if the report should be processed or false if the user chose
+ // to cancel report generation or removed all files from it
+ virtual bool Show(wxDebugReport& dbgrpt) const = 0;
+
+ // dtor is trivial as well but should be virtual for a base class
+ virtual ~wxDebugReportPreview() { }
+};
+
+#if wxUSE_GUI
+
+// ----------------------------------------------------------------------------
+// wxDebugReportPreviewStd: standard debug report preview window
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_QA wxDebugReportPreviewStd : public wxDebugReportPreview
+{
+public:
+ wxDebugReportPreviewStd() { }
+
+ virtual bool Show(wxDebugReport& dbgrpt) const;
+};
+
+#endif // wxUSE_GUI
+
+#endif // wxUSE_DEBUGREPORT && wxUSE_XML
+
+#endif // _WX_DEBUGRPT_H_
--- /dev/null
+/*
+ * Name: wx/defs.h
+ * Purpose: Declarations/definitions common to all wx source files
+ * Author: Julian Smart and others
+ * Modified by: Ryan Norton (Converted to C)
+ * Created: 01/02/97
+ * Copyright: (c) Julian Smart
+ * Licence: wxWindows licence
+ */
+
+/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
+
+#ifndef _WX_DEFS_H_
+#define _WX_DEFS_H_
+
+/*
+ NOTE: this symbol will be replaced with "WXWIN_COMPATIBILITY_3_0" as soon
+ as the development branch for 3.1 is created
+ */
+#define FUTURE_WXWIN_COMPATIBILITY_3_0 1
+#define wxDEPRECATED_FUTURE( x ) x
+
+/* ---------------------------------------------------------------------------- */
+/* compiler and OS identification */
+/* ---------------------------------------------------------------------------- */
+
+#include "wx/platform.h"
+
+#ifdef __cplusplus
+/* Make sure the environment is set correctly */
+# if defined(__WXMSW__) && defined(__X__)
+# error "Target can't be both X and MSW"
+# elif !defined(__WXMOTIF__) && \
+ !defined(__WXMSW__) && \
+ !defined(__WXGTK__) && \
+ !defined(__WXPM__) && \
+ !defined(__WXOSX_CARBON__) && \
+ !defined(__WXOSX_COCOA__) && \
+ !defined(__WXOSX_IPHONE__) && \
+ !defined(__WXCOCOA__) && \
+ !defined(__X__) && \
+ !defined(__WXDFB__) && \
+ !defined(__WXX11__) && \
+ wxUSE_GUI
+# ifdef __UNIX__
+# error "No Target! You should use wx-config program for compilation flags!"
+# else /* !Unix */
+# error "No Target! You should use supplied makefiles for compilation!"
+# endif /* Unix/!Unix */
+# endif
+#endif /*__cplusplus*/
+
+#ifndef __WXWINDOWS__
+ #define __WXWINDOWS__ 1
+#endif
+
+#ifndef wxUSE_BASE
+ /* by default consider that this is a monolithic build */
+ #define wxUSE_BASE 1
+#endif
+
+#if !wxUSE_GUI && !defined(__WXBASE__)
+ #define __WXBASE__
+#endif
+
+/* suppress some Visual C++ warnings */
+#ifdef __VISUALC__
+ /* the only "real" warning here is 4244 but there are just too many of them */
+ /* in our code... one day someone should go and fix them but until then... */
+# pragma warning(disable:4097) /* typedef used as class */
+# pragma warning(disable:4201) /* nonstandard extension used: nameless struct/union */
+# pragma warning(disable:4244) /* conversion from double to float */
+# pragma warning(disable:4355) /* 'this' used in base member initializer list */
+# pragma warning(disable:4511) /* copy ctor couldn't be generated */
+# pragma warning(disable:4512) /* operator=() couldn't be generated */
+# pragma warning(disable:4514) /* unreferenced inline func has been removed */
+# pragma warning(disable:4710) /* function not inlined */
+
+ /*
+ TODO: this warning should really be enabled as it can be genuinely
+ useful, check where does it occur in wxWidgets
+ */
+ #pragma warning(disable: 4127) /* conditional expression is constant */
+
+ /* There are too many false positivies for this one, particularly when
+ using templates like wxVector<T> */
+ /* class 'foo' needs to have dll-interface to be used by clients of
+ class 'bar'" */
+# pragma warning(disable:4251)
+
+ /*
+ This is a similar warning which occurs when deriving from standard
+ containers. MSDN even mentions that it can be ignored in this case
+ (albeit only in debug build while the warning is the same in release
+ too and seems equally harmless).
+ */
+#if wxUSE_STD_CONTAINERS
+# pragma warning(disable:4275)
+#endif /* wxUSE_STD_CONTAINERS */
+
+# ifdef __VISUALC5__
+ /* For VC++ 5.0 for release mode, the warning 'C4702: unreachable code */
+ /* is buggy, and occurs for code that does actually get executed */
+# ifndef __WXDEBUG__
+# pragma warning(disable:4702) /* unreachable code */
+# endif
+
+ /* The VC++ 5.0 warning 'C4003: not enough actual parameters for macro'
+ * is incompatible with the wxWidgets headers since it is given when
+ * parameters are empty but not missing. */
+# pragma warning(disable:4003) /* not enough actual parameters for macro */
+# endif
+
+ /*
+ VC6 insists on complaining about
+
+ return type for 'wxVector<T>::reverse_iterator::operator ->' is 'T **'
+ (ie; not a UDT or reference to a UDT. Will produce errors if applied
+ using infix notation)
+
+ which is perfectly fine because template classes do routinely define
+ operators which don't make sense for all template parameter values
+ (besides this warning was removed in subsequent versions).
+ */
+ #ifdef __VISUALC6__
+ #pragma warning(disable: 4284)
+ #endif /* VC6 */
+
+ /*
+ When compiling with VC++ 7 /Wp64 option we get thousands of warnings for
+ conversion from size_t to int or long. Some precious few of them might
+ be worth looking into but unfortunately it seems infeasible to fix all
+ the other, harmless ones (e.g. inserting static_cast<int>(s.length())
+ everywhere this method is used though we are quite sure that using >4GB
+ strings is a bad idea anyhow) so just disable it globally for now.
+ */
+ #if wxCHECK_VISUALC_VERSION(7)
+ /* conversion from 'size_t' to 'unsigned long', possible loss of data */
+ #pragma warning(disable:4267)
+ #endif /* VC++ 7 or later */
+
+ /*
+ VC++ 8 gives a warning when using standard functions such as sprintf,
+ localtime, ... -- stop this madness, unless the user had already done it
+ */
+ #if wxCHECK_VISUALC_VERSION(8)
+ #ifndef _CRT_SECURE_NO_DEPRECATE
+ #define _CRT_SECURE_NO_DEPRECATE 1
+ #endif
+ #ifndef _CRT_NON_CONFORMING_SWPRINTFS
+ #define _CRT_NON_CONFORMING_SWPRINTFS 1
+ #endif
+ #ifndef _SCL_SECURE_NO_WARNINGS
+ #define _SCL_SECURE_NO_WARNINGS 1
+ #endif
+ #endif /* VC++ 8 */
+#endif /* __VISUALC__ */
+
+/* suppress some Borland C++ warnings */
+#ifdef __BORLANDC__
+# pragma warn -inl /* Functions containing reserved words and certain constructs are not expanded inline */
+#endif /* __BORLANDC__ */
+
+/*
+ g++ gives a warning when a class has private dtor if it has no friends but
+ this is a perfectly valid situation for a ref-counted class which destroys
+ itself when its ref count drops to 0, so provide a macro to suppress this
+ warning
+ */
+#ifdef __GNUG__
+# define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name) \
+ friend class wxDummyFriendFor ## name;
+#else /* !g++ */
+# define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name)
+#endif
+
+/*
+ Clang Support
+ */
+
+#ifndef WX_HAS_CLANG_FEATURE
+# ifndef __has_feature
+# define WX_HAS_CLANG_FEATURE(x) 0
+# else
+# define WX_HAS_CLANG_FEATURE(x) __has_feature(x)
+# endif
+#endif
+
+/* ---------------------------------------------------------------------------- */
+/* wxWidgets version and compatibility defines */
+/* ---------------------------------------------------------------------------- */
+
+#include "wx/version.h"
+
+/* ============================================================================ */
+/* non portable C++ features */
+/* ============================================================================ */
+
+/* ---------------------------------------------------------------------------- */
+/* compiler defects workarounds */
+/* ---------------------------------------------------------------------------- */
+
+/*
+ Digital Unix C++ compiler only defines this symbol for .cxx and .hxx files,
+ so define it ourselves (newer versions do it for all files, though, and
+ don't allow it to be redefined)
+ */
+#if defined(__DECCXX) && !defined(__VMS) && !defined(__cplusplus)
+#define __cplusplus
+#endif /* __DECCXX */
+
+/* Resolves linking problems under HP-UX when compiling with gcc/g++ */
+#if defined(__HPUX__) && defined(__GNUG__)
+#define va_list __gnuc_va_list
+#endif /* HP-UX */
+
+/* Prevents conflicts between sys/types.h and winsock.h with Cygwin, */
+/* when using Windows sockets. */
+#if defined(__CYGWIN__) && defined(__WXMSW__)
+#define __USE_W32_SOCKETS
+#endif
+
+/* ---------------------------------------------------------------------------- */
+/* check for native bool type and TRUE/FALSE constants */
+/* ---------------------------------------------------------------------------- */
+
+/* for backwards compatibility, also define TRUE and FALSE */
+/* */
+/* note that these definitions should work both in C++ and C code, so don't */
+/* use true/false below */
+#ifndef TRUE
+ #define TRUE 1
+#endif
+
+#ifndef FALSE
+ #define FALSE 0
+#endif
+
+typedef short int WXTYPE;
+
+
+/* ---------------------------------------------------------------------------- */
+/* other feature tests */
+/* ---------------------------------------------------------------------------- */
+
+/* Every ride down a slippery slope begins with a single step.. */
+/* */
+/* Yes, using nested classes is indeed against our coding standards in */
+/* general, but there are places where you can use them to advantage */
+/* without totally breaking ports that cannot use them. If you do, then */
+/* wrap it in this guard, but such cases should still be relatively rare. */
+#define wxUSE_NESTED_CLASSES 1
+
+/* check for explicit keyword support */
+#ifndef HAVE_EXPLICIT
+ #if defined(__VISUALC__) && (__VISUALC__ >= 1100)
+ /* VC++ 6.0 and 5.0 have explicit (what about earlier versions?) */
+ #define HAVE_EXPLICIT
+ #elif ( defined(__MINGW32__) || defined(__CYGWIN32__) ) \
+ && wxCHECK_GCC_VERSION(2, 95)
+ /* GCC 2.95 has explicit, what about earlier versions? */
+ #define HAVE_EXPLICIT
+ #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x0520)
+ /* BC++ 4.52 doesn't support explicit, CBuilder 1 does */
+ #define HAVE_EXPLICIT
+ #elif defined(__DIGITALMARS__)
+ #define HAVE_EXPLICIT
+ #elif defined(__WATCOMC__)
+ #define HAVE_EXPLICIT
+ #endif
+#endif /* !HAVE_EXPLICIT */
+
+#ifdef HAVE_EXPLICIT
+ #define wxEXPLICIT explicit
+#else /* !HAVE_EXPLICIT */
+ #define wxEXPLICIT
+#endif /* HAVE_EXPLICIT/!HAVE_EXPLICIT */
+
+/* these macros are obsolete, use the standard C++ casts directly now */
+#define wx_static_cast(t, x) static_cast<t>(x)
+#define wx_const_cast(t, x) const_cast<t>(x)
+#define wx_reinterpret_cast(t, x) reinterpret_cast<t>(x)
+
+/*
+ This one is a wx invention: like static cast but used when we intentionally
+ truncate from a larger to smaller type, static_cast<> can't be used for it
+ as it results in warnings when using some compilers (SGI mipspro for example)
+ */
+#if defined(__INTELC__) && defined(__cplusplus)
+ template <typename T, typename X>
+ inline T wx_truncate_cast_impl(X x)
+ {
+ #pragma warning(push)
+ /* implicit conversion of a 64-bit integral type to a smaller integral type */
+ #pragma warning(disable: 1682)
+ /* conversion from "X" to "T" may lose significant bits */
+ #pragma warning(disable: 810)
+ /* non-pointer conversion from "foo" to "bar" may lose significant bits */
+ #pragma warning(disable: 2259)
+
+ return x;
+
+ #pragma warning(pop)
+ }
+
+ #define wx_truncate_cast(t, x) wx_truncate_cast_impl<t>(x)
+
+#elif defined(__cplusplus) && defined(__VISUALC__) && __VISUALC__ >= 1310
+ template <typename T, typename X>
+ inline T wx_truncate_cast_impl(X x)
+ {
+ #pragma warning(push)
+ /* conversion from 'size_t' to 'type', possible loss of data */
+ #pragma warning(disable: 4267)
+ /* conversion from 'type1' to 'type2', possible loss of data */
+ #pragma warning(disable: 4242)
+
+ return x;
+
+ #pragma warning(pop)
+ }
+
+ #define wx_truncate_cast(t, x) wx_truncate_cast_impl<t>(x)
+#else
+ #define wx_truncate_cast(t, x) ((t)(x))
+#endif
+
+/* for consistency with wxStatic/DynamicCast defined in wx/object.h */
+#define wxConstCast(obj, className) wx_const_cast(className *, obj)
+
+#ifndef HAVE_STD_WSTRING
+ #if defined(__VISUALC__) && (__VISUALC__ >= 1100)
+ /* VC++ 6.0 and 5.0 have std::wstring (what about earlier versions?) */
+ #define HAVE_STD_WSTRING
+ #elif defined(__MINGW32__) && wxCHECK_GCC_VERSION(3, 3)
+ /* GCC 3.1 has std::wstring; 3.0 never was in MinGW, 2.95 hasn't it */
+ #define HAVE_STD_WSTRING
+ #endif
+#endif
+
+#ifndef HAVE_STD_STRING_COMPARE
+ #if defined(__VISUALC__) && (__VISUALC__ >= 1100)
+ /* VC++ 6.0 and 5.0 have std::string::compare */
+ /* (what about earlier versions?) */
+ #define HAVE_STD_STRING_COMPARE
+ #elif ( defined(__MINGW32__) || defined(__CYGWIN32__) ) \
+ && wxCHECK_GCC_VERSION(3, 1)
+ /* GCC 3.1 has std::string::compare; */
+ /* 3.0 never was in MinGW, 2.95 hasn't it */
+ #define HAVE_STD_STRING_COMPARE
+ #endif
+#endif
+
+#ifndef HAVE_TR1_TYPE_TRAITS
+ #if defined(__VISUALC__) && (_MSC_FULL_VER >= 150030729)
+ #define HAVE_TR1_TYPE_TRAITS
+ #endif
+#endif
+
+#if defined(__has_include)
+ #if !defined(HAVE_TYPE_TRAITS) && __has_include(<type_traits>)
+ #define HAVE_TYPE_TRAITS
+ #endif
+
+ #if !defined(HAVE_TR1_TYPE_TRAITS) && __has_include(<tr1/type_traits>)
+ #define HAVE_TR1_TYPE_TRAITS
+ #endif
+
+ #if !defined(HAVE_STD_UNORDERED_MAP) && __has_include(<unordered_map>)
+ #define HAVE_STD_UNORDERED_MAP
+ #endif
+
+ #if !defined(HAVE_TR1_UNORDERED_MAP) && __has_include(<tr1/unordered_map>)
+ #define HAVE_TR1_UNORDERED_MAP
+ #endif
+
+ #if !defined(HAVE_STD_UNORDERED_SET) && __has_include(<unordered_set>)
+ #define HAVE_STD_UNORDERED_SET
+ #endif
+
+ #if !defined(HAVE_TR1_UNORDERED_SET) && __has_include(<tr1/unordered_set>)
+ #define HAVE_TR1_UNORDERED_SET
+ #endif
+#endif // defined(__has_include)
+
+/* provide replacement for C99 va_copy() if the compiler doesn't have it */
+
+/* could be already defined by configure or the user */
+#ifndef wxVaCopy
+ /* if va_copy is a macro or configure detected that we have it, use it */
+ #if defined(va_copy) || defined(HAVE_VA_COPY)
+ #define wxVaCopy va_copy
+ #else /* no va_copy, try to provide a replacement */
+ /*
+ configure tries to determine whether va_list is an array or struct
+ type, but it may not be used under Windows, so deal with a few
+ special cases.
+ */
+
+ #ifdef __WATCOMC__
+ /* Watcom uses array type for va_list except for PPC and Alpha */
+ #if !defined(__PPC__) && !defined(__AXP__)
+ #define VA_LIST_IS_ARRAY
+ #endif
+ #endif /* __WATCOMC__ */
+
+ #if defined(__PPC__) && (defined(_CALL_SYSV) || defined (_WIN32))
+ /*
+ PPC using SysV ABI and NT/PPC are special in that they use an
+ extra level of indirection.
+ */
+ #define VA_LIST_IS_POINTER
+ #endif /* SysV or Win32 on __PPC__ */
+
+ /*
+ note that we use memmove(), not memcpy(), in case anybody tries
+ to do wxVaCopy(ap, ap)
+ */
+ #if defined(VA_LIST_IS_POINTER)
+ #define wxVaCopy(d, s) memmove(*(d), *(s), sizeof(va_list))
+ #elif defined(VA_LIST_IS_ARRAY)
+ #define wxVaCopy(d, s) memmove((d), (s), sizeof(va_list))
+ #else /* we can only hope that va_lists are simple lvalues */
+ #define wxVaCopy(d, s) ((d) = (s))
+ #endif
+ #endif /* va_copy/!va_copy */
+#endif /* wxVaCopy */
+
+#ifndef HAVE_WOSTREAM
+ /*
+ Mingw <= 3.4 and all versions of Cygwin don't have std::wostream
+ */
+ #if (defined(__MINGW32__) && !wxCHECK_GCC_VERSION(4, 0)) || \
+ defined(__CYGWIN__)
+ #define wxNO_WOSTREAM
+ #endif
+
+ /* VC++ doesn't have it in the old iostream library */
+ #if defined(__VISUALC__) && wxUSE_IOSTREAMH
+ #define wxNO_WOSTREAM
+ #endif
+
+ #ifndef wxNO_WOSTREAM
+ #define HAVE_WOSTREAM
+ #endif
+
+ #undef wxNO_WOSTREAM
+#endif /* HAVE_WOSTREAM */
+
+/* ---------------------------------------------------------------------------- */
+/* other C++ features */
+/* ---------------------------------------------------------------------------- */
+
+#ifndef HAVE_PARTIAL_SPECIALIZATION
+ /* be optimistic by default */
+ #define HAVE_PARTIAL_SPECIALIZATION
+#endif
+
+#ifdef __VISUALC__
+ #if __VISUALC__ < 1310
+ #undef HAVE_PARTIAL_SPECIALIZATION
+ #endif
+#endif /* __VISUALC__ */
+
+
+#ifndef HAVE_TEMPLATE_OVERLOAD_RESOLUTION
+ /* assume the compiler can use type or const expressions as template
+ arguments if it supports partial specialization -- except if it's a
+ Borland one which can't */
+ #if defined(HAVE_PARTIAL_SPECIALIZATION) && !defined(__BORLANDC__)
+ #define HAVE_TEMPLATE_OVERLOAD_RESOLUTION
+ #endif /* (HAVE_PARTIAL_SPECIALIZATION) && !defined(__BORLANDC__) */
+#endif /* !defined(HAVE_TEMPLATE_OVERLOAD_RESOLUTION) */
+
+/* ---------------------------------------------------------------------------- */
+/* portable calling conventions macros */
+/* ---------------------------------------------------------------------------- */
+
+/* stdcall is used for all functions called by Windows under Windows */
+#if defined(__WINDOWS__)
+ #if defined(__GNUWIN32__)
+ #define wxSTDCALL __attribute__((stdcall))
+ #else
+ /* both VC++ and Borland understand this */
+ #define wxSTDCALL _stdcall
+ #endif
+
+#else /* Win */
+ /* no such stupidness under Unix */
+ #define wxSTDCALL
+#endif /* platform */
+
+/* LINKAGEMODE mode is empty for everything except OS/2 */
+#ifndef LINKAGEMODE
+ #define LINKAGEMODE
+#endif /* LINKAGEMODE */
+
+/* wxCALLBACK should be used for the functions which are called back by */
+/* Windows (such as compare function for wxListCtrl) */
+#if defined(__WIN32__) && !defined(__WXMICROWIN__)
+ #define wxCALLBACK wxSTDCALL
+#else
+ /* no stdcall under Unix nor Win16 */
+ #define wxCALLBACK
+#endif /* platform */
+
+/* generic calling convention for the extern "C" functions */
+
+#if defined(__VISUALC__)
+ #define wxC_CALLING_CONV _cdecl
+#elif defined(__VISAGECPP__)
+ #define wxC_CALLING_CONV _Optlink
+#else /* !Visual C++ */
+ #define wxC_CALLING_CONV
+#endif /* compiler */
+
+/* callling convention for the qsort(3) callback */
+#define wxCMPFUNC_CONV wxC_CALLING_CONV
+
+/* compatibility :-( */
+#define CMPFUNC_CONV wxCMPFUNC_CONV
+
+/* DLL import/export declarations */
+#include "wx/dlimpexp.h"
+
+/* ---------------------------------------------------------------------------- */
+/* Very common macros */
+/* ---------------------------------------------------------------------------- */
+
+/* Printf-like attribute definitions to obtain warnings with GNU C/C++ */
+#ifndef WX_ATTRIBUTE_PRINTF
+# if defined(__GNUC__) && !wxUSE_UNICODE
+# define WX_ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
+# else
+# define WX_ATTRIBUTE_PRINTF(m, n)
+# endif
+
+# define WX_ATTRIBUTE_PRINTF_1 WX_ATTRIBUTE_PRINTF(1, 2)
+# define WX_ATTRIBUTE_PRINTF_2 WX_ATTRIBUTE_PRINTF(2, 3)
+# define WX_ATTRIBUTE_PRINTF_3 WX_ATTRIBUTE_PRINTF(3, 4)
+# define WX_ATTRIBUTE_PRINTF_4 WX_ATTRIBUTE_PRINTF(4, 5)
+# define WX_ATTRIBUTE_PRINTF_5 WX_ATTRIBUTE_PRINTF(5, 6)
+#endif /* !defined(WX_ATTRIBUTE_PRINTF) */
+
+#ifndef WX_ATTRIBUTE_NORETURN
+# if WX_HAS_CLANG_FEATURE(attribute_analyzer_noreturn)
+# define WX_ATTRIBUTE_NORETURN __attribute__((analyzer_noreturn))
+# elif defined( __GNUC__ )
+# define WX_ATTRIBUTE_NORETURN __attribute__ ((noreturn))
+# elif wxCHECK_VISUALC_VERSION(7)
+# define WX_ATTRIBUTE_NORETURN __declspec(noreturn)
+# else
+# define WX_ATTRIBUTE_NORETURN
+# endif
+#endif
+
+#if defined(__GNUC__)
+ #define WX_ATTRIBUTE_UNUSED __attribute__ ((unused))
+#else
+ #define WX_ATTRIBUTE_UNUSED
+#endif
+
+/*
+ Macros for marking functions as being deprecated.
+
+ The preferred macro in the new code is wxDEPRECATED_MSG() which allows to
+ explain why is the function deprecated. Almost all the existing code uses
+ the older wxDEPRECATED() or its variants currently, but this will hopefully
+ change in the future.
+ */
+
+/* The basic compiler-specific construct to generate a deprecation warning. */
+#ifdef __clang__
+ #define wxDEPRECATED_DECL __attribute__((deprecated))
+#elif wxCHECK_GCC_VERSION(3, 1)
+ #define wxDEPRECATED_DECL __attribute__((deprecated))
+#elif defined(__VISUALC__) && (__VISUALC__ >= 1300)
+ #define wxDEPRECATED_DECL __declspec(deprecated)
+#else
+ #define wxDEPRECATED_DECL
+#endif
+
+/*
+ Macro taking the deprecation message. It applies to the next declaration.
+
+ If the compiler doesn't support showing the message, this degrades to a
+ simple wxDEPRECATED(), i.e. at least gives a warning, if possible.
+ */
+#if defined(__clang__) && defined(__has_extension)
+ #if __has_extension(attribute_deprecated_with_message)
+ #define wxDEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
+ #else
+ #define wxDEPRECATED_MSG(msg) __attribute__((deprecated))
+ #endif
+#elif wxCHECK_GCC_VERSION(4, 5)
+ #define wxDEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
+#elif wxCHECK_VISUALC_VERSION(8)
+ #define wxDEPRECATED_MSG(msg) __declspec(deprecated("deprecated: " msg))
+#else
+ #define wxDEPRECATED_MSG(msg) wxDEPRECATED_DECL
+#endif
+
+/*
+ Macro taking the declaration that it deprecates. Prefer to use
+ wxDEPRECATED_MSG() instead as it's simpler (wrapping the entire declaration
+ makes the code unclear) and allows to specify the explanation.
+ */
+#define wxDEPRECATED(x) wxDEPRECATED_DECL x
+
+#if defined(__GNUC__) && !wxCHECK_GCC_VERSION(3, 4)
+ /*
+ We need to add dummy "inline" to allow gcc < 3.4 to handle the
+ deprecation attribute on the constructors.
+ */
+ #define wxDEPRECATED_CONSTRUCTOR(x) wxDEPRECATED( inline x)
+#else
+ #define wxDEPRECATED_CONSTRUCTOR(x) wxDEPRECATED(x)
+#endif
+
+/*
+ Macro which marks the function as being deprecated but also defines it
+ inline.
+
+ Currently it's defined in the same trivial way in all cases but it could
+ need a special definition with some other compilers in the future which
+ explains why do we have it.
+ */
+#define wxDEPRECATED_INLINE(func, body) wxDEPRECATED(func) { body }
+
+/*
+ A macro to define a simple deprecated accessor.
+ */
+#define wxDEPRECATED_ACCESSOR(func, what) wxDEPRECATED_INLINE(func, return what;)
+
+/*
+ Special variant of the macro above which should be used for the functions
+ which are deprecated but called by wx itself: this often happens with
+ deprecated virtual functions which are called by the library.
+ */
+#ifdef WXBUILDING
+# define wxDEPRECATED_BUT_USED_INTERNALLY(x) x
+#else
+# define wxDEPRECATED_BUT_USED_INTERNALLY(x) wxDEPRECATED(x)
+#endif
+
+/*
+ Macros to suppress and restore gcc warnings, requires g++ >= 4.6 and don't
+ do anything otherwise.
+
+ Example of use:
+
+ wxGCC_WARNING_SUPPRESS(float-equal)
+ inline bool wxIsSameDouble(double x, double y) { return x == y; }
+ wxGCC_WARNING_RESTORE(float-equal)
+ */
+#if wxCHECK_GCC_VERSION(4, 6)
+# define wxGCC_WARNING_SUPPRESS(x) \
+ _Pragma (wxSTRINGIZE(GCC diagnostic push)) \
+ _Pragma (wxSTRINGIZE(GCC diagnostic ignored wxSTRINGIZE(wxCONCAT(-W,x))))
+# define wxGCC_WARNING_RESTORE(x) \
+ _Pragma (wxSTRINGIZE(GCC diagnostic pop))
+#else /* gcc < 4.6 or not gcc at all */
+# define wxGCC_WARNING_SUPPRESS(x)
+# define wxGCC_WARNING_RESTORE(x)
+#endif
+
+/*
+ Combination of the two variants above: should be used for deprecated
+ functions which are defined inline and are used by wxWidgets itself.
+ */
+#ifdef WXBUILDING
+# define wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(func, body) func { body }
+#else
+# define wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(func, body) \
+ wxDEPRECATED(func) { body }
+#endif
+
+/* NULL declaration: it must be defined as 0 for C++ programs (in particular, */
+/* it must not be defined as "(void *)0" which is standard for C but completely */
+/* breaks C++ code) */
+#if !defined(__HANDHELDPC__)
+#include <stddef.h>
+#endif
+
+#ifdef __cplusplus
+
+// everybody gets the assert and other debug macros
+#include "wx/debug.h"
+
+ // delete pointer if it is not NULL and NULL it afterwards
+ template <typename T>
+ inline void wxDELETE(T*& ptr)
+ {
+ typedef char TypeIsCompleteCheck[sizeof(T)] WX_ATTRIBUTE_UNUSED;
+
+ if ( ptr != NULL )
+ {
+ delete ptr;
+ ptr = NULL;
+ }
+ }
+
+ // delete an array and NULL it (see comments above)
+ template <typename T>
+ inline void wxDELETEA(T*& ptr)
+ {
+ typedef char TypeIsCompleteCheck[sizeof(T)] WX_ATTRIBUTE_UNUSED;
+
+ if ( ptr != NULL )
+ {
+ delete [] ptr;
+ ptr = NULL;
+ }
+ }
+
+ // trivial implementation of std::swap() for primitive types
+ template <typename T>
+ inline void wxSwap(T& first, T& second)
+ {
+ T tmp(first);
+ first = second;
+ second = tmp;
+ }
+#endif /*__cplusplus*/
+
+/* size of statically declared array */
+#define WXSIZEOF(array) (sizeof(array)/sizeof(array[0]))
+
+/* symbolic constant used by all Find()-like functions returning positive */
+/* integer on success as failure indicator */
+#define wxNOT_FOUND (-1)
+
+/* the default value for some length parameters meaning that the string is */
+/* NUL-terminated */
+#define wxNO_LEN ((size_t)-1)
+
+/* ---------------------------------------------------------------------------- */
+/* macros dealing with comparison operators */
+/* ---------------------------------------------------------------------------- */
+
+/*
+ Expands into m(op, args...) for each op in the set { ==, !=, <, <=, >, >= }.
+ */
+#define wxFOR_ALL_COMPARISONS(m) \
+ m(==) m(!=) m(>=) m(<=) m(>) m(<)
+
+#define wxFOR_ALL_COMPARISONS_1(m, x) \
+ m(==,x) m(!=,x) m(>=,x) m(<=,x) m(>,x) m(<,x)
+
+#define wxFOR_ALL_COMPARISONS_2(m, x, y) \
+ m(==,x,y) m(!=,x,y) m(>=,x,y) m(<=,x,y) m(>,x,y) m(<,x,y)
+
+#define wxFOR_ALL_COMPARISONS_3(m, x, y, z) \
+ m(==,x,y,z) m(!=,x,y,z) m(>=,x,y,z) m(<=,x,y,z) m(>,x,y,z) m(<,x,y,z)
+
+/*
+ These are only used with wxDEFINE_COMPARISON_[BY_]REV: they pass both the
+ normal and the reversed comparison operators to the macro.
+ */
+#define wxFOR_ALL_COMPARISONS_2_REV(m, x, y) \
+ m(==,x,y,==) m(!=,x,y,!=) m(>=,x,y,<=) \
+ m(<=,x,y,>=) m(>,x,y,<) m(<,x,y,>)
+
+#define wxFOR_ALL_COMPARISONS_3_REV(m, x, y, z) \
+ m(==,x,y,z,==) m(!=,x,y,z,!=) m(>=,x,y,z,<=) \
+ m(<=,x,y,z,>=) m(>,x,y,z,<) m(<,x,y,z,>)
+
+
+#define wxDEFINE_COMPARISON(op, T1, T2, cmp) \
+ inline bool operator op(T1 x, T2 y) { return cmp(x, y, op); }
+
+#define wxDEFINE_COMPARISON_REV(op, T1, T2, cmp, oprev) \
+ inline bool operator op(T2 y, T1 x) { return cmp(x, y, oprev); }
+
+#define wxDEFINE_COMPARISON_BY_REV(op, T1, T2, oprev) \
+ inline bool operator op(T1 x, T2 y) { return y oprev x; }
+
+/*
+ Define all 6 comparison operators (==, !=, <, <=, >, >=) for the given
+ types in the specified order. The implementation is provided by the cmp
+ macro. Normally wxDEFINE_ALL_COMPARISONS should be used as comparison
+ operators are usually symmetric.
+ */
+#define wxDEFINE_COMPARISONS(T1, T2, cmp) \
+ wxFOR_ALL_COMPARISONS_3(wxDEFINE_COMPARISON, T1, T2, cmp)
+
+/*
+ Define all 6 comparison operators (==, !=, <, <=, >, >=) for the given
+ types in the specified order, implemented in terms of existing operators
+ for the reverse order.
+ */
+#define wxDEFINE_COMPARISONS_BY_REV(T1, T2) \
+ wxFOR_ALL_COMPARISONS_2_REV(wxDEFINE_COMPARISON_BY_REV, T1, T2)
+
+/*
+ This macro allows to define all 12 comparison operators (6 operators for
+ both orders of arguments) for the given types using the provided "cmp"
+ macro to implement the actual comparison: the macro is called with the 2
+ arguments names, the first of type T1 and the second of type T2, and the
+ comparison operator being implemented.
+ */
+#define wxDEFINE_ALL_COMPARISONS(T1, T2, cmp) \
+ wxFOR_ALL_COMPARISONS_3(wxDEFINE_COMPARISON, T1, T2, cmp) \
+ wxFOR_ALL_COMPARISONS_3_REV(wxDEFINE_COMPARISON_REV, T1, T2, cmp)
+
+/* ---------------------------------------------------------------------------- */
+/* macros to avoid compiler warnings */
+/* ---------------------------------------------------------------------------- */
+
+/* Macro to cut down on compiler warnings. */
+#if 1 /* there should be no more any compilers needing the "#else" version */
+ #define WXUNUSED(identifier) /* identifier */
+#else /* stupid, broken compiler */
+ #define WXUNUSED(identifier) identifier
+#endif
+
+/* some arguments are not used in unicode mode */
+#if wxUSE_UNICODE
+ #define WXUNUSED_IN_UNICODE(param) WXUNUSED(param)
+#else
+ #define WXUNUSED_IN_UNICODE(param) param
+#endif
+
+/* some arguments are not used in WinCE build */
+#ifdef __WXWINCE__
+ #define WXUNUSED_IN_WINCE(param) WXUNUSED(param)
+#else
+ #define WXUNUSED_IN_WINCE(param) param
+#endif
+
+/* unused parameters in non stream builds */
+#if wxUSE_STREAMS
+ #define WXUNUSED_UNLESS_STREAMS(param) param
+#else
+ #define WXUNUSED_UNLESS_STREAMS(param) WXUNUSED(param)
+#endif
+
+/* some compilers give warning about a possibly unused variable if it is */
+/* initialized in both branches of if/else and shut up if it is initialized */
+/* when declared, but other compilers then give warnings about unused variable */
+/* value -- this should satisfy both of them */
+#if defined(__VISUALC__)
+ #define wxDUMMY_INITIALIZE(val) = val
+#else
+ #define wxDUMMY_INITIALIZE(val)
+#endif
+
+/* sometimes the value of a variable is *really* not used, to suppress the */
+/* resulting warning you may pass it to this function */
+#ifdef __cplusplus
+# ifdef __BORLANDC__
+# define wxUnusedVar(identifier) identifier
+# else
+ template <class T>
+ inline void wxUnusedVar(const T& WXUNUSED(t)) { }
+# endif
+#endif
+
+/* ---------------------------------------------------------------------------- */
+/* compiler specific settings */
+/* ---------------------------------------------------------------------------- */
+
+#if wxONLY_WATCOM_EARLIER_THAN(1,4)
+ typedef short mode_t;
+#endif
+
+/* where should i put this? we need to make sure of this as it breaks */
+/* the <iostream> code. */
+#if !wxUSE_IOSTREAMH && defined(__WXDEBUG__)
+# ifdef wxUSE_DEBUG_NEW_ALWAYS
+# undef wxUSE_DEBUG_NEW_ALWAYS
+# define wxUSE_DEBUG_NEW_ALWAYS 0
+# endif
+#endif
+
+/* ---------------------------------------------------------------------------- */
+/* standard wxWidgets types */
+/* ---------------------------------------------------------------------------- */
+
+/* the type for screen and DC coordinates */
+typedef int wxCoord;
+
+enum { wxDefaultCoord = -1 };
+
+/* ---------------------------------------------------------------------------- */
+/* define fixed length types */
+/* ---------------------------------------------------------------------------- */
+
+#if defined(__MINGW32__)
+ #include <sys/types.h>
+#endif
+
+/* chars are always one byte (by definition), shorts are always two (in */
+/* practice) */
+
+/* 8bit */
+typedef signed char wxInt8;
+typedef unsigned char wxUint8;
+typedef wxUint8 wxByte;
+
+
+/* 16bit */
+#ifdef SIZEOF_SHORT
+ #if SIZEOF_SHORT != 2
+ #error "wxWidgets assumes sizeof(short) == 2, please fix the code"
+ #endif
+#else
+ #define SIZEOF_SHORT 2
+#endif
+
+typedef signed short wxInt16;
+typedef unsigned short wxUint16;
+
+typedef wxUint16 wxWord;
+
+/*
+ things are getting more interesting with ints, longs and pointers
+
+ there are several different standard data models described by this table:
+
+ +-----------+----------------------------+
+ |type\model | LP64 ILP64 LLP64 ILP32 LP32|
+ +-----------+----------------------------+
+ |char | 8 8 8 8 8 |
+ |short | 16 16 16 16 16 |
+ |int | 32 64 32 32 16 |
+ |long | 64 64 32 32 32 |
+ |long long | 64 64 64 -- -- |
+ |void * | 64 64 64 32 32 |
+ +-----------+----------------------------+
+
+ Win16 used LP32 (but we don't support it any longer), Win32 obviously used
+ ILP32 and Win64 uses LLP64 (a.k.a. P64)
+
+ Under Unix LP64 is the most widely used (the only I've ever seen, in fact)
+ */
+
+/* 32bit */
+#if defined(__WINDOWS__)
+ #if defined(__WIN32__)
+ typedef int wxInt32;
+ typedef unsigned int wxUint32;
+
+ /*
+ Win64 uses LLP64 model and so ints and longs have the same size as
+ in Win32.
+ */
+ #ifndef SIZEOF_INT
+ #define SIZEOF_INT 4
+ #endif
+
+ #ifndef SIZEOF_LONG
+ #define SIZEOF_LONG 4
+ #endif
+
+ #ifndef SIZEOF_WCHAR_T
+ /* Windows uses UTF-16 */
+ #define SIZEOF_WCHAR_T 2
+ #endif
+
+ #ifndef SIZEOF_SIZE_T
+ /*
+ Under Win64 sizeof(size_t) == 8 and so it is neither unsigned
+ int nor unsigned long!
+ */
+ #ifdef __WIN64__
+ #define SIZEOF_SIZE_T 8
+
+ #undef wxSIZE_T_IS_UINT
+ #else /* Win32 */
+ #define SIZEOF_SIZE_T 4
+
+ #define wxSIZE_T_IS_UINT
+ #endif
+ #undef wxSIZE_T_IS_ULONG
+ #endif
+
+ #ifndef SIZEOF_VOID_P
+ #ifdef __WIN64__
+ #define SIZEOF_VOID_P 8
+ #else /* Win32 */
+ #define SIZEOF_VOID_P 4
+ #endif /* Win64/32 */
+ #endif
+ #else
+ #error "Unsupported Windows version"
+ #endif
+#else /* !Windows */
+ /* SIZEOF_XXX are normally defined by configure */
+ #ifdef SIZEOF_INT
+ #if SIZEOF_INT == 8
+ /* must be ILP64 data model, there is normally a special 32 bit */
+ /* type in it but we don't know what it is... */
+ #error "No 32bit int type on this platform"
+ #elif SIZEOF_INT == 4
+ typedef int wxInt32;
+ typedef unsigned int wxUint32;
+ #elif SIZEOF_INT == 2
+ /* must be LP32 */
+ #if SIZEOF_LONG != 4
+ #error "No 32bit int type on this platform"
+ #endif
+
+ typedef long wxInt32;
+ typedef unsigned long wxUint32;
+ #else
+ /* wxWidgets is not ready for 128bit systems yet... */
+ #error "Unknown sizeof(int) value, what are you compiling for?"
+ #endif
+ #else /* !defined(SIZEOF_INT) */
+ /* assume default 32bit machine -- what else can we do? */
+ wxCOMPILE_TIME_ASSERT( sizeof(int) == 4, IntMustBeExactly4Bytes);
+ wxCOMPILE_TIME_ASSERT( sizeof(size_t) == 4, SizeTMustBeExactly4Bytes);
+ wxCOMPILE_TIME_ASSERT( sizeof(void *) == 4, PtrMustBeExactly4Bytes);
+
+ #define SIZEOF_INT 4
+ #define SIZEOF_SIZE_T 4
+ #define SIZEOF_VOID_P 4
+
+ typedef int wxInt32;
+ typedef unsigned int wxUint32;
+
+ #if defined(__MACH__) && !defined(SIZEOF_WCHAR_T)
+ #define SIZEOF_WCHAR_T 4
+ #endif
+ #if !defined(SIZEOF_WCHAR_T)
+ /* also assume that sizeof(wchar_t) == 2 (under Unix the most */
+ /* common case is 4 but there configure would have defined */
+ /* SIZEOF_WCHAR_T for us) */
+ /* the most common case */
+ wxCOMPILE_TIME_ASSERT( sizeof(wchar_t) == 2,
+ Wchar_tMustBeExactly2Bytes);
+
+ #define SIZEOF_WCHAR_T 2
+ #endif /* !defined(SIZEOF_WCHAR_T) */
+ #endif
+#endif /* Win/!Win */
+
+#ifndef SIZEOF_WCHAR_T
+ #error "SIZEOF_WCHAR_T must be defined, but isn't"
+#endif
+
+/* also define C99-like sized MIN/MAX constants */
+#define wxINT8_MIN CHAR_MIN
+#define wxINT8_MAX CHAR_MAX
+#define wxUINT8_MAX UCHAR_MAX
+
+#define wxINT16_MIN SHRT_MIN
+#define wxINT16_MAX SHRT_MAX
+#define wxUINT16_MAX USHRT_MAX
+
+#if SIZEOF_INT == 4
+ #define wxINT32_MIN INT_MIN
+ #define wxINT32_MAX INT_MAX
+ #define wxUINT32_MAX UINT_MAX
+#elif SIZEOF_LONG == 4
+ #define wxINT32_MIN LONG_MIN
+ #define wxINT32_MAX LONG_MAX
+ #define wxUINT32_MAX ULONG_MAX
+#else
+ #error "Unknown 32 bit type"
+#endif
+
+typedef wxUint32 wxDword;
+
+#ifdef LLONG_MAX
+ #define wxINT64_MIN LLONG_MIN
+ #define wxINT64_MAX LLONG_MAX
+ #define wxUINT64_MAX ULLONG_MAX
+#else
+ #define wxINT64_MIN (wxLL(-9223372036854775807)-1)
+ #define wxINT64_MAX wxLL(9223372036854775807)
+ #define wxUINT64_MAX wxULL(0xFFFFFFFFFFFFFFFF)
+#endif
+
+/* 64 bit */
+
+/* NB: we #define and not typedef wxLongLong_t because we use "#ifdef */
+/* wxLongLong_t" in wx/longlong.h */
+
+/* wxULongLong_t is set later (usually to unsigned wxLongLong_t) */
+
+/* to avoid compilation problems on 64bit machines with ambiguous method calls */
+/* we will need to define this */
+#undef wxLongLongIsLong
+
+/*
+ First check for specific compilers which have known 64 bit integer types,
+ this avoids clashes with SIZEOF_LONG[_LONG] being defined incorrectly for
+ e.g. MSVC builds (Python.h defines it as 8 even for MSVC).
+
+ Also notice that we check for "long long" before checking for 64 bit long as
+ we still want to use "long long" and not "long" for wxLongLong_t on 64 bit
+ architectures to be able to pass wxLongLong_t to the standard functions
+ prototyped as taking "long long" such as strtoll().
+ */
+#if (defined(__VISUALC__) || defined(__INTELC__)) && defined(__WIN32__)
+ #define wxLongLong_t __int64
+ #define wxLongLongSuffix i64
+ #define wxLongLongFmtSpec "I64"
+#elif defined(__BORLANDC__) && defined(__WIN32__) && (__BORLANDC__ >= 0x520)
+ #define wxLongLong_t __int64
+ #define wxLongLongSuffix i64
+ #define wxLongLongFmtSpec "L"
+#elif (defined(__WATCOMC__) && (defined(__WIN32__) || defined(__DOS__) || defined(__OS2__)))
+ #define wxLongLong_t __int64
+ #define wxLongLongSuffix i64
+ #define wxLongLongFmtSpec "L"
+#elif defined(__DIGITALMARS__)
+ #define wxLongLong_t __int64
+ #define wxLongLongSuffix LL
+ #define wxLongLongFmtSpec "ll"
+#elif defined(__MINGW32__)
+ #define wxLongLong_t long long
+ #define wxLongLongSuffix ll
+ #define wxLongLongFmtSpec "I64"
+#elif defined(__VISAGECPP__) && __IBMCPP__ >= 400
+ #define wxLongLong_t long long
+#elif (defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG >= 8) || \
+ defined(__GNUC__) || \
+ defined(__CYGWIN__) || \
+ defined(__WXMICROWIN__) || \
+ (defined(__DJGPP__) && __DJGPP__ >= 2)
+ #define wxLongLong_t long long
+ #define wxLongLongSuffix ll
+ #define wxLongLongFmtSpec "ll"
+#elif defined(SIZEOF_LONG) && (SIZEOF_LONG == 8)
+ #define wxLongLong_t long
+ #define wxLongLongSuffix l
+ #define wxLongLongFmtSpec "l"
+ #define wxLongLongIsLong
+#endif
+
+
+#ifdef wxLongLong_t
+ #define wxULongLong_t unsigned wxLongLong_t
+
+ /*
+ wxLL() and wxULL() macros allow to define 64 bit constants in a
+ portable way.
+ */
+ #ifndef wxCOMPILER_BROKEN_CONCAT_OPER
+ #define wxLL(x) wxCONCAT(x, wxLongLongSuffix)
+ #define wxULL(x) wxCONCAT(x, wxCONCAT(u, wxLongLongSuffix))
+ #else
+ /*
+ Currently only Borland compiler has broken concatenation operator
+ and this compiler is known to use [u]i64 suffix.
+ */
+ #define wxLL(x) wxAPPEND_i64(x)
+ #define wxULL(x) wxAPPEND_ui64(x)
+ #endif
+
+ typedef wxLongLong_t wxInt64;
+ typedef wxULongLong_t wxUint64;
+
+ #define wxHAS_INT64 1
+
+ #ifndef wxLongLongIsLong
+ #define wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
+ #endif
+#elif wxUSE_LONGLONG
+ /* these macros allow to define 64 bit constants in a portable way */
+ #define wxLL(x) wxLongLong(x)
+ #define wxULL(x) wxULongLong(x)
+
+ #define wxInt64 wxLongLong
+ #define wxUint64 wxULongLong
+
+ #define wxHAS_INT64 1
+
+#else /* !wxUSE_LONGLONG */
+
+ #define wxHAS_INT64 0
+
+#endif
+
+/*
+ Helper macro for conditionally compiling some code only if wxLongLong_t is
+ available and is a type different from the other integer types (i.e. not
+ long).
+ */
+#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
+ #define wxIF_LONG_LONG_TYPE(x) x
+#else
+ #define wxIF_LONG_LONG_TYPE(x)
+#endif
+
+
+/* Make sure ssize_t is defined (a signed type the same size as size_t). */
+/* (HAVE_SSIZE_T is not already defined by configure) */
+#ifndef HAVE_SSIZE_T
+#ifdef __MINGW32__
+ #if defined(_SSIZE_T_) || defined(_SSIZE_T_DEFINED)
+ #define HAVE_SSIZE_T
+ #endif
+#elif wxCHECK_WATCOM_VERSION(1,4)
+ #define HAVE_SSIZE_T
+#endif
+#endif /* !HAVE_SSIZE_T */
+
+/* If we really don't have ssize_t, provide our own version. */
+#ifdef HAVE_SSIZE_T
+ #ifdef __UNIX__
+ #include <sys/types.h>
+ #endif
+#else /* !HAVE_SSIZE_T */
+ #if SIZEOF_SIZE_T == 4
+ typedef wxInt32 ssize_t;
+ #elif SIZEOF_SIZE_T == 8
+ typedef wxInt64 ssize_t;
+ #else
+ #error "error defining ssize_t, size_t is not 4 or 8 bytes"
+ #endif
+
+ /* prevent ssize_t redefinitions in other libraries */
+ #define HAVE_SSIZE_T
+#endif
+
+/*
+ We can't rely on Windows _W64 being defined as windows.h may not be
+ included so define our own equivalent: this should be used with types
+ like WXLPARAM or WXWPARAM which are 64 bit under Win64 to avoid warnings
+ each time we cast it to a pointer or a handle (which results in hundreds
+ of warnings as Win32 API often passes pointers in them)
+ */
+#if wxCHECK_VISUALC_VERSION(7)
+ #define wxW64 __w64
+#else
+ #define wxW64
+#endif
+
+/*
+ Define signed and unsigned integral types big enough to contain all of long,
+ size_t and void *.
+ */
+#if SIZEOF_LONG >= SIZEOF_VOID_P
+ /*
+ Normal case when long is the largest integral type.
+ */
+ typedef long wxIntPtr;
+ typedef unsigned long wxUIntPtr;
+#elif SIZEOF_SIZE_T >= SIZEOF_VOID_P
+ /*
+ Win64 case: size_t is the only integral type big enough for "void *".
+
+ Notice that we must use __w64 to avoid warnings about casting pointers
+ to wxIntPtr (which we do often as this is what it is defined for) in 32
+ bit build with MSVC.
+ */
+ typedef wxW64 ssize_t wxIntPtr;
+ typedef size_t wxUIntPtr;
+#else
+ /*
+ This should never happen for the current architectures but if you're
+ using one where it does, please contact wx-dev@lists.wxwidgets.org.
+ */
+ #error "Pointers can't be stored inside integer types."
+#endif
+
+#ifdef __cplusplus
+/* And also define a couple of simple functions to cast pointer to/from it. */
+inline wxUIntPtr wxPtrToUInt(const void *p)
+{
+ /*
+ VC++ 7.1 gives warnings about casts such as below even when they're
+ explicit with /Wp64 option, suppress them as we really know what we're
+ doing here. Same thing with icc with -Wall.
+ */
+#ifdef __VISUALC__
+ #if __VISUALC__ >= 1200
+ #pragma warning(push)
+ #endif
+ /* pointer truncation from '' to '' */
+ #pragma warning(disable: 4311)
+#elif defined(__INTELC__)
+ #pragma warning(push)
+ /* conversion from pointer to same-sized integral type */
+ #pragma warning(disable: 1684)
+#endif
+
+ return wx_reinterpret_cast(wxUIntPtr, p);
+
+#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__)
+ #pragma warning(pop)
+#endif
+}
+
+inline void *wxUIntToPtr(wxUIntPtr p)
+{
+#ifdef __VISUALC__
+ #if __VISUALC__ >= 1200
+ #pragma warning(push)
+ #endif
+ /* conversion to type of greater size */
+ #pragma warning(disable: 4312)
+#elif defined(__INTELC__)
+ #pragma warning(push)
+ /* invalid type conversion: "wxUIntPtr={unsigned long}" to "void *" */
+ #pragma warning(disable: 171)
+#endif
+
+ return wx_reinterpret_cast(void *, p);
+
+#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__)
+ #pragma warning(pop)
+#endif
+}
+#endif /*__cplusplus*/
+
+
+
+/* base floating point types */
+/* wxFloat32: 32 bit IEEE float ( 1 sign, 8 exponent bits, 23 fraction bits ) */
+/* wxFloat64: 64 bit IEEE float ( 1 sign, 11 exponent bits, 52 fraction bits ) */
+/* wxDouble: native fastest representation that has at least wxFloat64 */
+/* precision, so use the IEEE types for storage, and this for */
+/* calculations */
+
+typedef float wxFloat32;
+typedef double wxFloat64;
+
+typedef double wxDouble;
+
+/*
+ Some (non standard) compilers typedef wchar_t as an existing type instead
+ of treating it as a real fundamental type, set wxWCHAR_T_IS_REAL_TYPE to 0
+ for them and to 1 for all the others.
+ */
+#ifndef wxWCHAR_T_IS_REAL_TYPE
+ /*
+ VC++ typedefs wchar_t as unsigned short by default until VC8, that is
+ unless /Za or /Zc:wchar_t option is used in which case _WCHAR_T_DEFINED
+ is defined.
+ */
+# if defined(__VISUALC__) && !defined(_NATIVE_WCHAR_T_DEFINED)
+# define wxWCHAR_T_IS_REAL_TYPE 0
+# else /* compiler having standard-conforming wchar_t */
+# define wxWCHAR_T_IS_REAL_TYPE 1
+# endif
+#endif /* !defined(wxWCHAR_T_IS_REAL_TYPE) */
+
+/* Helper macro for doing something dependent on whether wchar_t is or isn't a
+ typedef inside another macro. */
+#if wxWCHAR_T_IS_REAL_TYPE
+ #define wxIF_WCHAR_T_TYPE(x) x
+#else /* !wxWCHAR_T_IS_REAL_TYPE */
+ #define wxIF_WCHAR_T_TYPE(x)
+#endif /* wxWCHAR_T_IS_REAL_TYPE/!wxWCHAR_T_IS_REAL_TYPE */
+
+/*
+ This constant should be used instead of NULL in vararg functions taking
+ wxChar* arguments: passing NULL (which is the same as 0, unless the compiler
+ defines it specially, e.g. like gcc does with its __null built-in) doesn't
+ work in this case as va_arg() wouldn't interpret the integer 0 correctly
+ when trying to convert it to a pointer on architectures where sizeof(int) is
+ strictly less than sizeof(void *).
+
+ Examples of places where this must be used include wxFileTypeInfo ctor.
+ */
+#define wxNullPtr ((void *)NULL)
+
+
+/* Define wxChar16 and wxChar32 */
+
+#if SIZEOF_WCHAR_T == 2
+ #define wxWCHAR_T_IS_WXCHAR16
+ typedef wchar_t wxChar16;
+#else
+ typedef wxUint16 wxChar16;
+#endif
+
+#if SIZEOF_WCHAR_T == 4
+ #define wxWCHAR_T_IS_WXCHAR32
+ typedef wchar_t wxChar32;
+#else
+ typedef wxUint32 wxChar32;
+#endif
+
+
+/*
+ Helper macro expanding into the given "m" macro invoked with each of the
+ integer types as parameter (notice that this does not include char/unsigned
+ char and bool but does include wchar_t).
+ */
+#define wxDO_FOR_INT_TYPES(m) \
+ m(short) \
+ m(unsigned short) \
+ m(int) \
+ m(unsigned int) \
+ m(long) \
+ m(unsigned long) \
+ wxIF_LONG_LONG_TYPE( m(wxLongLong_t) ) \
+ wxIF_LONG_LONG_TYPE( m(wxULongLong_t) ) \
+ wxIF_WCHAR_T_TYPE( m(wchar_t) )
+
+/*
+ Same as wxDO_FOR_INT_TYPES() but does include char and unsigned char.
+
+ Notice that we use "char" and "unsigned char" here but not "signed char"
+ which would be more correct as "char" could be unsigned by default. But
+ wxWidgets code currently supposes that char is signed and we'd need to
+ clean up assumptions about it, notably in wx/unichar.h, to be able to use
+ "signed char" here.
+ */
+#define wxDO_FOR_CHAR_INT_TYPES(m) \
+ m(char) \
+ m(unsigned char) \
+ wxDO_FOR_INT_TYPES(m)
+
+/*
+ Same as wxDO_FOR_INT_TYPES() above except that m macro takes the
+ type as the first argument and some extra argument, passed from this macro
+ itself, as the second one.
+ */
+#define wxDO_FOR_INT_TYPES_1(m, arg) \
+ m(short, arg) \
+ m(unsigned short, arg) \
+ m(int, arg) \
+ m(unsigned int, arg) \
+ m(long, arg) \
+ m(unsigned long, arg) \
+ wxIF_LONG_LONG_TYPE( m(wxLongLong_t, arg) ) \
+ wxIF_LONG_LONG_TYPE( m(wxULongLong_t, arg) ) \
+ wxIF_WCHAR_T_TYPE( m(wchar_t, arg) )
+
+/*
+ Combination of wxDO_FOR_CHAR_INT_TYPES() and wxDO_FOR_INT_TYPES_1():
+ invokes the given macro with the specified argument as its second parameter
+ for all char and int types.
+ */
+#define wxDO_FOR_CHAR_INT_TYPES_1(m, arg) \
+ m(char, arg) \
+ m(unsigned char, arg) \
+ wxDO_FOR_INT_TYPES_1(m, arg)
+
+
+/* ---------------------------------------------------------------------------- */
+/* byte ordering related definition and macros */
+/* ---------------------------------------------------------------------------- */
+
+/* byte sex */
+
+#define wxBIG_ENDIAN 4321
+#define wxLITTLE_ENDIAN 1234
+#define wxPDP_ENDIAN 3412
+
+#ifdef WORDS_BIGENDIAN
+#define wxBYTE_ORDER wxBIG_ENDIAN
+#else
+#define wxBYTE_ORDER wxLITTLE_ENDIAN
+#endif
+
+/* byte swapping */
+
+#define wxUINT16_SWAP_ALWAYS(val) \
+ ((wxUint16) ( \
+ (((wxUint16) (val) & (wxUint16) 0x00ffU) << 8) | \
+ (((wxUint16) (val) & (wxUint16) 0xff00U) >> 8)))
+
+#define wxINT16_SWAP_ALWAYS(val) \
+ ((wxInt16) ( \
+ (((wxUint16) (val) & (wxUint16) 0x00ffU) << 8) | \
+ (((wxUint16) (val) & (wxUint16) 0xff00U) >> 8)))
+
+#define wxUINT32_SWAP_ALWAYS(val) \
+ ((wxUint32) ( \
+ (((wxUint32) (val) & (wxUint32) 0x000000ffU) << 24) | \
+ (((wxUint32) (val) & (wxUint32) 0x0000ff00U) << 8) | \
+ (((wxUint32) (val) & (wxUint32) 0x00ff0000U) >> 8) | \
+ (((wxUint32) (val) & (wxUint32) 0xff000000U) >> 24)))
+
+#define wxINT32_SWAP_ALWAYS(val) \
+ ((wxInt32) ( \
+ (((wxUint32) (val) & (wxUint32) 0x000000ffU) << 24) | \
+ (((wxUint32) (val) & (wxUint32) 0x0000ff00U) << 8) | \
+ (((wxUint32) (val) & (wxUint32) 0x00ff0000U) >> 8) | \
+ (((wxUint32) (val) & (wxUint32) 0xff000000U) >> 24)))
+/* machine specific byte swapping */
+
+#ifdef wxLongLong_t
+ #define wxUINT64_SWAP_ALWAYS(val) \
+ ((wxUint64) ( \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x00000000000000ff)) << 56) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x000000000000ff00)) << 40) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x0000000000ff0000)) << 24) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x00000000ff000000)) << 8) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x000000ff00000000)) >> 8) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x0000ff0000000000)) >> 24) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x00ff000000000000)) >> 40) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0xff00000000000000)) >> 56)))
+
+ #define wxINT64_SWAP_ALWAYS(val) \
+ ((wxInt64) ( \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x00000000000000ff)) << 56) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x000000000000ff00)) << 40) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x0000000000ff0000)) << 24) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x00000000ff000000)) << 8) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x000000ff00000000)) >> 8) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x0000ff0000000000)) >> 24) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x00ff000000000000)) >> 40) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0xff00000000000000)) >> 56)))
+#elif wxUSE_LONGLONG /* !wxLongLong_t */
+ #define wxUINT64_SWAP_ALWAYS(val) \
+ ((wxUint64) ( \
+ ((wxULongLong(val) & wxULongLong(0L, 0x000000ffU)) << 56) | \
+ ((wxULongLong(val) & wxULongLong(0L, 0x0000ff00U)) << 40) | \
+ ((wxULongLong(val) & wxULongLong(0L, 0x00ff0000U)) << 24) | \
+ ((wxULongLong(val) & wxULongLong(0L, 0xff000000U)) << 8) | \
+ ((wxULongLong(val) & wxULongLong(0x000000ffL, 0U)) >> 8) | \
+ ((wxULongLong(val) & wxULongLong(0x0000ff00L, 0U)) >> 24) | \
+ ((wxULongLong(val) & wxULongLong(0x00ff0000L, 0U)) >> 40) | \
+ ((wxULongLong(val) & wxULongLong(0xff000000L, 0U)) >> 56)))
+
+ #define wxINT64_SWAP_ALWAYS(val) \
+ ((wxInt64) ( \
+ ((wxLongLong(val) & wxLongLong(0L, 0x000000ffU)) << 56) | \
+ ((wxLongLong(val) & wxLongLong(0L, 0x0000ff00U)) << 40) | \
+ ((wxLongLong(val) & wxLongLong(0L, 0x00ff0000U)) << 24) | \
+ ((wxLongLong(val) & wxLongLong(0L, 0xff000000U)) << 8) | \
+ ((wxLongLong(val) & wxLongLong(0x000000ffL, 0U)) >> 8) | \
+ ((wxLongLong(val) & wxLongLong(0x0000ff00L, 0U)) >> 24) | \
+ ((wxLongLong(val) & wxLongLong(0x00ff0000L, 0U)) >> 40) | \
+ ((wxLongLong(val) & wxLongLong(0xff000000L, 0U)) >> 56)))
+#endif /* wxLongLong_t/!wxLongLong_t */
+
+#ifdef WORDS_BIGENDIAN
+ #define wxUINT16_SWAP_ON_BE(val) wxUINT16_SWAP_ALWAYS(val)
+ #define wxINT16_SWAP_ON_BE(val) wxINT16_SWAP_ALWAYS(val)
+ #define wxUINT16_SWAP_ON_LE(val) (val)
+ #define wxINT16_SWAP_ON_LE(val) (val)
+ #define wxUINT32_SWAP_ON_BE(val) wxUINT32_SWAP_ALWAYS(val)
+ #define wxINT32_SWAP_ON_BE(val) wxINT32_SWAP_ALWAYS(val)
+ #define wxUINT32_SWAP_ON_LE(val) (val)
+ #define wxINT32_SWAP_ON_LE(val) (val)
+ #if wxHAS_INT64
+ #define wxUINT64_SWAP_ON_BE(val) wxUINT64_SWAP_ALWAYS(val)
+ #define wxUINT64_SWAP_ON_LE(val) (val)
+ #define wxINT64_SWAP_ON_BE(val) wxINT64_SWAP_ALWAYS(val)
+ #define wxINT64_SWAP_ON_LE(val) (val)
+ #endif
+#else
+ #define wxUINT16_SWAP_ON_LE(val) wxUINT16_SWAP_ALWAYS(val)
+ #define wxINT16_SWAP_ON_LE(val) wxINT16_SWAP_ALWAYS(val)
+ #define wxUINT16_SWAP_ON_BE(val) (val)
+ #define wxINT16_SWAP_ON_BE(val) (val)
+ #define wxUINT32_SWAP_ON_LE(val) wxUINT32_SWAP_ALWAYS(val)
+ #define wxINT32_SWAP_ON_LE(val) wxINT32_SWAP_ALWAYS(val)
+ #define wxUINT32_SWAP_ON_BE(val) (val)
+ #define wxINT32_SWAP_ON_BE(val) (val)
+ #if wxHAS_INT64
+ #define wxUINT64_SWAP_ON_LE(val) wxUINT64_SWAP_ALWAYS(val)
+ #define wxUINT64_SWAP_ON_BE(val) (val)
+ #define wxINT64_SWAP_ON_LE(val) wxINT64_SWAP_ALWAYS(val)
+ #define wxINT64_SWAP_ON_BE(val) (val)
+ #endif
+#endif
+
+/* ---------------------------------------------------------------------------- */
+/* template workarounds for buggy compilers */
+/* ---------------------------------------------------------------------------- */
+
+#if defined(__GNUC__) && !wxCHECK_GCC_VERSION( 3, 4 )
+ /* GCC <= 3.4 has buggy template support */
+# define wxUSE_MEMBER_TEMPLATES 0
+#endif
+
+#if defined(_MSC_VER) && _MSC_VER <= 1200
+ /* MSVC <= 6.0 has buggy template support */
+# define wxUSE_MEMBER_TEMPLATES 0
+# define wxUSE_FUNC_TEMPLATE_POINTER 0
+#endif
+
+#ifndef wxUSE_MEMBER_TEMPLATES
+# define wxUSE_MEMBER_TEMPLATES 1
+#endif
+
+#ifndef wxUSE_FUNC_TEMPLATE_POINTER
+# define wxUSE_FUNC_TEMPLATE_POINTER 1
+#endif
+
+#if wxUSE_MEMBER_TEMPLATES
+# define wxTEMPLATED_MEMBER_CALL( method, type ) method<type>()
+# define wxTEMPLATED_MEMBER_FIX( type )
+#else
+# define wxTEMPLATED_MEMBER_CALL( method, type ) method((type*)NULL)
+# define wxTEMPLATED_MEMBER_FIX( type ) type* =NULL
+#endif
+
+#if defined(_MSC_VER) && _MSC_VER <= 1200
+# define wxTEMPLATED_FUNCTION_FIX( type ), wxTEMPLATED_MEMBER_FIX(type)
+# define wxINFUNC_CLASS_TYPE_FIX( type ) typedef type type;
+#else
+# define wxTEMPLATED_FUNCTION_FIX( type )
+# define wxINFUNC_CLASS_TYPE_FIX( type )
+#endif
+
+/* ---------------------------------------------------------------------------- */
+/* Geometric flags */
+/* ---------------------------------------------------------------------------- */
+
+enum wxGeometryCentre
+{
+ wxCENTRE = 0x0001,
+ wxCENTER = wxCENTRE
+};
+
+/* centering into frame rather than screen (obsolete) */
+#define wxCENTER_FRAME 0x0000
+/* centre on screen rather than parent */
+#define wxCENTRE_ON_SCREEN 0x0002
+#define wxCENTER_ON_SCREEN wxCENTRE_ON_SCREEN
+
+enum wxOrientation
+{
+ /* don't change the values of these elements, they are used elsewhere */
+ wxHORIZONTAL = 0x0004,
+ wxVERTICAL = 0x0008,
+
+ wxBOTH = wxVERTICAL | wxHORIZONTAL,
+
+ /* a mask to extract orientation from the combination of flags */
+ wxORIENTATION_MASK = wxBOTH
+};
+
+enum wxDirection
+{
+ wxLEFT = 0x0010,
+ wxRIGHT = 0x0020,
+ wxUP = 0x0040,
+ wxDOWN = 0x0080,
+
+ wxTOP = wxUP,
+ wxBOTTOM = wxDOWN,
+
+ wxNORTH = wxUP,
+ wxSOUTH = wxDOWN,
+ wxWEST = wxLEFT,
+ wxEAST = wxRIGHT,
+
+ wxALL = (wxUP | wxDOWN | wxRIGHT | wxLEFT),
+
+ /* a mask to extract direction from the combination of flags */
+ wxDIRECTION_MASK = wxALL
+};
+
+enum wxAlignment
+{
+ /*
+ 0 is a valid wxAlignment value (both wxALIGN_LEFT and wxALIGN_TOP
+ use it) so define a symbolic name for an invalid alignment value
+ which can be assumed to be different from anything else
+ */
+ wxALIGN_INVALID = -1,
+
+ wxALIGN_NOT = 0x0000,
+ wxALIGN_CENTER_HORIZONTAL = 0x0100,
+ wxALIGN_CENTRE_HORIZONTAL = wxALIGN_CENTER_HORIZONTAL,
+ wxALIGN_LEFT = wxALIGN_NOT,
+ wxALIGN_TOP = wxALIGN_NOT,
+ wxALIGN_RIGHT = 0x0200,
+ wxALIGN_BOTTOM = 0x0400,
+ wxALIGN_CENTER_VERTICAL = 0x0800,
+ wxALIGN_CENTRE_VERTICAL = wxALIGN_CENTER_VERTICAL,
+
+ wxALIGN_CENTER = (wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL),
+ wxALIGN_CENTRE = wxALIGN_CENTER,
+
+ /* a mask to extract alignment from the combination of flags */
+ wxALIGN_MASK = 0x0f00
+};
+
+/* misc. flags for wxSizer items */
+enum wxSizerFlagBits
+{
+ /*
+ wxADJUST_MINSIZE doesn't do anything any more but we still define
+ it for compatibility. Notice that it may be also predefined (as 0,
+ hopefully) in the user code in order to use it even in
+ !WXWIN_COMPATIBILITY_2_8 builds so don't redefine it in such case.
+ */
+#if WXWIN_COMPATIBILITY_2_8 && !defined(wxADJUST_MINSIZE)
+ wxADJUST_MINSIZE = 0,
+#endif
+ wxFIXED_MINSIZE = 0x8000,
+ wxRESERVE_SPACE_EVEN_IF_HIDDEN = 0x0002,
+
+ /* a mask to extract wxSizerFlagBits from combination of flags */
+ wxSIZER_FLAG_BITS_MASK = 0x8002
+};
+
+enum wxStretch
+{
+ wxSTRETCH_NOT = 0x0000,
+ wxSHRINK = 0x1000,
+ wxGROW = 0x2000,
+ wxEXPAND = wxGROW,
+ wxSHAPED = 0x4000,
+ wxTILE = wxSHAPED | wxFIXED_MINSIZE,
+
+ /* a mask to extract stretch from the combination of flags */
+ wxSTRETCH_MASK = 0x7000 /* sans wxTILE */
+};
+
+/* border flags: the values are chosen for backwards compatibility */
+enum wxBorder
+{
+ /* this is different from wxBORDER_NONE as by default the controls do have */
+ /* border */
+ wxBORDER_DEFAULT = 0,
+
+ wxBORDER_NONE = 0x00200000,
+ wxBORDER_STATIC = 0x01000000,
+ wxBORDER_SIMPLE = 0x02000000,
+ wxBORDER_RAISED = 0x04000000,
+ wxBORDER_SUNKEN = 0x08000000,
+ wxBORDER_DOUBLE = 0x10000000, /* deprecated */
+ wxBORDER_THEME = wxBORDER_DOUBLE,
+
+ /* a mask to extract border style from the combination of flags */
+ wxBORDER_MASK = 0x1f200000
+};
+
+/* This makes it easier to specify a 'normal' border for a control */
+#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
+#define wxDEFAULT_CONTROL_BORDER wxBORDER_SIMPLE
+#else
+#define wxDEFAULT_CONTROL_BORDER wxBORDER_SUNKEN
+#endif
+
+/* ---------------------------------------------------------------------------- */
+/* Window style flags */
+/* ---------------------------------------------------------------------------- */
+
+/*
+ * Values are chosen so they can be |'ed in a bit list.
+ * Some styles are used across more than one group,
+ * so the values mustn't clash with others in the group.
+ * Otherwise, numbers can be reused across groups.
+ */
+
+/*
+ Summary of the bits used by various styles.
+
+ High word, containing styles which can be used with many windows:
+
+ +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+ |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|
+ +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+ | | | | | | | | | | | | | | | |
+ | | | | | | | | | | | | | | | \_ wxFULL_REPAINT_ON_RESIZE
+ | | | | | | | | | | | | | | \____ wxPOPUP_WINDOW
+ | | | | | | | | | | | | | \_______ wxWANTS_CHARS
+ | | | | | | | | | | | | \__________ wxTAB_TRAVERSAL
+ | | | | | | | | | | | \_____________ wxTRANSPARENT_WINDOW
+ | | | | | | | | | | \________________ wxBORDER_NONE
+ | | | | | | | | | \___________________ wxCLIP_CHILDREN
+ | | | | | | | | \______________________ wxALWAYS_SHOW_SB
+ | | | | | | | \_________________________ wxBORDER_STATIC
+ | | | | | | \____________________________ wxBORDER_SIMPLE
+ | | | | | \_______________________________ wxBORDER_RAISED
+ | | | | \__________________________________ wxBORDER_SUNKEN
+ | | | \_____________________________________ wxBORDER_{DOUBLE,THEME}
+ | | \________________________________________ wxCAPTION/wxCLIP_SIBLINGS
+ | \___________________________________________ wxHSCROLL
+ \______________________________________________ wxVSCROLL
+
+
+ Low word style bits is class-specific meaning that the same bit can have
+ different meanings for different controls (e.g. 0x10 is wxCB_READONLY
+ meaning that the control can't be modified for wxComboBox but wxLB_SORT
+ meaning that the control should be kept sorted for wxListBox, while
+ wxLB_SORT has a different value -- and this is just fine).
+ */
+
+/*
+ * Window (Frame/dialog/subwindow/panel item) style flags
+ */
+#define wxVSCROLL 0x80000000
+#define wxHSCROLL 0x40000000
+#define wxCAPTION 0x20000000
+
+/* New styles (border styles are now in their own enum) */
+#define wxDOUBLE_BORDER wxBORDER_DOUBLE
+#define wxSUNKEN_BORDER wxBORDER_SUNKEN
+#define wxRAISED_BORDER wxBORDER_RAISED
+#define wxBORDER wxBORDER_SIMPLE
+#define wxSIMPLE_BORDER wxBORDER_SIMPLE
+#define wxSTATIC_BORDER wxBORDER_STATIC
+#define wxNO_BORDER wxBORDER_NONE
+
+/* wxALWAYS_SHOW_SB: instead of hiding the scrollbar when it is not needed, */
+/* disable it - but still show (see also wxLB_ALWAYS_SB style) */
+/* */
+/* NB: as this style is only supported by wxUniversal and wxMSW so far */
+#define wxALWAYS_SHOW_SB 0x00800000
+
+/* Clip children when painting, which reduces flicker in e.g. frames and */
+/* splitter windows, but can't be used in a panel where a static box must be */
+/* 'transparent' (panel paints the background for it) */
+#define wxCLIP_CHILDREN 0x00400000
+
+/* Note we're reusing the wxCAPTION style because we won't need captions */
+/* for subwindows/controls */
+#define wxCLIP_SIBLINGS 0x20000000
+
+#define wxTRANSPARENT_WINDOW 0x00100000
+
+/* Add this style to a panel to get tab traversal working outside of dialogs */
+/* (on by default for wxPanel, wxDialog, wxScrolledWindow) */
+#define wxTAB_TRAVERSAL 0x00080000
+
+/* Add this style if the control wants to get all keyboard messages (under */
+/* Windows, it won't normally get the dialog navigation key events) */
+#define wxWANTS_CHARS 0x00040000
+
+/* Make window retained (Motif only, see src/generic/scrolwing.cpp)
+ * This is non-zero only under wxMotif, to avoid a clash with wxPOPUP_WINDOW
+ * on other platforms
+ */
+
+#ifdef __WXMOTIF__
+#define wxRETAINED 0x00020000
+#else
+#define wxRETAINED 0x00000000
+#endif
+#define wxBACKINGSTORE wxRETAINED
+
+/* set this flag to create a special popup window: it will be always shown on */
+/* top of other windows, will capture the mouse and will be dismissed when the */
+/* mouse is clicked outside of it or if it loses focus in any other way */
+#define wxPOPUP_WINDOW 0x00020000
+
+/* force a full repaint when the window is resized (instead of repainting just */
+/* the invalidated area) */
+#define wxFULL_REPAINT_ON_RESIZE 0x00010000
+
+/* obsolete: now this is the default behaviour */
+/* */
+/* don't invalidate the whole window (resulting in a PAINT event) when the */
+/* window is resized (currently, makes sense for wxMSW only) */
+#define wxNO_FULL_REPAINT_ON_RESIZE 0
+
+/* A mask which can be used to filter (out) all wxWindow-specific styles.
+ */
+#define wxWINDOW_STYLE_MASK \
+ (wxVSCROLL|wxHSCROLL|wxBORDER_MASK|wxALWAYS_SHOW_SB|wxCLIP_CHILDREN| \
+ wxCLIP_SIBLINGS|wxTRANSPARENT_WINDOW|wxTAB_TRAVERSAL|wxWANTS_CHARS| \
+ wxRETAINED|wxPOPUP_WINDOW|wxFULL_REPAINT_ON_RESIZE)
+
+/*
+ * Extra window style flags (use wxWS_EX prefix to make it clear that they
+ * should be passed to wxWindow::SetExtraStyle(), not SetWindowStyle())
+ */
+
+/* by default, TransferDataTo/FromWindow() only work on direct children of the */
+/* window (compatible behaviour), set this flag to make them recursively */
+/* descend into all subwindows */
+#define wxWS_EX_VALIDATE_RECURSIVELY 0x00000001
+
+/* wxCommandEvents and the objects of the derived classes are forwarded to the */
+/* parent window and so on recursively by default. Using this flag for the */
+/* given window allows to block this propagation at this window, i.e. prevent */
+/* the events from being propagated further upwards. The dialogs have this */
+/* flag on by default. */
+#define wxWS_EX_BLOCK_EVENTS 0x00000002
+
+/* don't use this window as an implicit parent for the other windows: this must */
+/* be used with transient windows as otherwise there is the risk of creating a */
+/* dialog/frame with this window as a parent which would lead to a crash if the */
+/* parent is destroyed before the child */
+#define wxWS_EX_TRANSIENT 0x00000004
+
+/* don't paint the window background, we'll assume it will */
+/* be done by a theming engine. This is not yet used but could */
+/* possibly be made to work in the future, at least on Windows */
+#define wxWS_EX_THEMED_BACKGROUND 0x00000008
+
+/* this window should always process idle events */
+#define wxWS_EX_PROCESS_IDLE 0x00000010
+
+/* this window should always process UI update events */
+#define wxWS_EX_PROCESS_UI_UPDATES 0x00000020
+
+/* Draw the window in a metal theme on Mac */
+#define wxFRAME_EX_METAL 0x00000040
+#define wxDIALOG_EX_METAL 0x00000040
+
+/* Use this style to add a context-sensitive help to the window (currently for */
+/* Win32 only and it doesn't work if wxMINIMIZE_BOX or wxMAXIMIZE_BOX are used) */
+#define wxWS_EX_CONTEXTHELP 0x00000080
+
+/* synonyms for wxWS_EX_CONTEXTHELP for compatibility */
+#define wxFRAME_EX_CONTEXTHELP wxWS_EX_CONTEXTHELP
+#define wxDIALOG_EX_CONTEXTHELP wxWS_EX_CONTEXTHELP
+
+/* Create a window which is attachable to another top level window */
+#define wxFRAME_DRAWER 0x0020
+
+/*
+ * MDI parent frame style flags
+ * Can overlap with some of the above.
+ */
+
+#define wxFRAME_NO_WINDOW_MENU 0x0100
+
+/*
+ * wxMenuBar style flags
+ */
+/* use native docking */
+#define wxMB_DOCKABLE 0x0001
+
+/*
+ * wxMenu style flags
+ */
+#define wxMENU_TEAROFF 0x0001
+
+/*
+ * Apply to all panel items
+ */
+#define wxCOLOURED 0x0800
+#define wxFIXED_LENGTH 0x0400
+
+/*
+ * Styles for wxListBox
+ */
+#define wxLB_SORT 0x0010
+#define wxLB_SINGLE 0x0020
+#define wxLB_MULTIPLE 0x0040
+#define wxLB_EXTENDED 0x0080
+/* wxLB_OWNERDRAW is Windows-only */
+#define wxLB_NEEDED_SB 0x0000
+#define wxLB_OWNERDRAW 0x0100
+#define wxLB_ALWAYS_SB 0x0200
+#define wxLB_NO_SB 0x0400
+#define wxLB_HSCROLL wxHSCROLL
+/* always show an entire number of rows */
+#define wxLB_INT_HEIGHT 0x0800
+
+#if WXWIN_COMPATIBILITY_2_6
+ /* deprecated synonyms */
+ #define wxPROCESS_ENTER 0x0400 /* wxTE_PROCESS_ENTER */
+ #define wxPASSWORD 0x0800 /* wxTE_PASSWORD */
+#endif
+
+/*
+ * wxComboBox style flags
+ */
+#define wxCB_SIMPLE 0x0004
+#define wxCB_SORT 0x0008
+#define wxCB_READONLY 0x0010
+#define wxCB_DROPDOWN 0x0020
+
+/*
+ * wxRadioBox style flags
+ */
+/* should we number the items from left to right or from top to bottom in a 2d */
+/* radiobox? */
+#define wxRA_LEFTTORIGHT 0x0001
+#define wxRA_TOPTOBOTTOM 0x0002
+
+/* New, more intuitive names to specify majorDim argument */
+#define wxRA_SPECIFY_COLS wxHORIZONTAL
+#define wxRA_SPECIFY_ROWS wxVERTICAL
+
+/* Old names for compatibility */
+#define wxRA_HORIZONTAL wxHORIZONTAL
+#define wxRA_VERTICAL wxVERTICAL
+
+/*
+ * wxRadioButton style flag
+ */
+#define wxRB_GROUP 0x0004
+#define wxRB_SINGLE 0x0008
+
+/*
+ * wxScrollBar flags
+ */
+#define wxSB_HORIZONTAL wxHORIZONTAL
+#define wxSB_VERTICAL wxVERTICAL
+
+/*
+ * wxSpinButton flags.
+ * Note that a wxSpinCtrl is sometimes defined as a wxTextCtrl, and so the
+ * flags shouldn't overlap with wxTextCtrl flags that can be used for a single
+ * line controls (currently we reuse wxTE_CHARWRAP and wxTE_RICH2 neither of
+ * which makes sense for them).
+ */
+#define wxSP_HORIZONTAL wxHORIZONTAL /* 4 */
+#define wxSP_VERTICAL wxVERTICAL /* 8 */
+#define wxSP_ARROW_KEYS 0x4000
+#define wxSP_WRAP 0x8000
+
+/*
+ * wxTabCtrl flags
+ */
+#define wxTC_RIGHTJUSTIFY 0x0010
+#define wxTC_FIXEDWIDTH 0x0020
+#define wxTC_TOP 0x0000 /* default */
+#define wxTC_LEFT 0x0020
+#define wxTC_RIGHT 0x0040
+#define wxTC_BOTTOM 0x0080
+#define wxTC_MULTILINE 0x0200 /* == wxNB_MULTILINE */
+#define wxTC_OWNERDRAW 0x0400
+
+/*
+ * wxStaticBitmap flags
+ */
+#define wxBI_EXPAND wxEXPAND
+
+/*
+ * wxStaticLine flags
+ */
+#define wxLI_HORIZONTAL wxHORIZONTAL
+#define wxLI_VERTICAL wxVERTICAL
+
+
+/*
+ * extended dialog specifiers. these values are stored in a different
+ * flag and thus do not overlap with other style flags. note that these
+ * values do not correspond to the return values of the dialogs (for
+ * those values, look at the wxID_XXX defines).
+ */
+
+/* wxCENTRE already defined as 0x00000001 */
+#define wxYES 0x00000002
+#define wxOK 0x00000004
+#define wxNO 0x00000008
+#define wxYES_NO (wxYES | wxNO)
+#define wxCANCEL 0x00000010
+#define wxAPPLY 0x00000020
+#define wxCLOSE 0x00000040
+
+#define wxOK_DEFAULT 0x00000000 /* has no effect (default) */
+#define wxYES_DEFAULT 0x00000000 /* has no effect (default) */
+#define wxNO_DEFAULT 0x00000080 /* only valid with wxYES_NO */
+#define wxCANCEL_DEFAULT 0x80000000 /* only valid with wxCANCEL */
+
+#define wxICON_EXCLAMATION 0x00000100
+#define wxICON_HAND 0x00000200
+#define wxICON_WARNING wxICON_EXCLAMATION
+#define wxICON_ERROR wxICON_HAND
+#define wxICON_QUESTION 0x00000400
+#define wxICON_INFORMATION 0x00000800
+#define wxICON_STOP wxICON_HAND
+#define wxICON_ASTERISK wxICON_INFORMATION
+
+#define wxHELP 0x00001000
+#define wxFORWARD 0x00002000
+#define wxBACKWARD 0x00004000
+#define wxRESET 0x00008000
+#define wxMORE 0x00010000
+#define wxSETUP 0x00020000
+#define wxICON_NONE 0x00040000
+#define wxICON_AUTH_NEEDED 0x00080000
+
+#define wxICON_MASK \
+ (wxICON_EXCLAMATION|wxICON_HAND|wxICON_QUESTION|wxICON_INFORMATION|wxICON_NONE|wxICON_AUTH_NEEDED)
+
+/*
+ * Background styles. See wxWindow::SetBackgroundStyle
+ */
+enum wxBackgroundStyle
+{
+ /*
+ background is erased in the EVT_ERASE_BACKGROUND handler or using
+ the system default background if no such handler is defined (this
+ is the default style)
+ */
+ wxBG_STYLE_ERASE,
+
+ /*
+ background is erased by the system, no EVT_ERASE_BACKGROUND event
+ is generated at all
+ */
+ wxBG_STYLE_SYSTEM,
+
+ /*
+ background is erased in EVT_PAINT handler and not erased at all
+ before it, this should be used if the paint handler paints over
+ the entire window to avoid flicker
+ */
+ wxBG_STYLE_PAINT,
+
+
+ /* this is a Mac-only style, don't use in portable code */
+ wxBG_STYLE_TRANSPARENT,
+
+ /* this style is deprecated and doesn't do anything, don't use */
+ wxBG_STYLE_COLOUR,
+
+ /*
+ this style is deprecated and is synonymous with
+ wxBG_STYLE_PAINT, use the new name
+ */
+ wxBG_STYLE_CUSTOM = wxBG_STYLE_PAINT
+};
+
+/*
+ * Key types used by (old style) lists and hashes.
+ */
+enum wxKeyType
+{
+ wxKEY_NONE,
+ wxKEY_INTEGER,
+ wxKEY_STRING
+};
+
+/* ---------------------------------------------------------------------------- */
+/* standard IDs */
+/* ---------------------------------------------------------------------------- */
+
+/* Standard menu IDs */
+enum wxStandardID
+{
+ /*
+ These ids delimit the range used by automatically-generated ids
+ (i.e. those used when wxID_ANY is specified during construction).
+ */
+#if defined(__WXMSW__) || wxUSE_AUTOID_MANAGEMENT
+ /*
+ On MSW the range is always restricted no matter if id management
+ is used or not because the native window ids are limited to short
+ range. On other platforms the range is only restricted if id
+ management is used so the reference count buffer won't be so big.
+ */
+ wxID_AUTO_LOWEST = -32000,
+ wxID_AUTO_HIGHEST = -2000,
+#else
+ wxID_AUTO_LOWEST = -1000000,
+ wxID_AUTO_HIGHEST = -2000,
+#endif
+
+ /* no id matches this one when compared to it */
+ wxID_NONE = -3,
+
+ /* id for a separator line in the menu (invalid for normal item) */
+ wxID_SEPARATOR = -2,
+
+ /* any id: means that we don't care about the id, whether when installing
+ * an event handler or when creating a new window */
+ wxID_ANY = -1,
+
+
+ /* all predefined ids are between wxID_LOWEST and wxID_HIGHEST */
+ wxID_LOWEST = 4999,
+
+ wxID_OPEN,
+ wxID_CLOSE,
+ wxID_NEW,
+ wxID_SAVE,
+ wxID_SAVEAS,
+ wxID_REVERT,
+ wxID_EXIT,
+ wxID_UNDO,
+ wxID_REDO,
+ wxID_HELP,
+ wxID_PRINT,
+ wxID_PRINT_SETUP,
+ wxID_PAGE_SETUP,
+ wxID_PREVIEW,
+ wxID_ABOUT,
+ wxID_HELP_CONTENTS,
+ wxID_HELP_INDEX,
+ wxID_HELP_SEARCH,
+ wxID_HELP_COMMANDS,
+ wxID_HELP_PROCEDURES,
+ wxID_HELP_CONTEXT,
+ wxID_CLOSE_ALL,
+ wxID_PREFERENCES,
+
+ wxID_EDIT = 5030,
+ wxID_CUT,
+ wxID_COPY,
+ wxID_PASTE,
+ wxID_CLEAR,
+ wxID_FIND,
+ wxID_DUPLICATE,
+ wxID_SELECTALL,
+ wxID_DELETE,
+ wxID_REPLACE,
+ wxID_REPLACE_ALL,
+ wxID_PROPERTIES,
+
+ wxID_VIEW_DETAILS,
+ wxID_VIEW_LARGEICONS,
+ wxID_VIEW_SMALLICONS,
+ wxID_VIEW_LIST,
+ wxID_VIEW_SORTDATE,
+ wxID_VIEW_SORTNAME,
+ wxID_VIEW_SORTSIZE,
+ wxID_VIEW_SORTTYPE,
+
+ wxID_FILE = 5050,
+ wxID_FILE1,
+ wxID_FILE2,
+ wxID_FILE3,
+ wxID_FILE4,
+ wxID_FILE5,
+ wxID_FILE6,
+ wxID_FILE7,
+ wxID_FILE8,
+ wxID_FILE9,
+
+ /* Standard button and menu IDs */
+ wxID_OK = 5100,
+ wxID_CANCEL,
+ wxID_APPLY,
+ wxID_YES,
+ wxID_NO,
+ wxID_STATIC,
+ wxID_FORWARD,
+ wxID_BACKWARD,
+ wxID_DEFAULT,
+ wxID_MORE,
+ wxID_SETUP,
+ wxID_RESET,
+ wxID_CONTEXT_HELP,
+ wxID_YESTOALL,
+ wxID_NOTOALL,
+ wxID_ABORT,
+ wxID_RETRY,
+ wxID_IGNORE,
+ wxID_ADD,
+ wxID_REMOVE,
+
+ wxID_UP,
+ wxID_DOWN,
+ wxID_HOME,
+ wxID_REFRESH,
+ wxID_STOP,
+ wxID_INDEX,
+
+ wxID_BOLD,
+ wxID_ITALIC,
+ wxID_JUSTIFY_CENTER,
+ wxID_JUSTIFY_FILL,
+ wxID_JUSTIFY_RIGHT,
+ wxID_JUSTIFY_LEFT,
+ wxID_UNDERLINE,
+ wxID_INDENT,
+ wxID_UNINDENT,
+ wxID_ZOOM_100,
+ wxID_ZOOM_FIT,
+ wxID_ZOOM_IN,
+ wxID_ZOOM_OUT,
+ wxID_UNDELETE,
+ wxID_REVERT_TO_SAVED,
+ wxID_CDROM,
+ wxID_CONVERT,
+ wxID_EXECUTE,
+ wxID_FLOPPY,
+ wxID_HARDDISK,
+ wxID_BOTTOM,
+ wxID_FIRST,
+ wxID_LAST,
+ wxID_TOP,
+ wxID_INFO,
+ wxID_JUMP_TO,
+ wxID_NETWORK,
+ wxID_SELECT_COLOR,
+ wxID_SELECT_FONT,
+ wxID_SORT_ASCENDING,
+ wxID_SORT_DESCENDING,
+ wxID_SPELL_CHECK,
+ wxID_STRIKETHROUGH,
+
+ /* System menu IDs (used by wxUniv): */
+ wxID_SYSTEM_MENU = 5200,
+ wxID_CLOSE_FRAME,
+ wxID_MOVE_FRAME,
+ wxID_RESIZE_FRAME,
+ wxID_MAXIMIZE_FRAME,
+ wxID_ICONIZE_FRAME,
+ wxID_RESTORE_FRAME,
+
+ /* MDI window menu ids */
+ wxID_MDI_WINDOW_FIRST = 5230,
+ wxID_MDI_WINDOW_CASCADE = wxID_MDI_WINDOW_FIRST,
+ wxID_MDI_WINDOW_TILE_HORZ,
+ wxID_MDI_WINDOW_TILE_VERT,
+ wxID_MDI_WINDOW_ARRANGE_ICONS,
+ wxID_MDI_WINDOW_PREV,
+ wxID_MDI_WINDOW_NEXT,
+ wxID_MDI_WINDOW_LAST = wxID_MDI_WINDOW_NEXT,
+
+ /* OS X system menu ids */
+ wxID_OSX_MENU_FIRST = 5250,
+ wxID_OSX_HIDE = wxID_OSX_MENU_FIRST,
+ wxID_OSX_HIDEOTHERS,
+ wxID_OSX_SHOWALL,
+ wxID_OSX_MENU_LAST = wxID_OSX_SHOWALL,
+
+ /* IDs used by generic file dialog (13 consecutive starting from this value) */
+ wxID_FILEDLGG = 5900,
+
+ /* IDs used by generic file ctrl (4 consecutive starting from this value) */
+ wxID_FILECTRL = 5950,
+
+ wxID_HIGHEST = 5999
+};
+
+/* ---------------------------------------------------------------------------- */
+/* wxWindowID type (after wxID_XYZ enum, platform detection, and dlimpexp.h) */
+/* ---------------------------------------------------------------------------- */
+
+/* special care should be taken with this type under Windows where the real */
+/* window id is unsigned, so we must always do the cast before comparing them */
+/* (or else they would be always different!). Using wxGetWindowId() which does */
+/* the cast itself is recommended. Note that this type can't be unsigned */
+/* because wxID_ANY == -1 is a valid (and largely used) value for window id. */
+#if defined(__cplusplus) && wxUSE_GUI
+ #include "wx/windowid.h"
+#endif
+
+/* ---------------------------------------------------------------------------- */
+/* other constants */
+/* ---------------------------------------------------------------------------- */
+
+/* menu and toolbar item kinds */
+enum wxItemKind
+{
+ wxITEM_SEPARATOR = -1,
+ wxITEM_NORMAL,
+ wxITEM_CHECK,
+ wxITEM_RADIO,
+ wxITEM_DROPDOWN,
+ wxITEM_MAX
+};
+
+/*
+ * The possible states of a 3-state checkbox (Compatible
+ * with the 2-state checkbox).
+ */
+enum wxCheckBoxState
+{
+ wxCHK_UNCHECKED,
+ wxCHK_CHECKED,
+ wxCHK_UNDETERMINED /* 3-state checkbox only */
+};
+
+
+/* hit test results */
+enum wxHitTest
+{
+ wxHT_NOWHERE,
+
+ /* scrollbar */
+ wxHT_SCROLLBAR_FIRST = wxHT_NOWHERE,
+ wxHT_SCROLLBAR_ARROW_LINE_1, /* left or upper arrow to scroll by line */
+ wxHT_SCROLLBAR_ARROW_LINE_2, /* right or down */
+ wxHT_SCROLLBAR_ARROW_PAGE_1, /* left or upper arrow to scroll by page */
+ wxHT_SCROLLBAR_ARROW_PAGE_2, /* right or down */
+ wxHT_SCROLLBAR_THUMB, /* on the thumb */
+ wxHT_SCROLLBAR_BAR_1, /* bar to the left/above the thumb */
+ wxHT_SCROLLBAR_BAR_2, /* bar to the right/below the thumb */
+ wxHT_SCROLLBAR_LAST,
+
+ /* window */
+ wxHT_WINDOW_OUTSIDE, /* not in this window at all */
+ wxHT_WINDOW_INSIDE, /* in the client area */
+ wxHT_WINDOW_VERT_SCROLLBAR, /* on the vertical scrollbar */
+ wxHT_WINDOW_HORZ_SCROLLBAR, /* on the horizontal scrollbar */
+ wxHT_WINDOW_CORNER, /* on the corner between 2 scrollbars */
+
+ wxHT_MAX
+};
+
+/* ---------------------------------------------------------------------------- */
+/* Possible SetSize flags */
+/* ---------------------------------------------------------------------------- */
+
+/* Use internally-calculated width if -1 */
+#define wxSIZE_AUTO_WIDTH 0x0001
+/* Use internally-calculated height if -1 */
+#define wxSIZE_AUTO_HEIGHT 0x0002
+/* Use internally-calculated width and height if each is -1 */
+#define wxSIZE_AUTO (wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT)
+/* Ignore missing (-1) dimensions (use existing). */
+/* For readability only: test for wxSIZE_AUTO_WIDTH/HEIGHT in code. */
+#define wxSIZE_USE_EXISTING 0x0000
+/* Allow -1 as a valid position */
+#define wxSIZE_ALLOW_MINUS_ONE 0x0004
+/* Don't do parent client adjustments (for implementation only) */
+#define wxSIZE_NO_ADJUSTMENTS 0x0008
+/* Change the window position even if it seems to be already correct */
+#define wxSIZE_FORCE 0x0010
+/* Emit size event even if size didn't change */
+#define wxSIZE_FORCE_EVENT 0x0020
+
+/* ---------------------------------------------------------------------------- */
+/* GDI descriptions */
+/* ---------------------------------------------------------------------------- */
+
+// Hatch styles used by both pen and brush styles.
+//
+// NB: Do not use these constants directly, they're for internal use only, use
+// wxBRUSHSTYLE_XXX_HATCH and wxPENSTYLE_XXX_HATCH instead.
+enum wxHatchStyle
+{
+ wxHATCHSTYLE_INVALID = -1,
+
+ /*
+ The value of the first style is chosen to fit with
+ wxDeprecatedGUIConstants values below, don't change it.
+ */
+ wxHATCHSTYLE_FIRST = 111,
+ wxHATCHSTYLE_BDIAGONAL = wxHATCHSTYLE_FIRST,
+ wxHATCHSTYLE_CROSSDIAG,
+ wxHATCHSTYLE_FDIAGONAL,
+ wxHATCHSTYLE_CROSS,
+ wxHATCHSTYLE_HORIZONTAL,
+ wxHATCHSTYLE_VERTICAL,
+ wxHATCHSTYLE_LAST = wxHATCHSTYLE_VERTICAL
+};
+
+/*
+ WARNING: the following styles are deprecated; use the
+ wxFontFamily, wxFontStyle, wxFontWeight, wxBrushStyle,
+ wxPenStyle, wxPenCap, wxPenJoin enum values instead!
+*/
+
+#if FUTURE_WXWIN_COMPATIBILITY_3_0
+
+/* don't use any elements of this enum in the new code */
+enum wxDeprecatedGUIConstants
+{
+ /* Text font families */
+ wxDEFAULT = 70,
+ wxDECORATIVE,
+ wxROMAN,
+ wxSCRIPT,
+ wxSWISS,
+ wxMODERN,
+ wxTELETYPE, /* @@@@ */
+
+ /* Proportional or Fixed width fonts (not yet used) */
+ wxVARIABLE = 80,
+ wxFIXED,
+
+ wxNORMAL = 90,
+ wxLIGHT,
+ wxBOLD,
+ /* Also wxNORMAL for normal (non-italic text) */
+ wxITALIC,
+ wxSLANT,
+
+ /* Pen styles */
+ wxSOLID = 100,
+ wxDOT,
+ wxLONG_DASH,
+ wxSHORT_DASH,
+ wxDOT_DASH,
+ wxUSER_DASH,
+
+ wxTRANSPARENT,
+
+ /* Brush & Pen Stippling. Note that a stippled pen cannot be dashed!! */
+ /* Note also that stippling a Pen IS meaningful, because a Line is */
+ wxSTIPPLE_MASK_OPAQUE, /* mask is used for blitting monochrome using text fore and back ground colors */
+ wxSTIPPLE_MASK, /* mask is used for masking areas in the stipple bitmap (TO DO) */
+ /* drawn with a Pen, and without any Brush -- and it can be stippled. */
+ wxSTIPPLE = 110,
+
+ wxBDIAGONAL_HATCH = wxHATCHSTYLE_BDIAGONAL,
+ wxCROSSDIAG_HATCH = wxHATCHSTYLE_CROSSDIAG,
+ wxFDIAGONAL_HATCH = wxHATCHSTYLE_FDIAGONAL,
+ wxCROSS_HATCH = wxHATCHSTYLE_CROSS,
+ wxHORIZONTAL_HATCH = wxHATCHSTYLE_HORIZONTAL,
+ wxVERTICAL_HATCH = wxHATCHSTYLE_VERTICAL,
+ wxFIRST_HATCH = wxHATCHSTYLE_FIRST,
+ wxLAST_HATCH = wxHATCHSTYLE_LAST
+};
+#endif
+
+/* ToolPanel in wxFrame (VZ: unused?) */
+enum
+{
+ wxTOOL_TOP = 1,
+ wxTOOL_BOTTOM,
+ wxTOOL_LEFT,
+ wxTOOL_RIGHT
+};
+
+/* the values of the format constants should be the same as corresponding */
+/* CF_XXX constants in Windows API */
+enum wxDataFormatId
+{
+ wxDF_INVALID = 0,
+ wxDF_TEXT = 1, /* CF_TEXT */
+ wxDF_BITMAP = 2, /* CF_BITMAP */
+ wxDF_METAFILE = 3, /* CF_METAFILEPICT */
+ wxDF_SYLK = 4,
+ wxDF_DIF = 5,
+ wxDF_TIFF = 6,
+ wxDF_OEMTEXT = 7, /* CF_OEMTEXT */
+ wxDF_DIB = 8, /* CF_DIB */
+ wxDF_PALETTE = 9,
+ wxDF_PENDATA = 10,
+ wxDF_RIFF = 11,
+ wxDF_WAVE = 12,
+ wxDF_UNICODETEXT = 13,
+ wxDF_ENHMETAFILE = 14,
+ wxDF_FILENAME = 15, /* CF_HDROP */
+ wxDF_LOCALE = 16,
+ wxDF_PRIVATE = 20,
+ wxDF_HTML = 30, /* Note: does not correspond to CF_ constant */
+ wxDF_MAX
+};
+
+/* Key codes */
+enum wxKeyCode
+{
+ WXK_NONE = 0,
+
+ WXK_CONTROL_A = 1,
+ WXK_CONTROL_B,
+ WXK_CONTROL_C,
+ WXK_CONTROL_D,
+ WXK_CONTROL_E,
+ WXK_CONTROL_F,
+ WXK_CONTROL_G,
+ WXK_CONTROL_H,
+ WXK_CONTROL_I,
+ WXK_CONTROL_J,
+ WXK_CONTROL_K,
+ WXK_CONTROL_L,
+ WXK_CONTROL_M,
+ WXK_CONTROL_N,
+ WXK_CONTROL_O,
+ WXK_CONTROL_P,
+ WXK_CONTROL_Q,
+ WXK_CONTROL_R,
+ WXK_CONTROL_S,
+ WXK_CONTROL_T,
+ WXK_CONTROL_U,
+ WXK_CONTROL_V,
+ WXK_CONTROL_W,
+ WXK_CONTROL_X,
+ WXK_CONTROL_Y,
+ WXK_CONTROL_Z,
+
+ WXK_BACK = 8, /* backspace */
+ WXK_TAB = 9,
+ WXK_RETURN = 13,
+ WXK_ESCAPE = 27,
+
+ /* values from 33 to 126 are reserved for the standard ASCII characters */
+
+ WXK_SPACE = 32,
+ WXK_DELETE = 127,
+
+ /* values from 128 to 255 are reserved for ASCII extended characters
+ (note that there isn't a single fixed standard for the meaning
+ of these values; avoid them in portable apps!) */
+
+ /* These are not compatible with unicode characters.
+ If you want to get a unicode character from a key event, use
+ wxKeyEvent::GetUnicodeKey */
+ WXK_START = 300,
+ WXK_LBUTTON,
+ WXK_RBUTTON,
+ WXK_CANCEL,
+ WXK_MBUTTON,
+ WXK_CLEAR,
+ WXK_SHIFT,
+ WXK_ALT,
+ WXK_CONTROL,
+ WXK_MENU,
+ WXK_PAUSE,
+ WXK_CAPITAL,
+ WXK_END,
+ WXK_HOME,
+ WXK_LEFT,
+ WXK_UP,
+ WXK_RIGHT,
+ WXK_DOWN,
+ WXK_SELECT,
+ WXK_PRINT,
+ WXK_EXECUTE,
+ WXK_SNAPSHOT,
+ WXK_INSERT,
+ WXK_HELP,
+ WXK_NUMPAD0,
+ WXK_NUMPAD1,
+ WXK_NUMPAD2,
+ WXK_NUMPAD3,
+ WXK_NUMPAD4,
+ WXK_NUMPAD5,
+ WXK_NUMPAD6,
+ WXK_NUMPAD7,
+ WXK_NUMPAD8,
+ WXK_NUMPAD9,
+ WXK_MULTIPLY,
+ WXK_ADD,
+ WXK_SEPARATOR,
+ WXK_SUBTRACT,
+ WXK_DECIMAL,
+ WXK_DIVIDE,
+ WXK_F1,
+ WXK_F2,
+ WXK_F3,
+ WXK_F4,
+ WXK_F5,
+ WXK_F6,
+ WXK_F7,
+ WXK_F8,
+ WXK_F9,
+ WXK_F10,
+ WXK_F11,
+ WXK_F12,
+ WXK_F13,
+ WXK_F14,
+ WXK_F15,
+ WXK_F16,
+ WXK_F17,
+ WXK_F18,
+ WXK_F19,
+ WXK_F20,
+ WXK_F21,
+ WXK_F22,
+ WXK_F23,
+ WXK_F24,
+ WXK_NUMLOCK,
+ WXK_SCROLL,
+ WXK_PAGEUP,
+ WXK_PAGEDOWN,
+#if WXWIN_COMPATIBILITY_2_6
+ WXK_PRIOR = WXK_PAGEUP,
+ WXK_NEXT = WXK_PAGEDOWN,
+#endif
+
+ WXK_NUMPAD_SPACE,
+ WXK_NUMPAD_TAB,
+ WXK_NUMPAD_ENTER,
+ WXK_NUMPAD_F1,
+ WXK_NUMPAD_F2,
+ WXK_NUMPAD_F3,
+ WXK_NUMPAD_F4,
+ WXK_NUMPAD_HOME,
+ WXK_NUMPAD_LEFT,
+ WXK_NUMPAD_UP,
+ WXK_NUMPAD_RIGHT,
+ WXK_NUMPAD_DOWN,
+ WXK_NUMPAD_PAGEUP,
+ WXK_NUMPAD_PAGEDOWN,
+#if WXWIN_COMPATIBILITY_2_6
+ WXK_NUMPAD_PRIOR = WXK_NUMPAD_PAGEUP,
+ WXK_NUMPAD_NEXT = WXK_NUMPAD_PAGEDOWN,
+#endif
+ WXK_NUMPAD_END,
+ WXK_NUMPAD_BEGIN,
+ WXK_NUMPAD_INSERT,
+ WXK_NUMPAD_DELETE,
+ WXK_NUMPAD_EQUAL,
+ WXK_NUMPAD_MULTIPLY,
+ WXK_NUMPAD_ADD,
+ WXK_NUMPAD_SEPARATOR,
+ WXK_NUMPAD_SUBTRACT,
+ WXK_NUMPAD_DECIMAL,
+ WXK_NUMPAD_DIVIDE,
+
+ WXK_WINDOWS_LEFT,
+ WXK_WINDOWS_RIGHT,
+ WXK_WINDOWS_MENU ,
+#ifdef __WXOSX__
+ WXK_RAW_CONTROL,
+#else
+ WXK_RAW_CONTROL = WXK_CONTROL,
+#endif
+ WXK_COMMAND = WXK_CONTROL,
+
+ /* Hardware-specific buttons */
+ WXK_SPECIAL1 = 193,
+ WXK_SPECIAL2,
+ WXK_SPECIAL3,
+ WXK_SPECIAL4,
+ WXK_SPECIAL5,
+ WXK_SPECIAL6,
+ WXK_SPECIAL7,
+ WXK_SPECIAL8,
+ WXK_SPECIAL9,
+ WXK_SPECIAL10,
+ WXK_SPECIAL11,
+ WXK_SPECIAL12,
+ WXK_SPECIAL13,
+ WXK_SPECIAL14,
+ WXK_SPECIAL15,
+ WXK_SPECIAL16,
+ WXK_SPECIAL17,
+ WXK_SPECIAL18,
+ WXK_SPECIAL19,
+ WXK_SPECIAL20
+};
+
+/* This enum contains bit mask constants used in wxKeyEvent */
+enum wxKeyModifier
+{
+ wxMOD_NONE = 0x0000,
+ wxMOD_ALT = 0x0001,
+ wxMOD_CONTROL = 0x0002,
+ wxMOD_ALTGR = wxMOD_ALT | wxMOD_CONTROL,
+ wxMOD_SHIFT = 0x0004,
+ wxMOD_META = 0x0008,
+ wxMOD_WIN = wxMOD_META,
+#if defined(__WXMAC__) || defined(__WXCOCOA__)
+ wxMOD_RAW_CONTROL = 0x0010,
+#else
+ wxMOD_RAW_CONTROL = wxMOD_CONTROL,
+#endif
+ wxMOD_CMD = wxMOD_CONTROL,
+ wxMOD_ALL = 0xffff
+};
+
+/* Shortcut for easier dialog-unit-to-pixel conversion */
+#define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt)
+
+/* Paper types */
+typedef enum
+{
+ wxPAPER_NONE, /* Use specific dimensions */
+ wxPAPER_LETTER, /* Letter, 8 1/2 by 11 inches */
+ wxPAPER_LEGAL, /* Legal, 8 1/2 by 14 inches */
+ wxPAPER_A4, /* A4 Sheet, 210 by 297 millimeters */
+ wxPAPER_CSHEET, /* C Sheet, 17 by 22 inches */
+ wxPAPER_DSHEET, /* D Sheet, 22 by 34 inches */
+ wxPAPER_ESHEET, /* E Sheet, 34 by 44 inches */
+ wxPAPER_LETTERSMALL, /* Letter Small, 8 1/2 by 11 inches */
+ wxPAPER_TABLOID, /* Tabloid, 11 by 17 inches */
+ wxPAPER_LEDGER, /* Ledger, 17 by 11 inches */
+ wxPAPER_STATEMENT, /* Statement, 5 1/2 by 8 1/2 inches */
+ wxPAPER_EXECUTIVE, /* Executive, 7 1/4 by 10 1/2 inches */
+ wxPAPER_A3, /* A3 sheet, 297 by 420 millimeters */
+ wxPAPER_A4SMALL, /* A4 small sheet, 210 by 297 millimeters */
+ wxPAPER_A5, /* A5 sheet, 148 by 210 millimeters */
+ wxPAPER_B4, /* B4 sheet, 250 by 354 millimeters */
+ wxPAPER_B5, /* B5 sheet, 182-by-257-millimeter paper */
+ wxPAPER_FOLIO, /* Folio, 8-1/2-by-13-inch paper */
+ wxPAPER_QUARTO, /* Quarto, 215-by-275-millimeter paper */
+ wxPAPER_10X14, /* 10-by-14-inch sheet */
+ wxPAPER_11X17, /* 11-by-17-inch sheet */
+ wxPAPER_NOTE, /* Note, 8 1/2 by 11 inches */
+ wxPAPER_ENV_9, /* #9 Envelope, 3 7/8 by 8 7/8 inches */
+ wxPAPER_ENV_10, /* #10 Envelope, 4 1/8 by 9 1/2 inches */
+ wxPAPER_ENV_11, /* #11 Envelope, 4 1/2 by 10 3/8 inches */
+ wxPAPER_ENV_12, /* #12 Envelope, 4 3/4 by 11 inches */
+ wxPAPER_ENV_14, /* #14 Envelope, 5 by 11 1/2 inches */
+ wxPAPER_ENV_DL, /* DL Envelope, 110 by 220 millimeters */
+ wxPAPER_ENV_C5, /* C5 Envelope, 162 by 229 millimeters */
+ wxPAPER_ENV_C3, /* C3 Envelope, 324 by 458 millimeters */
+ wxPAPER_ENV_C4, /* C4 Envelope, 229 by 324 millimeters */
+ wxPAPER_ENV_C6, /* C6 Envelope, 114 by 162 millimeters */
+ wxPAPER_ENV_C65, /* C65 Envelope, 114 by 229 millimeters */
+ wxPAPER_ENV_B4, /* B4 Envelope, 250 by 353 millimeters */
+ wxPAPER_ENV_B5, /* B5 Envelope, 176 by 250 millimeters */
+ wxPAPER_ENV_B6, /* B6 Envelope, 176 by 125 millimeters */
+ wxPAPER_ENV_ITALY, /* Italy Envelope, 110 by 230 millimeters */
+ wxPAPER_ENV_MONARCH, /* Monarch Envelope, 3 7/8 by 7 1/2 inches */
+ wxPAPER_ENV_PERSONAL, /* 6 3/4 Envelope, 3 5/8 by 6 1/2 inches */
+ wxPAPER_FANFOLD_US, /* US Std Fanfold, 14 7/8 by 11 inches */
+ wxPAPER_FANFOLD_STD_GERMAN, /* German Std Fanfold, 8 1/2 by 12 inches */
+ wxPAPER_FANFOLD_LGL_GERMAN, /* German Legal Fanfold, 8 1/2 by 13 inches */
+
+ wxPAPER_ISO_B4, /* B4 (ISO) 250 x 353 mm */
+ wxPAPER_JAPANESE_POSTCARD, /* Japanese Postcard 100 x 148 mm */
+ wxPAPER_9X11, /* 9 x 11 in */
+ wxPAPER_10X11, /* 10 x 11 in */
+ wxPAPER_15X11, /* 15 x 11 in */
+ wxPAPER_ENV_INVITE, /* Envelope Invite 220 x 220 mm */
+ wxPAPER_LETTER_EXTRA, /* Letter Extra 9 \275 x 12 in */
+ wxPAPER_LEGAL_EXTRA, /* Legal Extra 9 \275 x 15 in */
+ wxPAPER_TABLOID_EXTRA, /* Tabloid Extra 11.69 x 18 in */
+ wxPAPER_A4_EXTRA, /* A4 Extra 9.27 x 12.69 in */
+ wxPAPER_LETTER_TRANSVERSE, /* Letter Transverse 8 \275 x 11 in */
+ wxPAPER_A4_TRANSVERSE, /* A4 Transverse 210 x 297 mm */
+ wxPAPER_LETTER_EXTRA_TRANSVERSE, /* Letter Extra Transverse 9\275 x 12 in */
+ wxPAPER_A_PLUS, /* SuperA/SuperA/A4 227 x 356 mm */
+ wxPAPER_B_PLUS, /* SuperB/SuperB/A3 305 x 487 mm */
+ wxPAPER_LETTER_PLUS, /* Letter Plus 8.5 x 12.69 in */
+ wxPAPER_A4_PLUS, /* A4 Plus 210 x 330 mm */
+ wxPAPER_A5_TRANSVERSE, /* A5 Transverse 148 x 210 mm */
+ wxPAPER_B5_TRANSVERSE, /* B5 (JIS) Transverse 182 x 257 mm */
+ wxPAPER_A3_EXTRA, /* A3 Extra 322 x 445 mm */
+ wxPAPER_A5_EXTRA, /* A5 Extra 174 x 235 mm */
+ wxPAPER_B5_EXTRA, /* B5 (ISO) Extra 201 x 276 mm */
+ wxPAPER_A2, /* A2 420 x 594 mm */
+ wxPAPER_A3_TRANSVERSE, /* A3 Transverse 297 x 420 mm */
+ wxPAPER_A3_EXTRA_TRANSVERSE, /* A3 Extra Transverse 322 x 445 mm */
+
+ wxPAPER_DBL_JAPANESE_POSTCARD,/* Japanese Double Postcard 200 x 148 mm */
+ wxPAPER_A6, /* A6 105 x 148 mm */
+ wxPAPER_JENV_KAKU2, /* Japanese Envelope Kaku #2 */
+ wxPAPER_JENV_KAKU3, /* Japanese Envelope Kaku #3 */
+ wxPAPER_JENV_CHOU3, /* Japanese Envelope Chou #3 */
+ wxPAPER_JENV_CHOU4, /* Japanese Envelope Chou #4 */
+ wxPAPER_LETTER_ROTATED, /* Letter Rotated 11 x 8 1/2 in */
+ wxPAPER_A3_ROTATED, /* A3 Rotated 420 x 297 mm */
+ wxPAPER_A4_ROTATED, /* A4 Rotated 297 x 210 mm */
+ wxPAPER_A5_ROTATED, /* A5 Rotated 210 x 148 mm */
+ wxPAPER_B4_JIS_ROTATED, /* B4 (JIS) Rotated 364 x 257 mm */
+ wxPAPER_B5_JIS_ROTATED, /* B5 (JIS) Rotated 257 x 182 mm */
+ wxPAPER_JAPANESE_POSTCARD_ROTATED,/* Japanese Postcard Rotated 148 x 100 mm */
+ wxPAPER_DBL_JAPANESE_POSTCARD_ROTATED,/* Double Japanese Postcard Rotated 148 x 200 mm */
+ wxPAPER_A6_ROTATED, /* A6 Rotated 148 x 105 mm */
+ wxPAPER_JENV_KAKU2_ROTATED, /* Japanese Envelope Kaku #2 Rotated */
+ wxPAPER_JENV_KAKU3_ROTATED, /* Japanese Envelope Kaku #3 Rotated */
+ wxPAPER_JENV_CHOU3_ROTATED, /* Japanese Envelope Chou #3 Rotated */
+ wxPAPER_JENV_CHOU4_ROTATED, /* Japanese Envelope Chou #4 Rotated */
+ wxPAPER_B6_JIS, /* B6 (JIS) 128 x 182 mm */
+ wxPAPER_B6_JIS_ROTATED, /* B6 (JIS) Rotated 182 x 128 mm */
+ wxPAPER_12X11, /* 12 x 11 in */
+ wxPAPER_JENV_YOU4, /* Japanese Envelope You #4 */
+ wxPAPER_JENV_YOU4_ROTATED, /* Japanese Envelope You #4 Rotated */
+ wxPAPER_P16K, /* PRC 16K 146 x 215 mm */
+ wxPAPER_P32K, /* PRC 32K 97 x 151 mm */
+ wxPAPER_P32KBIG, /* PRC 32K(Big) 97 x 151 mm */
+ wxPAPER_PENV_1, /* PRC Envelope #1 102 x 165 mm */
+ wxPAPER_PENV_2, /* PRC Envelope #2 102 x 176 mm */
+ wxPAPER_PENV_3, /* PRC Envelope #3 125 x 176 mm */
+ wxPAPER_PENV_4, /* PRC Envelope #4 110 x 208 mm */
+ wxPAPER_PENV_5, /* PRC Envelope #5 110 x 220 mm */
+ wxPAPER_PENV_6, /* PRC Envelope #6 120 x 230 mm */
+ wxPAPER_PENV_7, /* PRC Envelope #7 160 x 230 mm */
+ wxPAPER_PENV_8, /* PRC Envelope #8 120 x 309 mm */
+ wxPAPER_PENV_9, /* PRC Envelope #9 229 x 324 mm */
+ wxPAPER_PENV_10, /* PRC Envelope #10 324 x 458 mm */
+ wxPAPER_P16K_ROTATED, /* PRC 16K Rotated */
+ wxPAPER_P32K_ROTATED, /* PRC 32K Rotated */
+ wxPAPER_P32KBIG_ROTATED, /* PRC 32K(Big) Rotated */
+ wxPAPER_PENV_1_ROTATED, /* PRC Envelope #1 Rotated 165 x 102 mm */
+ wxPAPER_PENV_2_ROTATED, /* PRC Envelope #2 Rotated 176 x 102 mm */
+ wxPAPER_PENV_3_ROTATED, /* PRC Envelope #3 Rotated 176 x 125 mm */
+ wxPAPER_PENV_4_ROTATED, /* PRC Envelope #4 Rotated 208 x 110 mm */
+ wxPAPER_PENV_5_ROTATED, /* PRC Envelope #5 Rotated 220 x 110 mm */
+ wxPAPER_PENV_6_ROTATED, /* PRC Envelope #6 Rotated 230 x 120 mm */
+ wxPAPER_PENV_7_ROTATED, /* PRC Envelope #7 Rotated 230 x 160 mm */
+ wxPAPER_PENV_8_ROTATED, /* PRC Envelope #8 Rotated 309 x 120 mm */
+ wxPAPER_PENV_9_ROTATED, /* PRC Envelope #9 Rotated 324 x 229 mm */
+ wxPAPER_PENV_10_ROTATED, /* PRC Envelope #10 Rotated 458 x 324 m */
+ wxPAPER_A0, /* A0 Sheet 841 x 1189 mm */
+ wxPAPER_A1 /* A1 Sheet 594 x 841 mm */
+} wxPaperSize;
+
+/* Printing orientation */
+enum wxPrintOrientation
+{
+ wxPORTRAIT = 1,
+ wxLANDSCAPE
+};
+
+/* Duplex printing modes
+ */
+
+enum wxDuplexMode
+{
+ wxDUPLEX_SIMPLEX, /* Non-duplex */
+ wxDUPLEX_HORIZONTAL,
+ wxDUPLEX_VERTICAL
+};
+
+/* Print quality.
+ */
+
+#define wxPRINT_QUALITY_HIGH -1
+#define wxPRINT_QUALITY_MEDIUM -2
+#define wxPRINT_QUALITY_LOW -3
+#define wxPRINT_QUALITY_DRAFT -4
+
+typedef int wxPrintQuality;
+
+/* Print mode (currently PostScript only)
+ */
+
+enum wxPrintMode
+{
+ wxPRINT_MODE_NONE = 0,
+ wxPRINT_MODE_PREVIEW = 1, /* Preview in external application */
+ wxPRINT_MODE_FILE = 2, /* Print to file */
+ wxPRINT_MODE_PRINTER = 3, /* Send to printer */
+ wxPRINT_MODE_STREAM = 4 /* Send postscript data into a stream */
+};
+
+/* ---------------------------------------------------------------------------- */
+/* UpdateWindowUI flags */
+/* ---------------------------------------------------------------------------- */
+
+enum wxUpdateUI
+{
+ wxUPDATE_UI_NONE = 0x0000,
+ wxUPDATE_UI_RECURSE = 0x0001,
+ wxUPDATE_UI_FROMIDLE = 0x0002 /* Invoked from On(Internal)Idle */
+};
+
+
+/* ---------------------------------------------------------------------------- */
+/* wxList types */
+/* ---------------------------------------------------------------------------- */
+
+/* type of compare function for list sort operation (as in 'qsort'): it should
+ return a negative value, 0 or positive value if the first element is less
+ than, equal or greater than the second */
+
+typedef int (* LINKAGEMODE wxSortCompareFunction)(const void *elem1, const void *elem2);
+
+/* wxList iterator function */
+typedef int (* LINKAGEMODE wxListIterateFunction)(void *current);
+
+
+/* ---------------------------------------------------------------------------- */
+/* miscellaneous */
+/* ---------------------------------------------------------------------------- */
+
+/* define this macro if font handling is done using the X font names */
+#if (defined(__WXGTK__) && !defined(__WXGTK20__)) || defined(__X__)
+ #define _WX_X_FONTLIKE
+#endif
+
+/* macro to specify "All Files" on different platforms */
+#if defined(__WXMSW__) || defined(__WXPM__)
+# define wxALL_FILES_PATTERN wxT("*.*")
+# define wxALL_FILES gettext_noop("All files (*.*)|*.*")
+#else
+# define wxALL_FILES_PATTERN wxT("*")
+# define wxALL_FILES gettext_noop("All files (*)|*")
+#endif
+
+#if defined(__CYGWIN__) && defined(__WXMSW__)
+# if wxUSE_STD_CONTAINERS || defined(wxUSE_STD_STRING)
+ /*
+ NASTY HACK because the gethostname in sys/unistd.h which the gnu
+ stl includes and wx builds with by default clash with each other
+ (windows version 2nd param is int, sys/unistd.h version is unsigned
+ int).
+ */
+# define gethostname gethostnameHACK
+# include <unistd.h>
+# undef gethostname
+# endif
+#endif
+
+/* --------------------------------------------------------------------------- */
+/* macros that enable wxWidgets apps to be compiled in absence of the */
+/* system headers, although some platform specific types are used in the */
+/* platform specific (implementation) parts of the headers */
+/* --------------------------------------------------------------------------- */
+
+#ifdef __DARWIN__
+#define DECLARE_WXOSX_OPAQUE_CFREF( name ) typedef struct __##name* name##Ref;
+#define DECLARE_WXOSX_OPAQUE_CONST_CFREF( name ) typedef const struct __##name* name##Ref;
+#endif
+
+#ifdef __WXMAC__
+
+#define WX_OPAQUE_TYPE( name ) struct wxOpaque##name
+
+typedef void* WXHBITMAP;
+typedef void* WXHCURSOR;
+typedef void* WXRECTPTR;
+typedef void* WXPOINTPTR;
+typedef void* WXHWND;
+typedef void* WXEVENTREF;
+typedef void* WXEVENTHANDLERREF;
+typedef void* WXEVENTHANDLERCALLREF;
+typedef void* WXAPPLEEVENTREF;
+
+typedef unsigned int WXUINT;
+typedef unsigned long WXDWORD;
+typedef unsigned short WXWORD;
+
+typedef WX_OPAQUE_TYPE(PicHandle ) * WXHMETAFILE ;
+#if wxOSX_USE_CARBON
+typedef struct OpaqueControlRef* WXWidget ;
+typedef struct OpaqueWindowPtr* WXWindow ;
+typedef struct __AGLPixelFormatRec *WXGLPixelFormat;
+typedef struct __AGLContextRec *WXGLContext;
+#endif
+
+typedef void* WXDisplay;
+
+/*
+ * core frameworks
+ */
+
+typedef const void * CFTypeRef;
+
+/* typedef const struct __CFString * CFStringRef; */
+
+DECLARE_WXOSX_OPAQUE_CONST_CFREF( CFString )
+typedef struct __CFString * CFMutableStringRef;
+
+DECLARE_WXOSX_OPAQUE_CFREF( CFRunLoopSource )
+DECLARE_WXOSX_OPAQUE_CONST_CFREF( CTFont )
+DECLARE_WXOSX_OPAQUE_CONST_CFREF( CTFontDescriptor )
+
+#define DECLARE_WXOSX_OPAQUE_CGREF( name ) typedef struct name* name##Ref;
+
+DECLARE_WXOSX_OPAQUE_CGREF( CGColor )
+DECLARE_WXOSX_OPAQUE_CGREF( CGImage )
+DECLARE_WXOSX_OPAQUE_CGREF( CGContext )
+DECLARE_WXOSX_OPAQUE_CGREF( CGFont )
+
+typedef CGColorRef WXCOLORREF;
+typedef CGImageRef WXCGIMAGEREF;
+typedef CGContextRef WXHDC;
+
+/*
+ * carbon
+ */
+
+typedef const struct __HIShape * HIShapeRef;
+typedef struct __HIShape * HIMutableShapeRef;
+
+#define DECLARE_WXMAC_OPAQUE_REF( name ) typedef struct Opaque##name* name;
+
+DECLARE_WXMAC_OPAQUE_REF( PasteboardRef )
+DECLARE_WXMAC_OPAQUE_REF( IconRef )
+DECLARE_WXMAC_OPAQUE_REF( MenuRef )
+
+typedef IconRef WXHICON ;
+typedef HIShapeRef WXHRGN;
+#if wxOSX_USE_CARBON
+typedef MenuRef WXHMENU;
+#endif
+
+#endif
+
+#if defined( __WXCOCOA__ ) || defined(__WXMAC__)
+
+/* Definitions of 32-bit/64-bit types
+ * These are typedef'd exactly the same way in newer OS X headers so
+ * redefinition when real headers are included should not be a problem. If
+ * it is, the types are being defined wrongly here.
+ * The purpose of these types is so they can be used from public wx headers.
+ * and also because the older (pre-Leopard) headers don't define them.
+ */
+
+/* NOTE: We don't pollute namespace with CGFLOAT_MIN/MAX/IS_DOUBLE macros
+ * since they are unlikely to be needed in a public header.
+ */
+#if defined(__LP64__) && __LP64__
+ typedef double CGFloat;
+#else
+ typedef float CGFloat;
+#endif
+
+#if (defined(__LP64__) && __LP64__) || (defined(NS_BUILD_32_LIKE_64) && NS_BUILD_32_LIKE_64)
+typedef long NSInteger;
+typedef unsigned long NSUInteger;
+#else
+typedef int NSInteger;
+typedef unsigned int NSUInteger;
+#endif
+
+/* Objective-C type declarations.
+ * These are to be used in public headers in lieu of NSSomething* because
+ * Objective-C class names are not available in C/C++ code.
+ */
+
+/* NOTE: This ought to work with other compilers too, but I'm being cautious */
+#if (defined(__GNUC__) && defined(__APPLE__))
+/* It's desirable to have type safety for Objective-C(++) code as it does
+at least catch typos of method names among other things. However, it
+is not possible to declare an Objective-C class from plain old C or C++
+code. Furthermore, because of C++ name mangling, the type name must
+be the same for both C++ and Objective-C++ code. Therefore, we define
+what should be a pointer to an Objective-C class as a pointer to a plain
+old C struct with the same name. Unfortunately, because the compiler
+does not see a struct as an Objective-C class we cannot declare it
+as a struct in Objective-C(++) mode.
+*/
+#if defined(__OBJC__)
+#define DECLARE_WXCOCOA_OBJC_CLASS(klass) \
+@class klass; \
+typedef klass *WX_##klass
+#else /* not defined(__OBJC__) */
+#define DECLARE_WXCOCOA_OBJC_CLASS(klass) \
+typedef struct klass *WX_##klass
+#endif /* defined(__OBJC__) */
+
+#else /* not Apple's gcc */
+#warning "Objective-C types will not be checked by the compiler."
+/* NOTE: typedef struct objc_object *id; */
+/* IOW, we're declaring these using the id type without using that name, */
+/* since "id" is used extensively not only within wxWidgets itself, but */
+/* also in wxWidgets application code. The following works fine when */
+/* compiling C(++) code, and works without typesafety for Obj-C(++) code */
+#define DECLARE_WXCOCOA_OBJC_CLASS(klass) \
+typedef struct objc_object *WX_##klass
+
+#endif /* (defined(__GNUC__) && defined(__APPLE__)) */
+
+DECLARE_WXCOCOA_OBJC_CLASS(NSApplication);
+DECLARE_WXCOCOA_OBJC_CLASS(NSBitmapImageRep);
+DECLARE_WXCOCOA_OBJC_CLASS(NSBox);
+DECLARE_WXCOCOA_OBJC_CLASS(NSButton);
+DECLARE_WXCOCOA_OBJC_CLASS(NSColor);
+DECLARE_WXCOCOA_OBJC_CLASS(NSColorPanel);
+DECLARE_WXCOCOA_OBJC_CLASS(NSControl);
+DECLARE_WXCOCOA_OBJC_CLASS(NSCursor);
+DECLARE_WXCOCOA_OBJC_CLASS(NSEvent);
+DECLARE_WXCOCOA_OBJC_CLASS(NSFont);
+DECLARE_WXCOCOA_OBJC_CLASS(NSFontDescriptor);
+DECLARE_WXCOCOA_OBJC_CLASS(NSFontPanel);
+DECLARE_WXCOCOA_OBJC_CLASS(NSImage);
+DECLARE_WXCOCOA_OBJC_CLASS(NSLayoutManager);
+DECLARE_WXCOCOA_OBJC_CLASS(NSMenu);
+DECLARE_WXCOCOA_OBJC_CLASS(NSMenuExtra);
+DECLARE_WXCOCOA_OBJC_CLASS(NSMenuItem);
+DECLARE_WXCOCOA_OBJC_CLASS(NSMutableArray);
+DECLARE_WXCOCOA_OBJC_CLASS(NSNotification);
+DECLARE_WXCOCOA_OBJC_CLASS(NSObject);
+DECLARE_WXCOCOA_OBJC_CLASS(NSPanel);
+DECLARE_WXCOCOA_OBJC_CLASS(NSResponder);
+DECLARE_WXCOCOA_OBJC_CLASS(NSScrollView);
+DECLARE_WXCOCOA_OBJC_CLASS(NSSound);
+DECLARE_WXCOCOA_OBJC_CLASS(NSStatusItem);
+DECLARE_WXCOCOA_OBJC_CLASS(NSTableColumn);
+DECLARE_WXCOCOA_OBJC_CLASS(NSTableView);
+DECLARE_WXCOCOA_OBJC_CLASS(NSTextContainer);
+DECLARE_WXCOCOA_OBJC_CLASS(NSTextField);
+DECLARE_WXCOCOA_OBJC_CLASS(NSTextStorage);
+DECLARE_WXCOCOA_OBJC_CLASS(NSThread);
+DECLARE_WXCOCOA_OBJC_CLASS(NSWindow);
+DECLARE_WXCOCOA_OBJC_CLASS(NSView);
+DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLContext);
+DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLPixelFormat);
+DECLARE_WXCOCOA_OBJC_CLASS( NSPrintInfo );
+#ifndef __WXMAC__
+typedef WX_NSView WXWidget; /* wxWidgets BASE definition */
+#endif
+#endif /* __WXCOCOA__ || ( __WXMAC__ &__DARWIN__)*/
+
+#ifdef __WXMAC__
+
+DECLARE_WXCOCOA_OBJC_CLASS(NSString);
+
+#if wxOSX_USE_COCOA
+
+typedef WX_NSWindow WXWindow;
+typedef WX_NSView WXWidget;
+typedef WX_NSMenu WXHMENU;
+typedef WX_NSOpenGLPixelFormat WXGLPixelFormat;
+typedef WX_NSOpenGLContext WXGLContext;
+
+#elif wxOSX_USE_IPHONE
+
+DECLARE_WXCOCOA_OBJC_CLASS(UIWindow);
+DECLARE_WXCOCOA_OBJC_CLASS(UIView);
+DECLARE_WXCOCOA_OBJC_CLASS(UIFont);
+DECLARE_WXCOCOA_OBJC_CLASS(UIImage);
+DECLARE_WXCOCOA_OBJC_CLASS(UIEvent);
+DECLARE_WXCOCOA_OBJC_CLASS(NSSet);
+DECLARE_WXCOCOA_OBJC_CLASS(EAGLContext);
+
+typedef WX_UIWindow WXWindow;
+typedef WX_UIView WXWidget;
+typedef WX_EAGLContext WXGLContext;
+typedef WX_NSString* WXGLPixelFormat;
+
+#endif
+
+#endif /* __WXMAC__ */
+
+/* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */
+#if defined(__WIN32__)
+
+/* Stand-ins for Windows types to avoid #including all of windows.h */
+
+#ifndef NO_STRICT
+ #define WX_MSW_DECLARE_HANDLE(type) typedef struct type##__ * WX##type
+#else
+ #define WX_MSW_DECLARE_HANDLE(type) typedef void * WX##type
+#endif
+
+typedef void* WXHANDLE;
+WX_MSW_DECLARE_HANDLE(HWND);
+WX_MSW_DECLARE_HANDLE(HICON);
+WX_MSW_DECLARE_HANDLE(HFONT);
+WX_MSW_DECLARE_HANDLE(HMENU);
+WX_MSW_DECLARE_HANDLE(HPEN);
+WX_MSW_DECLARE_HANDLE(HBRUSH);
+WX_MSW_DECLARE_HANDLE(HPALETTE);
+WX_MSW_DECLARE_HANDLE(HCURSOR);
+WX_MSW_DECLARE_HANDLE(HRGN);
+WX_MSW_DECLARE_HANDLE(RECTPTR);
+WX_MSW_DECLARE_HANDLE(HACCEL);
+WX_MSW_DECLARE_HANDLE(HINSTANCE);
+WX_MSW_DECLARE_HANDLE(HBITMAP);
+WX_MSW_DECLARE_HANDLE(HIMAGELIST);
+WX_MSW_DECLARE_HANDLE(HGLOBAL);
+WX_MSW_DECLARE_HANDLE(HDC);
+typedef WXHINSTANCE WXHMODULE;
+
+#undef WX_MSW_DECLARE_HANDLE
+
+typedef unsigned int WXUINT;
+typedef unsigned long WXDWORD;
+typedef unsigned short WXWORD;
+
+typedef unsigned long WXCOLORREF;
+typedef void * WXRGNDATA;
+typedef struct tagMSG WXMSG;
+typedef void * WXHCONV;
+typedef void * WXHKEY;
+typedef void * WXHTREEITEM;
+
+typedef void * WXDRAWITEMSTRUCT;
+typedef void * WXMEASUREITEMSTRUCT;
+typedef void * WXLPCREATESTRUCT;
+
+#ifdef __WXMSW__
+typedef WXHWND WXWidget;
+#endif
+
+#ifdef __WIN64__
+typedef unsigned __int64 WXWPARAM;
+typedef __int64 WXLPARAM;
+typedef __int64 WXLRESULT;
+#else
+typedef wxW64 unsigned int WXWPARAM;
+typedef wxW64 long WXLPARAM;
+typedef wxW64 long WXLRESULT;
+#endif
+
+#if defined(__GNUWIN32__) || defined(__WXMICROWIN__)
+typedef int (*WXFARPROC)();
+#else
+typedef int (__stdcall *WXFARPROC)();
+#endif
+#endif /* __WIN32__ */
+
+
+#if defined(__OS2__)
+typedef unsigned long DWORD;
+typedef unsigned short WORD;
+#endif
+
+#if defined(__WXPM__) || defined(__EMX__)
+#ifdef __WXPM__
+/* Stand-ins for OS/2 types, to avoid #including all of os2.h */
+typedef unsigned long WXHWND;
+typedef unsigned long WXHANDLE;
+typedef unsigned long WXHICON;
+typedef unsigned long WXHFONT;
+typedef unsigned long WXHMENU;
+typedef unsigned long WXHPEN;
+typedef unsigned long WXHBRUSH;
+typedef unsigned long WXHPALETTE;
+typedef unsigned long WXHCURSOR;
+typedef unsigned long WXHRGN;
+typedef unsigned long WXHACCEL;
+typedef unsigned long WXHINSTANCE;
+typedef unsigned long WXHMODULE;
+typedef unsigned long WXHBITMAP;
+typedef unsigned long WXHDC;
+typedef unsigned int WXUINT;
+typedef unsigned long WXDWORD;
+typedef unsigned short WXWORD;
+
+typedef unsigned long WXCOLORREF;
+typedef void * WXMSG;
+typedef unsigned long WXHTREEITEM;
+
+typedef void * WXDRAWITEMSTRUCT;
+typedef void * WXMEASUREITEMSTRUCT;
+typedef void * WXLPCREATESTRUCT;
+
+typedef WXHWND WXWidget;
+#endif
+#ifdef __EMX__
+/* Need a well-known type for WXFARPROC
+ below. MPARAM is typedef'ed too late. */
+#define WXWPARAM void *
+#define WXLPARAM void *
+#else
+#define WXWPARAM MPARAM
+#define WXLPARAM MPARAM
+#endif
+#define RECT RECTL
+#define LOGFONT FATTRS
+#define LOWORD SHORT1FROMMP
+#define HIWORD SHORT2FROMMP
+
+typedef unsigned long WXMPARAM;
+typedef unsigned long WXMSGID;
+typedef void* WXRESULT;
+/* typedef int (*WXFARPROC)(); */
+/* some windows handles not defined by PM */
+typedef unsigned long HANDLE;
+typedef unsigned long HICON;
+typedef unsigned long HFONT;
+typedef unsigned long HMENU;
+typedef unsigned long HPEN;
+typedef unsigned long HBRUSH;
+typedef unsigned long HPALETTE;
+typedef unsigned long HCURSOR;
+typedef unsigned long HINSTANCE;
+typedef unsigned long HIMAGELIST;
+typedef unsigned long HGLOBAL;
+#endif /* WXPM || EMX */
+
+#if defined (__WXPM__)
+/* WIN32 graphics types for OS/2 GPI */
+
+/* RGB under OS2 is more like a PALETTEENTRY struct under Windows so we need a real RGB def */
+#define OS2RGB(r,g,b) ((DWORD)((unsigned char)(b) | ((unsigned char)(g) << 8)) | ((unsigned char)(r) << 16))
+
+typedef unsigned long COLORREF;
+#define GetRValue(rgb) ((unsigned char)((rgb) >> 16))
+#define GetGValue(rgb) ((unsigned char)(((unsigned short)(rgb)) >> 8))
+#define GetBValue(rgb) ((unsigned char)(rgb))
+#define PALETTEINDEX(i) ((COLORREF)(0x01000000 | (DWORD)(WORD)(i)))
+#define PALETTERGB(r,g,b) (0x02000000 | OS2RGB(r,g,b))
+/* OS2's RGB/RGB2 is backwards from this */
+typedef struct tagPALETTEENTRY
+{
+ char bRed;
+ char bGreen;
+ char bBlue;
+ char bFlags;
+} PALETTEENTRY;
+typedef struct tagLOGPALETTE
+{
+ WORD palVersion;
+ WORD palNumentries;
+ WORD PALETTEENTRY[1];
+} LOGPALETTE;
+
+#if (defined(__VISAGECPP__) && (__IBMCPP__ < 400)) || defined (__WATCOMC__)
+ /* VA 3.0 for some reason needs base data types when typedefing a proc proto??? */
+typedef void* (_System *WXFARPROC)(unsigned long, unsigned long, void*, void*);
+#else
+#if defined(__EMX__) && !defined(_System)
+#define _System
+#endif
+typedef WXRESULT (_System *WXFARPROC)(WXHWND, WXMSGID, WXWPARAM, WXLPARAM);
+#endif
+
+#endif /* __WXPM__ */
+
+
+#if defined(__WXMOTIF__) || defined(__WXX11__)
+/* Stand-ins for X/Xt/Motif types */
+typedef void* WXWindow;
+typedef void* WXWidget;
+typedef void* WXAppContext;
+typedef void* WXColormap;
+typedef void* WXColor;
+typedef void WXDisplay;
+typedef void WXEvent;
+typedef void* WXCursor;
+typedef void* WXPixmap;
+typedef void* WXFontStructPtr;
+typedef void* WXGC;
+typedef void* WXRegion;
+typedef void* WXFont;
+typedef void* WXImage;
+typedef void* WXFontList;
+typedef void* WXFontSet;
+typedef void* WXRendition;
+typedef void* WXRenderTable;
+typedef void* WXFontType; /* either a XmFontList or XmRenderTable */
+typedef void* WXString;
+
+typedef unsigned long Atom; /* this might fail on a few architectures */
+typedef long WXPixel; /* safety catch in src/motif/colour.cpp */
+
+#endif /* Motif */
+
+#ifdef __WXGTK__
+
+/* Stand-ins for GLIB types */
+typedef struct _GSList GSList;
+
+/* Stand-ins for GDK types */
+typedef struct _GdkColor GdkColor;
+typedef struct _GdkCursor GdkCursor;
+typedef struct _GdkDragContext GdkDragContext;
+
+#if defined(__WXGTK20__)
+ typedef struct _GdkAtom* GdkAtom;
+#else
+ typedef unsigned long GdkAtom;
+#endif
+
+#if !defined(__WXGTK3__)
+ typedef struct _GdkColormap GdkColormap;
+ typedef struct _GdkFont GdkFont;
+ typedef struct _GdkGC GdkGC;
+ typedef struct _GdkRegion GdkRegion;
+#endif
+
+#if defined(__WXGTK3__)
+ typedef struct _GdkWindow GdkWindow;
+#elif defined(__WXGTK20__)
+ typedef struct _GdkDrawable GdkWindow;
+ typedef struct _GdkDrawable GdkPixmap;
+#else
+ typedef struct _GdkWindow GdkWindow;
+ typedef struct _GdkWindow GdkBitmap;
+ typedef struct _GdkWindow GdkPixmap;
+#endif
+
+/* Stand-ins for GTK types */
+typedef struct _GtkWidget GtkWidget;
+typedef struct _GtkRcStyle GtkRcStyle;
+typedef struct _GtkAdjustment GtkAdjustment;
+typedef struct _GtkToolbar GtkToolbar;
+typedef struct _GtkNotebook GtkNotebook;
+typedef struct _GtkNotebookPage GtkNotebookPage;
+typedef struct _GtkAccelGroup GtkAccelGroup;
+typedef struct _GtkSelectionData GtkSelectionData;
+typedef struct _GtkTextBuffer GtkTextBuffer;
+typedef struct _GtkRange GtkRange;
+typedef struct _GtkCellRenderer GtkCellRenderer;
+
+typedef GtkWidget *WXWidget;
+
+#ifndef __WXGTK20__
+#define GTK_OBJECT_GET_CLASS(object) (GTK_OBJECT(object)->klass)
+#define GTK_CLASS_TYPE(klass) ((klass)->type)
+#endif
+
+#endif /* __WXGTK__ */
+
+#if defined(__WXGTK20__) || (defined(__WXX11__) && wxUSE_UNICODE)
+#define wxUSE_PANGO 1
+#else
+#define wxUSE_PANGO 0
+#endif
+
+#if wxUSE_PANGO
+/* Stand-ins for Pango types */
+typedef struct _PangoContext PangoContext;
+typedef struct _PangoLayout PangoLayout;
+typedef struct _PangoFontDescription PangoFontDescription;
+#endif
+
+#ifdef __WXDFB__
+/* DirectFB doesn't have the concept of non-TLW window, so use
+ something arbitrary */
+typedef const void* WXWidget;
+#endif /* DFB */
+
+/* This is required because of clashing macros in windows.h, which may be */
+/* included before or after wxWidgets classes, and therefore must be */
+/* disabled here before any significant wxWidgets headers are included. */
+#ifdef __cplusplus
+#ifdef __WINDOWS__
+#include "wx/msw/winundef.h"
+#endif /* __WINDOWS__ */
+#endif /* __cplusplus */
+
+
+/* include the feature test macros */
+#include "wx/features.h"
+
+/* --------------------------------------------------------------------------- */
+/* macros to define a class without copy ctor nor assignment operator */
+/* --------------------------------------------------------------------------- */
+
+#define wxDECLARE_NO_COPY_CLASS(classname) \
+ private: \
+ classname(const classname&); \
+ classname& operator=(const classname&)
+
+#define wxDECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg) \
+ private: \
+ classname(const classname<arg>&); \
+ classname& operator=(const classname<arg>&)
+
+#define wxDECLARE_NO_COPY_TEMPLATE_CLASS_2(classname, arg1, arg2) \
+ private: \
+ classname(const classname<arg1, arg2>&); \
+ classname& operator=(const classname<arg1, arg2>&)
+
+#define wxDECLARE_NO_ASSIGN_CLASS(classname) \
+ private: \
+ classname& operator=(const classname&)
+
+/* deprecated variants _not_ requiring a semicolon after them */
+#define DECLARE_NO_COPY_CLASS(classname) \
+ wxDECLARE_NO_COPY_CLASS(classname);
+#define DECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg) \
+ wxDECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg);
+#define DECLARE_NO_ASSIGN_CLASS(classname) \
+ wxDECLARE_NO_ASSIGN_CLASS(classname);
+
+/* --------------------------------------------------------------------------- */
+/* If a manifest is being automatically generated, add common controls 6 to it */
+/* --------------------------------------------------------------------------- */
+
+#if wxUSE_GUI && \
+ (!defined wxUSE_NO_MANIFEST || wxUSE_NO_MANIFEST == 0 ) && \
+ ( defined _MSC_FULL_VER && _MSC_FULL_VER >= 140040130 )
+
+#define WX_CC_MANIFEST(cpu) \
+ "/manifestdependency:\"type='win32' \
+ name='Microsoft.Windows.Common-Controls' \
+ version='6.0.0.0' \
+ processorArchitecture='" cpu "' \
+ publicKeyToken='6595b64144ccf1df' \
+ language='*'\""
+
+#if defined _M_IX86
+ #pragma comment(linker, WX_CC_MANIFEST("x86"))
+#elif defined _M_X64
+ #pragma comment(linker, WX_CC_MANIFEST("amd64"))
+#elif defined _M_IA64
+ #pragma comment(linker, WX_CC_MANIFEST("ia64"))
+#else
+ #pragma comment(linker, WX_CC_MANIFEST("*"))
+#endif
+
+#endif /* !wxUSE_NO_MANIFEST && _MSC_FULL_VER >= 140040130 */
+
+/* wxThread and wxProcess priorities */
+enum
+{
+ wxPRIORITY_MIN = 0u, /* lowest possible priority */
+ wxPRIORITY_DEFAULT = 50u, /* normal priority */
+ wxPRIORITY_MAX = 100u /* highest possible priority */
+};
+
+#endif
+ /* _WX_DEFS_H_ */
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/dialog.h
+// Purpose: wxDialogBase class
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 29.06.99
+// Copyright: (c) Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DIALOG_H_BASE_
+#define _WX_DIALOG_H_BASE_
+
+#include "wx/toplevel.h"
+#include "wx/containr.h"
+#include "wx/sharedptr.h"
+
+class WXDLLIMPEXP_FWD_CORE wxSizer;
+class WXDLLIMPEXP_FWD_CORE wxStdDialogButtonSizer;
+class WXDLLIMPEXP_FWD_CORE wxBoxSizer;
+class WXDLLIMPEXP_FWD_CORE wxDialogLayoutAdapter;
+class WXDLLIMPEXP_FWD_CORE wxDialog;
+class WXDLLIMPEXP_FWD_CORE wxButton;
+class WXDLLIMPEXP_FWD_CORE wxScrolledWindow;
+class wxTextSizerWrapper;
+
+// Also see the bit summary table in wx/toplevel.h.
+
+#define wxDIALOG_NO_PARENT 0x00000020 // Don't make owned by apps top window
+
+#ifdef __WXWINCE__
+#define wxDEFAULT_DIALOG_STYLE (wxCAPTION | wxMAXIMIZE | wxCLOSE_BOX | wxNO_BORDER)
+#else
+#define wxDEFAULT_DIALOG_STYLE (wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX)
+#endif
+
+// Layout adaptation levels, for SetLayoutAdaptationLevel
+
+// Don't do any layout adaptation
+#define wxDIALOG_ADAPTATION_NONE 0
+
+// Only look for wxStdDialogButtonSizer for non-scrolling part
+#define wxDIALOG_ADAPTATION_STANDARD_SIZER 1
+
+// Also look for any suitable sizer for non-scrolling part
+#define wxDIALOG_ADAPTATION_ANY_SIZER 2
+
+// Also look for 'loose' standard buttons for non-scrolling part
+#define wxDIALOG_ADAPTATION_LOOSE_BUTTONS 3
+
+// Layout adaptation mode, for SetLayoutAdaptationMode
+enum wxDialogLayoutAdaptationMode
+{
+ wxDIALOG_ADAPTATION_MODE_DEFAULT = 0, // use global adaptation enabled status
+ wxDIALOG_ADAPTATION_MODE_ENABLED = 1, // enable this dialog overriding global status
+ wxDIALOG_ADAPTATION_MODE_DISABLED = 2 // disable this dialog overriding global status
+};
+
+enum wxDialogModality
+{
+ wxDIALOG_MODALITY_NONE = 0,
+ wxDIALOG_MODALITY_WINDOW_MODAL = 1,
+ wxDIALOG_MODALITY_APP_MODAL = 2
+};
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxDialogNameStr[];
+
+class WXDLLIMPEXP_CORE wxDialogBase : public wxNavigationEnabled<wxTopLevelWindow>
+{
+public:
+ wxDialogBase();
+ virtual ~wxDialogBase() { }
+
+ // define public wxDialog methods to be implemented by the derived classes
+ virtual int ShowModal() = 0;
+ virtual void EndModal(int retCode) = 0;
+ virtual bool IsModal() const = 0;
+ // show the dialog frame-modally (needs a parent), using app-modal
+ // dialogs on platforms that don't support it
+ virtual void ShowWindowModal () ;
+ virtual void SendWindowModalDialogEvent ( wxEventType type );
+
+#ifdef wxHAS_EVENT_BIND
+ template<typename Functor>
+ void ShowWindowModalThenDo(const Functor& onEndModal);
+#endif // wxHAS_EVENT_BIND
+
+ // Modal dialogs have a return code - usually the id of the last
+ // pressed button
+ void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
+ int GetReturnCode() const { return m_returnCode; }
+
+ // Set the identifier for the affirmative button: this button will close
+ // the dialog after validating data and calling TransferDataFromWindow()
+ void SetAffirmativeId(int affirmativeId);
+ int GetAffirmativeId() const { return m_affirmativeId; }
+
+ // Set identifier for Esc key translation: the button with this id will
+ // close the dialog without doing anything else; special value wxID_NONE
+ // means to not handle Esc at all while wxID_ANY means to map Esc to
+ // wxID_CANCEL if present and GetAffirmativeId() otherwise
+ void SetEscapeId(int escapeId);
+ int GetEscapeId() const { return m_escapeId; }
+
+ // Find the parent to use for modal dialog: try to use the specified parent
+ // but fall back to the current active window or main application window as
+ // last resort if it is unsuitable.
+ //
+ // As this function is often called from the ctor, the window style may be
+ // not set yet and hence must be passed explicitly to it so that we could
+ // check whether it contains wxDIALOG_NO_PARENT bit.
+ //
+ // This function always returns a valid top level window or NULL.
+ wxWindow *GetParentForModalDialog(wxWindow *parent, long style) const;
+
+ // This overload can only be used for already initialized windows, i.e. not
+ // from the ctor. It uses the current window parent and style.
+ wxWindow *GetParentForModalDialog() const
+ {
+ return GetParentForModalDialog(GetParent(), GetWindowStyle());
+ }
+
+#if wxUSE_STATTEXT // && wxUSE_TEXTCTRL
+ // splits text up at newlines and places the lines into a vertical
+ // wxBoxSizer
+ wxSizer *CreateTextSizer( const wxString& message );
+
+ // same as above but uses a customized wxTextSizerWrapper to create
+ // non-standard controls for the lines
+ wxSizer *CreateTextSizer( const wxString& message,
+ wxTextSizerWrapper& wrapper );
+#endif // wxUSE_STATTEXT // && wxUSE_TEXTCTRL
+
+ // returns a horizontal wxBoxSizer containing the given buttons
+ //
+ // notice that the returned sizer can be NULL if no buttons are put in the
+ // sizer (this mostly happens under smart phones and other atypical
+ // platforms which have hardware buttons replacing OK/Cancel and such)
+ wxSizer *CreateButtonSizer(long flags);
+
+ // returns a sizer containing the given one and a static line separating it
+ // from the preceding elements if it's appropriate for the current platform
+ wxSizer *CreateSeparatedSizer(wxSizer *sizer);
+
+ // returns the sizer containing CreateButtonSizer() below a separating
+ // static line for the platforms which use static lines for items
+ // separation (i.e. not Mac)
+ //
+ // this is just a combination of CreateButtonSizer() and
+ // CreateSeparatedSizer()
+ wxSizer *CreateSeparatedButtonSizer(long flags);
+
+#if wxUSE_BUTTON
+ wxStdDialogButtonSizer *CreateStdDialogButtonSizer( long flags );
+#endif // wxUSE_BUTTON
+
+ // Do layout adaptation
+ virtual bool DoLayoutAdaptation();
+
+ // Can we do layout adaptation?
+ virtual bool CanDoLayoutAdaptation();
+
+ // Returns a content window if there is one. This can be used by the layout adapter, for
+ // example to make the pages of a book control into scrolling windows
+ virtual wxWindow* GetContentWindow() const { return NULL; }
+
+ // Add an id to the list of main button identifiers that should be in the button sizer
+ void AddMainButtonId(wxWindowID id) { m_mainButtonIds.Add((int) id); }
+ wxArrayInt& GetMainButtonIds() { return m_mainButtonIds; }
+
+ // Is this id in the main button id array?
+ bool IsMainButtonId(wxWindowID id) const { return (m_mainButtonIds.Index((int) id) != wxNOT_FOUND); }
+
+ // Level of adaptation, from none (Level 0) to full (Level 3). To disable adaptation,
+ // set level 0, for example in your dialog constructor. You might
+ // do this if you know that you are displaying on a large screen and you don't want the
+ // dialog changed.
+ void SetLayoutAdaptationLevel(int level) { m_layoutAdaptationLevel = level; }
+ int GetLayoutAdaptationLevel() const { return m_layoutAdaptationLevel; }
+
+ /// Override global adaptation enabled/disabled status
+ void SetLayoutAdaptationMode(wxDialogLayoutAdaptationMode mode) { m_layoutAdaptationMode = mode; }
+ wxDialogLayoutAdaptationMode GetLayoutAdaptationMode() const { return m_layoutAdaptationMode; }
+
+ // Returns true if the adaptation has been done
+ void SetLayoutAdaptationDone(bool adaptationDone) { m_layoutAdaptationDone = adaptationDone; }
+ bool GetLayoutAdaptationDone() const { return m_layoutAdaptationDone; }
+
+ // Set layout adapter class, returning old adapter
+ static wxDialogLayoutAdapter* SetLayoutAdapter(wxDialogLayoutAdapter* adapter);
+ static wxDialogLayoutAdapter* GetLayoutAdapter() { return sm_layoutAdapter; }
+
+ // Global switch for layout adaptation
+ static bool IsLayoutAdaptationEnabled() { return sm_layoutAdaptation; }
+ static void EnableLayoutAdaptation(bool enable) { sm_layoutAdaptation = enable; }
+
+ // modality kind
+ virtual wxDialogModality GetModality() const;
+protected:
+ // emulate click of a button with the given id if it's present in the dialog
+ //
+ // return true if button was "clicked" or false if we don't have it
+ bool EmulateButtonClickIfPresent(int id);
+
+ // this function is used by OnCharHook() to decide whether the given key
+ // should close the dialog
+ //
+ // for most platforms the default implementation (which just checks for
+ // Esc) is sufficient, but Mac port also adds Cmd-. here and other ports
+ // could do something different if needed
+ virtual bool IsEscapeKey(const wxKeyEvent& event);
+
+ // end either modal or modeless dialog, for the modal dialog rc is used as
+ // the dialog return code
+ void EndDialog(int rc);
+
+ // call Validate() and TransferDataFromWindow() and close dialog with
+ // wxID_OK return code
+ void AcceptAndClose();
+
+ // The return code from modal dialog
+ int m_returnCode;
+
+ // The identifier for the affirmative button (usually wxID_OK)
+ int m_affirmativeId;
+
+ // The identifier for cancel button (usually wxID_CANCEL)
+ int m_escapeId;
+
+ // Flags whether layout adaptation has been done for this dialog
+ bool m_layoutAdaptationDone;
+
+ // Extra button identifiers to be taken as 'main' button identifiers
+ // to be placed in the non-scrolling area
+ wxArrayInt m_mainButtonIds;
+
+ // Adaptation level
+ int m_layoutAdaptationLevel;
+
+ // Local override for global adaptation enabled status
+ wxDialogLayoutAdaptationMode m_layoutAdaptationMode;
+
+ // Global layout adapter
+ static wxDialogLayoutAdapter* sm_layoutAdapter;
+
+ // Global adaptation switch
+ static bool sm_layoutAdaptation;
+
+private:
+ // helper of GetParentForModalDialog(): returns the passed in window if it
+ // can be used as our parent or NULL if it can't
+ wxWindow *CheckIfCanBeUsedAsParent(wxWindow *parent) const;
+
+ // Helper of OnCharHook() and OnCloseWindow(): find the appropriate button
+ // for closing the dialog and send a click event for it.
+ //
+ // Return true if we found a button to close the dialog and "clicked" it or
+ // false otherwise.
+ bool SendCloseButtonClickEvent();
+
+ // handle Esc key presses
+ void OnCharHook(wxKeyEvent& event);
+
+ // handle closing the dialog window
+ void OnCloseWindow(wxCloseEvent& event);
+
+ // handle the standard buttons
+ void OnButton(wxCommandEvent& event);
+
+ // update the background colour
+ void OnSysColourChanged(wxSysColourChangedEvent& event);
+
+
+ wxDECLARE_NO_COPY_CLASS(wxDialogBase);
+ DECLARE_EVENT_TABLE()
+};
+
+/*!
+ * Base class for layout adapters - code that, for example, turns a dialog into a
+ * scrolling dialog if there isn't enough screen space. You can derive further
+ * adapter classes to do any other kind of adaptation, such as applying a watermark, or adding
+ * a help mechanism.
+ */
+
+class WXDLLIMPEXP_CORE wxDialogLayoutAdapter: public wxObject
+{
+ DECLARE_CLASS(wxDialogLayoutAdapter)
+public:
+ wxDialogLayoutAdapter() {}
+
+ // Override this function to indicate that adaptation should be done
+ virtual bool CanDoLayoutAdaptation(wxDialog* dialog) = 0;
+
+ // Override this function to do the adaptation
+ virtual bool DoLayoutAdaptation(wxDialog* dialog) = 0;
+};
+
+/*!
+ * Standard adapter. Does scrolling adaptation for paged and regular dialogs.
+ *
+ */
+
+class WXDLLIMPEXP_CORE wxStandardDialogLayoutAdapter: public wxDialogLayoutAdapter
+{
+ DECLARE_CLASS(wxStandardDialogLayoutAdapter)
+public:
+ wxStandardDialogLayoutAdapter() {}
+
+// Overrides
+
+ // Indicate that adaptation should be done
+ virtual bool CanDoLayoutAdaptation(wxDialog* dialog);
+
+ // Do layout adaptation
+ virtual bool DoLayoutAdaptation(wxDialog* dialog);
+
+// Implementation
+
+ // Create the scrolled window
+ virtual wxScrolledWindow* CreateScrolledWindow(wxWindow* parent);
+
+#if wxUSE_BUTTON
+ // Find a standard or horizontal box sizer
+ virtual wxSizer* FindButtonSizer(bool stdButtonSizer, wxDialog* dialog, wxSizer* sizer, int& retBorder, int accumlatedBorder = 0);
+
+ // Check if this sizer contains standard buttons, and so can be repositioned in the dialog
+ virtual bool IsOrdinaryButtonSizer(wxDialog* dialog, wxBoxSizer* sizer);
+
+ // Check if this is a standard button
+ virtual bool IsStandardButton(wxDialog* dialog, wxButton* button);
+
+ // Find 'loose' main buttons in the existing layout and add them to the standard dialog sizer
+ virtual bool FindLooseButtons(wxDialog* dialog, wxStdDialogButtonSizer* buttonSizer, wxSizer* sizer, int& count);
+#endif // wxUSE_BUTTON
+
+ // Reparent the controls to the scrolled window, except those in buttonSizer
+ virtual void ReparentControls(wxWindow* parent, wxWindow* reparentTo, wxSizer* buttonSizer = NULL);
+ static void DoReparentControls(wxWindow* parent, wxWindow* reparentTo, wxSizer* buttonSizer = NULL);
+
+ // A function to fit the dialog around its contents, and then adjust for screen size.
+ // If scrolled windows are passed, scrolling is enabled in the required orientation(s).
+ virtual bool FitWithScrolling(wxDialog* dialog, wxScrolledWindow* scrolledWindow);
+ virtual bool FitWithScrolling(wxDialog* dialog, wxWindowList& windows);
+ static bool DoFitWithScrolling(wxDialog* dialog, wxScrolledWindow* scrolledWindow);
+ static bool DoFitWithScrolling(wxDialog* dialog, wxWindowList& windows);
+
+ // Find whether scrolling will be necessary for the dialog, returning wxVERTICAL, wxHORIZONTAL or both
+ virtual int MustScroll(wxDialog* dialog, wxSize& windowSize, wxSize& displaySize);
+ static int DoMustScroll(wxDialog* dialog, wxSize& windowSize, wxSize& displaySize);
+};
+
+#if defined(__WXUNIVERSAL__) && !defined(__WXMICROWIN__)
+ #include "wx/univ/dialog.h"
+#else
+ #if defined(__WXMSW__)
+ #include "wx/msw/dialog.h"
+ #elif defined(__WXMOTIF__)
+ #include "wx/motif/dialog.h"
+ #elif defined(__WXGTK20__)
+ #include "wx/gtk/dialog.h"
+ #elif defined(__WXGTK__)
+ #include "wx/gtk1/dialog.h"
+ #elif defined(__WXMAC__)
+ #include "wx/osx/dialog.h"
+ #elif defined(__WXCOCOA__)
+ #include "wx/cocoa/dialog.h"
+ #elif defined(__WXPM__)
+ #include "wx/os2/dialog.h"
+ #endif
+#endif
+
+class WXDLLIMPEXP_CORE wxWindowModalDialogEvent : public wxCommandEvent
+{
+public:
+ wxWindowModalDialogEvent (wxEventType commandType = wxEVT_NULL, int id = 0)
+ : wxCommandEvent(commandType, id) { }
+
+ wxDialog *GetDialog() const
+ { return wxStaticCast(GetEventObject(), wxDialog); }
+
+ int GetReturnCode() const
+ { return GetDialog()->GetReturnCode(); }
+
+ virtual wxEvent *Clone() const { return new wxWindowModalDialogEvent (*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowModalDialogEvent )
+};
+
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_WINDOW_MODAL_DIALOG_CLOSED , wxWindowModalDialogEvent );
+
+typedef void (wxEvtHandler::*wxWindowModalDialogEventFunction)(wxWindowModalDialogEvent &);
+
+#define wxWindowModalDialogEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxWindowModalDialogEventFunction, func)
+
+#define EVT_WINDOW_MODAL_DIALOG_CLOSED(winid, func) \
+ wx__DECLARE_EVT1(wxEVT_WINDOW_MODAL_DIALOG_CLOSED, winid, wxWindowModalDialogEventHandler(func))
+
+#ifdef wxHAS_EVENT_BIND
+template<typename Functor>
+class wxWindowModalDialogEventFunctor
+{
+public:
+ wxWindowModalDialogEventFunctor(const Functor& f)
+ : m_f(new Functor(f))
+ {}
+
+ void operator()(wxWindowModalDialogEvent& event)
+ {
+ if ( m_f )
+ {
+ // We only want to call this handler once. Also, by deleting
+ // the functor here, its data (such as wxWindowPtr pointing to
+ // the dialog) are freed immediately after exiting this operator().
+ wxSharedPtr<Functor> functor(m_f);
+ m_f.reset();
+
+ (*functor)(event.GetReturnCode());
+ }
+ else // was already called once
+ {
+ event.Skip();
+ }
+ }
+
+private:
+ wxSharedPtr<Functor> m_f;
+};
+
+template<typename Functor>
+void wxDialogBase::ShowWindowModalThenDo(const Functor& onEndModal)
+{
+ Bind(wxEVT_WINDOW_MODAL_DIALOG_CLOSED,
+ wxWindowModalDialogEventFunctor<Functor>(onEndModal));
+ ShowWindowModal();
+}
+#endif // wxHAS_EVENT_BIND
+
+#endif
+ // _WX_DIALOG_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/dialup.h
+// Purpose: Network related wxWidgets classes and functions
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 07.07.99
+// Copyright: (c) Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DIALUP_H
+#define _WX_DIALUP_H
+
+#if wxUSE_DIALUP_MANAGER
+
+#include "wx/event.h"
+
+// ----------------------------------------------------------------------------
+// misc
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_BASE wxArrayString;
+
+#define WXDIALUP_MANAGER_DEFAULT_BEACONHOST wxT("www.yahoo.com")
+
+// ----------------------------------------------------------------------------
+// A class which groups functions dealing with connecting to the network from a
+// workstation using dial-up access to the net. There is at most one instance
+// of this class in the program accessed via GetDialUpManager().
+// ----------------------------------------------------------------------------
+
+/* TODO
+ *
+ * 1. more configurability for Unix: i.e. how to initiate the connection, how
+ * to check for online status, &c.
+ * 2. a function to enumerate all connections (ISPs) and show a dialog in
+ * Dial() allowing to choose between them if no ISP given
+ * 3. add an async version of dialing functions which notify the caller about
+ * the progress (or may be even start another thread to monitor it)
+ * 4. the static creation/accessor functions are not MT-safe - but is this
+ * really crucial? I think we may suppose they're always called from the
+ * main thread?
+ */
+
+class WXDLLIMPEXP_CORE wxDialUpManager
+{
+public:
+ // this function should create and return the object of the
+ // platform-specific class derived from wxDialUpManager. It's implemented
+ // in the platform-specific source files.
+ static wxDialUpManager *Create();
+
+ // could the dialup manager be initialized correctly? If this function
+ // returns false, no other functions will work neither, so it's a good idea
+ // to call this function and check its result before calling any other
+ // wxDialUpManager methods
+ virtual bool IsOk() const = 0;
+
+ // virtual dtor for any base class
+ virtual ~wxDialUpManager() { }
+
+ // operations
+ // ----------
+
+ // fills the array with the names of all possible values for the first
+ // parameter to Dial() on this machine and returns their number (may be 0)
+ virtual size_t GetISPNames(wxArrayString& names) const = 0;
+
+ // dial the given ISP, use username and password to authentificate
+ //
+ // if no nameOfISP is given, the function will select the default one
+ //
+ // if no username/password are given, the function will try to do without
+ // them, but will ask the user if really needed
+ //
+ // if async parameter is false, the function waits until the end of dialing
+ // and returns true upon successful completion.
+ // if async is true, the function only initiates the connection and returns
+ // immediately - the result is reported via events (an event is sent
+ // anyhow, but if dialing failed it will be a DISCONNECTED one)
+ virtual bool Dial(const wxString& nameOfISP = wxEmptyString,
+ const wxString& username = wxEmptyString,
+ const wxString& password = wxEmptyString,
+ bool async = true) = 0;
+
+ // returns true if (async) dialing is in progress
+ virtual bool IsDialing() const = 0;
+
+ // cancel dialing the number initiated with Dial(async = true)
+ // NB: this won't result in DISCONNECTED event being sent
+ virtual bool CancelDialing() = 0;
+
+ // hang up the currently active dial up connection
+ virtual bool HangUp() = 0;
+
+ // online status
+ // -------------
+
+ // returns true if the computer has a permanent network connection (i.e. is
+ // on a LAN) and so there is no need to use Dial() function to go online
+ //
+ // NB: this functions tries to guess the result and it is not always
+ // guaranteed to be correct, so it's better to ask user for
+ // confirmation or give him a possibility to override it
+ virtual bool IsAlwaysOnline() const = 0;
+
+ // returns true if the computer is connected to the network: under Windows,
+ // this just means that a RAS connection exists, under Unix we check that
+ // the "well-known host" (as specified by SetWellKnownHost) is reachable
+ virtual bool IsOnline() const = 0;
+
+ // sometimes the built-in logic for determining the online status may fail,
+ // so, in general, the user should be allowed to override it. This function
+ // allows to forcefully set the online status - whatever our internal
+ // algorithm may think about it.
+ virtual void SetOnlineStatus(bool isOnline = true) = 0;
+
+ // set misc wxDialUpManager options
+ // --------------------------------
+
+ // enable automatical checks for the connection status and sending of
+ // wxEVT_DIALUP_CONNECTED/wxEVT_DIALUP_DISCONNECTED events. The interval
+ // parameter is only for Unix where we do the check manually: under
+ // Windows, the notification about the change of connection status is
+ // instantenous.
+ //
+ // Returns false if couldn't set up automatic check for online status.
+ virtual bool EnableAutoCheckOnlineStatus(size_t nSeconds = 60) = 0;
+
+ // disable automatic check for connection status change - notice that the
+ // wxEVT_DIALUP_XXX events won't be sent any more neither.
+ virtual void DisableAutoCheckOnlineStatus() = 0;
+
+ // additional Unix-only configuration
+ // ----------------------------------
+
+ // under Unix, the value of well-known host is used to check whether we're
+ // connected to the internet. It's unused under Windows, but this function
+ // is always safe to call. The default value is www.yahoo.com.
+ virtual void SetWellKnownHost(const wxString& hostname,
+ int portno = 80) = 0;
+
+ // Sets the commands to start up the network and to hang up again. Used by
+ // the Unix implementations only.
+ virtual void
+ SetConnectCommand(const wxString& commandDial = wxT("/usr/bin/pon"),
+ const wxString& commandHangup = wxT("/usr/bin/poff")) = 0;
+};
+
+// ----------------------------------------------------------------------------
+// wxDialUpManager events
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxDialUpEvent;
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DIALUP_CONNECTED, wxDialUpEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DIALUP_DISCONNECTED, wxDialUpEvent );
+
+// the event class for the dialup events
+class WXDLLIMPEXP_CORE wxDialUpEvent : public wxEvent
+{
+public:
+ wxDialUpEvent(bool isConnected, bool isOwnEvent) : wxEvent(isOwnEvent)
+ {
+ SetEventType(isConnected ? wxEVT_DIALUP_CONNECTED
+ : wxEVT_DIALUP_DISCONNECTED);
+ }
+
+ // is this a CONNECTED or DISCONNECTED event?
+ bool IsConnectedEvent() const
+ { return GetEventType() == wxEVT_DIALUP_CONNECTED; }
+
+ // does this event come from wxDialUpManager::Dial() or from some external
+ // process (i.e. does it result from our own attempt to establish the
+ // connection)?
+ bool IsOwnEvent() const { return m_id != 0; }
+
+ // implement the base class pure virtual
+ virtual wxEvent *Clone() const { return new wxDialUpEvent(*this); }
+
+private:
+ wxDECLARE_NO_ASSIGN_CLASS(wxDialUpEvent);
+};
+
+// the type of dialup event handler function
+typedef void (wxEvtHandler::*wxDialUpEventFunction)(wxDialUpEvent&);
+
+#define wxDialUpEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxDialUpEventFunction, func)
+
+// macros to catch dialup events
+#define EVT_DIALUP_CONNECTED(func) \
+ wx__DECLARE_EVT0(wxEVT_DIALUP_CONNECTED, wxDialUpEventHandler(func))
+#define EVT_DIALUP_DISCONNECTED(func) \
+ wx__DECLARE_EVT0(wxEVT_DIALUP_DISCONNECTED, wxDialUpEventHandler(func))
+
+
+#endif // wxUSE_DIALUP_MANAGER
+
+#endif // _WX_DIALUP_H
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/dir.h
+// Purpose: wxDir is a class for enumerating the files in a directory
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 08.12.99
+// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DIR_H_
+#define _WX_DIR_H_
+
+#include "wx/longlong.h"
+#include "wx/string.h"
+#include "wx/filefn.h" // for wxS_DIR_DEFAULT
+
+class WXDLLIMPEXP_FWD_BASE wxArrayString;
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// These flags affect the behaviour of GetFirst/GetNext() and Traverse().
+// They define what types are included in the list of items they produce.
+// Note that wxDIR_NO_FOLLOW is relevant only on Unix and ignored under systems
+// not supporting symbolic links.
+enum wxDirFlags
+{
+ wxDIR_FILES = 0x0001, // include files
+ wxDIR_DIRS = 0x0002, // include directories
+ wxDIR_HIDDEN = 0x0004, // include hidden files
+ wxDIR_DOTDOT = 0x0008, // include '.' and '..'
+ wxDIR_NO_FOLLOW = 0x0010, // don't dereference any symlink
+
+ // by default, enumerate everything except '.' and '..'
+ wxDIR_DEFAULT = wxDIR_FILES | wxDIR_DIRS | wxDIR_HIDDEN
+};
+
+// these constants are possible return value of wxDirTraverser::OnDir()
+enum wxDirTraverseResult
+{
+ wxDIR_IGNORE = -1, // ignore this directory but continue with others
+ wxDIR_STOP, // stop traversing
+ wxDIR_CONTINUE // continue into this directory
+};
+
+// ----------------------------------------------------------------------------
+// wxDirTraverser: helper class for wxDir::Traverse()
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxDirTraverser
+{
+public:
+ /// a virtual dtor has been provided since this class has virtual members
+ virtual ~wxDirTraverser() { }
+ // called for each file found by wxDir::Traverse()
+ //
+ // return wxDIR_STOP or wxDIR_CONTINUE from here (wxDIR_IGNORE doesn't
+ // make sense)
+ virtual wxDirTraverseResult OnFile(const wxString& filename) = 0;
+
+ // called for each directory found by wxDir::Traverse()
+ //
+ // return one of the enum elements defined above
+ virtual wxDirTraverseResult OnDir(const wxString& dirname) = 0;
+
+ // called for each directory which we couldn't open during our traversal
+ // of the directory tree
+ //
+ // this method can also return either wxDIR_STOP, wxDIR_IGNORE or
+ // wxDIR_CONTINUE but the latter is treated specially: it means to retry
+ // opening the directory and so may lead to infinite loop if it is
+ // returned unconditionally, be careful with this!
+ //
+ // the base class version always returns wxDIR_IGNORE
+ virtual wxDirTraverseResult OnOpenError(const wxString& dirname);
+};
+
+// ----------------------------------------------------------------------------
+// wxDir: portable equivalent of {open/read/close}dir functions
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_BASE wxDirData;
+
+class WXDLLIMPEXP_BASE wxDir
+{
+public:
+
+ // ctors
+ // -----
+
+ // default, use Open()
+ wxDir() { m_data = NULL; }
+
+ // opens the directory for enumeration, use IsOpened() to test success
+ wxDir(const wxString& dir);
+
+ // dtor calls Close() automatically
+ ~wxDir() { Close(); }
+
+ // open the directory for enumerating
+ bool Open(const wxString& dir);
+
+ // close the directory, Open() can be called again later
+ void Close();
+
+ // returns true if the directory was successfully opened
+ bool IsOpened() const;
+
+ // get the full name of the directory (without '/' at the end)
+ wxString GetName() const;
+
+ // Same as GetName() but does include the trailing separator, unless the
+ // string is empty (only for invalid directories).
+ wxString GetNameWithSep() const;
+
+
+ // file enumeration routines
+ // -------------------------
+
+ // start enumerating all files matching filespec (or all files if it is
+ // empty) and flags, return true on success
+ bool GetFirst(wxString *filename,
+ const wxString& filespec = wxEmptyString,
+ int flags = wxDIR_DEFAULT) const;
+
+ // get next file in the enumeration started with GetFirst()
+ bool GetNext(wxString *filename) const;
+
+ // return true if this directory has any files in it
+ bool HasFiles(const wxString& spec = wxEmptyString) const;
+
+ // return true if this directory has any subdirectories
+ bool HasSubDirs(const wxString& spec = wxEmptyString) const;
+
+ // enumerate all files in this directory and its subdirectories
+ //
+ // return the number of files found
+ size_t Traverse(wxDirTraverser& sink,
+ const wxString& filespec = wxEmptyString,
+ int flags = wxDIR_DEFAULT) const;
+
+ // simplest version of Traverse(): get the names of all files under this
+ // directory into filenames array, return the number of files
+ static size_t GetAllFiles(const wxString& dirname,
+ wxArrayString *files,
+ const wxString& filespec = wxEmptyString,
+ int flags = wxDIR_DEFAULT);
+
+ // check if there any files matching the given filespec under the given
+ // directory (i.e. searches recursively), return the file path if found or
+ // empty string otherwise
+ static wxString FindFirst(const wxString& dirname,
+ const wxString& filespec,
+ int flags = wxDIR_DEFAULT);
+
+#if wxUSE_LONGLONG
+ // returns the size of all directories recursively found in given path
+ static wxULongLong GetTotalSize(const wxString &dir, wxArrayString *filesSkipped = NULL);
+#endif // wxUSE_LONGLONG
+
+
+ // static utilities for directory management
+ // (alias to wxFileName's functions for dirs)
+ // -----------------------------------------
+
+ // test for existence of a directory with the given name
+ static bool Exists(const wxString& dir);
+
+ static bool Make(const wxString &dir, int perm = wxS_DIR_DEFAULT,
+ int flags = 0);
+
+ static bool Remove(const wxString &dir, int flags = 0);
+
+
+private:
+ friend class wxDirData;
+
+ wxDirData *m_data;
+
+ wxDECLARE_NO_COPY_CLASS(wxDir);
+};
+
+#endif // _WX_DIR_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/dirctrl.h
+// Purpose: Directory control base header
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DIRCTRL_H_BASE_
+#define _WX_DIRCTRL_H_BASE_
+
+#include "wx/generic/dirctrlg.h"
+
+#endif
+ // _WX_DIRCTRL_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/dirdlg.h
+// Purpose: wxDirDialog base class
+// Author: Robert Roebling
+// Modified by:
+// Created:
+// Copyright: (c) Robert Roebling
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DIRDLG_H_BASE_
+#define _WX_DIRDLG_H_BASE_
+
+#if wxUSE_DIRDLG
+
+#include "wx/dialog.h"
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxDirDialogNameStr[];
+extern WXDLLIMPEXP_DATA_CORE(const char) wxDirDialogDefaultFolderStr[];
+extern WXDLLIMPEXP_DATA_CORE(const char) wxDirSelectorPromptStr[];
+
+#define wxDD_CHANGE_DIR 0x0100
+#define wxDD_DIR_MUST_EXIST 0x0200
+
+// deprecated, on by default now, use wxDD_DIR_MUST_EXIST to disable it
+#define wxDD_NEW_DIR_BUTTON 0
+
+#ifdef __WXWINCE__
+ #define wxDD_DEFAULT_STYLE wxDEFAULT_DIALOG_STYLE
+#else
+ #define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
+#endif
+
+//-------------------------------------------------------------------------
+// wxDirDialogBase
+//-------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDirDialogBase : public wxDialog
+{
+public:
+ wxDirDialogBase() {}
+ wxDirDialogBase(wxWindow *parent,
+ const wxString& title = wxDirSelectorPromptStr,
+ const wxString& defaultPath = wxEmptyString,
+ long style = wxDD_DEFAULT_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& sz = wxDefaultSize,
+ const wxString& name = wxDirDialogNameStr)
+ {
+ Create(parent, title, defaultPath, style, pos, sz, name);
+ }
+
+ virtual ~wxDirDialogBase() {}
+
+
+ bool Create(wxWindow *parent,
+ const wxString& title = wxDirSelectorPromptStr,
+ const wxString& defaultPath = wxEmptyString,
+ long style = wxDD_DEFAULT_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& sz = wxDefaultSize,
+ const wxString& name = wxDirDialogNameStr)
+ {
+ if (!wxDialog::Create(parent, wxID_ANY, title, pos, sz, style, name))
+ return false;
+ m_path = defaultPath;
+ m_message = title;
+ return true;
+ }
+
+#if WXWIN_COMPATIBILITY_2_6
+
+ wxDEPRECATED( long GetStyle() const );
+ wxDEPRECATED( void SetStyle(long style) );
+
+#endif // WXWIN_COMPATIBILITY_2_6
+
+ virtual void SetMessage(const wxString& message) { m_message = message; }
+ virtual void SetPath(const wxString& path) { m_path = path; }
+
+ virtual wxString GetMessage() const { return m_message; }
+ virtual wxString GetPath() const { return m_path; }
+
+protected:
+ wxString m_message;
+ wxString m_path;
+};
+
+
+// Universal and non-port related switches with need for generic implementation
+#if defined(__WXUNIVERSAL__)
+ #include "wx/generic/dirdlgg.h"
+ #define wxDirDialog wxGenericDirDialog
+#elif defined(__WXMSW__) && (!wxUSE_OLE || \
+ (defined (__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS))
+ #include "wx/generic/dirdlgg.h"
+ #define wxDirDialog wxGenericDirDialog
+#elif defined(__WXMSW__) && defined(__WXWINCE__) && !defined(__HANDHELDPC__)
+ #include "wx/generic/dirdlgg.h" // MS PocketPC or MS Smartphone
+ #define wxDirDialog wxGenericDirDialog
+#elif defined(__WXMSW__)
+ #include "wx/msw/dirdlg.h" // Native MSW
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/dirdlg.h" // Native GTK for gtk2.4
+#elif defined(__WXGTK__)
+ #include "wx/generic/dirdlgg.h"
+ #define wxDirDialog wxGenericDirDialog
+#elif defined(__WXMAC__)
+ #include "wx/osx/dirdlg.h" // Native Mac
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/dirdlg.h" // Native Cocoa
+#elif defined(__WXMOTIF__) || \
+ defined(__WXX11__) || \
+ defined(__WXCOCOA__) || \
+ defined(__WXPM__)
+ #include "wx/generic/dirdlgg.h" // Other ports use generic implementation
+ #define wxDirDialog wxGenericDirDialog
+#endif
+
+// ----------------------------------------------------------------------------
+// common ::wxDirSelector() function
+// ----------------------------------------------------------------------------
+
+WXDLLIMPEXP_CORE wxString
+wxDirSelector(const wxString& message = wxDirSelectorPromptStr,
+ const wxString& defaultPath = wxEmptyString,
+ long style = wxDD_DEFAULT_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ wxWindow *parent = NULL);
+
+#endif // wxUSE_DIRDLG
+
+#endif
+ // _WX_DIRDLG_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/display.h
+// Purpose: wxDisplay class
+// Author: Royce Mitchell III, Vadim Zeitlin
+// Created: 06/21/02
+// Copyright: (c) 2002-2006 wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DISPLAY_H_BASE_
+#define _WX_DISPLAY_H_BASE_
+
+// NB: no #if wxUSE_DISPLAY here, the display geometry part of this class (but
+// not the video mode stuff) is always available but if wxUSE_DISPLAY == 0
+// it becomes just a trivial wrapper around the old wxDisplayXXX() functions
+
+#if wxUSE_DISPLAY
+ #include "wx/dynarray.h"
+ #include "wx/vidmode.h"
+
+ WX_DECLARE_EXPORTED_OBJARRAY(wxVideoMode, wxArrayVideoModes);
+
+ // default, uninitialized, video mode object
+ extern WXDLLIMPEXP_DATA_CORE(const wxVideoMode) wxDefaultVideoMode;
+#endif // wxUSE_DISPLAY
+
+class WXDLLIMPEXP_FWD_CORE wxWindow;
+class WXDLLIMPEXP_FWD_CORE wxPoint;
+class WXDLLIMPEXP_FWD_CORE wxRect;
+class WXDLLIMPEXP_FWD_BASE wxString;
+
+class WXDLLIMPEXP_FWD_CORE wxDisplayFactory;
+class WXDLLIMPEXP_FWD_CORE wxDisplayImpl;
+
+// ----------------------------------------------------------------------------
+// wxDisplay: represents a display/monitor attached to the system
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDisplay
+{
+public:
+ // initialize the object containing all information about the given
+ // display
+ //
+ // the displays are numbered from 0 to GetCount() - 1, 0 is always the
+ // primary display and the only one which is always supported
+ wxDisplay(unsigned n = 0);
+
+ // dtor is not virtual as this is a concrete class not meant to be derived
+ // from
+ ~wxDisplay();
+
+
+ // return the number of available displays, valid parameters to
+ // wxDisplay ctor are from 0 up to this number
+ static unsigned GetCount();
+
+ // find the display where the given point lies, return wxNOT_FOUND if
+ // it doesn't belong to any display
+ static int GetFromPoint(const wxPoint& pt);
+
+ // find the display where the given window lies, return wxNOT_FOUND if it
+ // is not shown at all
+ static int GetFromWindow(const wxWindow *window);
+
+
+ // return true if the object was initialized successfully
+ bool IsOk() const { return m_impl != NULL; }
+
+ // get the full display size
+ wxRect GetGeometry() const;
+
+ // get the client area of the display, i.e. without taskbars and such
+ wxRect GetClientArea() const;
+
+ // name may be empty
+ wxString GetName() const;
+
+ // display 0 is usually the primary display
+ bool IsPrimary() const;
+
+
+#if wxUSE_DISPLAY
+ // enumerate all video modes supported by this display matching the given
+ // one (in the sense of wxVideoMode::Match())
+ //
+ // as any mode matches the default value of the argument and there is
+ // always at least one video mode supported by display, the returned array
+ // is only empty for the default value of the argument if this function is
+ // not supported at all on this platform
+ wxArrayVideoModes
+ GetModes(const wxVideoMode& mode = wxDefaultVideoMode) const;
+
+ // get current video mode
+ wxVideoMode GetCurrentMode() const;
+
+ // change current mode, return true if succeeded, false otherwise
+ //
+ // for the default value of the argument restores the video mode to default
+ bool ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode);
+
+ // restore the default video mode (just a more readable synonym)
+ void ResetMode() { (void)ChangeMode(); }
+#endif // wxUSE_DISPLAY
+
+private:
+ // returns the factory used to implement our static methods and create new
+ // displays
+ static wxDisplayFactory& Factory();
+
+ // creates the factory object, called by Factory() when it is called for
+ // the first time and should return a pointer allocated with new (the
+ // caller will delete it)
+ //
+ // this method must be implemented in platform-specific code if
+ // wxUSE_DISPLAY == 1 (if it is 0 we provide the stub in common code)
+ static wxDisplayFactory *CreateFactory();
+
+
+ // the real implementation
+ wxDisplayImpl *m_impl;
+
+
+ wxDECLARE_NO_COPY_CLASS(wxDisplay);
+};
+
+#endif // _WX_DISPLAY_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/display_impl.h
+// Purpose: wxDisplayImpl class declaration
+// Author: Vadim Zeitlin
+// Created: 2006-03-15
+// Copyright: (c) 2002-2006 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DISPLAY_IMPL_H_BASE_
+#define _WX_DISPLAY_IMPL_H_BASE_
+
+#include "wx/gdicmn.h" // for wxRect
+
+// ----------------------------------------------------------------------------
+// wxDisplayFactory: allows to create wxDisplay objects
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDisplayFactory
+{
+public:
+ wxDisplayFactory() { }
+ virtual ~wxDisplayFactory() { }
+
+ // create a new display object
+ //
+ // it can return a NULL pointer if the display creation failed
+ virtual wxDisplayImpl *CreateDisplay(unsigned n) = 0;
+
+ // get the total number of displays
+ virtual unsigned GetCount() = 0;
+
+ // return the display for the given point or wxNOT_FOUND
+ virtual int GetFromPoint(const wxPoint& pt) = 0;
+
+ // return the display for the given window or wxNOT_FOUND
+ //
+ // the window pointer must not be NULL (i.e. caller should check it)
+ virtual int GetFromWindow(const wxWindow *window);
+};
+
+// ----------------------------------------------------------------------------
+// wxDisplayImpl: base class for all wxDisplay implementations
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDisplayImpl
+{
+public:
+ // virtual dtor for this base class
+ virtual ~wxDisplayImpl() { }
+
+
+ // return the full area of this display
+ virtual wxRect GetGeometry() const = 0;
+
+ // return the area of the display available for normal windows
+ virtual wxRect GetClientArea() const { return GetGeometry(); }
+
+ // return the name (may be empty)
+ virtual wxString GetName() const = 0;
+
+ // return the index of this display
+ unsigned GetIndex() const { return m_index; }
+
+ // return true if this is the primary monitor (usually one with index 0)
+ virtual bool IsPrimary() const { return GetIndex() == 0; }
+
+
+#if wxUSE_DISPLAY
+ // implements wxDisplay::GetModes()
+ virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const = 0;
+
+ // get current video mode
+ virtual wxVideoMode GetCurrentMode() const = 0;
+
+ // change current mode, return true if succeeded, false otherwise
+ virtual bool ChangeMode(const wxVideoMode& mode) = 0;
+#endif // wxUSE_DISPLAY
+
+protected:
+ // create the object providing access to the display with the given index
+ wxDisplayImpl(unsigned n) : m_index(n) { }
+
+
+ // the index of this display (0 is always the primary one)
+ const unsigned m_index;
+
+
+ friend class wxDisplayFactory;
+
+ wxDECLARE_NO_COPY_CLASS(wxDisplayImpl);
+};
+
+// ----------------------------------------------------------------------------
+// wxDisplayFactorySingle
+// ----------------------------------------------------------------------------
+
+// this is a stub implementation using single/main display only, it is
+// available even if wxUSE_DISPLAY == 0
+class WXDLLIMPEXP_CORE wxDisplayFactorySingle : public wxDisplayFactory
+{
+public:
+ virtual wxDisplayImpl *CreateDisplay(unsigned n);
+ virtual unsigned GetCount() { return 1; }
+ virtual int GetFromPoint(const wxPoint& pt);
+};
+
+#endif // _WX_DISPLAY_IMPL_H_BASE_
+
--- /dev/null
+/*
+ * Name: wx/dlimpexp.h
+ * Purpose: Macros for declaring DLL-imported/exported functions
+ * Author: Vadim Zeitlin
+ * Modified by:
+ * Created: 16.10.2003 (extracted from wx/defs.h)
+ * Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
+ * Licence: wxWindows licence
+ */
+
+/*
+ This is a C file, not C++ one, do not use C++ comments here!
+ */
+
+#ifndef _WX_DLIMPEXP_H_
+#define _WX_DLIMPEXP_H_
+
+#if defined(HAVE_VISIBILITY)
+# define WXEXPORT __attribute__ ((visibility("default")))
+# define WXIMPORT __attribute__ ((visibility("default")))
+#elif defined(__WINDOWS__)
+ /*
+ __declspec works in BC++ 5 and later, Watcom C++ 11.0 and later as well
+ as VC++.
+ */
+# if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__)
+# define WXEXPORT __declspec(dllexport)
+# define WXIMPORT __declspec(dllimport)
+ /*
+ While gcc also supports __declspec(dllexport), it creates unusably huge
+ DLL files since gcc 4.5 (while taking horribly long amounts of time),
+ see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43601. Because of this
+ we rely on binutils auto export/import support which seems to work
+ quite well for 4.5+.
+ */
+# elif defined(__GNUC__) && !wxCHECK_GCC_VERSION(4, 5)
+ /*
+ __declspec could be used here too but let's use the native
+ __attribute__ instead for clarity.
+ */
+# define WXEXPORT __attribute__((dllexport))
+# define WXIMPORT __attribute__((dllimport))
+# endif
+#elif defined(__WXPM__)
+# if defined (__WATCOMC__)
+# define WXEXPORT __declspec(dllexport)
+ /*
+ __declspec(dllimport) prepends __imp to imported symbols. We do NOT
+ want that!
+ */
+# define WXIMPORT
+# elif defined(__EMX__)
+# define WXEXPORT
+# define WXIMPORT
+# elif (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )))
+# define WXEXPORT _Export
+# define WXIMPORT _Export
+# endif
+#elif defined(__CYGWIN__)
+# define WXEXPORT __declspec(dllexport)
+# define WXIMPORT __declspec(dllimport)
+#endif
+
+/* for other platforms/compilers we don't anything */
+#ifndef WXEXPORT
+# define WXEXPORT
+# define WXIMPORT
+#endif
+
+/*
+ We support building wxWidgets as a set of several libraries but we don't
+ support arbitrary combinations of libs/DLLs: either we build all of them as
+ DLLs (in which case WXMAKINGDLL is defined) or none (it isn't).
+
+ However we have a problem because we need separate WXDLLIMPEXP versions for
+ different libraries as, for example, wxString class should be dllexported
+ when compiled in wxBase and dllimported otherwise, so we do define separate
+ WXMAKING/USINGDLL_XYZ constants for each component XYZ.
+ */
+#ifdef WXMAKINGDLL
+# if wxUSE_BASE
+# define WXMAKINGDLL_BASE
+# endif
+
+# define WXMAKINGDLL_NET
+# define WXMAKINGDLL_CORE
+# define WXMAKINGDLL_ADV
+# define WXMAKINGDLL_QA
+# define WXMAKINGDLL_HTML
+# define WXMAKINGDLL_GL
+# define WXMAKINGDLL_XML
+# define WXMAKINGDLL_XRC
+# define WXMAKINGDLL_AUI
+# define WXMAKINGDLL_PROPGRID
+# define WXMAKINGDLL_RIBBON
+# define WXMAKINGDLL_RICHTEXT
+# define WXMAKINGDLL_MEDIA
+# define WXMAKINGDLL_STC
+# define WXMAKINGDLL_WEBVIEW
+#endif /* WXMAKINGDLL */
+
+/*
+ WXDLLIMPEXP_CORE maps to export declaration when building the DLL, to import
+ declaration if using it or to nothing at all if we don't use wxWin as DLL
+ */
+#ifdef WXMAKINGDLL_BASE
+# define WXDLLIMPEXP_BASE WXEXPORT
+# define WXDLLIMPEXP_DATA_BASE(type) WXEXPORT type
+# if defined(HAVE_VISIBILITY)
+# define WXDLLIMPEXP_INLINE_BASE WXEXPORT
+# else
+# define WXDLLIMPEXP_INLINE_BASE
+# endif
+#elif defined(WXUSINGDLL)
+# define WXDLLIMPEXP_BASE WXIMPORT
+# define WXDLLIMPEXP_DATA_BASE(type) WXIMPORT type
+# if defined(HAVE_VISIBILITY)
+# define WXDLLIMPEXP_INLINE_BASE WXIMPORT
+# else
+# define WXDLLIMPEXP_INLINE_BASE
+# endif
+#else /* not making nor using DLL */
+# define WXDLLIMPEXP_BASE
+# define WXDLLIMPEXP_DATA_BASE(type) type
+# define WXDLLIMPEXP_INLINE_BASE
+#endif
+
+#ifdef WXMAKINGDLL_NET
+# define WXDLLIMPEXP_NET WXEXPORT
+# define WXDLLIMPEXP_DATA_NET(type) WXEXPORT type
+#elif defined(WXUSINGDLL)
+# define WXDLLIMPEXP_NET WXIMPORT
+# define WXDLLIMPEXP_DATA_NET(type) WXIMPORT type
+#else /* not making nor using DLL */
+# define WXDLLIMPEXP_NET
+# define WXDLLIMPEXP_DATA_NET(type) type
+#endif
+
+#ifdef WXMAKINGDLL_CORE
+# define WXDLLIMPEXP_CORE WXEXPORT
+# define WXDLLIMPEXP_DATA_CORE(type) WXEXPORT type
+# if defined(HAVE_VISIBILITY)
+# define WXDLLIMPEXP_INLINE_CORE WXEXPORT
+# else
+# define WXDLLIMPEXP_INLINE_CORE
+# endif
+#elif defined(WXUSINGDLL)
+# define WXDLLIMPEXP_CORE WXIMPORT
+# define WXDLLIMPEXP_DATA_CORE(type) WXIMPORT type
+# if defined(HAVE_VISIBILITY)
+# define WXDLLIMPEXP_INLINE_CORE WXIMPORT
+# else
+# define WXDLLIMPEXP_INLINE_CORE
+# endif
+#else /* not making nor using DLL */
+# define WXDLLIMPEXP_CORE
+# define WXDLLIMPEXP_DATA_CORE(type) type
+# define WXDLLIMPEXP_INLINE_CORE
+#endif
+
+#ifdef WXMAKINGDLL_ADV
+# define WXDLLIMPEXP_ADV WXEXPORT
+# define WXDLLIMPEXP_DATA_ADV(type) WXEXPORT type
+#elif defined(WXUSINGDLL)
+# define WXDLLIMPEXP_ADV WXIMPORT
+# define WXDLLIMPEXP_DATA_ADV(type) WXIMPORT type
+#else /* not making nor using DLL */
+# define WXDLLIMPEXP_ADV
+# define WXDLLIMPEXP_DATA_ADV(type) type
+#endif
+
+#ifdef WXMAKINGDLL_QA
+# define WXDLLIMPEXP_QA WXEXPORT
+# define WXDLLIMPEXP_DATA_QA(type) WXEXPORT type
+#elif defined(WXUSINGDLL)
+# define WXDLLIMPEXP_QA WXIMPORT
+# define WXDLLIMPEXP_DATA_QA(type) WXIMPORT type
+#else /* not making nor using DLL */
+# define WXDLLIMPEXP_QA
+# define WXDLLIMPEXP_DATA_QA(type) type
+#endif
+
+#ifdef WXMAKINGDLL_HTML
+# define WXDLLIMPEXP_HTML WXEXPORT
+# define WXDLLIMPEXP_DATA_HTML(type) WXEXPORT type
+#elif defined(WXUSINGDLL)
+# define WXDLLIMPEXP_HTML WXIMPORT
+# define WXDLLIMPEXP_DATA_HTML(type) WXIMPORT type
+#else /* not making nor using DLL */
+# define WXDLLIMPEXP_HTML
+# define WXDLLIMPEXP_DATA_HTML(type) type
+#endif
+
+#ifdef WXMAKINGDLL_GL
+# define WXDLLIMPEXP_GL WXEXPORT
+#elif defined(WXUSINGDLL)
+# define WXDLLIMPEXP_GL WXIMPORT
+#else /* not making nor using DLL */
+# define WXDLLIMPEXP_GL
+#endif
+
+#ifdef WXMAKINGDLL_XML
+# define WXDLLIMPEXP_XML WXEXPORT
+#elif defined(WXUSINGDLL)
+# define WXDLLIMPEXP_XML WXIMPORT
+#else /* not making nor using DLL */
+# define WXDLLIMPEXP_XML
+#endif
+
+#ifdef WXMAKINGDLL_XRC
+# define WXDLLIMPEXP_XRC WXEXPORT
+#elif defined(WXUSINGDLL)
+# define WXDLLIMPEXP_XRC WXIMPORT
+#else /* not making nor using DLL */
+# define WXDLLIMPEXP_XRC
+#endif
+
+#ifdef WXMAKINGDLL_AUI
+# define WXDLLIMPEXP_AUI WXEXPORT
+#elif defined(WXUSINGDLL)
+# define WXDLLIMPEXP_AUI WXIMPORT
+#else /* not making nor using DLL */
+# define WXDLLIMPEXP_AUI
+#endif
+
+#ifdef WXMAKINGDLL_PROPGRID
+# define WXDLLIMPEXP_PROPGRID WXEXPORT
+# define WXDLLIMPEXP_DATA_PROPGRID(type) WXEXPORT type
+#elif defined(WXUSINGDLL)
+# define WXDLLIMPEXP_PROPGRID WXIMPORT
+# define WXDLLIMPEXP_DATA_PROPGRID(type) WXIMPORT type
+#else /* not making nor using DLL */
+# define WXDLLIMPEXP_PROPGRID
+# define WXDLLIMPEXP_DATA_PROPGRID(type) type
+#endif
+
+#ifdef WXMAKINGDLL_RIBBON
+# define WXDLLIMPEXP_RIBBON WXEXPORT
+#elif defined(WXUSINGDLL)
+# define WXDLLIMPEXP_RIBBON WXIMPORT
+#else /* not making nor using DLL */
+# define WXDLLIMPEXP_RIBBON
+#endif
+
+#ifdef WXMAKINGDLL_RICHTEXT
+# define WXDLLIMPEXP_RICHTEXT WXEXPORT
+#elif defined(WXUSINGDLL)
+# define WXDLLIMPEXP_RICHTEXT WXIMPORT
+#else /* not making nor using DLL */
+# define WXDLLIMPEXP_RICHTEXT
+#endif
+
+#ifdef WXMAKINGDLL_MEDIA
+# define WXDLLIMPEXP_MEDIA WXEXPORT
+#elif defined(WXUSINGDLL)
+# define WXDLLIMPEXP_MEDIA WXIMPORT
+#else /* not making nor using DLL */
+# define WXDLLIMPEXP_MEDIA
+#endif
+
+#ifdef WXMAKINGDLL_STC
+# define WXDLLIMPEXP_STC WXEXPORT
+# define WXDLLIMPEXP_DATA_STC(type) WXEXPORT type
+#elif defined(WXUSINGDLL)
+# define WXDLLIMPEXP_STC WXIMPORT
+# define WXDLLIMPEXP_DATA_STC(type) WXIMPORT type
+#else /* not making nor using DLL */
+# define WXDLLIMPEXP_STC
+# define WXDLLIMPEXP_DATA_STC(type) type
+#endif
+
+#ifdef WXMAKINGDLL_WEBVIEW
+# define WXDLLIMPEXP_WEBVIEW WXEXPORT
+# define WXDLLIMPEXP_DATA_WEBVIEW(type) WXEXPORT type
+#elif defined(WXUSINGDLL)
+# define WXDLLIMPEXP_WEBVIEW WXIMPORT
+# define WXDLLIMPEXP_DATA_WEBVIEW(type) WXIMPORT type
+#else /* not making nor using DLL */
+# define WXDLLIMPEXP_WEBVIEW
+# define WXDLLIMPEXP_DATA_WEBVIEW(type) type
+#endif
+
+/*
+ GCC warns about using __attribute__ (and also __declspec in mingw32 case) on
+ forward declarations while MSVC complains about forward declarations without
+ __declspec for the classes later declared with it, so we need a separate set
+ of macros for forward declarations to hide this difference:
+ */
+#if defined(HAVE_VISIBILITY) || (defined(__WINDOWS__) && defined(__GNUC__))
+ #define WXDLLIMPEXP_FWD_BASE
+ #define WXDLLIMPEXP_FWD_NET
+ #define WXDLLIMPEXP_FWD_CORE
+ #define WXDLLIMPEXP_FWD_ADV
+ #define WXDLLIMPEXP_FWD_QA
+ #define WXDLLIMPEXP_FWD_HTML
+ #define WXDLLIMPEXP_FWD_GL
+ #define WXDLLIMPEXP_FWD_XML
+ #define WXDLLIMPEXP_FWD_XRC
+ #define WXDLLIMPEXP_FWD_AUI
+ #define WXDLLIMPEXP_FWD_PROPGRID
+ #define WXDLLIMPEXP_FWD_RIBBON
+ #define WXDLLIMPEXP_FWD_RICHTEXT
+ #define WXDLLIMPEXP_FWD_MEDIA
+ #define WXDLLIMPEXP_FWD_STC
+ #define WXDLLIMPEXP_FWD_WEBVIEW
+#else
+ #define WXDLLIMPEXP_FWD_BASE WXDLLIMPEXP_BASE
+ #define WXDLLIMPEXP_FWD_NET WXDLLIMPEXP_NET
+ #define WXDLLIMPEXP_FWD_CORE WXDLLIMPEXP_CORE
+ #define WXDLLIMPEXP_FWD_ADV WXDLLIMPEXP_ADV
+ #define WXDLLIMPEXP_FWD_QA WXDLLIMPEXP_QA
+ #define WXDLLIMPEXP_FWD_HTML WXDLLIMPEXP_HTML
+ #define WXDLLIMPEXP_FWD_GL WXDLLIMPEXP_GL
+ #define WXDLLIMPEXP_FWD_XML WXDLLIMPEXP_XML
+ #define WXDLLIMPEXP_FWD_XRC WXDLLIMPEXP_XRC
+ #define WXDLLIMPEXP_FWD_AUI WXDLLIMPEXP_AUI
+ #define WXDLLIMPEXP_FWD_PROPGRID WXDLLIMPEXP_PROPGRID
+ #define WXDLLIMPEXP_FWD_RIBBON WXDLLIMPEXP_RIBBON
+ #define WXDLLIMPEXP_FWD_RICHTEXT WXDLLIMPEXP_RICHTEXT
+ #define WXDLLIMPEXP_FWD_MEDIA WXDLLIMPEXP_MEDIA
+ #define WXDLLIMPEXP_FWD_STC WXDLLIMPEXP_STC
+ #define WXDLLIMPEXP_FWD_WEBVIEW WXDLLIMPEXP_WEBVIEW
+#endif
+
+/* for backwards compatibility, define suffix-less versions too */
+#define WXDLLEXPORT WXDLLIMPEXP_CORE
+#define WXDLLEXPORT_DATA WXDLLIMPEXP_DATA_CORE
+
+/*
+ MSVC up to 6.0 needs to be explicitly told to export template instantiations
+ used by the DLL clients, use this macro to do it like this:
+
+ template <typename T> class Foo { ... };
+ WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( Foo<int> )
+
+ (notice that currently we only need this for wxBase and wxCore libraries)
+ */
+#if defined(__VISUALC__) && (__VISUALC__ <= 1200)
+ #ifdef WXMAKINGDLL_BASE
+ #define WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE(decl) \
+ template class WXDLLIMPEXP_BASE decl;
+ #define WXDLLIMPEXP_TEMPLATE_INSTANCE_CORE(decl) \
+ template class WXDLLIMPEXP_CORE decl;
+ #else
+ /*
+ We need to disable this warning when using this macro, as
+ recommended by Microsoft itself:
+
+ http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b168958
+ */
+ #pragma warning(disable:4231)
+
+ #define WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE(decl) \
+ extern template class WXDLLIMPEXP_BASE decl;
+ #define WXDLLIMPEXP_TEMPLATE_INSTANCE_CORE(decl) \
+ extern template class WXDLLIMPEXP_CORE decl;
+ #endif
+#else /* not VC <= 6 */
+ #define WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE(decl)
+ #define WXDLLIMPEXP_TEMPLATE_INSTANCE_CORE(decl)
+#endif /* VC6/others */
+
+#endif /* _WX_DLIMPEXP_H_ */
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/dlist.h
+// Purpose: wxDList<T> which is a template version of wxList
+// Author: Robert Roebling
+// Created: 18.09.2008
+// Copyright: (c) 2008 wxWidgets team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DLIST_H_
+#define _WX_DLIST_H_
+
+#include "wx/defs.h"
+#include "wx/utils.h"
+
+#if wxUSE_STD_CONTAINERS
+
+#include "wx/beforestd.h"
+#include <algorithm>
+#include <iterator>
+#include <list>
+#include "wx/afterstd.h"
+
+template<typename T>
+class wxDList: public std::list<T*>
+{
+private:
+ bool m_destroy;
+ typedef std::list<T*> BaseListType;
+ typedef wxDList<T> ListType;
+
+public:
+ typedef typename BaseListType::iterator iterator;
+
+ class compatibility_iterator
+ {
+ private:
+ /* Workaround for broken VC6 nested class name resolution */
+ typedef typename BaseListType::iterator iterator;
+ friend class wxDList<T>;
+
+ iterator m_iter;
+ ListType *m_list;
+
+ public:
+ compatibility_iterator()
+ : m_iter(), m_list( NULL ) {}
+ compatibility_iterator( ListType* li, iterator i )
+ : m_iter( i ), m_list( li ) {}
+ compatibility_iterator( const ListType* li, iterator i )
+ : m_iter( i ), m_list( const_cast<ListType*>(li) ) {}
+
+ compatibility_iterator* operator->() { return this; }
+ const compatibility_iterator* operator->() const { return this; }
+
+ bool operator==(const compatibility_iterator& i) const
+ {
+ wxASSERT_MSG( m_list && i.m_list,
+ "comparing invalid iterators is illegal" );
+ return (m_list == i.m_list) && (m_iter == i.m_iter);
+ }
+ bool operator!=(const compatibility_iterator& i) const
+ { return !( operator==( i ) ); }
+ operator bool() const
+ { return m_list ? m_iter != m_list->end() : false; }
+ bool operator !() const
+ { return !( operator bool() ); }
+
+ T* GetData() const { return *m_iter; }
+ void SetData( T* e ) { *m_iter = e; }
+
+ compatibility_iterator GetNext() const
+ {
+ iterator i = m_iter;
+ return compatibility_iterator( m_list, ++i );
+ }
+
+ compatibility_iterator GetPrevious() const
+ {
+ if ( m_iter == m_list->begin() )
+ return compatibility_iterator();
+
+ iterator i = m_iter;
+ return compatibility_iterator( m_list, --i );
+ }
+
+ int IndexOf() const
+ {
+ return *this ? std::distance( m_list->begin(), m_iter )
+ : wxNOT_FOUND;
+ }
+ };
+
+public:
+ wxDList() : m_destroy( false ) {}
+
+ ~wxDList() { Clear(); }
+
+ compatibility_iterator Find( const T* e ) const
+ {
+ return compatibility_iterator( this,
+ std::find( const_cast<ListType*>(this)->begin(),
+ const_cast<ListType*>(this)->end(), e ) );
+ }
+
+ bool IsEmpty() const
+ { return this->empty(); }
+ size_t GetCount() const
+ { return this->size(); }
+
+ compatibility_iterator Item( size_t idx ) const
+ {
+ iterator i = const_cast<ListType*>(this)->begin();
+ std::advance( i, idx );
+ return compatibility_iterator( this, i );
+ }
+
+ T* operator[](size_t idx) const
+ {
+ return Item(idx).GetData();
+ }
+
+ compatibility_iterator GetFirst() const
+ {
+ return compatibility_iterator( this, const_cast<ListType*>(this)->begin() );
+ }
+ compatibility_iterator GetLast() const
+ {
+ iterator i = const_cast<ListType*>(this)->end();
+ return compatibility_iterator( this, !(this->empty()) ? --i : i );
+ }
+ compatibility_iterator Member( T* e ) const
+ { return Find( e ); }
+ compatibility_iterator Nth( int n ) const
+ { return Item( n ); }
+ int IndexOf( T* e ) const
+ { return Find( e ).IndexOf(); }
+
+ compatibility_iterator Append( T* e )
+ {
+ this->push_back( e );
+ return GetLast();
+ }
+
+ compatibility_iterator Insert( T* e )
+ {
+ this->push_front( e );
+ return compatibility_iterator( this, this->begin() );
+ }
+
+ compatibility_iterator Insert( compatibility_iterator & i, T* e )
+ {
+ return compatibility_iterator( this, this->insert( i.m_iter, e ) );
+ }
+
+ compatibility_iterator Insert( size_t idx, T* e )
+ {
+ return compatibility_iterator( this,
+ this->insert( Item( idx ).m_iter, e ) );
+ }
+
+ void DeleteContents( bool destroy )
+ { m_destroy = destroy; }
+
+ bool GetDeleteContents() const
+ { return m_destroy; }
+
+ void Erase( const compatibility_iterator& i )
+ {
+ if ( m_destroy )
+ delete i->GetData();
+ this->erase( i.m_iter );
+ }
+
+ bool DeleteNode( const compatibility_iterator& i )
+ {
+ if( i )
+ {
+ Erase( i );
+ return true;
+ }
+ return false;
+ }
+
+ bool DeleteObject( T* e )
+ {
+ return DeleteNode( Find( e ) );
+ }
+
+ void Clear()
+ {
+ if ( m_destroy )
+ {
+ iterator it, en;
+ for ( it = this->begin(), en = this->end(); it != en; ++it )
+ delete *it;
+ }
+ this->clear();
+ }
+};
+
+#else // !wxUSE_STD_CONTAINERS
+
+template <typename T>
+class wxDList
+{
+public:
+ class Node
+ {
+ public:
+ Node(wxDList<T> *list = NULL,
+ Node *previous = NULL,
+ Node *next = NULL,
+ T *data = NULL)
+ {
+ m_list = list;
+ m_previous = previous;
+ m_next = next;
+ m_data = data;
+ if (previous)
+ previous->m_next = this;
+ if (next)
+ next->m_previous = this;
+ }
+
+ ~Node()
+ {
+ // handle the case when we're being deleted from the list by
+ // the user (i.e. not by the list itself from DeleteNode) -
+ // we must do it for compatibility with old code
+ if (m_list != NULL)
+ m_list->DetachNode(this);
+ }
+
+ void DeleteData()
+ {
+ delete m_data;
+ }
+
+ Node *GetNext() const { return m_next; }
+ Node *GetPrevious() const { return m_previous; }
+ T *GetData() const { return m_data; }
+ T **GetDataPtr() const { return &(wx_const_cast(nodetype*,this)->m_data); }
+ void SetData( T *data ) { m_data = data; }
+
+ int IndexOf() const
+ {
+ wxCHECK_MSG( m_list, wxNOT_FOUND,
+ "node doesn't belong to a list in IndexOf" );
+
+ int i;
+ Node *prev = m_previous;
+ for( i = 0; prev; i++ )
+ prev = prev->m_previous;
+ return i;
+ }
+
+ private:
+ T *m_data; // user data
+ Node *m_next, // next and previous nodes in the list
+ *m_previous;
+ wxDList<T> *m_list; // list we belong to
+
+ friend class wxDList<T>;
+ };
+
+ typedef Node nodetype;
+
+ class compatibility_iterator
+ {
+ public:
+ compatibility_iterator(nodetype *ptr = NULL) : m_ptr(ptr) { }
+ nodetype *operator->() const { return m_ptr; }
+ operator nodetype *() const { return m_ptr; }
+
+ private:
+ nodetype *m_ptr;
+ };
+
+private:
+ void Init()
+ {
+ m_nodeFirst =
+ m_nodeLast = NULL;
+ m_count = 0;
+ m_destroy = false;
+ }
+
+ void DoDeleteNode( nodetype *node )
+ {
+ if ( m_destroy )
+ node->DeleteData();
+ // so that the node knows that it's being deleted by the list
+ node->m_list = NULL;
+ delete node;
+ }
+
+ size_t m_count; // number of elements in the list
+ bool m_destroy; // destroy user data when deleting list items?
+ nodetype *m_nodeFirst, // pointers to the head and tail of the list
+ *m_nodeLast;
+
+public:
+ wxDList()
+ {
+ Init();
+ }
+
+ wxDList( const wxDList<T>& list )
+ {
+ Init();
+ Assign(list);
+ }
+
+ wxDList( size_t count, T *elements[] )
+ {
+ Init();
+ size_t n;
+ for (n = 0; n < count; n++)
+ Append( elements[n] );
+ }
+
+ wxDList& operator=( const wxDList<T>& list )
+ {
+ if (&list != this)
+ Assign(list);
+ return *this;
+ }
+
+ ~wxDList()
+ {
+ nodetype *each = m_nodeFirst;
+ while ( each != NULL )
+ {
+ nodetype *next = each->GetNext();
+ DoDeleteNode(each);
+ each = next;
+ }
+ }
+
+ void Assign(const wxDList<T> &list)
+ {
+ wxASSERT_MSG( !list.m_destroy,
+ "copying list which owns it's elements is a bad idea" );
+ Clear();
+ m_destroy = list.m_destroy;
+ m_nodeFirst = NULL;
+ m_nodeLast = NULL;
+ nodetype* node;
+ for (node = list.GetFirst(); node; node = node->GetNext() )
+ Append(node->GetData());
+ wxASSERT_MSG( m_count == list.m_count, "logic error in Assign()" );
+ }
+
+ nodetype *Append( T *object )
+ {
+ nodetype *node = new nodetype( this, m_nodeLast, NULL, object );
+
+ if ( !m_nodeFirst )
+ {
+ m_nodeFirst = node;
+ m_nodeLast = m_nodeFirst;
+ }
+ else
+ {
+ m_nodeLast->m_next = node;
+ m_nodeLast = node;
+ }
+ m_count++;
+ return node;
+ }
+
+ nodetype *Insert( T* object )
+ {
+ return Insert( NULL, object );
+ }
+
+ nodetype *Insert( size_t pos, T* object )
+ {
+ if (pos == m_count)
+ return Append( object );
+ else
+ return Insert( Item(pos), object );
+ }
+
+ nodetype *Insert( nodetype *position, T* object )
+ {
+ wxCHECK_MSG( !position || position->m_list == this, NULL,
+ "can't insert before a node from another list" );
+
+ // previous and next node for the node being inserted
+ nodetype *prev, *next;
+ if ( position )
+ {
+ prev = position->GetPrevious();
+ next = position;
+ }
+ else
+ {
+ // inserting in the beginning of the list
+ prev = NULL;
+ next = m_nodeFirst;
+ }
+ nodetype *node = new nodetype( this, prev, next, object );
+ if ( !m_nodeFirst )
+ m_nodeLast = node;
+ if ( prev == NULL )
+ m_nodeFirst = node;
+ m_count++;
+ return node;
+ }
+
+ nodetype *GetFirst() const { return m_nodeFirst; }
+ nodetype *GetLast() const { return m_nodeLast; }
+ size_t GetCount() const { return m_count; }
+ bool IsEmpty() const { return m_count == 0; }
+
+ void DeleteContents(bool destroy) { m_destroy = destroy; }
+ bool GetDeleteContents() const { return m_destroy; }
+
+ nodetype *Item(size_t index) const
+ {
+ for ( nodetype *current = GetFirst(); current; current = current->GetNext() )
+ {
+ if ( index-- == 0 )
+ return current;
+ }
+ wxFAIL_MSG( "invalid index in Item()" );
+ return NULL;
+ }
+
+ T *operator[](size_t index) const
+ {
+ nodetype *node = Item(index);
+ return node ? node->GetData() : NULL;
+ }
+
+ nodetype *DetachNode( nodetype *node )
+ {
+ wxCHECK_MSG( node, NULL, "detaching NULL wxNodeBase" );
+ wxCHECK_MSG( node->m_list == this, NULL,
+ "detaching node which is not from this list" );
+ // update the list
+ nodetype **prevNext = node->GetPrevious() ? &node->GetPrevious()->m_next
+ : &m_nodeFirst;
+ nodetype **nextPrev = node->GetNext() ? &node->GetNext()->m_previous
+ : &m_nodeLast;
+ *prevNext = node->GetNext();
+ *nextPrev = node->GetPrevious();
+ m_count--;
+ // mark the node as not belonging to this list any more
+ node->m_list = NULL;
+ return node;
+ }
+
+ void Erase( nodetype *node )
+ {
+ DeleteNode(node);
+ }
+
+ bool DeleteNode( nodetype *node )
+ {
+ if ( !DetachNode(node) )
+ return false;
+ DoDeleteNode(node);
+ return true;
+ }
+
+ bool DeleteObject( T *object )
+ {
+ for ( nodetype *current = GetFirst(); current; current = current->GetNext() )
+ {
+ if ( current->GetData() == object )
+ {
+ DeleteNode(current);
+ return true;
+ }
+ }
+ // not found
+ return false;
+ }
+
+ nodetype *Find(const T *object) const
+ {
+ for ( nodetype *current = GetFirst(); current; current = current->GetNext() )
+ {
+ if ( current->GetData() == object )
+ return current;
+ }
+ // not found
+ return NULL;
+ }
+
+ int IndexOf(const T *object) const
+ {
+ int n = 0;
+ for ( nodetype *current = GetFirst(); current; current = current->GetNext() )
+ {
+ if ( current->GetData() == object )
+ return n;
+ n++;
+ }
+ return wxNOT_FOUND;
+ }
+
+ void Clear()
+ {
+ nodetype *current = m_nodeFirst;
+ while ( current )
+ {
+ nodetype *next = current->GetNext();
+ DoDeleteNode(current);
+ current = next;
+ }
+ m_nodeFirst =
+ m_nodeLast = NULL;
+ m_count = 0;
+ }
+
+ void Reverse()
+ {
+ nodetype * node = m_nodeFirst;
+ nodetype* tmp;
+ while (node)
+ {
+ // swap prev and next pointers
+ tmp = node->m_next;
+ node->m_next = node->m_previous;
+ node->m_previous = tmp;
+ // this is the node that was next before swapping
+ node = tmp;
+ }
+ // swap first and last node
+ tmp = m_nodeFirst; m_nodeFirst = m_nodeLast; m_nodeLast = tmp;
+ }
+
+ void DeleteNodes(nodetype* first, nodetype* last)
+ {
+ nodetype * node = first;
+ while (node != last)
+ {
+ nodetype* next = node->GetNext();
+ DeleteNode(node);
+ node = next;
+ }
+ }
+
+ void ForEach(wxListIterateFunction F)
+ {
+ for ( nodetype *current = GetFirst(); current; current = current->GetNext() )
+ (*F)(current->GetData());
+ }
+
+ T *FirstThat(wxListIterateFunction F)
+ {
+ for ( nodetype *current = GetFirst(); current; current = current->GetNext() )
+ {
+ if ( (*F)(current->GetData()) )
+ return current->GetData();
+ }
+ return NULL;
+ }
+
+ T *LastThat(wxListIterateFunction F)
+ {
+ for ( nodetype *current = GetLast(); current; current = current->GetPrevious() )
+ {
+ if ( (*F)(current->GetData()) )
+ return current->GetData();
+ }
+ return NULL;
+ }
+
+ /* STL interface */
+public:
+ typedef size_t size_type;
+ typedef int difference_type;
+ typedef T* value_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
+ class iterator
+ {
+ public:
+ typedef nodetype Node;
+ typedef iterator itor;
+ typedef T* value_type;
+ typedef value_type* ptr_type;
+ typedef value_type& reference;
+
+ Node* m_node;
+ Node* m_init;
+ public:
+ typedef reference reference_type;
+ typedef ptr_type pointer_type;
+
+ iterator(Node* node, Node* init) : m_node(node), m_init(init) {}
+ iterator() : m_node(NULL), m_init(NULL) { }
+ reference_type operator*() const
+ { return *m_node->GetDataPtr(); }
+ // ptrop
+ itor& operator++() { m_node = m_node->GetNext(); return *this; }
+ const itor operator++(int)
+ { itor tmp = *this; m_node = m_node->GetNext(); return tmp; }
+ itor& operator--()
+ {
+ m_node = m_node ? m_node->GetPrevious() : m_init;
+ return *this;
+ }
+ const itor operator--(int)
+ {
+ itor tmp = *this;
+ m_node = m_node ? m_node->GetPrevious() : m_init;
+ return tmp;
+ }
+ bool operator!=(const itor& it) const
+ { return it.m_node != m_node; }
+ bool operator==(const itor& it) const
+ { return it.m_node == m_node; }
+ };
+ class const_iterator
+ {
+ public:
+ typedef nodetype Node;
+ typedef T* value_type;
+ typedef const value_type& const_reference;
+ typedef const_iterator itor;
+ typedef value_type* ptr_type;
+
+ Node* m_node;
+ Node* m_init;
+ public:
+ typedef const_reference reference_type;
+ typedef const ptr_type pointer_type;
+
+ const_iterator(Node* node, Node* init)
+ : m_node(node), m_init(init) { }
+ const_iterator() : m_node(NULL), m_init(NULL) { }
+ const_iterator(const iterator& it)
+ : m_node(it.m_node), m_init(it.m_init) { }
+ reference_type operator*() const
+ { return *m_node->GetDataPtr(); }
+ // ptrop
+ itor& operator++() { m_node = m_node->GetNext(); return *this; }
+ const itor operator++(int)
+ { itor tmp = *this; m_node = m_node->GetNext(); return tmp; }
+ itor& operator--()
+ {
+ m_node = m_node ? m_node->GetPrevious() : m_init;
+ return *this;
+ }
+ const itor operator--(int)
+ {
+ itor tmp = *this;
+ m_node = m_node ? m_node->GetPrevious() : m_init;
+ return tmp;
+ }
+ bool operator!=(const itor& it) const
+ { return it.m_node != m_node; }
+ bool operator==(const itor& it) const
+ { return it.m_node == m_node; }
+ };
+
+ class reverse_iterator
+ {
+ public:
+ typedef nodetype Node;
+ typedef T* value_type;
+ typedef reverse_iterator itor;
+ typedef value_type* ptr_type;
+ typedef value_type& reference;
+
+ Node* m_node;
+ Node* m_init;
+ public:
+ typedef reference reference_type;
+ typedef ptr_type pointer_type;
+
+ reverse_iterator(Node* node, Node* init)
+ : m_node(node), m_init(init) { }
+ reverse_iterator() : m_node(NULL), m_init(NULL) { }
+ reference_type operator*() const
+ { return *m_node->GetDataPtr(); }
+ // ptrop
+ itor& operator++()
+ { m_node = m_node->GetPrevious(); return *this; }
+ const itor operator++(int)
+ { itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; }
+ itor& operator--()
+ { m_node = m_node ? m_node->GetNext() : m_init; return *this; }
+ const itor operator--(int)
+ {
+ itor tmp = *this;
+ m_node = m_node ? m_node->GetNext() : m_init;
+ return tmp;
+ }
+ bool operator!=(const itor& it) const
+ { return it.m_node != m_node; }
+ bool operator==(const itor& it) const
+ { return it.m_node == m_node; }
+ };
+
+ class const_reverse_iterator
+ {
+ public:
+ typedef nodetype Node;
+ typedef T* value_type;
+ typedef const_reverse_iterator itor;
+ typedef value_type* ptr_type;
+ typedef const value_type& const_reference;
+
+ Node* m_node;
+ Node* m_init;
+ public:
+ typedef const_reference reference_type;
+ typedef const ptr_type pointer_type;
+
+ const_reverse_iterator(Node* node, Node* init)
+ : m_node(node), m_init(init) { }
+ const_reverse_iterator() : m_node(NULL), m_init(NULL) { }
+ const_reverse_iterator(const reverse_iterator& it)
+ : m_node(it.m_node), m_init(it.m_init) { }
+ reference_type operator*() const
+ { return *m_node->GetDataPtr(); }
+ // ptrop
+ itor& operator++()
+ { m_node = m_node->GetPrevious(); return *this; }
+ const itor operator++(int)
+ { itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; }
+ itor& operator--()
+ { m_node = m_node ? m_node->GetNext() : m_init; return *this;}
+ const itor operator--(int)
+ {
+ itor tmp = *this;
+ m_node = m_node ? m_node->GetNext() : m_init;
+ return tmp;
+ }
+ bool operator!=(const itor& it) const
+ { return it.m_node != m_node; }
+ bool operator==(const itor& it) const
+ { return it.m_node == m_node; }
+ };
+
+ wxEXPLICIT wxDList(size_type n, const_reference v = value_type())
+ { assign(n, v); }
+ wxDList(const const_iterator& first, const const_iterator& last)
+ { assign(first, last); }
+ iterator begin() { return iterator(GetFirst(), GetLast()); }
+ const_iterator begin() const
+ { return const_iterator(GetFirst(), GetLast()); }
+ iterator end() { return iterator(NULL, GetLast()); }
+ const_iterator end() const { return const_iterator(NULL, GetLast()); }
+ reverse_iterator rbegin()
+ { return reverse_iterator(GetLast(), GetFirst()); }
+ const_reverse_iterator rbegin() const
+ { return const_reverse_iterator(GetLast(), GetFirst()); }
+ reverse_iterator rend() { return reverse_iterator(NULL, GetFirst()); }
+ const_reverse_iterator rend() const
+ { return const_reverse_iterator(NULL, GetFirst()); }
+ void resize(size_type n, value_type v = value_type())
+ {
+ while (n < size())
+ pop_back();
+ while (n > size())
+ push_back(v);
+ }
+ size_type size() const { return GetCount(); }
+ size_type max_size() const { return INT_MAX; }
+ bool empty() const { return IsEmpty(); }
+ reference front() { return *begin(); }
+ const_reference front() const { return *begin(); }
+ reference back() { iterator tmp = end(); return *--tmp; }
+ const_reference back() const { const_iterator tmp = end(); return *--tmp; }
+ void push_front(const_reference v = value_type())
+ { Insert(GetFirst(), v); }
+ void pop_front() { DeleteNode(GetFirst()); }
+ void push_back(const_reference v = value_type())
+ { Append( v ); }
+ void pop_back() { DeleteNode(GetLast()); }
+ void assign(const_iterator first, const const_iterator& last)
+ {
+ clear();
+ for(; first != last; ++first)
+ Append(*first);
+ }
+ void assign(size_type n, const_reference v = value_type())
+ {
+ clear();
+ for(size_type i = 0; i < n; ++i)
+ Append(v);
+ }
+ iterator insert(const iterator& it, const_reference v)
+ {
+ if (it == end())
+ Append( v );
+ else
+ Insert(it.m_node,v);
+ iterator itprev(it);
+ return itprev--;
+ }
+ void insert(const iterator& it, size_type n, const_reference v)
+ {
+ for(size_type i = 0; i < n; ++i)
+ Insert(it.m_node, v);
+ }
+ void insert(const iterator& it, const_iterator first, const const_iterator& last)
+ {
+ for(; first != last; ++first)
+ Insert(it.m_node, *first);
+ }
+ iterator erase(const iterator& it)
+ {
+ iterator next = iterator(it.m_node->GetNext(), GetLast());
+ DeleteNode(it.m_node); return next;
+ }
+ iterator erase(const iterator& first, const iterator& last)
+ {
+ iterator next = last; ++next;
+ DeleteNodes(first.m_node, last.m_node);
+ return next;
+ }
+ void clear() { Clear(); }
+ void splice(const iterator& it, wxDList<T>& l, const iterator& first, const iterator& last)
+ { insert(it, first, last); l.erase(first, last); }
+ void splice(const iterator& it, wxDList<T>& l)
+ { splice(it, l, l.begin(), l.end() ); }
+ void splice(const iterator& it, wxDList<T>& l, const iterator& first)
+ {
+ iterator tmp = first; ++tmp;
+ if(it == first || it == tmp) return;
+ insert(it, *first);
+ l.erase(first);
+ }
+ void remove(const_reference v)
+ { DeleteObject(v); }
+ void reverse()
+ { Reverse(); }
+ /* void swap(list<T>& l)
+ {
+ { size_t t = m_count; m_count = l.m_count; l.m_count = t; }
+ { bool t = m_destroy; m_destroy = l.m_destroy; l.m_destroy = t; }
+ { wxNodeBase* t = m_nodeFirst; m_nodeFirst = l.m_nodeFirst; l.m_nodeFirst = t; }
+ { wxNodeBase* t = m_nodeLast; m_nodeLast = l.m_nodeLast; l.m_nodeLast = t; }
+ { wxKeyType t = m_keyType; m_keyType = l.m_keyType; l.m_keyType = t; }
+ } */
+};
+
+#endif // wxUSE_STD_CONTAINERS/!wxUSE_STD_CONTAINERS
+
+#endif // _WX_DLIST_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/dnd.h
+// Purpose: Drag and drop classes declarations
+// Author: Vadim Zeitlin, Robert Roebling
+// Modified by:
+// Created: 26.05.99
+// Copyright: (c) wxWidgets Team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DND_H_BASE_
+#define _WX_DND_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_DRAG_AND_DROP
+
+#include "wx/dataobj.h"
+#include "wx/cursor.h"
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// flags for wxDropSource::DoDragDrop()
+//
+// NB: wxDrag_CopyOnly must be 0 (== FALSE) and wxDrag_AllowMove must be 1
+// (== TRUE) for compatibility with the old DoDragDrop(bool) method!
+enum
+{
+ wxDrag_CopyOnly = 0, // allow only copying
+ wxDrag_AllowMove = 1, // allow moving (copying is always allowed)
+ wxDrag_DefaultMove = 3 // the default operation is move, not copy
+};
+
+// result of wxDropSource::DoDragDrop() call
+enum wxDragResult
+{
+ wxDragError, // error prevented the d&d operation from completing
+ wxDragNone, // drag target didn't accept the data
+ wxDragCopy, // the data was successfully copied
+ wxDragMove, // the data was successfully moved (MSW only)
+ wxDragLink, // operation is a drag-link
+ wxDragCancel // the operation was cancelled by user (not an error)
+};
+
+// return true if res indicates that something was done during a dnd operation,
+// i.e. is neither error nor none nor cancel
+WXDLLIMPEXP_CORE bool wxIsDragResultOk(wxDragResult res);
+
+// ----------------------------------------------------------------------------
+// wxDropSource is the object you need to create (and call DoDragDrop on it)
+// to initiate a drag-and-drop operation
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDropSourceBase
+{
+public:
+ wxDropSourceBase(const wxCursor &cursorCopy = wxNullCursor,
+ const wxCursor &cursorMove = wxNullCursor,
+ const wxCursor &cursorStop = wxNullCursor)
+ : m_cursorCopy(cursorCopy),
+ m_cursorMove(cursorMove),
+ m_cursorStop(cursorStop)
+ { m_data = NULL; }
+ virtual ~wxDropSourceBase() { }
+
+ // set the data which is transferred by drag and drop
+ void SetData(wxDataObject& data)
+ { m_data = &data; }
+
+ wxDataObject *GetDataObject()
+ { return m_data; }
+
+ // set the icon corresponding to given drag result
+ void SetCursor(wxDragResult res, const wxCursor& cursor)
+ {
+ if ( res == wxDragCopy )
+ m_cursorCopy = cursor;
+ else if ( res == wxDragMove )
+ m_cursorMove = cursor;
+ else
+ m_cursorStop = cursor;
+ }
+
+ // start drag action, see enum wxDragResult for return value description
+ //
+ // if flags contains wxDrag_AllowMove, moving (and only copying) data is
+ // allowed, if it contains wxDrag_DefaultMove (which includes the previous
+ // flag), it is even the default operation
+ virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly) = 0;
+
+ // override to give feedback depending on the current operation result
+ // "effect" and return true if you did something, false to let the library
+ // give the default feedback
+ virtual bool GiveFeedback(wxDragResult WXUNUSED(effect)) { return false; }
+
+protected:
+ const wxCursor& GetCursor(wxDragResult res) const
+ {
+ if ( res == wxDragCopy )
+ return m_cursorCopy;
+ else if ( res == wxDragMove )
+ return m_cursorMove;
+ else
+ return m_cursorStop;
+ }
+
+ // the data we're dragging
+ wxDataObject *m_data;
+
+ // the cursors to use for feedback
+ wxCursor m_cursorCopy,
+ m_cursorMove,
+ m_cursorStop;
+
+ wxDECLARE_NO_COPY_CLASS(wxDropSourceBase);
+};
+
+// ----------------------------------------------------------------------------
+// wxDropTarget should be associated with a window if it wants to be able to
+// receive data via drag and drop.
+//
+// To use this class, you should derive from wxDropTarget and implement
+// OnData() pure virtual method. You may also wish to override OnDrop() if you
+// want to accept the data only inside some region of the window (this may
+// avoid having to copy the data to this application which happens only when
+// OnData() is called)
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDropTargetBase
+{
+public:
+ // ctor takes a pointer to heap-allocated wxDataObject which will be owned
+ // by wxDropTarget and deleted by it automatically. If you don't give it
+ // here, you can use SetDataObject() later.
+ wxDropTargetBase(wxDataObject *dataObject = NULL)
+ { m_dataObject = dataObject; m_defaultAction = wxDragNone; }
+ // dtor deletes our data object
+ virtual ~wxDropTargetBase()
+ { delete m_dataObject; }
+
+ // get/set the associated wxDataObject
+ wxDataObject *GetDataObject() const
+ { return m_dataObject; }
+ void SetDataObject(wxDataObject *dataObject)
+ { if (m_dataObject) delete m_dataObject;
+ m_dataObject = dataObject; }
+
+ // these functions are called when data is moved over position (x, y) and
+ // may return either wxDragCopy, wxDragMove or wxDragNone depending on
+ // what would happen if the data were dropped here.
+ //
+ // the last parameter is what would happen by default and is determined by
+ // the platform-specific logic (for example, under Windows it's wxDragCopy
+ // if Ctrl key is pressed and wxDragMove otherwise) except that it will
+ // always be wxDragNone if the carried data is in an unsupported format.
+
+ // called when the mouse enters the window (only once until OnLeave())
+ virtual wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def)
+ { return OnDragOver(x, y, def); }
+
+ // called when the mouse moves in the window - shouldn't take long to
+ // execute or otherwise mouse movement would be too slow
+ virtual wxDragResult OnDragOver(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
+ wxDragResult def)
+ { return def; }
+
+ // called when mouse leaves the window: might be used to remove the
+ // feedback which was given in OnEnter()
+ virtual void OnLeave() { }
+
+ // this function is called when data is dropped at position (x, y) - if it
+ // returns true, OnData() will be called immediately afterwards which will
+ // allow to retrieve the data dropped.
+ virtual bool OnDrop(wxCoord x, wxCoord y) = 0;
+
+ // called after OnDrop() returns TRUE: you will usually just call
+ // GetData() from here and, probably, also refresh something to update the
+ // new data and, finally, return the code indicating how did the operation
+ // complete (returning default value in case of success and wxDragError on
+ // failure is usually ok)
+ virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def) = 0;
+
+ // may be called *only* from inside OnData() and will fill m_dataObject
+ // with the data from the drop source if it returns true
+ virtual bool GetData() = 0;
+
+ // sets the default action for drag and drop:
+ // use wxDragMove or wxDragCopy to set deafult action to move or copy
+ // and use wxDragNone (default) to set default action specified by
+ // initialization of draging (see wxDropSourceBase::DoDragDrop())
+ void SetDefaultAction(wxDragResult action)
+ { m_defaultAction = action; }
+
+ // returns default action for drag and drop or
+ // wxDragNone if this not specified
+ wxDragResult GetDefaultAction()
+ { return m_defaultAction; }
+
+protected:
+ wxDataObject *m_dataObject;
+ wxDragResult m_defaultAction;
+
+ wxDECLARE_NO_COPY_CLASS(wxDropTargetBase);
+};
+
+// ----------------------------------------------------------------------------
+// include platform dependent class declarations
+// ----------------------------------------------------------------------------
+
+#if defined(__WXMSW__)
+ #include "wx/msw/ole/dropsrc.h"
+ #include "wx/msw/ole/droptgt.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/dnd.h"
+#elif defined(__WXX11__)
+ #include "wx/x11/dnd.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/dnd.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/dnd.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/dnd.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/dnd.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// standard wxDropTarget implementations (implemented in common/dobjcmn.cpp)
+// ----------------------------------------------------------------------------
+
+// A simple wxDropTarget derived class for text data: you only need to
+// override OnDropText() to get something working
+class WXDLLIMPEXP_CORE wxTextDropTarget : public wxDropTarget
+{
+public:
+ wxTextDropTarget();
+
+ virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& text) = 0;
+
+ virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxTextDropTarget);
+};
+
+// A drop target which accepts files (dragged from File Manager or Explorer)
+class WXDLLIMPEXP_CORE wxFileDropTarget : public wxDropTarget
+{
+public:
+ wxFileDropTarget();
+
+ // parameters are the number of files and the array of file names
+ virtual bool OnDropFiles(wxCoord x, wxCoord y,
+ const wxArrayString& filenames) = 0;
+
+ virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxFileDropTarget);
+};
+
+#endif // wxUSE_DRAG_AND_DROP
+
+#endif // _WX_DND_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/docmdi.h
+// Purpose: Frame classes for MDI document/view applications
+// Author: Julian Smart
+// Created: 01/02/97
+// Copyright: (c) 1997 Julian Smart
+// (c) 2010 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DOCMDI_H_
+#define _WX_DOCMDI_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_MDI_ARCHITECTURE
+
+#include "wx/docview.h"
+#include "wx/mdi.h"
+
+#ifdef __VISUALC6__
+ // "non dll-interface class 'wxDocXXXFrameAny<>' used as base interface for
+ // dll-interface class 'wxDocMDIXXXFrame'" -- this is bogus as the template
+ // will be DLL-exported but only once it is used as base class here!
+ #pragma warning (push)
+ #pragma warning (disable:4275)
+#endif
+
+// Define MDI versions of the doc-view frame classes. Note that we need to
+// define them as classes for wxRTTI, otherwise we could simply define them as
+// typedefs.
+
+// ----------------------------------------------------------------------------
+// An MDI document parent frame
+// ----------------------------------------------------------------------------
+
+typedef
+ wxDocParentFrameAny<wxMDIParentFrame> wxDocMDIParentFrameBase;
+
+class WXDLLIMPEXP_CORE wxDocMDIParentFrame : public wxDocMDIParentFrameBase
+{
+public:
+ wxDocMDIParentFrame() : wxDocMDIParentFrameBase() { }
+
+ wxDocMDIParentFrame(wxDocManager *manager,
+ wxFrame *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr)
+ : wxDocMDIParentFrameBase(manager,
+ parent, id, title, pos, size, style, name)
+ {
+ }
+
+private:
+ DECLARE_CLASS(wxDocMDIParentFrame)
+ wxDECLARE_NO_COPY_CLASS(wxDocMDIParentFrame);
+};
+
+// ----------------------------------------------------------------------------
+// An MDI document child frame
+// ----------------------------------------------------------------------------
+
+typedef
+ wxDocChildFrameAny<wxMDIChildFrame, wxMDIParentFrame> wxDocMDIChildFrameBase;
+
+class WXDLLIMPEXP_CORE wxDocMDIChildFrame : public wxDocMDIChildFrameBase
+{
+public:
+ wxDocMDIChildFrame() { }
+
+ wxDocMDIChildFrame(wxDocument *doc,
+ wxView *view,
+ wxMDIParentFrame *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr)
+ : wxDocMDIChildFrameBase(doc, view,
+ parent, id, title, pos, size, style, name)
+ {
+ }
+
+private:
+ DECLARE_CLASS(wxDocMDIChildFrame)
+ wxDECLARE_NO_COPY_CLASS(wxDocMDIChildFrame);
+};
+
+#ifdef __VISUALC6__
+ #pragma warning (pop)
+#endif
+
+#endif // wxUSE_MDI_ARCHITECTURE
+
+#endif // _WX_DOCMDI_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/docview.h
+// Purpose: Doc/View classes
+// Author: Julian Smart
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DOCH__
+#define _WX_DOCH__
+
+#include "wx/defs.h"
+
+#if wxUSE_DOC_VIEW_ARCHITECTURE
+
+#include "wx/list.h"
+#include "wx/dlist.h"
+#include "wx/string.h"
+#include "wx/frame.h"
+#include "wx/filehistory.h"
+#include "wx/vector.h"
+
+#if wxUSE_PRINTING_ARCHITECTURE
+ #include "wx/print.h"
+#endif
+
+class WXDLLIMPEXP_FWD_CORE wxWindow;
+class WXDLLIMPEXP_FWD_CORE wxDocument;
+class WXDLLIMPEXP_FWD_CORE wxView;
+class WXDLLIMPEXP_FWD_CORE wxDocTemplate;
+class WXDLLIMPEXP_FWD_CORE wxDocManager;
+class WXDLLIMPEXP_FWD_CORE wxPrintInfo;
+class WXDLLIMPEXP_FWD_CORE wxCommandProcessor;
+class WXDLLIMPEXP_FWD_BASE wxConfigBase;
+
+class wxDocChildFrameAnyBase;
+
+#if wxUSE_STD_IOSTREAM
+ #include "wx/iosfwrap.h"
+#else
+ #include "wx/stream.h"
+#endif
+
+// Flags for wxDocManager (can be combined).
+enum
+{
+ wxDOC_NEW = 1,
+ wxDOC_SILENT = 2
+};
+
+// Document template flags
+enum
+{
+ wxTEMPLATE_VISIBLE = 1,
+ wxTEMPLATE_INVISIBLE = 2,
+ wxDEFAULT_TEMPLATE_FLAGS = wxTEMPLATE_VISIBLE
+};
+
+#define wxMAX_FILE_HISTORY 9
+
+typedef wxVector<wxDocument*> wxDocVector;
+typedef wxVector<wxView*> wxViewVector;
+typedef wxVector<wxDocTemplate*> wxDocTemplateVector;
+
+class WXDLLIMPEXP_CORE wxDocument : public wxEvtHandler
+{
+public:
+ wxDocument(wxDocument *parent = NULL);
+ virtual ~wxDocument();
+
+ // accessors
+ void SetFilename(const wxString& filename, bool notifyViews = false);
+ wxString GetFilename() const { return m_documentFile; }
+
+ void SetTitle(const wxString& title) { m_documentTitle = title; }
+ wxString GetTitle() const { return m_documentTitle; }
+
+ void SetDocumentName(const wxString& name) { m_documentTypeName = name; }
+ wxString GetDocumentName() const { return m_documentTypeName; }
+
+ // access the flag indicating whether this document had been already saved,
+ // SetDocumentSaved() is only used internally, don't call it
+ bool GetDocumentSaved() const { return m_savedYet; }
+ void SetDocumentSaved(bool saved = true) { m_savedYet = saved; }
+
+ // activate the first view of the document if any
+ void Activate();
+
+ // return true if the document hasn't been modified since the last time it
+ // was saved (implying that it returns false if it was never saved, even if
+ // the document is not modified)
+ bool AlreadySaved() const { return !IsModified() && GetDocumentSaved(); }
+
+ virtual bool Close();
+ virtual bool Save();
+ virtual bool SaveAs();
+ virtual bool Revert();
+
+#if wxUSE_STD_IOSTREAM
+ virtual wxSTD ostream& SaveObject(wxSTD ostream& stream);
+ virtual wxSTD istream& LoadObject(wxSTD istream& stream);
+#else
+ virtual wxOutputStream& SaveObject(wxOutputStream& stream);
+ virtual wxInputStream& LoadObject(wxInputStream& stream);
+#endif
+
+ // Called by wxWidgets
+ virtual bool OnSaveDocument(const wxString& filename);
+ virtual bool OnOpenDocument(const wxString& filename);
+ virtual bool OnNewDocument();
+ virtual bool OnCloseDocument();
+
+ // Prompts for saving if about to close a modified document. Returns true
+ // if ok to close the document (may have saved in the meantime, or set
+ // modified to false)
+ virtual bool OnSaveModified();
+
+ // if you override, remember to call the default
+ // implementation (wxDocument::OnChangeFilename)
+ virtual void OnChangeFilename(bool notifyViews);
+
+ // Called by framework if created automatically by the default document
+ // manager: gives document a chance to initialise and (usually) create a
+ // view
+ virtual bool OnCreate(const wxString& path, long flags);
+
+ // By default, creates a base wxCommandProcessor.
+ virtual wxCommandProcessor *OnCreateCommandProcessor();
+ virtual wxCommandProcessor *GetCommandProcessor() const
+ { return m_commandProcessor; }
+ virtual void SetCommandProcessor(wxCommandProcessor *proc)
+ { m_commandProcessor = proc; }
+
+ // Called after a view is added or removed. The default implementation
+ // deletes the document if this is there are no more views.
+ virtual void OnChangedViewList();
+
+ // Called from OnCloseDocument(), does nothing by default but may be
+ // overridden. Return value is ignored.
+ virtual bool DeleteContents();
+
+ virtual bool Draw(wxDC&);
+ virtual bool IsModified() const { return m_documentModified; }
+ virtual void Modify(bool mod);
+
+ virtual bool AddView(wxView *view);
+ virtual bool RemoveView(wxView *view);
+
+#ifndef __VISUALC6__
+ wxViewVector GetViewsVector() const;
+#endif // !__VISUALC6__
+
+ wxList& GetViews() { return m_documentViews; }
+ const wxList& GetViews() const { return m_documentViews; }
+
+ wxView *GetFirstView() const;
+
+ virtual void UpdateAllViews(wxView *sender = NULL, wxObject *hint = NULL);
+ virtual void NotifyClosing();
+
+ // Remove all views (because we're closing the document)
+ virtual bool DeleteAllViews();
+
+ // Other stuff
+ virtual wxDocManager *GetDocumentManager() const;
+ virtual wxDocTemplate *GetDocumentTemplate() const
+ { return m_documentTemplate; }
+ virtual void SetDocumentTemplate(wxDocTemplate *temp)
+ { m_documentTemplate = temp; }
+
+ // Get the document name to be shown to the user: the title if there is
+ // any, otherwise the filename if the document was saved and, finally,
+ // "unnamed" otherwise
+ virtual wxString GetUserReadableName() const;
+
+#if WXWIN_COMPATIBILITY_2_8
+ // use GetUserReadableName() instead
+ wxDEPRECATED_BUT_USED_INTERNALLY(
+ virtual bool GetPrintableName(wxString& buf) const
+ );
+#endif // WXWIN_COMPATIBILITY_2_8
+
+ // Returns a window that can be used as a parent for document-related
+ // dialogs. Override if necessary.
+ virtual wxWindow *GetDocumentWindow() const;
+
+ // Returns true if this document is a child document corresponding to a
+ // part of the parent document and not a disk file as usual.
+ bool IsChildDocument() const { return m_documentParent != NULL; }
+
+protected:
+ wxList m_documentViews;
+ wxString m_documentFile;
+ wxString m_documentTitle;
+ wxString m_documentTypeName;
+ wxDocTemplate* m_documentTemplate;
+ bool m_documentModified;
+
+ // if the document parent is non-NULL, it's a pseudo-document corresponding
+ // to a part of the parent document which can't be saved or loaded
+ // independently of its parent and is always closed when its parent is
+ wxDocument* m_documentParent;
+
+ wxCommandProcessor* m_commandProcessor;
+ bool m_savedYet;
+
+ // Called by OnSaveDocument and OnOpenDocument to implement standard
+ // Save/Load behaviour. Re-implement in derived class for custom
+ // behaviour.
+ virtual bool DoSaveDocument(const wxString& file);
+ virtual bool DoOpenDocument(const wxString& file);
+
+ // the default implementation of GetUserReadableName()
+ wxString DoGetUserReadableName() const;
+
+private:
+ // list of all documents whose m_documentParent is this one
+ typedef wxDList<wxDocument> DocsList;
+ DocsList m_childDocuments;
+
+ DECLARE_ABSTRACT_CLASS(wxDocument)
+ wxDECLARE_NO_COPY_CLASS(wxDocument);
+};
+
+class WXDLLIMPEXP_CORE wxView: public wxEvtHandler
+{
+public:
+ wxView();
+ virtual ~wxView();
+
+ wxDocument *GetDocument() const { return m_viewDocument; }
+ virtual void SetDocument(wxDocument *doc);
+
+ wxString GetViewName() const { return m_viewTypeName; }
+ void SetViewName(const wxString& name) { m_viewTypeName = name; }
+
+ wxWindow *GetFrame() const { return m_viewFrame ; }
+ void SetFrame(wxWindow *frame) { m_viewFrame = frame; }
+
+ virtual void OnActivateView(bool activate,
+ wxView *activeView,
+ wxView *deactiveView);
+ virtual void OnDraw(wxDC *dc) = 0;
+ virtual void OnPrint(wxDC *dc, wxObject *info);
+ virtual void OnUpdate(wxView *sender, wxObject *hint = NULL);
+ virtual void OnClosingDocument() {}
+ virtual void OnChangeFilename();
+
+ // Called by framework if created automatically by the default document
+ // manager class: gives view a chance to initialise
+ virtual bool OnCreate(wxDocument *WXUNUSED(doc), long WXUNUSED(flags))
+ { return true; }
+
+ // Checks if the view is the last one for the document; if so, asks user
+ // to confirm save data (if modified). If ok, deletes itself and returns
+ // true.
+ virtual bool Close(bool deleteWindow = true);
+
+ // Override to do cleanup/veto close
+ virtual bool OnClose(bool deleteWindow);
+
+ // A view's window can call this to notify the view it is (in)active.
+ // The function then notifies the document manager.
+ virtual void Activate(bool activate);
+
+ wxDocManager *GetDocumentManager() const
+ { return m_viewDocument->GetDocumentManager(); }
+
+#if wxUSE_PRINTING_ARCHITECTURE
+ virtual wxPrintout *OnCreatePrintout();
+#endif
+
+ // implementation only
+ // -------------------
+
+ // set the associated frame, it is used to reset its view when we're
+ // destroyed
+ void SetDocChildFrame(wxDocChildFrameAnyBase *docChildFrame);
+
+ // get the associated frame, may be NULL during destruction
+ wxDocChildFrameAnyBase* GetDocChildFrame() const { return m_docChildFrame; }
+
+protected:
+ // hook the document into event handlers chain here
+ virtual bool TryBefore(wxEvent& event);
+
+ wxDocument* m_viewDocument;
+ wxString m_viewTypeName;
+ wxWindow* m_viewFrame;
+
+ wxDocChildFrameAnyBase *m_docChildFrame;
+
+private:
+ DECLARE_ABSTRACT_CLASS(wxView)
+ wxDECLARE_NO_COPY_CLASS(wxView);
+};
+
+// Represents user interface (and other) properties of documents and views
+class WXDLLIMPEXP_CORE wxDocTemplate: public wxObject
+{
+
+friend class WXDLLIMPEXP_FWD_CORE wxDocManager;
+
+public:
+ // Associate document and view types. They're for identifying what view is
+ // associated with what template/document type
+ wxDocTemplate(wxDocManager *manager,
+ const wxString& descr,
+ const wxString& filter,
+ const wxString& dir,
+ const wxString& ext,
+ const wxString& docTypeName,
+ const wxString& viewTypeName,
+ wxClassInfo *docClassInfo = NULL,
+ wxClassInfo *viewClassInfo = NULL,
+ long flags = wxDEFAULT_TEMPLATE_FLAGS);
+
+ virtual ~wxDocTemplate();
+
+ // By default, these two member functions dynamically creates document and
+ // view using dynamic instance construction. Override these if you need a
+ // different method of construction.
+ virtual wxDocument *CreateDocument(const wxString& path, long flags = 0);
+ virtual wxView *CreateView(wxDocument *doc, long flags = 0);
+
+ // Helper method for CreateDocument; also allows you to do your own document
+ // creation
+ virtual bool InitDocument(wxDocument* doc,
+ const wxString& path,
+ long flags = 0);
+
+ wxString GetDefaultExtension() const { return m_defaultExt; }
+ wxString GetDescription() const { return m_description; }
+ wxString GetDirectory() const { return m_directory; }
+ wxDocManager *GetDocumentManager() const { return m_documentManager; }
+ void SetDocumentManager(wxDocManager *manager)
+ { m_documentManager = manager; }
+ wxString GetFileFilter() const { return m_fileFilter; }
+ long GetFlags() const { return m_flags; }
+ virtual wxString GetViewName() const { return m_viewTypeName; }
+ virtual wxString GetDocumentName() const { return m_docTypeName; }
+
+ void SetFileFilter(const wxString& filter) { m_fileFilter = filter; }
+ void SetDirectory(const wxString& dir) { m_directory = dir; }
+ void SetDescription(const wxString& descr) { m_description = descr; }
+ void SetDefaultExtension(const wxString& ext) { m_defaultExt = ext; }
+ void SetFlags(long flags) { m_flags = flags; }
+
+ bool IsVisible() const { return (m_flags & wxTEMPLATE_VISIBLE) != 0; }
+
+ wxClassInfo* GetDocClassInfo() const { return m_docClassInfo; }
+ wxClassInfo* GetViewClassInfo() const { return m_viewClassInfo; }
+
+ virtual bool FileMatchesTemplate(const wxString& path);
+
+protected:
+ long m_flags;
+ wxString m_fileFilter;
+ wxString m_directory;
+ wxString m_description;
+ wxString m_defaultExt;
+ wxString m_docTypeName;
+ wxString m_viewTypeName;
+ wxDocManager* m_documentManager;
+
+ // For dynamic creation of appropriate instances.
+ wxClassInfo* m_docClassInfo;
+ wxClassInfo* m_viewClassInfo;
+
+ // Called by CreateDocument and CreateView to create the actual
+ // document/view object.
+ //
+ // By default uses the ClassInfo provided to the constructor. Override
+ // these functions to provide a different method of creation.
+ virtual wxDocument *DoCreateDocument();
+ virtual wxView *DoCreateView();
+
+private:
+ DECLARE_CLASS(wxDocTemplate)
+ wxDECLARE_NO_COPY_CLASS(wxDocTemplate);
+};
+
+// One object of this class may be created in an application, to manage all
+// the templates and documents.
+class WXDLLIMPEXP_CORE wxDocManager: public wxEvtHandler
+{
+public:
+ // NB: flags are unused, don't pass wxDOC_XXX to this ctor
+ wxDocManager(long flags = 0, bool initialize = true);
+ virtual ~wxDocManager();
+
+ virtual bool Initialize();
+
+ // Handlers for common user commands
+ void OnFileClose(wxCommandEvent& event);
+ void OnFileCloseAll(wxCommandEvent& event);
+ void OnFileNew(wxCommandEvent& event);
+ void OnFileOpen(wxCommandEvent& event);
+ void OnFileRevert(wxCommandEvent& event);
+ void OnFileSave(wxCommandEvent& event);
+ void OnFileSaveAs(wxCommandEvent& event);
+ void OnMRUFile(wxCommandEvent& event);
+#if wxUSE_PRINTING_ARCHITECTURE
+ void OnPrint(wxCommandEvent& event);
+ void OnPreview(wxCommandEvent& event);
+ void OnPageSetup(wxCommandEvent& event);
+#endif // wxUSE_PRINTING_ARCHITECTURE
+ void OnUndo(wxCommandEvent& event);
+ void OnRedo(wxCommandEvent& event);
+
+ // Handlers for UI update commands
+ void OnUpdateFileOpen(wxUpdateUIEvent& event);
+ void OnUpdateDisableIfNoDoc(wxUpdateUIEvent& event);
+ void OnUpdateFileRevert(wxUpdateUIEvent& event);
+ void OnUpdateFileNew(wxUpdateUIEvent& event);
+ void OnUpdateFileSave(wxUpdateUIEvent& event);
+ void OnUpdateFileSaveAs(wxUpdateUIEvent& event);
+ void OnUpdateUndo(wxUpdateUIEvent& event);
+ void OnUpdateRedo(wxUpdateUIEvent& event);
+
+ // called when file format detection didn't work, can be overridden to do
+ // something in this case
+ virtual void OnOpenFileFailure() { }
+
+ virtual wxDocument *CreateDocument(const wxString& path, long flags = 0);
+
+ // wrapper around CreateDocument() with a more clear name
+ wxDocument *CreateNewDocument()
+ { return CreateDocument(wxString(), wxDOC_NEW); }
+
+ virtual wxView *CreateView(wxDocument *doc, long flags = 0);
+ virtual void DeleteTemplate(wxDocTemplate *temp, long flags = 0);
+ virtual bool FlushDoc(wxDocument *doc);
+ virtual wxDocTemplate *MatchTemplate(const wxString& path);
+ virtual wxDocTemplate *SelectDocumentPath(wxDocTemplate **templates,
+ int noTemplates, wxString& path, long flags, bool save = false);
+ virtual wxDocTemplate *SelectDocumentType(wxDocTemplate **templates,
+ int noTemplates, bool sort = false);
+ virtual wxDocTemplate *SelectViewType(wxDocTemplate **templates,
+ int noTemplates, bool sort = false);
+ virtual wxDocTemplate *FindTemplateForPath(const wxString& path);
+
+ void AssociateTemplate(wxDocTemplate *temp);
+ void DisassociateTemplate(wxDocTemplate *temp);
+
+ // Find template from document class info, may return NULL.
+ wxDocTemplate* FindTemplate(const wxClassInfo* documentClassInfo);
+
+ // Find document from file name, may return NULL.
+ wxDocument* FindDocumentByPath(const wxString& path) const;
+
+ wxDocument *GetCurrentDocument() const;
+
+ void SetMaxDocsOpen(int n) { m_maxDocsOpen = n; }
+ int GetMaxDocsOpen() const { return m_maxDocsOpen; }
+
+ // Add and remove a document from the manager's list
+ void AddDocument(wxDocument *doc);
+ void RemoveDocument(wxDocument *doc);
+
+ // closes all currently open documents
+ bool CloseDocuments(bool force = true);
+
+ // closes the specified document
+ bool CloseDocument(wxDocument* doc, bool force = false);
+
+ // Clear remaining documents and templates
+ bool Clear(bool force = true);
+
+ // Views or windows should inform the document manager
+ // when a view is going in or out of focus
+ virtual void ActivateView(wxView *view, bool activate = true);
+ virtual wxView *GetCurrentView() const { return m_currentView; }
+
+ // This method tries to find an active view harder than GetCurrentView():
+ // if the latter is NULL, it also checks if we don't have just a single
+ // view and returns it then.
+ wxView *GetAnyUsableView() const;
+
+
+#ifndef __VISUALC6__
+ wxDocVector GetDocumentsVector() const;
+ wxDocTemplateVector GetTemplatesVector() const;
+#endif // !__VISUALC6__
+
+ wxList& GetDocuments() { return m_docs; }
+ wxList& GetTemplates() { return m_templates; }
+
+ // Return the default name for a new document (by default returns strings
+ // in the form "unnamed <counter>" but can be overridden)
+ virtual wxString MakeNewDocumentName();
+
+ // Make a frame title (override this to do something different)
+ virtual wxString MakeFrameTitle(wxDocument* doc);
+
+ virtual wxFileHistory *OnCreateFileHistory();
+ virtual wxFileHistory *GetFileHistory() const { return m_fileHistory; }
+
+ // File history management
+ virtual void AddFileToHistory(const wxString& file);
+ virtual void RemoveFileFromHistory(size_t i);
+ virtual size_t GetHistoryFilesCount() const;
+ virtual wxString GetHistoryFile(size_t i) const;
+ virtual void FileHistoryUseMenu(wxMenu *menu);
+ virtual void FileHistoryRemoveMenu(wxMenu *menu);
+#if wxUSE_CONFIG
+ virtual void FileHistoryLoad(const wxConfigBase& config);
+ virtual void FileHistorySave(wxConfigBase& config);
+#endif // wxUSE_CONFIG
+
+ virtual void FileHistoryAddFilesToMenu();
+ virtual void FileHistoryAddFilesToMenu(wxMenu* menu);
+
+ wxString GetLastDirectory() const;
+ void SetLastDirectory(const wxString& dir) { m_lastDirectory = dir; }
+
+ // Get the current document manager
+ static wxDocManager* GetDocumentManager() { return sm_docManager; }
+
+#if wxUSE_PRINTING_ARCHITECTURE
+ wxPageSetupDialogData& GetPageSetupDialogData()
+ { return m_pageSetupDialogData; }
+ const wxPageSetupDialogData& GetPageSetupDialogData() const
+ { return m_pageSetupDialogData; }
+#endif // wxUSE_PRINTING_ARCHITECTURE
+
+#if WXWIN_COMPATIBILITY_2_8
+ // deprecated, override GetDefaultName() instead
+ wxDEPRECATED_BUT_USED_INTERNALLY(
+ virtual bool MakeDefaultName(wxString& buf)
+ );
+#endif
+
+#if WXWIN_COMPATIBILITY_2_6
+ // deprecated, use GetHistoryFilesCount() instead
+ wxDEPRECATED( size_t GetNoHistoryFiles() const );
+#endif // WXWIN_COMPATIBILITY_2_6
+
+
+protected:
+ // Called when a file selected from the MRU list doesn't exist any more.
+ // The default behaviour is to remove the file from the MRU and notify the
+ // user about it but this method can be overridden to customize it.
+ virtual void OnMRUFileNotExist(unsigned n, const wxString& filename);
+
+ // Open the MRU file with the given index in our associated file history.
+ void DoOpenMRUFile(unsigned n);
+#if wxUSE_PRINTING_ARCHITECTURE
+ virtual wxPreviewFrame* CreatePreviewFrame(wxPrintPreviewBase* preview,
+ wxWindow *parent,
+ const wxString& title);
+#endif // wxUSE_PRINTING_ARCHITECTURE
+
+ // hook the currently active view into event handlers chain here
+ virtual bool TryBefore(wxEvent& event);
+
+ // return the command processor for the current document, if any
+ wxCommandProcessor *GetCurrentCommandProcessor() const;
+
+ int m_defaultDocumentNameCounter;
+ int m_maxDocsOpen;
+ wxList m_docs;
+ wxList m_templates;
+ wxView* m_currentView;
+ wxFileHistory* m_fileHistory;
+ wxString m_lastDirectory;
+ static wxDocManager* sm_docManager;
+
+#if wxUSE_PRINTING_ARCHITECTURE
+ wxPageSetupDialogData m_pageSetupDialogData;
+#endif // wxUSE_PRINTING_ARCHITECTURE
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxDocManager)
+ wxDECLARE_NO_COPY_CLASS(wxDocManager);
+};
+
+#if WXWIN_COMPATIBILITY_2_6
+inline size_t wxDocManager::GetNoHistoryFiles() const
+{
+ return GetHistoryFilesCount();
+}
+#endif // WXWIN_COMPATIBILITY_2_6
+
+// ----------------------------------------------------------------------------
+// Base class for child frames -- this is what wxView renders itself into
+//
+// Notice that this is a mix-in class so it doesn't derive from wxWindow, only
+// wxDocChildFrameAny does
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDocChildFrameAnyBase
+{
+public:
+ // default ctor, use Create() after it
+ wxDocChildFrameAnyBase()
+ {
+ m_childDocument = NULL;
+ m_childView = NULL;
+ m_win = NULL;
+ m_lastEvent = NULL;
+ }
+
+ // full ctor equivalent to using the default one and Create()
+ wxDocChildFrameAnyBase(wxDocument *doc, wxView *view, wxWindow *win)
+ {
+ Create(doc, view, win);
+ }
+
+ // method which must be called for an object created using the default ctor
+ //
+ // note that it returns bool just for consistency with Create() methods in
+ // other classes, we never return false from here
+ bool Create(wxDocument *doc, wxView *view, wxWindow *win)
+ {
+ m_childDocument = doc;
+ m_childView = view;
+ m_win = win;
+
+ if ( view )
+ view->SetDocChildFrame(this);
+
+ return true;
+ }
+
+ // dtor doesn't need to be virtual, an object should never be destroyed via
+ // a pointer to this class
+ ~wxDocChildFrameAnyBase()
+ {
+ // prevent the view from deleting us if we're being deleted directly
+ // (and not via Close() + Destroy())
+ if ( m_childView )
+ m_childView->SetDocChildFrame(NULL);
+ }
+
+ wxDocument *GetDocument() const { return m_childDocument; }
+ wxView *GetView() const { return m_childView; }
+ void SetDocument(wxDocument *doc) { m_childDocument = doc; }
+ void SetView(wxView *view) { m_childView = view; }
+
+ wxWindow *GetWindow() const { return m_win; }
+
+ // implementation only
+
+ // Check if this event had been just processed in this frame.
+ bool HasAlreadyProcessed(wxEvent& event) const
+ {
+ return m_lastEvent == &event;
+ }
+
+protected:
+ // we're not a wxEvtHandler but we provide this wxEvtHandler-like function
+ // which is called from TryBefore() of the derived classes to give our view
+ // a chance to process the message before the frame event handlers are used
+ bool TryProcessEvent(wxEvent& event);
+
+ // called from EVT_CLOSE handler in the frame: check if we can close and do
+ // cleanup if so; veto the event otherwise
+ bool CloseView(wxCloseEvent& event);
+
+
+ wxDocument* m_childDocument;
+ wxView* m_childView;
+
+ // the associated window: having it here is not terribly elegant but it
+ // allows us to avoid having any virtual functions in this class
+ wxWindow* m_win;
+
+private:
+ // Pointer to the last processed event used to avoid sending the same event
+ // twice to wxDocManager, from here and from wxDocParentFrameAnyBase.
+ wxEvent* m_lastEvent;
+
+ wxDECLARE_NO_COPY_CLASS(wxDocChildFrameAnyBase);
+};
+
+// ----------------------------------------------------------------------------
+// Template implementing child frame concept using the given wxFrame-like class
+//
+// This is used to define wxDocChildFrame and wxDocMDIChildFrame: ChildFrame is
+// a wxFrame or wxMDIChildFrame (although in theory it could be any wxWindow-
+// derived class as long as it provided a ctor with the same signature as
+// wxFrame and OnActivate() method) and ParentFrame is either wxFrame or
+// wxMDIParentFrame.
+// ----------------------------------------------------------------------------
+
+template <class ChildFrame, class ParentFrame>
+class WXDLLIMPEXP_CORE wxDocChildFrameAny : public ChildFrame,
+ public wxDocChildFrameAnyBase
+{
+public:
+ typedef ChildFrame BaseClass;
+
+ // default ctor, use Create after it
+ wxDocChildFrameAny() { }
+
+ // ctor for a frame showing the given view of the specified document
+ wxDocChildFrameAny(wxDocument *doc,
+ wxView *view,
+ ParentFrame *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr)
+ {
+ Create(doc, view, parent, id, title, pos, size, style, name);
+ }
+
+ bool Create(wxDocument *doc,
+ wxView *view,
+ ParentFrame *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr)
+ {
+ if ( !wxDocChildFrameAnyBase::Create(doc, view, this) )
+ return false;
+
+ if ( !BaseClass::Create(parent, id, title, pos, size, style, name) )
+ return false;
+
+ this->Connect(wxEVT_ACTIVATE,
+ wxActivateEventHandler(wxDocChildFrameAny::OnActivate));
+ this->Connect(wxEVT_CLOSE_WINDOW,
+ wxCloseEventHandler(wxDocChildFrameAny::OnCloseWindow));
+
+ return true;
+ }
+
+ virtual bool Destroy()
+ {
+ // FIXME: why exactly do we do this? to avoid activation events during
+ // destructions maybe?
+ m_childView = NULL;
+ return BaseClass::Destroy();
+ }
+
+protected:
+ // hook the child view into event handlers chain here
+ virtual bool TryBefore(wxEvent& event)
+ {
+ return TryProcessEvent(event) || BaseClass::TryBefore(event);
+ }
+
+private:
+ void OnActivate(wxActivateEvent& event)
+ {
+ BaseClass::OnActivate(event);
+
+ if ( m_childView )
+ m_childView->Activate(event.GetActive());
+ }
+
+ void OnCloseWindow(wxCloseEvent& event)
+ {
+ if ( CloseView(event) )
+ Destroy();
+ //else: vetoed
+ }
+
+ wxDECLARE_NO_COPY_TEMPLATE_CLASS_2(wxDocChildFrameAny,
+ ChildFrame, ParentFrame);
+};
+
+// ----------------------------------------------------------------------------
+// A default child frame: we need to define it as a class just for wxRTTI,
+// otherwise we could simply typedef it
+// ----------------------------------------------------------------------------
+
+#ifdef __VISUALC6__
+ // "non dll-interface class 'wxDocChildFrameAny<>' used as base interface
+ // for dll-interface class 'wxDocChildFrame'" -- this is bogus as the
+ // template will be DLL-exported but only once it is used as base class
+ // here!
+ #pragma warning (push)
+ #pragma warning (disable:4275)
+#endif
+
+typedef wxDocChildFrameAny<wxFrame, wxFrame> wxDocChildFrameBase;
+
+class WXDLLIMPEXP_CORE wxDocChildFrame : public wxDocChildFrameBase
+{
+public:
+ wxDocChildFrame()
+ {
+ }
+
+ wxDocChildFrame(wxDocument *doc,
+ wxView *view,
+ wxFrame *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr)
+ : wxDocChildFrameBase(doc, view,
+ parent, id, title, pos, size, style, name)
+ {
+ }
+
+ bool Create(wxDocument *doc,
+ wxView *view,
+ wxFrame *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr)
+ {
+ return wxDocChildFrameBase::Create
+ (
+ doc, view,
+ parent, id, title, pos, size, style, name
+ );
+ }
+
+private:
+ DECLARE_CLASS(wxDocChildFrame)
+ wxDECLARE_NO_COPY_CLASS(wxDocChildFrame);
+};
+
+// ----------------------------------------------------------------------------
+// wxDocParentFrame and related classes.
+//
+// As with wxDocChildFrame we define a template base class used by both normal
+// and MDI versions
+// ----------------------------------------------------------------------------
+
+// Base class containing type-independent code of wxDocParentFrameAny
+//
+// Similarly to wxDocChildFrameAnyBase, this class is a mix-in and doesn't
+// derive from wxWindow.
+class WXDLLIMPEXP_CORE wxDocParentFrameAnyBase
+{
+public:
+ wxDocParentFrameAnyBase(wxWindow* frame)
+ : m_frame(frame)
+ {
+ m_docManager = NULL;
+ }
+
+ wxDocManager *GetDocumentManager() const { return m_docManager; }
+
+protected:
+ // This is similar to wxDocChildFrameAnyBase method with the same name:
+ // while we're not an event handler ourselves and so can't override
+ // TryBefore(), we provide a helper that the derived template class can use
+ // from its TryBefore() implementation.
+ bool TryProcessEvent(wxEvent& event);
+
+ wxWindow* const m_frame;
+ wxDocManager *m_docManager;
+
+ wxDECLARE_NO_COPY_CLASS(wxDocParentFrameAnyBase);
+};
+
+// This is similar to wxDocChildFrameAny and is used to provide common
+// implementation for both wxDocParentFrame and wxDocMDIParentFrame
+template <class BaseFrame>
+class WXDLLIMPEXP_CORE wxDocParentFrameAny : public BaseFrame,
+ public wxDocParentFrameAnyBase
+{
+public:
+ wxDocParentFrameAny() : wxDocParentFrameAnyBase(this) { }
+ wxDocParentFrameAny(wxDocManager *manager,
+ wxFrame *frame,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr)
+ : wxDocParentFrameAnyBase(this)
+ {
+ Create(manager, frame, id, title, pos, size, style, name);
+ }
+
+ bool Create(wxDocManager *manager,
+ wxFrame *frame,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr)
+ {
+ m_docManager = manager;
+
+ if ( !BaseFrame::Create(frame, id, title, pos, size, style, name) )
+ return false;
+
+ this->Connect(wxID_EXIT, wxEVT_MENU,
+ wxCommandEventHandler(wxDocParentFrameAny::OnExit));
+ this->Connect(wxEVT_CLOSE_WINDOW,
+ wxCloseEventHandler(wxDocParentFrameAny::OnCloseWindow));
+
+ return true;
+ }
+
+protected:
+ // hook the document manager into event handling chain here
+ virtual bool TryBefore(wxEvent& event)
+ {
+ // It is important to send the event to the base class first as
+ // wxMDIParentFrame overrides its TryBefore() to send the menu events
+ // to the currently active child frame and the child must get them
+ // before our own TryProcessEvent() is executed, not afterwards.
+ return BaseFrame::TryBefore(event) || TryProcessEvent(event);
+ }
+
+private:
+ void OnExit(wxCommandEvent& WXUNUSED(event))
+ {
+ this->Close();
+ }
+
+ void OnCloseWindow(wxCloseEvent& event)
+ {
+ if ( m_docManager && !m_docManager->Clear(!event.CanVeto()) )
+ {
+ // The user decided not to close finally, abort.
+ event.Veto();
+ }
+ else
+ {
+ // Just skip the event, base class handler will destroy the window.
+ event.Skip();
+ }
+ }
+
+
+ wxDECLARE_NO_COPY_CLASS(wxDocParentFrameAny);
+};
+
+typedef wxDocParentFrameAny<wxFrame> wxDocParentFrameBase;
+
+class WXDLLIMPEXP_CORE wxDocParentFrame : public wxDocParentFrameBase
+{
+public:
+ wxDocParentFrame() : wxDocParentFrameBase() { }
+
+ wxDocParentFrame(wxDocManager *manager,
+ wxFrame *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr)
+ : wxDocParentFrameBase(manager,
+ parent, id, title, pos, size, style, name)
+ {
+ }
+
+ bool Create(wxDocManager *manager,
+ wxFrame *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr)
+ {
+ return wxDocParentFrameBase::Create(manager,
+ parent, id, title,
+ pos, size, style, name);
+ }
+
+private:
+ DECLARE_CLASS(wxDocParentFrame)
+ wxDECLARE_NO_COPY_CLASS(wxDocParentFrame);
+};
+
+#ifdef __VISUALC6__
+ // reenable warning 4275
+ #pragma warning (pop)
+#endif
+
+// ----------------------------------------------------------------------------
+// Provide simple default printing facilities
+// ----------------------------------------------------------------------------
+
+#if wxUSE_PRINTING_ARCHITECTURE
+class WXDLLIMPEXP_CORE wxDocPrintout : public wxPrintout
+{
+public:
+ wxDocPrintout(wxView *view = NULL, const wxString& title = wxString());
+
+ // implement wxPrintout methods
+ virtual bool OnPrintPage(int page);
+ virtual bool HasPage(int page);
+ virtual bool OnBeginDocument(int startPage, int endPage);
+ virtual void GetPageInfo(int *minPage, int *maxPage,
+ int *selPageFrom, int *selPageTo);
+
+ virtual wxView *GetView() { return m_printoutView; }
+
+protected:
+ wxView* m_printoutView;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxDocPrintout)
+ wxDECLARE_NO_COPY_CLASS(wxDocPrintout);
+};
+#endif // wxUSE_PRINTING_ARCHITECTURE
+
+// For compatibility with existing file formats:
+// converts from/to a stream to/from a temporary file.
+#if wxUSE_STD_IOSTREAM
+bool WXDLLIMPEXP_CORE
+wxTransferFileToStream(const wxString& filename, wxSTD ostream& stream);
+bool WXDLLIMPEXP_CORE
+wxTransferStreamToFile(wxSTD istream& stream, const wxString& filename);
+#else
+bool WXDLLIMPEXP_CORE
+wxTransferFileToStream(const wxString& filename, wxOutputStream& stream);
+bool WXDLLIMPEXP_CORE
+wxTransferStreamToFile(wxInputStream& stream, const wxString& filename);
+#endif // wxUSE_STD_IOSTREAM
+
+
+// these flags are not used anywhere by wxWidgets and kept only for an unlikely
+// case of existing user code using them for its own purposes
+#if WXWIN_COMPATIBILITY_2_8
+enum
+{
+ wxDOC_SDI = 1,
+ wxDOC_MDI,
+ wxDEFAULT_DOCMAN_FLAGS = wxDOC_SDI
+};
+#endif // WXWIN_COMPATIBILITY_2_8
+
+#ifndef __VISUALC6__
+inline wxViewVector wxDocument::GetViewsVector() const
+{
+ return m_documentViews.AsVector<wxView*>();
+}
+
+inline wxDocVector wxDocManager::GetDocumentsVector() const
+{
+ return m_docs.AsVector<wxDocument*>();
+}
+
+inline wxDocTemplateVector wxDocManager::GetTemplatesVector() const
+{
+ return m_templates.AsVector<wxDocTemplate*>();
+}
+#endif // !__VISUALC6__
+
+#endif // wxUSE_DOC_VIEW_ARCHITECTURE
+
+#endif // _WX_DOCH__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/dragimag.h
+// Purpose: wxDragImage base header
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DRAGIMAG_H_BASE_
+#define _WX_DRAGIMAG_H_BASE_
+
+#if wxUSE_DRAGIMAGE
+
+class WXDLLIMPEXP_FWD_CORE wxRect;
+class WXDLLIMPEXP_FWD_CORE wxMemoryDC;
+class WXDLLIMPEXP_FWD_CORE wxDC;
+
+#if defined(__WXMSW__)
+# if defined(__WXUNIVERSAL__)
+# include "wx/generic/dragimgg.h"
+# define wxDragImage wxGenericDragImage
+# else
+# include "wx/msw/dragimag.h"
+# endif
+
+#elif defined(__WXMOTIF__)
+# include "wx/generic/dragimgg.h"
+# define wxDragImage wxGenericDragImage
+
+#elif defined(__WXGTK__)
+# include "wx/generic/dragimgg.h"
+# define wxDragImage wxGenericDragImage
+
+#elif defined(__WXX11__)
+# include "wx/generic/dragimgg.h"
+# define wxDragImage wxGenericDragImage
+
+#elif defined(__WXMAC__)
+# include "wx/generic/dragimgg.h"
+# define wxDragImage wxGenericDragImage
+
+#elif defined(__WXPM__)
+# include "wx/generic/dragimgg.h"
+# define wxDragImage wxGenericDragImage
+
+#endif
+
+#endif // wxUSE_DRAGIMAGE
+
+#endif
+ // _WX_DRAGIMAG_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/dvrenderers.h
+// Purpose: Declare all wxDataViewCtrl classes
+// Author: Robert Roebling, Vadim Zeitlin
+// Created: 2009-11-08 (extracted from wx/dataview.h)
+// Copyright: (c) 2006 Robert Roebling
+// (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DVRENDERERS_H_
+#define _WX_DVRENDERERS_H_
+
+/*
+ Note about the structure of various headers: they're organized in a more
+ complicated way than usual because of the various dependencies which are
+ different for different ports. In any case the only public header, i.e. the
+ one which can be included directly is wx/dataview.h. It, in turn, includes
+ this one to define all the renderer classes.
+
+ We define the base wxDataViewRendererBase class first and then include a
+ port-dependent wx/xxx/dvrenderer.h which defines wxDataViewRenderer itself.
+ After this we can define wxDataViewRendererCustomBase (and maybe in the
+ future base classes for other renderers if the need arises, i.e. if there
+ is any non-trivial code or API which it makes sense to keep in common code)
+ and include wx/xxx/dvrenderers.h (notice the plural) which defines all the
+ rest of the renderer classes.
+ */
+
+class WXDLLIMPEXP_FWD_ADV wxDataViewCustomRenderer;
+
+// ----------------------------------------------------------------------------
+// wxDataViewIconText: helper class used by wxDataViewIconTextRenderer
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewIconText : public wxObject
+{
+public:
+ wxDataViewIconText( const wxString &text = wxEmptyString,
+ const wxIcon& icon = wxNullIcon )
+ : m_text(text),
+ m_icon(icon)
+ { }
+
+ wxDataViewIconText( const wxDataViewIconText &other )
+ : wxObject(),
+ m_text(other.m_text),
+ m_icon(other.m_icon)
+ { }
+
+ void SetText( const wxString &text ) { m_text = text; }
+ wxString GetText() const { return m_text; }
+ void SetIcon( const wxIcon &icon ) { m_icon = icon; }
+ const wxIcon &GetIcon() const { return m_icon; }
+
+ bool IsSameAs(const wxDataViewIconText& other) const
+ {
+ return m_text == other.m_text && m_icon.IsSameAs(other.m_icon);
+ }
+
+ bool operator==(const wxDataViewIconText& other) const
+ {
+ return IsSameAs(other);
+ }
+
+ bool operator!=(const wxDataViewIconText& other) const
+ {
+ return !IsSameAs(other);
+ }
+
+private:
+ wxString m_text;
+ wxIcon m_icon;
+
+ DECLARE_DYNAMIC_CLASS(wxDataViewIconText)
+};
+
+DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewIconText, WXDLLIMPEXP_ADV)
+
+// ----------------------------------------------------------------------------
+// wxDataViewRendererBase
+// ----------------------------------------------------------------------------
+
+enum wxDataViewCellMode
+{
+ wxDATAVIEW_CELL_INERT,
+ wxDATAVIEW_CELL_ACTIVATABLE,
+ wxDATAVIEW_CELL_EDITABLE
+};
+
+enum wxDataViewCellRenderState
+{
+ wxDATAVIEW_CELL_SELECTED = 1,
+ wxDATAVIEW_CELL_PRELIT = 2,
+ wxDATAVIEW_CELL_INSENSITIVE = 4,
+ wxDATAVIEW_CELL_FOCUSED = 8
+};
+
+class WXDLLIMPEXP_ADV wxDataViewRendererBase: public wxObject
+{
+public:
+ wxDataViewRendererBase( const wxString &varianttype,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int alignment = wxDVR_DEFAULT_ALIGNMENT );
+ virtual ~wxDataViewRendererBase();
+
+ virtual bool Validate( wxVariant& WXUNUSED(value) )
+ { return true; }
+
+ void SetOwner( wxDataViewColumn *owner ) { m_owner = owner; }
+ wxDataViewColumn* GetOwner() const { return m_owner; }
+
+ // renderer value and attributes: SetValue() and SetAttr() are called
+ // before a cell is rendered using this renderer
+ virtual bool SetValue(const wxVariant& value) = 0;
+ virtual bool GetValue(wxVariant& value) const = 0;
+
+ virtual void SetAttr(const wxDataViewItemAttr& WXUNUSED(attr)) { }
+
+ virtual void SetEnabled(bool WXUNUSED(enabled)) { }
+
+ wxString GetVariantType() const { return m_variantType; }
+
+ // helper that calls SetValue and SetAttr:
+ void PrepareForItem(const wxDataViewModel *model,
+ const wxDataViewItem& item, unsigned column);
+
+ // renderer properties:
+ virtual void SetMode( wxDataViewCellMode mode ) = 0;
+ virtual wxDataViewCellMode GetMode() const = 0;
+
+ // NOTE: Set/GetAlignment do not take/return a wxAlignment enum but
+ // rather an "int"; that's because for rendering cells it's allowed
+ // to combine alignment flags (e.g. wxALIGN_LEFT|wxALIGN_BOTTOM)
+ virtual void SetAlignment( int align ) = 0;
+ virtual int GetAlignment() const = 0;
+
+ // enable or disable (if called with wxELLIPSIZE_NONE) replacing parts of
+ // the item text (hence this only makes sense for renderers showing
+ // text...) with ellipsis in order to make it fit the column width
+ virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE) = 0;
+ void DisableEllipsize() { EnableEllipsize(wxELLIPSIZE_NONE); }
+
+ virtual wxEllipsizeMode GetEllipsizeMode() const = 0;
+
+ // in-place editing
+ virtual bool HasEditorCtrl() const
+ { return false; }
+ virtual wxWindow* CreateEditorCtrl(wxWindow * WXUNUSED(parent),
+ wxRect WXUNUSED(labelRect),
+ const wxVariant& WXUNUSED(value))
+ { return NULL; }
+ virtual bool GetValueFromEditorCtrl(wxWindow * WXUNUSED(editor),
+ wxVariant& WXUNUSED(value))
+ { return false; }
+
+ virtual bool StartEditing( const wxDataViewItem &item, wxRect labelRect );
+ virtual void CancelEditing();
+ virtual bool FinishEditing();
+
+ wxWindow *GetEditorCtrl() { return m_editorCtrl; }
+
+ virtual bool IsCustomRenderer() const { return false; }
+
+
+protected:
+ // Called from {Cancel,Finish}Editing() to cleanup m_editorCtrl
+ void DestroyEditControl();
+
+ // Return the alignment of this renderer if it's specified (i.e. has value
+ // different from the default wxDVR_DEFAULT_ALIGNMENT) or the alignment of
+ // the column it is used for otherwise.
+ //
+ // Unlike GetAlignment(), this always returns a valid combination of
+ // wxALIGN_XXX flags (although possibly wxALIGN_NOT) and never returns
+ // wxDVR_DEFAULT_ALIGNMENT.
+ int GetEffectiveAlignment() const;
+
+ wxString m_variantType;
+ wxDataViewColumn *m_owner;
+ wxWeakRef<wxWindow> m_editorCtrl;
+ wxDataViewItem m_item; // for m_editorCtrl
+
+ // internal utility, may be used anywhere the window associated with the
+ // renderer is required
+ wxDataViewCtrl* GetView() const;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase)
+};
+
+// include the real wxDataViewRenderer declaration for the native ports
+#ifdef wxHAS_GENERIC_DATAVIEWCTRL
+ // in the generic implementation there is no real wxDataViewRenderer, all
+ // renderers are custom so it's the same as wxDataViewCustomRenderer and
+ // wxDataViewCustomRendererBase derives from wxDataViewRendererBase directly
+ //
+ // this is a rather ugly hack but unfortunately it just doesn't seem to be
+ // possible to have the same class hierarchy in all ports and avoid
+ // duplicating the entire wxDataViewCustomRendererBase in the generic
+ // wxDataViewRenderer class (well, we could use a mix-in but this would
+ // make classes hierarchy non linear and arguably even more complex)
+ #define wxDataViewCustomRendererRealBase wxDataViewRendererBase
+#else
+ #if defined(__WXGTK20__)
+ #include "wx/gtk/dvrenderer.h"
+ #elif defined(__WXMAC__)
+ #include "wx/osx/dvrenderer.h"
+ #else
+ #error "unknown native wxDataViewCtrl implementation"
+ #endif
+ #define wxDataViewCustomRendererRealBase wxDataViewRenderer
+#endif
+
+// ----------------------------------------------------------------------------
+// wxDataViewCustomRendererBase
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewCustomRendererBase
+ : public wxDataViewCustomRendererRealBase
+{
+public:
+ // Constructor must specify the usual renderer parameters which we simply
+ // pass to the base class
+ wxDataViewCustomRendererBase(const wxString& varianttype = "string",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT)
+ : wxDataViewCustomRendererRealBase(varianttype, mode, align)
+ {
+ }
+
+
+ // Render the item using the current value (returned by GetValue()).
+ virtual bool Render(wxRect cell, wxDC *dc, int state) = 0;
+
+ // Return the size of the item appropriate to its current value.
+ virtual wxSize GetSize() const = 0;
+
+ // Define virtual function which are called when a key is pressed on the
+ // item, clicked or the user starts to drag it: by default they all simply
+ // return false indicating that the events are not handled
+
+ virtual bool ActivateCell(const wxRect& cell,
+ wxDataViewModel *model,
+ const wxDataViewItem & item,
+ unsigned int col,
+ const wxMouseEvent* mouseEvent);
+
+ // Deprecated, use (and override) ActivateCell() instead
+ wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(
+ virtual bool Activate(wxRect WXUNUSED(cell),
+ wxDataViewModel *WXUNUSED(model),
+ const wxDataViewItem & WXUNUSED(item),
+ unsigned int WXUNUSED(col)),
+ return false; )
+
+ // Deprecated, use (and override) ActivateCell() instead
+ wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(
+ virtual bool LeftClick(wxPoint WXUNUSED(cursor),
+ wxRect WXUNUSED(cell),
+ wxDataViewModel *WXUNUSED(model),
+ const wxDataViewItem & WXUNUSED(item),
+ unsigned int WXUNUSED(col)),
+ return false; )
+
+ virtual bool StartDrag(const wxPoint& WXUNUSED(cursor),
+ const wxRect& WXUNUSED(cell),
+ wxDataViewModel *WXUNUSED(model),
+ const wxDataViewItem & WXUNUSED(item),
+ unsigned int WXUNUSED(col) )
+ { return false; }
+
+
+ // Helper which can be used by Render() implementation in the derived
+ // classes: it will draw the text in the same manner as the standard
+ // renderers do.
+ virtual void RenderText(const wxString& text,
+ int xoffset,
+ wxRect cell,
+ wxDC *dc,
+ int state);
+
+
+ // Override the base class virtual method to simply store the attribute so
+ // that it can be accessed using GetAttr() from Render() if needed.
+ virtual void SetAttr(const wxDataViewItemAttr& attr) { m_attr = attr; }
+ const wxDataViewItemAttr& GetAttr() const { return m_attr; }
+
+ // Store the enabled state of the item so that it can be accessed from
+ // Render() via GetEnabled() if needed.
+ virtual void SetEnabled(bool enabled) { m_enabled = enabled; }
+ bool GetEnabled() const { return m_enabled; }
+
+
+ // Implementation only from now on
+
+ // Retrieve the DC to use for drawing. This is implemented in derived
+ // platform-specific classes.
+ virtual wxDC *GetDC() = 0;
+
+ // To draw background use the background colour in wxDataViewItemAttr
+ virtual void RenderBackground(wxDC* dc, const wxRect& rect);
+
+ // Prepare DC to use attributes and call Render().
+ void WXCallRender(wxRect rect, wxDC *dc, int state);
+
+ virtual bool IsCustomRenderer() const { return true; }
+
+protected:
+ // helper for GetSize() implementations, respects attributes
+ wxSize GetTextExtent(const wxString& str) const;
+
+private:
+ wxDataViewItemAttr m_attr;
+ bool m_enabled;
+
+ wxDECLARE_NO_COPY_CLASS(wxDataViewCustomRendererBase);
+};
+
+// include the declaration of all the other renderers to get the real
+// wxDataViewCustomRenderer from which we need to inherit below
+#ifdef wxHAS_GENERIC_DATAVIEWCTRL
+ // because of the different renderer classes hierarchy in the generic
+ // version, as explained above, we can include the header defining
+ // wxDataViewRenderer only here and not before wxDataViewCustomRendererBase
+ // declaration as for the native ports
+ #include "wx/generic/dvrenderer.h"
+ #include "wx/generic/dvrenderers.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/dvrenderers.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/dvrenderers.h"
+#else
+ #error "unknown native wxDataViewCtrl implementation"
+#endif
+
+// ----------------------------------------------------------------------------
+// wxDataViewSpinRenderer
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewSpinRenderer: public wxDataViewCustomRenderer
+{
+public:
+ wxDataViewSpinRenderer( int min, int max,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
+ int alignment = wxDVR_DEFAULT_ALIGNMENT );
+ virtual bool HasEditorCtrl() const { return true; }
+ virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value );
+ virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value );
+ virtual bool Render( wxRect rect, wxDC *dc, int state );
+ virtual wxSize GetSize() const;
+ virtual bool SetValue( const wxVariant &value );
+ virtual bool GetValue( wxVariant &value ) const;
+
+private:
+ long m_data;
+ long m_min,m_max;
+};
+
+#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXOSX_CARBON__)
+
+// ----------------------------------------------------------------------------
+// wxDataViewChoiceRenderer
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewChoiceRenderer: public wxDataViewCustomRenderer
+{
+public:
+ wxDataViewChoiceRenderer( const wxArrayString &choices,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
+ int alignment = wxDVR_DEFAULT_ALIGNMENT );
+ virtual bool HasEditorCtrl() const { return true; }
+ virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value );
+ virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value );
+ virtual bool Render( wxRect rect, wxDC *dc, int state );
+ virtual wxSize GetSize() const;
+ virtual bool SetValue( const wxVariant &value );
+ virtual bool GetValue( wxVariant &value ) const;
+
+ wxString GetChoice(size_t index) const { return m_choices[index]; }
+ const wxArrayString& GetChoices() const { return m_choices; }
+
+private:
+ wxArrayString m_choices;
+ wxString m_data;
+};
+
+// ----------------------------------------------------------------------------
+// wxDataViewChoiceByIndexRenderer
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewChoiceByIndexRenderer: public wxDataViewChoiceRenderer
+{
+public:
+ wxDataViewChoiceByIndexRenderer( const wxArrayString &choices,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
+ int alignment = wxDVR_DEFAULT_ALIGNMENT );
+
+ virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value );
+ virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value );
+
+ virtual bool SetValue( const wxVariant &value );
+ virtual bool GetValue( wxVariant &value ) const;
+};
+
+
+#endif // generic or Carbon versions
+
+#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXGTK__)
+
+// ----------------------------------------------------------------------------
+// wxDataViewDateRenderer
+// ----------------------------------------------------------------------------
+
+#if wxUSE_DATEPICKCTRL
+class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewCustomRenderer
+{
+public:
+ wxDataViewDateRenderer(const wxString &varianttype = wxT("datetime"),
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
+ int align = wxDVR_DEFAULT_ALIGNMENT);
+
+ virtual bool HasEditorCtrl() const { return true; }
+ virtual wxWindow *CreateEditorCtrl(wxWindow *parent, wxRect labelRect, const wxVariant &value);
+ virtual bool GetValueFromEditorCtrl(wxWindow* editor, wxVariant &value);
+ virtual bool SetValue(const wxVariant &value);
+ virtual bool GetValue(wxVariant& value) const;
+ virtual bool Render( wxRect cell, wxDC *dc, int state );
+ virtual wxSize GetSize() const;
+
+private:
+ wxDateTime m_date;
+};
+#else // !wxUSE_DATEPICKCTRL
+typedef wxDataViewTextRenderer wxDataViewDateRenderer;
+#endif
+
+#endif // generic or GTK+ versions
+
+// this class is obsolete, its functionality was merged in
+// wxDataViewTextRenderer itself now, don't use it any more
+#define wxDataViewTextRendererAttr wxDataViewTextRenderer
+
+#endif // _WX_DVRENDERERS_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/dynarray.h
+// Purpose: auto-resizable (i.e. dynamic) array support
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 12.09.97
+// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _DYNARRAY_H
+#define _DYNARRAY_H
+
+#include "wx/defs.h"
+
+#if wxUSE_STD_CONTAINERS
+ #include "wx/beforestd.h"
+ #include <vector>
+ #include <algorithm>
+ #include "wx/afterstd.h"
+#endif
+
+/*
+ This header defines the dynamic arrays and object arrays (i.e. arrays which
+ own their elements). Dynamic means that the arrays grow automatically as
+ needed.
+
+ These macros are ugly (especially if you look in the sources ;-), but they
+ allow us to define "template" classes without actually using templates and so
+ this works with all compilers (and may be also much faster to compile even
+ with a compiler which does support templates). The arrays defined with these
+ macros are type-safe.
+
+ Range checking is performed in debug build for both arrays and objarrays but
+ not in release build - so using an invalid index will just lead to a crash
+ then.
+
+ Note about memory usage: arrays never shrink automatically (although you may
+ use Shrink() function explicitly), they only grow, so loading 10 millions in
+ an array only to delete them 2 lines below might be a bad idea if the array
+ object is not going to be destroyed soon. However, as it does free memory
+ when destroyed, it is ok if the array is a local variable.
+ */
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+/*
+ The initial size by which an array grows when an element is added default
+ value avoids allocate one or two bytes when the array is created which is
+ rather inefficient
+*/
+#define WX_ARRAY_DEFAULT_INITIAL_SIZE (16)
+
+#define _WX_ERROR_REMOVE "removing inexistent element in wxArray::Remove"
+
+// ----------------------------------------------------------------------------
+// types
+// ----------------------------------------------------------------------------
+
+/*
+ Callback compare function for quick sort.
+
+ It must return negative value, 0 or positive value if the first item is
+ less than, equal to or greater than the second one.
+ */
+extern "C"
+{
+typedef int (wxCMPFUNC_CONV *CMPFUNC)(const void* pItem1, const void* pItem2);
+}
+
+// ----------------------------------------------------------------------------
+// Base class managing data having size of type 'long' (not used directly)
+//
+// NB: for efficiency this often used class has no virtual functions (hence no
+// virtual table), even dtor is *not* virtual. If used as expected it
+// won't create any problems because ARRAYs from DEFINE_ARRAY have no dtor
+// at all, so it's not too important if it's not called (this happens when
+// you cast "SomeArray *" as "BaseArray *" and then delete it)
+// ----------------------------------------------------------------------------
+
+#if wxUSE_STD_CONTAINERS
+
+template<class T>
+class wxArray_SortFunction
+{
+public:
+ typedef int (wxCMPFUNC_CONV *CMPFUNC)(T* pItem1, T* pItem2);
+
+ wxArray_SortFunction(CMPFUNC f) : m_f(f) { }
+ bool operator()(const T& i1, const T& i2)
+ { return m_f((T*)&i1, (T*)&i2) < 0; }
+private:
+ CMPFUNC m_f;
+};
+
+template<class T, typename F>
+class wxSortedArray_SortFunction
+{
+public:
+ typedef F CMPFUNC;
+
+ wxSortedArray_SortFunction(CMPFUNC f) : m_f(f) { }
+ bool operator()(const T& i1, const T& i2)
+ { return m_f(i1, i2) < 0; }
+private:
+ CMPFUNC m_f;
+};
+
+#define _WX_DECLARE_BASEARRAY(T, name, classexp) \
+ typedef int (wxCMPFUNC_CONV *CMPFUN##name)(T pItem1, T pItem2); \
+ typedef wxSortedArray_SortFunction<T, CMPFUN##name> name##_Predicate; \
+ _WX_DECLARE_BASEARRAY_2(T, name, name##_Predicate, classexp)
+
+#define _WX_DECLARE_BASEARRAY_2(T, name, predicate, classexp) \
+classexp name : public std::vector<T> \
+{ \
+ typedef predicate Predicate; \
+ typedef predicate::CMPFUNC SCMPFUNC; \
+public: \
+ typedef wxArray_SortFunction<T>::CMPFUNC CMPFUNC; \
+ \
+public: \
+ typedef T base_type; \
+ \
+ name() : std::vector<T>() { } \
+ name(size_type n) : std::vector<T>(n) { } \
+ name(size_type n, const_reference v) : std::vector<T>(n, v) { } \
+ template <class InputIterator> \
+ name(InputIterator first, InputIterator last) : std::vector<T>(first, last) { } \
+ \
+ void Empty() { clear(); } \
+ void Clear() { clear(); } \
+ void Alloc(size_t uiSize) { reserve(uiSize); } \
+ void Shrink() { name tmp(*this); swap(tmp); } \
+ \
+ size_t GetCount() const { return size(); } \
+ void SetCount(size_t n, T v = T()) { resize(n, v); } \
+ bool IsEmpty() const { return empty(); } \
+ size_t Count() const { return size(); } \
+ \
+ T& Item(size_t uiIndex) const \
+ { wxASSERT( uiIndex < size() ); return (T&)operator[](uiIndex); } \
+ T& Last() const { return Item(size() - 1); } \
+ \
+ int Index(T item, bool bFromEnd = false) const \
+ { \
+ if ( bFromEnd ) \
+ { \
+ const const_reverse_iterator b = rbegin(), \
+ e = rend(); \
+ for ( const_reverse_iterator i = b; i != e; ++i ) \
+ if ( *i == item ) \
+ return (int)(e - i - 1); \
+ } \
+ else \
+ { \
+ const const_iterator b = begin(), \
+ e = end(); \
+ for ( const_iterator i = b; i != e; ++i ) \
+ if ( *i == item ) \
+ return (int)(i - b); \
+ } \
+ \
+ return wxNOT_FOUND; \
+ } \
+ int Index(T lItem, CMPFUNC fnCompare) const \
+ { \
+ Predicate p((SCMPFUNC)fnCompare); \
+ const_iterator i = std::lower_bound(begin(), end(), lItem, p);\
+ return i != end() && !p(lItem, *i) ? (int)(i - begin()) \
+ : wxNOT_FOUND; \
+ } \
+ size_t IndexForInsert(T lItem, CMPFUNC fnCompare) const \
+ { \
+ Predicate p((SCMPFUNC)fnCompare); \
+ const_iterator i = std::lower_bound(begin(), end(), lItem, p);\
+ return i - begin(); \
+ } \
+ void Add(T lItem, size_t nInsert = 1) \
+ { insert(end(), nInsert, lItem); } \
+ size_t Add(T lItem, CMPFUNC fnCompare) \
+ { \
+ size_t n = IndexForInsert(lItem, fnCompare); \
+ Insert(lItem, n); \
+ return n; \
+ } \
+ void Insert(T lItem, size_t uiIndex, size_t nInsert = 1) \
+ { insert(begin() + uiIndex, nInsert, lItem); } \
+ void Remove(T lItem) \
+ { \
+ int n = Index(lItem); \
+ wxCHECK_RET( n != wxNOT_FOUND, _WX_ERROR_REMOVE ); \
+ RemoveAt((size_t)n); \
+ } \
+ void RemoveAt(size_t uiIndex, size_t nRemove = 1) \
+ { erase(begin() + uiIndex, begin() + uiIndex + nRemove); } \
+ \
+ void Sort(CMPFUNC fCmp) \
+ { \
+ wxArray_SortFunction<T> p(fCmp); \
+ std::sort(begin(), end(), p); \
+ } \
+}
+
+#else // if !wxUSE_STD_CONTAINERS
+
+#define _WX_DECLARE_BASEARRAY(T, name, classexp) \
+classexp name \
+{ \
+ typedef CMPFUNC SCMPFUNC; /* for compatibility wuth wxUSE_STD_CONTAINERS */ \
+public: \
+ name(); \
+ name(const name& array); \
+ name& operator=(const name& src); \
+ ~name(); \
+ \
+ void Empty() { m_nCount = 0; } \
+ void Clear(); \
+ void Alloc(size_t n) { if ( n > m_nSize ) Realloc(n); } \
+ void Shrink(); \
+ \
+ size_t GetCount() const { return m_nCount; } \
+ void SetCount(size_t n, T defval = T()); \
+ bool IsEmpty() const { return m_nCount == 0; } \
+ size_t Count() const { return m_nCount; } \
+ \
+ typedef T base_type; \
+ \
+protected: \
+ T& Item(size_t uiIndex) const \
+ { wxASSERT( uiIndex < m_nCount ); return m_pItems[uiIndex]; } \
+ T& operator[](size_t uiIndex) const { return Item(uiIndex); } \
+ \
+ int Index(T lItem, bool bFromEnd = false) const; \
+ int Index(T lItem, CMPFUNC fnCompare) const; \
+ size_t IndexForInsert(T lItem, CMPFUNC fnCompare) const; \
+ void Add(T lItem, size_t nInsert = 1); \
+ size_t Add(T lItem, CMPFUNC fnCompare); \
+ void Insert(T lItem, size_t uiIndex, size_t nInsert = 1); \
+ void Remove(T lItem); \
+ void RemoveAt(size_t uiIndex, size_t nRemove = 1); \
+ \
+ void Sort(CMPFUNC fnCompare); \
+ \
+ /* *minimal* STL-ish interface, for derived classes */ \
+ typedef T value_type; \
+ typedef value_type* iterator; \
+ typedef const value_type* const_iterator; \
+ typedef value_type& reference; \
+ typedef const value_type& const_reference; \
+ typedef ptrdiff_t difference_type; \
+ typedef size_t size_type; \
+ \
+ void assign(const_iterator first, const_iterator last); \
+ void assign(size_type n, const_reference v); \
+ size_type capacity() const { return m_nSize; } \
+ iterator erase(iterator first, iterator last) \
+ { \
+ size_type idx = first - begin(); \
+ RemoveAt(idx, last - first); \
+ return begin() + idx; \
+ } \
+ iterator erase(iterator it) { return erase(it, it + 1); } \
+ void insert(iterator it, size_type n, const value_type& v) \
+ { Insert(v, it - begin(), n); } \
+ iterator insert(iterator it, const value_type& v = value_type()) \
+ { \
+ size_type idx = it - begin(); \
+ Insert(v, idx); \
+ return begin() + idx; \
+ } \
+ void insert(iterator it, const_iterator first, const_iterator last);\
+ void pop_back() { RemoveAt(size() - 1); } \
+ void push_back(const value_type& v) { Add(v); } \
+ void reserve(size_type n) { Alloc(n); } \
+ void resize(size_type count, value_type defval = value_type()) \
+ { \
+ if ( count < m_nCount ) \
+ m_nCount = count; \
+ else \
+ SetCount(count, defval); \
+ } \
+ \
+ iterator begin() { return m_pItems; } \
+ iterator end() { return m_pItems + m_nCount; } \
+ const_iterator begin() const { return m_pItems; } \
+ const_iterator end() const { return m_pItems + m_nCount; } \
+ \
+ void swap(name& other) \
+ { \
+ wxSwap(m_nSize, other.m_nSize); \
+ wxSwap(m_nCount, other.m_nCount); \
+ wxSwap(m_pItems, other.m_pItems); \
+ } \
+ \
+ /* the following functions may be made directly public because */ \
+ /* they don't use the type of the elements at all */ \
+public: \
+ void clear() { Clear(); } \
+ bool empty() const { return IsEmpty(); } \
+ size_type max_size() const { return INT_MAX; } \
+ size_type size() const { return GetCount(); } \
+ \
+private: \
+ void Grow(size_t nIncrement = 0); \
+ bool Realloc(size_t nSize); \
+ \
+ size_t m_nSize, \
+ m_nCount; \
+ \
+ T *m_pItems; \
+}
+
+#endif // !wxUSE_STD_CONTAINERS
+
+// ============================================================================
+// The private helper macros containing the core of the array classes
+// ============================================================================
+
+// Implementation notes:
+//
+// JACS: Salford C++ doesn't like 'var->operator=' syntax, as in:
+// { ((wxBaseArray *)this)->operator=((const wxBaseArray&)src);
+// so using a temporary variable instead.
+//
+// The classes need a (even trivial) ~name() to link under Mac X
+
+// ----------------------------------------------------------------------------
+// _WX_DEFINE_TYPEARRAY: array for simple types
+// ----------------------------------------------------------------------------
+
+#if wxUSE_STD_CONTAINERS
+
+// in STL case we don't need the entire base arrays hack as standard container
+// don't suffer from alignment/storage problems as our home-grown do
+#define _WX_DEFINE_TYPEARRAY(T, name, base, classexp) \
+ _WX_DECLARE_BASEARRAY(T, name, classexp)
+
+#define _WX_DEFINE_TYPEARRAY_PTR(T, name, base, classexp) \
+ _WX_DEFINE_TYPEARRAY(T, name, base, classexp)
+
+#else // if !wxUSE_STD_CONTAINERS
+
+// common declaration used by both _WX_DEFINE_TYPEARRAY and
+// _WX_DEFINE_TYPEARRAY_PTR
+#define _WX_DEFINE_TYPEARRAY_HELPER(T, name, base, classexp, ptrop) \
+wxCOMPILE_TIME_ASSERT2(sizeof(T) <= sizeof(base::base_type), \
+ TypeTooBigToBeStoredIn##base, \
+ name); \
+typedef int (CMPFUNC_CONV *CMPFUNC##T)(T *pItem1, T *pItem2); \
+classexp name : public base \
+{ \
+public: \
+ name() { } \
+ ~name() { } \
+ \
+ T& operator[](size_t uiIndex) const \
+ { return (T&)(base::operator[](uiIndex)); } \
+ T& Item(size_t uiIndex) const \
+ { return (T&)(base::operator[](uiIndex)); } \
+ T& Last() const \
+ { return (T&)(base::operator[](GetCount() - 1)); } \
+ \
+ int Index(T lItem, bool bFromEnd = false) const \
+ { return base::Index((base_type)lItem, bFromEnd); } \
+ \
+ void Add(T lItem, size_t nInsert = 1) \
+ { base::Add((base_type)lItem, nInsert); } \
+ void Insert(T lItem, size_t uiIndex, size_t nInsert = 1) \
+ { base::Insert((base_type)lItem, uiIndex, nInsert) ; } \
+ \
+ void RemoveAt(size_t uiIndex, size_t nRemove = 1) \
+ { base::RemoveAt(uiIndex, nRemove); } \
+ void Remove(T lItem) \
+ { int iIndex = Index(lItem); \
+ wxCHECK_RET( iIndex != wxNOT_FOUND, _WX_ERROR_REMOVE); \
+ base::RemoveAt((size_t)iIndex); } \
+ \
+ void Sort(CMPFUNC##T fCmp) { base::Sort((CMPFUNC)fCmp); } \
+ \
+ /* STL-like interface */ \
+private: \
+ typedef base::iterator biterator; \
+ typedef base::const_iterator bconst_iterator; \
+ typedef base::value_type bvalue_type; \
+ typedef base::const_reference bconst_reference; \
+public: \
+ typedef T value_type; \
+ typedef value_type* pointer; \
+ typedef const value_type* const_pointer; \
+ typedef value_type* iterator; \
+ typedef const value_type* const_iterator; \
+ typedef value_type& reference; \
+ typedef const value_type& const_reference; \
+ typedef base::difference_type difference_type; \
+ typedef base::size_type size_type; \
+ \
+ class reverse_iterator \
+ { \
+ typedef T value_type; \
+ typedef value_type& reference; \
+ typedef value_type* pointer; \
+ typedef reverse_iterator itor; \
+ friend inline itor operator+(int o, const itor& it) \
+ { return it.m_ptr - o; } \
+ friend inline itor operator+(const itor& it, int o) \
+ { return it.m_ptr - o; } \
+ friend inline itor operator-(const itor& it, int o) \
+ { return it.m_ptr + o; } \
+ friend inline difference_type operator-(const itor& i1, \
+ const itor& i2) \
+ { return i1.m_ptr - i2.m_ptr; } \
+ \
+ public: \
+ pointer m_ptr; \
+ reverse_iterator() : m_ptr(NULL) { } \
+ reverse_iterator(pointer ptr) : m_ptr(ptr) { } \
+ reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } \
+ reference operator*() const { return *m_ptr; } \
+ ptrop \
+ itor& operator++() { --m_ptr; return *this; } \
+ const itor operator++(int) \
+ { reverse_iterator tmp = *this; --m_ptr; return tmp; } \
+ itor& operator--() { ++m_ptr; return *this; } \
+ const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; }\
+ bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; }\
+ bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; }\
+ }; \
+ \
+ class const_reverse_iterator \
+ { \
+ typedef T value_type; \
+ typedef const value_type& reference; \
+ typedef const value_type* pointer; \
+ typedef const_reverse_iterator itor; \
+ friend inline itor operator+(int o, const itor& it) \
+ { return it.m_ptr - o; } \
+ friend inline itor operator+(const itor& it, int o) \
+ { return it.m_ptr - o; } \
+ friend inline itor operator-(const itor& it, int o) \
+ { return it.m_ptr + o; } \
+ friend inline difference_type operator-(const itor& i1, \
+ const itor& i2) \
+ { return i1.m_ptr - i2.m_ptr; } \
+ \
+ public: \
+ pointer m_ptr; \
+ const_reverse_iterator() : m_ptr(NULL) { } \
+ const_reverse_iterator(pointer ptr) : m_ptr(ptr) { } \
+ const_reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } \
+ const_reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { }\
+ reference operator*() const { return *m_ptr; } \
+ ptrop \
+ itor& operator++() { --m_ptr; return *this; } \
+ const itor operator++(int) \
+ { itor tmp = *this; --m_ptr; return tmp; } \
+ itor& operator--() { ++m_ptr; return *this; } \
+ const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; }\
+ bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; }\
+ bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; }\
+ }; \
+ \
+ name(size_type n) { assign(n, value_type()); } \
+ name(size_type n, const_reference v) { assign(n, v); } \
+ name(const_iterator first, const_iterator last) \
+ { assign(first, last); } \
+ void assign(const_iterator first, const_iterator last) \
+ { base::assign((bconst_iterator)first, (bconst_iterator)last); } \
+ void assign(size_type n, const_reference v) \
+ { base::assign(n, (bconst_reference)v); } \
+ reference back() { return *(end() - 1); } \
+ const_reference back() const { return *(end() - 1); } \
+ iterator begin() { return (iterator)base::begin(); } \
+ const_iterator begin() const { return (const_iterator)base::begin(); }\
+ size_type capacity() const { return base::capacity(); } \
+ iterator end() { return (iterator)base::end(); } \
+ const_iterator end() const { return (const_iterator)base::end(); } \
+ iterator erase(iterator first, iterator last) \
+ { return (iterator)base::erase((biterator)first, (biterator)last); }\
+ iterator erase(iterator it) \
+ { return (iterator)base::erase((biterator)it); } \
+ reference front() { return *begin(); } \
+ const_reference front() const { return *begin(); } \
+ void insert(iterator it, size_type n, const_reference v) \
+ { base::insert((biterator)it, n, (bconst_reference)v); } \
+ iterator insert(iterator it, const_reference v = value_type()) \
+ { return (iterator)base::insert((biterator)it, (bconst_reference)v); }\
+ void insert(iterator it, const_iterator first, const_iterator last) \
+ { base::insert((biterator)it, (bconst_iterator)first, \
+ (bconst_iterator)last); } \
+ void pop_back() { base::pop_back(); } \
+ void push_back(const_reference v) \
+ { base::push_back((bconst_reference)v); } \
+ reverse_iterator rbegin() { return reverse_iterator(end() - 1); } \
+ const_reverse_iterator rbegin() const; \
+ reverse_iterator rend() { return reverse_iterator(begin() - 1); } \
+ const_reverse_iterator rend() const; \
+ void reserve(size_type n) { base::reserve(n); } \
+ void resize(size_type n, value_type v = value_type()) \
+ { base::resize(n, v); } \
+ void swap(name& other) { base::swap(other); } \
+}
+
+#define _WX_PTROP pointer operator->() const { return m_ptr; }
+#define _WX_PTROP_NONE
+
+#define _WX_DEFINE_TYPEARRAY(T, name, base, classexp) \
+ _WX_DEFINE_TYPEARRAY_HELPER(T, name, base, classexp, _WX_PTROP)
+#define _WX_DEFINE_TYPEARRAY_PTR(T, name, base, classexp) \
+ _WX_DEFINE_TYPEARRAY_HELPER(T, name, base, classexp, _WX_PTROP_NONE)
+
+#endif // !wxUSE_STD_CONTAINERS
+
+// ----------------------------------------------------------------------------
+// _WX_DEFINE_SORTED_TYPEARRAY: sorted array for simple data types
+// cannot handle types with size greater than pointer because of sorting
+// ----------------------------------------------------------------------------
+
+#define _WX_DEFINE_SORTED_TYPEARRAY_2(T, name, base, defcomp, classexp, comptype)\
+wxCOMPILE_TIME_ASSERT2(sizeof(T) <= sizeof(base::base_type), \
+ TypeTooBigToBeStoredInSorted##base, \
+ name); \
+classexp name : public base \
+{ \
+ typedef comptype SCMPFUNC; \
+public: \
+ name(comptype fn defcomp) { m_fnCompare = fn; } \
+ \
+ name& operator=(const name& src) \
+ { base* temp = (base*) this; \
+ (*temp) = ((const base&)src); \
+ m_fnCompare = src.m_fnCompare; \
+ return *this; } \
+ \
+ T& operator[](size_t uiIndex) const \
+ { return (T&)(base::operator[](uiIndex)); } \
+ T& Item(size_t uiIndex) const \
+ { return (T&)(base::operator[](uiIndex)); } \
+ T& Last() const \
+ { return (T&)(base::operator[](size() - 1)); } \
+ \
+ int Index(T lItem) const \
+ { return base::Index(lItem, (CMPFUNC)m_fnCompare); } \
+ \
+ size_t IndexForInsert(T lItem) const \
+ { return base::IndexForInsert(lItem, (CMPFUNC)m_fnCompare); } \
+ \
+ void AddAt(T item, size_t index) \
+ { base::insert(begin() + index, item); } \
+ \
+ size_t Add(T lItem) \
+ { return base::Add(lItem, (CMPFUNC)m_fnCompare); } \
+ void push_back(T lItem) \
+ { Add(lItem); } \
+ \
+ void RemoveAt(size_t uiIndex, size_t nRemove = 1) \
+ { base::erase(begin() + uiIndex, begin() + uiIndex + nRemove); } \
+ void Remove(T lItem) \
+ { int iIndex = Index(lItem); \
+ wxCHECK_RET( iIndex != wxNOT_FOUND, _WX_ERROR_REMOVE ); \
+ base::erase(begin() + iIndex); } \
+ \
+private: \
+ comptype m_fnCompare; \
+}
+
+
+// ----------------------------------------------------------------------------
+// _WX_DECLARE_OBJARRAY: an array for pointers to type T with owning semantics
+// ----------------------------------------------------------------------------
+
+#define _WX_DECLARE_OBJARRAY(T, name, base, classexp) \
+typedef int (CMPFUNC_CONV *CMPFUNC##T)(T **pItem1, T **pItem2); \
+classexp name : protected base \
+{ \
+typedef int (CMPFUNC_CONV *CMPFUNC##base)(void **pItem1, void **pItem2); \
+typedef base base_array; \
+public: \
+ name() { } \
+ name(const name& src); \
+ name& operator=(const name& src); \
+ \
+ ~name(); \
+ \
+ void Alloc(size_t count) { base::reserve(count); } \
+ void reserve(size_t count) { base::reserve(count); } \
+ size_t GetCount() const { return base_array::size(); } \
+ size_t size() const { return base_array::size(); } \
+ bool IsEmpty() const { return base_array::empty(); } \
+ bool empty() const { return base_array::empty(); } \
+ size_t Count() const { return base_array::size(); } \
+ void Shrink() { base::Shrink(); } \
+ \
+ T& operator[](size_t uiIndex) const \
+ { return *(T*)base::operator[](uiIndex); } \
+ T& Item(size_t uiIndex) const \
+ { return *(T*)base::operator[](uiIndex); } \
+ T& Last() const \
+ { return *(T*)(base::operator[](size() - 1)); } \
+ \
+ int Index(const T& lItem, bool bFromEnd = false) const; \
+ \
+ void Add(const T& lItem, size_t nInsert = 1); \
+ void Add(const T* pItem) \
+ { base::push_back((T*)pItem); } \
+ void push_back(const T* pItem) \
+ { base::push_back((T*)pItem); } \
+ void push_back(const T& lItem) \
+ { Add(lItem); } \
+ \
+ void Insert(const T& lItem, size_t uiIndex, size_t nInsert = 1); \
+ void Insert(const T* pItem, size_t uiIndex) \
+ { base::insert(begin() + uiIndex, (T*)pItem); } \
+ \
+ void Empty() { DoEmpty(); base::clear(); } \
+ void Clear() { DoEmpty(); base::clear(); } \
+ \
+ T* Detach(size_t uiIndex) \
+ { T* p = (T*)base::operator[](uiIndex); \
+ base::erase(begin() + uiIndex); return p; } \
+ void RemoveAt(size_t uiIndex, size_t nRemove = 1); \
+ \
+ void Sort(CMPFUNC##T fCmp) { base::Sort((CMPFUNC##base)fCmp); } \
+ \
+private: \
+ void DoEmpty(); \
+ void DoCopy(const name& src); \
+}
+
+// ============================================================================
+// The public macros for declaration and definition of the dynamic arrays
+// ============================================================================
+
+// Please note that for each macro WX_FOO_ARRAY we also have
+// WX_FOO_EXPORTED_ARRAY and WX_FOO_USER_EXPORTED_ARRAY which are exactly the
+// same except that they use an additional __declspec(dllexport) or equivalent
+// under Windows if needed.
+//
+// The first (just EXPORTED) macros do it if wxWidgets was compiled as a DLL
+// and so must be used used inside the library. The second kind (USER_EXPORTED)
+// allow the user code to do it when it wants. This is needed if you have a dll
+// that wants to export a wxArray daubed with your own import/export goo.
+//
+// Finally, you can define the macro below as something special to modify the
+// arrays defined by a simple WX_FOO_ARRAY as well. By default is empty.
+#define wxARRAY_DEFAULT_EXPORT
+
+// ----------------------------------------------------------------------------
+// WX_DECLARE_BASEARRAY(T, name) declare an array class named "name" containing
+// the elements of type T
+// ----------------------------------------------------------------------------
+
+#define WX_DECLARE_BASEARRAY(T, name) \
+ WX_DECLARE_USER_EXPORTED_BASEARRAY(T, name, wxARRAY_DEFAULT_EXPORT)
+
+#define WX_DECLARE_EXPORTED_BASEARRAY(T, name) \
+ WX_DECLARE_USER_EXPORTED_BASEARRAY(T, name, WXDLLIMPEXP_CORE)
+
+#define WX_DECLARE_USER_EXPORTED_BASEARRAY(T, name, expmode) \
+ typedef T _wxArray##name; \
+ _WX_DECLARE_BASEARRAY(_wxArray##name, name, class expmode)
+
+// ----------------------------------------------------------------------------
+// WX_DEFINE_TYPEARRAY(T, name, base) define an array class named "name" deriving
+// from class "base" containing the elements of type T
+//
+// Note that the class defined has only inline function and doesn't take any
+// space at all so there is no size penalty for defining multiple array classes
+// ----------------------------------------------------------------------------
+
+#define WX_DEFINE_TYPEARRAY(T, name, base) \
+ WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, class wxARRAY_DEFAULT_EXPORT)
+
+#define WX_DEFINE_TYPEARRAY_PTR(T, name, base) \
+ WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, class wxARRAY_DEFAULT_EXPORT)
+
+#define WX_DEFINE_EXPORTED_TYPEARRAY(T, name, base) \
+ WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, class WXDLLIMPEXP_CORE)
+
+#define WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, base) \
+ WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, class WXDLLIMPEXP_CORE)
+
+#define WX_DEFINE_USER_EXPORTED_TYPEARRAY(T, name, base, expdecl) \
+ WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, class expdecl)
+
+#define WX_DEFINE_USER_EXPORTED_TYPEARRAY_PTR(T, name, base, expdecl) \
+ WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, class expdecl)
+
+#define WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, classdecl) \
+ typedef T _wxArray##name; \
+ _WX_DEFINE_TYPEARRAY(_wxArray##name, name, base, classdecl)
+
+#define WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, classdecl) \
+ typedef T _wxArray##name; \
+ _WX_DEFINE_TYPEARRAY_PTR(_wxArray##name, name, base, classdecl)
+
+// ----------------------------------------------------------------------------
+// WX_DEFINE_SORTED_TYPEARRAY: this is the same as the previous macro, but it
+// defines a sorted array.
+//
+// Differences:
+// 1) it must be given a COMPARE function in ctor which takes 2 items of type
+// T* and should return -1, 0 or +1 if the first one is less/greater
+// than/equal to the second one.
+// 2) the Add() method inserts the item in such was that the array is always
+// sorted (it uses the COMPARE function)
+// 3) it has no Sort() method because it's always sorted
+// 4) Index() method is much faster (the sorted arrays use binary search
+// instead of linear one), but Add() is slower.
+// 5) there is no Insert() method because you can't insert an item into the
+// given position in a sorted array but there is IndexForInsert()/AddAt()
+// pair which may be used to optimize a common operation of "insert only if
+// not found"
+//
+// Note that you have to specify the comparison function when creating the
+// objects of this array type. If, as in 99% of cases, the comparison function
+// is the same for all objects of a class, WX_DEFINE_SORTED_TYPEARRAY_CMP below
+// is more convenient.
+//
+// Summary: use this class when the speed of Index() function is important, use
+// the normal arrays otherwise.
+// ----------------------------------------------------------------------------
+
+// we need a macro which expands to nothing to pass correct number of
+// parameters to a nested macro invocation even when we don't have anything to
+// pass it
+#define wxARRAY_EMPTY
+
+#define WX_DEFINE_SORTED_TYPEARRAY(T, name, base) \
+ WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, base, \
+ wxARRAY_DEFAULT_EXPORT)
+
+#define WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, base) \
+ WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, base, WXDLLIMPEXP_CORE)
+
+#define WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, base, expmode) \
+ typedef T _wxArray##name; \
+ typedef int (CMPFUNC_CONV *SCMPFUNC##name)(T pItem1, T pItem2); \
+ _WX_DEFINE_SORTED_TYPEARRAY_2(_wxArray##name, name, base, \
+ wxARRAY_EMPTY, class expmode, SCMPFUNC##name)
+
+// ----------------------------------------------------------------------------
+// WX_DEFINE_SORTED_TYPEARRAY_CMP: exactly the same as above but the comparison
+// function is provided by this macro and the objects of this class have a
+// default constructor which just uses it.
+//
+// The arguments are: the element type, the comparison function and the array
+// name
+//
+// NB: this is, of course, how WX_DEFINE_SORTED_TYPEARRAY() should have worked
+// from the very beginning - unfortunately I didn't think about this earlier
+// ----------------------------------------------------------------------------
+
+#define WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, base) \
+ WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base, \
+ wxARRAY_DEFAULT_EXPORT)
+
+#define WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base) \
+ WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base, \
+ WXDLLIMPEXP_CORE)
+
+#define WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base, \
+ expmode) \
+ typedef T _wxArray##name; \
+ typedef int (CMPFUNC_CONV *SCMPFUNC##name)(T pItem1, T pItem2); \
+ _WX_DEFINE_SORTED_TYPEARRAY_2(_wxArray##name, name, base, = cmpfunc, \
+ class expmode, SCMPFUNC##name)
+
+// ----------------------------------------------------------------------------
+// WX_DECLARE_OBJARRAY(T, name): this macro generates a new array class
+// named "name" which owns the objects of type T it contains, i.e. it will
+// delete them when it is destroyed.
+//
+// An element is of type T*, but arguments of type T& are taken (see below!)
+// and T& is returned.
+//
+// Don't use this for simple types such as "int" or "long"!
+//
+// Note on Add/Insert functions:
+// 1) function(T*) gives the object to the array, i.e. it will delete the
+// object when it's removed or in the array's dtor
+// 2) function(T&) will create a copy of the object and work with it
+//
+// Also:
+// 1) Remove() will delete the object after removing it from the array
+// 2) Detach() just removes the object from the array (returning pointer to it)
+//
+// NB1: Base type T should have an accessible copy ctor if Add(T&) is used
+// NB2: Never ever cast a array to it's base type: as dtor is not virtual
+// and so you risk having at least the memory leaks and probably worse
+//
+// Some functions of this class are not inline, so it takes some space to
+// define new class from this template even if you don't use it - which is not
+// the case for the simple (non-object) array classes
+//
+// To use an objarray class you must
+// #include "dynarray.h"
+// WX_DECLARE_OBJARRAY(element_type, list_class_name)
+// #include "arrimpl.cpp"
+// WX_DEFINE_OBJARRAY(list_class_name) // name must be the same as above!
+//
+// This is necessary because at the moment of DEFINE_OBJARRAY class parsing the
+// element_type must be fully defined (i.e. forward declaration is not
+// enough), while WX_DECLARE_OBJARRAY may be done anywhere. The separation of
+// two allows to break cicrcular dependencies with classes which have member
+// variables of objarray type.
+// ----------------------------------------------------------------------------
+
+#define WX_DECLARE_OBJARRAY(T, name) \
+ WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, wxARRAY_DEFAULT_EXPORT)
+
+#define WX_DECLARE_EXPORTED_OBJARRAY(T, name) \
+ WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, WXDLLIMPEXP_CORE)
+
+#define WX_DECLARE_OBJARRAY_WITH_DECL(T, name, decl) \
+ typedef T _wxObjArray##name; \
+ _WX_DECLARE_OBJARRAY(_wxObjArray##name, name, wxArrayPtrVoid, decl)
+
+#define WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, expmode) \
+ WX_DECLARE_OBJARRAY_WITH_DECL(T, name, class expmode)
+
+// WX_DEFINE_OBJARRAY is going to be redefined when arrimpl.cpp is included,
+// try to provoke a human-understandable error if it used incorrectly.
+//
+// there is no real need for 3 different macros in the DEFINE case but do it
+// anyhow for consistency
+#define WX_DEFINE_OBJARRAY(name) DidYouIncludeArrimplCpp
+#define WX_DEFINE_EXPORTED_OBJARRAY(name) WX_DEFINE_OBJARRAY(name)
+#define WX_DEFINE_USER_EXPORTED_OBJARRAY(name) WX_DEFINE_OBJARRAY(name)
+
+// ----------------------------------------------------------------------------
+// Some commonly used predefined base arrays
+// ----------------------------------------------------------------------------
+
+WX_DECLARE_USER_EXPORTED_BASEARRAY(const void *, wxBaseArrayPtrVoid,
+ WXDLLIMPEXP_BASE);
+WX_DECLARE_USER_EXPORTED_BASEARRAY(char, wxBaseArrayChar, WXDLLIMPEXP_BASE);
+WX_DECLARE_USER_EXPORTED_BASEARRAY(short, wxBaseArrayShort, WXDLLIMPEXP_BASE);
+WX_DECLARE_USER_EXPORTED_BASEARRAY(int, wxBaseArrayInt, WXDLLIMPEXP_BASE);
+WX_DECLARE_USER_EXPORTED_BASEARRAY(long, wxBaseArrayLong, WXDLLIMPEXP_BASE);
+WX_DECLARE_USER_EXPORTED_BASEARRAY(size_t, wxBaseArraySizeT, WXDLLIMPEXP_BASE);
+WX_DECLARE_USER_EXPORTED_BASEARRAY(double, wxBaseArrayDouble, WXDLLIMPEXP_BASE);
+
+// ----------------------------------------------------------------------------
+// Convenience macros to define arrays from base arrays
+// ----------------------------------------------------------------------------
+
+#define WX_DEFINE_ARRAY(T, name) \
+ WX_DEFINE_TYPEARRAY(T, name, wxBaseArrayPtrVoid)
+#define WX_DEFINE_ARRAY_PTR(T, name) \
+ WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayPtrVoid)
+#define WX_DEFINE_EXPORTED_ARRAY(T, name) \
+ WX_DEFINE_EXPORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid)
+#define WX_DEFINE_EXPORTED_ARRAY_PTR(T, name) \
+ WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayPtrVoid)
+#define WX_DEFINE_ARRAY_WITH_DECL_PTR(T, name, decl) \
+ WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayPtrVoid, decl)
+#define WX_DEFINE_USER_EXPORTED_ARRAY(T, name, expmode) \
+ WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, wxBaseArrayPtrVoid, wxARRAY_EMPTY expmode)
+#define WX_DEFINE_USER_EXPORTED_ARRAY_PTR(T, name, expmode) \
+ WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayPtrVoid, wxARRAY_EMPTY expmode)
+
+#define WX_DEFINE_ARRAY_CHAR(T, name) \
+ WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayChar)
+#define WX_DEFINE_EXPORTED_ARRAY_CHAR(T, name) \
+ WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayChar)
+#define WX_DEFINE_USER_EXPORTED_ARRAY_CHAR(T, name, expmode) \
+ WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayChar, wxARRAY_EMPTY expmode)
+
+#define WX_DEFINE_ARRAY_SHORT(T, name) \
+ WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayShort)
+#define WX_DEFINE_EXPORTED_ARRAY_SHORT(T, name) \
+ WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayShort)
+#define WX_DEFINE_USER_EXPORTED_ARRAY_SHORT(T, name, expmode) \
+ WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayShort, wxARRAY_EMPTY expmode)
+
+#define WX_DEFINE_ARRAY_INT(T, name) \
+ WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayInt)
+#define WX_DEFINE_EXPORTED_ARRAY_INT(T, name) \
+ WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayInt)
+#define WX_DEFINE_USER_EXPORTED_ARRAY_INT(T, name, expmode) \
+ WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayInt, wxARRAY_EMPTY expmode)
+
+#define WX_DEFINE_ARRAY_LONG(T, name) \
+ WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayLong)
+#define WX_DEFINE_EXPORTED_ARRAY_LONG(T, name) \
+ WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayLong)
+#define WX_DEFINE_USER_EXPORTED_ARRAY_LONG(T, name, expmode) \
+ WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayLong, wxARRAY_EMPTY expmode)
+
+#define WX_DEFINE_ARRAY_SIZE_T(T, name) \
+ WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArraySizeT)
+#define WX_DEFINE_EXPORTED_ARRAY_SIZE_T(T, name) \
+ WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArraySizeT)
+#define WX_DEFINE_USER_EXPORTED_ARRAY_SIZE_T(T, name, expmode) \
+ WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArraySizeT, wxARRAY_EMPTY expmode)
+
+#define WX_DEFINE_ARRAY_DOUBLE(T, name) \
+ WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayDouble)
+#define WX_DEFINE_EXPORTED_ARRAY_DOUBLE(T, name) \
+ WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayDouble)
+#define WX_DEFINE_USER_EXPORTED_ARRAY_DOUBLE(T, name, expmode) \
+ WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayDouble, wxARRAY_EMPTY expmode)
+
+// ----------------------------------------------------------------------------
+// Convenience macros to define sorted arrays from base arrays
+// ----------------------------------------------------------------------------
+
+#define WX_DEFINE_SORTED_ARRAY(T, name) \
+ WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid)
+#define WX_DEFINE_SORTED_EXPORTED_ARRAY(T, name) \
+ WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid)
+#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY(T, name, expmode) \
+ WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid, wxARRAY_EMPTY expmode)
+
+#define WX_DEFINE_SORTED_ARRAY_CHAR(T, name) \
+ WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayChar)
+#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CHAR(T, name) \
+ WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayChar)
+#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CHAR(T, name, expmode) \
+ WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayChar, wxARRAY_EMPTY expmode)
+
+#define WX_DEFINE_SORTED_ARRAY_SHORT(T, name) \
+ WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayShort)
+#define WX_DEFINE_SORTED_EXPORTED_ARRAY_SHORT(T, name) \
+ WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayShort)
+#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_SHORT(T, name, expmode) \
+ WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayShort, wxARRAY_EMPTY expmode)
+
+#define WX_DEFINE_SORTED_ARRAY_INT(T, name) \
+ WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayInt)
+#define WX_DEFINE_SORTED_EXPORTED_ARRAY_INT(T, name) \
+ WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayInt)
+#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_INT(T, name, expmode) \
+ WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayInt, expmode)
+
+#define WX_DEFINE_SORTED_ARRAY_LONG(T, name) \
+ WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayLong)
+#define WX_DEFINE_SORTED_EXPORTED_ARRAY_LONG(T, name) \
+ WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayLong)
+#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_LONG(T, name, expmode) \
+ WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayLong, expmode)
+
+#define WX_DEFINE_SORTED_ARRAY_SIZE_T(T, name) \
+ WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArraySizeT)
+#define WX_DEFINE_SORTED_EXPORTED_ARRAY_SIZE_T(T, name) \
+ WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArraySizeT)
+#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_SIZE_T(T, name, expmode) \
+ WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArraySizeT, wxARRAY_EMPTY expmode)
+
+// ----------------------------------------------------------------------------
+// Convenience macros to define sorted arrays from base arrays
+// ----------------------------------------------------------------------------
+
+#define WX_DEFINE_SORTED_ARRAY_CMP(T, cmpfunc, name) \
+ WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayPtrVoid)
+#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP(T, cmpfunc, name) \
+ WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayPtrVoid)
+#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP(T, cmpfunc, \
+ name, expmode) \
+ WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \
+ wxBaseArrayPtrVoid, \
+ wxARRAY_EMPTY expmode)
+
+#define WX_DEFINE_SORTED_ARRAY_CMP_CHAR(T, cmpfunc, name) \
+ WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayChar)
+#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_CHAR(T, cmpfunc, name) \
+ WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayChar)
+#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_CHAR(T, cmpfunc, \
+ name, expmode) \
+ WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \
+ wxBaseArrayChar, \
+ wxARRAY_EMPTY expmode)
+
+#define WX_DEFINE_SORTED_ARRAY_CMP_SHORT(T, cmpfunc, name) \
+ WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayShort)
+#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_SHORT(T, cmpfunc, name) \
+ WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayShort)
+#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_SHORT(T, cmpfunc, \
+ name, expmode) \
+ WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \
+ wxBaseArrayShort, \
+ wxARRAY_EMPTY expmode)
+
+#define WX_DEFINE_SORTED_ARRAY_CMP_INT(T, cmpfunc, name) \
+ WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayInt)
+#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_INT(T, cmpfunc, name) \
+ WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayInt)
+#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_INT(T, cmpfunc, \
+ name, expmode) \
+ WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \
+ wxBaseArrayInt, \
+ wxARRAY_EMPTY expmode)
+
+#define WX_DEFINE_SORTED_ARRAY_CMP_LONG(T, cmpfunc, name) \
+ WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayLong)
+#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_LONG(T, cmpfunc, name) \
+ WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayLong)
+#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_LONG(T, cmpfunc, \
+ name, expmode) \
+ WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \
+ wxBaseArrayLong, \
+ wxARRAY_EMPTY expmode)
+
+#define WX_DEFINE_SORTED_ARRAY_CMP_SIZE_T(T, cmpfunc, name) \
+ WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArraySizeT)
+#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_SIZE_T(T, cmpfunc, name) \
+ WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArraySizeT)
+#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_SIZE_T(T, cmpfunc, \
+ name, expmode) \
+ WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \
+ wxBaseArraySizeT, \
+ wxARRAY_EMPTY expmode)
+
+// ----------------------------------------------------------------------------
+// Some commonly used predefined arrays
+// ----------------------------------------------------------------------------
+
+WX_DEFINE_USER_EXPORTED_ARRAY_SHORT(short, wxArrayShort, class WXDLLIMPEXP_BASE);
+WX_DEFINE_USER_EXPORTED_ARRAY_INT(int, wxArrayInt, class WXDLLIMPEXP_BASE);
+WX_DEFINE_USER_EXPORTED_ARRAY_DOUBLE(double, wxArrayDouble, class WXDLLIMPEXP_BASE);
+WX_DEFINE_USER_EXPORTED_ARRAY_LONG(long, wxArrayLong, class WXDLLIMPEXP_BASE);
+WX_DEFINE_USER_EXPORTED_ARRAY_PTR(void *, wxArrayPtrVoid, class WXDLLIMPEXP_BASE);
+
+// -----------------------------------------------------------------------------
+// convenience macros
+// -----------------------------------------------------------------------------
+
+// prepend all element of one array to another one; e.g. if first array contains
+// elements X,Y,Z and the second contains A,B,C (in those orders), then the
+// first array will be result as A,B,C,X,Y,Z
+#define WX_PREPEND_ARRAY(array, other) \
+ { \
+ size_t wxAAcnt = (other).size(); \
+ (array).reserve(wxAAcnt); \
+ for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ ) \
+ { \
+ (array).Insert((other)[wxAAn], wxAAn); \
+ } \
+ }
+
+// append all element of one array to another one
+#define WX_APPEND_ARRAY(array, other) \
+ { \
+ size_t wxAAcnt = (other).size(); \
+ (array).reserve(wxAAcnt); \
+ for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ ) \
+ { \
+ (array).push_back((other)[wxAAn]); \
+ } \
+ }
+
+// delete all array elements
+//
+// NB: the class declaration of the array elements must be visible from the
+// place where you use this macro, otherwise the proper destructor may not
+// be called (a decent compiler should give a warning about it, but don't
+// count on it)!
+#define WX_CLEAR_ARRAY(array) \
+ { \
+ size_t wxAAcnt = (array).size(); \
+ for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ ) \
+ { \
+ delete (array)[wxAAn]; \
+ } \
+ \
+ (array).clear(); \
+ }
+
+#endif // _DYNARRAY_H
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/dynlib.h
+// Purpose: Dynamic library loading classes
+// Author: Guilhem Lavaux, Vadim Zeitlin, Vaclav Slavik
+// Modified by:
+// Created: 20/07/98
+// Copyright: (c) 1998 Guilhem Lavaux
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DYNLIB_H__
+#define _WX_DYNLIB_H__
+
+#include "wx/defs.h"
+
+#if wxUSE_DYNLIB_CLASS
+
+#include "wx/string.h"
+#include "wx/dynarray.h"
+
+// note that we have our own dlerror() implementation under Darwin
+#if (defined(HAVE_DLERROR) && !defined(__EMX__)) || defined(__DARWIN__)
+ #define wxHAVE_DYNLIB_ERROR
+#endif
+
+class WXDLLIMPEXP_FWD_BASE wxDynamicLibraryDetailsCreator;
+
+// ----------------------------------------------------------------------------
+// conditional compilation
+// ----------------------------------------------------------------------------
+
+// Note: __OS2__/EMX has to be tested first, since we want to use
+// native version, even if configure detected presence of DLOPEN.
+#if defined(__OS2__) || defined(__EMX__) || defined(__WINDOWS__)
+ typedef WXHMODULE wxDllType;
+#elif defined(__DARWIN__)
+ // Don't include dlfcn.h on Darwin, we may be using our own replacements.
+ typedef void *wxDllType;
+#elif defined(HAVE_DLOPEN)
+ #include <dlfcn.h>
+ typedef void *wxDllType;
+#elif defined(HAVE_SHL_LOAD)
+ #include <dl.h>
+ typedef shl_t wxDllType;
+#elif defined(__WXMAC__)
+ #include <CodeFragments.h>
+ typedef CFragConnectionID wxDllType;
+#else
+ #error "Dynamic Loading classes can't be compiled on this platform, sorry."
+#endif
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+enum wxDLFlags
+{
+ wxDL_LAZY = 0x00000001, // resolve undefined symbols at first use
+ // (only works on some Unix versions)
+ wxDL_NOW = 0x00000002, // resolve undefined symbols on load
+ // (default, always the case under Win32)
+ wxDL_GLOBAL = 0x00000004, // export extern symbols to subsequently
+ // loaded libs.
+ wxDL_VERBATIM = 0x00000008, // attempt to load the supplied library
+ // name without appending the usual dll
+ // filename extension.
+
+ // this flag is obsolete, don't use
+ wxDL_NOSHARE = 0x00000010, // load new DLL, don't reuse already loaded
+ // (only for wxPluginManager)
+
+ wxDL_QUIET = 0x00000020, // don't log an error if failed to load
+
+ // this flag is dangerous, for internal use of wxMSW only, don't use at all
+ // and especially don't use directly, use wxLoadedDLL instead if you really
+ // do need it
+ wxDL_GET_LOADED = 0x00000040, // Win32 only: return handle of already
+ // loaded DLL or NULL otherwise; Unload()
+ // should not be called so don't forget to
+ // Detach() if you use this function
+
+ wxDL_DEFAULT = wxDL_NOW // default flags correspond to Win32
+};
+
+enum wxDynamicLibraryCategory
+{
+ wxDL_LIBRARY, // standard library
+ wxDL_MODULE // loadable module/plugin
+};
+
+enum wxPluginCategory
+{
+ wxDL_PLUGIN_GUI, // plugin that uses GUI classes
+ wxDL_PLUGIN_BASE // wxBase-only plugin
+};
+
+// ----------------------------------------------------------------------------
+// macros
+// ----------------------------------------------------------------------------
+
+// when loading a function from a DLL you always have to cast the returned
+// "void *" pointer to the correct type and, even more annoyingly, you have to
+// repeat this type twice if you want to declare and define a function pointer
+// all in one line
+//
+// this macro makes this slightly less painful by allowing you to specify the
+// type only once, as the first parameter, and creating a variable of this type
+// called "pfn<name>" initialized with the "name" from the "dynlib"
+#define wxDYNLIB_FUNCTION(type, name, dynlib) \
+ type pfn ## name = (type)(dynlib).GetSymbol(wxT(#name))
+
+
+// a more convenient function replacing wxDYNLIB_FUNCTION above
+//
+// it uses the convention that the type of the function is its name suffixed
+// with "_t" but it doesn't define a variable but just assigns the loaded value
+// to it and also allows to pass it the prefix to be used instead of hardcoding
+// "pfn" (the prefix can be "m_" or "gs_pfn" or whatever)
+//
+// notice that this function doesn't generate error messages if the symbol
+// couldn't be loaded, the caller should generate the appropriate message
+#define wxDL_INIT_FUNC(pfx, name, dynlib) \
+ pfx ## name = (name ## _t)(dynlib).RawGetSymbol(#name)
+
+#ifdef __WINDOWS__
+
+// same as wxDL_INIT_FUNC() but appends 'A' or 'W' to the function name, see
+// wxDynamicLibrary::GetSymbolAorW()
+#define wxDL_INIT_FUNC_AW(pfx, name, dynlib) \
+ pfx ## name = (name ## _t)(dynlib).GetSymbolAorW(#name)
+
+#endif // __WINDOWS__
+
+// the following macros can be used to redirect a whole library to a class and
+// check at run-time if the library is present and contains all required
+// methods
+//
+// notice that they are supposed to be used inside a class which has "m_ok"
+// member variable indicating if the library had been successfully loaded
+
+// helper macros constructing the name of the variable storing the function
+// pointer and the name of its type from the function name
+#define wxDL_METHOD_NAME(name) m_pfn ## name
+#define wxDL_METHOD_TYPE(name) name ## _t
+
+// parameters are:
+// - rettype: return type of the function, e.g. "int"
+// - name: name of the function, e.g. "foo"
+// - args: function signature in parentheses, e.g. "(int x, int y)"
+// - argnames: the names of the parameters in parentheses, e.g. "(x, y)"
+// - defret: the value to return if the library wasn't successfully loaded
+#define wxDL_METHOD_DEFINE( rettype, name, args, argnames, defret ) \
+ typedef rettype (* wxDL_METHOD_TYPE(name)) args ; \
+ wxDL_METHOD_TYPE(name) wxDL_METHOD_NAME(name); \
+ rettype name args \
+ { return m_ok ? wxDL_METHOD_NAME(name) argnames : defret; }
+
+#define wxDL_VOIDMETHOD_DEFINE( name, args, argnames ) \
+ typedef void (* wxDL_METHOD_TYPE(name)) args ; \
+ wxDL_METHOD_TYPE(name) wxDL_METHOD_NAME(name); \
+ void name args \
+ { if ( m_ok ) wxDL_METHOD_NAME(name) argnames ; }
+
+#define wxDL_METHOD_LOAD(lib, name) \
+ wxDL_METHOD_NAME(name) = \
+ (wxDL_METHOD_TYPE(name)) lib.GetSymbol(#name, &m_ok); \
+ if ( !m_ok ) return false
+
+// ----------------------------------------------------------------------------
+// wxDynamicLibraryDetails: contains details about a loaded wxDynamicLibrary
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxDynamicLibraryDetails
+{
+public:
+ // ctor, normally never used as these objects are only created by
+ // wxDynamicLibrary::ListLoaded()
+ wxDynamicLibraryDetails() { m_address = NULL; m_length = 0; }
+
+ // get the (base) name
+ wxString GetName() const { return m_name; }
+
+ // get the full path of this object
+ wxString GetPath() const { return m_path; }
+
+ // get the load address and the extent, return true if this information is
+ // available
+ bool GetAddress(void **addr, size_t *len) const
+ {
+ if ( !m_address )
+ return false;
+
+ if ( addr )
+ *addr = m_address;
+ if ( len )
+ *len = m_length;
+
+ return true;
+ }
+
+ // return the version of the DLL (may be empty if no version info)
+ wxString GetVersion() const
+ {
+ return m_version;
+ }
+
+private:
+ wxString m_name,
+ m_path,
+ m_version;
+
+ void *m_address;
+ size_t m_length;
+
+ friend class wxDynamicLibraryDetailsCreator;
+};
+
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDynamicLibraryDetails,
+ wxDynamicLibraryDetailsArray,
+ WXDLLIMPEXP_BASE);
+
+// ----------------------------------------------------------------------------
+// wxDynamicLibrary: represents a handle to a DLL/shared object
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxDynamicLibrary
+{
+public:
+ // return a valid handle for the main program itself or NULL if back
+ // linking is not supported by the current platform (e.g. Win32)
+ static wxDllType GetProgramHandle();
+
+ // return the platform standard DLL extension (with leading dot)
+ static wxString GetDllExt(wxDynamicLibraryCategory cat = wxDL_LIBRARY);
+
+ wxDynamicLibrary() : m_handle(0) { }
+ wxDynamicLibrary(const wxString& libname, int flags = wxDL_DEFAULT)
+ : m_handle(0)
+ {
+ Load(libname, flags);
+ }
+
+ // NOTE: this class is (deliberately) not virtual, do not attempt
+ // to use it polymorphically.
+ ~wxDynamicLibrary() { Unload(); }
+
+ // return true if the library was loaded successfully
+ bool IsLoaded() const { return m_handle != 0; }
+
+ // load the library with the given name (full or not), return true if ok
+ bool Load(const wxString& libname, int flags = wxDL_DEFAULT);
+
+ // raw function for loading dynamic libs: always behaves as if
+ // wxDL_VERBATIM were specified and doesn't log error message if the
+ // library couldn't be loaded but simply returns NULL
+ static wxDllType RawLoad(const wxString& libname, int flags = wxDL_DEFAULT);
+
+ // detach the library object from its handle, i.e. prevent the object from
+ // unloading the library in its dtor -- the caller is now responsible for
+ // doing this
+ wxDllType Detach() { wxDllType h = m_handle; m_handle = 0; return h; }
+
+ // unload the given library handle (presumably returned by Detach() before)
+ static void Unload(wxDllType handle);
+
+ // unload the library, also done automatically in dtor
+ void Unload() { if ( IsLoaded() ) { Unload(m_handle); m_handle = 0; } }
+
+ // Return the raw handle from dlopen and friends.
+ wxDllType GetLibHandle() const { return m_handle; }
+
+ // check if the given symbol is present in the library, useful to verify if
+ // a loadable module is our plugin, for example, without provoking error
+ // messages from GetSymbol()
+ bool HasSymbol(const wxString& name) const
+ {
+ bool ok;
+ DoGetSymbol(name, &ok);
+ return ok;
+ }
+
+ // resolve a symbol in a loaded DLL, such as a variable or function name.
+ // 'name' is the (possibly mangled) name of the symbol. (use extern "C" to
+ // export unmangled names)
+ //
+ // Since it is perfectly valid for the returned symbol to actually be NULL,
+ // that is not always indication of an error. Pass and test the parameter
+ // 'success' for a true indication of success or failure to load the
+ // symbol.
+ //
+ // Returns a pointer to the symbol on success, or NULL if an error occurred
+ // or the symbol wasn't found.
+ void *GetSymbol(const wxString& name, bool *success = NULL) const;
+
+ // low-level version of GetSymbol()
+ static void *RawGetSymbol(wxDllType handle, const wxString& name);
+ void *RawGetSymbol(const wxString& name) const
+ {
+#if defined (__WXPM__) || defined(__EMX__)
+ return GetSymbol(name);
+#else
+ return RawGetSymbol(m_handle, name);
+#endif
+ }
+
+#ifdef __WINDOWS__
+ // this function is useful for loading functions from the standard Windows
+ // DLLs: such functions have an 'A' (in ANSI build) or 'W' (in Unicode, or
+ // wide character build) suffix if they take string parameters
+ static void *RawGetSymbolAorW(wxDllType handle, const wxString& name)
+ {
+ return RawGetSymbol
+ (
+ handle,
+ name +
+#if wxUSE_UNICODE
+ L'W'
+#else
+ 'A'
+#endif
+ );
+ }
+
+ void *GetSymbolAorW(const wxString& name) const
+ {
+ return RawGetSymbolAorW(m_handle, name);
+ }
+#endif // __WINDOWS__
+
+ // return all modules/shared libraries in the address space of this process
+ //
+ // returns an empty array if not implemented or an error occurred
+ static wxDynamicLibraryDetailsArray ListLoaded();
+
+ // return platform-specific name of dynamic library with proper extension
+ // and prefix (e.g. "foo.dll" on Windows or "libfoo.so" on Linux)
+ static wxString CanonicalizeName(const wxString& name,
+ wxDynamicLibraryCategory cat = wxDL_LIBRARY);
+
+ // return name of wxWidgets plugin (adds compiler and version info
+ // to the filename):
+ static wxString
+ CanonicalizePluginName(const wxString& name,
+ wxPluginCategory cat = wxDL_PLUGIN_GUI);
+
+ // return plugin directory on platforms where it makes sense and empty
+ // string on others:
+ static wxString GetPluginsDirectory();
+
+
+#ifdef __WINDOWS__
+ // return the handle (HMODULE/HINSTANCE) of the DLL with the given name
+ // and/or containing the specified address: for XP and later systems only
+ // the address is used and the name is ignored but for the previous systems
+ // only the name (which may be either a full path to the DLL or just its
+ // base name, possibly even without extension) is used
+ //
+ // the returned handle reference count is not incremented so it doesn't
+ // need to be freed using FreeLibrary() but it also means that it can
+ // become invalid if the DLL is unloaded
+ static WXHMODULE MSWGetModuleHandle(const wxString& name, void *addr);
+#endif // __WINDOWS__
+
+protected:
+ // common part of GetSymbol() and HasSymbol()
+ void *DoGetSymbol(const wxString& name, bool *success = 0) const;
+
+#ifdef wxHAVE_DYNLIB_ERROR
+ // log the error after a dlxxx() function failure
+ static void Error();
+#endif // wxHAVE_DYNLIB_ERROR
+
+
+ // the handle to DLL or NULL
+ wxDllType m_handle;
+
+ // no copy ctor/assignment operators (or we'd try to unload the library
+ // twice)
+ wxDECLARE_NO_COPY_CLASS(wxDynamicLibrary);
+};
+
+#ifdef __WINDOWS__
+
+// ----------------------------------------------------------------------------
+// wxLoadedDLL is a MSW-only internal helper class allowing to dynamically bind
+// to a DLL already loaded into the project address space
+// ----------------------------------------------------------------------------
+
+class wxLoadedDLL : public wxDynamicLibrary
+{
+public:
+ wxLoadedDLL(const wxString& dllname)
+ : wxDynamicLibrary(dllname, wxDL_GET_LOADED | wxDL_VERBATIM | wxDL_QUIET)
+ {
+ }
+
+ ~wxLoadedDLL()
+ {
+ Detach();
+ }
+};
+
+#endif // __WINDOWS__
+
+// ----------------------------------------------------------------------------
+// Interesting defines
+// ----------------------------------------------------------------------------
+
+#define WXDLL_ENTRY_FUNCTION() \
+extern "C" WXEXPORT const wxClassInfo *wxGetClassFirst(); \
+const wxClassInfo *wxGetClassFirst() { \
+ return wxClassInfo::GetFirst(); \
+}
+
+#endif // wxUSE_DYNLIB_CLASS
+
+#endif // _WX_DYNLIB_H__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/dynload.h
+// Purpose: Dynamic loading framework
+// Author: Ron Lee, David Falkinder, Vadim Zeitlin and a cast of 1000's
+// (derived in part from dynlib.cpp (c) 1998 Guilhem Lavaux)
+// Modified by:
+// Created: 03/12/01
+// Copyright: (c) 2001 Ron Lee <ron@debian.org>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DYNAMICLOADER_H__
+#define _WX_DYNAMICLOADER_H__
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_DYNAMIC_LOADER
+
+#include "wx/dynlib.h"
+#include "wx/hashmap.h"
+#include "wx/module.h"
+
+class WXDLLIMPEXP_FWD_BASE wxPluginLibrary;
+
+
+WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxPluginLibrary *, wxDLManifest,
+ class WXDLLIMPEXP_BASE);
+typedef wxDLManifest wxDLImports;
+
+// ---------------------------------------------------------------------------
+// wxPluginLibrary
+// ---------------------------------------------------------------------------
+
+// NOTE: Do not attempt to use a base class pointer to this class.
+// wxDL is not virtual and we deliberately hide some of it's
+// methods here.
+//
+// Unless you know exacty why you need to, you probably shouldn't
+// instantiate this class directly anyway, use wxPluginManager
+// instead.
+
+class WXDLLIMPEXP_BASE wxPluginLibrary : public wxDynamicLibrary
+{
+public:
+
+ static wxDLImports* ms_classes; // Static hash of all imported classes.
+
+ wxPluginLibrary( const wxString &libname, int flags = wxDL_DEFAULT );
+ ~wxPluginLibrary();
+
+ wxPluginLibrary *RefLib();
+ bool UnrefLib();
+
+ // These two are called by the PluginSentinel on (PLUGGABLE) object
+ // creation/destruction. There is usually no reason for the user to
+ // call them directly. We have to separate this from the link count,
+ // since the two are not interchangeable.
+
+ // FIXME: for even better debugging PluginSentinel should register
+ // the name of the class created too, then we can state
+ // exactly which object was not destroyed which may be
+ // difficult to find otherwise. Also this code should
+ // probably only be active in DEBUG mode, but let's just
+ // get it right first.
+
+ void RefObj() { ++m_objcount; }
+ void UnrefObj()
+ {
+ wxASSERT_MSG( m_objcount > 0, wxT("Too many objects deleted??") );
+ --m_objcount;
+ }
+
+ // Override/hide some base class methods
+
+ bool IsLoaded() const { return m_linkcount > 0; }
+ void Unload() { UnrefLib(); }
+
+private:
+
+ // These pointers may be NULL but if they are not, then m_ourLast follows
+ // m_ourFirst in the linked list, i.e. can be found by calling GetNext() a
+ // sufficient number of times.
+ const wxClassInfo *m_ourFirst; // first class info in this plugin
+ const wxClassInfo *m_ourLast; // ..and the last one
+
+ size_t m_linkcount; // Ref count of library link calls
+ size_t m_objcount; // ..and (pluggable) object instantiations.
+ wxModuleList m_wxmodules; // any wxModules that we initialised.
+
+ void UpdateClasses(); // Update ms_classes
+ void RestoreClasses(); // Removes this library from ms_classes
+ void RegisterModules(); // Init any wxModules in the lib.
+ void UnregisterModules(); // Cleanup any wxModules we installed.
+
+ wxDECLARE_NO_COPY_CLASS(wxPluginLibrary);
+};
+
+
+class WXDLLIMPEXP_BASE wxPluginManager
+{
+public:
+
+ // Static accessors.
+
+ static wxPluginLibrary *LoadLibrary( const wxString &libname,
+ int flags = wxDL_DEFAULT );
+ static bool UnloadLibrary(const wxString &libname);
+
+ // Instance methods.
+
+ wxPluginManager() : m_entry(NULL) {}
+ wxPluginManager(const wxString &libname, int flags = wxDL_DEFAULT)
+ {
+ Load(libname, flags);
+ }
+ ~wxPluginManager() { if ( IsLoaded() ) Unload(); }
+
+ bool Load(const wxString &libname, int flags = wxDL_DEFAULT);
+ void Unload();
+
+ bool IsLoaded() const { return m_entry && m_entry->IsLoaded(); }
+ void *GetSymbol(const wxString &symbol, bool *success = 0)
+ {
+ return m_entry->GetSymbol( symbol, success );
+ }
+
+ static void CreateManifest() { ms_manifest = new wxDLManifest(wxKEY_STRING); }
+ static void ClearManifest() { delete ms_manifest; ms_manifest = NULL; }
+
+private:
+ // return the pointer to the entry for the library with given name in
+ // ms_manifest or NULL if none
+ static wxPluginLibrary *FindByName(const wxString& name)
+ {
+ const wxDLManifest::iterator i = ms_manifest->find(name);
+
+ return i == ms_manifest->end() ? NULL : i->second;
+ }
+
+ static wxDLManifest* ms_manifest; // Static hash of loaded libs.
+ wxPluginLibrary* m_entry; // Cache our entry in the manifest.
+
+ // We could allow this class to be copied if we really
+ // wanted to, but not without modification.
+ wxDECLARE_NO_COPY_CLASS(wxPluginManager);
+};
+
+
+#endif // wxUSE_DYNAMIC_LOADER
+#endif // _WX_DYNAMICLOADER_H__
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/editlbox.h
+// Purpose: ListBox with editable items
+// Author: Vaclav Slavik
+// Copyright: (c) Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef __WX_EDITLBOX_H__
+#define __WX_EDITLBOX_H__
+
+#include "wx/defs.h"
+
+#if wxUSE_EDITABLELISTBOX
+
+#include "wx/panel.h"
+
+class WXDLLIMPEXP_FWD_CORE wxBitmapButton;
+class WXDLLIMPEXP_FWD_CORE wxListCtrl;
+class WXDLLIMPEXP_FWD_CORE wxListEvent;
+
+#define wxEL_ALLOW_NEW 0x0100
+#define wxEL_ALLOW_EDIT 0x0200
+#define wxEL_ALLOW_DELETE 0x0400
+#define wxEL_NO_REORDER 0x0800
+#define wxEL_DEFAULT_STYLE (wxEL_ALLOW_NEW | wxEL_ALLOW_EDIT | wxEL_ALLOW_DELETE)
+
+extern WXDLLIMPEXP_DATA_ADV(const char) wxEditableListBoxNameStr[];
+
+// This class provides a composite control that lets the
+// user easily enter list of strings
+
+class WXDLLIMPEXP_ADV wxEditableListBox : public wxPanel
+{
+public:
+ wxEditableListBox() { Init(); }
+
+ wxEditableListBox(wxWindow *parent, wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxEL_DEFAULT_STYLE,
+ const wxString& name = wxEditableListBoxNameStr)
+ {
+ Init();
+ Create(parent, id, label, pos, size, style, name);
+ }
+
+ bool Create(wxWindow *parent, wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxEL_DEFAULT_STYLE,
+ const wxString& name = wxEditableListBoxNameStr);
+
+ void SetStrings(const wxArrayString& strings);
+ void GetStrings(wxArrayString& strings) const;
+
+ wxListCtrl* GetListCtrl() { return m_listCtrl; }
+ wxBitmapButton* GetDelButton() { return m_bDel; }
+ wxBitmapButton* GetNewButton() { return m_bNew; }
+ wxBitmapButton* GetUpButton() { return m_bUp; }
+ wxBitmapButton* GetDownButton() { return m_bDown; }
+ wxBitmapButton* GetEditButton() { return m_bEdit; }
+
+protected:
+ wxBitmapButton *m_bDel, *m_bNew, *m_bUp, *m_bDown, *m_bEdit;
+ wxListCtrl *m_listCtrl;
+ int m_selection;
+ long m_style;
+
+ void Init()
+ {
+ m_style = 0;
+ m_selection = 0;
+ m_bEdit = m_bNew = m_bDel = m_bUp = m_bDown = NULL;
+ m_listCtrl = NULL;
+ }
+
+ void OnItemSelected(wxListEvent& event);
+ void OnEndLabelEdit(wxListEvent& event);
+ void OnNewItem(wxCommandEvent& event);
+ void OnDelItem(wxCommandEvent& event);
+ void OnEditItem(wxCommandEvent& event);
+ void OnUpItem(wxCommandEvent& event);
+ void OnDownItem(wxCommandEvent& event);
+
+ DECLARE_CLASS(wxEditableListBox)
+ DECLARE_EVENT_TABLE()
+
+private:
+ void SwapItems(long i1, long i2);
+
+};
+
+#endif // wxUSE_EDITABLELISTBOX
+
+#endif // __WX_EDITLBOX_H__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/effects.h
+// Purpose: wxEffects class
+// Draws 3D effects.
+// Author: Julian Smart et al
+// Modified by:
+// Created: 25/4/2000
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_EFFECTS_H_
+#define _WX_EFFECTS_H_
+
+// this class is deprecated and will be removed in the next wx version
+//
+// please use wxRenderer::DrawBorder() instead of DrawSunkenEdge(); there is no
+// replacement for TileBitmap() but it doesn't seem to be very useful anyhow
+#if WXWIN_COMPATIBILITY_2_8
+
+/*
+ * wxEffects: various 3D effects
+ */
+
+#include "wx/object.h"
+#include "wx/colour.h"
+#include "wx/gdicmn.h"
+#include "wx/dc.h"
+
+class WXDLLIMPEXP_CORE wxEffectsImpl: public wxObject
+{
+public:
+ // Assume system colours
+ wxEffectsImpl() ;
+ // Going from lightest to darkest
+ wxEffectsImpl(const wxColour& highlightColour, const wxColour& lightShadow,
+ const wxColour& faceColour, const wxColour& mediumShadow,
+ const wxColour& darkShadow) ;
+
+ // Accessors
+ wxColour GetHighlightColour() const { return m_highlightColour; }
+ wxColour GetLightShadow() const { return m_lightShadow; }
+ wxColour GetFaceColour() const { return m_faceColour; }
+ wxColour GetMediumShadow() const { return m_mediumShadow; }
+ wxColour GetDarkShadow() const { return m_darkShadow; }
+
+ void SetHighlightColour(const wxColour& c) { m_highlightColour = c; }
+ void SetLightShadow(const wxColour& c) { m_lightShadow = c; }
+ void SetFaceColour(const wxColour& c) { m_faceColour = c; }
+ void SetMediumShadow(const wxColour& c) { m_mediumShadow = c; }
+ void SetDarkShadow(const wxColour& c) { m_darkShadow = c; }
+
+ void Set(const wxColour& highlightColour, const wxColour& lightShadow,
+ const wxColour& faceColour, const wxColour& mediumShadow,
+ const wxColour& darkShadow)
+ {
+ SetHighlightColour(highlightColour);
+ SetLightShadow(lightShadow);
+ SetFaceColour(faceColour);
+ SetMediumShadow(mediumShadow);
+ SetDarkShadow(darkShadow);
+ }
+
+ // Draw a sunken edge
+ void DrawSunkenEdge(wxDC& dc, const wxRect& rect, int borderSize = 1);
+
+ // Tile a bitmap
+ bool TileBitmap(const wxRect& rect, wxDC& dc, const wxBitmap& bitmap);
+
+protected:
+ wxColour m_highlightColour; // Usually white
+ wxColour m_lightShadow; // Usually light grey
+ wxColour m_faceColour; // Usually grey
+ wxColour m_mediumShadow; // Usually dark grey
+ wxColour m_darkShadow; // Usually black
+
+ DECLARE_CLASS(wxEffectsImpl)
+};
+
+// current versions of g++ don't generate deprecation warnings for classes
+// declared deprecated, so define wxEffects as a typedef instead: this does
+// generate warnings with both g++ and VC (which also has no troubles with
+// directly deprecating the classes...)
+//
+// note that this g++ bug (16370) is supposed to be fixed in g++ 4.3.0
+typedef wxEffectsImpl wxDEPRECATED(wxEffects);
+
+#endif // WXWIN_COMPATIBILITY_2_8
+
+#endif // _WX_EFFECTS_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/encconv.h
+// Purpose: wxEncodingConverter class for converting between different
+// font encodings
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_ENCCONV_H_
+#define _WX_ENCCONV_H_
+
+#include "wx/defs.h"
+
+#include "wx/object.h"
+#include "wx/fontenc.h"
+#include "wx/dynarray.h"
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+enum
+{
+ wxCONVERT_STRICT,
+ wxCONVERT_SUBSTITUTE
+};
+
+
+enum
+{
+ wxPLATFORM_CURRENT = -1,
+
+ wxPLATFORM_UNIX = 0,
+ wxPLATFORM_WINDOWS,
+ wxPLATFORM_OS2,
+ wxPLATFORM_MAC
+};
+
+// ----------------------------------------------------------------------------
+// types
+// ----------------------------------------------------------------------------
+
+WX_DEFINE_ARRAY_INT(wxFontEncoding, wxFontEncodingArray);
+
+//--------------------------------------------------------------------------------
+// wxEncodingConverter
+// This class is capable of converting strings between any two
+// 8bit encodings/charsets. It can also convert from/to Unicode
+//--------------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxEncodingConverter : public wxObject
+{
+ public:
+
+ wxEncodingConverter();
+ virtual ~wxEncodingConverter() { if (m_Table) delete[] m_Table; }
+
+ // Initialize conversion. Both output or input encoding may
+ // be wxFONTENCODING_UNICODE.
+ //
+ // All subsequent calls to Convert() will interpret it's argument
+ // as a string in input_enc encoding and will output string in
+ // output_enc encoding.
+ //
+ // You must call this method before calling Convert. You may call
+ // it more than once in order to switch to another conversion
+ //
+ // Method affects behaviour of Convert() in case input character
+ // cannot be converted because it does not exist in output encoding:
+ // wxCONVERT_STRICT --
+ // follow behaviour of GNU Recode - just copy unconvertable
+ // characters to output and don't change them (it's integer
+ // value will stay the same)
+ // wxCONVERT_SUBSTITUTE --
+ // try some (lossy) substitutions - e.g. replace
+ // unconvertable latin capitals with acute by ordinary
+ // capitals, replace en-dash or em-dash by '-' etc.
+ // both modes guarantee that output string will have same length
+ // as input string
+ //
+ // Returns false if given conversion is impossible, true otherwise
+ // (conversion may be impossible either if you try to convert
+ // to Unicode with non-Unicode build of wxWidgets or if input
+ // or output encoding is not supported.)
+ bool Init(wxFontEncoding input_enc, wxFontEncoding output_enc, int method = wxCONVERT_STRICT);
+
+ // Convert input string according to settings passed to Init.
+ // Note that you must call Init before using Convert!
+ bool Convert(const char* input, char* output) const;
+ bool Convert(char* str) const { return Convert(str, str); }
+ wxString Convert(const wxString& input) const;
+
+ bool Convert(const char* input, wchar_t* output) const;
+ bool Convert(const wchar_t* input, char* output) const;
+ bool Convert(const wchar_t* input, wchar_t* output) const;
+ bool Convert(wchar_t* str) const { return Convert(str, str); }
+
+ // Return equivalent(s) for given font that are used
+ // under given platform. wxPLATFORM_CURRENT means the plaform
+ // this binary was compiled for
+ //
+ // Examples:
+ // current platform enc returned value
+ // -----------------------------------------------------
+ // unix CP1250 {ISO8859_2}
+ // unix ISO8859_2 {}
+ // windows ISO8859_2 {CP1250}
+ //
+ // Equivalence is defined in terms of convertibility:
+ // 2 encodings are equivalent if you can convert text between
+ // then without losing information (it may - and will - happen
+ // that you lose special chars like quotation marks or em-dashes
+ // but you shouldn't lose any diacritics and language-specific
+ // characters when converting between equivalent encodings).
+ //
+ // Convert() method is not limited to converting between
+ // equivalent encodings, it can convert between arbitrary
+ // two encodings!
+ //
+ // Remember that this function does _NOT_ check for presence of
+ // fonts in system. It only tells you what are most suitable
+ // encodings. (It usually returns only one encoding)
+ //
+ // Note that argument enc itself may be present in returned array!
+ // (so that you can -- as a side effect -- detect whether the
+ // encoding is native for this platform or not)
+ static wxFontEncodingArray GetPlatformEquivalents(wxFontEncoding enc, int platform = wxPLATFORM_CURRENT);
+
+ // Similar to GetPlatformEquivalent, but this one will return ALL
+ // equivalent encodings, regardless the platform, including itself.
+ static wxFontEncodingArray GetAllEquivalents(wxFontEncoding enc);
+
+ // Return true if [any text in] one multibyte encoding can be
+ // converted to another one losslessly.
+ //
+ // Do not call this with wxFONTENCODING_UNICODE, it doesn't make
+ // sense (always works in one sense and always depends on the text
+ // to convert in the other)
+ static bool CanConvert(wxFontEncoding encIn, wxFontEncoding encOut)
+ {
+ return GetAllEquivalents(encIn).Index(encOut) != wxNOT_FOUND;
+ }
+
+ private:
+ wchar_t *m_Table;
+ bool m_UnicodeInput, m_UnicodeOutput;
+ bool m_JustCopy;
+
+ wxDECLARE_NO_COPY_CLASS(wxEncodingConverter);
+};
+
+#endif // _WX_ENCCONV_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/encinfo.h
+// Purpose: declares wxNativeEncodingInfo struct
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 19.09.2003 (extracted from wx/fontenc.h)
+// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_ENCINFO_H_
+#define _WX_ENCINFO_H_
+
+#include "wx/string.h"
+
+// ----------------------------------------------------------------------------
+// wxNativeEncodingInfo contains all encoding parameters for this platform
+// ----------------------------------------------------------------------------
+
+// This private structure specifies all the parameters needed to create a font
+// with the given encoding on this platform.
+//
+// Under X, it contains the last 2 elements of the font specifications
+// (registry and encoding).
+//
+// Under Windows, it contains a number which is one of predefined CHARSET_XXX
+// values.
+//
+// Under all platforms it also contains a facename string which should be
+// used, if not empty, to create fonts in this encoding (this is the only way
+// to create a font of non-standard encoding (like KOI8) under Windows - the
+// facename specifies the encoding then)
+
+struct WXDLLIMPEXP_CORE wxNativeEncodingInfo
+{
+ wxString facename; // may be empty meaning "any"
+ wxFontEncoding encoding; // so that we know what this struct represents
+
+#if defined(__WXMSW__) || \
+ defined(__WXPM__) || \
+ defined(__WXMAC__) || \
+ defined(__WXCOCOA__) // FIXME: __WXCOCOA__
+
+ wxNativeEncodingInfo()
+ : facename()
+ , encoding(wxFONTENCODING_SYSTEM)
+ , charset(0) /* ANSI_CHARSET */
+ { }
+
+ int charset;
+#elif defined(_WX_X_FONTLIKE)
+ wxString xregistry,
+ xencoding;
+#elif defined(wxHAS_UTF8_FONTS)
+ // ports using UTF-8 for text don't need encoding information for fonts
+#else
+ #error "Unsupported toolkit"
+#endif
+ // this struct is saved in config by wxFontMapper, so it should know to
+ // serialise itself (implemented in platform-specific code)
+ bool FromString(const wxString& s);
+ wxString ToString() const;
+};
+
+#endif // _WX_ENCINFO_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/event.h
+// Purpose: Event classes
+// Author: Julian Smart
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_EVENT_H_
+#define _WX_EVENT_H_
+
+#include "wx/defs.h"
+#include "wx/cpp.h"
+#include "wx/object.h"
+#include "wx/clntdata.h"
+
+#if wxUSE_GUI
+ #include "wx/gdicmn.h"
+ #include "wx/cursor.h"
+ #include "wx/mousestate.h"
+#endif
+
+#include "wx/dynarray.h"
+#include "wx/thread.h"
+#include "wx/tracker.h"
+#include "wx/typeinfo.h"
+#include "wx/any.h"
+
+#ifdef wxHAS_EVENT_BIND
+ #include "wx/meta/convertible.h"
+#endif
+
+// Currently VC6 and VC7 are known to not be able to compile CallAfter() code,
+// so disable it for them.
+#if !defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(8)
+ #include "wx/meta/removeref.h"
+
+ #define wxHAS_CALL_AFTER
+#endif
+
+// ----------------------------------------------------------------------------
+// forward declarations
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_BASE wxList;
+class WXDLLIMPEXP_FWD_BASE wxEvent;
+class WXDLLIMPEXP_FWD_BASE wxEventFilter;
+#if wxUSE_GUI
+ class WXDLLIMPEXP_FWD_CORE wxDC;
+ class WXDLLIMPEXP_FWD_CORE wxMenu;
+ class WXDLLIMPEXP_FWD_CORE wxWindow;
+ class WXDLLIMPEXP_FWD_CORE wxWindowBase;
+#endif // wxUSE_GUI
+
+// We operate with pointer to members of wxEvtHandler (such functions are used
+// as event handlers in the event tables or as arguments to Connect()) but by
+// default MSVC uses a restricted (but more efficient) representation of
+// pointers to members which can't deal with multiple base classes. To avoid
+// mysterious (as the compiler is not good enough to detect this and give a
+// sensible error message) errors in the user code as soon as it defines
+// classes inheriting from both wxEvtHandler (possibly indirectly, e.g. via
+// wxWindow) and something else (including our own wxTrackable but not limited
+// to it), we use the special MSVC keyword telling the compiler to use a more
+// general pointer to member representation for the classes inheriting from
+// wxEvtHandler.
+#ifdef __VISUALC__
+ #define wxMSVC_FWD_MULTIPLE_BASES __multiple_inheritance
+#else
+ #define wxMSVC_FWD_MULTIPLE_BASES
+#endif
+
+class WXDLLIMPEXP_FWD_BASE wxMSVC_FWD_MULTIPLE_BASES wxEvtHandler;
+class wxEventConnectionRef;
+
+// ----------------------------------------------------------------------------
+// Event types
+// ----------------------------------------------------------------------------
+
+typedef int wxEventType;
+
+#define wxEVT_ANY ((wxEventType)-1)
+
+// this is used to make the event table entry type safe, so that for an event
+// handler only a function with proper parameter list can be given. See also
+// the wxEVENT_HANDLER_CAST-macro.
+#define wxStaticCastEvent(type, val) static_cast<type>(val)
+
+#define wxDECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \
+ wxEventTableEntry(type, winid, idLast, wxNewEventTableFunctor(type, fn), obj)
+
+#define wxDECLARE_EVENT_TABLE_TERMINATOR() \
+ wxEventTableEntry(wxEVT_NULL, 0, 0, 0, 0)
+
+// generate a new unique event type
+extern WXDLLIMPEXP_BASE wxEventType wxNewEventType();
+
+// define macros to create new event types:
+#ifdef wxHAS_EVENT_BIND
+ // events are represented by an instance of wxEventTypeTag and the
+ // corresponding type must be specified for type-safety checks
+
+ // define a new custom event type, can be used alone or after event
+ // declaration in the header using one of the macros below
+ #define wxDEFINE_EVENT( name, type ) \
+ const wxEventTypeTag< type > name( wxNewEventType() )
+
+ // the general version allowing exporting the event type from DLL, used by
+ // wxWidgets itself
+ #define wxDECLARE_EXPORTED_EVENT( expdecl, name, type ) \
+ extern const expdecl wxEventTypeTag< type > name
+
+ // this is the version which will normally be used in the user code
+ #define wxDECLARE_EVENT( name, type ) \
+ wxDECLARE_EXPORTED_EVENT( wxEMPTY_PARAMETER_VALUE, name, type )
+
+
+ // these macros are only used internally for backwards compatibility and
+ // allow to define an alias for an existing event type (this is used by
+ // wxEVT_SPIN_XXX)
+ #define wxDEFINE_EVENT_ALIAS( name, type, value ) \
+ const wxEventTypeTag< type > name( value )
+
+ #define wxDECLARE_EXPORTED_EVENT_ALIAS( expdecl, name, type ) \
+ extern const expdecl wxEventTypeTag< type > name
+#else // !wxHAS_EVENT_BIND
+ // the macros are the same ones as above but defined differently as we only
+ // use the integer event type values to identify events in this case
+
+ #define wxDEFINE_EVENT( name, type ) \
+ const wxEventType name( wxNewEventType() )
+
+ #define wxDECLARE_EXPORTED_EVENT( expdecl, name, type ) \
+ extern const expdecl wxEventType name
+ #define wxDECLARE_EVENT( name, type ) \
+ wxDECLARE_EXPORTED_EVENT( wxEMPTY_PARAMETER_VALUE, name, type )
+
+ #define wxDEFINE_EVENT_ALIAS( name, type, value ) \
+ const wxEventType name = value
+ #define wxDECLARE_EXPORTED_EVENT_ALIAS( expdecl, name, type ) \
+ extern const expdecl wxEventType name
+#endif // wxHAS_EVENT_BIND/!wxHAS_EVENT_BIND
+
+// Try to cast the given event handler to the correct handler type:
+
+#define wxEVENT_HANDLER_CAST( functype, func ) \
+ ( wxObjectEventFunction )( wxEventFunction )wxStaticCastEvent( functype, &func )
+
+
+#ifdef wxHAS_EVENT_BIND
+
+// The tag is a type associated to the event type (which is an integer itself,
+// in spite of its name) value. It exists in order to be used as a template
+// parameter and provide a mapping between the event type values and their
+// corresponding wxEvent-derived classes.
+template <typename T>
+class wxEventTypeTag
+{
+public:
+ // The class of wxEvent-derived class carried by the events of this type.
+ typedef T EventClass;
+
+ wxEventTypeTag(wxEventType type) { m_type = type; }
+
+ // Return a wxEventType reference for the initialization of the static
+ // event tables. See wxEventTableEntry::m_eventType for a more thorough
+ // explanation.
+ operator const wxEventType&() const { return m_type; }
+
+private:
+ wxEventType m_type;
+};
+
+#endif // wxHAS_EVENT_BIND
+
+// These are needed for the functor definitions
+typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
+
+// We had some trouble (specifically with eVC for ARM WinCE build) with using
+// wxEventFunction in the past so we had introduced wxObjectEventFunction which
+// used to be a typedef for a member of wxObject and not wxEvtHandler to work
+// around this but as eVC is not really supported any longer we now only keep
+// this for backwards compatibility and, despite its name, this is a typedef
+// for wxEvtHandler member now -- but if we have the same problem with another
+// compiler we can restore its old definition for it.
+typedef wxEventFunction wxObjectEventFunction;
+
+// The event functor which is stored in the static and dynamic event tables:
+class WXDLLIMPEXP_BASE wxEventFunctor
+{
+public:
+ virtual ~wxEventFunctor();
+
+ // Invoke the actual event handler:
+ virtual void operator()(wxEvtHandler *, wxEvent&) = 0;
+
+ // this function tests whether this functor is matched, for the purpose of
+ // finding it in an event table in Unbind(), by the given functor:
+ virtual bool IsMatching(const wxEventFunctor& functor) const = 0;
+
+ // If the functor holds an wxEvtHandler, then get access to it and track
+ // its lifetime with wxEventConnectionRef:
+ virtual wxEvtHandler *GetEvtHandler() const
+ { return NULL; }
+
+ // This is only used to maintain backward compatibility in
+ // wxAppConsoleBase::CallEventHandler and ensures that an overwritten
+ // wxAppConsoleBase::HandleEvent is still called for functors which hold an
+ // wxEventFunction:
+ virtual wxEventFunction GetEvtMethod() const
+ { return NULL; }
+
+private:
+ WX_DECLARE_ABSTRACT_TYPEINFO(wxEventFunctor)
+};
+
+// A plain method functor for the untyped legacy event types:
+class WXDLLIMPEXP_BASE wxObjectEventFunctor : public wxEventFunctor
+{
+public:
+ wxObjectEventFunctor(wxObjectEventFunction method, wxEvtHandler *handler)
+ : m_handler( handler ), m_method( method )
+ { }
+
+ virtual void operator()(wxEvtHandler *handler, wxEvent& event);
+
+ virtual bool IsMatching(const wxEventFunctor& functor) const
+ {
+ if ( wxTypeId(functor) == wxTypeId(*this) )
+ {
+ const wxObjectEventFunctor &other =
+ static_cast< const wxObjectEventFunctor & >( functor );
+
+ // FIXME-VC6: amazing but true: replacing "m_method == 0" here
+ // with "!m_method" makes VC6 crash with an ICE in DLL build (only!)
+ // Also notice that using "NULL" instead of "0" results in warnings
+ // about "using NULL in arithmetics" from arm-linux-androideabi-g++
+ // 4.4.3 used for wxAndroid build.
+
+ return ( m_method == other.m_method || other.m_method == 0 ) &&
+ ( m_handler == other.m_handler || other.m_handler == NULL );
+ }
+ else
+ return false;
+ }
+
+ virtual wxEvtHandler *GetEvtHandler() const
+ { return m_handler; }
+
+ virtual wxEventFunction GetEvtMethod() const
+ { return m_method; }
+
+private:
+ wxEvtHandler *m_handler;
+ wxEventFunction m_method;
+
+ // Provide a dummy default ctor for type info purposes
+ wxObjectEventFunctor() { }
+
+ WX_DECLARE_TYPEINFO_INLINE(wxObjectEventFunctor)
+};
+
+// Create a functor for the legacy events: used by Connect()
+inline wxObjectEventFunctor *
+wxNewEventFunctor(const wxEventType& WXUNUSED(evtType),
+ wxObjectEventFunction method,
+ wxEvtHandler *handler)
+{
+ return new wxObjectEventFunctor(method, handler);
+}
+
+// This version is used by wxDECLARE_EVENT_TABLE_ENTRY()
+inline wxObjectEventFunctor *
+wxNewEventTableFunctor(const wxEventType& WXUNUSED(evtType),
+ wxObjectEventFunction method)
+{
+ return new wxObjectEventFunctor(method, NULL);
+}
+
+inline wxObjectEventFunctor
+wxMakeEventFunctor(const wxEventType& WXUNUSED(evtType),
+ wxObjectEventFunction method,
+ wxEvtHandler *handler)
+{
+ return wxObjectEventFunctor(method, handler);
+}
+
+#ifdef wxHAS_EVENT_BIND
+
+namespace wxPrivate
+{
+
+// helper template defining nested "type" typedef as the event class
+// corresponding to the given event type
+template <typename T> struct EventClassOf;
+
+// the typed events provide the information about the class of the events they
+// carry themselves:
+template <typename T>
+struct EventClassOf< wxEventTypeTag<T> >
+{
+ typedef typename wxEventTypeTag<T>::EventClass type;
+};
+
+// for the old untyped events we don't have information about the exact event
+// class carried by them
+template <>
+struct EventClassOf<wxEventType>
+{
+ typedef wxEvent type;
+};
+
+
+// helper class defining operations different for method functors using an
+// object of wxEvtHandler-derived class as handler and the others
+template <typename T, typename A, bool> struct HandlerImpl;
+
+// specialization for handlers deriving from wxEvtHandler
+template <typename T, typename A>
+struct HandlerImpl<T, A, true>
+{
+ static bool IsEvtHandler()
+ { return true; }
+ static T *ConvertFromEvtHandler(wxEvtHandler *p)
+ { return static_cast<T *>(p); }
+ static wxEvtHandler *ConvertToEvtHandler(T *p)
+ { return p; }
+ static wxEventFunction ConvertToEvtMethod(void (T::*f)(A&))
+ { return static_cast<wxEventFunction>(
+ reinterpret_cast<void (T::*)(wxEvent&)>(f)); }
+};
+
+// specialization for handlers not deriving from wxEvtHandler
+template <typename T, typename A>
+struct HandlerImpl<T, A, false>
+{
+ static bool IsEvtHandler()
+ { return false; }
+ static T *ConvertFromEvtHandler(wxEvtHandler *)
+ { return NULL; }
+ static wxEvtHandler *ConvertToEvtHandler(T *)
+ { return NULL; }
+ static wxEventFunction ConvertToEvtMethod(void (T::*)(A&))
+ { return NULL; }
+};
+
+} // namespace wxPrivate
+
+// functor forwarding the event to a method of the given object
+//
+// notice that the object class may be different from the class in which the
+// method is defined but it must be convertible to this class
+//
+// also, the type of the handler parameter doesn't need to be exactly the same
+// as EventTag::EventClass but it must be its base class -- this is explicitly
+// allowed to handle different events in the same handler taking wxEvent&, for
+// example
+template
+ <typename EventTag, typename Class, typename EventArg, typename EventHandler>
+class wxEventFunctorMethod
+ : public wxEventFunctor,
+ private wxPrivate::HandlerImpl
+ <
+ Class,
+ EventArg,
+ wxConvertibleTo<Class, wxEvtHandler>::value != 0
+ >
+{
+private:
+ static void CheckHandlerArgument(EventArg *) { }
+
+public:
+ // the event class associated with the given event tag
+ typedef typename wxPrivate::EventClassOf<EventTag>::type EventClass;
+
+
+ wxEventFunctorMethod(void (Class::*method)(EventArg&), EventHandler *handler)
+ : m_handler( handler ), m_method( method )
+ {
+ wxASSERT_MSG( handler || this->IsEvtHandler(),
+ "handlers defined in non-wxEvtHandler-derived classes "
+ "must be connected with a valid sink object" );
+
+ // if you get an error here it means that the signature of the handler
+ // you're trying to use is not compatible with (i.e. is not the same as
+ // or a base class of) the real event class used for this event type
+ CheckHandlerArgument(static_cast<EventClass *>(NULL));
+ }
+
+ virtual void operator()(wxEvtHandler *handler, wxEvent& event)
+ {
+ Class * realHandler = m_handler;
+ if ( !realHandler )
+ {
+ realHandler = this->ConvertFromEvtHandler(handler);
+
+ // this is not supposed to happen but check for it nevertheless
+ wxCHECK_RET( realHandler, "invalid event handler" );
+ }
+
+ // the real (run-time) type of event is EventClass and we checked in
+ // the ctor that EventClass can be converted to EventArg, so this cast
+ // is always valid
+ (realHandler->*m_method)(static_cast<EventArg&>(event));
+ }
+
+ virtual bool IsMatching(const wxEventFunctor& functor) const
+ {
+ if ( wxTypeId(functor) != wxTypeId(*this) )
+ return false;
+
+ typedef wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler>
+ ThisFunctor;
+
+ // the cast is valid because wxTypeId()s matched above
+ const ThisFunctor& other = static_cast<const ThisFunctor &>(functor);
+
+ return (m_method == other.m_method || other.m_method == NULL) &&
+ (m_handler == other.m_handler || other.m_handler == NULL);
+ }
+
+ virtual wxEvtHandler *GetEvtHandler() const
+ { return this->ConvertToEvtHandler(m_handler); }
+
+ virtual wxEventFunction GetEvtMethod() const
+ { return this->ConvertToEvtMethod(m_method); }
+
+private:
+ EventHandler *m_handler;
+ void (Class::*m_method)(EventArg&);
+
+ // Provide a dummy default ctor for type info purposes
+ wxEventFunctorMethod() { }
+
+ typedef wxEventFunctorMethod<EventTag, Class,
+ EventArg, EventHandler> thisClass;
+ WX_DECLARE_TYPEINFO_INLINE(thisClass)
+};
+
+
+// functor forwarding the event to function (function, static method)
+template <typename EventTag, typename EventArg>
+class wxEventFunctorFunction : public wxEventFunctor
+{
+private:
+ static void CheckHandlerArgument(EventArg *) { }
+
+public:
+ // the event class associated with the given event tag
+ typedef typename wxPrivate::EventClassOf<EventTag>::type EventClass;
+
+ wxEventFunctorFunction( void ( *handler )( EventArg & ))
+ : m_handler( handler )
+ {
+ // if you get an error here it means that the signature of the handler
+ // you're trying to use is not compatible with (i.e. is not the same as
+ // or a base class of) the real event class used for this event type
+ CheckHandlerArgument(static_cast<EventClass *>(NULL));
+ }
+
+ virtual void operator()(wxEvtHandler *WXUNUSED(handler), wxEvent& event)
+ {
+ // If you get an error here like "must use .* or ->* to call
+ // pointer-to-member function" then you probably tried to call
+ // Bind/Unbind with a method pointer but without a handler pointer or
+ // NULL as a handler e.g.:
+ // Unbind( wxEVT_XXX, &EventHandler::method );
+ // or
+ // Unbind( wxEVT_XXX, &EventHandler::method, NULL )
+ m_handler(static_cast<EventArg&>(event));
+ }
+
+ virtual bool IsMatching(const wxEventFunctor &functor) const
+ {
+ if ( wxTypeId(functor) != wxTypeId(*this) )
+ return false;
+
+ typedef wxEventFunctorFunction<EventTag, EventArg> ThisFunctor;
+
+ const ThisFunctor& other = static_cast<const ThisFunctor&>( functor );
+
+ return m_handler == other.m_handler;
+ }
+
+private:
+ void (*m_handler)(EventArg&);
+
+ // Provide a dummy default ctor for type info purposes
+ wxEventFunctorFunction() { }
+
+ typedef wxEventFunctorFunction<EventTag, EventArg> thisClass;
+ WX_DECLARE_TYPEINFO_INLINE(thisClass)
+};
+
+
+template <typename EventTag, typename Functor>
+class wxEventFunctorFunctor : public wxEventFunctor
+{
+public:
+ typedef typename EventTag::EventClass EventArg;
+
+ wxEventFunctorFunctor(const Functor& handler)
+ : m_handler(handler), m_handlerAddr(&handler)
+ { }
+
+ virtual void operator()(wxEvtHandler *WXUNUSED(handler), wxEvent& event)
+ {
+ // If you get an error here like "must use '.*' or '->*' to call
+ // pointer-to-member function" then you probably tried to call
+ // Bind/Unbind with a method pointer but without a handler pointer or
+ // NULL as a handler e.g.:
+ // Unbind( wxEVT_XXX, &EventHandler::method );
+ // or
+ // Unbind( wxEVT_XXX, &EventHandler::method, NULL )
+ m_handler(static_cast<EventArg&>(event));
+ }
+
+ virtual bool IsMatching(const wxEventFunctor &functor) const
+ {
+ if ( wxTypeId(functor) != wxTypeId(*this) )
+ return false;
+
+ typedef wxEventFunctorFunctor<EventTag, Functor> FunctorThis;
+
+ const FunctorThis& other = static_cast<const FunctorThis&>(functor);
+
+ // The only reliable/portable way to compare two functors is by
+ // identity:
+ return m_handlerAddr == other.m_handlerAddr;
+ }
+
+private:
+ // Store a copy of the functor to prevent using/calling an already
+ // destroyed instance:
+ Functor m_handler;
+
+ // Use the address of the original functor for comparison in IsMatching:
+ const void *m_handlerAddr;
+
+ // Provide a dummy default ctor for type info purposes
+ wxEventFunctorFunctor() { }
+
+ typedef wxEventFunctorFunctor<EventTag, Functor> thisClass;
+ WX_DECLARE_TYPEINFO_INLINE(thisClass)
+};
+
+// Create functors for the templatized events, either allocated on the heap for
+// wxNewXXX() variants (this is needed in wxEvtHandler::Bind<>() to store them
+// in dynamic event table) or just by returning them as temporary objects (this
+// is enough for Unbind<>() and we avoid unnecessary heap allocation like this).
+
+
+// Create functors wrapping functions:
+template <typename EventTag, typename EventArg>
+inline wxEventFunctorFunction<EventTag, EventArg> *
+wxNewEventFunctor(const EventTag&, void (*func)(EventArg &))
+{
+ return new wxEventFunctorFunction<EventTag, EventArg>(func);
+}
+
+template <typename EventTag, typename EventArg>
+inline wxEventFunctorFunction<EventTag, EventArg>
+wxMakeEventFunctor(const EventTag&, void (*func)(EventArg &))
+{
+ return wxEventFunctorFunction<EventTag, EventArg>(func);
+}
+
+// Create functors wrapping other functors:
+template <typename EventTag, typename Functor>
+inline wxEventFunctorFunctor<EventTag, Functor> *
+wxNewEventFunctor(const EventTag&, const Functor &func)
+{
+ return new wxEventFunctorFunctor<EventTag, Functor>(func);
+}
+
+template <typename EventTag, typename Functor>
+inline wxEventFunctorFunctor<EventTag, Functor>
+wxMakeEventFunctor(const EventTag&, const Functor &func)
+{
+ return wxEventFunctorFunctor<EventTag, Functor>(func);
+}
+
+// Create functors wrapping methods:
+template
+ <typename EventTag, typename Class, typename EventArg, typename EventHandler>
+inline wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler> *
+wxNewEventFunctor(const EventTag&,
+ void (Class::*method)(EventArg&),
+ EventHandler *handler)
+{
+ return new wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler>(
+ method, handler);
+}
+
+template
+ <typename EventTag, typename Class, typename EventArg, typename EventHandler>
+inline wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler>
+wxMakeEventFunctor(const EventTag&,
+ void (Class::*method)(EventArg&),
+ EventHandler *handler)
+{
+ return wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler>(
+ method, handler);
+}
+
+// Create an event functor for the event table via wxDECLARE_EVENT_TABLE_ENTRY:
+// in this case we don't have the handler (as it's always the same as the
+// object which generated the event) so we must use Class as its type
+template <typename EventTag, typename Class, typename EventArg>
+inline wxEventFunctorMethod<EventTag, Class, EventArg, Class> *
+wxNewEventTableFunctor(const EventTag&, void (Class::*method)(EventArg&))
+{
+ return new wxEventFunctorMethod<EventTag, Class, EventArg, Class>(
+ method, NULL);
+}
+
+#endif // wxHAS_EVENT_BIND
+
+
+// many, but not all, standard event types
+
+ // some generic events
+extern WXDLLIMPEXP_BASE const wxEventType wxEVT_NULL;
+extern WXDLLIMPEXP_BASE const wxEventType wxEVT_FIRST;
+extern WXDLLIMPEXP_BASE const wxEventType wxEVT_USER_FIRST;
+
+ // Need events declared to do this
+class WXDLLIMPEXP_FWD_BASE wxIdleEvent;
+class WXDLLIMPEXP_FWD_BASE wxThreadEvent;
+class WXDLLIMPEXP_FWD_BASE wxAsyncMethodCallEvent;
+class WXDLLIMPEXP_FWD_CORE wxCommandEvent;
+class WXDLLIMPEXP_FWD_CORE wxMouseEvent;
+class WXDLLIMPEXP_FWD_CORE wxFocusEvent;
+class WXDLLIMPEXP_FWD_CORE wxChildFocusEvent;
+class WXDLLIMPEXP_FWD_CORE wxKeyEvent;
+class WXDLLIMPEXP_FWD_CORE wxNavigationKeyEvent;
+class WXDLLIMPEXP_FWD_CORE wxSetCursorEvent;
+class WXDLLIMPEXP_FWD_CORE wxScrollEvent;
+class WXDLLIMPEXP_FWD_CORE wxSpinEvent;
+class WXDLLIMPEXP_FWD_CORE wxScrollWinEvent;
+class WXDLLIMPEXP_FWD_CORE wxSizeEvent;
+class WXDLLIMPEXP_FWD_CORE wxMoveEvent;
+class WXDLLIMPEXP_FWD_CORE wxCloseEvent;
+class WXDLLIMPEXP_FWD_CORE wxActivateEvent;
+class WXDLLIMPEXP_FWD_CORE wxWindowCreateEvent;
+class WXDLLIMPEXP_FWD_CORE wxWindowDestroyEvent;
+class WXDLLIMPEXP_FWD_CORE wxShowEvent;
+class WXDLLIMPEXP_FWD_CORE wxIconizeEvent;
+class WXDLLIMPEXP_FWD_CORE wxMaximizeEvent;
+class WXDLLIMPEXP_FWD_CORE wxMouseCaptureChangedEvent;
+class WXDLLIMPEXP_FWD_CORE wxMouseCaptureLostEvent;
+class WXDLLIMPEXP_FWD_CORE wxPaintEvent;
+class WXDLLIMPEXP_FWD_CORE wxEraseEvent;
+class WXDLLIMPEXP_FWD_CORE wxNcPaintEvent;
+class WXDLLIMPEXP_FWD_CORE wxMenuEvent;
+class WXDLLIMPEXP_FWD_CORE wxContextMenuEvent;
+class WXDLLIMPEXP_FWD_CORE wxSysColourChangedEvent;
+class WXDLLIMPEXP_FWD_CORE wxDisplayChangedEvent;
+class WXDLLIMPEXP_FWD_CORE wxQueryNewPaletteEvent;
+class WXDLLIMPEXP_FWD_CORE wxPaletteChangedEvent;
+class WXDLLIMPEXP_FWD_CORE wxJoystickEvent;
+class WXDLLIMPEXP_FWD_CORE wxDropFilesEvent;
+class WXDLLIMPEXP_FWD_CORE wxInitDialogEvent;
+class WXDLLIMPEXP_FWD_CORE wxUpdateUIEvent;
+class WXDLLIMPEXP_FWD_CORE wxClipboardTextEvent;
+class WXDLLIMPEXP_FWD_CORE wxHelpEvent;
+
+
+ // Command events
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_BUTTON, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHECKBOX, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHOICE, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LISTBOX, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LISTBOX_DCLICK, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHECKLISTBOX, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SLIDER, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RADIOBOX, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RADIOBUTTON, wxCommandEvent);
+
+// wxEVT_SCROLLBAR is deprecated, use wxEVT_SCROLL... events
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLBAR, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_VLBOX, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMBOBOX, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TOOL_RCLICKED, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TOOL_DROPDOWN, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TOOL_ENTER, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMBOBOX_DROPDOWN, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMBOBOX_CLOSEUP, wxCommandEvent);
+
+ // Thread and asynchronous method call events
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_THREAD, wxThreadEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_ASYNC_METHOD_CALL, wxAsyncMethodCallEvent);
+
+ // Mouse event types
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_DOWN, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_UP, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_DOWN, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_UP, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_DOWN, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_UP, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOTION, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ENTER_WINDOW, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEAVE_WINDOW, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_DCLICK, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_DCLICK, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_DCLICK, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SET_FOCUS, wxFocusEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KILL_FOCUS, wxFocusEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHILD_FOCUS, wxChildFocusEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSEWHEEL, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_DOWN, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_UP, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_DCLICK, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DOWN, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_UP, wxMouseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DCLICK, wxMouseEvent);
+
+ // Character input event type
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHAR, wxKeyEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHAR_HOOK, wxKeyEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_NAVIGATION_KEY, wxNavigationKeyEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KEY_DOWN, wxKeyEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KEY_UP, wxKeyEvent);
+#if wxUSE_HOTKEY
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HOTKEY, wxKeyEvent);
+#endif
+// This is a private event used by wxMSW code only and subject to change or
+// disappear in the future. Don't use.
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AFTER_CHAR, wxKeyEvent);
+
+ // Set cursor event
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SET_CURSOR, wxSetCursorEvent);
+
+ // wxScrollBar and wxSlider event identifiers
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_TOP, wxScrollEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_BOTTOM, wxScrollEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_LINEUP, wxScrollEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_LINEDOWN, wxScrollEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_PAGEUP, wxScrollEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_PAGEDOWN, wxScrollEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_THUMBTRACK, wxScrollEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_THUMBRELEASE, wxScrollEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_CHANGED, wxScrollEvent);
+
+// Due to a bug in older wx versions, wxSpinEvents were being sent with type of
+// wxEVT_SCROLL_LINEUP, wxEVT_SCROLL_LINEDOWN and wxEVT_SCROLL_THUMBTRACK. But
+// with the type-safe events in place, these event types are associated with
+// wxScrollEvent. To allow handling of spin events, new event types have been
+// defined in spinbutt.h/spinnbuttcmn.cpp. To maintain backward compatibility
+// the spin event types are being initialized with the scroll event types.
+
+#if wxUSE_SPINBTN
+
+wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN_UP, wxSpinEvent );
+wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN_DOWN, wxSpinEvent );
+wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN, wxSpinEvent );
+
+#endif
+
+ // Scroll events from wxWindow
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_TOP, wxScrollWinEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_BOTTOM, wxScrollWinEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_LINEUP, wxScrollWinEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_LINEDOWN, wxScrollWinEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_PAGEUP, wxScrollWinEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_PAGEDOWN, wxScrollWinEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEvent);
+
+ // System events
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SIZE, wxSizeEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE, wxMoveEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CLOSE_WINDOW, wxCloseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_END_SESSION, wxCloseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_QUERY_END_SESSION, wxCloseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ACTIVATE_APP, wxActivateEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ACTIVATE, wxActivateEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CREATE, wxWindowCreateEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DESTROY, wxWindowDestroyEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SHOW, wxShowEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ICONIZE, wxIconizeEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MAXIMIZE, wxMaximizeEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSE_CAPTURE_CHANGED, wxMouseCaptureChangedEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_PAINT, wxPaintEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ERASE_BACKGROUND, wxEraseEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_NC_PAINT, wxNcPaintEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_OPEN, wxMenuEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_CLOSE, wxMenuEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_HIGHLIGHT, wxMenuEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CONTEXT_MENU, wxContextMenuEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SYS_COLOUR_CHANGED, wxSysColourChangedEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DISPLAY_CHANGED, wxDisplayChangedEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_QUERY_NEW_PALETTE, wxQueryNewPaletteEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_PALETTE_CHANGED, wxPaletteChangedEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_BUTTON_DOWN, wxJoystickEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_BUTTON_UP, wxJoystickEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_MOVE, wxJoystickEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_ZMOVE, wxJoystickEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DROP_FILES, wxDropFilesEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_INIT_DIALOG, wxInitDialogEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_IDLE, wxIdleEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_UPDATE_UI, wxUpdateUIEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SIZING, wxSizeEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVING, wxMoveEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE_START, wxMoveEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE_END, wxMoveEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HIBERNATE, wxActivateEvent);
+
+ // Clipboard events
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_COPY, wxClipboardTextEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_CUT, wxClipboardTextEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_PASTE, wxClipboardTextEvent);
+
+ // Generic command events
+ // Note: a click is a higher-level event than button down/up
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LEFT_CLICK, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LEFT_DCLICK, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RIGHT_CLICK, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RIGHT_DCLICK, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SET_FOCUS, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_KILL_FOCUS, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_ENTER, wxCommandEvent);
+
+ // Help events
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HELP, wxHelpEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DETAILED_HELP, wxHelpEvent);
+
+// these 2 events are the same
+#define wxEVT_TOOL wxEVT_MENU
+
+// ----------------------------------------------------------------------------
+// Compatibility
+// ----------------------------------------------------------------------------
+
+// this event is also used by wxComboBox and wxSpinCtrl which don't include
+// wx/textctrl.h in all ports [yet], so declare it here as well
+//
+// still, any new code using it should include wx/textctrl.h explicitly
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT, wxCommandEvent);
+
+
+// ----------------------------------------------------------------------------
+// wxEvent(-derived) classes
+// ----------------------------------------------------------------------------
+
+// the predefined constants for the number of times we propagate event
+// upwards window child-parent chain
+enum wxEventPropagation
+{
+ // don't propagate it at all
+ wxEVENT_PROPAGATE_NONE = 0,
+
+ // propagate it until it is processed
+ wxEVENT_PROPAGATE_MAX = INT_MAX
+};
+
+// The different categories for a wxEvent; see wxEvent::GetEventCategory.
+// NOTE: they are used as OR-combinable flags by wxEventLoopBase::YieldFor
+enum wxEventCategory
+{
+ // this is the category for those events which are generated to update
+ // the appearance of the GUI but which (usually) do not comport data
+ // processing, i.e. which do not provide input or output data
+ // (e.g. size events, scroll events, etc).
+ // They are events NOT directly generated by the user's input devices.
+ wxEVT_CATEGORY_UI = 1,
+
+ // this category groups those events which are generated directly from the
+ // user through input devices like mouse and keyboard and usually result in
+ // data to be processed from the application.
+ // (e.g. mouse clicks, key presses, etc)
+ wxEVT_CATEGORY_USER_INPUT = 2,
+
+ // this category is for wxSocketEvent
+ wxEVT_CATEGORY_SOCKET = 4,
+
+ // this category is for wxTimerEvent
+ wxEVT_CATEGORY_TIMER = 8,
+
+ // this category is for any event used to send notifications from the
+ // secondary threads to the main one or in general for notifications among
+ // different threads (which may or may not be user-generated)
+ wxEVT_CATEGORY_THREAD = 16,
+
+
+ // implementation only
+
+ // used in the implementations of wxEventLoopBase::YieldFor
+ wxEVT_CATEGORY_UNKNOWN = 32,
+
+ // a special category used as an argument to wxEventLoopBase::YieldFor to indicate that
+ // Yield() should leave all wxEvents on the queue while emptying the native event queue
+ // (native events will be processed but the wxEvents they generate will be queued)
+ wxEVT_CATEGORY_CLIPBOARD = 64,
+
+
+ // shortcut masks
+
+ // this category groups those events which are emitted in response to
+ // events of the native toolkit and which typically are not-"delayable".
+ wxEVT_CATEGORY_NATIVE_EVENTS = wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT,
+
+ // used in wxEventLoopBase::YieldFor to specify all event categories should be processed:
+ wxEVT_CATEGORY_ALL =
+ wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT|wxEVT_CATEGORY_SOCKET| \
+ wxEVT_CATEGORY_TIMER|wxEVT_CATEGORY_THREAD|wxEVT_CATEGORY_UNKNOWN| \
+ wxEVT_CATEGORY_CLIPBOARD
+};
+
+/*
+ * wxWidgets events, covering all interesting things that might happen
+ * (button clicking, resizing, setting text in widgets, etc.).
+ *
+ * For each completely new event type, derive a new event class.
+ * An event CLASS represents a C++ class defining a range of similar event TYPES;
+ * examples are canvas events, panel item command events.
+ * An event TYPE is a unique identifier for a particular system event,
+ * such as a button press or a listbox deselection.
+ *
+ */
+
+class WXDLLIMPEXP_BASE wxEvent : public wxObject
+{
+public:
+ wxEvent(int winid = 0, wxEventType commandType = wxEVT_NULL );
+
+ void SetEventType(wxEventType typ) { m_eventType = typ; }
+ wxEventType GetEventType() const { return m_eventType; }
+
+ wxObject *GetEventObject() const { return m_eventObject; }
+ void SetEventObject(wxObject *obj) { m_eventObject = obj; }
+
+ long GetTimestamp() const { return m_timeStamp; }
+ void SetTimestamp(long ts = 0) { m_timeStamp = ts; }
+
+ int GetId() const { return m_id; }
+ void SetId(int Id) { m_id = Id; }
+
+ // Returns the user data optionally associated with the event handler when
+ // using Connect() or Bind().
+ wxObject *GetEventUserData() const { return m_callbackUserData; }
+
+ // Can instruct event processor that we wish to ignore this event
+ // (treat as if the event table entry had not been found): this must be done
+ // to allow the event processing by the base classes (calling event.Skip()
+ // is the analog of calling the base class version of a virtual function)
+ void Skip(bool skip = true) { m_skipped = skip; }
+ bool GetSkipped() const { return m_skipped; }
+
+ // This function is used to create a copy of the event polymorphically and
+ // all derived classes must implement it because otherwise wxPostEvent()
+ // for them wouldn't work (it needs to do a copy of the event)
+ virtual wxEvent *Clone() const = 0;
+
+ // this function is used to selectively process events in wxEventLoopBase::YieldFor
+ // NOTE: by default it returns wxEVT_CATEGORY_UI just because the major
+ // part of wxWidgets events belong to that category.
+ virtual wxEventCategory GetEventCategory() const
+ { return wxEVT_CATEGORY_UI; }
+
+ // Implementation only: this test is explicitly anti OO and this function
+ // exists only for optimization purposes.
+ bool IsCommandEvent() const { return m_isCommandEvent; }
+
+ // Determine if this event should be propagating to the parent window.
+ bool ShouldPropagate() const
+ { return m_propagationLevel != wxEVENT_PROPAGATE_NONE; }
+
+ // Stop an event from propagating to its parent window, returns the old
+ // propagation level value
+ int StopPropagation()
+ {
+ int propagationLevel = m_propagationLevel;
+ m_propagationLevel = wxEVENT_PROPAGATE_NONE;
+ return propagationLevel;
+ }
+
+ // Resume the event propagation by restoring the propagation level
+ // (returned by StopPropagation())
+ void ResumePropagation(int propagationLevel)
+ {
+ m_propagationLevel = propagationLevel;
+ }
+
+ // This method is for internal use only and allows to get the object that
+ // is propagating this event upwards the window hierarchy, if any.
+ wxEvtHandler* GetPropagatedFrom() const { return m_propagatedFrom; }
+
+ // This is for internal use only and is only called by
+ // wxEvtHandler::ProcessEvent() to check whether it's the first time this
+ // event is being processed
+ bool WasProcessed()
+ {
+ if ( m_wasProcessed )
+ return true;
+
+ m_wasProcessed = true;
+
+ return false;
+ }
+
+ // This is for internal use only and is used for setting, testing and
+ // resetting of m_willBeProcessedAgain flag.
+ void SetWillBeProcessedAgain()
+ {
+ m_willBeProcessedAgain = true;
+ }
+
+ bool WillBeProcessedAgain()
+ {
+ if ( m_willBeProcessedAgain )
+ {
+ m_willBeProcessedAgain = false;
+ return true;
+ }
+
+ return false;
+ }
+
+ // This is also used only internally by ProcessEvent() to check if it
+ // should process the event normally or only restrict the search for the
+ // event handler to this object itself.
+ bool ShouldProcessOnlyIn(wxEvtHandler *h) const
+ {
+ return h == m_handlerToProcessOnlyIn;
+ }
+
+ // Called to indicate that the result of ShouldProcessOnlyIn() wasn't taken
+ // into account. The existence of this function may seem counterintuitive
+ // but unfortunately it's needed by wxScrollHelperEvtHandler, see comments
+ // there. Don't even think of using this in your own code, this is a gross
+ // hack and is only needed because of wx complicated history and should
+ // never be used anywhere else.
+ void DidntHonourProcessOnlyIn()
+ {
+ m_handlerToProcessOnlyIn = NULL;
+ }
+
+protected:
+ wxObject* m_eventObject;
+ wxEventType m_eventType;
+ long m_timeStamp;
+ int m_id;
+
+public:
+ // m_callbackUserData is for internal usage only
+ wxObject* m_callbackUserData;
+
+private:
+ // If this handler
+ wxEvtHandler *m_handlerToProcessOnlyIn;
+
+protected:
+ // the propagation level: while it is positive, we propagate the event to
+ // the parent window (if any)
+ int m_propagationLevel;
+
+ // The object that the event is being propagated from, initially NULL and
+ // only set by wxPropagateOnce.
+ wxEvtHandler* m_propagatedFrom;
+
+ bool m_skipped;
+ bool m_isCommandEvent;
+
+ // initially false but becomes true as soon as WasProcessed() is called for
+ // the first time, as this is done only by ProcessEvent() it explains the
+ // variable name: it becomes true after ProcessEvent() was called at least
+ // once for this event
+ bool m_wasProcessed;
+
+ // This one is initially false too, but can be set to true to indicate that
+ // the event will be passed to another handler if it's not processed in
+ // this one.
+ bool m_willBeProcessedAgain;
+
+protected:
+ wxEvent(const wxEvent&); // for implementing Clone()
+ wxEvent& operator=(const wxEvent&); // for derived classes operator=()
+
+private:
+ // It needs to access our m_propagationLevel and m_propagatedFrom fields.
+ friend class WXDLLIMPEXP_FWD_BASE wxPropagateOnce;
+
+ // and this one needs to access our m_handlerToProcessOnlyIn
+ friend class WXDLLIMPEXP_FWD_BASE wxEventProcessInHandlerOnly;
+
+
+ DECLARE_ABSTRACT_CLASS(wxEvent)
+};
+
+/*
+ * Helper class to temporarily change an event not to propagate.
+ */
+class WXDLLIMPEXP_BASE wxPropagationDisabler
+{
+public:
+ wxPropagationDisabler(wxEvent& event) : m_event(event)
+ {
+ m_propagationLevelOld = m_event.StopPropagation();
+ }
+
+ ~wxPropagationDisabler()
+ {
+ m_event.ResumePropagation(m_propagationLevelOld);
+ }
+
+private:
+ wxEvent& m_event;
+ int m_propagationLevelOld;
+
+ wxDECLARE_NO_COPY_CLASS(wxPropagationDisabler);
+};
+
+/*
+ * Helper used to indicate that an event is propagated upwards the window
+ * hierarchy by the given window.
+ */
+class WXDLLIMPEXP_BASE wxPropagateOnce
+{
+public:
+ // The handler argument should normally be non-NULL to allow the parent
+ // event handler to know that it's being used to process an event coming
+ // from the child, it's only NULL by default for backwards compatibility.
+ wxPropagateOnce(wxEvent& event, wxEvtHandler* handler = NULL)
+ : m_event(event),
+ m_propagatedFromOld(event.m_propagatedFrom)
+ {
+ wxASSERT_MSG( m_event.m_propagationLevel > 0,
+ wxT("shouldn't be used unless ShouldPropagate()!") );
+
+ m_event.m_propagationLevel--;
+ m_event.m_propagatedFrom = handler;
+ }
+
+ ~wxPropagateOnce()
+ {
+ m_event.m_propagatedFrom = m_propagatedFromOld;
+ m_event.m_propagationLevel++;
+ }
+
+private:
+ wxEvent& m_event;
+ wxEvtHandler* const m_propagatedFromOld;
+
+ wxDECLARE_NO_COPY_CLASS(wxPropagateOnce);
+};
+
+// A helper object used to temporarily make wxEvent::ShouldProcessOnlyIn()
+// return true for the handler passed to its ctor.
+class wxEventProcessInHandlerOnly
+{
+public:
+ wxEventProcessInHandlerOnly(wxEvent& event, wxEvtHandler *handler)
+ : m_event(event),
+ m_handlerToProcessOnlyInOld(event.m_handlerToProcessOnlyIn)
+ {
+ m_event.m_handlerToProcessOnlyIn = handler;
+ }
+
+ ~wxEventProcessInHandlerOnly()
+ {
+ m_event.m_handlerToProcessOnlyIn = m_handlerToProcessOnlyInOld;
+ }
+
+private:
+ wxEvent& m_event;
+ wxEvtHandler * const m_handlerToProcessOnlyInOld;
+
+ wxDECLARE_NO_COPY_CLASS(wxEventProcessInHandlerOnly);
+};
+
+
+class WXDLLIMPEXP_BASE wxEventBasicPayloadMixin
+{
+public:
+ wxEventBasicPayloadMixin()
+ : m_commandInt(0),
+ m_extraLong(0)
+ {
+ }
+
+ void SetString(const wxString& s) { m_cmdString = s; }
+ const wxString& GetString() const { return m_cmdString; }
+
+ void SetInt(int i) { m_commandInt = i; }
+ int GetInt() const { return m_commandInt; }
+
+ void SetExtraLong(long extraLong) { m_extraLong = extraLong; }
+ long GetExtraLong() const { return m_extraLong; }
+
+protected:
+ // Note: these variables have "cmd" or "command" in their name for backward compatibility:
+ // they used to be part of wxCommandEvent, not this mixin.
+ wxString m_cmdString; // String event argument
+ int m_commandInt;
+ long m_extraLong; // Additional information (e.g. select/deselect)
+
+ wxDECLARE_NO_ASSIGN_CLASS(wxEventBasicPayloadMixin);
+};
+
+class WXDLLIMPEXP_BASE wxEventAnyPayloadMixin : public wxEventBasicPayloadMixin
+{
+public:
+ wxEventAnyPayloadMixin() : wxEventBasicPayloadMixin() {}
+
+#if wxUSE_ANY && (!defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7))
+ template<typename T>
+ void SetPayload(const T& payload)
+ {
+ m_payload = payload;
+ }
+
+ template<typename T>
+ T GetPayload() const
+ {
+ return m_payload.As<T>();
+ }
+
+protected:
+ wxAny m_payload;
+#endif // wxUSE_ANY && (!defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7))
+
+ wxDECLARE_NO_ASSIGN_CLASS(wxEventBasicPayloadMixin);
+};
+
+
+// Idle event
+/*
+ wxEVT_IDLE
+ */
+
+// Whether to always send idle events to windows, or
+// to only send update events to those with the
+// wxWS_EX_PROCESS_IDLE style.
+
+enum wxIdleMode
+{
+ // Send idle events to all windows
+ wxIDLE_PROCESS_ALL,
+
+ // Send idle events to windows that have
+ // the wxWS_EX_PROCESS_IDLE flag specified
+ wxIDLE_PROCESS_SPECIFIED
+};
+
+class WXDLLIMPEXP_BASE wxIdleEvent : public wxEvent
+{
+public:
+ wxIdleEvent()
+ : wxEvent(0, wxEVT_IDLE),
+ m_requestMore(false)
+ { }
+ wxIdleEvent(const wxIdleEvent& event)
+ : wxEvent(event),
+ m_requestMore(event.m_requestMore)
+ { }
+
+ void RequestMore(bool needMore = true) { m_requestMore = needMore; }
+ bool MoreRequested() const { return m_requestMore; }
+
+ virtual wxEvent *Clone() const { return new wxIdleEvent(*this); }
+
+ // Specify how wxWidgets will send idle events: to
+ // all windows, or only to those which specify that they
+ // will process the events.
+ static void SetMode(wxIdleMode mode) { sm_idleMode = mode; }
+
+ // Returns the idle event mode
+ static wxIdleMode GetMode() { return sm_idleMode; }
+
+protected:
+ bool m_requestMore;
+ static wxIdleMode sm_idleMode;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIdleEvent)
+};
+
+
+// Thread event
+
+class WXDLLIMPEXP_BASE wxThreadEvent : public wxEvent,
+ public wxEventAnyPayloadMixin
+{
+public:
+ wxThreadEvent(wxEventType eventType = wxEVT_THREAD, int id = wxID_ANY)
+ : wxEvent(id, eventType)
+ { }
+
+ wxThreadEvent(const wxThreadEvent& event)
+ : wxEvent(event),
+ wxEventAnyPayloadMixin(event)
+ {
+ // make sure our string member (which uses COW, aka refcounting) is not
+ // shared by other wxString instances:
+ SetString(GetString().Clone());
+ }
+
+ virtual wxEvent *Clone() const
+ {
+ return new wxThreadEvent(*this);
+ }
+
+ // this is important to avoid that calling wxEventLoopBase::YieldFor thread events
+ // gets processed when this is unwanted:
+ virtual wxEventCategory GetEventCategory() const
+ { return wxEVT_CATEGORY_THREAD; }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxThreadEvent)
+};
+
+
+// Asynchronous method call events: these event are processed by wxEvtHandler
+// itself and result in a call to its Execute() method which simply calls the
+// specified method. The difference with a simple method call is that this is
+// done asynchronously, i.e. at some later time, instead of immediately when
+// the event object is constructed.
+
+#ifdef wxHAS_CALL_AFTER
+
+// This is a base class used to process all method calls.
+class wxAsyncMethodCallEvent : public wxEvent
+{
+public:
+ wxAsyncMethodCallEvent(wxObject* object)
+ : wxEvent(wxID_ANY, wxEVT_ASYNC_METHOD_CALL)
+ {
+ SetEventObject(object);
+ }
+
+ wxAsyncMethodCallEvent(const wxAsyncMethodCallEvent& other)
+ : wxEvent(other)
+ {
+ }
+
+ virtual void Execute() = 0;
+};
+
+// This is a version for calling methods without parameters.
+template <typename T>
+class wxAsyncMethodCallEvent0 : public wxAsyncMethodCallEvent
+{
+public:
+ typedef T ObjectType;
+ typedef void (ObjectType::*MethodType)();
+
+ wxAsyncMethodCallEvent0(ObjectType* object,
+ MethodType method)
+ : wxAsyncMethodCallEvent(object),
+ m_object(object),
+ m_method(method)
+ {
+ }
+
+ wxAsyncMethodCallEvent0(const wxAsyncMethodCallEvent0& other)
+ : wxAsyncMethodCallEvent(other),
+ m_object(other.m_object),
+ m_method(other.m_method)
+ {
+ }
+
+ virtual wxEvent *Clone() const
+ {
+ return new wxAsyncMethodCallEvent0(*this);
+ }
+
+ virtual void Execute()
+ {
+ (m_object->*m_method)();
+ }
+
+private:
+ ObjectType* const m_object;
+ const MethodType m_method;
+};
+
+// This is a version for calling methods with a single parameter.
+template <typename T, typename T1>
+class wxAsyncMethodCallEvent1 : public wxAsyncMethodCallEvent
+{
+public:
+ typedef T ObjectType;
+ typedef void (ObjectType::*MethodType)(T1 x1);
+ typedef typename wxRemoveRef<T1>::type ParamType1;
+
+ wxAsyncMethodCallEvent1(ObjectType* object,
+ MethodType method,
+ const ParamType1& x1)
+ : wxAsyncMethodCallEvent(object),
+ m_object(object),
+ m_method(method),
+ m_param1(x1)
+ {
+ }
+
+ wxAsyncMethodCallEvent1(const wxAsyncMethodCallEvent1& other)
+ : wxAsyncMethodCallEvent(other),
+ m_object(other.m_object),
+ m_method(other.m_method),
+ m_param1(other.m_param1)
+ {
+ }
+
+ virtual wxEvent *Clone() const
+ {
+ return new wxAsyncMethodCallEvent1(*this);
+ }
+
+ virtual void Execute()
+ {
+ (m_object->*m_method)(m_param1);
+ }
+
+private:
+ ObjectType* const m_object;
+ const MethodType m_method;
+ const ParamType1 m_param1;
+};
+
+// This is a version for calling methods with two parameters.
+template <typename T, typename T1, typename T2>
+class wxAsyncMethodCallEvent2 : public wxAsyncMethodCallEvent
+{
+public:
+ typedef T ObjectType;
+ typedef void (ObjectType::*MethodType)(T1 x1, T2 x2);
+ typedef typename wxRemoveRef<T1>::type ParamType1;
+ typedef typename wxRemoveRef<T2>::type ParamType2;
+
+ wxAsyncMethodCallEvent2(ObjectType* object,
+ MethodType method,
+ const ParamType1& x1,
+ const ParamType2& x2)
+ : wxAsyncMethodCallEvent(object),
+ m_object(object),
+ m_method(method),
+ m_param1(x1),
+ m_param2(x2)
+ {
+ }
+
+ wxAsyncMethodCallEvent2(const wxAsyncMethodCallEvent2& other)
+ : wxAsyncMethodCallEvent(other),
+ m_object(other.m_object),
+ m_method(other.m_method),
+ m_param1(other.m_param1),
+ m_param2(other.m_param2)
+ {
+ }
+
+ virtual wxEvent *Clone() const
+ {
+ return new wxAsyncMethodCallEvent2(*this);
+ }
+
+ virtual void Execute()
+ {
+ (m_object->*m_method)(m_param1, m_param2);
+ }
+
+private:
+ ObjectType* const m_object;
+ const MethodType m_method;
+ const ParamType1 m_param1;
+ const ParamType2 m_param2;
+};
+
+// This is a version for calling any functors
+template <typename T>
+class wxAsyncMethodCallEventFunctor : public wxAsyncMethodCallEvent
+{
+public:
+ typedef T FunctorType;
+
+ wxAsyncMethodCallEventFunctor(wxObject *object, const FunctorType& fn)
+ : wxAsyncMethodCallEvent(object),
+ m_fn(fn)
+ {
+ }
+
+ wxAsyncMethodCallEventFunctor(const wxAsyncMethodCallEventFunctor& other)
+ : wxAsyncMethodCallEvent(other),
+ m_fn(other.m_fn)
+ {
+ }
+
+ virtual wxEvent *Clone() const
+ {
+ return new wxAsyncMethodCallEventFunctor(*this);
+ }
+
+ virtual void Execute()
+ {
+ m_fn();
+ }
+
+private:
+ FunctorType m_fn;
+};
+
+#endif // wxHAS_CALL_AFTER
+
+
+#if wxUSE_GUI
+
+
+// Item or menu event class
+/*
+ wxEVT_BUTTON
+ wxEVT_CHECKBOX
+ wxEVT_CHOICE
+ wxEVT_LISTBOX
+ wxEVT_LISTBOX_DCLICK
+ wxEVT_TEXT
+ wxEVT_TEXT_ENTER
+ wxEVT_MENU
+ wxEVT_SLIDER
+ wxEVT_RADIOBOX
+ wxEVT_RADIOBUTTON
+ wxEVT_SCROLLBAR
+ wxEVT_VLBOX
+ wxEVT_COMBOBOX
+ wxEVT_TOGGLEBUTTON
+*/
+
+class WXDLLIMPEXP_CORE wxCommandEvent : public wxEvent,
+ public wxEventBasicPayloadMixin
+{
+public:
+ wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
+
+ wxCommandEvent(const wxCommandEvent& event)
+ : wxEvent(event),
+ wxEventBasicPayloadMixin(event),
+ m_clientData(event.m_clientData),
+ m_clientObject(event.m_clientObject)
+ {
+ // Because GetString() can retrieve the string text only on demand, we
+ // need to copy it explicitly.
+ if ( m_cmdString.empty() )
+ m_cmdString = event.GetString();
+ }
+
+ // Set/Get client data from controls
+ void SetClientData(void* clientData) { m_clientData = clientData; }
+ void *GetClientData() const { return m_clientData; }
+
+ // Set/Get client object from controls
+ void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; }
+ wxClientData *GetClientObject() const { return m_clientObject; }
+
+ // Note: this shadows wxEventBasicPayloadMixin::GetString(), because it does some
+ // GUI-specific hacks
+ wxString GetString() const;
+
+ // Get listbox selection if single-choice
+ int GetSelection() const { return m_commandInt; }
+
+ // Get checkbox value
+ bool IsChecked() const { return m_commandInt != 0; }
+
+ // true if the listbox event was a selection.
+ bool IsSelection() const { return (m_extraLong != 0); }
+
+ virtual wxEvent *Clone() const { return new wxCommandEvent(*this); }
+ virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; }
+
+protected:
+ void* m_clientData; // Arbitrary client data
+ wxClientData* m_clientObject; // Arbitrary client object
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCommandEvent)
+};
+
+// this class adds a possibility to react (from the user) code to a control
+// notification: allow or veto the operation being reported.
+class WXDLLIMPEXP_CORE wxNotifyEvent : public wxCommandEvent
+{
+public:
+ wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
+ : wxCommandEvent(commandType, winid)
+ { m_bAllow = true; }
+
+ wxNotifyEvent(const wxNotifyEvent& event)
+ : wxCommandEvent(event)
+ { m_bAllow = event.m_bAllow; }
+
+ // veto the operation (usually it's allowed by default)
+ void Veto() { m_bAllow = false; }
+
+ // allow the operation if it was disabled by default
+ void Allow() { m_bAllow = true; }
+
+ // for implementation code only: is the operation allowed?
+ bool IsAllowed() const { return m_bAllow; }
+
+ virtual wxEvent *Clone() const { return new wxNotifyEvent(*this); }
+
+private:
+ bool m_bAllow;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNotifyEvent)
+};
+
+
+// Scroll event class, derived form wxCommandEvent. wxScrollEvents are
+// sent by wxSlider and wxScrollBar.
+/*
+ wxEVT_SCROLL_TOP
+ wxEVT_SCROLL_BOTTOM
+ wxEVT_SCROLL_LINEUP
+ wxEVT_SCROLL_LINEDOWN
+ wxEVT_SCROLL_PAGEUP
+ wxEVT_SCROLL_PAGEDOWN
+ wxEVT_SCROLL_THUMBTRACK
+ wxEVT_SCROLL_THUMBRELEASE
+ wxEVT_SCROLL_CHANGED
+*/
+
+class WXDLLIMPEXP_CORE wxScrollEvent : public wxCommandEvent
+{
+public:
+ wxScrollEvent(wxEventType commandType = wxEVT_NULL,
+ int winid = 0, int pos = 0, int orient = 0);
+
+ int GetOrientation() const { return (int) m_extraLong; }
+ int GetPosition() const { return m_commandInt; }
+ void SetOrientation(int orient) { m_extraLong = (long) orient; }
+ void SetPosition(int pos) { m_commandInt = pos; }
+
+ virtual wxEvent *Clone() const { return new wxScrollEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollEvent)
+};
+
+// ScrollWin event class, derived fom wxEvent. wxScrollWinEvents
+// are sent by wxWindow.
+/*
+ wxEVT_SCROLLWIN_TOP
+ wxEVT_SCROLLWIN_BOTTOM
+ wxEVT_SCROLLWIN_LINEUP
+ wxEVT_SCROLLWIN_LINEDOWN
+ wxEVT_SCROLLWIN_PAGEUP
+ wxEVT_SCROLLWIN_PAGEDOWN
+ wxEVT_SCROLLWIN_THUMBTRACK
+ wxEVT_SCROLLWIN_THUMBRELEASE
+*/
+
+class WXDLLIMPEXP_CORE wxScrollWinEvent : public wxEvent
+{
+public:
+ wxScrollWinEvent(wxEventType commandType = wxEVT_NULL,
+ int pos = 0, int orient = 0);
+ wxScrollWinEvent(const wxScrollWinEvent& event) : wxEvent(event)
+ { m_commandInt = event.m_commandInt;
+ m_extraLong = event.m_extraLong; }
+
+ int GetOrientation() const { return (int) m_extraLong; }
+ int GetPosition() const { return m_commandInt; }
+ void SetOrientation(int orient) { m_extraLong = (long) orient; }
+ void SetPosition(int pos) { m_commandInt = pos; }
+
+ virtual wxEvent *Clone() const { return new wxScrollWinEvent(*this); }
+
+protected:
+ int m_commandInt;
+ long m_extraLong;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollWinEvent)
+};
+
+
+
+// Mouse event class
+
+/*
+ wxEVT_LEFT_DOWN
+ wxEVT_LEFT_UP
+ wxEVT_MIDDLE_DOWN
+ wxEVT_MIDDLE_UP
+ wxEVT_RIGHT_DOWN
+ wxEVT_RIGHT_UP
+ wxEVT_MOTION
+ wxEVT_ENTER_WINDOW
+ wxEVT_LEAVE_WINDOW
+ wxEVT_LEFT_DCLICK
+ wxEVT_MIDDLE_DCLICK
+ wxEVT_RIGHT_DCLICK
+*/
+
+enum wxMouseWheelAxis
+{
+ wxMOUSE_WHEEL_VERTICAL,
+ wxMOUSE_WHEEL_HORIZONTAL
+};
+
+class WXDLLIMPEXP_CORE wxMouseEvent : public wxEvent,
+ public wxMouseState
+{
+public:
+ wxMouseEvent(wxEventType mouseType = wxEVT_NULL);
+ wxMouseEvent(const wxMouseEvent& event)
+ : wxEvent(event),
+ wxMouseState(event)
+ {
+ Assign(event);
+ }
+
+ // Was it a button event? (*doesn't* mean: is any button *down*?)
+ bool IsButton() const { return Button(wxMOUSE_BTN_ANY); }
+
+ // Was it a down event from this (or any) button?
+ bool ButtonDown(int but = wxMOUSE_BTN_ANY) const;
+
+ // Was it a dclick event from this (or any) button?
+ bool ButtonDClick(int but = wxMOUSE_BTN_ANY) const;
+
+ // Was it a up event from this (or any) button?
+ bool ButtonUp(int but = wxMOUSE_BTN_ANY) const;
+
+ // Was this event generated by the given button?
+ bool Button(int but) const;
+
+ // Get the button which is changing state (wxMOUSE_BTN_NONE if none)
+ int GetButton() const;
+
+ // Find which event was just generated
+ bool LeftDown() const { return (m_eventType == wxEVT_LEFT_DOWN); }
+ bool MiddleDown() const { return (m_eventType == wxEVT_MIDDLE_DOWN); }
+ bool RightDown() const { return (m_eventType == wxEVT_RIGHT_DOWN); }
+ bool Aux1Down() const { return (m_eventType == wxEVT_AUX1_DOWN); }
+ bool Aux2Down() const { return (m_eventType == wxEVT_AUX2_DOWN); }
+
+ bool LeftUp() const { return (m_eventType == wxEVT_LEFT_UP); }
+ bool MiddleUp() const { return (m_eventType == wxEVT_MIDDLE_UP); }
+ bool RightUp() const { return (m_eventType == wxEVT_RIGHT_UP); }
+ bool Aux1Up() const { return (m_eventType == wxEVT_AUX1_UP); }
+ bool Aux2Up() const { return (m_eventType == wxEVT_AUX2_UP); }
+
+ bool LeftDClick() const { return (m_eventType == wxEVT_LEFT_DCLICK); }
+ bool MiddleDClick() const { return (m_eventType == wxEVT_MIDDLE_DCLICK); }
+ bool RightDClick() const { return (m_eventType == wxEVT_RIGHT_DCLICK); }
+ bool Aux1DClick() const { return (m_eventType == wxEVT_AUX1_DCLICK); }
+ bool Aux2DClick() const { return (m_eventType == wxEVT_AUX2_DCLICK); }
+
+ // True if a button is down and the mouse is moving
+ bool Dragging() const
+ {
+ return (m_eventType == wxEVT_MOTION) && ButtonIsDown(wxMOUSE_BTN_ANY);
+ }
+
+ // True if the mouse is moving, and no button is down
+ bool Moving() const
+ {
+ return (m_eventType == wxEVT_MOTION) && !ButtonIsDown(wxMOUSE_BTN_ANY);
+ }
+
+ // True if the mouse is just entering the window
+ bool Entering() const { return (m_eventType == wxEVT_ENTER_WINDOW); }
+
+ // True if the mouse is just leaving the window
+ bool Leaving() const { return (m_eventType == wxEVT_LEAVE_WINDOW); }
+
+ // Returns the number of mouse clicks associated with this event.
+ int GetClickCount() const { return m_clickCount; }
+
+ // Find the logical position of the event given the DC
+ wxPoint GetLogicalPosition(const wxDC& dc) const;
+
+ // Get wheel rotation, positive or negative indicates direction of
+ // rotation. Current devices all send an event when rotation is equal to
+ // +/-WheelDelta, but this allows for finer resolution devices to be
+ // created in the future. Because of this you shouldn't assume that one
+ // event is equal to 1 line or whatever, but you should be able to either
+ // do partial line scrolling or wait until +/-WheelDelta rotation values
+ // have been accumulated before scrolling.
+ int GetWheelRotation() const { return m_wheelRotation; }
+
+ // Get wheel delta, normally 120. This is the threshold for action to be
+ // taken, and one such action (for example, scrolling one increment)
+ // should occur for each delta.
+ int GetWheelDelta() const { return m_wheelDelta; }
+
+ // Gets the axis the wheel operation concerns; wxMOUSE_WHEEL_VERTICAL
+ // (most common case) or wxMOUSE_WHEEL_HORIZONTAL (for horizontal scrolling
+ // using e.g. a trackpad).
+ wxMouseWheelAxis GetWheelAxis() const { return m_wheelAxis; }
+
+ // Returns the configured number of lines (or whatever) to be scrolled per
+ // wheel action. Defaults to three.
+ int GetLinesPerAction() const { return m_linesPerAction; }
+
+ // Returns the configured number of columns (or whatever) to be scrolled per
+ // wheel action. Defaults to three.
+ int GetColumnsPerAction() const { return m_columnsPerAction; }
+
+ // Is the system set to do page scrolling?
+ bool IsPageScroll() const { return ((unsigned int)m_linesPerAction == UINT_MAX); }
+
+ virtual wxEvent *Clone() const { return new wxMouseEvent(*this); }
+ virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; }
+
+ wxMouseEvent& operator=(const wxMouseEvent& event)
+ {
+ if (&event != this)
+ Assign(event);
+ return *this;
+ }
+
+public:
+ int m_clickCount;
+
+ wxMouseWheelAxis m_wheelAxis;
+ int m_wheelRotation;
+ int m_wheelDelta;
+ int m_linesPerAction;
+ int m_columnsPerAction;
+
+protected:
+ void Assign(const wxMouseEvent& evt);
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxMouseEvent)
+};
+
+// Cursor set event
+
+/*
+ wxEVT_SET_CURSOR
+ */
+
+class WXDLLIMPEXP_CORE wxSetCursorEvent : public wxEvent
+{
+public:
+ wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0)
+ : wxEvent(0, wxEVT_SET_CURSOR),
+ m_x(x), m_y(y), m_cursor()
+ { }
+
+ wxSetCursorEvent(const wxSetCursorEvent& event)
+ : wxEvent(event),
+ m_x(event.m_x),
+ m_y(event.m_y),
+ m_cursor(event.m_cursor)
+ { }
+
+ wxCoord GetX() const { return m_x; }
+ wxCoord GetY() const { return m_y; }
+
+ void SetCursor(const wxCursor& cursor) { m_cursor = cursor; }
+ const wxCursor& GetCursor() const { return m_cursor; }
+ bool HasCursor() const { return m_cursor.IsOk(); }
+
+ virtual wxEvent *Clone() const { return new wxSetCursorEvent(*this); }
+
+private:
+ wxCoord m_x, m_y;
+ wxCursor m_cursor;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSetCursorEvent)
+};
+
+// Keyboard input event class
+
+/*
+ wxEVT_CHAR
+ wxEVT_CHAR_HOOK
+ wxEVT_KEY_DOWN
+ wxEVT_KEY_UP
+ wxEVT_HOTKEY
+ */
+
+// key categories: the bit flags for IsKeyInCategory() function
+//
+// the enum values used may change in future version of wx
+// use the named constants only, or bitwise combinations thereof
+enum wxKeyCategoryFlags
+{
+ // arrow keys, on and off numeric keypads
+ WXK_CATEGORY_ARROW = 1,
+
+ // page up and page down keys, on and off numeric keypads
+ WXK_CATEGORY_PAGING = 2,
+
+ // home and end keys, on and off numeric keypads
+ WXK_CATEGORY_JUMP = 4,
+
+ // tab key, on and off numeric keypads
+ WXK_CATEGORY_TAB = 8,
+
+ // backspace and delete keys, on and off numeric keypads
+ WXK_CATEGORY_CUT = 16,
+
+ // all keys usually used for navigation
+ WXK_CATEGORY_NAVIGATION = WXK_CATEGORY_ARROW |
+ WXK_CATEGORY_PAGING |
+ WXK_CATEGORY_JUMP
+};
+
+class WXDLLIMPEXP_CORE wxKeyEvent : public wxEvent,
+ public wxKeyboardState
+{
+public:
+ wxKeyEvent(wxEventType keyType = wxEVT_NULL);
+
+ // Normal copy ctor and a ctor creating a new event for the same key as the
+ // given one but a different event type (this is used in implementation
+ // code only, do not use outside of the library).
+ wxKeyEvent(const wxKeyEvent& evt);
+ wxKeyEvent(wxEventType eventType, const wxKeyEvent& evt);
+
+ // get the key code: an ASCII7 char or an element of wxKeyCode enum
+ int GetKeyCode() const { return (int)m_keyCode; }
+
+ // returns true iff this event's key code is of a certain type
+ bool IsKeyInCategory(int category) const;
+
+#if wxUSE_UNICODE
+ // get the Unicode character corresponding to this key
+ wxChar GetUnicodeKey() const { return m_uniChar; }
+#endif // wxUSE_UNICODE
+
+ // get the raw key code (platform-dependent)
+ wxUint32 GetRawKeyCode() const { return m_rawCode; }
+
+ // get the raw key flags (platform-dependent)
+ wxUint32 GetRawKeyFlags() const { return m_rawFlags; }
+
+ // Find the position of the event
+ void GetPosition(wxCoord *xpos, wxCoord *ypos) const
+ {
+ if (xpos)
+ *xpos = GetX();
+ if (ypos)
+ *ypos = GetY();
+ }
+
+ // This version if provided only for backwards compatiblity, don't use.
+ void GetPosition(long *xpos, long *ypos) const
+ {
+ if (xpos)
+ *xpos = GetX();
+ if (ypos)
+ *ypos = GetY();
+ }
+
+ wxPoint GetPosition() const
+ { return wxPoint(GetX(), GetY()); }
+
+ // Get X position
+ wxCoord GetX() const;
+
+ // Get Y position
+ wxCoord GetY() const;
+
+ // Can be called from wxEVT_CHAR_HOOK handler to allow generation of normal
+ // key events even though the event had been handled (by default they would
+ // not be generated in this case).
+ void DoAllowNextEvent() { m_allowNext = true; }
+
+ // Return the value of the "allow next" flag, for internal use only.
+ bool IsNextEventAllowed() const { return m_allowNext; }
+
+
+ virtual wxEvent *Clone() const { return new wxKeyEvent(*this); }
+ virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; }
+
+ // we do need to copy wxKeyEvent sometimes (in wxTreeCtrl code, for
+ // example)
+ wxKeyEvent& operator=(const wxKeyEvent& evt)
+ {
+ if ( &evt != this )
+ {
+ wxEvent::operator=(evt);
+
+ // Borland C++ 5.82 doesn't compile an explicit call to an
+ // implicitly defined operator=() so need to do it this way:
+ *static_cast<wxKeyboardState *>(this) = evt;
+
+ DoAssignMembers(evt);
+ }
+ return *this;
+ }
+
+public:
+ // Do not use these fields directly, they are initialized on demand, so
+ // call GetX() and GetY() or GetPosition() instead.
+ wxCoord m_x, m_y;
+
+ long m_keyCode;
+
+#if wxUSE_UNICODE
+ // This contains the full Unicode character
+ // in a character events in Unicode mode
+ wxChar m_uniChar;
+#endif
+
+ // these fields contain the platform-specific information about
+ // key that was pressed
+ wxUint32 m_rawCode;
+ wxUint32 m_rawFlags;
+
+private:
+ // Set the event to propagate if necessary, i.e. if it's of wxEVT_CHAR_HOOK
+ // type. This is used by all ctors.
+ void InitPropagation()
+ {
+ if ( m_eventType == wxEVT_CHAR_HOOK )
+ m_propagationLevel = wxEVENT_PROPAGATE_MAX;
+
+ m_allowNext = false;
+ }
+
+ // Copy only the event data present in this class, this is used by
+ // AssignKeyData() and copy ctor.
+ void DoAssignMembers(const wxKeyEvent& evt)
+ {
+ m_x = evt.m_x;
+ m_y = evt.m_y;
+ m_hasPosition = evt.m_hasPosition;
+
+ m_keyCode = evt.m_keyCode;
+
+ m_rawCode = evt.m_rawCode;
+ m_rawFlags = evt.m_rawFlags;
+#if wxUSE_UNICODE
+ m_uniChar = evt.m_uniChar;
+#endif
+ }
+
+ // Initialize m_x and m_y using the current mouse cursor position if
+ // necessary.
+ void InitPositionIfNecessary() const;
+
+ // If this flag is true, the normal key events should still be generated
+ // even if wxEVT_CHAR_HOOK had been handled. By default it is false as
+ // handling wxEVT_CHAR_HOOK suppresses all the subsequent events.
+ bool m_allowNext;
+
+ // If true, m_x and m_y were already initialized. If false, try to get them
+ // when they're requested.
+ bool m_hasPosition;
+
+ DECLARE_DYNAMIC_CLASS(wxKeyEvent)
+};
+
+// Size event class
+/*
+ wxEVT_SIZE
+ */
+
+class WXDLLIMPEXP_CORE wxSizeEvent : public wxEvent
+{
+public:
+ wxSizeEvent() : wxEvent(0, wxEVT_SIZE)
+ { }
+ wxSizeEvent(const wxSize& sz, int winid = 0)
+ : wxEvent(winid, wxEVT_SIZE),
+ m_size(sz)
+ { }
+ wxSizeEvent(const wxSizeEvent& event)
+ : wxEvent(event),
+ m_size(event.m_size), m_rect(event.m_rect)
+ { }
+ wxSizeEvent(const wxRect& rect, int id = 0)
+ : m_size(rect.GetSize()), m_rect(rect)
+ { m_eventType = wxEVT_SIZING; m_id = id; }
+
+ wxSize GetSize() const { return m_size; }
+ void SetSize(wxSize size) { m_size = size; }
+ wxRect GetRect() const { return m_rect; }
+ void SetRect(const wxRect& rect) { m_rect = rect; }
+
+ virtual wxEvent *Clone() const { return new wxSizeEvent(*this); }
+
+public:
+ // For internal usage only. Will be converted to protected members.
+ wxSize m_size;
+ wxRect m_rect; // Used for wxEVT_SIZING
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSizeEvent)
+};
+
+// Move event class
+
+/*
+ wxEVT_MOVE
+ */
+
+class WXDLLIMPEXP_CORE wxMoveEvent : public wxEvent
+{
+public:
+ wxMoveEvent()
+ : wxEvent(0, wxEVT_MOVE)
+ { }
+ wxMoveEvent(const wxPoint& pos, int winid = 0)
+ : wxEvent(winid, wxEVT_MOVE),
+ m_pos(pos)
+ { }
+ wxMoveEvent(const wxMoveEvent& event)
+ : wxEvent(event),
+ m_pos(event.m_pos)
+ { }
+ wxMoveEvent(const wxRect& rect, int id = 0)
+ : m_pos(rect.GetPosition()), m_rect(rect)
+ { m_eventType = wxEVT_MOVING; m_id = id; }
+
+ wxPoint GetPosition() const { return m_pos; }
+ void SetPosition(const wxPoint& pos) { m_pos = pos; }
+ wxRect GetRect() const { return m_rect; }
+ void SetRect(const wxRect& rect) { m_rect = rect; }
+
+ virtual wxEvent *Clone() const { return new wxMoveEvent(*this); }
+
+protected:
+ wxPoint m_pos;
+ wxRect m_rect;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMoveEvent)
+};
+
+// Paint event class
+/*
+ wxEVT_PAINT
+ wxEVT_NC_PAINT
+ */
+
+#if wxDEBUG_LEVEL && (defined(__WXMSW__) || defined(__WXPM__))
+ #define wxHAS_PAINT_DEBUG
+
+ // see comments in src/msw|os2/dcclient.cpp where g_isPainting is defined
+ extern WXDLLIMPEXP_CORE int g_isPainting;
+#endif // debug
+
+class WXDLLIMPEXP_CORE wxPaintEvent : public wxEvent
+{
+public:
+ wxPaintEvent(int Id = 0)
+ : wxEvent(Id, wxEVT_PAINT)
+ {
+#ifdef wxHAS_PAINT_DEBUG
+ // set the internal flag for the duration of redrawing
+ g_isPainting++;
+#endif // debug
+ }
+
+ // default copy ctor and dtor are normally fine, we only need them to keep
+ // g_isPainting updated in debug build
+#ifdef wxHAS_PAINT_DEBUG
+ wxPaintEvent(const wxPaintEvent& event)
+ : wxEvent(event)
+ {
+ g_isPainting++;
+ }
+
+ virtual ~wxPaintEvent()
+ {
+ g_isPainting--;
+ }
+#endif // debug
+
+ virtual wxEvent *Clone() const { return new wxPaintEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaintEvent)
+};
+
+class WXDLLIMPEXP_CORE wxNcPaintEvent : public wxEvent
+{
+public:
+ wxNcPaintEvent(int winid = 0)
+ : wxEvent(winid, wxEVT_NC_PAINT)
+ { }
+
+ virtual wxEvent *Clone() const { return new wxNcPaintEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNcPaintEvent)
+};
+
+// Erase background event class
+/*
+ wxEVT_ERASE_BACKGROUND
+ */
+
+class WXDLLIMPEXP_CORE wxEraseEvent : public wxEvent
+{
+public:
+ wxEraseEvent(int Id = 0, wxDC *dc = NULL)
+ : wxEvent(Id, wxEVT_ERASE_BACKGROUND),
+ m_dc(dc)
+ { }
+
+ wxEraseEvent(const wxEraseEvent& event)
+ : wxEvent(event),
+ m_dc(event.m_dc)
+ { }
+
+ wxDC *GetDC() const { return m_dc; }
+
+ virtual wxEvent *Clone() const { return new wxEraseEvent(*this); }
+
+protected:
+ wxDC *m_dc;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxEraseEvent)
+};
+
+// Focus event class
+/*
+ wxEVT_SET_FOCUS
+ wxEVT_KILL_FOCUS
+ */
+
+class WXDLLIMPEXP_CORE wxFocusEvent : public wxEvent
+{
+public:
+ wxFocusEvent(wxEventType type = wxEVT_NULL, int winid = 0)
+ : wxEvent(winid, type)
+ { m_win = NULL; }
+
+ wxFocusEvent(const wxFocusEvent& event)
+ : wxEvent(event)
+ { m_win = event.m_win; }
+
+ // The window associated with this event is the window which had focus
+ // before for SET event and the window which will have focus for the KILL
+ // one. NB: it may be NULL in both cases!
+ wxWindow *GetWindow() const { return m_win; }
+ void SetWindow(wxWindow *win) { m_win = win; }
+
+ virtual wxEvent *Clone() const { return new wxFocusEvent(*this); }
+
+private:
+ wxWindow *m_win;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFocusEvent)
+};
+
+// wxChildFocusEvent notifies the parent that a child has got the focus: unlike
+// wxFocusEvent it is propagated upwards the window chain
+class WXDLLIMPEXP_CORE wxChildFocusEvent : public wxCommandEvent
+{
+public:
+ wxChildFocusEvent(wxWindow *win = NULL);
+
+ wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
+
+ virtual wxEvent *Clone() const { return new wxChildFocusEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChildFocusEvent)
+};
+
+// Activate event class
+/*
+ wxEVT_ACTIVATE
+ wxEVT_ACTIVATE_APP
+ wxEVT_HIBERNATE
+ */
+
+class WXDLLIMPEXP_CORE wxActivateEvent : public wxEvent
+{
+public:
+ // Type of activation. For now we can only detect if it was by mouse or by
+ // some other method and even this is only available under wxMSW.
+ enum Reason
+ {
+ Reason_Mouse,
+ Reason_Unknown
+ };
+
+ wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = true,
+ int Id = 0, Reason activationReason = Reason_Unknown)
+ : wxEvent(Id, type),
+ m_activationReason(activationReason)
+ {
+ m_active = active;
+ }
+ wxActivateEvent(const wxActivateEvent& event)
+ : wxEvent(event)
+ {
+ m_active = event.m_active;
+ m_activationReason = event.m_activationReason;
+ }
+
+ bool GetActive() const { return m_active; }
+ Reason GetActivationReason() const { return m_activationReason;}
+
+ virtual wxEvent *Clone() const { return new wxActivateEvent(*this); }
+
+private:
+ bool m_active;
+ Reason m_activationReason;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxActivateEvent)
+};
+
+// InitDialog event class
+/*
+ wxEVT_INIT_DIALOG
+ */
+
+class WXDLLIMPEXP_CORE wxInitDialogEvent : public wxEvent
+{
+public:
+ wxInitDialogEvent(int Id = 0)
+ : wxEvent(Id, wxEVT_INIT_DIALOG)
+ { }
+
+ virtual wxEvent *Clone() const { return new wxInitDialogEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxInitDialogEvent)
+};
+
+// Miscellaneous menu event class
+/*
+ wxEVT_MENU_OPEN,
+ wxEVT_MENU_CLOSE,
+ wxEVT_MENU_HIGHLIGHT,
+*/
+
+class WXDLLIMPEXP_CORE wxMenuEvent : public wxEvent
+{
+public:
+ wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = NULL)
+ : wxEvent(winid, type)
+ { m_menuId = winid; m_menu = menu; }
+ wxMenuEvent(const wxMenuEvent& event)
+ : wxEvent(event)
+ { m_menuId = event.m_menuId; m_menu = event.m_menu; }
+
+ // only for wxEVT_MENU_HIGHLIGHT
+ int GetMenuId() const { return m_menuId; }
+
+ // only for wxEVT_MENU_OPEN/CLOSE
+ bool IsPopup() const { return m_menuId == wxID_ANY; }
+
+ // only for wxEVT_MENU_OPEN/CLOSE
+ wxMenu* GetMenu() const { return m_menu; }
+
+ virtual wxEvent *Clone() const { return new wxMenuEvent(*this); }
+
+private:
+ int m_menuId;
+ wxMenu* m_menu;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMenuEvent)
+};
+
+// Window close or session close event class
+/*
+ wxEVT_CLOSE_WINDOW,
+ wxEVT_END_SESSION,
+ wxEVT_QUERY_END_SESSION
+ */
+
+class WXDLLIMPEXP_CORE wxCloseEvent : public wxEvent
+{
+public:
+ wxCloseEvent(wxEventType type = wxEVT_NULL, int winid = 0)
+ : wxEvent(winid, type),
+ m_loggingOff(true),
+ m_veto(false), // should be false by default
+ m_canVeto(true) {}
+
+ wxCloseEvent(const wxCloseEvent& event)
+ : wxEvent(event),
+ m_loggingOff(event.m_loggingOff),
+ m_veto(event.m_veto),
+ m_canVeto(event.m_canVeto) {}
+
+ void SetLoggingOff(bool logOff) { m_loggingOff = logOff; }
+ bool GetLoggingOff() const
+ {
+ // m_loggingOff flag is only used by wxEVT_[QUERY_]END_SESSION, it
+ // doesn't make sense for wxEVT_CLOSE_WINDOW
+ wxASSERT_MSG( m_eventType != wxEVT_CLOSE_WINDOW,
+ wxT("this flag is for end session events only") );
+
+ return m_loggingOff;
+ }
+
+ void Veto(bool veto = true)
+ {
+ // GetVeto() will return false anyhow...
+ wxCHECK_RET( m_canVeto,
+ wxT("call to Veto() ignored (can't veto this event)") );
+
+ m_veto = veto;
+ }
+ void SetCanVeto(bool canVeto) { m_canVeto = canVeto; }
+ bool CanVeto() const { return m_canVeto; }
+ bool GetVeto() const { return m_canVeto && m_veto; }
+
+ virtual wxEvent *Clone() const { return new wxCloseEvent(*this); }
+
+protected:
+ bool m_loggingOff,
+ m_veto,
+ m_canVeto;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCloseEvent)
+};
+
+/*
+ wxEVT_SHOW
+ */
+
+class WXDLLIMPEXP_CORE wxShowEvent : public wxEvent
+{
+public:
+ wxShowEvent(int winid = 0, bool show = false)
+ : wxEvent(winid, wxEVT_SHOW)
+ { m_show = show; }
+ wxShowEvent(const wxShowEvent& event)
+ : wxEvent(event)
+ { m_show = event.m_show; }
+
+ void SetShow(bool show) { m_show = show; }
+
+ // return true if the window was shown, false if hidden
+ bool IsShown() const { return m_show; }
+
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED( bool GetShow() const { return IsShown(); } )
+#endif
+
+ virtual wxEvent *Clone() const { return new wxShowEvent(*this); }
+
+protected:
+ bool m_show;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxShowEvent)
+};
+
+/*
+ wxEVT_ICONIZE
+ */
+
+class WXDLLIMPEXP_CORE wxIconizeEvent : public wxEvent
+{
+public:
+ wxIconizeEvent(int winid = 0, bool iconized = true)
+ : wxEvent(winid, wxEVT_ICONIZE)
+ { m_iconized = iconized; }
+ wxIconizeEvent(const wxIconizeEvent& event)
+ : wxEvent(event)
+ { m_iconized = event.m_iconized; }
+
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED( bool Iconized() const { return IsIconized(); } )
+#endif
+ // return true if the frame was iconized, false if restored
+ bool IsIconized() const { return m_iconized; }
+
+ virtual wxEvent *Clone() const { return new wxIconizeEvent(*this); }
+
+protected:
+ bool m_iconized;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIconizeEvent)
+};
+/*
+ wxEVT_MAXIMIZE
+ */
+
+class WXDLLIMPEXP_CORE wxMaximizeEvent : public wxEvent
+{
+public:
+ wxMaximizeEvent(int winid = 0)
+ : wxEvent(winid, wxEVT_MAXIMIZE)
+ { }
+
+ virtual wxEvent *Clone() const { return new wxMaximizeEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMaximizeEvent)
+};
+
+// Joystick event class
+/*
+ wxEVT_JOY_BUTTON_DOWN,
+ wxEVT_JOY_BUTTON_UP,
+ wxEVT_JOY_MOVE,
+ wxEVT_JOY_ZMOVE
+*/
+
+// Which joystick? Same as Windows ids so no conversion necessary.
+enum
+{
+ wxJOYSTICK1,
+ wxJOYSTICK2
+};
+
+// Which button is down?
+enum
+{
+ wxJOY_BUTTON_ANY = -1,
+ wxJOY_BUTTON1 = 1,
+ wxJOY_BUTTON2 = 2,
+ wxJOY_BUTTON3 = 4,
+ wxJOY_BUTTON4 = 8
+};
+
+class WXDLLIMPEXP_CORE wxJoystickEvent : public wxEvent
+{
+protected:
+ wxPoint m_pos;
+ int m_zPosition;
+ int m_buttonChange; // Which button changed?
+ int m_buttonState; // Which buttons are down?
+ int m_joyStick; // Which joystick?
+
+public:
+ wxJoystickEvent(wxEventType type = wxEVT_NULL,
+ int state = 0,
+ int joystick = wxJOYSTICK1,
+ int change = 0)
+ : wxEvent(0, type),
+ m_pos(),
+ m_zPosition(0),
+ m_buttonChange(change),
+ m_buttonState(state),
+ m_joyStick(joystick)
+ {
+ }
+ wxJoystickEvent(const wxJoystickEvent& event)
+ : wxEvent(event),
+ m_pos(event.m_pos),
+ m_zPosition(event.m_zPosition),
+ m_buttonChange(event.m_buttonChange),
+ m_buttonState(event.m_buttonState),
+ m_joyStick(event.m_joyStick)
+ { }
+
+ wxPoint GetPosition() const { return m_pos; }
+ int GetZPosition() const { return m_zPosition; }
+ int GetButtonState() const { return m_buttonState; }
+ int GetButtonChange() const { return m_buttonChange; }
+ int GetJoystick() const { return m_joyStick; }
+
+ void SetJoystick(int stick) { m_joyStick = stick; }
+ void SetButtonState(int state) { m_buttonState = state; }
+ void SetButtonChange(int change) { m_buttonChange = change; }
+ void SetPosition(const wxPoint& pos) { m_pos = pos; }
+ void SetZPosition(int zPos) { m_zPosition = zPos; }
+
+ // Was it a button event? (*doesn't* mean: is any button *down*?)
+ bool IsButton() const { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) ||
+ (GetEventType() == wxEVT_JOY_BUTTON_UP)); }
+
+ // Was it a move event?
+ bool IsMove() const { return (GetEventType() == wxEVT_JOY_MOVE); }
+
+ // Was it a zmove event?
+ bool IsZMove() const { return (GetEventType() == wxEVT_JOY_ZMOVE); }
+
+ // Was it a down event from button 1, 2, 3, 4 or any?
+ bool ButtonDown(int but = wxJOY_BUTTON_ANY) const
+ { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) &&
+ ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); }
+
+ // Was it a up event from button 1, 2, 3 or any?
+ bool ButtonUp(int but = wxJOY_BUTTON_ANY) const
+ { return ((GetEventType() == wxEVT_JOY_BUTTON_UP) &&
+ ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); }
+
+ // Was the given button 1,2,3,4 or any in Down state?
+ bool ButtonIsDown(int but = wxJOY_BUTTON_ANY) const
+ { return (((but == wxJOY_BUTTON_ANY) && (m_buttonState != 0)) ||
+ ((m_buttonState & but) == but)); }
+
+ virtual wxEvent *Clone() const { return new wxJoystickEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxJoystickEvent)
+};
+
+// Drop files event class
+/*
+ wxEVT_DROP_FILES
+ */
+
+class WXDLLIMPEXP_CORE wxDropFilesEvent : public wxEvent
+{
+public:
+ int m_noFiles;
+ wxPoint m_pos;
+ wxString* m_files;
+
+ wxDropFilesEvent(wxEventType type = wxEVT_NULL,
+ int noFiles = 0,
+ wxString *files = NULL)
+ : wxEvent(0, type),
+ m_noFiles(noFiles),
+ m_pos(),
+ m_files(files)
+ { }
+
+ // we need a copy ctor to avoid deleting m_files pointer twice
+ wxDropFilesEvent(const wxDropFilesEvent& other)
+ : wxEvent(other),
+ m_noFiles(other.m_noFiles),
+ m_pos(other.m_pos),
+ m_files(NULL)
+ {
+ m_files = new wxString[m_noFiles];
+ for ( int n = 0; n < m_noFiles; n++ )
+ {
+ m_files[n] = other.m_files[n];
+ }
+ }
+
+ virtual ~wxDropFilesEvent()
+ {
+ delete [] m_files;
+ }
+
+ wxPoint GetPosition() const { return m_pos; }
+ int GetNumberOfFiles() const { return m_noFiles; }
+ wxString *GetFiles() const { return m_files; }
+
+ virtual wxEvent *Clone() const { return new wxDropFilesEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDropFilesEvent)
+};
+
+// Update UI event
+/*
+ wxEVT_UPDATE_UI
+ */
+
+// Whether to always send update events to windows, or
+// to only send update events to those with the
+// wxWS_EX_PROCESS_UI_UPDATES style.
+
+enum wxUpdateUIMode
+{
+ // Send UI update events to all windows
+ wxUPDATE_UI_PROCESS_ALL,
+
+ // Send UI update events to windows that have
+ // the wxWS_EX_PROCESS_UI_UPDATES flag specified
+ wxUPDATE_UI_PROCESS_SPECIFIED
+};
+
+class WXDLLIMPEXP_CORE wxUpdateUIEvent : public wxCommandEvent
+{
+public:
+ wxUpdateUIEvent(wxWindowID commandId = 0)
+ : wxCommandEvent(wxEVT_UPDATE_UI, commandId)
+ {
+ m_checked =
+ m_enabled =
+ m_shown =
+ m_setEnabled =
+ m_setShown =
+ m_setText =
+ m_setChecked = false;
+ }
+ wxUpdateUIEvent(const wxUpdateUIEvent& event)
+ : wxCommandEvent(event),
+ m_checked(event.m_checked),
+ m_enabled(event.m_enabled),
+ m_shown(event.m_shown),
+ m_setEnabled(event.m_setEnabled),
+ m_setShown(event.m_setShown),
+ m_setText(event.m_setText),
+ m_setChecked(event.m_setChecked),
+ m_text(event.m_text)
+ { }
+
+ bool GetChecked() const { return m_checked; }
+ bool GetEnabled() const { return m_enabled; }
+ bool GetShown() const { return m_shown; }
+ wxString GetText() const { return m_text; }
+ bool GetSetText() const { return m_setText; }
+ bool GetSetChecked() const { return m_setChecked; }
+ bool GetSetEnabled() const { return m_setEnabled; }
+ bool GetSetShown() const { return m_setShown; }
+
+ void Check(bool check) { m_checked = check; m_setChecked = true; }
+ void Enable(bool enable) { m_enabled = enable; m_setEnabled = true; }
+ void Show(bool show) { m_shown = show; m_setShown = true; }
+ void SetText(const wxString& text) { m_text = text; m_setText = true; }
+
+ // Sets the interval between updates in milliseconds.
+ // Set to -1 to disable updates, or to 0 to update as frequently as possible.
+ static void SetUpdateInterval(long updateInterval) { sm_updateInterval = updateInterval; }
+
+ // Returns the current interval between updates in milliseconds
+ static long GetUpdateInterval() { return sm_updateInterval; }
+
+ // Can we update this window?
+ static bool CanUpdate(wxWindowBase *win);
+
+ // Reset the update time to provide a delay until the next
+ // time we should update
+ static void ResetUpdateTime();
+
+ // Specify how wxWidgets will send update events: to
+ // all windows, or only to those which specify that they
+ // will process the events.
+ static void SetMode(wxUpdateUIMode mode) { sm_updateMode = mode; }
+
+ // Returns the UI update mode
+ static wxUpdateUIMode GetMode() { return sm_updateMode; }
+
+ virtual wxEvent *Clone() const { return new wxUpdateUIEvent(*this); }
+
+protected:
+ bool m_checked;
+ bool m_enabled;
+ bool m_shown;
+ bool m_setEnabled;
+ bool m_setShown;
+ bool m_setText;
+ bool m_setChecked;
+ wxString m_text;
+#if wxUSE_LONGLONG
+ static wxLongLong sm_lastUpdate;
+#endif
+ static long sm_updateInterval;
+ static wxUpdateUIMode sm_updateMode;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxUpdateUIEvent)
+};
+
+/*
+ wxEVT_SYS_COLOUR_CHANGED
+ */
+
+// TODO: shouldn't all events record the window ID?
+class WXDLLIMPEXP_CORE wxSysColourChangedEvent : public wxEvent
+{
+public:
+ wxSysColourChangedEvent()
+ : wxEvent(0, wxEVT_SYS_COLOUR_CHANGED)
+ { }
+
+ virtual wxEvent *Clone() const { return new wxSysColourChangedEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSysColourChangedEvent)
+};
+
+/*
+ wxEVT_MOUSE_CAPTURE_CHANGED
+ The window losing the capture receives this message
+ (even if it released the capture itself).
+ */
+
+class WXDLLIMPEXP_CORE wxMouseCaptureChangedEvent : public wxEvent
+{
+public:
+ wxMouseCaptureChangedEvent(wxWindowID winid = 0, wxWindow* gainedCapture = NULL)
+ : wxEvent(winid, wxEVT_MOUSE_CAPTURE_CHANGED),
+ m_gainedCapture(gainedCapture)
+ { }
+
+ wxMouseCaptureChangedEvent(const wxMouseCaptureChangedEvent& event)
+ : wxEvent(event),
+ m_gainedCapture(event.m_gainedCapture)
+ { }
+
+ virtual wxEvent *Clone() const { return new wxMouseCaptureChangedEvent(*this); }
+
+ wxWindow* GetCapturedWindow() const { return m_gainedCapture; }
+
+private:
+ wxWindow* m_gainedCapture;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureChangedEvent)
+};
+
+/*
+ wxEVT_MOUSE_CAPTURE_LOST
+ The window losing the capture receives this message, unless it released it
+ it itself or unless wxWindow::CaptureMouse was called on another window
+ (and so capture will be restored when the new capturer releases it).
+ */
+
+class WXDLLIMPEXP_CORE wxMouseCaptureLostEvent : public wxEvent
+{
+public:
+ wxMouseCaptureLostEvent(wxWindowID winid = 0)
+ : wxEvent(winid, wxEVT_MOUSE_CAPTURE_LOST)
+ {}
+
+ wxMouseCaptureLostEvent(const wxMouseCaptureLostEvent& event)
+ : wxEvent(event)
+ {}
+
+ virtual wxEvent *Clone() const { return new wxMouseCaptureLostEvent(*this); }
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureLostEvent)
+};
+
+/*
+ wxEVT_DISPLAY_CHANGED
+ */
+class WXDLLIMPEXP_CORE wxDisplayChangedEvent : public wxEvent
+{
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDisplayChangedEvent)
+
+public:
+ wxDisplayChangedEvent()
+ : wxEvent(0, wxEVT_DISPLAY_CHANGED)
+ { }
+
+ virtual wxEvent *Clone() const { return new wxDisplayChangedEvent(*this); }
+};
+
+/*
+ wxEVT_PALETTE_CHANGED
+ */
+
+class WXDLLIMPEXP_CORE wxPaletteChangedEvent : public wxEvent
+{
+public:
+ wxPaletteChangedEvent(wxWindowID winid = 0)
+ : wxEvent(winid, wxEVT_PALETTE_CHANGED),
+ m_changedWindow(NULL)
+ { }
+
+ wxPaletteChangedEvent(const wxPaletteChangedEvent& event)
+ : wxEvent(event),
+ m_changedWindow(event.m_changedWindow)
+ { }
+
+ void SetChangedWindow(wxWindow* win) { m_changedWindow = win; }
+ wxWindow* GetChangedWindow() const { return m_changedWindow; }
+
+ virtual wxEvent *Clone() const { return new wxPaletteChangedEvent(*this); }
+
+protected:
+ wxWindow* m_changedWindow;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaletteChangedEvent)
+};
+
+/*
+ wxEVT_QUERY_NEW_PALETTE
+ Indicates the window is getting keyboard focus and should re-do its palette.
+ */
+
+class WXDLLIMPEXP_CORE wxQueryNewPaletteEvent : public wxEvent
+{
+public:
+ wxQueryNewPaletteEvent(wxWindowID winid = 0)
+ : wxEvent(winid, wxEVT_QUERY_NEW_PALETTE),
+ m_paletteRealized(false)
+ { }
+ wxQueryNewPaletteEvent(const wxQueryNewPaletteEvent& event)
+ : wxEvent(event),
+ m_paletteRealized(event.m_paletteRealized)
+ { }
+
+ // App sets this if it changes the palette.
+ void SetPaletteRealized(bool realized) { m_paletteRealized = realized; }
+ bool GetPaletteRealized() const { return m_paletteRealized; }
+
+ virtual wxEvent *Clone() const { return new wxQueryNewPaletteEvent(*this); }
+
+protected:
+ bool m_paletteRealized;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxQueryNewPaletteEvent)
+};
+
+/*
+ Event generated by dialog navigation keys
+ wxEVT_NAVIGATION_KEY
+ */
+// NB: don't derive from command event to avoid being propagated to the parent
+class WXDLLIMPEXP_CORE wxNavigationKeyEvent : public wxEvent
+{
+public:
+ wxNavigationKeyEvent()
+ : wxEvent(0, wxEVT_NAVIGATION_KEY),
+ m_flags(IsForward | FromTab), // defaults are for TAB
+ m_focus(NULL)
+ {
+ m_propagationLevel = wxEVENT_PROPAGATE_NONE;
+ }
+
+ wxNavigationKeyEvent(const wxNavigationKeyEvent& event)
+ : wxEvent(event),
+ m_flags(event.m_flags),
+ m_focus(event.m_focus)
+ { }
+
+ // direction: forward (true) or backward (false)
+ bool GetDirection() const
+ { return (m_flags & IsForward) != 0; }
+ void SetDirection(bool bForward)
+ { if ( bForward ) m_flags |= IsForward; else m_flags &= ~IsForward; }
+
+ // it may be a window change event (MDI, notebook pages...) or a control
+ // change event
+ bool IsWindowChange() const
+ { return (m_flags & WinChange) != 0; }
+ void SetWindowChange(bool bIs)
+ { if ( bIs ) m_flags |= WinChange; else m_flags &= ~WinChange; }
+
+ // Set to true under MSW if the event was generated using the tab key.
+ // This is required for proper navogation over radio buttons
+ bool IsFromTab() const
+ { return (m_flags & FromTab) != 0; }
+ void SetFromTab(bool bIs)
+ { if ( bIs ) m_flags |= FromTab; else m_flags &= ~FromTab; }
+
+ // the child which has the focus currently (may be NULL - use
+ // wxWindow::FindFocus then)
+ wxWindow* GetCurrentFocus() const { return m_focus; }
+ void SetCurrentFocus(wxWindow *win) { m_focus = win; }
+
+ // Set flags
+ void SetFlags(long flags) { m_flags = flags; }
+
+ virtual wxEvent *Clone() const { return new wxNavigationKeyEvent(*this); }
+
+ enum wxNavigationKeyEventFlags
+ {
+ IsBackward = 0x0000,
+ IsForward = 0x0001,
+ WinChange = 0x0002,
+ FromTab = 0x0004
+ };
+
+ long m_flags;
+ wxWindow *m_focus;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNavigationKeyEvent)
+};
+
+// Window creation/destruction events: the first is sent as soon as window is
+// created (i.e. the underlying GUI object exists), but when the C++ object is
+// fully initialized (so virtual functions may be called). The second,
+// wxEVT_DESTROY, is sent right before the window is destroyed - again, it's
+// still safe to call virtual functions at this moment
+/*
+ wxEVT_CREATE
+ wxEVT_DESTROY
+ */
+
+class WXDLLIMPEXP_CORE wxWindowCreateEvent : public wxCommandEvent
+{
+public:
+ wxWindowCreateEvent(wxWindow *win = NULL);
+
+ wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
+
+ virtual wxEvent *Clone() const { return new wxWindowCreateEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowCreateEvent)
+};
+
+class WXDLLIMPEXP_CORE wxWindowDestroyEvent : public wxCommandEvent
+{
+public:
+ wxWindowDestroyEvent(wxWindow *win = NULL);
+
+ wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
+
+ virtual wxEvent *Clone() const { return new wxWindowDestroyEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowDestroyEvent)
+};
+
+// A help event is sent when the user clicks on a window in context-help mode.
+/*
+ wxEVT_HELP
+ wxEVT_DETAILED_HELP
+*/
+
+class WXDLLIMPEXP_CORE wxHelpEvent : public wxCommandEvent
+{
+public:
+ // how was this help event generated?
+ enum Origin
+ {
+ Origin_Unknown, // unrecognized event source
+ Origin_Keyboard, // event generated from F1 key press
+ Origin_HelpButton // event from [?] button on the title bar (Windows)
+ };
+
+ wxHelpEvent(wxEventType type = wxEVT_NULL,
+ wxWindowID winid = 0,
+ const wxPoint& pt = wxDefaultPosition,
+ Origin origin = Origin_Unknown)
+ : wxCommandEvent(type, winid),
+ m_pos(pt),
+ m_origin(GuessOrigin(origin))
+ { }
+ wxHelpEvent(const wxHelpEvent& event)
+ : wxCommandEvent(event),
+ m_pos(event.m_pos),
+ m_target(event.m_target),
+ m_link(event.m_link),
+ m_origin(event.m_origin)
+ { }
+
+ // Position of event (in screen coordinates)
+ const wxPoint& GetPosition() const { return m_pos; }
+ void SetPosition(const wxPoint& pos) { m_pos = pos; }
+
+ // Optional link to further help
+ const wxString& GetLink() const { return m_link; }
+ void SetLink(const wxString& link) { m_link = link; }
+
+ // Optional target to display help in. E.g. a window specification
+ const wxString& GetTarget() const { return m_target; }
+ void SetTarget(const wxString& target) { m_target = target; }
+
+ virtual wxEvent *Clone() const { return new wxHelpEvent(*this); }
+
+ // optional indication of the event source
+ Origin GetOrigin() const { return m_origin; }
+ void SetOrigin(Origin origin) { m_origin = origin; }
+
+protected:
+ wxPoint m_pos;
+ wxString m_target;
+ wxString m_link;
+ Origin m_origin;
+
+ // we can try to guess the event origin ourselves, even if none is
+ // specified in the ctor
+ static Origin GuessOrigin(Origin origin);
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHelpEvent)
+};
+
+// A Clipboard Text event is sent when a window intercepts text copy/cut/paste
+// message, i.e. the user has cut/copied/pasted data from/into a text control
+// via ctrl-C/X/V, ctrl/shift-del/insert, a popup menu command, etc.
+// NOTE : under windows these events are *NOT* generated automatically
+// for a Rich Edit text control.
+/*
+wxEVT_TEXT_COPY
+wxEVT_TEXT_CUT
+wxEVT_TEXT_PASTE
+*/
+
+class WXDLLIMPEXP_CORE wxClipboardTextEvent : public wxCommandEvent
+{
+public:
+ wxClipboardTextEvent(wxEventType type = wxEVT_NULL,
+ wxWindowID winid = 0)
+ : wxCommandEvent(type, winid)
+ { }
+ wxClipboardTextEvent(const wxClipboardTextEvent& event)
+ : wxCommandEvent(event)
+ { }
+
+ virtual wxEvent *Clone() const { return new wxClipboardTextEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxClipboardTextEvent)
+};
+
+// A Context event is sent when the user right clicks on a window or
+// presses Shift-F10
+// NOTE : Under windows this is a repackaged WM_CONTETXMENU message
+// Under other systems it may have to be generated from a right click event
+/*
+ wxEVT_CONTEXT_MENU
+*/
+
+class WXDLLIMPEXP_CORE wxContextMenuEvent : public wxCommandEvent
+{
+public:
+ wxContextMenuEvent(wxEventType type = wxEVT_NULL,
+ wxWindowID winid = 0,
+ const wxPoint& pt = wxDefaultPosition)
+ : wxCommandEvent(type, winid),
+ m_pos(pt)
+ { }
+ wxContextMenuEvent(const wxContextMenuEvent& event)
+ : wxCommandEvent(event),
+ m_pos(event.m_pos)
+ { }
+
+ // Position of event (in screen coordinates)
+ const wxPoint& GetPosition() const { return m_pos; }
+ void SetPosition(const wxPoint& pos) { m_pos = pos; }
+
+ virtual wxEvent *Clone() const { return new wxContextMenuEvent(*this); }
+
+protected:
+ wxPoint m_pos;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxContextMenuEvent)
+};
+
+
+/* TODO
+ wxEVT_MOUSE_CAPTURE_CHANGED,
+ wxEVT_SETTING_CHANGED, // WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95)
+// wxEVT_FONT_CHANGED, // WM_FONTCHANGE: roll into wxEVT_SETTING_CHANGED, but remember to propagate
+ // wxEVT_FONT_CHANGED to all other windows (maybe).
+ wxEVT_DRAW_ITEM, // Leave these three as virtual functions in wxControl?? Platform-specific.
+ wxEVT_MEASURE_ITEM,
+ wxEVT_COMPARE_ITEM
+*/
+
+#endif // wxUSE_GUI
+
+
+// ============================================================================
+// event handler and related classes
+// ============================================================================
+
+
+// struct containing the members common to static and dynamic event tables
+// entries
+struct WXDLLIMPEXP_BASE wxEventTableEntryBase
+{
+ wxEventTableEntryBase(int winid, int idLast,
+ wxEventFunctor* fn, wxObject *data)
+ : m_id(winid),
+ m_lastId(idLast),
+ m_fn(fn),
+ m_callbackUserData(data)
+ {
+ wxASSERT_MSG( idLast == wxID_ANY || winid <= idLast,
+ "invalid IDs range: lower bound > upper bound" );
+ }
+
+ wxEventTableEntryBase( const wxEventTableEntryBase &entry )
+ : m_id( entry.m_id ),
+ m_lastId( entry.m_lastId ),
+ m_fn( entry.m_fn ),
+ m_callbackUserData( entry.m_callbackUserData )
+ {
+ // This is a 'hack' to ensure that only one instance tries to delete
+ // the functor pointer. It is safe as long as the only place where the
+ // copy constructor is being called is when the static event tables are
+ // being initialized (a temporary instance is created and then this
+ // constructor is called).
+
+ const_cast<wxEventTableEntryBase&>( entry ).m_fn = NULL;
+ }
+
+ ~wxEventTableEntryBase()
+ {
+ delete m_fn;
+ }
+
+ // the range of ids for this entry: if m_lastId == wxID_ANY, the range
+ // consists only of m_id, otherwise it is m_id..m_lastId inclusive
+ int m_id,
+ m_lastId;
+
+ // function/method/functor to call
+ wxEventFunctor* m_fn;
+
+ // arbitrary user data associated with the callback
+ wxObject* m_callbackUserData;
+
+private:
+ wxDECLARE_NO_ASSIGN_CLASS(wxEventTableEntryBase);
+};
+
+// an entry from a static event table
+struct WXDLLIMPEXP_BASE wxEventTableEntry : public wxEventTableEntryBase
+{
+ wxEventTableEntry(const int& evType, int winid, int idLast,
+ wxEventFunctor* fn, wxObject *data)
+ : wxEventTableEntryBase(winid, idLast, fn, data),
+ m_eventType(evType)
+ { }
+
+ // the reference to event type: this allows us to not care about the
+ // (undefined) order in which the event table entries and the event types
+ // are initialized: initially the value of this reference might be
+ // invalid, but by the time it is used for the first time, all global
+ // objects will have been initialized (including the event type constants)
+ // and so it will have the correct value when it is needed
+ const int& m_eventType;
+
+private:
+ wxDECLARE_NO_ASSIGN_CLASS(wxEventTableEntry);
+};
+
+// an entry used in dynamic event table managed by wxEvtHandler::Connect()
+struct WXDLLIMPEXP_BASE wxDynamicEventTableEntry : public wxEventTableEntryBase
+{
+ wxDynamicEventTableEntry(int evType, int winid, int idLast,
+ wxEventFunctor* fn, wxObject *data)
+ : wxEventTableEntryBase(winid, idLast, fn, data),
+ m_eventType(evType)
+ { }
+
+ // not a reference here as we can't keep a reference to a temporary int
+ // created to wrap the constant value typically passed to Connect() - nor
+ // do we need it
+ int m_eventType;
+
+private:
+ wxDECLARE_NO_ASSIGN_CLASS(wxDynamicEventTableEntry);
+};
+
+// ----------------------------------------------------------------------------
+// wxEventTable: an array of event entries terminated with {0, 0, 0, 0, 0}
+// ----------------------------------------------------------------------------
+
+struct WXDLLIMPEXP_BASE wxEventTable
+{
+ const wxEventTable *baseTable; // base event table (next in chain)
+ const wxEventTableEntry *entries; // bottom of entry array
+};
+
+// ----------------------------------------------------------------------------
+// wxEventHashTable: a helper of wxEvtHandler to speed up wxEventTable lookups.
+// ----------------------------------------------------------------------------
+
+WX_DEFINE_ARRAY_PTR(const wxEventTableEntry*, wxEventTableEntryPointerArray);
+
+class WXDLLIMPEXP_BASE wxEventHashTable
+{
+private:
+ // Internal data structs
+ struct EventTypeTable
+ {
+ wxEventType eventType;
+ wxEventTableEntryPointerArray eventEntryTable;
+ };
+ typedef EventTypeTable* EventTypeTablePointer;
+
+public:
+ // Constructor, needs the event table it needs to hash later on.
+ // Note: hashing of the event table is not done in the constructor as it
+ // can be that the event table is not yet full initialize, the hash
+ // will gets initialized when handling the first event look-up request.
+ wxEventHashTable(const wxEventTable &table);
+ // Destructor.
+ ~wxEventHashTable();
+
+ // Handle the given event, in other words search the event table hash
+ // and call self->ProcessEvent() if a match was found.
+ bool HandleEvent(wxEvent& event, wxEvtHandler *self);
+
+ // Clear table
+ void Clear();
+
+#if wxUSE_MEMORY_TRACING
+ // Clear all tables: only used to work around problems in memory tracing
+ // code
+ static void ClearAll();
+#endif // wxUSE_MEMORY_TRACING
+
+protected:
+ // Init the hash table with the entries of the static event table.
+ void InitHashTable();
+ // Helper function of InitHashTable() to insert 1 entry into the hash table.
+ void AddEntry(const wxEventTableEntry &entry);
+ // Allocate and init with null pointers the base hash table.
+ void AllocEventTypeTable(size_t size);
+ // Grow the hash table in size and transfer all items currently
+ // in the table to the correct location in the new table.
+ void GrowEventTypeTable();
+
+protected:
+ const wxEventTable &m_table;
+ bool m_rebuildHash;
+
+ size_t m_size;
+ EventTypeTablePointer *m_eventTypeTable;
+
+ static wxEventHashTable* sm_first;
+ wxEventHashTable* m_previous;
+ wxEventHashTable* m_next;
+
+ wxDECLARE_NO_COPY_CLASS(wxEventHashTable);
+};
+
+// ----------------------------------------------------------------------------
+// wxEvtHandler: the base class for all objects handling wxWidgets events
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxEvtHandler : public wxObject
+ , public wxTrackable
+{
+public:
+ wxEvtHandler();
+ virtual ~wxEvtHandler();
+
+
+ // Event handler chain
+ // -------------------
+
+ wxEvtHandler *GetNextHandler() const { return m_nextHandler; }
+ wxEvtHandler *GetPreviousHandler() const { return m_previousHandler; }
+ virtual void SetNextHandler(wxEvtHandler *handler) { m_nextHandler = handler; }
+ virtual void SetPreviousHandler(wxEvtHandler *handler) { m_previousHandler = handler; }
+
+ void SetEvtHandlerEnabled(bool enabled) { m_enabled = enabled; }
+ bool GetEvtHandlerEnabled() const { return m_enabled; }
+
+ void Unlink();
+ bool IsUnlinked() const;
+
+
+ // Global event filters
+ // --------------------
+
+ // Add an event filter whose FilterEvent() method will be called for each
+ // and every event processed by wxWidgets. The filters are called in LIFO
+ // order and wxApp is registered as an event filter by default. The pointer
+ // must remain valid until it's removed with RemoveFilter() and is not
+ // deleted by wxEvtHandler.
+ static void AddFilter(wxEventFilter* filter);
+
+ // Remove a filter previously installed with AddFilter().
+ static void RemoveFilter(wxEventFilter* filter);
+
+
+ // Event queuing and processing
+ // ----------------------------
+
+ // Process an event right now: this can only be called from the main
+ // thread, use QueueEvent() for scheduling the events for
+ // processing from other threads.
+ virtual bool ProcessEvent(wxEvent& event);
+
+ // Process an event by calling ProcessEvent and handling any exceptions
+ // thrown by event handlers. It's mostly useful when processing wx events
+ // when called from C code (e.g. in GTK+ callback) when the exception
+ // wouldn't correctly propagate to wxEventLoop.
+ bool SafelyProcessEvent(wxEvent& event);
+ // NOTE: uses ProcessEvent()
+
+ // This method tries to process the event in this event handler, including
+ // any preprocessing done by TryBefore() and all the handlers chained to
+ // it, but excluding the post-processing done in TryAfter().
+ //
+ // It is meant to be called from ProcessEvent() only and is not virtual,
+ // additional event handlers can be hooked into the normal event processing
+ // logic using TryBefore() and TryAfter() hooks.
+ //
+ // You can also call it yourself to forward an event to another handler but
+ // without propagating it upwards if it's unhandled (this is usually
+ // unwanted when forwarding as the original handler would already do it if
+ // needed normally).
+ bool ProcessEventLocally(wxEvent& event);
+
+ // Schedule the given event to be processed later. It takes ownership of
+ // the event pointer, i.e. it will be deleted later. This is safe to call
+ // from multiple threads although you still need to ensure that wxString
+ // fields of the event object are deep copies and not use the same string
+ // buffer as other wxString objects in this thread.
+ virtual void QueueEvent(wxEvent *event);
+
+ // Add an event to be processed later: notice that this function is not
+ // safe to call from threads other than main, use QueueEvent()
+ virtual void AddPendingEvent(const wxEvent& event)
+ {
+ // notice that the thread-safety problem comes from the fact that
+ // Clone() doesn't make deep copies of wxString fields of wxEvent
+ // object and so the same wxString could be used from both threads when
+ // the event object is destroyed in this one -- QueueEvent() avoids
+ // this problem as the event pointer is not used any more in this
+ // thread at all after it is called.
+ QueueEvent(event.Clone());
+ }
+
+ void ProcessPendingEvents();
+ // NOTE: uses ProcessEvent()
+
+ void DeletePendingEvents();
+
+#if wxUSE_THREADS
+ bool ProcessThreadEvent(const wxEvent& event);
+ // NOTE: uses AddPendingEvent(); call only from secondary threads
+#endif
+
+#ifdef wxHAS_CALL_AFTER
+ // Asynchronous method calls: these methods schedule the given method
+ // pointer for a later call (during the next idle event loop iteration).
+ //
+ // Notice that the method is called on this object itself, so the object
+ // CallAfter() is called on must have the correct dynamic type.
+ //
+ // These method can be used from another thread.
+
+ template <typename T>
+ void CallAfter(void (T::*method)())
+ {
+ QueueEvent(
+ new wxAsyncMethodCallEvent0<T>(static_cast<T*>(this), method)
+ );
+ }
+
+ // Notice that we use P1 and not T1 for the parameter to allow passing
+ // parameters that are convertible to the type taken by the method
+ // instead of being exactly the same, to be closer to the usual method call
+ // semantics.
+ template <typename T, typename T1, typename P1>
+ void CallAfter(void (T::*method)(T1 x1), P1 x1)
+ {
+ QueueEvent(
+ new wxAsyncMethodCallEvent1<T, T1>(
+ static_cast<T*>(this), method, x1)
+ );
+ }
+
+ template <typename T, typename T1, typename T2, typename P1, typename P2>
+ void CallAfter(void (T::*method)(T1 x1, T2 x2), P1 x1, P2 x2)
+ {
+ QueueEvent(
+ new wxAsyncMethodCallEvent2<T, T1, T2>(
+ static_cast<T*>(this), method, x1, x2)
+ );
+ }
+
+ template <typename T>
+ void CallAfter(const T& fn)
+ {
+ QueueEvent(new wxAsyncMethodCallEventFunctor<T>(this, fn));
+ }
+#endif // wxHAS_CALL_AFTER
+
+
+ // Connecting and disconnecting
+ // ----------------------------
+
+ // These functions are used for old, untyped, event handlers and don't
+ // check that the type of the function passed to them actually matches the
+ // type of the event. They also only allow connecting events to methods of
+ // wxEvtHandler-derived classes.
+ //
+ // The template Connect() methods below are safer and allow connecting
+ // events to arbitrary functions or functors -- but require compiler
+ // support for templates.
+
+ // Dynamic association of a member function handler with the event handler,
+ // winid and event type
+ void Connect(int winid,
+ int lastId,
+ wxEventType eventType,
+ wxObjectEventFunction func,
+ wxObject *userData = NULL,
+ wxEvtHandler *eventSink = NULL)
+ {
+ DoBind(winid, lastId, eventType,
+ wxNewEventFunctor(eventType, func, eventSink),
+ userData);
+ }
+
+ // Convenience function: take just one id
+ void Connect(int winid,
+ wxEventType eventType,
+ wxObjectEventFunction func,
+ wxObject *userData = NULL,
+ wxEvtHandler *eventSink = NULL)
+ { Connect(winid, wxID_ANY, eventType, func, userData, eventSink); }
+
+ // Even more convenient: without id (same as using id of wxID_ANY)
+ void Connect(wxEventType eventType,
+ wxObjectEventFunction func,
+ wxObject *userData = NULL,
+ wxEvtHandler *eventSink = NULL)
+ { Connect(wxID_ANY, wxID_ANY, eventType, func, userData, eventSink); }
+
+ bool Disconnect(int winid,
+ int lastId,
+ wxEventType eventType,
+ wxObjectEventFunction func = NULL,
+ wxObject *userData = NULL,
+ wxEvtHandler *eventSink = NULL)
+ {
+ return DoUnbind(winid, lastId, eventType,
+ wxMakeEventFunctor(eventType, func, eventSink),
+ userData );
+ }
+
+ bool Disconnect(int winid = wxID_ANY,
+ wxEventType eventType = wxEVT_NULL,
+ wxObjectEventFunction func = NULL,
+ wxObject *userData = NULL,
+ wxEvtHandler *eventSink = NULL)
+ { return Disconnect(winid, wxID_ANY, eventType, func, userData, eventSink); }
+
+ bool Disconnect(wxEventType eventType,
+ wxObjectEventFunction func,
+ wxObject *userData = NULL,
+ wxEvtHandler *eventSink = NULL)
+ { return Disconnect(wxID_ANY, eventType, func, userData, eventSink); }
+
+#ifdef wxHAS_EVENT_BIND
+ // Bind functions to an event:
+ template <typename EventTag, typename EventArg>
+ void Bind(const EventTag& eventType,
+ void (*function)(EventArg &),
+ int winid = wxID_ANY,
+ int lastId = wxID_ANY,
+ wxObject *userData = NULL)
+ {
+ DoBind(winid, lastId, eventType,
+ wxNewEventFunctor(eventType, function),
+ userData);
+ }
+
+
+ template <typename EventTag, typename EventArg>
+ bool Unbind(const EventTag& eventType,
+ void (*function)(EventArg &),
+ int winid = wxID_ANY,
+ int lastId = wxID_ANY,
+ wxObject *userData = NULL)
+ {
+ return DoUnbind(winid, lastId, eventType,
+ wxMakeEventFunctor(eventType, function),
+ userData);
+ }
+
+ // Bind functors to an event:
+ template <typename EventTag, typename Functor>
+ void Bind(const EventTag& eventType,
+ const Functor &functor,
+ int winid = wxID_ANY,
+ int lastId = wxID_ANY,
+ wxObject *userData = NULL)
+ {
+ DoBind(winid, lastId, eventType,
+ wxNewEventFunctor(eventType, functor),
+ userData);
+ }
+
+
+ template <typename EventTag, typename Functor>
+ bool Unbind(const EventTag& eventType,
+ const Functor &functor,
+ int winid = wxID_ANY,
+ int lastId = wxID_ANY,
+ wxObject *userData = NULL)
+ {
+ return DoUnbind(winid, lastId, eventType,
+ wxMakeEventFunctor(eventType, functor),
+ userData);
+ }
+
+
+ // Bind a method of a class (called on the specified handler which must
+ // be convertible to this class) object to an event:
+
+ template <typename EventTag, typename Class, typename EventArg, typename EventHandler>
+ void Bind(const EventTag &eventType,
+ void (Class::*method)(EventArg &),
+ EventHandler *handler,
+ int winid = wxID_ANY,
+ int lastId = wxID_ANY,
+ wxObject *userData = NULL)
+ {
+ DoBind(winid, lastId, eventType,
+ wxNewEventFunctor(eventType, method, handler),
+ userData);
+ }
+
+ template <typename EventTag, typename Class, typename EventArg, typename EventHandler>
+ bool Unbind(const EventTag &eventType,
+ void (Class::*method)(EventArg&),
+ EventHandler *handler,
+ int winid = wxID_ANY,
+ int lastId = wxID_ANY,
+ wxObject *userData = NULL )
+ {
+ return DoUnbind(winid, lastId, eventType,
+ wxMakeEventFunctor(eventType, method, handler),
+ userData);
+ }
+#endif // wxHAS_EVENT_BIND
+
+ wxList* GetDynamicEventTable() const { return m_dynamicEvents ; }
+
+ // User data can be associated with each wxEvtHandler
+ void SetClientObject( wxClientData *data ) { DoSetClientObject(data); }
+ wxClientData *GetClientObject() const { return DoGetClientObject(); }
+
+ void SetClientData( void *data ) { DoSetClientData(data); }
+ void *GetClientData() const { return DoGetClientData(); }
+
+
+ // implementation from now on
+ // --------------------------
+
+ // check if the given event table entry matches this event by id (the check
+ // for the event type should be done by caller) and call the handler if it
+ // does
+ //
+ // return true if the event was processed, false otherwise (no match or the
+ // handler decided to skip the event)
+ static bool ProcessEventIfMatchesId(const wxEventTableEntryBase& tableEntry,
+ wxEvtHandler *handler,
+ wxEvent& event);
+
+ virtual bool SearchEventTable(wxEventTable& table, wxEvent& event);
+ bool SearchDynamicEventTable( wxEvent& event );
+
+ // Avoid problems at exit by cleaning up static hash table gracefully
+ void ClearEventHashTable() { GetEventHashTable().Clear(); }
+ void OnSinkDestroyed( wxEvtHandler *sink );
+
+
+private:
+ void DoBind(int winid,
+ int lastId,
+ wxEventType eventType,
+ wxEventFunctor *func,
+ wxObject* userData = NULL);
+
+ bool DoUnbind(int winid,
+ int lastId,
+ wxEventType eventType,
+ const wxEventFunctor& func,
+ wxObject *userData = NULL);
+
+ static const wxEventTableEntry sm_eventTableEntries[];
+
+protected:
+ // hooks for wxWindow used by ProcessEvent()
+ // -----------------------------------------
+
+ // this one is called before trying our own event table to allow plugging
+ // in the event handlers overriding the default logic, this is used by e.g.
+ // validators.
+ virtual bool TryBefore(wxEvent& event);
+
+ // This one is not a hook but just a helper which looks up the handler in
+ // this object itself.
+ //
+ // It is called from ProcessEventLocally() and normally shouldn't be called
+ // directly as doing it would ignore any chained event handlers
+ bool TryHereOnly(wxEvent& event);
+
+ // Another helper which simply calls pre-processing hook and then tries to
+ // handle the event at this handler level.
+ bool TryBeforeAndHere(wxEvent& event)
+ {
+ return TryBefore(event) || TryHereOnly(event);
+ }
+
+ // this one is called after failing to find the event handle in our own
+ // table to give a chance to the other windows to process it
+ //
+ // base class implementation passes the event to wxTheApp
+ virtual bool TryAfter(wxEvent& event);
+
+#if WXWIN_COMPATIBILITY_2_8
+ // deprecated method: override TryBefore() instead of this one
+ wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(
+ virtual bool TryValidator(wxEvent& WXUNUSED(event)), return false; )
+
+ wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(
+ virtual bool TryParent(wxEvent& event), return DoTryApp(event); )
+#endif // WXWIN_COMPATIBILITY_2_8
+
+
+ static const wxEventTable sm_eventTable;
+ virtual const wxEventTable *GetEventTable() const;
+
+ static wxEventHashTable sm_eventHashTable;
+ virtual wxEventHashTable& GetEventHashTable() const;
+
+ wxEvtHandler* m_nextHandler;
+ wxEvtHandler* m_previousHandler;
+ wxList* m_dynamicEvents;
+ wxList* m_pendingEvents;
+
+#if wxUSE_THREADS
+ // critical section protecting m_pendingEvents
+ wxCriticalSection m_pendingEventsLock;
+#endif // wxUSE_THREADS
+
+ // Is event handler enabled?
+ bool m_enabled;
+
+
+ // The user data: either an object which will be deleted by the container
+ // when it's deleted or some raw pointer which we do nothing with - only
+ // one type of data can be used with the given window (i.e. you cannot set
+ // the void data and then associate the container with wxClientData or vice
+ // versa)
+ union
+ {
+ wxClientData *m_clientObject;
+ void *m_clientData;
+ };
+
+ // what kind of data do we have?
+ wxClientDataType m_clientDataType;
+
+ // client data accessors
+ virtual void DoSetClientObject( wxClientData *data );
+ virtual wxClientData *DoGetClientObject() const;
+
+ virtual void DoSetClientData( void *data );
+ virtual void *DoGetClientData() const;
+
+ // Search tracker objects for event connection with this sink
+ wxEventConnectionRef *FindRefInTrackerList(wxEvtHandler *handler);
+
+private:
+ // pass the event to wxTheApp instance, called from TryAfter()
+ bool DoTryApp(wxEvent& event);
+
+ // try to process events in all handlers chained to this one
+ bool DoTryChain(wxEvent& event);
+
+ // Head of the event filter linked list.
+ static wxEventFilter* ms_filterList;
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxEvtHandler)
+};
+
+WX_DEFINE_ARRAY_WITH_DECL_PTR(wxEvtHandler *, wxEvtHandlerArray, class WXDLLIMPEXP_BASE);
+
+
+// Define an inline method of wxObjectEventFunctor which couldn't be defined
+// before wxEvtHandler declaration: at least Sun CC refuses to compile function
+// calls through pointer to member for forward-declared classes (see #12452).
+inline void wxObjectEventFunctor::operator()(wxEvtHandler *handler, wxEvent& event)
+{
+ wxEvtHandler * const realHandler = m_handler ? m_handler : handler;
+
+ (realHandler->*m_method)(event);
+}
+
+// ----------------------------------------------------------------------------
+// wxEventConnectionRef represents all connections between two event handlers
+// and enables automatic disconnect when an event handler sink goes out of
+// scope. Each connection/disconnect increases/decreases ref count, and
+// when it reaches zero the node goes out of scope.
+// ----------------------------------------------------------------------------
+
+class wxEventConnectionRef : public wxTrackerNode
+{
+public:
+ wxEventConnectionRef() : m_src(NULL), m_sink(NULL), m_refCount(0) { }
+ wxEventConnectionRef(wxEvtHandler *src, wxEvtHandler *sink)
+ : m_src(src), m_sink(sink), m_refCount(1)
+ {
+ m_sink->AddNode(this);
+ }
+
+ // The sink is being destroyed
+ virtual void OnObjectDestroy( )
+ {
+ if ( m_src )
+ m_src->OnSinkDestroyed( m_sink );
+ delete this;
+ }
+
+ virtual wxEventConnectionRef *ToEventConnection() { return this; }
+
+ void IncRef() { m_refCount++; }
+ void DecRef()
+ {
+ if ( !--m_refCount )
+ {
+ // The sink holds the only external pointer to this object
+ if ( m_sink )
+ m_sink->RemoveNode(this);
+ delete this;
+ }
+ }
+
+private:
+ wxEvtHandler *m_src,
+ *m_sink;
+ int m_refCount;
+
+ friend class wxEvtHandler;
+
+ wxDECLARE_NO_ASSIGN_CLASS(wxEventConnectionRef);
+};
+
+// Post a message to the given event handler which will be processed during the
+// next event loop iteration.
+//
+// Notice that this one is not thread-safe, use wxQueueEvent()
+inline void wxPostEvent(wxEvtHandler *dest, const wxEvent& event)
+{
+ wxCHECK_RET( dest, "need an object to post event to" );
+
+ dest->AddPendingEvent(event);
+}
+
+// Wrapper around wxEvtHandler::QueueEvent(): adds an event for later
+// processing, unlike wxPostEvent it is safe to use from different thread even
+// for events with wxString members
+inline void wxQueueEvent(wxEvtHandler *dest, wxEvent *event)
+{
+ wxCHECK_RET( dest, "need an object to queue event for" );
+
+ dest->QueueEvent(event);
+}
+
+typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
+typedef void (wxEvtHandler::*wxIdleEventFunction)(wxIdleEvent&);
+typedef void (wxEvtHandler::*wxThreadEventFunction)(wxThreadEvent&);
+
+#define wxEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxEventFunction, func)
+#define wxIdleEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxIdleEventFunction, func)
+#define wxThreadEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxThreadEventFunction, func)
+
+#if wxUSE_GUI
+
+// ----------------------------------------------------------------------------
+// wxEventBlocker: helper class to temporarily disable event handling for a window
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxEventBlocker : public wxEvtHandler
+{
+public:
+ wxEventBlocker(wxWindow *win, wxEventType type = wxEVT_ANY);
+ virtual ~wxEventBlocker();
+
+ void Block(wxEventType type)
+ {
+ m_eventsToBlock.push_back(type);
+ }
+
+ virtual bool ProcessEvent(wxEvent& event);
+
+protected:
+ wxArrayInt m_eventsToBlock;
+ wxWindow *m_window;
+
+ wxDECLARE_NO_COPY_CLASS(wxEventBlocker);
+};
+
+typedef void (wxEvtHandler::*wxCommandEventFunction)(wxCommandEvent&);
+typedef void (wxEvtHandler::*wxScrollEventFunction)(wxScrollEvent&);
+typedef void (wxEvtHandler::*wxScrollWinEventFunction)(wxScrollWinEvent&);
+typedef void (wxEvtHandler::*wxSizeEventFunction)(wxSizeEvent&);
+typedef void (wxEvtHandler::*wxMoveEventFunction)(wxMoveEvent&);
+typedef void (wxEvtHandler::*wxPaintEventFunction)(wxPaintEvent&);
+typedef void (wxEvtHandler::*wxNcPaintEventFunction)(wxNcPaintEvent&);
+typedef void (wxEvtHandler::*wxEraseEventFunction)(wxEraseEvent&);
+typedef void (wxEvtHandler::*wxMouseEventFunction)(wxMouseEvent&);
+typedef void (wxEvtHandler::*wxCharEventFunction)(wxKeyEvent&);
+typedef void (wxEvtHandler::*wxFocusEventFunction)(wxFocusEvent&);
+typedef void (wxEvtHandler::*wxChildFocusEventFunction)(wxChildFocusEvent&);
+typedef void (wxEvtHandler::*wxActivateEventFunction)(wxActivateEvent&);
+typedef void (wxEvtHandler::*wxMenuEventFunction)(wxMenuEvent&);
+typedef void (wxEvtHandler::*wxJoystickEventFunction)(wxJoystickEvent&);
+typedef void (wxEvtHandler::*wxDropFilesEventFunction)(wxDropFilesEvent&);
+typedef void (wxEvtHandler::*wxInitDialogEventFunction)(wxInitDialogEvent&);
+typedef void (wxEvtHandler::*wxSysColourChangedEventFunction)(wxSysColourChangedEvent&);
+typedef void (wxEvtHandler::*wxDisplayChangedEventFunction)(wxDisplayChangedEvent&);
+typedef void (wxEvtHandler::*wxUpdateUIEventFunction)(wxUpdateUIEvent&);
+typedef void (wxEvtHandler::*wxCloseEventFunction)(wxCloseEvent&);
+typedef void (wxEvtHandler::*wxShowEventFunction)(wxShowEvent&);
+typedef void (wxEvtHandler::*wxIconizeEventFunction)(wxIconizeEvent&);
+typedef void (wxEvtHandler::*wxMaximizeEventFunction)(wxMaximizeEvent&);
+typedef void (wxEvtHandler::*wxNavigationKeyEventFunction)(wxNavigationKeyEvent&);
+typedef void (wxEvtHandler::*wxPaletteChangedEventFunction)(wxPaletteChangedEvent&);
+typedef void (wxEvtHandler::*wxQueryNewPaletteEventFunction)(wxQueryNewPaletteEvent&);
+typedef void (wxEvtHandler::*wxWindowCreateEventFunction)(wxWindowCreateEvent&);
+typedef void (wxEvtHandler::*wxWindowDestroyEventFunction)(wxWindowDestroyEvent&);
+typedef void (wxEvtHandler::*wxSetCursorEventFunction)(wxSetCursorEvent&);
+typedef void (wxEvtHandler::*wxNotifyEventFunction)(wxNotifyEvent&);
+typedef void (wxEvtHandler::*wxHelpEventFunction)(wxHelpEvent&);
+typedef void (wxEvtHandler::*wxContextMenuEventFunction)(wxContextMenuEvent&);
+typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureChangedEvent&);
+typedef void (wxEvtHandler::*wxMouseCaptureLostEventFunction)(wxMouseCaptureLostEvent&);
+typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent&);
+
+
+#define wxCommandEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxCommandEventFunction, func)
+#define wxScrollEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxScrollEventFunction, func)
+#define wxScrollWinEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxScrollWinEventFunction, func)
+#define wxSizeEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxSizeEventFunction, func)
+#define wxMoveEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxMoveEventFunction, func)
+#define wxPaintEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxPaintEventFunction, func)
+#define wxNcPaintEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxNcPaintEventFunction, func)
+#define wxEraseEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxEraseEventFunction, func)
+#define wxMouseEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxMouseEventFunction, func)
+#define wxCharEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxCharEventFunction, func)
+#define wxKeyEventHandler(func) wxCharEventHandler(func)
+#define wxFocusEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxFocusEventFunction, func)
+#define wxChildFocusEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxChildFocusEventFunction, func)
+#define wxActivateEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxActivateEventFunction, func)
+#define wxMenuEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxMenuEventFunction, func)
+#define wxJoystickEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxJoystickEventFunction, func)
+#define wxDropFilesEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxDropFilesEventFunction, func)
+#define wxInitDialogEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxInitDialogEventFunction, func)
+#define wxSysColourChangedEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxSysColourChangedEventFunction, func)
+#define wxDisplayChangedEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxDisplayChangedEventFunction, func)
+#define wxUpdateUIEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxUpdateUIEventFunction, func)
+#define wxCloseEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxCloseEventFunction, func)
+#define wxShowEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxShowEventFunction, func)
+#define wxIconizeEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxIconizeEventFunction, func)
+#define wxMaximizeEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxMaximizeEventFunction, func)
+#define wxNavigationKeyEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxNavigationKeyEventFunction, func)
+#define wxPaletteChangedEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxPaletteChangedEventFunction, func)
+#define wxQueryNewPaletteEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxQueryNewPaletteEventFunction, func)
+#define wxWindowCreateEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxWindowCreateEventFunction, func)
+#define wxWindowDestroyEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxWindowDestroyEventFunction, func)
+#define wxSetCursorEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxSetCursorEventFunction, func)
+#define wxNotifyEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxNotifyEventFunction, func)
+#define wxHelpEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxHelpEventFunction, func)
+#define wxContextMenuEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxContextMenuEventFunction, func)
+#define wxMouseCaptureChangedEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxMouseCaptureChangedEventFunction, func)
+#define wxMouseCaptureLostEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxMouseCaptureLostEventFunction, func)
+#define wxClipboardTextEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxClipboardTextEventFunction, func)
+
+#endif // wxUSE_GUI
+
+// N.B. In GNU-WIN32, you *have* to take the address of a member function
+// (use &) or the compiler crashes...
+
+#define wxDECLARE_EVENT_TABLE() \
+ private: \
+ static const wxEventTableEntry sm_eventTableEntries[]; \
+ protected: \
+ static const wxEventTable sm_eventTable; \
+ virtual const wxEventTable* GetEventTable() const; \
+ static wxEventHashTable sm_eventHashTable; \
+ virtual wxEventHashTable& GetEventHashTable() const
+
+// N.B.: when building DLL with Borland C++ 5.5 compiler, you must initialize
+// sm_eventTable before using it in GetEventTable() or the compiler gives
+// E2233 (see http://groups.google.com/groups?selm=397dcc8a%241_2%40dnews)
+
+#define wxBEGIN_EVENT_TABLE(theClass, baseClass) \
+ const wxEventTable theClass::sm_eventTable = \
+ { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \
+ const wxEventTable *theClass::GetEventTable() const \
+ { return &theClass::sm_eventTable; } \
+ wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \
+ wxEventHashTable &theClass::GetEventHashTable() const \
+ { return theClass::sm_eventHashTable; } \
+ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
+
+#define wxBEGIN_EVENT_TABLE_TEMPLATE1(theClass, baseClass, T1) \
+ template<typename T1> \
+ const wxEventTable theClass<T1>::sm_eventTable = \
+ { &baseClass::sm_eventTable, &theClass<T1>::sm_eventTableEntries[0] }; \
+ template<typename T1> \
+ const wxEventTable *theClass<T1>::GetEventTable() const \
+ { return &theClass<T1>::sm_eventTable; } \
+ template<typename T1> \
+ wxEventHashTable theClass<T1>::sm_eventHashTable(theClass<T1>::sm_eventTable); \
+ template<typename T1> \
+ wxEventHashTable &theClass<T1>::GetEventHashTable() const \
+ { return theClass<T1>::sm_eventHashTable; } \
+ template<typename T1> \
+ const wxEventTableEntry theClass<T1>::sm_eventTableEntries[] = { \
+
+#define wxBEGIN_EVENT_TABLE_TEMPLATE2(theClass, baseClass, T1, T2) \
+ template<typename T1, typename T2> \
+ const wxEventTable theClass<T1, T2>::sm_eventTable = \
+ { &baseClass::sm_eventTable, &theClass<T1, T2>::sm_eventTableEntries[0] }; \
+ template<typename T1, typename T2> \
+ const wxEventTable *theClass<T1, T2>::GetEventTable() const \
+ { return &theClass<T1, T2>::sm_eventTable; } \
+ template<typename T1, typename T2> \
+ wxEventHashTable theClass<T1, T2>::sm_eventHashTable(theClass<T1, T2>::sm_eventTable); \
+ template<typename T1, typename T2> \
+ wxEventHashTable &theClass<T1, T2>::GetEventHashTable() const \
+ { return theClass<T1, T2>::sm_eventHashTable; } \
+ template<typename T1, typename T2> \
+ const wxEventTableEntry theClass<T1, T2>::sm_eventTableEntries[] = { \
+
+#define wxBEGIN_EVENT_TABLE_TEMPLATE3(theClass, baseClass, T1, T2, T3) \
+ template<typename T1, typename T2, typename T3> \
+ const wxEventTable theClass<T1, T2, T3>::sm_eventTable = \
+ { &baseClass::sm_eventTable, &theClass<T1, T2, T3>::sm_eventTableEntries[0] }; \
+ template<typename T1, typename T2, typename T3> \
+ const wxEventTable *theClass<T1, T2, T3>::GetEventTable() const \
+ { return &theClass<T1, T2, T3>::sm_eventTable; } \
+ template<typename T1, typename T2, typename T3> \
+ wxEventHashTable theClass<T1, T2, T3>::sm_eventHashTable(theClass<T1, T2, T3>::sm_eventTable); \
+ template<typename T1, typename T2, typename T3> \
+ wxEventHashTable &theClass<T1, T2, T3>::GetEventHashTable() const \
+ { return theClass<T1, T2, T3>::sm_eventHashTable; } \
+ template<typename T1, typename T2, typename T3> \
+ const wxEventTableEntry theClass<T1, T2, T3>::sm_eventTableEntries[] = { \
+
+#define wxBEGIN_EVENT_TABLE_TEMPLATE4(theClass, baseClass, T1, T2, T3, T4) \
+ template<typename T1, typename T2, typename T3, typename T4> \
+ const wxEventTable theClass<T1, T2, T3, T4>::sm_eventTable = \
+ { &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4>::sm_eventTableEntries[0] }; \
+ template<typename T1, typename T2, typename T3, typename T4> \
+ const wxEventTable *theClass<T1, T2, T3, T4>::GetEventTable() const \
+ { return &theClass<T1, T2, T3, T4>::sm_eventTable; } \
+ template<typename T1, typename T2, typename T3, typename T4> \
+ wxEventHashTable theClass<T1, T2, T3, T4>::sm_eventHashTable(theClass<T1, T2, T3, T4>::sm_eventTable); \
+ template<typename T1, typename T2, typename T3, typename T4> \
+ wxEventHashTable &theClass<T1, T2, T3, T4>::GetEventHashTable() const \
+ { return theClass<T1, T2, T3, T4>::sm_eventHashTable; } \
+ template<typename T1, typename T2, typename T3, typename T4> \
+ const wxEventTableEntry theClass<T1, T2, T3, T4>::sm_eventTableEntries[] = { \
+
+#define wxBEGIN_EVENT_TABLE_TEMPLATE5(theClass, baseClass, T1, T2, T3, T4, T5) \
+ template<typename T1, typename T2, typename T3, typename T4, typename T5> \
+ const wxEventTable theClass<T1, T2, T3, T4, T5>::sm_eventTable = \
+ { &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4, T5>::sm_eventTableEntries[0] }; \
+ template<typename T1, typename T2, typename T3, typename T4, typename T5> \
+ const wxEventTable *theClass<T1, T2, T3, T4, T5>::GetEventTable() const \
+ { return &theClass<T1, T2, T3, T4, T5>::sm_eventTable; } \
+ template<typename T1, typename T2, typename T3, typename T4, typename T5> \
+ wxEventHashTable theClass<T1, T2, T3, T4, T5>::sm_eventHashTable(theClass<T1, T2, T3, T4, T5>::sm_eventTable); \
+ template<typename T1, typename T2, typename T3, typename T4, typename T5> \
+ wxEventHashTable &theClass<T1, T2, T3, T4, T5>::GetEventHashTable() const \
+ { return theClass<T1, T2, T3, T4, T5>::sm_eventHashTable; } \
+ template<typename T1, typename T2, typename T3, typename T4, typename T5> \
+ const wxEventTableEntry theClass<T1, T2, T3, T4, T5>::sm_eventTableEntries[] = { \
+
+#define wxBEGIN_EVENT_TABLE_TEMPLATE7(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7) \
+ template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
+ const wxEventTable theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTable = \
+ { &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTableEntries[0] }; \
+ template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
+ const wxEventTable *theClass<T1, T2, T3, T4, T5, T6, T7>::GetEventTable() const \
+ { return &theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTable; } \
+ template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
+ wxEventHashTable theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventHashTable(theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTable); \
+ template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
+ wxEventHashTable &theClass<T1, T2, T3, T4, T5, T6, T7>::GetEventHashTable() const \
+ { return theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventHashTable; } \
+ template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
+ const wxEventTableEntry theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTableEntries[] = { \
+
+#define wxBEGIN_EVENT_TABLE_TEMPLATE8(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7, T8) \
+ template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
+ const wxEventTable theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTable = \
+ { &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTableEntries[0] }; \
+ template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
+ const wxEventTable *theClass<T1, T2, T3, T4, T5, T6, T7, T8>::GetEventTable() const \
+ { return &theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTable; } \
+ template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
+ wxEventHashTable theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventHashTable(theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTable); \
+ template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
+ wxEventHashTable &theClass<T1, T2, T3, T4, T5, T6, T7, T8>::GetEventHashTable() const \
+ { return theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventHashTable; } \
+ template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
+ const wxEventTableEntry theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTableEntries[] = { \
+
+#define wxEND_EVENT_TABLE() \
+ wxDECLARE_EVENT_TABLE_TERMINATOR() };
+
+/*
+ * Event table macros
+ */
+
+// helpers for writing shorter code below: declare an event macro taking 2, 1
+// or none ids (the missing ids default to wxID_ANY)
+//
+// macro arguments:
+// - evt one of wxEVT_XXX constants
+// - id1, id2 ids of the first/last id
+// - fn the function (should be cast to the right type)
+#define wx__DECLARE_EVT2(evt, id1, id2, fn) \
+ wxDECLARE_EVENT_TABLE_ENTRY(evt, id1, id2, fn, NULL),
+#define wx__DECLARE_EVT1(evt, id, fn) \
+ wx__DECLARE_EVT2(evt, id, wxID_ANY, fn)
+#define wx__DECLARE_EVT0(evt, fn) \
+ wx__DECLARE_EVT1(evt, wxID_ANY, fn)
+
+
+// Generic events
+#define EVT_CUSTOM(event, winid, func) \
+ wx__DECLARE_EVT1(event, winid, wxEventHandler(func))
+#define EVT_CUSTOM_RANGE(event, id1, id2, func) \
+ wx__DECLARE_EVT2(event, id1, id2, wxEventHandler(func))
+
+// EVT_COMMAND
+#define EVT_COMMAND(winid, event, func) \
+ wx__DECLARE_EVT1(event, winid, wxCommandEventHandler(func))
+
+#define EVT_COMMAND_RANGE(id1, id2, event, func) \
+ wx__DECLARE_EVT2(event, id1, id2, wxCommandEventHandler(func))
+
+#define EVT_NOTIFY(event, winid, func) \
+ wx__DECLARE_EVT1(event, winid, wxNotifyEventHandler(func))
+
+#define EVT_NOTIFY_RANGE(event, id1, id2, func) \
+ wx__DECLARE_EVT2(event, id1, id2, wxNotifyEventHandler(func))
+
+// Miscellaneous
+#define EVT_SIZE(func) wx__DECLARE_EVT0(wxEVT_SIZE, wxSizeEventHandler(func))
+#define EVT_SIZING(func) wx__DECLARE_EVT0(wxEVT_SIZING, wxSizeEventHandler(func))
+#define EVT_MOVE(func) wx__DECLARE_EVT0(wxEVT_MOVE, wxMoveEventHandler(func))
+#define EVT_MOVING(func) wx__DECLARE_EVT0(wxEVT_MOVING, wxMoveEventHandler(func))
+#define EVT_MOVE_START(func) wx__DECLARE_EVT0(wxEVT_MOVE_START, wxMoveEventHandler(func))
+#define EVT_MOVE_END(func) wx__DECLARE_EVT0(wxEVT_MOVE_END, wxMoveEventHandler(func))
+#define EVT_CLOSE(func) wx__DECLARE_EVT0(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(func))
+#define EVT_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func))
+#define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func))
+#define EVT_PAINT(func) wx__DECLARE_EVT0(wxEVT_PAINT, wxPaintEventHandler(func))
+#define EVT_NC_PAINT(func) wx__DECLARE_EVT0(wxEVT_NC_PAINT, wxNcPaintEventHandler(func))
+#define EVT_ERASE_BACKGROUND(func) wx__DECLARE_EVT0(wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(func))
+#define EVT_CHAR(func) wx__DECLARE_EVT0(wxEVT_CHAR, wxCharEventHandler(func))
+#define EVT_KEY_DOWN(func) wx__DECLARE_EVT0(wxEVT_KEY_DOWN, wxKeyEventHandler(func))
+#define EVT_KEY_UP(func) wx__DECLARE_EVT0(wxEVT_KEY_UP, wxKeyEventHandler(func))
+#if wxUSE_HOTKEY
+#define EVT_HOTKEY(winid, func) wx__DECLARE_EVT1(wxEVT_HOTKEY, winid, wxCharEventHandler(func))
+#endif
+#define EVT_CHAR_HOOK(func) wx__DECLARE_EVT0(wxEVT_CHAR_HOOK, wxCharEventHandler(func))
+#define EVT_MENU_OPEN(func) wx__DECLARE_EVT0(wxEVT_MENU_OPEN, wxMenuEventHandler(func))
+#define EVT_MENU_CLOSE(func) wx__DECLARE_EVT0(wxEVT_MENU_CLOSE, wxMenuEventHandler(func))
+#define EVT_MENU_HIGHLIGHT(winid, func) wx__DECLARE_EVT1(wxEVT_MENU_HIGHLIGHT, winid, wxMenuEventHandler(func))
+#define EVT_MENU_HIGHLIGHT_ALL(func) wx__DECLARE_EVT0(wxEVT_MENU_HIGHLIGHT, wxMenuEventHandler(func))
+#define EVT_SET_FOCUS(func) wx__DECLARE_EVT0(wxEVT_SET_FOCUS, wxFocusEventHandler(func))
+#define EVT_KILL_FOCUS(func) wx__DECLARE_EVT0(wxEVT_KILL_FOCUS, wxFocusEventHandler(func))
+#define EVT_CHILD_FOCUS(func) wx__DECLARE_EVT0(wxEVT_CHILD_FOCUS, wxChildFocusEventHandler(func))
+#define EVT_ACTIVATE(func) wx__DECLARE_EVT0(wxEVT_ACTIVATE, wxActivateEventHandler(func))
+#define EVT_ACTIVATE_APP(func) wx__DECLARE_EVT0(wxEVT_ACTIVATE_APP, wxActivateEventHandler(func))
+#define EVT_HIBERNATE(func) wx__DECLARE_EVT0(wxEVT_HIBERNATE, wxActivateEventHandler(func))
+#define EVT_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func))
+#define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func))
+#define EVT_DROP_FILES(func) wx__DECLARE_EVT0(wxEVT_DROP_FILES, wxDropFilesEventHandler(func))
+#define EVT_INIT_DIALOG(func) wx__DECLARE_EVT0(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(func))
+#define EVT_SYS_COLOUR_CHANGED(func) wx__DECLARE_EVT0(wxEVT_SYS_COLOUR_CHANGED, wxSysColourChangedEventHandler(func))
+#define EVT_DISPLAY_CHANGED(func) wx__DECLARE_EVT0(wxEVT_DISPLAY_CHANGED, wxDisplayChangedEventHandler(func))
+#define EVT_SHOW(func) wx__DECLARE_EVT0(wxEVT_SHOW, wxShowEventHandler(func))
+#define EVT_MAXIMIZE(func) wx__DECLARE_EVT0(wxEVT_MAXIMIZE, wxMaximizeEventHandler(func))
+#define EVT_ICONIZE(func) wx__DECLARE_EVT0(wxEVT_ICONIZE, wxIconizeEventHandler(func))
+#define EVT_NAVIGATION_KEY(func) wx__DECLARE_EVT0(wxEVT_NAVIGATION_KEY, wxNavigationKeyEventHandler(func))
+#define EVT_PALETTE_CHANGED(func) wx__DECLARE_EVT0(wxEVT_PALETTE_CHANGED, wxPaletteChangedEventHandler(func))
+#define EVT_QUERY_NEW_PALETTE(func) wx__DECLARE_EVT0(wxEVT_QUERY_NEW_PALETTE, wxQueryNewPaletteEventHandler(func))
+#define EVT_WINDOW_CREATE(func) wx__DECLARE_EVT0(wxEVT_CREATE, wxWindowCreateEventHandler(func))
+#define EVT_WINDOW_DESTROY(func) wx__DECLARE_EVT0(wxEVT_DESTROY, wxWindowDestroyEventHandler(func))
+#define EVT_SET_CURSOR(func) wx__DECLARE_EVT0(wxEVT_SET_CURSOR, wxSetCursorEventHandler(func))
+#define EVT_MOUSE_CAPTURE_CHANGED(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_CHANGED, wxMouseCaptureChangedEventHandler(func))
+#define EVT_MOUSE_CAPTURE_LOST(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEventHandler(func))
+
+// Mouse events
+#define EVT_LEFT_DOWN(func) wx__DECLARE_EVT0(wxEVT_LEFT_DOWN, wxMouseEventHandler(func))
+#define EVT_LEFT_UP(func) wx__DECLARE_EVT0(wxEVT_LEFT_UP, wxMouseEventHandler(func))
+#define EVT_MIDDLE_DOWN(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_DOWN, wxMouseEventHandler(func))
+#define EVT_MIDDLE_UP(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_UP, wxMouseEventHandler(func))
+#define EVT_RIGHT_DOWN(func) wx__DECLARE_EVT0(wxEVT_RIGHT_DOWN, wxMouseEventHandler(func))
+#define EVT_RIGHT_UP(func) wx__DECLARE_EVT0(wxEVT_RIGHT_UP, wxMouseEventHandler(func))
+#define EVT_MOTION(func) wx__DECLARE_EVT0(wxEVT_MOTION, wxMouseEventHandler(func))
+#define EVT_LEFT_DCLICK(func) wx__DECLARE_EVT0(wxEVT_LEFT_DCLICK, wxMouseEventHandler(func))
+#define EVT_MIDDLE_DCLICK(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_DCLICK, wxMouseEventHandler(func))
+#define EVT_RIGHT_DCLICK(func) wx__DECLARE_EVT0(wxEVT_RIGHT_DCLICK, wxMouseEventHandler(func))
+#define EVT_LEAVE_WINDOW(func) wx__DECLARE_EVT0(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(func))
+#define EVT_ENTER_WINDOW(func) wx__DECLARE_EVT0(wxEVT_ENTER_WINDOW, wxMouseEventHandler(func))
+#define EVT_MOUSEWHEEL(func) wx__DECLARE_EVT0(wxEVT_MOUSEWHEEL, wxMouseEventHandler(func))
+#define EVT_MOUSE_AUX1_DOWN(func) wx__DECLARE_EVT0(wxEVT_AUX1_DOWN, wxMouseEventHandler(func))
+#define EVT_MOUSE_AUX1_UP(func) wx__DECLARE_EVT0(wxEVT_AUX1_UP, wxMouseEventHandler(func))
+#define EVT_MOUSE_AUX1_DCLICK(func) wx__DECLARE_EVT0(wxEVT_AUX1_DCLICK, wxMouseEventHandler(func))
+#define EVT_MOUSE_AUX2_DOWN(func) wx__DECLARE_EVT0(wxEVT_AUX2_DOWN, wxMouseEventHandler(func))
+#define EVT_MOUSE_AUX2_UP(func) wx__DECLARE_EVT0(wxEVT_AUX2_UP, wxMouseEventHandler(func))
+#define EVT_MOUSE_AUX2_DCLICK(func) wx__DECLARE_EVT0(wxEVT_AUX2_DCLICK, wxMouseEventHandler(func))
+
+// All mouse events
+#define EVT_MOUSE_EVENTS(func) \
+ EVT_LEFT_DOWN(func) \
+ EVT_LEFT_UP(func) \
+ EVT_LEFT_DCLICK(func) \
+ EVT_MIDDLE_DOWN(func) \
+ EVT_MIDDLE_UP(func) \
+ EVT_MIDDLE_DCLICK(func) \
+ EVT_RIGHT_DOWN(func) \
+ EVT_RIGHT_UP(func) \
+ EVT_RIGHT_DCLICK(func) \
+ EVT_MOUSE_AUX1_DOWN(func) \
+ EVT_MOUSE_AUX1_UP(func) \
+ EVT_MOUSE_AUX1_DCLICK(func) \
+ EVT_MOUSE_AUX2_DOWN(func) \
+ EVT_MOUSE_AUX2_UP(func) \
+ EVT_MOUSE_AUX2_DCLICK(func) \
+ EVT_MOTION(func) \
+ EVT_LEAVE_WINDOW(func) \
+ EVT_ENTER_WINDOW(func) \
+ EVT_MOUSEWHEEL(func)
+
+// Scrolling from wxWindow (sent to wxScrolledWindow)
+#define EVT_SCROLLWIN_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_TOP, wxScrollWinEventHandler(func))
+#define EVT_SCROLLWIN_BOTTOM(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_BOTTOM, wxScrollWinEventHandler(func))
+#define EVT_SCROLLWIN_LINEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_LINEUP, wxScrollWinEventHandler(func))
+#define EVT_SCROLLWIN_LINEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_LINEDOWN, wxScrollWinEventHandler(func))
+#define EVT_SCROLLWIN_PAGEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_PAGEUP, wxScrollWinEventHandler(func))
+#define EVT_SCROLLWIN_PAGEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_PAGEDOWN, wxScrollWinEventHandler(func))
+#define EVT_SCROLLWIN_THUMBTRACK(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler(func))
+#define EVT_SCROLLWIN_THUMBRELEASE(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEventHandler(func))
+
+#define EVT_SCROLLWIN(func) \
+ EVT_SCROLLWIN_TOP(func) \
+ EVT_SCROLLWIN_BOTTOM(func) \
+ EVT_SCROLLWIN_LINEUP(func) \
+ EVT_SCROLLWIN_LINEDOWN(func) \
+ EVT_SCROLLWIN_PAGEUP(func) \
+ EVT_SCROLLWIN_PAGEDOWN(func) \
+ EVT_SCROLLWIN_THUMBTRACK(func) \
+ EVT_SCROLLWIN_THUMBRELEASE(func)
+
+// Scrolling from wxSlider and wxScrollBar
+#define EVT_SCROLL_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_TOP, wxScrollEventHandler(func))
+#define EVT_SCROLL_BOTTOM(func) wx__DECLARE_EVT0(wxEVT_SCROLL_BOTTOM, wxScrollEventHandler(func))
+#define EVT_SCROLL_LINEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_LINEUP, wxScrollEventHandler(func))
+#define EVT_SCROLL_LINEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler(func))
+#define EVT_SCROLL_PAGEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_PAGEUP, wxScrollEventHandler(func))
+#define EVT_SCROLL_PAGEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler(func))
+#define EVT_SCROLL_THUMBTRACK(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler(func))
+#define EVT_SCROLL_THUMBRELEASE(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler(func))
+#define EVT_SCROLL_CHANGED(func) wx__DECLARE_EVT0(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(func))
+
+#define EVT_SCROLL(func) \
+ EVT_SCROLL_TOP(func) \
+ EVT_SCROLL_BOTTOM(func) \
+ EVT_SCROLL_LINEUP(func) \
+ EVT_SCROLL_LINEDOWN(func) \
+ EVT_SCROLL_PAGEUP(func) \
+ EVT_SCROLL_PAGEDOWN(func) \
+ EVT_SCROLL_THUMBTRACK(func) \
+ EVT_SCROLL_THUMBRELEASE(func) \
+ EVT_SCROLL_CHANGED(func)
+
+// Scrolling from wxSlider and wxScrollBar, with an id
+#define EVT_COMMAND_SCROLL_TOP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_TOP, winid, wxScrollEventHandler(func))
+#define EVT_COMMAND_SCROLL_BOTTOM(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_BOTTOM, winid, wxScrollEventHandler(func))
+#define EVT_COMMAND_SCROLL_LINEUP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_LINEUP, winid, wxScrollEventHandler(func))
+#define EVT_COMMAND_SCROLL_LINEDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_LINEDOWN, winid, wxScrollEventHandler(func))
+#define EVT_COMMAND_SCROLL_PAGEUP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_PAGEUP, winid, wxScrollEventHandler(func))
+#define EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_PAGEDOWN, winid, wxScrollEventHandler(func))
+#define EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBTRACK, winid, wxScrollEventHandler(func))
+#define EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBRELEASE, winid, wxScrollEventHandler(func))
+#define EVT_COMMAND_SCROLL_CHANGED(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_CHANGED, winid, wxScrollEventHandler(func))
+
+#define EVT_COMMAND_SCROLL(winid, func) \
+ EVT_COMMAND_SCROLL_TOP(winid, func) \
+ EVT_COMMAND_SCROLL_BOTTOM(winid, func) \
+ EVT_COMMAND_SCROLL_LINEUP(winid, func) \
+ EVT_COMMAND_SCROLL_LINEDOWN(winid, func) \
+ EVT_COMMAND_SCROLL_PAGEUP(winid, func) \
+ EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) \
+ EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) \
+ EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) \
+ EVT_COMMAND_SCROLL_CHANGED(winid, func)
+
+#if WXWIN_COMPATIBILITY_2_6
+ // compatibility macros for the old name, deprecated in 2.8
+ #define wxEVT_SCROLL_ENDSCROLL wxEVT_SCROLL_CHANGED
+ #define EVT_COMMAND_SCROLL_ENDSCROLL EVT_COMMAND_SCROLL_CHANGED
+ #define EVT_SCROLL_ENDSCROLL EVT_SCROLL_CHANGED
+#endif // WXWIN_COMPATIBILITY_2_6
+
+// Convenience macros for commonly-used commands
+#define EVT_CHECKBOX(winid, func) wx__DECLARE_EVT1(wxEVT_CHECKBOX, winid, wxCommandEventHandler(func))
+#define EVT_CHOICE(winid, func) wx__DECLARE_EVT1(wxEVT_CHOICE, winid, wxCommandEventHandler(func))
+#define EVT_LISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_LISTBOX, winid, wxCommandEventHandler(func))
+#define EVT_LISTBOX_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_LISTBOX_DCLICK, winid, wxCommandEventHandler(func))
+#define EVT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_MENU, winid, wxCommandEventHandler(func))
+#define EVT_MENU_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_MENU, id1, id2, wxCommandEventHandler(func))
+#if defined(__SMARTPHONE__)
+# define EVT_BUTTON(winid, func) EVT_MENU(winid, func)
+#else
+# define EVT_BUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_BUTTON, winid, wxCommandEventHandler(func))
+#endif
+#define EVT_SLIDER(winid, func) wx__DECLARE_EVT1(wxEVT_SLIDER, winid, wxCommandEventHandler(func))
+#define EVT_RADIOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_RADIOBOX, winid, wxCommandEventHandler(func))
+#define EVT_RADIOBUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_RADIOBUTTON, winid, wxCommandEventHandler(func))
+// EVT_SCROLLBAR is now obsolete since we use EVT_COMMAND_SCROLL... events
+#define EVT_SCROLLBAR(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLLBAR, winid, wxCommandEventHandler(func))
+#define EVT_VLBOX(winid, func) wx__DECLARE_EVT1(wxEVT_VLBOX, winid, wxCommandEventHandler(func))
+#define EVT_COMBOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMBOBOX, winid, wxCommandEventHandler(func))
+#define EVT_TOOL(winid, func) wx__DECLARE_EVT1(wxEVT_TOOL, winid, wxCommandEventHandler(func))
+#define EVT_TOOL_DROPDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_TOOL_DROPDOWN, winid, wxCommandEventHandler(func))
+#define EVT_TOOL_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_TOOL, id1, id2, wxCommandEventHandler(func))
+#define EVT_TOOL_RCLICKED(winid, func) wx__DECLARE_EVT1(wxEVT_TOOL_RCLICKED, winid, wxCommandEventHandler(func))
+#define EVT_TOOL_RCLICKED_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_TOOL_RCLICKED, id1, id2, wxCommandEventHandler(func))
+#define EVT_TOOL_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_TOOL_ENTER, winid, wxCommandEventHandler(func))
+#define EVT_CHECKLISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_CHECKLISTBOX, winid, wxCommandEventHandler(func))
+#define EVT_COMBOBOX_DROPDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_COMBOBOX_DROPDOWN, winid, wxCommandEventHandler(func))
+#define EVT_COMBOBOX_CLOSEUP(winid, func) wx__DECLARE_EVT1(wxEVT_COMBOBOX_CLOSEUP, winid, wxCommandEventHandler(func))
+
+// Generic command events
+#define EVT_COMMAND_LEFT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_CLICK, winid, wxCommandEventHandler(func))
+#define EVT_COMMAND_LEFT_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_DCLICK, winid, wxCommandEventHandler(func))
+#define EVT_COMMAND_RIGHT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RIGHT_CLICK, winid, wxCommandEventHandler(func))
+#define EVT_COMMAND_RIGHT_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RIGHT_DCLICK, winid, wxCommandEventHandler(func))
+#define EVT_COMMAND_SET_FOCUS(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SET_FOCUS, winid, wxCommandEventHandler(func))
+#define EVT_COMMAND_KILL_FOCUS(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_KILL_FOCUS, winid, wxCommandEventHandler(func))
+#define EVT_COMMAND_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_ENTER, winid, wxCommandEventHandler(func))
+
+// Joystick events
+
+#define EVT_JOY_BUTTON_DOWN(func) wx__DECLARE_EVT0(wxEVT_JOY_BUTTON_DOWN, wxJoystickEventHandler(func))
+#define EVT_JOY_BUTTON_UP(func) wx__DECLARE_EVT0(wxEVT_JOY_BUTTON_UP, wxJoystickEventHandler(func))
+#define EVT_JOY_MOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_MOVE, wxJoystickEventHandler(func))
+#define EVT_JOY_ZMOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_ZMOVE, wxJoystickEventHandler(func))
+
+// All joystick events
+#define EVT_JOYSTICK_EVENTS(func) \
+ EVT_JOY_BUTTON_DOWN(func) \
+ EVT_JOY_BUTTON_UP(func) \
+ EVT_JOY_MOVE(func) \
+ EVT_JOY_ZMOVE(func)
+
+// Idle event
+#define EVT_IDLE(func) wx__DECLARE_EVT0(wxEVT_IDLE, wxIdleEventHandler(func))
+
+// Update UI event
+#define EVT_UPDATE_UI(winid, func) wx__DECLARE_EVT1(wxEVT_UPDATE_UI, winid, wxUpdateUIEventHandler(func))
+#define EVT_UPDATE_UI_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_UPDATE_UI, id1, id2, wxUpdateUIEventHandler(func))
+
+// Help events
+#define EVT_HELP(winid, func) wx__DECLARE_EVT1(wxEVT_HELP, winid, wxHelpEventHandler(func))
+#define EVT_HELP_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_HELP, id1, id2, wxHelpEventHandler(func))
+#define EVT_DETAILED_HELP(winid, func) wx__DECLARE_EVT1(wxEVT_DETAILED_HELP, winid, wxHelpEventHandler(func))
+#define EVT_DETAILED_HELP_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_DETAILED_HELP, id1, id2, wxHelpEventHandler(func))
+
+// Context Menu Events
+#define EVT_CONTEXT_MENU(func) wx__DECLARE_EVT0(wxEVT_CONTEXT_MENU, wxContextMenuEventHandler(func))
+#define EVT_COMMAND_CONTEXT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_CONTEXT_MENU, winid, wxContextMenuEventHandler(func))
+
+// Clipboard text Events
+#define EVT_TEXT_CUT(winid, func) wx__DECLARE_EVT1(wxEVT_TEXT_CUT, winid, wxClipboardTextEventHandler(func))
+#define EVT_TEXT_COPY(winid, func) wx__DECLARE_EVT1(wxEVT_TEXT_COPY, winid, wxClipboardTextEventHandler(func))
+#define EVT_TEXT_PASTE(winid, func) wx__DECLARE_EVT1(wxEVT_TEXT_PASTE, winid, wxClipboardTextEventHandler(func))
+
+// Thread events
+#define EVT_THREAD(id, func) wx__DECLARE_EVT1(wxEVT_THREAD, id, wxThreadEventHandler(func))
+
+// ----------------------------------------------------------------------------
+// Helper functions
+// ----------------------------------------------------------------------------
+
+// This is an ugly hack to allow the use of Bind() instead of Connect() inside
+// the library code if the library was built with support for it, here is how
+// it is used:
+//
+// class SomeEventHandlingClass : wxBIND_OR_CONNECT_HACK_BASE_CLASS
+// public SomeBaseClass
+// {
+// public:
+// SomeEventHandlingClass(wxWindow *win)
+// {
+// // connect to the event for the given window
+// wxBIND_OR_CONNECT_HACK(win, wxEVT_SOMETHING, wxSomeEventHandler,
+// SomeEventHandlingClass::OnSomeEvent, this);
+// }
+//
+// private:
+// void OnSomeEvent(wxSomeEvent&) { ... }
+// };
+//
+// This is *not* meant to be used by library users, it is only defined here
+// (and not in a private header) because the base class must be visible from
+// other public headers, please do NOT use this in your code, it will be
+// removed from future wx versions without warning.
+#ifdef wxHAS_EVENT_BIND
+ #define wxBIND_OR_CONNECT_HACK_BASE_CLASS
+ #define wxBIND_OR_CONNECT_HACK_ONLY_BASE_CLASS
+ #define wxBIND_OR_CONNECT_HACK(win, evt, handler, func, obj) \
+ win->Bind(evt, &func, obj)
+#else // wxHAS_EVENT_BIND
+ #define wxBIND_OR_CONNECT_HACK_BASE_CLASS public wxEvtHandler,
+ #define wxBIND_OR_CONNECT_HACK_ONLY_BASE_CLASS : public wxEvtHandler
+ #define wxBIND_OR_CONNECT_HACK(win, evt, handler, func, obj) \
+ win->Connect(evt, handler(func), NULL, obj)
+#endif // wxHAS_EVENT_BIND
+
+#if wxUSE_GUI
+
+// Find a window with the focus, that is also a descendant of the given window.
+// This is used to determine the window to initially send commands to.
+WXDLLIMPEXP_CORE wxWindow* wxFindFocusDescendant(wxWindow* ancestor);
+
+#endif // wxUSE_GUI
+
+
+// ----------------------------------------------------------------------------
+// Compatibility macro aliases
+// ----------------------------------------------------------------------------
+
+// deprecated variants _not_ requiring a semicolon after them and without wx prefix
+// (note that also some wx-prefixed macro do _not_ require a semicolon because
+// it's not always possible to force the compire to require it)
+
+#define DECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \
+ wxDECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj)
+#define DECLARE_EVENT_TABLE_TERMINATOR() wxDECLARE_EVENT_TABLE_TERMINATOR()
+#define DECLARE_EVENT_TABLE() wxDECLARE_EVENT_TABLE();
+#define BEGIN_EVENT_TABLE(a,b) wxBEGIN_EVENT_TABLE(a,b)
+#define BEGIN_EVENT_TABLE_TEMPLATE1(a,b,c) wxBEGIN_EVENT_TABLE_TEMPLATE1(a,b,c)
+#define BEGIN_EVENT_TABLE_TEMPLATE2(a,b,c,d) wxBEGIN_EVENT_TABLE_TEMPLATE2(a,b,c,d)
+#define BEGIN_EVENT_TABLE_TEMPLATE3(a,b,c,d,e) wxBEGIN_EVENT_TABLE_TEMPLATE3(a,b,c,d,e)
+#define BEGIN_EVENT_TABLE_TEMPLATE4(a,b,c,d,e,f) wxBEGIN_EVENT_TABLE_TEMPLATE4(a,b,c,d,e,f)
+#define BEGIN_EVENT_TABLE_TEMPLATE5(a,b,c,d,e,f,g) wxBEGIN_EVENT_TABLE_TEMPLATE5(a,b,c,d,e,f,g)
+#define BEGIN_EVENT_TABLE_TEMPLATE6(a,b,c,d,e,f,g,h) wxBEGIN_EVENT_TABLE_TEMPLATE6(a,b,c,d,e,f,g,h)
+#define END_EVENT_TABLE() wxEND_EVENT_TABLE()
+
+// other obsolete event declaration/definition macros; we don't need them any longer
+// but we keep them for compatibility as it doesn't cost us anything anyhow
+#define BEGIN_DECLARE_EVENT_TYPES()
+#define END_DECLARE_EVENT_TYPES()
+#define DECLARE_EXPORTED_EVENT_TYPE(expdecl, name, value) \
+ extern expdecl const wxEventType name;
+#define DECLARE_EVENT_TYPE(name, value) \
+ DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, name, value)
+#define DECLARE_LOCAL_EVENT_TYPE(name, value) \
+ DECLARE_EXPORTED_EVENT_TYPE(wxEMPTY_PARAMETER_VALUE, name, value)
+#define DEFINE_EVENT_TYPE(name) const wxEventType name = wxNewEventType();
+#define DEFINE_LOCAL_EVENT_TYPE(name) DEFINE_EVENT_TYPE(name)
+
+// alias for backward compatibility with 2.9.0:
+#define wxEVT_COMMAND_THREAD wxEVT_THREAD
+// other old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_BUTTON_CLICKED wxEVT_BUTTON
+#define wxEVT_COMMAND_CHECKBOX_CLICKED wxEVT_CHECKBOX
+#define wxEVT_COMMAND_CHOICE_SELECTED wxEVT_CHOICE
+#define wxEVT_COMMAND_LISTBOX_SELECTED wxEVT_LISTBOX
+#define wxEVT_COMMAND_LISTBOX_DOUBLECLICKED wxEVT_LISTBOX_DCLICK
+#define wxEVT_COMMAND_CHECKLISTBOX_TOGGLED wxEVT_CHECKLISTBOX
+#define wxEVT_COMMAND_MENU_SELECTED wxEVT_MENU
+#define wxEVT_COMMAND_TOOL_CLICKED wxEVT_TOOL
+#define wxEVT_COMMAND_SLIDER_UPDATED wxEVT_SLIDER
+#define wxEVT_COMMAND_RADIOBOX_SELECTED wxEVT_RADIOBOX
+#define wxEVT_COMMAND_RADIOBUTTON_SELECTED wxEVT_RADIOBUTTON
+#define wxEVT_COMMAND_SCROLLBAR_UPDATED wxEVT_SCROLLBAR
+#define wxEVT_COMMAND_VLBOX_SELECTED wxEVT_VLBOX
+#define wxEVT_COMMAND_COMBOBOX_SELECTED wxEVT_COMBOBOX
+#define wxEVT_COMMAND_TOOL_RCLICKED wxEVT_TOOL_RCLICKED
+#define wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED wxEVT_TOOL_DROPDOWN
+#define wxEVT_COMMAND_TOOL_ENTER wxEVT_TOOL_ENTER
+#define wxEVT_COMMAND_COMBOBOX_DROPDOWN wxEVT_COMBOBOX_DROPDOWN
+#define wxEVT_COMMAND_COMBOBOX_CLOSEUP wxEVT_COMBOBOX_CLOSEUP
+#define wxEVT_COMMAND_TEXT_COPY wxEVT_TEXT_COPY
+#define wxEVT_COMMAND_TEXT_CUT wxEVT_TEXT_CUT
+#define wxEVT_COMMAND_TEXT_PASTE wxEVT_TEXT_PASTE
+#define wxEVT_COMMAND_TEXT_UPDATED wxEVT_TEXT
+
+#endif // _WX_EVENT_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/eventfilter.h
+// Purpose: wxEventFilter class declaration.
+// Author: Vadim Zeitlin
+// Created: 2011-11-21
+// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_EVENTFILTER_H_
+#define _WX_EVENTFILTER_H_
+
+#include "wx/defs.h"
+
+class WXDLLIMPEXP_FWD_BASE wxEvent;
+class WXDLLIMPEXP_FWD_BASE wxEvtHandler;
+
+// ----------------------------------------------------------------------------
+// wxEventFilter is used with wxEvtHandler::AddFilter() and ProcessEvent().
+// ----------------------------------------------------------------------------
+
+class wxEventFilter
+{
+public:
+ // Possible return values for FilterEvent().
+ //
+ // Notice that the values of these enum elements are fixed due to backwards
+ // compatibility constraints.
+ enum
+ {
+ // Process event as usual.
+ Event_Skip = -1,
+
+ // Don't process the event normally at all.
+ Event_Ignore = 0,
+
+ // Event was already handled, don't process it normally.
+ Event_Processed = 1
+ };
+
+ wxEventFilter()
+ {
+ m_next = NULL;
+ }
+
+ virtual ~wxEventFilter()
+ {
+ wxASSERT_MSG( !m_next, "Forgot to call wxEvtHandler::RemoveFilter()?" );
+ }
+
+ // This method allows to filter all the events processed by the program, so
+ // you should try to return quickly from it to avoid slowing down the
+ // program to a crawl.
+ //
+ // Return value should be -1 to continue with the normal event processing,
+ // or true or false to stop further processing and pretend that the event
+ // had been already processed or won't be processed at all, respectively.
+ virtual int FilterEvent(wxEvent& event) = 0;
+
+private:
+ // Objects of this class are made to be stored in a linked list in
+ // wxEvtHandler so put the next node ponter directly in the class itself.
+ wxEventFilter* m_next;
+
+ // And provide access to it for wxEvtHandler [only].
+ friend class wxEvtHandler;
+
+ wxDECLARE_NO_COPY_CLASS(wxEventFilter);
+};
+
+#endif // _WX_EVENTFILTER_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/evtloop.h
+// Purpose: declares wxEventLoop class
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 01.06.01
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_EVTLOOP_H_
+#define _WX_EVTLOOP_H_
+
+#include "wx/event.h"
+#include "wx/utils.h"
+
+// TODO: implement wxEventLoopSource for MSW (it should wrap a HANDLE and be
+// monitored using MsgWaitForMultipleObjects())
+#if defined(__WXOSX__) || (defined(__UNIX__) && !defined(__WXMSW__))
+ #define wxUSE_EVENTLOOP_SOURCE 1
+#else
+ #define wxUSE_EVENTLOOP_SOURCE 0
+#endif
+
+#if wxUSE_EVENTLOOP_SOURCE
+ class wxEventLoopSource;
+ class wxEventLoopSourceHandler;
+#endif
+
+/*
+ NOTE ABOUT wxEventLoopBase::YieldFor LOGIC
+ ------------------------------------------
+
+ The YieldFor() function helps to avoid re-entrancy problems and problems
+ caused by out-of-order event processing
+ (see "wxYield-like problems" and "wxProgressDialog+threading BUG" wx-dev threads).
+
+ The logic behind YieldFor() is simple: it analyzes the queue of the native
+ events generated by the underlying GUI toolkit and picks out and processes
+ only those matching the given mask.
+
+ It's important to note that YieldFor() is used to selectively process the
+ events generated by the NATIVE toolkit.
+ Events syntethized by wxWidgets code or by user code are instead selectively
+ processed thanks to the logic built into wxEvtHandler::ProcessPendingEvents().
+ In fact, when wxEvtHandler::ProcessPendingEvents gets called from inside a
+ YieldFor() call, wxEventLoopBase::IsEventAllowedInsideYield is used to decide
+ if the pending events for that event handler can be processed.
+ If all the pending events associated with that event handler result as "not processable",
+ the event handler "delays" itself calling wxEventLoopBase::DelayPendingEventHandler
+ (so it's moved: m_handlersWithPendingEvents => m_handlersWithPendingDelayedEvents).
+ Last, wxEventLoopBase::ProcessPendingEvents() before exiting moves the delayed
+ event handlers back into the list of handlers with pending events
+ (m_handlersWithPendingDelayedEvents => m_handlersWithPendingEvents) so that
+ a later call to ProcessPendingEvents() (possibly outside the YieldFor() call)
+ will process all pending events as usual.
+*/
+
+// ----------------------------------------------------------------------------
+// wxEventLoopBase: interface for wxEventLoop
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxEventLoopBase
+{
+public:
+ // trivial, but needed (because of wxEventLoopBase) ctor
+ wxEventLoopBase();
+
+ // dtor
+ virtual ~wxEventLoopBase() { }
+
+ // use this to check whether the event loop was successfully created before
+ // using it
+ virtual bool IsOk() const { return true; }
+
+ // returns true if this is the main loop
+ bool IsMain() const;
+
+#if wxUSE_EVENTLOOP_SOURCE
+ // create a new event loop source wrapping the given file descriptor and
+ // monitor it for events occurring on this descriptor in all event loops
+ static wxEventLoopSource *
+ AddSourceForFD(int fd, wxEventLoopSourceHandler *handler, int flags);
+#endif // wxUSE_EVENTLOOP_SOURCE
+
+ // dispatch&processing
+ // -------------------
+
+ // start the event loop, return the exit code when it is finished
+ //
+ // notice that wx ports should override DoRun(), this method is virtual
+ // only to allow overriding it in the user code for custom event loops
+ virtual int Run();
+
+ // is this event loop running now?
+ //
+ // notice that even if this event loop hasn't terminated yet but has just
+ // spawned a nested (e.g. modal) event loop, this would return false
+ bool IsRunning() const;
+
+ // exit from the loop with the given exit code
+ //
+ // this can be only used to exit the currently running loop, use
+ // ScheduleExit() if this might not be the case
+ virtual void Exit(int rc = 0);
+
+ // ask the event loop to exit with the given exit code, can be used even if
+ // this loop is not running right now but the loop must have been started,
+ // i.e. Run() should have been already called
+ virtual void ScheduleExit(int rc = 0) = 0;
+
+ // return true if any events are available
+ virtual bool Pending() const = 0;
+
+ // dispatch a single event, return false if we should exit from the loop
+ virtual bool Dispatch() = 0;
+
+ // same as Dispatch() but doesn't wait for longer than the specified (in
+ // ms) timeout, return true if an event was processed, false if we should
+ // exit the loop or -1 if timeout expired
+ virtual int DispatchTimeout(unsigned long timeout) = 0;
+
+ // implement this to wake up the loop: usually done by posting a dummy event
+ // to it (can be called from non main thread)
+ virtual void WakeUp() = 0;
+
+
+ // idle handling
+ // -------------
+
+ // make sure that idle events are sent again
+ virtual void WakeUpIdle();
+
+ // this virtual function is called when the application
+ // becomes idle and by default it forwards to wxApp::ProcessIdle() and
+ // while it can be overridden in a custom event loop, you must call the
+ // base class version to ensure that idle events are still generated
+ //
+ // it should return true if more idle events are needed, false if not
+ virtual bool ProcessIdle();
+
+
+ // Yield-related hooks
+ // -------------------
+
+ // process all currently pending events right now
+ //
+ // it is an error to call Yield() recursively unless the value of
+ // onlyIfNeeded is true
+ //
+ // WARNING: this function is dangerous as it can lead to unexpected
+ // reentrancies (i.e. when called from an event handler it
+ // may result in calling the same event handler again), use
+ // with _extreme_ care or, better, don't use at all!
+ bool Yield(bool onlyIfNeeded = false);
+ virtual bool YieldFor(long eventsToProcess) = 0;
+
+ // returns true if the main thread is inside a Yield() call
+ virtual bool IsYielding() const
+ { return m_isInsideYield; }
+
+ // returns true if events of the given event category should be immediately
+ // processed inside a wxApp::Yield() call or rather should be queued for
+ // later processing by the main event loop
+ virtual bool IsEventAllowedInsideYield(wxEventCategory cat) const
+ { return (m_eventsToProcessInsideYield & cat) != 0; }
+
+ // no SafeYield hooks since it uses wxWindow which is not available when wxUSE_GUI=0
+
+
+ // active loop
+ // -----------
+
+ // return currently active (running) event loop, may be NULL
+ static wxEventLoopBase *GetActive() { return ms_activeLoop; }
+
+ // set currently active (running) event loop
+ static void SetActive(wxEventLoopBase* loop);
+
+
+protected:
+ // real implementation of Run()
+ virtual int DoRun() = 0;
+
+ // this function should be called before the event loop terminates, whether
+ // this happens normally (because of Exit() call) or abnormally (because of
+ // an exception thrown from inside the loop)
+ virtual void OnExit();
+
+ // Return true if we're currently inside our Run(), even if another nested
+ // event loop is currently running, unlike IsRunning() (which should have
+ // been really called IsActive() but it's too late to change this now).
+ bool IsInsideRun() const { return m_isInsideRun; }
+
+
+ // the pointer to currently active loop
+ static wxEventLoopBase *ms_activeLoop;
+
+ // should we exit the loop?
+ bool m_shouldExit;
+
+ // YieldFor() helpers:
+ bool m_isInsideYield;
+ long m_eventsToProcessInsideYield;
+
+private:
+ // this flag is set on entry into Run() and reset before leaving it
+ bool m_isInsideRun;
+
+ wxDECLARE_NO_COPY_CLASS(wxEventLoopBase);
+};
+
+#if defined(__WINDOWS__) || defined(__WXMAC__) || defined(__WXDFB__) || (defined(__UNIX__) && !defined(__WXOSX__))
+
+// this class can be used to implement a standard event loop logic using
+// Pending() and Dispatch()
+//
+// it also handles idle processing automatically
+class WXDLLIMPEXP_BASE wxEventLoopManual : public wxEventLoopBase
+{
+public:
+ wxEventLoopManual();
+
+ // sets the "should exit" flag and wakes up the loop so that it terminates
+ // soon
+ virtual void ScheduleExit(int rc = 0);
+
+protected:
+ // enters a loop calling OnNextIteration(), Pending() and Dispatch() and
+ // terminating when Exit() is called
+ virtual int DoRun();
+
+ // may be overridden to perform some action at the start of each new event
+ // loop iteration
+ virtual void OnNextIteration() { }
+
+
+ // the loop exit code
+ int m_exitcode;
+
+private:
+ // process all already pending events and dispatch a new one (blocking
+ // until it appears in the event queue if necessary)
+ //
+ // returns the return value of Dispatch()
+ bool ProcessEvents();
+
+ wxDECLARE_NO_COPY_CLASS(wxEventLoopManual);
+};
+
+#endif // platforms using "manual" loop
+
+// we're moving away from old m_impl wxEventLoop model as otherwise the user
+// code doesn't have access to platform-specific wxEventLoop methods and this
+// can sometimes be very useful (e.g. under MSW this is necessary for
+// integration with MFC) but currently this is not done for all ports yet (e.g.
+// wxX11) so fall back to the old wxGUIEventLoop definition below for them
+
+#if defined(__DARWIN__)
+ // CoreFoundation-based event loop is currently in wxBase so include it in
+ // any case too (although maybe it actually shouldn't be there at all)
+ #include "wx/osx/core/evtloop.h"
+#endif
+
+// include the header defining wxConsoleEventLoop
+#if defined(__UNIX__) && !defined(__WXMSW__)
+ #include "wx/unix/evtloop.h"
+#elif defined(__WINDOWS__)
+ #include "wx/msw/evtloopconsole.h"
+#endif
+
+#if wxUSE_GUI
+
+// include the appropriate header defining wxGUIEventLoop
+
+#if defined(__WXMSW__)
+ #include "wx/msw/evtloop.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/evtloop.h"
+#elif defined(__WXOSX__)
+ #include "wx/osx/evtloop.h"
+#elif defined(__WXDFB__)
+ #include "wx/dfb/evtloop.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/evtloop.h"
+#else // other platform
+
+#include "wx/stopwatch.h" // for wxMilliClock_t
+
+class WXDLLIMPEXP_FWD_CORE wxEventLoopImpl;
+
+class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxEventLoopBase
+{
+public:
+ wxGUIEventLoop() { m_impl = NULL; }
+ virtual ~wxGUIEventLoop();
+
+ virtual void ScheduleExit(int rc = 0);
+ virtual bool Pending() const;
+ virtual bool Dispatch();
+ virtual int DispatchTimeout(unsigned long timeout)
+ {
+ // TODO: this is, of course, horribly inefficient and a proper wait with
+ // timeout should be implemented for all ports natively...
+ const wxMilliClock_t timeEnd = wxGetLocalTimeMillis() + timeout;
+ for ( ;; )
+ {
+ if ( Pending() )
+ return Dispatch();
+
+ if ( wxGetLocalTimeMillis() >= timeEnd )
+ return -1;
+ }
+ }
+ virtual void WakeUp() { }
+ virtual bool YieldFor(long eventsToProcess);
+
+protected:
+ virtual int DoRun();
+
+ // the pointer to the port specific implementation class
+ wxEventLoopImpl *m_impl;
+
+ wxDECLARE_NO_COPY_CLASS(wxGUIEventLoop);
+};
+
+#endif // platforms
+
+#endif // wxUSE_GUI
+
+#if wxUSE_GUI
+ // we use a class rather than a typedef because wxEventLoop is
+ // forward-declared in many places
+ class wxEventLoop : public wxGUIEventLoop { };
+#else // !wxUSE_GUI
+ // we can't define wxEventLoop differently in GUI and base libraries so use
+ // a #define to still allow writing wxEventLoop in the user code
+ #if wxUSE_CONSOLE_EVENTLOOP && (defined(__WINDOWS__) || defined(__UNIX__))
+ #define wxEventLoop wxConsoleEventLoop
+ #else // we still must define it somehow for the code below...
+ #define wxEventLoop wxEventLoopBase
+ #endif
+#endif
+
+inline bool wxEventLoopBase::IsRunning() const { return GetActive() == this; }
+
+#if wxUSE_GUI && !defined(__WXOSX__)
+// ----------------------------------------------------------------------------
+// wxModalEventLoop
+// ----------------------------------------------------------------------------
+
+// this is a naive generic implementation which uses wxWindowDisabler to
+// implement modality, we will surely need platform-specific implementations
+// too, this generic implementation is here only temporarily to see how it
+// works
+class WXDLLIMPEXP_CORE wxModalEventLoop : public wxGUIEventLoop
+{
+public:
+ wxModalEventLoop(wxWindow *winModal)
+ {
+ m_windowDisabler = new wxWindowDisabler(winModal);
+ }
+
+protected:
+ virtual void OnExit()
+ {
+ delete m_windowDisabler;
+ m_windowDisabler = NULL;
+
+ wxGUIEventLoop::OnExit();
+ }
+
+private:
+ wxWindowDisabler *m_windowDisabler;
+};
+
+#endif //wxUSE_GUI
+
+// ----------------------------------------------------------------------------
+// wxEventLoopActivator: helper class for wxEventLoop implementations
+// ----------------------------------------------------------------------------
+
+// this object sets the wxEventLoop given to the ctor as the currently active
+// one and unsets it in its dtor, this is especially useful in presence of
+// exceptions but is more tidy even when we don't use them
+class wxEventLoopActivator
+{
+public:
+ wxEventLoopActivator(wxEventLoopBase *evtLoop)
+ {
+ m_evtLoopOld = wxEventLoopBase::GetActive();
+ wxEventLoopBase::SetActive(evtLoop);
+ }
+
+ ~wxEventLoopActivator()
+ {
+ // restore the previously active event loop
+ wxEventLoopBase::SetActive(m_evtLoopOld);
+ }
+
+private:
+ wxEventLoopBase *m_evtLoopOld;
+};
+
+#if wxUSE_CONSOLE_EVENTLOOP
+
+class wxEventLoopGuarantor
+{
+public:
+ wxEventLoopGuarantor()
+ {
+ m_evtLoopNew = NULL;
+ if (!wxEventLoop::GetActive())
+ {
+ m_evtLoopNew = new wxEventLoop;
+ wxEventLoop::SetActive(m_evtLoopNew);
+ }
+ }
+
+ ~wxEventLoopGuarantor()
+ {
+ if (m_evtLoopNew)
+ {
+ wxEventLoop::SetActive(NULL);
+ delete m_evtLoopNew;
+ }
+ }
+
+private:
+ wxEventLoop *m_evtLoopNew;
+};
+
+#endif // wxUSE_CONSOLE_EVENTLOOP
+
+#endif // _WX_EVTLOOP_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/evtloopsrc.h
+// Purpose: declaration of wxEventLoopSource class
+// Author: Vadim Zeitlin
+// Created: 2009-10-21
+// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_EVTLOOPSRC_H_
+#define _WX_EVTLOOPSRC_H_
+
+// Include the header to get wxUSE_EVENTLOOP_SOURCE definition from it.
+#include "wx/evtloop.h"
+
+// ----------------------------------------------------------------------------
+// wxEventLoopSource: a source of events which may be added to wxEventLoop
+// ----------------------------------------------------------------------------
+
+// TODO: refactor wxSocket under Unix to reuse wxEventLoopSource instead of
+// duplicating much of its logic
+//
+// TODO: freeze the API and document it
+
+#if wxUSE_EVENTLOOP_SOURCE
+
+#define wxTRACE_EVT_SOURCE "EventSource"
+
+// handler used to process events on event loop sources
+class wxEventLoopSourceHandler
+{
+public:
+ // called when descriptor is available for non-blocking read
+ virtual void OnReadWaiting() = 0;
+
+ // called when descriptor is available for non-blocking write
+ virtual void OnWriteWaiting() = 0;
+
+ // called when there is exception on descriptor
+ virtual void OnExceptionWaiting() = 0;
+
+ // virtual dtor for the base class
+ virtual ~wxEventLoopSourceHandler() { }
+};
+
+// flags describing which kind of IO events we're interested in
+enum
+{
+ wxEVENT_SOURCE_INPUT = 0x01,
+ wxEVENT_SOURCE_OUTPUT = 0x02,
+ wxEVENT_SOURCE_EXCEPTION = 0x04,
+ wxEVENT_SOURCE_ALL = wxEVENT_SOURCE_INPUT |
+ wxEVENT_SOURCE_OUTPUT |
+ wxEVENT_SOURCE_EXCEPTION
+};
+
+// wxEventLoopSource itself is an ABC and can't be created directly, currently
+// the only way to create it is by using wxEventLoop::AddSourceForFD().
+class wxEventLoopSource
+{
+public:
+ // dtor is pure virtual because it must be overridden to remove the source
+ // from the event loop monitoring it
+ virtual ~wxEventLoopSource() = 0;
+
+ void SetHandler(wxEventLoopSourceHandler* handler) { m_handler = handler; }
+ wxEventLoopSourceHandler* GetHandler() const { return m_handler; }
+
+ void SetFlags(int flags) { m_flags = flags; }
+ int GetFlags() const { return m_flags; }
+
+protected:
+ // ctor is only used by the derived classes
+ wxEventLoopSource(wxEventLoopSourceHandler *handler, int flags)
+ : m_handler(handler),
+ m_flags(flags)
+ {
+ }
+
+ wxEventLoopSourceHandler* m_handler;
+ int m_flags;
+
+ wxDECLARE_NO_COPY_CLASS(wxEventLoopSource);
+};
+
+inline wxEventLoopSource::~wxEventLoopSource() { }
+
+#if defined(__UNIX__)
+ #include "wx/unix/evtloopsrc.h"
+#endif // __UNIX__
+
+#if defined(__WXGTK20__)
+ #include "wx/gtk/evtloopsrc.h"
+#endif
+
+#if defined(__DARWIN__)
+ #include "wx/osx/evtloopsrc.h"
+#endif
+
+#endif // wxUSE_EVENTLOOP_SOURCE
+
+#endif // _WX_EVTLOOPSRC_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/except.h
+// Purpose: C++ exception related stuff
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 17.09.2003
+// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_EXCEPT_H_
+#define _WX_EXCEPT_H_
+
+#include "wx/defs.h"
+
+// ----------------------------------------------------------------------------
+// macros working whether wxUSE_EXCEPTIONS is 0 or 1
+// ----------------------------------------------------------------------------
+
+// even if the library itself was compiled with exceptions support, the user
+// code using it might be compiling with a compiler switch disabling them in
+// which cases we shouldn't use try/catch in the headers -- this results in
+// compilation errors in e.g. wx/scopeguard.h with at least g++ 4
+#if !wxUSE_EXCEPTIONS || \
+ (defined(__GNUG__) && !defined(__EXCEPTIONS))
+ #ifndef wxNO_EXCEPTIONS
+ #define wxNO_EXCEPTIONS
+ #endif
+#endif
+
+#ifdef wxNO_EXCEPTIONS
+ #define wxTRY
+ #define wxCATCH_ALL(code)
+#else // do use exceptions
+ #define wxTRY try
+ #define wxCATCH_ALL(code) catch ( ... ) { code }
+#endif // wxNO_EXCEPTIONS/!wxNO_EXCEPTIONS
+
+#endif // _WX_EXCEPT_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/fdrepdlg.h
+// Purpose: wxFindReplaceDialog class
+// Author: Markus Greither and Vadim Zeitlin
+// Modified by:
+// Created: 23/03/2001
+// Copyright: (c) Markus Greither
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FINDREPLACEDLG_H_
+#define _WX_FINDREPLACEDLG_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_FINDREPLDLG
+
+#include "wx/dialog.h"
+
+class WXDLLIMPEXP_FWD_CORE wxFindDialogEvent;
+class WXDLLIMPEXP_FWD_CORE wxFindReplaceDialog;
+class WXDLLIMPEXP_FWD_CORE wxFindReplaceData;
+class WXDLLIMPEXP_FWD_CORE wxFindReplaceDialogImpl;
+
+// ----------------------------------------------------------------------------
+// Flags for wxFindReplaceData.Flags
+// ----------------------------------------------------------------------------
+
+// flages used by wxFindDialogEvent::GetFlags()
+enum wxFindReplaceFlags
+{
+ // downward search/replace selected (otherwise - upwards)
+ wxFR_DOWN = 1,
+
+ // whole word search/replace selected
+ wxFR_WHOLEWORD = 2,
+
+ // case sensitive search/replace selected (otherwise - case insensitive)
+ wxFR_MATCHCASE = 4
+};
+
+// these flags can be specified in wxFindReplaceDialog ctor or Create()
+enum wxFindReplaceDialogStyles
+{
+ // replace dialog (otherwise find dialog)
+ wxFR_REPLACEDIALOG = 1,
+
+ // don't allow changing the search direction
+ wxFR_NOUPDOWN = 2,
+
+ // don't allow case sensitive searching
+ wxFR_NOMATCHCASE = 4,
+
+ // don't allow whole word searching
+ wxFR_NOWHOLEWORD = 8
+};
+
+// ----------------------------------------------------------------------------
+// wxFindReplaceData: holds Setup Data/Feedback Data for wxFindReplaceDialog
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFindReplaceData : public wxObject
+{
+public:
+ wxFindReplaceData() { Init(); }
+ wxFindReplaceData(wxUint32 flags) { Init(); SetFlags(flags); }
+
+ // accessors
+ const wxString& GetFindString() const { return m_FindWhat; }
+ const wxString& GetReplaceString() const { return m_ReplaceWith; }
+
+ int GetFlags() const { return m_Flags; }
+
+ // setters: may only be called before showing the dialog, no effect later
+ void SetFlags(wxUint32 flags) { m_Flags = flags; }
+
+ void SetFindString(const wxString& str) { m_FindWhat = str; }
+ void SetReplaceString(const wxString& str) { m_ReplaceWith = str; }
+
+protected:
+ void Init();
+
+private:
+ wxUint32 m_Flags;
+ wxString m_FindWhat,
+ m_ReplaceWith;
+
+ friend class wxFindReplaceDialogBase;
+};
+
+// ----------------------------------------------------------------------------
+// wxFindReplaceDialogBase
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFindReplaceDialogBase : public wxDialog
+{
+public:
+ // ctors and such
+ wxFindReplaceDialogBase() { m_FindReplaceData = NULL; }
+ wxFindReplaceDialogBase(wxWindow * WXUNUSED(parent),
+ wxFindReplaceData *data,
+ const wxString& WXUNUSED(title),
+ int WXUNUSED(style) = 0)
+ {
+ m_FindReplaceData = data;
+ }
+
+ virtual ~wxFindReplaceDialogBase();
+
+ // find dialog data access
+ const wxFindReplaceData *GetData() const { return m_FindReplaceData; }
+ void SetData(wxFindReplaceData *data) { m_FindReplaceData = data; }
+
+ // implementation only, don't use
+ void Send(wxFindDialogEvent& event);
+
+protected:
+ wxFindReplaceData *m_FindReplaceData;
+
+ // the last string we searched for
+ wxString m_lastSearch;
+
+ wxDECLARE_NO_COPY_CLASS(wxFindReplaceDialogBase);
+};
+
+// include wxFindReplaceDialog declaration
+#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) && !defined(__WXWINCE__)
+ #include "wx/msw/fdrepdlg.h"
+#else
+ #define wxGenericFindReplaceDialog wxFindReplaceDialog
+
+ #include "wx/generic/fdrepdlg.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// wxFindReplaceDialog events
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFindDialogEvent : public wxCommandEvent
+{
+public:
+ wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, int id = 0)
+ : wxCommandEvent(commandType, id) { }
+ wxFindDialogEvent(const wxFindDialogEvent& event)
+ : wxCommandEvent(event), m_strReplace(event.m_strReplace) { }
+
+ int GetFlags() const { return GetInt(); }
+ wxString GetFindString() const { return GetString(); }
+ const wxString& GetReplaceString() const { return m_strReplace; }
+
+ wxFindReplaceDialog *GetDialog() const
+ { return wxStaticCast(GetEventObject(), wxFindReplaceDialog); }
+
+ // implementation only
+ void SetFlags(int flags) { SetInt(flags); }
+ void SetFindString(const wxString& str) { SetString(str); }
+ void SetReplaceString(const wxString& str) { m_strReplace = str; }
+
+ virtual wxEvent *Clone() const { return new wxFindDialogEvent(*this); }
+
+private:
+ wxString m_strReplace;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFindDialogEvent)
+};
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FIND, wxFindDialogEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FIND_NEXT, wxFindDialogEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FIND_REPLACE, wxFindDialogEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FIND_REPLACE_ALL, wxFindDialogEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FIND_CLOSE, wxFindDialogEvent );
+
+typedef void (wxEvtHandler::*wxFindDialogEventFunction)(wxFindDialogEvent&);
+
+#define wxFindDialogEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxFindDialogEventFunction, func)
+
+#define EVT_FIND(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_FIND, id, wxFindDialogEventHandler(fn))
+
+#define EVT_FIND_NEXT(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_FIND_NEXT, id, wxFindDialogEventHandler(fn))
+
+#define EVT_FIND_REPLACE(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_FIND_REPLACE, id, wxFindDialogEventHandler(fn))
+
+#define EVT_FIND_REPLACE_ALL(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_FIND_REPLACE_ALL, id, wxFindDialogEventHandler(fn))
+
+#define EVT_FIND_CLOSE(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_FIND_CLOSE, id, wxFindDialogEventHandler(fn))
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_FIND wxEVT_FIND
+#define wxEVT_COMMAND_FIND_NEXT wxEVT_FIND_NEXT
+#define wxEVT_COMMAND_FIND_REPLACE wxEVT_FIND_REPLACE
+#define wxEVT_COMMAND_FIND_REPLACE_ALL wxEVT_FIND_REPLACE_ALL
+#define wxEVT_COMMAND_FIND_CLOSE wxEVT_FIND_CLOSE
+
+#endif // wxUSE_FINDREPLDLG
+
+#endif
+ // _WX_FDREPDLG_H
--- /dev/null
+/**
+* Name: wx/features.h
+* Purpose: test macros for the features which might be available in some
+* wxWidgets ports but not others
+* Author: Vadim Zeitlin
+* Modified by: Ryan Norton (Converted to C)
+* Created: 18.03.02
+* Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org>
+* Licence: wxWindows licence
+*/
+
+/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
+
+#ifndef _WX_FEATURES_H_
+#define _WX_FEATURES_H_
+
+/* radio menu items are currently not implemented in wxMotif, use this
+ symbol (kept for compatibility from the time when they were not implemented
+ under other platforms as well) to test for this */
+#if !defined(__WXMOTIF__)
+ #define wxHAS_RADIO_MENU_ITEMS
+#else
+ #undef wxHAS_RADIO_MENU_ITEMS
+#endif
+
+/* the raw keyboard codes are generated under wxGTK and wxMSW only */
+#if defined(__WXGTK__) || defined(__WXMSW__) || defined(__WXMAC__) \
+ || defined(__WXDFB__)
+ #define wxHAS_RAW_KEY_CODES
+#else
+ #undef wxHAS_RAW_KEY_CODES
+#endif
+
+/* taskbar is implemented in the major ports */
+#if defined(__WXMSW__) || defined(__WXCOCOA__) \
+ || defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXX11__) \
+ || defined(__WXOSX_MAC__) || defined(__WXCOCOA__)
+ #define wxHAS_TASK_BAR_ICON
+#else
+ #undef wxUSE_TASKBARICON
+ #define wxUSE_TASKBARICON 0
+ #undef wxHAS_TASK_BAR_ICON
+#endif
+
+/* wxIconLocation appeared in the middle of 2.5.0 so it's handy to have a */
+/* separate define for it */
+#define wxHAS_ICON_LOCATION
+
+/* same for wxCrashReport */
+#ifdef __WXMSW__
+ #define wxHAS_CRASH_REPORT
+#else
+ #undef wxHAS_CRASH_REPORT
+#endif
+
+/* wxRE_ADVANCED is not always available, depending on regex library used
+ * (it's unavailable only if compiling via configure against system library) */
+#ifndef WX_NO_REGEX_ADVANCED
+ #define wxHAS_REGEX_ADVANCED
+#else
+ #undef wxHAS_REGEX_ADVANCED
+#endif
+
+/* Pango-based ports and wxDFB use UTF-8 for text and font encodings
+ * internally and so their fonts can handle any encodings: */
+#if wxUSE_PANGO || defined(__WXDFB__)
+ #define wxHAS_UTF8_FONTS
+#endif
+
+/* This is defined when the underlying toolkit handles tab traversal natively.
+ Otherwise we implement it ourselves in wxControlContainer. */
+#ifdef __WXGTK20__
+ #define wxHAS_NATIVE_TAB_TRAVERSAL
+#endif
+
+/* This is defined when the compiler provides some type of extended locale
+ functions. Otherwise, we implement them ourselves to only support the
+ 'C' locale */
+#if defined(HAVE_LOCALE_T) || \
+ (wxCHECK_VISUALC_VERSION(8) && !defined(__WXWINCE__))
+ #define wxHAS_XLOCALE_SUPPORT
+#else
+ #undef wxHAS_XLOCALE_SUPPORT
+#endif
+
+/* Direct access to bitmap data is not implemented in all ports yet */
+#if defined(__WXGTK20__) || defined(__WXMAC__) || defined(__WXDFB__) || \
+ defined(__WXMSW__)
+
+ /*
+ These compilers can't deal with templates in wx/rawbmp.h:
+ - HP aCC for PA-RISC
+ - Watcom < 1.8
+ */
+ #if !wxONLY_WATCOM_EARLIER_THAN(1, 8) && \
+ !(defined(__HP_aCC) && defined(__hppa))
+ #define wxHAS_RAW_BITMAP
+ #endif
+#endif
+
+/* also define deprecated synonym which exists for compatibility only */
+#ifdef wxHAS_RAW_BITMAP
+ #define wxHAVE_RAW_BITMAP
+#endif
+
+/*
+ If this is defined, wxEvtHandler::Bind<>() is available (not all compilers
+ have the required template support for this and in particular under Windows
+ where only g++ and MSVC >= 7 currently support it.
+
+ Recent Sun CC versions support this but perhaps older ones can compile this
+ code too, adjust the version check if this is the case (unfortunately we
+ can't easily test for the things used in wx/event.h in configure so we have
+ to maintain these checks manually). The same applies to xlC 7: perhaps
+ earlier versions can compile this code too but they were not tested.
+ */
+#if wxCHECK_GCC_VERSION(3, 2) || wxCHECK_VISUALC_VERSION(7) \
+ || (defined(__SUNCC__) && __SUNCC__ >= 0x5100) \
+ || (defined(__xlC__) && __xlC__ >= 0x700) \
+ || defined(__INTELC__)
+ #define wxHAS_EVENT_BIND
+#endif
+
+
+#endif /* _WX_FEATURES_H_ */
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/ffile.h
+// Purpose: wxFFile - encapsulates "FILE *" stream
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 14.07.99
+// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FFILE_H_
+#define _WX_FFILE_H_
+
+#include "wx/defs.h" // for wxUSE_FFILE
+
+#if wxUSE_FFILE
+
+#include "wx/string.h"
+#include "wx/filefn.h"
+#include "wx/convauto.h"
+
+#include <stdio.h>
+
+// ----------------------------------------------------------------------------
+// class wxFFile: standard C stream library IO
+//
+// NB: for space efficiency this class has no virtual functions, including
+// dtor which is _not_ virtual, so it shouldn't be used as a base class.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxFFile
+{
+public:
+ // ctors
+ // -----
+ // def ctor
+ wxFFile() { m_fp = NULL; }
+ // open specified file (may fail, use IsOpened())
+ wxFFile(const wxString& filename, const wxString& mode = wxT("r"));
+ // attach to (already opened) file
+ wxFFile(FILE *lfp) { m_fp = lfp; }
+
+ // open/close
+ // open a file (existing or not - the mode controls what happens)
+ bool Open(const wxString& filename, const wxString& mode = wxT("r"));
+ // closes the opened file (this is a NOP if not opened)
+ bool Close();
+
+ // assign an existing file descriptor and get it back from wxFFile object
+ void Attach(FILE *lfp, const wxString& name = wxEmptyString)
+ { Close(); m_fp = lfp; m_name = name; }
+ FILE* Detach() { FILE* fpOld = m_fp; m_fp = NULL; return fpOld; }
+ FILE *fp() const { return m_fp; }
+
+ // read/write (unbuffered)
+ // read all data from the file into a string (useful for text files)
+ bool ReadAll(wxString *str, const wxMBConv& conv = wxConvAuto());
+ // returns number of bytes read - use Eof() and Error() to see if an error
+ // occurred or not
+ size_t Read(void *pBuf, size_t nCount);
+ // returns the number of bytes written
+ size_t Write(const void *pBuf, size_t nCount);
+ // returns true on success
+ bool Write(const wxString& s, const wxMBConv& conv = wxConvAuto());
+ // flush data not yet written
+ bool Flush();
+
+ // file pointer operations (return ofsInvalid on failure)
+ // move ptr ofs bytes related to start/current pos/end of file
+ bool Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart);
+ // move ptr to ofs bytes before the end
+ bool SeekEnd(wxFileOffset ofs = 0) { return Seek(ofs, wxFromEnd); }
+ // get current position in the file
+ wxFileOffset Tell() const;
+ // get current file length
+ wxFileOffset Length() const;
+
+ // simple accessors: note that Eof() and Error() may only be called if
+ // IsOpened()!
+ // is file opened?
+ bool IsOpened() const { return m_fp != NULL; }
+ // is end of file reached?
+ bool Eof() const { return feof(m_fp) != 0; }
+ // has an error occurred?
+ bool Error() const { return ferror(m_fp) != 0; }
+ // get the file name
+ const wxString& GetName() const { return m_name; }
+ // type such as disk or pipe
+ wxFileKind GetKind() const { return wxGetFileKind(m_fp); }
+
+ // dtor closes the file if opened
+ ~wxFFile() { Close(); }
+
+private:
+ // copy ctor and assignment operator are private because it doesn't make
+ // sense to copy files this way: attempt to do it will provoke a compile-time
+ // error.
+ wxFFile(const wxFFile&);
+ wxFFile& operator=(const wxFFile&);
+
+ FILE *m_fp; // IO stream or NULL if not opened
+
+ wxString m_name; // the name of the file (for diagnostic messages)
+};
+
+#endif // wxUSE_FFILE
+
+#endif // _WX_FFILE_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/file.h
+// Purpose: wxFile - encapsulates low-level "file descriptor"
+// wxTempFile - safely replace the old file
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 29/01/98
+// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FILEH__
+#define _WX_FILEH__
+
+#include "wx/defs.h"
+
+#if wxUSE_FILE
+
+#include "wx/string.h"
+#include "wx/filefn.h"
+#include "wx/convauto.h"
+
+// ----------------------------------------------------------------------------
+// class wxFile: raw file IO
+//
+// NB: for space efficiency this class has no virtual functions, including
+// dtor which is _not_ virtual, so it shouldn't be used as a base class.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxFile
+{
+public:
+ // more file constants
+ // -------------------
+ // opening mode
+ enum OpenMode { read, write, read_write, write_append, write_excl };
+ // standard values for file descriptor
+ enum { fd_invalid = -1, fd_stdin, fd_stdout, fd_stderr };
+
+ // static functions
+ // ----------------
+ // check whether a regular file by this name exists
+ static bool Exists(const wxString& name);
+ // check whether we can access the given file in given mode
+ // (only read and write make sense here)
+ static bool Access(const wxString& name, OpenMode mode);
+
+ // ctors
+ // -----
+ // def ctor
+ wxFile() { m_fd = fd_invalid; m_lasterror = 0; }
+ // open specified file (may fail, use IsOpened())
+ wxFile(const wxString& fileName, OpenMode mode = read);
+ // attach to (already opened) file
+ wxFile(int lfd) { m_fd = lfd; m_lasterror = 0; }
+
+ // open/close
+ // create a new file (with the default value of bOverwrite, it will fail if
+ // the file already exists, otherwise it will overwrite it and succeed)
+ bool Create(const wxString& fileName, bool bOverwrite = false,
+ int access = wxS_DEFAULT);
+ bool Open(const wxString& fileName, OpenMode mode = read,
+ int access = wxS_DEFAULT);
+ bool Close(); // Close is a NOP if not opened
+
+ // assign an existing file descriptor and get it back from wxFile object
+ void Attach(int lfd) { Close(); m_fd = lfd; m_lasterror = 0; }
+ int Detach() { int fdOld = m_fd; m_fd = fd_invalid; return fdOld; }
+ int fd() const { return m_fd; }
+
+ // read/write (unbuffered)
+ // read all data from the file into a string (useful for text files)
+ bool ReadAll(wxString *str, const wxMBConv& conv = wxConvAuto());
+ // returns number of bytes read or wxInvalidOffset on error
+ ssize_t Read(void *pBuf, size_t nCount);
+ // returns the number of bytes written
+ size_t Write(const void *pBuf, size_t nCount);
+ // returns true on success
+ bool Write(const wxString& s, const wxMBConv& conv = wxConvAuto());
+ // flush data not yet written
+ bool Flush();
+
+ // file pointer operations (return wxInvalidOffset on failure)
+ // move ptr ofs bytes related to start/current offset/end of file
+ wxFileOffset Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart);
+ // move ptr to ofs bytes before the end
+ wxFileOffset SeekEnd(wxFileOffset ofs = 0) { return Seek(ofs, wxFromEnd); }
+ // get current offset
+ wxFileOffset Tell() const;
+ // get current file length
+ wxFileOffset Length() const;
+
+ // simple accessors
+ // is file opened?
+ bool IsOpened() const { return m_fd != fd_invalid; }
+ // is end of file reached?
+ bool Eof() const;
+ // has an error occurred?
+ bool Error() const { return m_lasterror != 0; }
+ // get last errno
+ int GetLastError() const { return m_lasterror; }
+ // reset error state
+ void ClearLastError() { m_lasterror = 0; }
+ // type such as disk or pipe
+ wxFileKind GetKind() const { return wxGetFileKind(m_fd); }
+
+
+ // dtor closes the file if opened
+ ~wxFile() { Close(); }
+
+private:
+ // copy ctor and assignment operator are private because
+ // it doesn't make sense to copy files this way:
+ // attempt to do it will provoke a compile-time error.
+ wxFile(const wxFile&);
+ wxFile& operator=(const wxFile&);
+
+ // Copy the value of errno into m_lasterror if rc == -1 and return true in
+ // this case (indicating that we've got an error). Otherwise return false.
+ //
+ // Notice that we use the possibly 64 bit wxFileOffset instead of int here so
+ // that it works for checking the result of functions such as tell() too.
+ bool CheckForError(wxFileOffset rc) const;
+
+
+ int m_fd; // file descriptor or INVALID_FD if not opened
+ int m_lasterror; // errno value of last error
+};
+
+// ----------------------------------------------------------------------------
+// class wxTempFile: if you want to replace another file, create an instance
+// of wxTempFile passing the name of the file to be replaced to the ctor. Then
+// you can write to wxTempFile and call Commit() function to replace the old
+// file (and close this one) or call Discard() to cancel the modification. If
+// you call neither of them, dtor will call Discard().
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxTempFile
+{
+public:
+ // ctors
+ // default
+ wxTempFile() { }
+ // associates the temp file with the file to be replaced and opens it
+ wxTempFile(const wxString& strName);
+
+ // open the temp file (strName is the name of file to be replaced)
+ bool Open(const wxString& strName);
+
+ // is the file opened?
+ bool IsOpened() const { return m_file.IsOpened(); }
+ // get current file length
+ wxFileOffset Length() const { return m_file.Length(); }
+ // move ptr ofs bytes related to start/current offset/end of file
+ wxFileOffset Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart)
+ { return m_file.Seek(ofs, mode); }
+ // get current offset
+ wxFileOffset Tell() const { return m_file.Tell(); }
+
+ // I/O (both functions return true on success, false on failure)
+ bool Write(const void *p, size_t n) { return m_file.Write(p, n) == n; }
+ bool Write(const wxString& str, const wxMBConv& conv = wxMBConvUTF8())
+ { return m_file.Write(str, conv); }
+
+ // flush data: can be called before closing file to ensure that data was
+ // correctly written out
+ bool Flush() { return m_file.Flush(); }
+
+ // different ways to close the file
+ // validate changes and delete the old file of name m_strName
+ bool Commit();
+ // discard changes
+ void Discard();
+
+ // dtor calls Discard() if file is still opened
+ ~wxTempFile();
+
+private:
+ // no copy ctor/assignment operator
+ wxTempFile(const wxTempFile&);
+ wxTempFile& operator=(const wxTempFile&);
+
+ wxString m_strName, // name of the file to replace in Commit()
+ m_strTemp; // temporary file name
+ wxFile m_file; // the temporary file
+};
+
+#endif // wxUSE_FILE
+
+#endif // _WX_FILEH__
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/fileconf.h
+// Purpose: wxFileConfig derivation of wxConfigBase
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 07.04.98 (adapted from appconf.cpp)
+// Copyright: (c) 1997 Karsten Ballueder & Vadim Zeitlin
+// Ballueder@usa.net <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _FILECONF_H
+#define _FILECONF_H
+
+#include "wx/defs.h"
+
+#if wxUSE_CONFIG
+
+#include "wx/textfile.h"
+#include "wx/string.h"
+#include "wx/confbase.h"
+#include "wx/filename.h"
+
+// ----------------------------------------------------------------------------
+// wxFileConfig
+// ----------------------------------------------------------------------------
+
+/*
+ wxFileConfig derives from base Config and implements file based config class,
+ i.e. it uses ASCII disk files to store the information. These files are
+ alternatively called INI, .conf or .rc in the documentation. They are
+ organized in groups or sections, which can nest (i.e. a group contains
+ subgroups, which contain their own subgroups &c). Each group has some
+ number of entries, which are "key = value" pairs. More precisely, the format
+ is:
+
+ # comments are allowed after either ';' or '#' (Win/UNIX standard)
+
+ # blank lines (as above) are ignored
+
+ # global entries are members of special (no name) top group
+ written_for = Windows
+ platform = Linux
+
+ # the start of the group 'Foo'
+ [Foo] # may put comments like this also
+ # following 3 lines are entries
+ key = value
+ another_key = " strings with spaces in the beginning should be quoted, \
+ otherwise the spaces are lost"
+ last_key = but you don't have to put " normally (nor quote them, like here)
+
+ # subgroup of the group 'Foo'
+ # (order is not important, only the name is: separator is '/', as in paths)
+ [Foo/Bar]
+ # entries prefixed with "!" are immutable, i.e. can't be changed if they are
+ # set in the system-wide config file
+ !special_key = value
+ bar_entry = whatever
+
+ [Foo/Bar/Fubar] # depth is (theoretically :-) unlimited
+ # may have the same name as key in another section
+ bar_entry = whatever not
+
+ You have {read/write/delete}Entry functions (guess what they do) and also
+ setCurrentPath to select current group. enum{Subgroups/Entries} allow you
+ to get all entries in the config file (in the current group). Finally,
+ flush() writes immediately all changed entries to disk (otherwise it would
+ be done automatically in dtor)
+
+ wxFileConfig manages not less than 2 config files for each program: global
+ and local (or system and user if you prefer). Entries are read from both of
+ them and the local entries override the global ones unless the latter is
+ immutable (prefixed with '!') in which case a warning message is generated
+ and local value is ignored. Of course, the changes are always written to local
+ file only.
+
+ The names of these files can be specified in a number of ways. First of all,
+ you can use the standard convention: using the ctor which takes 'strAppName'
+ parameter will probably be sufficient for 90% of cases. If, for whatever
+ reason you wish to use the files with some other names, you can always use the
+ second ctor.
+
+ wxFileConfig also may automatically expand the values of environment variables
+ in the entries it reads: for example, if you have an entry
+ score_file = $HOME/.score
+ a call to Read(&str, "score_file") will return a complete path to .score file
+ unless the expansion was previously disabled with SetExpandEnvVars(false) call
+ (it's on by default, the current status can be retrieved with
+ IsExpandingEnvVars function).
+*/
+class WXDLLIMPEXP_FWD_BASE wxFileConfigGroup;
+class WXDLLIMPEXP_FWD_BASE wxFileConfigEntry;
+class WXDLLIMPEXP_FWD_BASE wxFileConfigLineList;
+
+#if wxUSE_STREAMS
+class WXDLLIMPEXP_FWD_BASE wxInputStream;
+class WXDLLIMPEXP_FWD_BASE wxOutputStream;
+#endif // wxUSE_STREAMS
+
+class WXDLLIMPEXP_BASE wxFileConfig : public wxConfigBase
+{
+public:
+ // construct the "standard" full name for global (system-wide) and
+ // local (user-specific) config files from the base file name.
+ //
+ // the following are the filenames returned by this functions:
+ // global local
+ // Unix /etc/file.ext ~/.file
+ // Win %windir%\file.ext %USERPROFILE%\file.ext
+ //
+ // where file is the basename of szFile, ext is its extension
+ // or .conf (Unix) or .ini (Win) if it has none
+ static wxFileName GetGlobalFile(const wxString& szFile);
+ static wxFileName GetLocalFile(const wxString& szFile, int style = 0);
+
+ static wxString GetGlobalFileName(const wxString& szFile)
+ {
+ return GetGlobalFile(szFile).GetFullPath();
+ }
+
+ static wxString GetLocalFileName(const wxString& szFile, int style = 0)
+ {
+ return GetLocalFile(szFile, style).GetFullPath();
+ }
+
+ // ctor & dtor
+ // New constructor: one size fits all. Specify wxCONFIG_USE_LOCAL_FILE or
+ // wxCONFIG_USE_GLOBAL_FILE to say which files should be used.
+ wxFileConfig(const wxString& appName = wxEmptyString,
+ const wxString& vendorName = wxEmptyString,
+ const wxString& localFilename = wxEmptyString,
+ const wxString& globalFilename = wxEmptyString,
+ long style = wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_GLOBAL_FILE,
+ const wxMBConv& conv = wxConvAuto());
+
+#if wxUSE_STREAMS
+ // ctor that takes an input stream.
+ wxFileConfig(wxInputStream &inStream, const wxMBConv& conv = wxConvAuto());
+#endif // wxUSE_STREAMS
+
+ // dtor will save unsaved data
+ virtual ~wxFileConfig();
+
+ // under Unix, set the umask to be used for the file creation, do nothing
+ // under other systems
+#ifdef __UNIX__
+ void SetUmask(int mode) { m_umask = mode; }
+#else // !__UNIX__
+ void SetUmask(int WXUNUSED(mode)) { }
+#endif // __UNIX__/!__UNIX__
+
+ // implement inherited pure virtual functions
+ virtual void SetPath(const wxString& strPath);
+ virtual const wxString& GetPath() const;
+
+ virtual bool GetFirstGroup(wxString& str, long& lIndex) const;
+ virtual bool GetNextGroup (wxString& str, long& lIndex) const;
+ virtual bool GetFirstEntry(wxString& str, long& lIndex) const;
+ virtual bool GetNextEntry (wxString& str, long& lIndex) const;
+
+ virtual size_t GetNumberOfEntries(bool bRecursive = false) const;
+ virtual size_t GetNumberOfGroups(bool bRecursive = false) const;
+
+ virtual bool HasGroup(const wxString& strName) const;
+ virtual bool HasEntry(const wxString& strName) const;
+
+ virtual bool Flush(bool bCurrentOnly = false);
+
+ virtual bool RenameEntry(const wxString& oldName, const wxString& newName);
+ virtual bool RenameGroup(const wxString& oldName, const wxString& newName);
+
+ virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true);
+ virtual bool DeleteGroup(const wxString& szKey);
+ virtual bool DeleteAll();
+
+ // additional, wxFileConfig-specific, functionality
+#if wxUSE_STREAMS
+ // save the entire config file text to the given stream, note that the text
+ // won't be saved again in dtor when Flush() is called if you use this method
+ // as it won't be "changed" any more
+ virtual bool Save(wxOutputStream& os, const wxMBConv& conv = wxConvAuto());
+#endif // wxUSE_STREAMS
+
+public:
+ // functions to work with this list
+ wxFileConfigLineList *LineListAppend(const wxString& str);
+ wxFileConfigLineList *LineListInsert(const wxString& str,
+ wxFileConfigLineList *pLine); // NULL => Prepend()
+ void LineListRemove(wxFileConfigLineList *pLine);
+ bool LineListIsEmpty();
+
+protected:
+ virtual bool DoReadString(const wxString& key, wxString *pStr) const;
+ virtual bool DoReadLong(const wxString& key, long *pl) const;
+#if wxUSE_BASE64
+ virtual bool DoReadBinary(const wxString& key, wxMemoryBuffer* buf) const;
+#endif // wxUSE_BASE64
+
+ virtual bool DoWriteString(const wxString& key, const wxString& szValue);
+ virtual bool DoWriteLong(const wxString& key, long lValue);
+#if wxUSE_BASE64
+ virtual bool DoWriteBinary(const wxString& key, const wxMemoryBuffer& buf);
+#endif // wxUSE_BASE64
+
+private:
+ // GetXXXFileName helpers: return ('/' terminated) directory names
+ static wxString GetGlobalDir();
+ static wxString GetLocalDir(int style = 0);
+
+ // common part of all ctors (assumes that m_str{Local|Global}File are already
+ // initialized
+ void Init();
+
+ // common part of from dtor and DeleteAll
+ void CleanUp();
+
+ // parse the whole file
+ void Parse(const wxTextBuffer& buffer, bool bLocal);
+
+ // the same as SetPath("/")
+ void SetRootPath();
+
+ // real SetPath() implementation, returns true if path could be set or false
+ // if path doesn't exist and createMissingComponents == false
+ bool DoSetPath(const wxString& strPath, bool createMissingComponents);
+
+ // set/test the dirty flag
+ void SetDirty() { m_isDirty = true; }
+ void ResetDirty() { m_isDirty = false; }
+ bool IsDirty() const { return m_isDirty; }
+
+
+ // member variables
+ // ----------------
+ wxFileConfigLineList *m_linesHead, // head of the linked list
+ *m_linesTail; // tail
+
+ wxFileName m_fnLocalFile, // local file name passed to ctor
+ m_fnGlobalFile; // global
+ wxString m_strPath; // current path (not '/' terminated)
+
+ wxFileConfigGroup *m_pRootGroup, // the top (unnamed) group
+ *m_pCurrentGroup; // the current group
+
+ wxMBConv *m_conv;
+
+#ifdef __UNIX__
+ int m_umask; // the umask to use for file creation
+#endif // __UNIX__
+
+ bool m_isDirty; // if true, we have unsaved changes
+
+ wxDECLARE_NO_COPY_CLASS(wxFileConfig);
+ DECLARE_ABSTRACT_CLASS(wxFileConfig)
+};
+
+#endif
+ // wxUSE_CONFIG
+
+#endif
+ //_FILECONF_H
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/filectrl.h
+// Purpose: Header for wxFileCtrlBase and other common functions used by
+// platform-specific wxFileCtrl's
+// Author: Diaa M. Sami
+// Modified by:
+// Created: Jul-07-2007
+// Copyright: (c) Diaa M. Sami
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FILECTRL_H_BASE_
+#define _WX_FILECTRL_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_FILECTRL
+
+#include "wx/string.h"
+#include "wx/event.h"
+
+enum
+{
+ wxFC_OPEN = 0x0001,
+ wxFC_SAVE = 0x0002,
+ wxFC_MULTIPLE = 0x0004,
+ wxFC_NOSHOWHIDDEN = 0x0008
+};
+
+#define wxFC_DEFAULT_STYLE wxFC_OPEN
+extern WXDLLIMPEXP_DATA_CORE(const char) wxFileCtrlNameStr[]; // in filectrlcmn.cpp
+
+class WXDLLIMPEXP_CORE wxFileCtrlBase
+{
+public:
+ virtual ~wxFileCtrlBase() {}
+
+ virtual void SetWildcard( const wxString& wildCard ) = 0;
+ virtual void SetFilterIndex( int filterindex ) = 0;
+ virtual bool SetDirectory( const wxString& dir ) = 0;
+
+ // Selects a certain file.
+ // In case the filename specified isn't found/couldn't be shown with
+ // currently selected filter, false is returned and nothing happens
+ virtual bool SetFilename( const wxString& name ) = 0;
+
+ // chdirs to a certain directory and selects a certain file.
+ // In case the filename specified isn't found/couldn't be shown with
+ // currently selected filter, false is returned and if directory exists
+ // it's chdir'ed to
+ virtual bool SetPath( const wxString& path ) = 0;
+
+ virtual wxString GetFilename() const = 0;
+ virtual wxString GetDirectory() const = 0;
+ virtual wxString GetWildcard() const = 0;
+ virtual wxString GetPath() const = 0;
+ virtual void GetPaths( wxArrayString& paths ) const = 0;
+ virtual void GetFilenames( wxArrayString& files ) const = 0;
+ virtual int GetFilterIndex() const = 0;
+
+ virtual bool HasMultipleFileSelection() const = 0;
+ virtual void ShowHidden(bool show) = 0;
+};
+
+void GenerateFilterChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd );
+void GenerateFolderChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd );
+void GenerateSelectionChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd );
+void GenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const wxString filename = wxEmptyString );
+
+#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
+ #define wxFileCtrl wxGtkFileCtrl
+ #include "wx/gtk/filectrl.h"
+#else
+ #define wxFileCtrl wxGenericFileCtrl
+ #include "wx/generic/filectrlg.h"
+#endif
+
+// Some documentation
+// On wxEVT_FILECTRL_FILTERCHANGED, only the value returned by GetFilterIndex is
+// valid and it represents the (new) current filter index for the wxFileCtrl.
+// On wxEVT_FILECTRL_FOLDERCHANGED, only the value returned by GetDirectory is
+// valid and it represents the (new) current directory for the wxFileCtrl.
+// On wxEVT_FILECTRL_FILEACTIVATED, GetDirectory returns the current directory
+// for the wxFileCtrl and GetFiles returns the names of the file(s) activated.
+// On wxEVT_FILECTRL_SELECTIONCHANGED, GetDirectory returns the current directory
+// for the wxFileCtrl and GetFiles returns the names of the currently selected
+// file(s).
+// In wxGTK, after each wxEVT_FILECTRL_FOLDERCHANGED, wxEVT_FILECTRL_SELECTIONCHANGED
+// is fired automatically once or more with 0 files.
+class WXDLLIMPEXP_CORE wxFileCtrlEvent : public wxCommandEvent
+{
+public:
+ wxFileCtrlEvent() {}
+ wxFileCtrlEvent( wxEventType type, wxObject *evtObject, int id )
+ : wxCommandEvent( type, id )
+ {
+ SetEventObject( evtObject );
+ }
+
+ // no need for the copy constructor as the default one will be fine.
+ virtual wxEvent *Clone() const { return new wxFileCtrlEvent( *this ); }
+
+ void SetFiles( const wxArrayString &files ) { m_files = files; }
+ void SetDirectory( const wxString &directory ) { m_directory = directory; }
+ void SetFilterIndex( int filterIndex ) { m_filterIndex = filterIndex; }
+
+ wxArrayString GetFiles() const { return m_files; }
+ wxString GetDirectory() const { return m_directory; }
+ int GetFilterIndex() const { return m_filterIndex; }
+
+ wxString GetFile() const;
+
+protected:
+ int m_filterIndex;
+ wxString m_directory;
+ wxArrayString m_files;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN( wxFileCtrlEvent )
+};
+
+typedef void ( wxEvtHandler::*wxFileCtrlEventFunction )( wxFileCtrlEvent& );
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_SELECTIONCHANGED, wxFileCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_FILEACTIVATED, wxFileCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_FOLDERCHANGED, wxFileCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_FILTERCHANGED, wxFileCtrlEvent );
+
+#define wxFileCtrlEventHandler(func) \
+ wxEVENT_HANDLER_CAST( wxFileCtrlEventFunction, func )
+
+#define EVT_FILECTRL_FILEACTIVATED(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_FILECTRL_FILEACTIVATED, id, wxFileCtrlEventHandler(fn))
+
+#define EVT_FILECTRL_SELECTIONCHANGED(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_FILECTRL_SELECTIONCHANGED, id, wxFileCtrlEventHandler(fn))
+
+#define EVT_FILECTRL_FOLDERCHANGED(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_FILECTRL_FOLDERCHANGED, id, wxFileCtrlEventHandler(fn))
+
+#define EVT_FILECTRL_FILTERCHANGED(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_FILECTRL_FILTERCHANGED, id, wxFileCtrlEventHandler(fn))
+
+#endif // wxUSE_FILECTRL
+
+#endif // _WX_FILECTRL_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/filedlg.h
+// Purpose: wxFileDialog base header
+// Author: Robert Roebling
+// Modified by:
+// Created: 8/17/99
+// Copyright: (c) Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FILEDLG_H_BASE_
+#define _WX_FILEDLG_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_FILEDLG
+
+#include "wx/dialog.h"
+#include "wx/arrstr.h"
+
+// this symbol is defined for the platforms which support multiple
+// ('|'-separated) filters in the file dialog
+#if defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXMAC__)
+ #define wxHAS_MULTIPLE_FILEDLG_FILTERS
+#endif
+
+//----------------------------------------------------------------------------
+// wxFileDialog data
+//----------------------------------------------------------------------------
+
+/*
+ The flags below must coexist with the following flags in m_windowStyle
+ #define wxCAPTION 0x20000000
+ #define wxMAXIMIZE 0x00002000
+ #define wxCLOSE_BOX 0x00001000
+ #define wxSYSTEM_MENU 0x00000800
+ wxBORDER_NONE = 0x00200000
+ #define wxRESIZE_BORDER 0x00000040
+*/
+
+enum
+{
+ wxFD_OPEN = 0x0001,
+ wxFD_SAVE = 0x0002,
+ wxFD_OVERWRITE_PROMPT = 0x0004,
+ wxFD_FILE_MUST_EXIST = 0x0010,
+ wxFD_MULTIPLE = 0x0020,
+ wxFD_CHANGE_DIR = 0x0080,
+ wxFD_PREVIEW = 0x0100
+};
+
+#if WXWIN_COMPATIBILITY_2_6
+enum
+{
+ wxOPEN = wxFD_OPEN,
+ wxSAVE = wxFD_SAVE,
+ wxOVERWRITE_PROMPT = wxFD_OVERWRITE_PROMPT,
+ wxFILE_MUST_EXIST = wxFD_FILE_MUST_EXIST,
+ wxMULTIPLE = wxFD_MULTIPLE,
+ wxCHANGE_DIR = wxFD_CHANGE_DIR
+};
+#endif
+
+#define wxFD_DEFAULT_STYLE wxFD_OPEN
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxFileDialogNameStr[];
+extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorPromptStr[];
+extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorDefaultWildcardStr[];
+
+//----------------------------------------------------------------------------
+// wxFileDialogBase
+//----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFileDialogBase: public wxDialog
+{
+public:
+ wxFileDialogBase () { Init(); }
+
+ wxFileDialogBase(wxWindow *parent,
+ const wxString& message = wxFileSelectorPromptStr,
+ const wxString& defaultDir = wxEmptyString,
+ const wxString& defaultFile = wxEmptyString,
+ const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
+ long style = wxFD_DEFAULT_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& sz = wxDefaultSize,
+ const wxString& name = wxFileDialogNameStr)
+ {
+ Init();
+ Create(parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name);
+ }
+
+ virtual ~wxFileDialogBase() {}
+
+
+ bool Create(wxWindow *parent,
+ const wxString& message = wxFileSelectorPromptStr,
+ const wxString& defaultDir = wxEmptyString,
+ const wxString& defaultFile = wxEmptyString,
+ const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
+ long style = wxFD_DEFAULT_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& sz = wxDefaultSize,
+ const wxString& name = wxFileDialogNameStr);
+
+ bool HasFdFlag(int flag) const { return HasFlag(flag); }
+
+ virtual void SetMessage(const wxString& message) { m_message = message; }
+ virtual void SetPath(const wxString& path);
+ virtual void SetDirectory(const wxString& dir);
+ virtual void SetFilename(const wxString& name);
+ virtual void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; }
+ virtual void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; }
+
+ virtual wxString GetMessage() const { return m_message; }
+ virtual wxString GetPath() const { return m_path; }
+ virtual void GetPaths(wxArrayString& paths) const { paths.Empty(); paths.Add(m_path); }
+ virtual wxString GetDirectory() const { return m_dir; }
+ virtual wxString GetFilename() const { return m_fileName; }
+ virtual void GetFilenames(wxArrayString& files) const { files.Empty(); files.Add(m_fileName); }
+ virtual wxString GetWildcard() const { return m_wildCard; }
+ virtual int GetFilterIndex() const { return m_filterIndex; }
+
+ virtual wxString GetCurrentlySelectedFilename() const
+ { return m_currentlySelectedFilename; }
+
+ // this function is called with wxFileDialog as parameter and should
+ // create the window containing the extra controls we want to show in it
+ typedef wxWindow *(*ExtraControlCreatorFunction)(wxWindow*);
+
+ virtual bool SupportsExtraControl() const { return false; }
+
+ bool SetExtraControlCreator(ExtraControlCreatorFunction creator);
+ wxWindow *GetExtraControl() const { return m_extraControl; }
+
+ // Utility functions
+
+#if WXWIN_COMPATIBILITY_2_6
+
+ wxDEPRECATED( long GetStyle() const );
+ wxDEPRECATED( void SetStyle(long style) );
+
+#endif // WXWIN_COMPATIBILITY_2_6
+
+
+ // Append first extension to filePath from a ';' separated extensionList
+ // if filePath = "path/foo.bar" just return it as is
+ // if filePath = "foo[.]" and extensionList = "*.jpg;*.png" return "foo.jpg"
+ // if the extension is "*.j?g" (has wildcards) or "jpg" then return filePath
+ static wxString AppendExtension(const wxString &filePath,
+ const wxString &extensionList);
+
+protected:
+ wxString m_message;
+ wxString m_dir;
+ wxString m_path; // Full path
+ wxString m_fileName;
+ wxString m_wildCard;
+ int m_filterIndex;
+
+ // Currently selected, but not yet necessarily accepted by the user, file.
+ // This should be updated whenever the selection in the control changes by
+ // the platform-specific code to provide a useful implementation of
+ // GetCurrentlySelectedFilename().
+ wxString m_currentlySelectedFilename;
+
+ wxWindow* m_extraControl;
+
+ // returns true if control is created (if it already exists returns false)
+ bool CreateExtraControl();
+ // return true if SetExtraControlCreator() was called
+ bool HasExtraControlCreator() const
+ { return m_extraControlCreator != NULL; }
+ // get the size of the extra control by creating and deleting it
+ wxSize GetExtraControlSize();
+
+private:
+ ExtraControlCreatorFunction m_extraControlCreator;
+
+ void Init();
+ DECLARE_DYNAMIC_CLASS(wxFileDialogBase)
+ wxDECLARE_NO_COPY_CLASS(wxFileDialogBase);
+};
+
+
+//----------------------------------------------------------------------------
+// wxFileDialog convenience functions
+//----------------------------------------------------------------------------
+
+// File selector - backward compatibility
+WXDLLIMPEXP_CORE wxString
+wxFileSelector(const wxString& message = wxFileSelectorPromptStr,
+ const wxString& default_path = wxEmptyString,
+ const wxString& default_filename = wxEmptyString,
+ const wxString& default_extension = wxEmptyString,
+ const wxString& wildcard = wxFileSelectorDefaultWildcardStr,
+ int flags = 0,
+ wxWindow *parent = NULL,
+ int x = wxDefaultCoord, int y = wxDefaultCoord);
+
+// An extended version of wxFileSelector
+WXDLLIMPEXP_CORE wxString
+wxFileSelectorEx(const wxString& message = wxFileSelectorPromptStr,
+ const wxString& default_path = wxEmptyString,
+ const wxString& default_filename = wxEmptyString,
+ int *indexDefaultExtension = NULL,
+ const wxString& wildcard = wxFileSelectorDefaultWildcardStr,
+ int flags = 0,
+ wxWindow *parent = NULL,
+ int x = wxDefaultCoord, int y = wxDefaultCoord);
+
+// Ask for filename to load
+WXDLLIMPEXP_CORE wxString
+wxLoadFileSelector(const wxString& what,
+ const wxString& extension,
+ const wxString& default_name = wxEmptyString,
+ wxWindow *parent = NULL);
+
+// Ask for filename to save
+WXDLLIMPEXP_CORE wxString
+wxSaveFileSelector(const wxString& what,
+ const wxString& extension,
+ const wxString& default_name = wxEmptyString,
+ wxWindow *parent = NULL);
+
+
+#if defined (__WXUNIVERSAL__)
+ #define wxHAS_GENERIC_FILEDIALOG
+ #include "wx/generic/filedlgg.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/filedlg.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/filedlg.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/filedlg.h" // GTK+ > 2.4 has native version
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/filedlg.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/filedlg.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/filedlg.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/filedlg.h"
+#endif
+
+#endif // wxUSE_FILEDLG
+
+#endif // _WX_FILEDLG_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/filefn.h
+// Purpose: File- and directory-related functions
+// Author: Julian Smart
+// Modified by:
+// Created: 29/01/98
+// Copyright: (c) 1998 Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _FILEFN_H_
+#define _FILEFN_H_
+
+#include "wx/list.h"
+#include "wx/arrstr.h"
+
+#ifdef __WXWINCE__
+ #include "wx/msw/wince/time.h"
+ #include "wx/msw/private.h"
+#else
+ #include <time.h>
+#endif
+
+#ifndef __WXWINCE__
+ #include <sys/types.h>
+ #include <sys/stat.h>
+#endif
+
+#ifdef __OS2__
+// need to check for __OS2__ first since currently both
+// __OS2__ and __UNIX__ are defined.
+ #include <process.h>
+ #include "wx/os2/private.h"
+ #ifdef __WATCOMC__
+ #include <direct.h>
+ #endif
+ #include <io.h>
+ #ifdef __EMX__
+ #include <unistd.h>
+ #endif
+#elif defined(__UNIX__)
+ #include <unistd.h>
+ #include <dirent.h>
+#endif
+
+#if defined(__WINDOWS__) && !defined(__WXMICROWIN__)
+#if !defined( __GNUWIN32__ ) && !defined(__WXWINCE__) && !defined(__CYGWIN__)
+ #include <direct.h>
+ #include <dos.h>
+ #include <io.h>
+#endif // __WINDOWS__
+#endif // native Win compiler
+
+#if defined(__DOS__)
+ #ifdef __WATCOMC__
+ #include <direct.h>
+ #include <dos.h>
+ #include <io.h>
+ #endif
+ #ifdef __DJGPP__
+ #include <io.h>
+ #include <unistd.h>
+ #endif
+#endif
+
+#ifdef __BORLANDC__ // Please someone tell me which version of Borland needs
+ // this (3.1 I believe) and how to test for it.
+ // If this works for Borland 4.0 as well, then no worries.
+ #include <dir.h>
+#endif
+
+#ifndef __WXWINCE__
+ #include <fcntl.h> // O_RDONLY &c
+#endif
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+#if defined(__VISUALC__) || defined(__DIGITALMARS__)
+ typedef int mode_t;
+#endif
+
+#ifdef __WXWINCE__
+ typedef long off_t;
+#else
+ // define off_t
+ #if !defined(__WXMAC__) || defined(__UNIX__) || defined(__MACH__)
+ #include <sys/types.h>
+ #else
+ typedef long off_t;
+ #endif
+#endif
+
+#if defined(__VISUALC__) && !defined(__WXWINCE__)
+ typedef _off_t off_t;
+#elif defined(__SYMANTEC__)
+ typedef long off_t;
+#endif
+
+enum wxSeekMode
+{
+ wxFromStart,
+ wxFromCurrent,
+ wxFromEnd
+};
+
+enum wxFileKind
+{
+ wxFILE_KIND_UNKNOWN,
+ wxFILE_KIND_DISK, // a file supporting seeking to arbitrary offsets
+ wxFILE_KIND_TERMINAL, // a tty
+ wxFILE_KIND_PIPE // a pipe
+};
+
+// we redefine these constants here because S_IREAD &c are _not_ standard
+// however, we do assume that the values correspond to the Unix umask bits
+enum wxPosixPermissions
+{
+ // standard Posix names for these permission flags:
+ wxS_IRUSR = 00400,
+ wxS_IWUSR = 00200,
+ wxS_IXUSR = 00100,
+
+ wxS_IRGRP = 00040,
+ wxS_IWGRP = 00020,
+ wxS_IXGRP = 00010,
+
+ wxS_IROTH = 00004,
+ wxS_IWOTH = 00002,
+ wxS_IXOTH = 00001,
+
+ // longer but more readable synonyms for the constants above:
+ wxPOSIX_USER_READ = wxS_IRUSR,
+ wxPOSIX_USER_WRITE = wxS_IWUSR,
+ wxPOSIX_USER_EXECUTE = wxS_IXUSR,
+
+ wxPOSIX_GROUP_READ = wxS_IRGRP,
+ wxPOSIX_GROUP_WRITE = wxS_IWGRP,
+ wxPOSIX_GROUP_EXECUTE = wxS_IXGRP,
+
+ wxPOSIX_OTHERS_READ = wxS_IROTH,
+ wxPOSIX_OTHERS_WRITE = wxS_IWOTH,
+ wxPOSIX_OTHERS_EXECUTE = wxS_IXOTH,
+
+ // default mode for the new files: allow reading/writing them to everybody but
+ // the effective file mode will be set after anding this value with umask and
+ // so won't include wxS_IW{GRP,OTH} for the default 022 umask value
+ wxS_DEFAULT = (wxPOSIX_USER_READ | wxPOSIX_USER_WRITE | \
+ wxPOSIX_GROUP_READ | wxPOSIX_GROUP_WRITE | \
+ wxPOSIX_OTHERS_READ | wxPOSIX_OTHERS_WRITE),
+
+ // default mode for the new directories (see wxFileName::Mkdir): allow
+ // reading/writing/executing them to everybody, but just like wxS_DEFAULT
+ // the effective directory mode will be set after anding this value with umask
+ wxS_DIR_DEFAULT = (wxPOSIX_USER_READ | wxPOSIX_USER_WRITE | wxPOSIX_USER_EXECUTE | \
+ wxPOSIX_GROUP_READ | wxPOSIX_GROUP_WRITE | wxPOSIX_GROUP_EXECUTE | \
+ wxPOSIX_OTHERS_READ | wxPOSIX_OTHERS_WRITE | wxPOSIX_OTHERS_EXECUTE)
+};
+
+// ----------------------------------------------------------------------------
+// declare our versions of low level file functions: some compilers prepend
+// underscores to the usual names, some also have Unicode versions of them
+// ----------------------------------------------------------------------------
+
+// Wrappers around Win32 api functions like CreateFile, ReadFile and such
+// Implemented in filefnwce.cpp
+#if defined( __WXWINCE__)
+ typedef __int64 wxFileOffset;
+ #define wxFileOffsetFmtSpec wxT("I64")
+ WXDLLIMPEXP_BASE int wxCRT_Open(const wxChar *filename, int oflag, int WXUNUSED(pmode));
+ WXDLLIMPEXP_BASE int wxCRT_Access(const wxChar *name, int WXUNUSED(how));
+ WXDLLIMPEXP_BASE int wxCRT_Chmod(const wxChar *name, int WXUNUSED(how));
+ WXDLLIMPEXP_BASE int wxClose(int fd);
+ WXDLLIMPEXP_BASE int wxFsync(int WXUNUSED(fd));
+ WXDLLIMPEXP_BASE int wxRead(int fd, void *buf, unsigned int count);
+ WXDLLIMPEXP_BASE int wxWrite(int fd, const void *buf, unsigned int count);
+ WXDLLIMPEXP_BASE int wxEof(int fd);
+ WXDLLIMPEXP_BASE wxFileOffset wxSeek(int fd, wxFileOffset offset, int origin);
+ #define wxLSeek wxSeek
+ WXDLLIMPEXP_BASE wxFileOffset wxTell(int fd);
+
+ // always Unicode under WinCE
+ #define wxCRT_MkDir _wmkdir
+ #define wxCRT_RmDir _wrmdir
+ #define wxCRT_Stat _wstat
+ #define wxStructStat struct _stat
+#elif (defined(__WINDOWS__) || defined(__OS2__)) && \
+ ( \
+ defined(__VISUALC__) || \
+ defined(__MINGW64__) || \
+ (defined(__MINGW32__) && !defined(__WINE__) && \
+ wxCHECK_W32API_VERSION(0, 5)) || \
+ defined(__DMC__) || \
+ defined(__WATCOMC__) || \
+ defined(__BORLANDC__) \
+ )
+
+ // temporary defines just used immediately below
+ #undef wxHAS_HUGE_FILES
+ #undef wxHAS_HUGE_STDIO_FILES
+
+ // detect compilers which have support for huge files
+ #if defined(__VISUALC__)
+ #define wxHAS_HUGE_FILES 1
+ #elif defined(__MINGW32__) || defined(__MINGW64__)
+ #define wxHAS_HUGE_FILES 1f
+ #elif defined(_LARGE_FILES)
+ #define wxHAS_HUGE_FILES 1
+ #endif
+
+ // detect compilers which have support for huge stdio files
+ #if wxCHECK_VISUALC_VERSION(8)
+ #define wxHAS_HUGE_STDIO_FILES
+ #define wxFseek _fseeki64
+ #define wxFtell _ftelli64
+ #elif wxCHECK_MINGW32_VERSION(3, 5) // mingw-runtime version (not gcc)
+ #define wxHAS_HUGE_STDIO_FILES
+ #define wxFseek fseeko64
+ #define wxFtell ftello64
+ #endif
+
+ // other Windows compilers (DMC, Watcom, and Borland) don't have huge file
+ // support (or at least not all functions needed for it by wx) currently
+
+ // types
+
+ #ifdef wxHAS_HUGE_FILES
+ typedef wxLongLong_t wxFileOffset;
+ #define wxFileOffsetFmtSpec wxLongLongFmtSpec
+ #else
+ typedef off_t wxFileOffset;
+ #endif
+
+ // at least Borland 5.5 doesn't like "struct ::stat" so don't use the scope
+ // resolution operator present in wxPOSIX_IDENT for it
+ #ifdef __BORLANDC__
+ #define wxPOSIX_STRUCT(s) struct s
+ #else
+ #define wxPOSIX_STRUCT(s) struct wxPOSIX_IDENT(s)
+ #endif
+
+ // Notice that Watcom is the only compiler to have a wide char
+ // version of struct stat as well as a wide char stat function variant.
+ // This was dropped since OW 1.4 "for consistency across platforms".
+ //
+ // Borland is also special in that it uses _stat with Unicode functions
+ // (for MSVC compatibility?) but stat with ANSI ones
+ #ifdef __BORLANDC__
+ #if wxHAS_HUGE_FILES
+ #define wxStructStat struct stati64
+ #else
+ #if wxUSE_UNICODE
+ #define wxStructStat struct _stat
+ #else
+ #define wxStructStat struct stat
+ #endif
+ #endif
+ #else // !__BORLANDC__
+ #ifdef wxHAS_HUGE_FILES
+ #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4)
+ #define wxStructStat struct _wstati64
+ #else
+ #define wxStructStat struct _stati64
+ #endif
+ #else
+ #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4)
+ #define wxStructStat struct _wstat
+ #else
+ #define wxStructStat struct _stat
+ #endif
+ #endif
+ #endif // __BORLANDC__/!__BORLANDC__
+
+
+ // functions
+
+ // MSVC and compatible compilers prepend underscores to the POSIX function
+ // names, other compilers don't and even if their later versions usually do
+ // define the versions with underscores for MSVC compatibility, it's better
+ // to avoid using them as they're not present in earlier versions and
+ // always using the native functions spelling is easier than testing for
+ // the versions
+ #if defined(__BORLANDC__) || defined(__DMC__) || defined(__WATCOMC__) || defined(__MINGW64__)
+ #define wxPOSIX_IDENT(func) ::func
+ #else // by default assume MSVC-compatible names
+ #define wxPOSIX_IDENT(func) _ ## func
+ #define wxHAS_UNDERSCORES_IN_POSIX_IDENTS
+ #endif
+
+ // first functions not working with strings, i.e. without ANSI/Unicode
+ // complications
+ #define wxClose wxPOSIX_IDENT(close)
+
+ #define wxRead wxPOSIX_IDENT(read)
+ #define wxWrite wxPOSIX_IDENT(write)
+
+ #ifdef wxHAS_HUGE_FILES
+ #ifndef __MINGW64__
+ #define wxSeek wxPOSIX_IDENT(lseeki64)
+ #define wxLseek wxPOSIX_IDENT(lseeki64)
+ #define wxTell wxPOSIX_IDENT(telli64)
+ #else
+ // unfortunately, mingw-W64 is somewhat inconsistent...
+ #define wxSeek _lseeki64
+ #define wxLseek _lseeki64
+ #define wxTell _telli64
+ #endif
+ #else // !wxHAS_HUGE_FILES
+ #define wxSeek wxPOSIX_IDENT(lseek)
+ #define wxLseek wxPOSIX_IDENT(lseek)
+ #define wxTell wxPOSIX_IDENT(tell)
+ #endif // wxHAS_HUGE_FILES/!wxHAS_HUGE_FILES
+
+ #ifndef __WATCOMC__
+ #if !defined(__BORLANDC__) || (__BORLANDC__ > 0x540)
+ // NB: this one is not POSIX and always has the underscore
+ #define wxFsync _commit
+
+ // could be already defined by configure (Cygwin)
+ #ifndef HAVE_FSYNC
+ #define HAVE_FSYNC
+ #endif
+ #endif // BORLANDC
+ #endif
+
+ #define wxEof wxPOSIX_IDENT(eof)
+
+ // then the functions taking strings
+
+ // first the ANSI versions
+ #define wxCRT_OpenA wxPOSIX_IDENT(open)
+ #define wxCRT_AccessA wxPOSIX_IDENT(access)
+ #define wxCRT_ChmodA wxPOSIX_IDENT(chmod)
+ #define wxCRT_MkDirA wxPOSIX_IDENT(mkdir)
+ #define wxCRT_RmDirA wxPOSIX_IDENT(rmdir)
+ #ifdef wxHAS_HUGE_FILES
+ // MinGW-64 provides underscore-less versions of all file functions
+ // except for this one.
+ #ifdef __MINGW64__
+ #define wxCRT_StatA _stati64
+ #else
+ #define wxCRT_StatA wxPOSIX_IDENT(stati64)
+ #endif
+ #else
+ // Unfortunately Watcom is not consistent
+ #if defined(__OS2__) && defined(__WATCOMC__)
+ #define wxCRT_StatA _stat
+ #else
+ #define wxCRT_StatA wxPOSIX_IDENT(stat)
+ #endif
+ #endif
+
+ // then wide char ones
+ #if wxUSE_UNICODE
+ // special workaround for buggy wopen() in bcc 5.5
+ #if defined(__BORLANDC__) && \
+ (__BORLANDC__ >= 0x550 && __BORLANDC__ <= 0x551)
+ WXDLLIMPEXP_BASE int wxCRT_OpenW(const wxChar *pathname,
+ int flags, mode_t mode);
+ #else
+ #define wxCRT_OpenW _wopen
+ #endif
+
+ #define wxCRT_AccessW _waccess
+ #define wxCRT_ChmodW _wchmod
+ #define wxCRT_MkDirW _wmkdir
+ #define wxCRT_RmDirW _wrmdir
+ #ifdef wxHAS_HUGE_FILES
+ #define wxCRT_StatW _wstati64
+ #else
+ #define wxCRT_StatW _wstat
+ #endif
+ #endif // wxUSE_UNICODE
+
+
+ // finally the default char-type versions
+ #if wxUSE_UNICODE
+ #if wxUSE_UNICODE_MSLU || defined(__WX_STRICT_ANSI_GCC__)
+ // implement the missing file functions in Win9x ourselves
+ WXDLLIMPEXP_BASE int wxMSLU__wopen(const wxChar *name,
+ int flags, int mode);
+ WXDLLIMPEXP_BASE int wxMSLU__waccess(const wxChar *name,
+ int mode);
+ WXDLLIMPEXP_BASE int wxMSLU__wchmod(const wxChar *name,
+ int mode);
+ WXDLLIMPEXP_BASE int wxMSLU__wmkdir(const wxChar *name);
+ WXDLLIMPEXP_BASE int wxMSLU__wrmdir(const wxChar *name);
+
+ WXDLLIMPEXP_BASE int
+ wxMSLU__wstat(const wxChar *name, wxStructStat *buffer);
+
+ #define wxCRT_Open wxMSLU__wopen
+
+ #define wxCRT_Access wxMSLU__waccess
+ #define wxCRT_Chmod wxMSLU__wchmod
+ #define wxCRT_MkDir wxMSLU__wmkdir
+ #define wxCRT_RmDir wxMSLU__wrmdir
+ #define wxCRT_Stat wxMSLU__wstat
+ #else // !wxUSE_UNICODE_MSLU
+ #define wxCRT_Open wxCRT_OpenW
+ #define wxCRT_Access wxCRT_AccessW
+ #define wxCRT_Chmod wxCRT_ChmodW
+ #define wxCRT_MkDir wxCRT_MkDirW
+ #define wxCRT_RmDir wxCRT_RmDirW
+ #define wxCRT_Stat wxCRT_StatW
+ #endif // wxUSE_UNICODE_MSLU/!wxUSE_UNICODE_MSLU
+ #else // !wxUSE_UNICODE
+ #define wxCRT_Open wxCRT_OpenA
+ #define wxCRT_Access wxCRT_AccessA
+ #define wxCRT_Chmod wxCRT_ChmodA
+ #define wxCRT_MkDir wxCRT_MkDirA
+ #define wxCRT_RmDir wxCRT_RmDirA
+ #define wxCRT_Stat wxCRT_StatA
+ #endif // wxUSE_UNICODE/!wxUSE_UNICODE
+
+
+ // constants (unless already defined by the user code)
+ #ifdef wxHAS_UNDERSCORES_IN_POSIX_IDENTS
+ #ifndef O_RDONLY
+ #define O_RDONLY _O_RDONLY
+ #define O_WRONLY _O_WRONLY
+ #define O_RDWR _O_RDWR
+ #define O_EXCL _O_EXCL
+ #define O_CREAT _O_CREAT
+ #define O_BINARY _O_BINARY
+ #endif
+
+ #ifndef S_IFMT
+ #define S_IFMT _S_IFMT
+ #define S_IFDIR _S_IFDIR
+ #define S_IFREG _S_IFREG
+ #endif
+ #endif // wxHAS_UNDERSCORES_IN_POSIX_IDENTS
+
+ #ifdef wxHAS_HUGE_FILES
+ // wxFile is present and supports large files.
+ #if wxUSE_FILE
+ #define wxHAS_LARGE_FILES
+ #endif
+ // wxFFile is present and supports large files
+ #if wxUSE_FFILE && defined wxHAS_HUGE_STDIO_FILES
+ #define wxHAS_LARGE_FFILES
+ #endif
+ #endif
+
+ // private defines, undefine so that nobody gets tempted to use
+ #undef wxHAS_HUGE_FILES
+ #undef wxHAS_HUGE_STDIO_FILES
+#else // Unix or Windows using unknown compiler, assume POSIX supported
+ typedef off_t wxFileOffset;
+ #ifdef HAVE_LARGEFILE_SUPPORT
+ #define wxFileOffsetFmtSpec wxLongLongFmtSpec
+ wxCOMPILE_TIME_ASSERT( sizeof(off_t) == sizeof(wxLongLong_t),
+ BadFileSizeType );
+ // wxFile is present and supports large files
+ #if wxUSE_FILE
+ #define wxHAS_LARGE_FILES
+ #endif
+ // wxFFile is present and supports large files
+ #if wxUSE_FFILE && (SIZEOF_LONG == 8 || defined HAVE_FSEEKO)
+ #define wxHAS_LARGE_FFILES
+ #endif
+ #ifdef HAVE_FSEEKO
+ #define wxFseek fseeko
+ #define wxFtell ftello
+ #endif
+ #else
+ #define wxFileOffsetFmtSpec wxT("")
+ #endif
+ // functions
+ #define wxClose close
+ #define wxRead ::read
+ #define wxWrite ::write
+ #define wxLseek lseek
+ #define wxSeek lseek
+ #define wxFsync fsync
+ #define wxEof eof
+ #define wxCRT_MkDir mkdir
+ #define wxCRT_RmDir rmdir
+
+ #define wxTell(fd) lseek(fd, 0, SEEK_CUR)
+
+ #define wxStructStat struct stat
+
+ #define wxCRT_Open open
+ #define wxCRT_Stat stat
+ #define wxCRT_Lstat lstat
+ #define wxCRT_Access access
+ #define wxCRT_Chmod chmod
+
+ #define wxHAS_NATIVE_LSTAT
+#endif // platforms
+
+// if the platform doesn't have symlinks, define wxCRT_Lstat to be the same as
+// wxCRT_Stat to avoid #ifdefs in the code using it
+#ifndef wxHAS_NATIVE_LSTAT
+ #define wxCRT_Lstat wxCRT_Stat
+#endif
+
+// define wxFseek/wxFtell to large file versions if available (done above) or
+// to fseek/ftell if not, to save ifdefs in using code
+#ifndef wxFseek
+ #define wxFseek fseek
+#endif
+#ifndef wxFtell
+ #define wxFtell ftell
+#endif
+
+inline int wxAccess(const wxString& path, mode_t mode)
+ { return wxCRT_Access(path.fn_str(), mode); }
+inline int wxChmod(const wxString& path, mode_t mode)
+ { return wxCRT_Chmod(path.fn_str(), mode); }
+inline int wxOpen(const wxString& path, int flags, mode_t mode)
+ { return wxCRT_Open(path.fn_str(), flags, mode); }
+
+// FIXME-CE: provide our own implementations of the missing CRT functions
+#ifndef __WXWINCE__
+inline int wxStat(const wxString& path, wxStructStat *buf)
+ { return wxCRT_Stat(path.fn_str(), buf); }
+inline int wxLstat(const wxString& path, wxStructStat *buf)
+ { return wxCRT_Lstat(path.fn_str(), buf); }
+inline int wxRmDir(const wxString& path)
+ { return wxCRT_RmDir(path.fn_str()); }
+#if (defined(__WINDOWS__) && !defined(__CYGWIN__)) \
+ || (defined(__OS2__) && defined(__WATCOMC__))
+inline int wxMkDir(const wxString& path, mode_t WXUNUSED(mode) = 0)
+ { return wxCRT_MkDir(path.fn_str()); }
+#else
+inline int wxMkDir(const wxString& path, mode_t mode)
+ { return wxCRT_MkDir(path.fn_str(), mode); }
+#endif
+#endif // !__WXWINCE__
+
+#ifdef O_BINARY
+ #define wxO_BINARY O_BINARY
+#else
+ #define wxO_BINARY 0
+#endif
+
+#if defined(__VISAGECPP__) && __IBMCPP__ >= 400
+//
+// VisualAge C++ V4.0 cannot have any external linkage const decs
+// in headers included by more than one primary source
+//
+extern const int wxInvalidOffset;
+#else
+const int wxInvalidOffset = -1;
+#endif
+
+// ----------------------------------------------------------------------------
+// functions
+// ----------------------------------------------------------------------------
+WXDLLIMPEXP_BASE bool wxFileExists(const wxString& filename);
+
+// does the path exist? (may have or not '/' or '\\' at the end)
+WXDLLIMPEXP_BASE bool wxDirExists(const wxString& pathName);
+
+WXDLLIMPEXP_BASE bool wxIsAbsolutePath(const wxString& filename);
+
+// Get filename
+WXDLLIMPEXP_BASE wxChar* wxFileNameFromPath(wxChar *path);
+WXDLLIMPEXP_BASE wxString wxFileNameFromPath(const wxString& path);
+
+// Get directory
+WXDLLIMPEXP_BASE wxString wxPathOnly(const wxString& path);
+
+// all deprecated functions below are deprecated in favour of wxFileName's methods
+#if WXWIN_COMPATIBILITY_2_8
+
+wxDEPRECATED( WXDLLIMPEXP_BASE void wxDos2UnixFilename(char *s) );
+wxDEPRECATED( WXDLLIMPEXP_BASE void wxDos2UnixFilename(wchar_t *s) );
+
+wxDEPRECATED_BUT_USED_INTERNALLY(
+ WXDLLIMPEXP_BASE void wxUnix2DosFilename(char *s) );
+wxDEPRECATED_BUT_USED_INTERNALLY(
+ WXDLLIMPEXP_BASE void wxUnix2DosFilename(wchar_t *s) );
+
+// Strip the extension, in situ
+// Deprecated in favour of wxFileName::StripExtension() but notice that their
+// behaviour is slightly different, see the manual
+wxDEPRECATED( WXDLLIMPEXP_BASE void wxStripExtension(char *buffer) );
+wxDEPRECATED( WXDLLIMPEXP_BASE void wxStripExtension(wchar_t *buffer) );
+wxDEPRECATED( WXDLLIMPEXP_BASE void wxStripExtension(wxString& buffer) );
+
+// Get a temporary filename
+wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE wxChar* wxGetTempFileName(const wxString& prefix, wxChar *buf = NULL) );
+wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE bool wxGetTempFileName(const wxString& prefix, wxString& buf) );
+
+// Expand file name (~/ and ${OPENWINHOME}/ stuff)
+wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE char* wxExpandPath(char *dest, const wxString& path) );
+wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE wchar_t* wxExpandPath(wchar_t *dest, const wxString& path) );
+ // DEPRECATED: use wxFileName::Normalize(wxPATH_NORM_ENV_VARS)
+
+// Contract w.r.t environment (</usr/openwin/lib, OPENWHOME> -> ${OPENWINHOME}/lib)
+// and make (if under the home tree) relative to home
+// [caller must copy-- volatile]
+wxDEPRECATED(
+WXDLLIMPEXP_BASE wxChar* wxContractPath(const wxString& filename,
+ const wxString& envname = wxEmptyString,
+ const wxString& user = wxEmptyString) );
+ // DEPRECATED: use wxFileName::ReplaceEnvVariable and wxFileName::ReplaceHomeDir
+
+// Destructive removal of /./ and /../ stuff
+wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE char* wxRealPath(char *path) );
+wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE wchar_t* wxRealPath(wchar_t *path) );
+wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE wxString wxRealPath(const wxString& path) );
+ // DEPRECATED: use wxFileName::Normalize instead
+
+// Allocate a copy of the full absolute path
+wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* wxCopyAbsolutePath(const wxString& path) );
+ // DEPRECATED: use wxFileName::MakeAbsolute instead
+#endif
+
+// Get first file name matching given wild card.
+// Flags are reserved for future use.
+#define wxFILE 1
+#define wxDIR 2
+WXDLLIMPEXP_BASE wxString wxFindFirstFile(const wxString& spec, int flags = wxFILE);
+WXDLLIMPEXP_BASE wxString wxFindNextFile();
+
+// Does the pattern contain wildcards?
+WXDLLIMPEXP_BASE bool wxIsWild(const wxString& pattern);
+
+// Does the pattern match the text (usually a filename)?
+// If dot_special is true, doesn't match * against . (eliminating
+// `hidden' dot files)
+WXDLLIMPEXP_BASE bool wxMatchWild(const wxString& pattern, const wxString& text, bool dot_special = true);
+
+// Concatenate two files to form third
+WXDLLIMPEXP_BASE bool wxConcatFiles(const wxString& file1, const wxString& file2, const wxString& file3);
+
+// Copy file1 to file2
+WXDLLIMPEXP_BASE bool wxCopyFile(const wxString& file1, const wxString& file2,
+ bool overwrite = true);
+
+// Remove file
+WXDLLIMPEXP_BASE bool wxRemoveFile(const wxString& file);
+
+// Rename file
+WXDLLIMPEXP_BASE bool wxRenameFile(const wxString& file1, const wxString& file2, bool overwrite = true);
+
+// Get current working directory.
+#if WXWIN_COMPATIBILITY_2_6
+// If buf is NULL, allocates space using new, else
+// copies into buf.
+// IMPORTANT NOTE getcwd is know not to work under some releases
+// of Win32s 1.3, according to MS release notes!
+wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* wxGetWorkingDirectory(wxChar *buf = NULL, int sz = 1000) );
+// new and preferred version of wxGetWorkingDirectory
+// NB: can't have the same name because of overloading ambiguity
+#endif // WXWIN_COMPATIBILITY_2_6
+WXDLLIMPEXP_BASE wxString wxGetCwd();
+
+// Set working directory
+WXDLLIMPEXP_BASE bool wxSetWorkingDirectory(const wxString& d);
+
+// Make directory
+WXDLLIMPEXP_BASE bool wxMkdir(const wxString& dir, int perm = wxS_DIR_DEFAULT);
+
+// Remove directory. Flags reserved for future use.
+WXDLLIMPEXP_BASE bool wxRmdir(const wxString& dir, int flags = 0);
+
+// Return the type of an open file
+WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(int fd);
+WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(FILE *fp);
+
+#if WXWIN_COMPATIBILITY_2_6
+// compatibility defines, don't use in new code
+wxDEPRECATED( inline bool wxPathExists(const wxChar *pszPathName) );
+inline bool wxPathExists(const wxChar *pszPathName)
+{
+ return wxDirExists(pszPathName);
+}
+#endif //WXWIN_COMPATIBILITY_2_6
+
+// permissions; these functions work both on files and directories:
+WXDLLIMPEXP_BASE bool wxIsWritable(const wxString &path);
+WXDLLIMPEXP_BASE bool wxIsReadable(const wxString &path);
+WXDLLIMPEXP_BASE bool wxIsExecutable(const wxString &path);
+
+// ----------------------------------------------------------------------------
+// separators in file names
+// ----------------------------------------------------------------------------
+
+// between file name and extension
+#define wxFILE_SEP_EXT wxT('.')
+
+// between drive/volume name and the path
+#define wxFILE_SEP_DSK wxT(':')
+
+// between the path components
+#define wxFILE_SEP_PATH_DOS wxT('\\')
+#define wxFILE_SEP_PATH_UNIX wxT('/')
+#define wxFILE_SEP_PATH_MAC wxT(':')
+#define wxFILE_SEP_PATH_VMS wxT('.') // VMS also uses '[' and ']'
+
+// separator in the path list (as in PATH environment variable)
+// there is no PATH variable in Classic Mac OS so just use the
+// semicolon (it must be different from the file name separator)
+// NB: these are strings and not characters on purpose!
+#define wxPATH_SEP_DOS wxT(";")
+#define wxPATH_SEP_UNIX wxT(":")
+#define wxPATH_SEP_MAC wxT(";")
+
+// platform independent versions
+#if defined(__UNIX__) && !defined(__OS2__)
+ // CYGWIN also uses UNIX settings
+ #define wxFILE_SEP_PATH wxFILE_SEP_PATH_UNIX
+ #define wxPATH_SEP wxPATH_SEP_UNIX
+#elif defined(__MAC__)
+ #define wxFILE_SEP_PATH wxFILE_SEP_PATH_MAC
+ #define wxPATH_SEP wxPATH_SEP_MAC
+#else // Windows and OS/2
+ #define wxFILE_SEP_PATH wxFILE_SEP_PATH_DOS
+ #define wxPATH_SEP wxPATH_SEP_DOS
+#endif // Unix/Windows
+
+// this is useful for wxString::IsSameAs(): to compare two file names use
+// filename1.IsSameAs(filename2, wxARE_FILENAMES_CASE_SENSITIVE)
+#if defined(__UNIX__) && !defined(__DARWIN__) && !defined(__OS2__)
+ #define wxARE_FILENAMES_CASE_SENSITIVE true
+#else // Windows, Mac OS and OS/2
+ #define wxARE_FILENAMES_CASE_SENSITIVE false
+#endif // Unix/Windows
+
+// is the char a path separator?
+inline bool wxIsPathSeparator(wxChar c)
+{
+ // under DOS/Windows we should understand both Unix and DOS file separators
+#if ( defined(__UNIX__) && !defined(__OS2__) )|| defined(__MAC__)
+ return c == wxFILE_SEP_PATH;
+#else
+ return c == wxFILE_SEP_PATH_DOS || c == wxFILE_SEP_PATH_UNIX;
+#endif
+}
+
+// does the string ends with path separator?
+WXDLLIMPEXP_BASE bool wxEndsWithPathSeparator(const wxString& filename);
+
+#if WXWIN_COMPATIBILITY_2_8
+// split the full path into path (including drive for DOS), name and extension
+// (understands both '/' and '\\')
+// Deprecated in favour of wxFileName::SplitPath
+wxDEPRECATED( WXDLLIMPEXP_BASE void wxSplitPath(const wxString& fileName,
+ wxString *pstrPath,
+ wxString *pstrName,
+ wxString *pstrExt) );
+#endif
+
+// find a file in a list of directories, returns false if not found
+WXDLLIMPEXP_BASE bool wxFindFileInPath(wxString *pStr, const wxString& szPath, const wxString& szFile);
+
+// Get the OS directory if appropriate (such as the Windows directory).
+// On non-Windows platform, probably just return the empty string.
+WXDLLIMPEXP_BASE wxString wxGetOSDirectory();
+
+#if wxUSE_DATETIME
+
+// Get file modification time
+WXDLLIMPEXP_BASE time_t wxFileModificationTime(const wxString& filename);
+
+#endif // wxUSE_DATETIME
+
+// Parses the wildCard, returning the number of filters.
+// Returns 0 if none or if there's a problem,
+// The arrays will contain an equal number of items found before the error.
+// wildCard is in the form:
+// "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png"
+WXDLLIMPEXP_BASE int wxParseCommonDialogsFilter(const wxString& wildCard, wxArrayString& descriptions, wxArrayString& filters);
+
+// ----------------------------------------------------------------------------
+// classes
+// ----------------------------------------------------------------------------
+
+#ifdef __UNIX__
+
+// set umask to the given value in ctor and reset it to the old one in dtor
+class WXDLLIMPEXP_BASE wxUmaskChanger
+{
+public:
+ // change the umask to the given one if it is not -1: this allows to write
+ // the same code whether you really want to change umask or not, as is in
+ // wxFileConfig::Flush() for example
+ wxUmaskChanger(int umaskNew)
+ {
+ m_umaskOld = umaskNew == -1 ? -1 : (int)umask((mode_t)umaskNew);
+ }
+
+ ~wxUmaskChanger()
+ {
+ if ( m_umaskOld != -1 )
+ umask((mode_t)m_umaskOld);
+ }
+
+private:
+ int m_umaskOld;
+};
+
+// this macro expands to an "anonymous" wxUmaskChanger object under Unix and
+// nothing elsewhere
+#define wxCHANGE_UMASK(m) wxUmaskChanger wxMAKE_UNIQUE_NAME(umaskChanger_)(m)
+
+#else // !__UNIX__
+
+#define wxCHANGE_UMASK(m)
+
+#endif // __UNIX__/!__UNIX__
+
+
+// Path searching
+class WXDLLIMPEXP_BASE wxPathList : public wxArrayString
+{
+public:
+ wxPathList() {}
+ wxPathList(const wxArrayString &arr)
+ { Add(arr); }
+
+ // Adds all paths in environment variable
+ void AddEnvList(const wxString& envVariable);
+
+ // Adds given path to this list
+ bool Add(const wxString& path);
+ void Add(const wxArrayString &paths);
+
+ // Find the first full path for which the file exists
+ wxString FindValidPath(const wxString& filename) const;
+
+ // Find the first full path for which the file exists; ensure it's an
+ // absolute path that gets returned.
+ wxString FindAbsoluteValidPath(const wxString& filename) const;
+
+ // Given full path and filename, add path to list
+ bool EnsureFileAccessible(const wxString& path);
+
+#if WXWIN_COMPATIBILITY_2_6
+ // Returns true if the path is in the list
+ wxDEPRECATED( bool Member(const wxString& path) const );
+#endif
+};
+
+#endif // _WX_FILEFN_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/filehistory.h
+// Purpose: wxFileHistory class
+// Author: Julian Smart, Vaclav Slavik
+// Created: 2010-05-03
+// Copyright: (c) Julian Smart, Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FILEHISTORY_H_
+#define _WX_FILEHISTORY_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_FILE_HISTORY
+
+#include "wx/windowid.h"
+#include "wx/object.h"
+#include "wx/list.h"
+#include "wx/string.h"
+#include "wx/arrstr.h"
+
+class WXDLLIMPEXP_FWD_CORE wxMenu;
+class WXDLLIMPEXP_FWD_BASE wxConfigBase;
+class WXDLLIMPEXP_FWD_BASE wxFileName;
+
+// ----------------------------------------------------------------------------
+// File history management
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFileHistoryBase : public wxObject
+{
+public:
+ wxFileHistoryBase(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1);
+
+ // Operations
+ virtual void AddFileToHistory(const wxString& file);
+ virtual void RemoveFileFromHistory(size_t i);
+ virtual int GetMaxFiles() const { return (int)m_fileMaxFiles; }
+ virtual void UseMenu(wxMenu *menu);
+
+ // Remove menu from the list (MDI child may be closing)
+ virtual void RemoveMenu(wxMenu *menu);
+
+#if wxUSE_CONFIG
+ virtual void Load(const wxConfigBase& config);
+ virtual void Save(wxConfigBase& config);
+#endif // wxUSE_CONFIG
+
+ virtual void AddFilesToMenu();
+ virtual void AddFilesToMenu(wxMenu* menu); // Single menu
+
+ // Accessors
+ virtual wxString GetHistoryFile(size_t i) const { return m_fileHistory[i]; }
+ virtual size_t GetCount() const { return m_fileHistory.GetCount(); }
+
+ const wxList& GetMenus() const { return m_fileMenus; }
+
+ // Set/get base id
+ void SetBaseId(wxWindowID baseId) { m_idBase = baseId; }
+ wxWindowID GetBaseId() const { return m_idBase; }
+
+#if WXWIN_COMPATIBILITY_2_6
+ // deprecated, use GetCount() instead
+ wxDEPRECATED( size_t GetNoHistoryFiles() const );
+#endif // WXWIN_COMPATIBILITY_2_6
+
+protected:
+ // Last n files
+ wxArrayString m_fileHistory;
+
+ // Menus to maintain (may need several for an MDI app)
+ wxList m_fileMenus;
+
+ // Max files to maintain
+ size_t m_fileMaxFiles;
+
+private:
+ // The ID of the first history menu item (Doesn't have to be wxID_FILE1)
+ wxWindowID m_idBase;
+
+ // Normalize a file name to canonical form. We have a special function for
+ // this to ensure the same normalization is used everywhere.
+ static wxString NormalizeFileName(const wxFileName& filename);
+
+ wxDECLARE_NO_COPY_CLASS(wxFileHistoryBase);
+};
+
+#if WXWIN_COMPATIBILITY_2_6
+inline size_t wxFileHistoryBase::GetNoHistoryFiles() const
+{
+ return m_fileHistory.GetCount();
+}
+#endif // WXWIN_COMPATIBILITY_2_6
+
+
+#if defined(__WXGTK20__)
+ #include "wx/gtk/filehistory.h"
+#else
+ // no platform-specific implementation of wxFileHistory yet
+ class WXDLLIMPEXP_CORE wxFileHistory : public wxFileHistoryBase
+ {
+ public:
+ wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1)
+ : wxFileHistoryBase(maxFiles, idBase) {}
+
+ DECLARE_DYNAMIC_CLASS(wxFileHistory)
+ };
+#endif
+
+#endif // wxUSE_FILE_HISTORY
+
+#endif // _WX_FILEHISTORY_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/filename.h
+// Purpose: wxFileName - encapsulates a file path
+// Author: Robert Roebling, Vadim Zeitlin
+// Modified by:
+// Created: 28.12.00
+// Copyright: (c) 2000 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FILENAME_H_
+#define _WX_FILENAME_H_
+
+#include "wx/arrstr.h"
+#include "wx/filefn.h"
+#include "wx/datetime.h"
+#include "wx/intl.h"
+#include "wx/longlong.h"
+#include "wx/file.h"
+
+#if wxUSE_FILE
+class WXDLLIMPEXP_FWD_BASE wxFile;
+#endif
+
+#if wxUSE_FFILE
+class WXDLLIMPEXP_FWD_BASE wxFFile;
+#endif
+
+// this symbol is defined for the platforms where file systems use volumes in
+// paths
+#if defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__)
+ #define wxHAS_FILESYSTEM_VOLUMES
+#endif
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// the various values for the path format: this mainly affects the path
+// separator but also whether or not the path has the drive part (as under
+// Windows)
+enum wxPathFormat
+{
+ wxPATH_NATIVE = 0, // the path format for the current platform
+ wxPATH_UNIX,
+ wxPATH_BEOS = wxPATH_UNIX,
+ wxPATH_MAC,
+ wxPATH_DOS,
+ wxPATH_WIN = wxPATH_DOS,
+ wxPATH_OS2 = wxPATH_DOS,
+ wxPATH_VMS,
+
+ wxPATH_MAX // Not a valid value for specifying path format
+};
+
+// different conventions that may be used with GetHumanReadableSize()
+enum wxSizeConvention
+{
+ wxSIZE_CONV_TRADITIONAL, // 1024 bytes = 1 KB
+ wxSIZE_CONV_IEC, // 1024 bytes = 1 KiB
+ wxSIZE_CONV_SI // 1000 bytes = 1 KB
+};
+
+// the kind of normalization to do with the file name: these values can be
+// or'd together to perform several operations at once
+enum wxPathNormalize
+{
+ wxPATH_NORM_ENV_VARS = 0x0001, // replace env vars with their values
+ wxPATH_NORM_DOTS = 0x0002, // squeeze all .. and .
+ wxPATH_NORM_TILDE = 0x0004, // Unix only: replace ~ and ~user
+ wxPATH_NORM_CASE = 0x0008, // if case insensitive => tolower
+ wxPATH_NORM_ABSOLUTE = 0x0010, // make the path absolute
+ wxPATH_NORM_LONG = 0x0020, // make the path the long form
+ wxPATH_NORM_SHORTCUT = 0x0040, // resolve the shortcut, if it is a shortcut
+ wxPATH_NORM_ALL = 0x00ff & ~wxPATH_NORM_CASE
+};
+
+// what exactly should GetPath() return?
+enum
+{
+ wxPATH_NO_SEPARATOR = 0x0000, // for symmetry with wxPATH_GET_SEPARATOR
+ wxPATH_GET_VOLUME = 0x0001, // include the volume if applicable
+ wxPATH_GET_SEPARATOR = 0x0002 // terminate the path with the separator
+};
+
+// Mkdir flags
+enum
+{
+ wxPATH_MKDIR_FULL = 0x0001 // create directories recursively
+};
+
+// Rmdir flags
+enum
+{
+ wxPATH_RMDIR_FULL = 0x0001, // delete with subdirectories if empty
+ wxPATH_RMDIR_RECURSIVE = 0x0002 // delete all recursively (dangerous!)
+};
+
+// FileExists flags
+enum
+{
+ wxFILE_EXISTS_REGULAR = 0x0001, // check for existence of a regular file
+ wxFILE_EXISTS_DIR = 0x0002, // check for existence of a directory
+ wxFILE_EXISTS_SYMLINK = 0x1004, // check for existence of a symbolic link;
+ // also sets wxFILE_EXISTS_NO_FOLLOW as
+ // it would never be satisfied otherwise
+ wxFILE_EXISTS_DEVICE = 0x0008, // check for existence of a device
+ wxFILE_EXISTS_FIFO = 0x0016, // check for existence of a FIFO
+ wxFILE_EXISTS_SOCKET = 0x0032, // check for existence of a socket
+ // gap for future types
+ wxFILE_EXISTS_NO_FOLLOW = 0x1000, // don't dereference a contained symlink
+ wxFILE_EXISTS_ANY = 0x1FFF // check for existence of anything
+};
+
+#if wxUSE_LONGLONG
+// error code of wxFileName::GetSize()
+extern WXDLLIMPEXP_DATA_BASE(const wxULongLong) wxInvalidSize;
+#endif // wxUSE_LONGLONG
+
+
+
+// ----------------------------------------------------------------------------
+// wxFileName: encapsulates a file path
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxFileName
+{
+public:
+ // constructors and assignment
+
+ // the usual stuff
+ wxFileName() { Clear(); }
+ wxFileName(const wxFileName& filepath) { Assign(filepath); }
+
+ // from a full filename: if it terminates with a '/', a directory path
+ // is contructed (the name will be empty), otherwise a file name and
+ // extension are extracted from it
+ wxFileName( const wxString& fullpath, wxPathFormat format = wxPATH_NATIVE )
+ { Assign( fullpath, format ); m_dontFollowLinks = false; }
+
+ // from a directory name and a file name
+ wxFileName(const wxString& path,
+ const wxString& name,
+ wxPathFormat format = wxPATH_NATIVE)
+ { Assign(path, name, format); m_dontFollowLinks = false; }
+
+ // from a volume, directory name, file base name and extension
+ wxFileName(const wxString& volume,
+ const wxString& path,
+ const wxString& name,
+ const wxString& ext,
+ wxPathFormat format = wxPATH_NATIVE)
+ { Assign(volume, path, name, ext, format); m_dontFollowLinks = false; }
+
+ // from a directory name, file base name and extension
+ wxFileName(const wxString& path,
+ const wxString& name,
+ const wxString& ext,
+ wxPathFormat format = wxPATH_NATIVE)
+ { Assign(path, name, ext, format); m_dontFollowLinks = false; }
+
+ // the same for delayed initialization
+
+ void Assign(const wxFileName& filepath);
+
+ void Assign(const wxString& fullpath,
+ wxPathFormat format = wxPATH_NATIVE);
+
+ void Assign(const wxString& volume,
+ const wxString& path,
+ const wxString& name,
+ const wxString& ext,
+ bool hasExt,
+ wxPathFormat format = wxPATH_NATIVE);
+
+ void Assign(const wxString& volume,
+ const wxString& path,
+ const wxString& name,
+ const wxString& ext,
+ wxPathFormat format = wxPATH_NATIVE)
+ { Assign(volume, path, name, ext, !ext.empty(), format); }
+
+ void Assign(const wxString& path,
+ const wxString& name,
+ wxPathFormat format = wxPATH_NATIVE);
+
+ void Assign(const wxString& path,
+ const wxString& name,
+ const wxString& ext,
+ wxPathFormat format = wxPATH_NATIVE);
+
+ void AssignDir(const wxString& dir, wxPathFormat format = wxPATH_NATIVE);
+
+ // assorted assignment operators
+
+ wxFileName& operator=(const wxFileName& filename)
+ { if (this != &filename) Assign(filename); return *this; }
+
+ wxFileName& operator=(const wxString& filename)
+ { Assign(filename); return *this; }
+
+ // reset all components to default, uninitialized state
+ void Clear();
+
+ // static pseudo constructors
+ static wxFileName FileName(const wxString& file,
+ wxPathFormat format = wxPATH_NATIVE);
+ static wxFileName DirName(const wxString& dir,
+ wxPathFormat format = wxPATH_NATIVE);
+
+ // file tests
+
+ // is the filename valid at all?
+ bool IsOk() const
+ {
+ // we're fine if we have the path or the name or if we're a root dir
+ return m_dirs.size() != 0 || !m_name.empty() || !m_relative ||
+ !m_ext.empty() || m_hasExt;
+ }
+
+ // does the file with this name exist?
+ bool FileExists() const;
+ static bool FileExists( const wxString &file );
+
+ // does the directory with this name exist?
+ bool DirExists() const;
+ static bool DirExists( const wxString &dir );
+
+ // does anything at all with this name (i.e. file, directory or some
+ // other file system object such as a device, socket, ...) exist?
+ bool Exists(int flags = wxFILE_EXISTS_ANY) const;
+ static bool Exists(const wxString& path, int flags = wxFILE_EXISTS_ANY);
+
+
+ // checks on most common flags for files/directories;
+ // more platform-specific features (like e.g. Unix permissions) are not
+ // available in wxFileName
+
+ bool IsDirWritable() const { return wxIsWritable(GetPath()); }
+ static bool IsDirWritable(const wxString &path) { return wxDirExists(path) && wxIsWritable(path); }
+
+ bool IsDirReadable() const { return wxIsReadable(GetPath()); }
+ static bool IsDirReadable(const wxString &path) { return wxDirExists(path) && wxIsReadable(path); }
+
+ // NOTE: IsDirExecutable() is not present because the meaning of "executable"
+ // directory is very platform-dependent and also not so useful
+
+ bool IsFileWritable() const { return wxIsWritable(GetFullPath()); }
+ static bool IsFileWritable(const wxString &path) { return wxFileExists(path) && wxIsWritable(path); }
+
+ bool IsFileReadable() const { return wxIsReadable(GetFullPath()); }
+ static bool IsFileReadable(const wxString &path) { return wxFileExists(path) && wxIsReadable(path); }
+
+ bool IsFileExecutable() const { return wxIsExecutable(GetFullPath()); }
+ static bool IsFileExecutable(const wxString &path) { return wxFileExists(path) && wxIsExecutable(path); }
+
+ // set the file permissions to a combination of wxPosixPermissions enum
+ // values
+ bool SetPermissions(int permissions);
+
+
+ // time functions
+#if wxUSE_DATETIME
+ // set the file last access/mod and creation times
+ // (any of the pointers may be NULL)
+ bool SetTimes(const wxDateTime *dtAccess,
+ const wxDateTime *dtMod,
+ const wxDateTime *dtCreate) const;
+
+ // set the access and modification times to the current moment
+ bool Touch() const;
+
+ // return the last access, last modification and create times
+ // (any of the pointers may be NULL)
+ bool GetTimes(wxDateTime *dtAccess,
+ wxDateTime *dtMod,
+ wxDateTime *dtCreate) const;
+
+ // convenience wrapper: get just the last mod time of the file
+ wxDateTime GetModificationTime() const
+ {
+ wxDateTime dtMod;
+ (void)GetTimes(NULL, &dtMod, NULL);
+ return dtMod;
+ }
+#endif // wxUSE_DATETIME
+
+#if defined( __WXOSX_MAC__ ) && wxOSX_USE_CARBON
+ bool MacSetTypeAndCreator( wxUint32 type , wxUint32 creator ) ;
+ bool MacGetTypeAndCreator( wxUint32 *type , wxUint32 *creator ) const;
+ // gets the 'common' type and creator for a certain extension
+ static bool MacFindDefaultTypeAndCreator( const wxString& ext , wxUint32 *type , wxUint32 *creator ) ;
+ // registers application defined extensions and their default type and creator
+ static void MacRegisterDefaultTypeAndCreator( const wxString& ext , wxUint32 type , wxUint32 creator ) ;
+ // looks up the appropriate type and creator from the registration and then sets
+ bool MacSetDefaultTypeAndCreator() ;
+#endif
+
+ // various file/dir operations
+
+ // retrieve the value of the current working directory
+ void AssignCwd(const wxString& volume = wxEmptyString);
+ static wxString GetCwd(const wxString& volume = wxEmptyString);
+
+ // change the current working directory
+ bool SetCwd() const;
+ static bool SetCwd( const wxString &cwd );
+
+ // get the value of user home (Unix only mainly)
+ void AssignHomeDir();
+ static wxString GetHomeDir();
+
+ // get the system temporary directory
+ static wxString GetTempDir();
+
+#if wxUSE_FILE || wxUSE_FFILE
+ // get a temp file name starting with the specified prefix
+ void AssignTempFileName(const wxString& prefix);
+ static wxString CreateTempFileName(const wxString& prefix);
+#endif // wxUSE_FILE
+
+#if wxUSE_FILE
+ // get a temp file name starting with the specified prefix and open the
+ // file passed to us using this name for writing (atomically if
+ // possible)
+ void AssignTempFileName(const wxString& prefix, wxFile *fileTemp);
+ static wxString CreateTempFileName(const wxString& prefix,
+ wxFile *fileTemp);
+#endif // wxUSE_FILE
+
+#if wxUSE_FFILE
+ // get a temp file name starting with the specified prefix and open the
+ // file passed to us using this name for writing (atomically if
+ // possible)
+ void AssignTempFileName(const wxString& prefix, wxFFile *fileTemp);
+ static wxString CreateTempFileName(const wxString& prefix,
+ wxFFile *fileTemp);
+#endif // wxUSE_FFILE
+
+ // directory creation and removal.
+ bool Mkdir(int perm = wxS_DIR_DEFAULT, int flags = 0) const;
+ static bool Mkdir(const wxString &dir, int perm = wxS_DIR_DEFAULT,
+ int flags = 0);
+
+ bool Rmdir(int flags = 0) const;
+ static bool Rmdir(const wxString &dir, int flags = 0);
+
+ // operations on the path
+
+ // normalize the path: with the default flags value, the path will be
+ // made absolute, without any ".." and "." and all environment
+ // variables will be expanded in it
+ //
+ // this may be done using another (than current) value of cwd
+ bool Normalize(int flags = wxPATH_NORM_ALL,
+ const wxString& cwd = wxEmptyString,
+ wxPathFormat format = wxPATH_NATIVE);
+
+ // get a path path relative to the given base directory, i.e. opposite
+ // of Normalize
+ //
+ // pass an empty string to get a path relative to the working directory
+ //
+ // returns true if the file name was modified, false if we failed to do
+ // anything with it (happens when the file is on a different volume,
+ // for example)
+ bool MakeRelativeTo(const wxString& pathBase = wxEmptyString,
+ wxPathFormat format = wxPATH_NATIVE);
+
+ // make the path absolute
+ //
+ // this may be done using another (than current) value of cwd
+ bool MakeAbsolute(const wxString& cwd = wxEmptyString,
+ wxPathFormat format = wxPATH_NATIVE)
+ { return Normalize(wxPATH_NORM_DOTS | wxPATH_NORM_ABSOLUTE |
+ wxPATH_NORM_TILDE, cwd, format); }
+
+
+ // If the path is a symbolic link (Unix-only), indicate that all
+ // filesystem operations on this path should be performed on the link
+ // itself and not on the file it points to, as is the case by default.
+ //
+ // No effect if this is not a symbolic link.
+ void DontFollowLink()
+ {
+ m_dontFollowLinks = true;
+ }
+
+ // If the path is a symbolic link (Unix-only), returns whether various
+ // file operations should act on the link itself, or on its target.
+ //
+ // This does not test if the path is really a symlink or not.
+ bool ShouldFollowLink() const
+ {
+ return !m_dontFollowLinks;
+ }
+
+#if defined(__WIN32__) && !defined(__WXWINCE__) && wxUSE_OLE
+ // if the path is a shortcut, return the target and optionally,
+ // the arguments
+ bool GetShortcutTarget(const wxString& shortcutPath,
+ wxString& targetFilename,
+ wxString* arguments = NULL) const;
+#endif
+
+#ifndef __WXWINCE__
+ // if the path contains the value of the environment variable named envname
+ // then this function replaces it with the string obtained from
+ // wxString::Format(replacementFmtString, value_of_envname_variable)
+ //
+ // Example:
+ // wxFileName fn("/usr/openwin/lib/someFile");
+ // fn.ReplaceEnvVariable("OPENWINHOME");
+ // // now fn.GetFullPath() == "$OPENWINHOME/lib/someFile"
+ bool ReplaceEnvVariable(const wxString& envname,
+ const wxString& replacementFmtString = "$%s",
+ wxPathFormat format = wxPATH_NATIVE);
+#endif
+
+ // replaces, if present in the path, the home directory for the given user
+ // (see wxGetHomeDir) with a tilde
+ bool ReplaceHomeDir(wxPathFormat format = wxPATH_NATIVE);
+
+
+ // Comparison
+
+ // compares with the rules of the given platforms format
+ bool SameAs(const wxFileName& filepath,
+ wxPathFormat format = wxPATH_NATIVE) const;
+
+ // compare with another filename object
+ bool operator==(const wxFileName& filename) const
+ { return SameAs(filename); }
+ bool operator!=(const wxFileName& filename) const
+ { return !SameAs(filename); }
+
+ // compare with a filename string interpreted as a native file name
+ bool operator==(const wxString& filename) const
+ { return SameAs(wxFileName(filename)); }
+ bool operator!=(const wxString& filename) const
+ { return !SameAs(wxFileName(filename)); }
+
+ // are the file names of this type cases sensitive?
+ static bool IsCaseSensitive( wxPathFormat format = wxPATH_NATIVE );
+
+ // is this filename absolute?
+ bool IsAbsolute(wxPathFormat format = wxPATH_NATIVE) const;
+
+ // is this filename relative?
+ bool IsRelative(wxPathFormat format = wxPATH_NATIVE) const
+ { return !IsAbsolute(format); }
+
+ // Returns the characters that aren't allowed in filenames
+ // on the specified platform.
+ static wxString GetForbiddenChars(wxPathFormat format = wxPATH_NATIVE);
+
+ // Information about path format
+
+ // get the string separating the volume from the path for this format,
+ // return an empty string if this format doesn't support the notion of
+ // volumes at all
+ static wxString GetVolumeSeparator(wxPathFormat format = wxPATH_NATIVE);
+
+ // get the string of path separators for this format
+ static wxString GetPathSeparators(wxPathFormat format = wxPATH_NATIVE);
+
+ // get the string of path terminators, i.e. characters which terminate the
+ // path
+ static wxString GetPathTerminators(wxPathFormat format = wxPATH_NATIVE);
+
+ // get the canonical path separator for this format
+ static wxUniChar GetPathSeparator(wxPathFormat format = wxPATH_NATIVE)
+ { return GetPathSeparators(format)[0u]; }
+
+ // is the char a path separator for this format?
+ static bool IsPathSeparator(wxChar ch, wxPathFormat format = wxPATH_NATIVE);
+
+ // is this is a DOS path which beings with a windows unique volume name
+ // ('\\?\Volume{guid}\')?
+ static bool IsMSWUniqueVolumeNamePath(const wxString& path,
+ wxPathFormat format = wxPATH_NATIVE);
+
+ // Dir accessors
+ size_t GetDirCount() const { return m_dirs.size(); }
+ bool AppendDir(const wxString& dir);
+ void PrependDir(const wxString& dir);
+ bool InsertDir(size_t before, const wxString& dir);
+ void RemoveDir(size_t pos);
+ void RemoveLastDir() { RemoveDir(GetDirCount() - 1); }
+
+ // Other accessors
+ void SetExt( const wxString &ext ) { m_ext = ext; m_hasExt = !m_ext.empty(); }
+ void ClearExt() { m_ext.clear(); m_hasExt = false; }
+ void SetEmptyExt() { m_ext.clear(); m_hasExt = true; }
+ wxString GetExt() const { return m_ext; }
+ bool HasExt() const { return m_hasExt; }
+
+ void SetName( const wxString &name ) { m_name = name; }
+ wxString GetName() const { return m_name; }
+ bool HasName() const { return !m_name.empty(); }
+
+ void SetVolume( const wxString &volume ) { m_volume = volume; }
+ wxString GetVolume() const { return m_volume; }
+ bool HasVolume() const { return !m_volume.empty(); }
+
+ // full name is the file name + extension (but without the path)
+ void SetFullName(const wxString& fullname);
+ wxString GetFullName() const;
+
+ const wxArrayString& GetDirs() const { return m_dirs; }
+
+ // flags are combination of wxPATH_GET_XXX flags
+ wxString GetPath(int flags = wxPATH_GET_VOLUME,
+ wxPathFormat format = wxPATH_NATIVE) const;
+
+ // Replace current path with this one
+ void SetPath( const wxString &path, wxPathFormat format = wxPATH_NATIVE );
+
+ // Construct full path with name and ext
+ wxString GetFullPath( wxPathFormat format = wxPATH_NATIVE ) const;
+
+ // Return the short form of the path (returns identity on non-Windows platforms)
+ wxString GetShortPath() const;
+
+ // Return the long form of the path (returns identity on non-Windows platforms)
+ wxString GetLongPath() const;
+
+ // Is this a file or directory (not necessarily an existing one)
+ bool IsDir() const { return m_name.empty() && m_ext.empty(); }
+
+ // various helpers
+
+ // get the canonical path format for this platform
+ static wxPathFormat GetFormat( wxPathFormat format = wxPATH_NATIVE );
+
+ // split a fullpath into the volume, path, (base) name and extension
+ // (all of the pointers can be NULL)
+ static void SplitPath(const wxString& fullpath,
+ wxString *volume,
+ wxString *path,
+ wxString *name,
+ wxString *ext,
+ bool *hasExt = NULL,
+ wxPathFormat format = wxPATH_NATIVE);
+
+ static void SplitPath(const wxString& fullpath,
+ wxString *volume,
+ wxString *path,
+ wxString *name,
+ wxString *ext,
+ wxPathFormat format)
+ {
+ SplitPath(fullpath, volume, path, name, ext, NULL, format);
+ }
+
+ // compatibility version: volume is part of path
+ static void SplitPath(const wxString& fullpath,
+ wxString *path,
+ wxString *name,
+ wxString *ext,
+ wxPathFormat format = wxPATH_NATIVE);
+
+ // split a path into volume and pure path part
+ static void SplitVolume(const wxString& fullpathWithVolume,
+ wxString *volume,
+ wxString *path,
+ wxPathFormat format = wxPATH_NATIVE);
+
+ // strip the file extension: "foo.bar" => "foo" (but ".baz" => ".baz")
+ static wxString StripExtension(const wxString& fullpath);
+
+#ifdef wxHAS_FILESYSTEM_VOLUMES
+ // return the string representing a file system volume, or drive
+ static wxString GetVolumeString(char drive, int flags = wxPATH_GET_SEPARATOR);
+#endif // wxHAS_FILESYSTEM_VOLUMES
+
+ // File size
+
+#if wxUSE_LONGLONG
+ // returns the size of the given filename
+ wxULongLong GetSize() const;
+ static wxULongLong GetSize(const wxString &file);
+
+ // returns the size in a human readable form
+ wxString
+ GetHumanReadableSize(const wxString& nullsize = wxGetTranslation("Not available"),
+ int precision = 1,
+ wxSizeConvention conv = wxSIZE_CONV_TRADITIONAL) const;
+ static wxString
+ GetHumanReadableSize(const wxULongLong& sz,
+ const wxString& nullsize = wxGetTranslation("Not available"),
+ int precision = 1,
+ wxSizeConvention conv = wxSIZE_CONV_TRADITIONAL);
+#endif // wxUSE_LONGLONG
+
+
+ // deprecated methods, don't use any more
+ // --------------------------------------
+
+#ifndef __DIGITALMARS__
+ wxString GetPath( bool withSep, wxPathFormat format = wxPATH_NATIVE ) const
+ { return GetPath(withSep ? wxPATH_GET_SEPARATOR : 0, format); }
+#endif
+ wxString GetPathWithSep(wxPathFormat format = wxPATH_NATIVE ) const
+ { return GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR, format); }
+
+private:
+ // check whether this dir is valid for Append/Prepend/InsertDir()
+ static bool IsValidDirComponent(const wxString& dir);
+
+ // the drive/volume/device specification (always empty for Unix)
+ wxString m_volume;
+
+ // the path components of the file
+ wxArrayString m_dirs;
+
+ // the file name and extension (empty for directories)
+ wxString m_name,
+ m_ext;
+
+ // when m_dirs is empty it may mean either that we have no path at all or
+ // that our path is '/', i.e. the root directory
+ //
+ // we use m_relative to distinguish between these two cases, it will be
+ // true in the former and false in the latter
+ //
+ // NB: the path is not absolute just because m_relative is false, it still
+ // needs the drive (i.e. volume) in some formats (Windows)
+ bool m_relative;
+
+ // when m_ext is empty, it may be because we don't have any extension or
+ // because we have an empty extension
+ //
+ // the difference is important as file with name "foo" and without
+ // extension has full name "foo" while with empty extension it is "foo."
+ bool m_hasExt;
+
+ // by default, symlinks are dereferenced but this flag can be set with
+ // DontFollowLink() to change this and make different operations work on
+ // this file path itself instead of the target of the symlink
+ bool m_dontFollowLinks;
+};
+
+#endif // _WX_FILENAME_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/filepicker.h
+// Purpose: wxFilePickerCtrl, wxDirPickerCtrl base header
+// Author: Francesco Montorsi
+// Modified by:
+// Created: 14/4/2006
+// Copyright: (c) Francesco Montorsi
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FILEDIRPICKER_H_BASE_
+#define _WX_FILEDIRPICKER_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL
+
+#include "wx/pickerbase.h"
+#include "wx/filename.h"
+
+class WXDLLIMPEXP_FWD_CORE wxDialog;
+class WXDLLIMPEXP_FWD_CORE wxFileDirPickerEvent;
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxFilePickerWidgetLabel[];
+extern WXDLLIMPEXP_DATA_CORE(const char) wxFilePickerWidgetNameStr[];
+extern WXDLLIMPEXP_DATA_CORE(const char) wxFilePickerCtrlNameStr[];
+extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorPromptStr[];
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxDirPickerWidgetLabel[];
+extern WXDLLIMPEXP_DATA_CORE(const char) wxDirPickerWidgetNameStr[];
+extern WXDLLIMPEXP_DATA_CORE(const char) wxDirPickerCtrlNameStr[];
+extern WXDLLIMPEXP_DATA_CORE(const char) wxDirSelectorPromptStr[];
+
+// ----------------------------------------------------------------------------
+// wxFileDirPickerEvent: used by wxFilePickerCtrl and wxDirPickerCtrl only
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFileDirPickerEvent : public wxCommandEvent
+{
+public:
+ wxFileDirPickerEvent() {}
+ wxFileDirPickerEvent(wxEventType type, wxObject *generator, int id, const wxString &path)
+ : wxCommandEvent(type, id),
+ m_path(path)
+ {
+ SetEventObject(generator);
+ }
+
+ wxString GetPath() const { return m_path; }
+ void SetPath(const wxString &p) { m_path = p; }
+
+ // default copy ctor, assignment operator and dtor are ok
+ virtual wxEvent *Clone() const { return new wxFileDirPickerEvent(*this); }
+
+private:
+ wxString m_path;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFileDirPickerEvent)
+};
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILEPICKER_CHANGED, wxFileDirPickerEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DIRPICKER_CHANGED, wxFileDirPickerEvent );
+
+// ----------------------------------------------------------------------------
+// event types and macros
+// ----------------------------------------------------------------------------
+
+typedef void (wxEvtHandler::*wxFileDirPickerEventFunction)(wxFileDirPickerEvent&);
+
+#define wxFileDirPickerEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxFileDirPickerEventFunction, func)
+
+#define EVT_FILEPICKER_CHANGED(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_FILEPICKER_CHANGED, id, wxFileDirPickerEventHandler(fn))
+#define EVT_DIRPICKER_CHANGED(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_DIRPICKER_CHANGED, id, wxFileDirPickerEventHandler(fn))
+
+// ----------------------------------------------------------------------------
+// wxFileDirPickerWidgetBase: a generic abstract interface which must be
+// implemented by controls used by wxFileDirPickerCtrlBase
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFileDirPickerWidgetBase
+{
+public:
+ wxFileDirPickerWidgetBase() { }
+ virtual ~wxFileDirPickerWidgetBase() { }
+
+ // Path here is the name of the selected file or directory.
+ wxString GetPath() const { return m_path; }
+ virtual void SetPath(const wxString &str) { m_path=str; }
+
+ // Set the directory to open the file browse dialog at initially.
+ virtual void SetInitialDirectory(const wxString& dir) = 0;
+
+ // returns the picker widget cast to wxControl
+ virtual wxControl *AsControl() = 0;
+
+protected:
+ virtual void UpdateDialogPath(wxDialog *) = 0;
+ virtual void UpdatePathFromDialog(wxDialog *) = 0;
+
+ wxString m_path;
+};
+
+// Styles which must be supported by all controls implementing wxFileDirPickerWidgetBase
+// NB: these styles must be defined to carefully-chosen values to
+// avoid conflicts with wxButton's styles
+
+#define wxFLP_OPEN 0x0400
+#define wxFLP_SAVE 0x0800
+#define wxFLP_OVERWRITE_PROMPT 0x1000
+#define wxFLP_FILE_MUST_EXIST 0x2000
+#define wxFLP_CHANGE_DIR 0x4000
+#define wxFLP_SMALL wxPB_SMALL
+
+// NOTE: wxMULTIPLE is not supported !
+
+
+#define wxDIRP_DIR_MUST_EXIST 0x0008
+#define wxDIRP_CHANGE_DIR 0x0010
+#define wxDIRP_SMALL wxPB_SMALL
+
+
+// map platform-dependent controls which implement the wxFileDirPickerWidgetBase
+// under the name "wxFilePickerWidget" and "wxDirPickerWidget".
+// NOTE: wxFileDirPickerCtrlBase will allocate a wx{File|Dir}PickerWidget and this
+// requires that all classes being mapped as wx{File|Dir}PickerWidget have the
+// same prototype for the contructor...
+// since GTK >= 2.6, there is GtkFileButton
+#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
+ #include "wx/gtk/filepicker.h"
+ #define wxFilePickerWidget wxFileButton
+ #define wxDirPickerWidget wxDirButton
+#else
+ #include "wx/generic/filepickerg.h"
+ #define wxFilePickerWidget wxGenericFileButton
+ #define wxDirPickerWidget wxGenericDirButton
+#endif
+
+
+
+// ----------------------------------------------------------------------------
+// wxFileDirPickerCtrlBase
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFileDirPickerCtrlBase : public wxPickerBase
+{
+public:
+ wxFileDirPickerCtrlBase() {}
+
+protected:
+ // NB: no default values since this function will never be used
+ // directly by the user and derived classes wouldn't use them
+ bool CreateBase(wxWindow *parent,
+ wxWindowID id,
+ const wxString& path,
+ const wxString &message,
+ const wxString &wildcard,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxValidator& validator,
+ const wxString& name);
+
+public: // public API
+
+ wxString GetPath() const;
+ void SetPath(const wxString &str);
+
+ // Set the directory to open the file browse dialog at initially.
+ void SetInitialDirectory(const wxString& dir)
+ {
+ m_pickerIface->SetInitialDirectory(dir);
+ }
+
+public: // internal functions
+
+ void UpdatePickerFromTextCtrl();
+ void UpdateTextCtrlFromPicker();
+
+ // event handler for our picker
+ void OnFileDirChange(wxFileDirPickerEvent &);
+
+ // TRUE if any textctrl change should update the current working directory
+ virtual bool IsCwdToUpdate() const = 0;
+
+ // Returns the event type sent by this picker
+ virtual wxEventType GetEventType() const = 0;
+
+ virtual void DoConnect( wxControl *sender, wxFileDirPickerCtrlBase *eventSink ) = 0;
+
+ // Returns the filtered value currently placed in the text control (if present).
+ virtual wxString GetTextCtrlValue() const = 0;
+
+protected:
+ // creates the picker control
+ virtual
+ wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent,
+ const wxString& path,
+ const wxString& message,
+ const wxString& wildcard) = 0;
+
+protected:
+
+ // m_picker object as wxFileDirPickerWidgetBase interface
+ wxFileDirPickerWidgetBase *m_pickerIface;
+};
+
+#endif // wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL
+
+
+#if wxUSE_FILEPICKERCTRL
+
+// ----------------------------------------------------------------------------
+// wxFilePickerCtrl: platform-independent class which embeds the
+// platform-dependent wxFilePickerWidget and, if wxFLP_USE_TEXTCTRL style is
+// used, a textctrl next to it.
+// ----------------------------------------------------------------------------
+
+#define wxFLP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL)
+
+#ifdef __WXGTK__
+ // GTK apps usually don't have a textctrl next to the picker
+ #define wxFLP_DEFAULT_STYLE (wxFLP_OPEN|wxFLP_FILE_MUST_EXIST)
+#else
+ #define wxFLP_DEFAULT_STYLE (wxFLP_USE_TEXTCTRL|wxFLP_OPEN|wxFLP_FILE_MUST_EXIST)
+#endif
+
+class WXDLLIMPEXP_CORE wxFilePickerCtrl : public wxFileDirPickerCtrlBase
+{
+public:
+ wxFilePickerCtrl() {}
+
+ wxFilePickerCtrl(wxWindow *parent,
+ wxWindowID id,
+ const wxString& path = wxEmptyString,
+ const wxString& message = wxFileSelectorPromptStr,
+ const wxString& wildcard = wxFileSelectorDefaultWildcardStr,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxFLP_DEFAULT_STYLE,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxFilePickerCtrlNameStr)
+ {
+ Create(parent, id, path, message, wildcard, pos, size, style,
+ validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& path = wxEmptyString,
+ const wxString& message = wxFileSelectorPromptStr,
+ const wxString& wildcard = wxFileSelectorDefaultWildcardStr,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxFLP_DEFAULT_STYLE,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxFilePickerCtrlNameStr);
+
+ void SetFileName(const wxFileName &filename)
+ { SetPath(filename.GetFullPath()); }
+
+ wxFileName GetFileName() const
+ { return wxFileName(GetPath()); }
+
+public: // overrides
+
+ // return the text control value in canonical form
+ wxString GetTextCtrlValue() const;
+
+ bool IsCwdToUpdate() const
+ { return HasFlag(wxFLP_CHANGE_DIR); }
+
+ wxEventType GetEventType() const
+ { return wxEVT_FILEPICKER_CHANGED; }
+
+ virtual void DoConnect( wxControl *sender, wxFileDirPickerCtrlBase *eventSink )
+ {
+ sender->Connect( wxEVT_FILEPICKER_CHANGED,
+ wxFileDirPickerEventHandler( wxFileDirPickerCtrlBase::OnFileDirChange ),
+ NULL, eventSink );
+ }
+
+
+protected:
+ virtual
+ wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent,
+ const wxString& path,
+ const wxString& message,
+ const wxString& wildcard)
+ {
+ return new wxFilePickerWidget(parent, wxID_ANY,
+ wxGetTranslation(wxFilePickerWidgetLabel),
+ path, message, wildcard,
+ wxDefaultPosition, wxDefaultSize,
+ GetPickerStyle(GetWindowStyle()));
+ }
+
+ // extracts the style for our picker from wxFileDirPickerCtrlBase's style
+ long GetPickerStyle(long style) const
+ {
+ return style & (wxFLP_OPEN |
+ wxFLP_SAVE |
+ wxFLP_OVERWRITE_PROMPT |
+ wxFLP_FILE_MUST_EXIST |
+ wxFLP_CHANGE_DIR |
+ wxFLP_USE_TEXTCTRL |
+ wxFLP_SMALL);
+ }
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxFilePickerCtrl)
+};
+
+#endif // wxUSE_FILEPICKERCTRL
+
+
+#if wxUSE_DIRPICKERCTRL
+
+// ----------------------------------------------------------------------------
+// wxDirPickerCtrl: platform-independent class which embeds the
+// platform-dependent wxDirPickerWidget and eventually a textctrl
+// (see wxDIRP_USE_TEXTCTRL) next to it.
+// ----------------------------------------------------------------------------
+
+#define wxDIRP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL)
+
+#ifdef __WXGTK__
+ // GTK apps usually don't have a textctrl next to the picker
+ #define wxDIRP_DEFAULT_STYLE (wxDIRP_DIR_MUST_EXIST)
+#else
+ #define wxDIRP_DEFAULT_STYLE (wxDIRP_USE_TEXTCTRL|wxDIRP_DIR_MUST_EXIST)
+#endif
+
+class WXDLLIMPEXP_CORE wxDirPickerCtrl : public wxFileDirPickerCtrlBase
+{
+public:
+ wxDirPickerCtrl() {}
+
+ wxDirPickerCtrl(wxWindow *parent, wxWindowID id,
+ const wxString& path = wxEmptyString,
+ const wxString& message = wxDirSelectorPromptStr,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDIRP_DEFAULT_STYLE,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxDirPickerCtrlNameStr)
+ {
+ Create(parent, id, path, message, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent, wxWindowID id,
+ const wxString& path = wxEmptyString,
+ const wxString& message = wxDirSelectorPromptStr,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDIRP_DEFAULT_STYLE,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxDirPickerCtrlNameStr);
+
+ void SetDirName(const wxFileName &dirname)
+ { SetPath(dirname.GetPath()); }
+
+ wxFileName GetDirName() const
+ { return wxFileName::DirName(GetPath()); }
+
+public: // overrides
+
+ wxString GetTextCtrlValue() const;
+
+ bool IsCwdToUpdate() const
+ { return HasFlag(wxDIRP_CHANGE_DIR); }
+
+ wxEventType GetEventType() const
+ { return wxEVT_DIRPICKER_CHANGED; }
+
+ virtual void DoConnect( wxControl *sender, wxFileDirPickerCtrlBase *eventSink )
+ {
+ sender->Connect( wxEVT_DIRPICKER_CHANGED,
+ wxFileDirPickerEventHandler( wxFileDirPickerCtrlBase::OnFileDirChange ),
+ NULL, eventSink );
+ }
+
+
+protected:
+ virtual
+ wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent,
+ const wxString& path,
+ const wxString& message,
+ const wxString& WXUNUSED(wildcard))
+ {
+ return new wxDirPickerWidget(parent, wxID_ANY,
+ wxGetTranslation(wxDirPickerWidgetLabel),
+ path, message,
+ wxDefaultPosition, wxDefaultSize,
+ GetPickerStyle(GetWindowStyle()));
+ }
+
+ // extracts the style for our picker from wxFileDirPickerCtrlBase's style
+ long GetPickerStyle(long style) const
+ {
+ return style & (wxDIRP_DIR_MUST_EXIST |
+ wxDIRP_CHANGE_DIR |
+ wxDIRP_USE_TEXTCTRL |
+ wxDIRP_SMALL);
+ }
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxDirPickerCtrl)
+};
+
+#endif // wxUSE_DIRPICKERCTRL
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_FILEPICKER_CHANGED wxEVT_FILEPICKER_CHANGED
+#define wxEVT_COMMAND_DIRPICKER_CHANGED wxEVT_DIRPICKER_CHANGED
+
+#endif // _WX_FILEDIRPICKER_H_BASE_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/filesys.h
+// Purpose: class for opening files - virtual file system
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __FILESYS_H__
+#define __FILESYS_H__
+
+#include "wx/defs.h"
+
+#if wxUSE_FILESYSTEM
+
+#if !wxUSE_STREAMS
+#error You cannot compile virtual file systems without wxUSE_STREAMS
+#endif
+
+#if wxUSE_HTML && !wxUSE_FILESYSTEM
+#error You cannot compile wxHTML without virtual file systems
+#endif
+
+#include "wx/stream.h"
+#include "wx/datetime.h"
+#include "wx/filename.h"
+#include "wx/hashmap.h"
+
+class WXDLLIMPEXP_FWD_BASE wxFSFile;
+class WXDLLIMPEXP_FWD_BASE wxFileSystemHandler;
+class WXDLLIMPEXP_FWD_BASE wxFileSystem;
+
+//--------------------------------------------------------------------------------
+// wxFSFile
+// This class is a file opened using wxFileSystem. It consists of
+// input stream, location, mime type & optional anchor
+// (in 'index.htm#chapter2', 'chapter2' is anchor)
+//--------------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxFSFile : public wxObject
+{
+public:
+ wxFSFile(wxInputStream *stream, const wxString& loc,
+ const wxString& mimetype, const wxString& anchor
+#if wxUSE_DATETIME
+ , wxDateTime modif
+#endif // wxUSE_DATETIME
+ )
+ {
+ m_Stream = stream;
+ m_Location = loc;
+ m_MimeType = mimetype.Lower();
+ m_Anchor = anchor;
+#if wxUSE_DATETIME
+ m_Modif = modif;
+#endif // wxUSE_DATETIME
+ }
+
+ virtual ~wxFSFile() { delete m_Stream; }
+
+ // returns stream. This doesn't give away ownership of the stream object.
+ wxInputStream *GetStream() const { return m_Stream; }
+
+ // gives away the ownership of the current stream.
+ wxInputStream *DetachStream()
+ {
+ wxInputStream *stream = m_Stream;
+ m_Stream = NULL;
+ return stream;
+ }
+
+ // deletes the current stream and takes ownership of another.
+ void SetStream(wxInputStream *stream)
+ {
+ delete m_Stream;
+ m_Stream = stream;
+ }
+
+ // returns file's mime type
+ const wxString& GetMimeType() const;
+
+ // returns the original location (aka filename) of the file
+ const wxString& GetLocation() const { return m_Location; }
+
+ const wxString& GetAnchor() const { return m_Anchor; }
+
+#if wxUSE_DATETIME
+ wxDateTime GetModificationTime() const { return m_Modif; }
+#endif // wxUSE_DATETIME
+
+private:
+ wxInputStream *m_Stream;
+ wxString m_Location;
+ wxString m_MimeType;
+ wxString m_Anchor;
+#if wxUSE_DATETIME
+ wxDateTime m_Modif;
+#endif // wxUSE_DATETIME
+
+ DECLARE_ABSTRACT_CLASS(wxFSFile)
+ wxDECLARE_NO_COPY_CLASS(wxFSFile);
+};
+
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxFileSystemHandler
+// This class is FS handler for wxFileSystem. It provides
+// interface to access certain
+// kinds of files (HTPP, FTP, local, tar.gz etc..)
+//--------------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxFileSystemHandler : public wxObject
+{
+public:
+ wxFileSystemHandler() : wxObject() {}
+
+ // returns true if this handler is able to open given location
+ virtual bool CanOpen(const wxString& location) = 0;
+
+ // opens given file and returns pointer to input stream.
+ // Returns NULL if opening failed.
+ // The location is always absolute path.
+ virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) = 0;
+
+ // Finds first/next file that matches spec wildcard. flags can be wxDIR for restricting
+ // the query to directories or wxFILE for files only or 0 for either.
+ // Returns filename or empty string if no more matching file exists
+ virtual wxString FindFirst(const wxString& spec, int flags = 0);
+ virtual wxString FindNext();
+
+ // Returns MIME type of the file - w/o need to open it
+ // (default behaviour is that it returns type based on extension)
+ static wxString GetMimeTypeFromExt(const wxString& location);
+
+protected:
+ // returns protocol ("file", "http", "tar" etc.) The last (most right)
+ // protocol is used:
+ // {it returns "tar" for "file:subdir/archive.tar.gz#tar:/README.txt"}
+ static wxString GetProtocol(const wxString& location);
+
+ // returns left part of address:
+ // {it returns "file:subdir/archive.tar.gz" for "file:subdir/archive.tar.gz#tar:/README.txt"}
+ static wxString GetLeftLocation(const wxString& location);
+
+ // returns anchor part of address:
+ // {it returns "anchor" for "file:subdir/archive.tar.gz#tar:/README.txt#anchor"}
+ // NOTE: anchor is NOT a part of GetLeftLocation()'s return value
+ static wxString GetAnchor(const wxString& location);
+
+ // returns right part of address:
+ // {it returns "/README.txt" for "file:subdir/archive.tar.gz#tar:/README.txt"}
+ static wxString GetRightLocation(const wxString& location);
+
+ DECLARE_ABSTRACT_CLASS(wxFileSystemHandler)
+};
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxFileSystem
+// This class provides simple interface for opening various
+// kinds of files (HTPP, FTP, local, tar.gz etc..)
+//--------------------------------------------------------------------------------
+
+// Open Bit Flags
+enum wxFileSystemOpenFlags
+{
+ wxFS_READ = 1, // Open for reading
+ wxFS_SEEKABLE = 4 // Returned stream will be seekable
+};
+
+WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL(wxFileSystemHandler*, wxFSHandlerHash, class WXDLLIMPEXP_BASE);
+
+class WXDLLIMPEXP_BASE wxFileSystem : public wxObject
+{
+public:
+ wxFileSystem() : wxObject() { m_FindFileHandler = NULL;}
+ virtual ~wxFileSystem();
+
+ // sets the current location. Every call to OpenFile is
+ // relative to this location.
+ // NOTE !!
+ // unless is_dir = true 'location' is *not* the directory but
+ // file contained in this directory
+ // (so ChangePathTo("dir/subdir/xh.htm") sets m_Path to "dir/subdir/")
+ void ChangePathTo(const wxString& location, bool is_dir = false);
+
+ wxString GetPath() const {return m_Path;}
+
+ // opens given file and returns pointer to input stream.
+ // Returns NULL if opening failed.
+ // It first tries to open the file in relative scope
+ // (based on ChangePathTo()'s value) and then as an absolute
+ // path.
+ wxFSFile* OpenFile(const wxString& location, int flags = wxFS_READ);
+
+ // Finds first/next file that matches spec wildcard. flags can be wxDIR for restricting
+ // the query to directories or wxFILE for files only or 0 for either.
+ // Returns filename or empty string if no more matching file exists
+ wxString FindFirst(const wxString& spec, int flags = 0);
+ wxString FindNext();
+
+ // find a file in a list of directories, returns false if not found
+ bool FindFileInPath(wxString *pStr,
+ const wxString& path, const wxString& file);
+
+ // Adds FS handler.
+ // In fact, this class is only front-end to the FS handlers :-)
+ static void AddHandler(wxFileSystemHandler *handler);
+
+ // Removes FS handler
+ static wxFileSystemHandler* RemoveHandler(wxFileSystemHandler *handler);
+
+ // Returns true if there is a handler which can open the given location.
+ static bool HasHandlerForPath(const wxString& location);
+
+ // remove all items from the m_Handlers list
+ static void CleanUpHandlers();
+
+ // Returns the native path for a file URL
+ static wxFileName URLToFileName(const wxString& url);
+
+ // Returns the file URL for a native path
+ static wxString FileNameToURL(const wxFileName& filename);
+
+
+protected:
+ wxFileSystemHandler *MakeLocal(wxFileSystemHandler *h);
+
+ wxString m_Path;
+ // the path (location) we are currently in
+ // this is path, not file!
+ // (so if you opened test/demo.htm, it is
+ // "test/", not "test/demo.htm")
+ wxString m_LastName;
+ // name of last opened file (full path)
+ static wxList m_Handlers;
+ // list of FS handlers
+ wxFileSystemHandler *m_FindFileHandler;
+ // handler that succeed in FindFirst query
+ wxFSHandlerHash m_LocalHandlers;
+ // Handlers local to this instance
+
+ DECLARE_DYNAMIC_CLASS(wxFileSystem)
+ wxDECLARE_NO_COPY_CLASS(wxFileSystem);
+};
+
+
+/*
+
+'location' syntax:
+
+To determine FS type, we're using standard KDE notation:
+file:/absolute/path/file.htm
+file:relative_path/xxxxx.html
+/some/path/x.file ('file:' is default)
+http://www.gnome.org
+file:subdir/archive.tar.gz#tar:/README.txt
+
+special characters :
+ ':' - FS identificator is before this char
+ '#' - separator. It can be either HTML anchor ("index.html#news")
+ (in case there is no ':' in the string to the right from it)
+ or FS separator
+ (example : http://www.wxhtml.org/wxhtml-0.1.tar.gz#tar:/include/wxhtml/filesys.h"
+ this would access tgz archive stored on web)
+ '/' - directory (path) separator. It is used to determine upper-level path.
+ HEY! Don't use \ even if you're on Windows!
+
+*/
+
+
+class WXDLLIMPEXP_BASE wxLocalFSHandler : public wxFileSystemHandler
+{
+public:
+ virtual bool CanOpen(const wxString& location);
+ virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
+ virtual wxString FindFirst(const wxString& spec, int flags = 0);
+ virtual wxString FindNext();
+
+ // wxLocalFSHandler will prefix all filenames with 'root' before accessing
+ // files on disk. This effectively makes 'root' the top-level directory
+ // and prevents access to files outside this directory.
+ // (This is similar to Unix command 'chroot'.)
+ static void Chroot(const wxString& root) { ms_root = root; }
+
+protected:
+ static wxString ms_root;
+};
+
+// Stream reading data from wxFSFile: this allows to use virtual files with any
+// wx functions accepting streams.
+class WXDLLIMPEXP_BASE wxFSInputStream : public wxWrapperInputStream
+{
+public:
+ // Notice that wxFS_READ is implied in flags.
+ wxFSInputStream(const wxString& filename, int flags = 0);
+ virtual ~wxFSInputStream();
+
+private:
+ wxFSFile* m_file;
+
+ wxDECLARE_NO_COPY_CLASS(wxFSInputStream);
+};
+
+#endif
+ // wxUSE_FILESYSTEM
+
+#endif
+ // __FILESYS_H__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/flags.h
+// Purpose: a bitset suited for replacing the current style flags
+// Author: Stefan Csomor
+// Modified by:
+// Created: 27/07/03
+// Copyright: (c) 2003 Stefan Csomor
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SETH__
+#define _WX_SETH__
+
+// wxBitset should be applied to an enum, then this can be used like
+// bitwise operators but keeps the type safety and information, the
+// enums must be in a sequence , their value determines the bit position
+// that they represent
+// The api is made as close as possible to <bitset>
+
+template <class T> class wxBitset
+{
+ friend class wxEnumData ;
+public:
+ // creates a wxBitset<> object with all flags initialized to 0
+ wxBitset() { m_data = 0; }
+
+ // created a wxBitset<> object initialized according to the bits of the
+ // integral value val
+ wxBitset(unsigned long val) { m_data = val ; }
+
+ // copies the content in the new wxBitset<> object from another one
+ wxBitset(const wxBitset &src) { m_data = src.m_data; }
+
+ // creates a wxBitset<> object that has the specific flag set
+ wxBitset(const T el) { m_data |= 1 << el; }
+
+ // returns the integral value that the bits of this object represent
+ unsigned long to_ulong() const { return m_data ; }
+
+ // assignment
+ wxBitset &operator =(const wxBitset &rhs)
+ {
+ m_data = rhs.m_data;
+ return *this;
+ }
+
+ // bitwise or operator, sets all bits that are in rhs and leaves
+ // the rest unchanged
+ wxBitset &operator |=(const wxBitset &rhs)
+ {
+ m_data |= rhs.m_data;
+ return *this;
+ }
+
+ // bitwsie exclusive-or operator, toggles the value of all bits
+ // that are set in bits and leaves all others unchanged
+ wxBitset &operator ^=(const wxBitset &rhs) // difference
+ {
+ m_data ^= rhs.m_data;
+ return *this;
+ }
+
+ // bitwise and operator, resets all bits that are not in rhs and leaves
+ // all others unchanged
+ wxBitset &operator &=(const wxBitset &rhs) // intersection
+ {
+ m_data &= rhs.m_data;
+ return *this;
+ }
+
+ // bitwise or operator, returns a new bitset that has all bits set that set are in
+ // bitset2 or in this bitset
+ wxBitset operator |(const wxBitset &bitset2) const // union
+ {
+ wxBitset<T> s;
+ s.m_data = m_data | bitset2.m_data;
+ return s;
+ }
+
+ // bitwise exclusive-or operator, returns a new bitset that has all bits set that are set either in
+ // bitset2 or in this bitset but not in both
+ wxBitset operator ^(const wxBitset &bitset2) const // difference
+ {
+ wxBitset<T> s;
+ s.m_data = m_data ^ bitset2.m_data;
+ return s;
+ }
+
+ // bitwise and operator, returns a new bitset that has all bits set that are set both in
+ // bitset2 and in this bitset
+ wxBitset operator &(const wxBitset &bitset2) const // intersection
+ {
+ wxBitset<T> s;
+ s.m_data = m_data & bitset2.m_data;
+ return s;
+ }
+
+ // sets appropriate the bit to true
+ wxBitset& set(const T el) //Add element
+ {
+ m_data |= 1 << el;
+ return *this;
+ }
+
+ // clears the appropriate flag to false
+ wxBitset& reset(const T el) //remove element
+ {
+ m_data &= ~(1 << el);
+ return *this;
+ }
+
+ // clear all flags
+ wxBitset& reset()
+ {
+ m_data = 0;
+ return *this;
+ }
+
+ // true if this flag is set
+ bool test(const T el) const
+ {
+ return (m_data & (1 << el)) ? true : false;
+ }
+
+ // true if no flag is set
+ bool none() const
+ {
+ return m_data == 0;
+ }
+
+ // true if any flag is set
+ bool any() const
+ {
+ return m_data != 0;
+ }
+
+ // true if both have the same flags
+ bool operator ==(const wxBitset &rhs) const
+ {
+ return m_data == rhs.m_data;
+ }
+
+ // true if both differ in their flags set
+ bool operator !=(const wxBitset &rhs) const
+ {
+ return !operator==(rhs);
+ }
+
+ bool operator[] (const T el) const { return test(el) ; }
+
+private :
+ unsigned long m_data;
+};
+
+#if wxUSE_EXTENDED_RTTI
+
+#define wxDEFINE_FLAGS( flags ) \
+ class WXDLLIMPEXP_BASE flags \
+ {\
+ public : \
+ flags(long data=0) :m_data(data) {} \
+ long m_data ;\
+ bool operator ==(const flags &rhs) const { return m_data == rhs.m_data; }\
+ } ;
+
+#else
+
+#define wxDEFINE_FLAGS( flags )
+
+#endif
+
+#if WXWIN_COMPATIBILITY_2_8
+ #define WX_DEFINE_FLAGS wxDEFINE_FLAGS
+#endif
+
+#endif
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/fmappriv.h
+// Purpose: private wxFontMapper stuff, not to be used by the library users
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 21.06.2003 (extracted from common/fontmap.cpp)
+// Copyright: (c) 1999-2003 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FMAPPRIV_H_
+#define _WX_FMAPPRIV_H_
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// a special pseudo encoding which means "don't ask me about this charset
+// any more" -- we need it to avoid driving the user crazy with asking him
+// time after time about the same charset which he [presumably] doesn't
+// have the fonts for
+enum { wxFONTENCODING_UNKNOWN = -2 };
+
+// the config paths we use
+#if wxUSE_CONFIG
+
+#define FONTMAPPER_ROOT_PATH wxT("/wxWindows/FontMapper")
+#define FONTMAPPER_CHARSET_PATH wxT("Charsets")
+#define FONTMAPPER_CHARSET_ALIAS_PATH wxT("Aliases")
+
+#endif // wxUSE_CONFIG
+
+// ----------------------------------------------------------------------------
+// wxFontMapperPathChanger: change the config path during our lifetime
+// ----------------------------------------------------------------------------
+
+#if wxUSE_CONFIG && wxUSE_FILECONFIG
+
+class wxFontMapperPathChanger
+{
+public:
+ wxFontMapperPathChanger(wxFontMapperBase *fontMapper, const wxString& path)
+ {
+ m_fontMapper = fontMapper;
+ m_ok = m_fontMapper->ChangePath(path, &m_pathOld);
+ }
+
+ bool IsOk() const { return m_ok; }
+
+ ~wxFontMapperPathChanger()
+ {
+ if ( IsOk() )
+ m_fontMapper->RestorePath(m_pathOld);
+ }
+
+private:
+ // the fontmapper object we're working with
+ wxFontMapperBase *m_fontMapper;
+
+ // the old path to be restored if m_ok
+ wxString m_pathOld;
+
+ // have we changed the path successfully?
+ bool m_ok;
+
+
+ wxDECLARE_NO_COPY_CLASS(wxFontMapperPathChanger);
+};
+
+#endif // wxUSE_CONFIG
+
+#endif // _WX_FMAPPRIV_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/font.h
+// Purpose: wxFontBase class: the interface of wxFont
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 20.09.99
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FONT_H_BASE_
+#define _WX_FONT_H_BASE_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h" // for wxDEFAULT &c
+#include "wx/fontenc.h" // the font encoding constants
+#include "wx/gdiobj.h" // the base class
+#include "wx/gdicmn.h" // for wxGDIObjListBase
+
+// ----------------------------------------------------------------------------
+// forward declarations
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxFont;
+
+// ----------------------------------------------------------------------------
+// font constants
+// ----------------------------------------------------------------------------
+
+// standard font families: these may be used only for the font creation, it
+// doesn't make sense to query an existing font for its font family as,
+// especially if the font had been created from a native font description, it
+// may be unknown
+enum wxFontFamily
+{
+ wxFONTFAMILY_DEFAULT = wxDEFAULT,
+ wxFONTFAMILY_DECORATIVE = wxDECORATIVE,
+ wxFONTFAMILY_ROMAN = wxROMAN,
+ wxFONTFAMILY_SCRIPT = wxSCRIPT,
+ wxFONTFAMILY_SWISS = wxSWISS,
+ wxFONTFAMILY_MODERN = wxMODERN,
+ wxFONTFAMILY_TELETYPE = wxTELETYPE,
+ wxFONTFAMILY_MAX,
+ wxFONTFAMILY_UNKNOWN = wxFONTFAMILY_MAX
+};
+
+// font styles
+enum wxFontStyle
+{
+ wxFONTSTYLE_NORMAL = wxNORMAL,
+ wxFONTSTYLE_ITALIC = wxITALIC,
+ wxFONTSTYLE_SLANT = wxSLANT,
+ wxFONTSTYLE_MAX
+};
+
+// font weights
+enum wxFontWeight
+{
+ wxFONTWEIGHT_NORMAL = wxNORMAL,
+ wxFONTWEIGHT_LIGHT = wxLIGHT,
+ wxFONTWEIGHT_BOLD = wxBOLD,
+ wxFONTWEIGHT_MAX
+};
+
+// Symbolic font sizes as defined in CSS specification.
+enum wxFontSymbolicSize
+{
+ wxFONTSIZE_XX_SMALL = -3,
+ wxFONTSIZE_X_SMALL,
+ wxFONTSIZE_SMALL,
+ wxFONTSIZE_MEDIUM,
+ wxFONTSIZE_LARGE,
+ wxFONTSIZE_X_LARGE,
+ wxFONTSIZE_XX_LARGE
+};
+
+// the font flag bits for the new font ctor accepting one combined flags word
+enum wxFontFlag
+{
+ // no special flags: font with default weight/slant/anti-aliasing
+ wxFONTFLAG_DEFAULT = 0,
+
+ // slant flags (default: no slant)
+ wxFONTFLAG_ITALIC = 1 << 0,
+ wxFONTFLAG_SLANT = 1 << 1,
+
+ // weight flags (default: medium)
+ wxFONTFLAG_LIGHT = 1 << 2,
+ wxFONTFLAG_BOLD = 1 << 3,
+
+ // anti-aliasing flag: force on or off (default: the current system default)
+ wxFONTFLAG_ANTIALIASED = 1 << 4,
+ wxFONTFLAG_NOT_ANTIALIASED = 1 << 5,
+
+ // underlined/strikethrough flags (default: no lines)
+ wxFONTFLAG_UNDERLINED = 1 << 6,
+ wxFONTFLAG_STRIKETHROUGH = 1 << 7,
+
+ // the mask of all currently used flags
+ wxFONTFLAG_MASK = wxFONTFLAG_ITALIC |
+ wxFONTFLAG_SLANT |
+ wxFONTFLAG_LIGHT |
+ wxFONTFLAG_BOLD |
+ wxFONTFLAG_ANTIALIASED |
+ wxFONTFLAG_NOT_ANTIALIASED |
+ wxFONTFLAG_UNDERLINED |
+ wxFONTFLAG_STRIKETHROUGH
+};
+
+// ----------------------------------------------------------------------------
+// wxFontInfo describes a wxFont
+// ----------------------------------------------------------------------------
+
+class wxFontInfo
+{
+public:
+ // Default ctor uses the default font size appropriate for the current
+ // platform.
+ wxFontInfo()
+ { InitPointSize(-1); }
+
+ // These ctors specify the font size, either in points or in pixels.
+ wxEXPLICIT wxFontInfo(int pointSize)
+ { InitPointSize(pointSize); }
+ wxEXPLICIT wxFontInfo(const wxSize& pixelSize) : m_pixelSize(pixelSize)
+ { Init(); }
+
+ // Setters for the various attributes. All of them return the object itself
+ // so that the calls to them could be chained.
+ wxFontInfo& Family(wxFontFamily family)
+ { m_family = family; return *this; }
+ wxFontInfo& FaceName(const wxString& faceName)
+ { m_faceName = faceName; return *this; }
+
+ wxFontInfo& Bold(bool bold = true)
+ { SetFlag(wxFONTFLAG_BOLD, bold); return *this; }
+ wxFontInfo& Light(bool light = true)
+ { SetFlag(wxFONTFLAG_LIGHT, light); return *this; }
+
+ wxFontInfo& Italic(bool italic = true)
+ { SetFlag(wxFONTFLAG_ITALIC, italic); return *this; }
+ wxFontInfo& Slant(bool slant = true)
+ { SetFlag(wxFONTFLAG_SLANT, slant); return *this; }
+
+ wxFontInfo& AntiAliased(bool antiAliased = true)
+ { SetFlag(wxFONTFLAG_ANTIALIASED, antiAliased); return *this; }
+ wxFontInfo& Underlined(bool underlined = true)
+ { SetFlag(wxFONTFLAG_UNDERLINED, underlined); return *this; }
+ wxFontInfo& Strikethrough(bool strikethrough = true)
+ { SetFlag(wxFONTFLAG_STRIKETHROUGH, strikethrough); return *this; }
+
+ wxFontInfo& Encoding(wxFontEncoding encoding)
+ { m_encoding = encoding; return *this; }
+
+
+ // Set all flags at once.
+ wxFontInfo& AllFlags(int flags)
+ { m_flags = flags; return *this; }
+
+
+ // Accessors are mostly meant to be used by wxFont itself to extract the
+ // various pieces of the font description.
+
+ bool IsUsingSizeInPixels() const { return m_pixelSize != wxDefaultSize; }
+ int GetPointSize() const { return m_pointSize; }
+ wxSize GetPixelSize() const { return m_pixelSize; }
+ wxFontFamily GetFamily() const { return m_family; }
+ const wxString& GetFaceName() const { return m_faceName; }
+
+ wxFontStyle GetStyle() const
+ {
+ return m_flags & wxFONTFLAG_ITALIC
+ ? wxFONTSTYLE_ITALIC
+ : m_flags & wxFONTFLAG_SLANT
+ ? wxFONTSTYLE_SLANT
+ : wxFONTSTYLE_NORMAL;
+ }
+
+ wxFontWeight GetWeight() const
+ {
+ return m_flags & wxFONTFLAG_LIGHT
+ ? wxFONTWEIGHT_LIGHT
+ : m_flags & wxFONTFLAG_BOLD
+ ? wxFONTWEIGHT_BOLD
+ : wxFONTWEIGHT_NORMAL;
+ }
+
+ bool IsAntiAliased() const
+ {
+ return (m_flags & wxFONTFLAG_ANTIALIASED) != 0;
+ }
+
+ bool IsUnderlined() const
+ {
+ return (m_flags & wxFONTFLAG_UNDERLINED) != 0;
+ }
+
+ bool IsStrikethrough() const
+ {
+ return (m_flags & wxFONTFLAG_STRIKETHROUGH) != 0;
+ }
+
+ wxFontEncoding GetEncoding() const { return m_encoding; }
+
+
+ // Default copy ctor, assignment operator and dtor are OK.
+
+private:
+ // Common part of all ctor, initializing everything except the size (which
+ // is initialized by the ctors themselves).
+ void Init()
+ {
+ m_family = wxFONTFAMILY_DEFAULT;
+ m_flags = wxFONTFLAG_DEFAULT;
+ m_encoding = wxFONTENCODING_DEFAULT;
+ }
+
+ void InitPointSize(int pointSize)
+ {
+ Init();
+
+ m_pointSize = pointSize;
+ m_pixelSize = wxDefaultSize;
+ }
+
+ // Turn on or off the given bit in m_flags depending on the value of the
+ // boolean argument.
+ void SetFlag(int flag, bool on)
+ {
+ if ( on )
+ m_flags |= flag;
+ else
+ m_flags &= ~flag;
+ }
+
+ // The size information: if m_pixelSize is valid (!= wxDefaultSize), then
+ // it is used. Otherwise m_pointSize is used, taking into account that if
+ // it is == -1, it means that the platform dependent font size should be
+ // used.
+ int m_pointSize;
+ wxSize m_pixelSize;
+
+ wxFontFamily m_family;
+ wxString m_faceName;
+ int m_flags;
+ wxFontEncoding m_encoding;
+};
+
+// ----------------------------------------------------------------------------
+// wxFontBase represents a font object
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxNativeFontInfo;
+
+class WXDLLIMPEXP_CORE wxFontBase : public wxGDIObject
+{
+public:
+ /*
+ derived classes should provide the following ctors:
+
+ wxFont();
+ wxFont(const wxFontInfo& info);
+ wxFont(const wxString& nativeFontInfoString);
+ wxFont(const wxNativeFontInfo& info);
+ wxFont(int size,
+ wxFontFamily family,
+ wxFontStyle style,
+ wxFontWeight weight,
+ bool underlined = false,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
+ wxFont(const wxSize& pixelSize,
+ wxFontFamily family,
+ wxFontStyle style,
+ wxFontWeight weight,
+ bool underlined = false,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
+ */
+
+ // creator function
+ virtual ~wxFontBase();
+
+
+#if FUTURE_WXWIN_COMPATIBILITY_3_0
+ // from the font components
+ static wxFont *New(
+ int pointSize, // size of the font in points
+ int family, // see wxFontFamily enum
+ int style, // see wxFontStyle enum
+ int weight, // see wxFontWeight enum
+ bool underlined = false, // not underlined by default
+ const wxString& face = wxEmptyString, // facename
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT) // ISO8859-X, ...
+ { return New(pointSize, (wxFontFamily)family, (wxFontStyle)style,
+ (wxFontWeight)weight, underlined, face, encoding); }
+
+ // from the font components
+ static wxFont *New(
+ const wxSize& pixelSize, // size of the font in pixels
+ int family, // see wxFontFamily enum
+ int style, // see wxFontStyle enum
+ int weight, // see wxFontWeight enum
+ bool underlined = false, // not underlined by default
+ const wxString& face = wxEmptyString, // facename
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT) // ISO8859-X, ...
+ { return New(pixelSize, (wxFontFamily)family, (wxFontStyle)style,
+ (wxFontWeight)weight, underlined, face, encoding); }
+#endif
+
+ // from the font components
+ static wxFont *New(
+ int pointSize, // size of the font in points
+ wxFontFamily family, // see wxFontFamily enum
+ wxFontStyle style, // see wxFontStyle enum
+ wxFontWeight weight, // see wxFontWeight enum
+ bool underlined = false, // not underlined by default
+ const wxString& face = wxEmptyString, // facename
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ...
+
+ // from the font components
+ static wxFont *New(
+ const wxSize& pixelSize, // size of the font in pixels
+ wxFontFamily family, // see wxFontFamily enum
+ wxFontStyle style, // see wxFontStyle enum
+ wxFontWeight weight, // see wxFontWeight enum
+ bool underlined = false, // not underlined by default
+ const wxString& face = wxEmptyString, // facename
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ...
+
+ // from the font components but using the font flags instead of separate
+ // parameters for each flag
+ static wxFont *New(int pointSize,
+ wxFontFamily family,
+ int flags = wxFONTFLAG_DEFAULT,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
+
+
+ // from the font components but using the font flags instead of separate
+ // parameters for each flag
+ static wxFont *New(const wxSize& pixelSize,
+ wxFontFamily family,
+ int flags = wxFONTFLAG_DEFAULT,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
+
+ // from the (opaque) native font description object
+ static wxFont *New(const wxNativeFontInfo& nativeFontDesc);
+
+ // from the string representation of wxNativeFontInfo
+ static wxFont *New(const wxString& strNativeFontDesc);
+
+ // comparison
+ bool operator==(const wxFont& font) const;
+ bool operator!=(const wxFont& font) const { return !(*this == font); }
+
+ // accessors: get the font characteristics
+ virtual int GetPointSize() const = 0;
+ virtual wxSize GetPixelSize() const;
+ virtual bool IsUsingSizeInPixels() const;
+ wxFontFamily GetFamily() const;
+ virtual wxFontStyle GetStyle() const = 0;
+ virtual wxFontWeight GetWeight() const = 0;
+ virtual bool GetUnderlined() const = 0;
+ virtual bool GetStrikethrough() const { return false; }
+ virtual wxString GetFaceName() const = 0;
+ virtual wxFontEncoding GetEncoding() const = 0;
+ virtual const wxNativeFontInfo *GetNativeFontInfo() const = 0;
+
+ virtual bool IsFixedWidth() const;
+
+ wxString GetNativeFontInfoDesc() const;
+ wxString GetNativeFontInfoUserDesc() const;
+
+ // change the font characteristics
+ virtual void SetPointSize( int pointSize ) = 0;
+ virtual void SetPixelSize( const wxSize& pixelSize );
+ virtual void SetFamily( wxFontFamily family ) = 0;
+ virtual void SetStyle( wxFontStyle style ) = 0;
+ virtual void SetWeight( wxFontWeight weight ) = 0;
+
+ virtual void SetUnderlined( bool underlined ) = 0;
+ virtual void SetStrikethrough( bool WXUNUSED(strikethrough) ) {}
+ virtual void SetEncoding(wxFontEncoding encoding) = 0;
+ virtual bool SetFaceName( const wxString& faceName );
+ void SetNativeFontInfo(const wxNativeFontInfo& info)
+ { DoSetNativeFontInfo(info); }
+
+ bool SetNativeFontInfo(const wxString& info);
+ bool SetNativeFontInfoUserDesc(const wxString& info);
+
+ // Symbolic font sizes support: set the font size to "large" or "very
+ // small" either absolutely (i.e. compared to the default font size) or
+ // relatively to the given font size.
+ void SetSymbolicSize(wxFontSymbolicSize size);
+ void SetSymbolicSizeRelativeTo(wxFontSymbolicSize size, int base)
+ {
+ SetPointSize(AdjustToSymbolicSize(size, base));
+ }
+
+ // Adjust the base size in points according to symbolic size.
+ static int AdjustToSymbolicSize(wxFontSymbolicSize size, int base);
+
+
+ // translate the fonts into human-readable string (i.e. GetStyleString()
+ // will return "wxITALIC" for an italic font, ...)
+ wxString GetFamilyString() const;
+ wxString GetStyleString() const;
+ wxString GetWeightString() const;
+
+ // the default encoding is used for creating all fonts with default
+ // encoding parameter
+ static wxFontEncoding GetDefaultEncoding() { return ms_encodingDefault; }
+ static void SetDefaultEncoding(wxFontEncoding encoding);
+
+ // this doesn't do anything and is kept for compatibility only
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED_INLINE(void SetNoAntiAliasing(bool no = true), wxUnusedVar(no););
+ wxDEPRECATED_INLINE(bool GetNoAntiAliasing() const, return false;)
+#endif // WXWIN_COMPATIBILITY_2_8
+
+protected:
+ // the function called by both overloads of SetNativeFontInfo()
+ virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info);
+
+ // The function called by public GetFamily(): it can return
+ // wxFONTFAMILY_UNKNOWN unlike the public method (see comment there).
+ virtual wxFontFamily DoGetFamily() const = 0;
+
+
+ // Helper functions to recover wxFONTSTYLE/wxFONTWEIGHT and underlined flag
+ // values from flags containing a combination of wxFONTFLAG_XXX.
+ static wxFontStyle GetStyleFromFlags(int flags)
+ {
+ return flags & wxFONTFLAG_ITALIC
+ ? wxFONTSTYLE_ITALIC
+ : flags & wxFONTFLAG_SLANT
+ ? wxFONTSTYLE_SLANT
+ : wxFONTSTYLE_NORMAL;
+ }
+
+ static wxFontWeight GetWeightFromFlags(int flags)
+ {
+ return flags & wxFONTFLAG_LIGHT
+ ? wxFONTWEIGHT_LIGHT
+ : flags & wxFONTFLAG_BOLD
+ ? wxFONTWEIGHT_BOLD
+ : wxFONTWEIGHT_NORMAL;
+ }
+
+ static bool GetUnderlinedFromFlags(int flags)
+ {
+ return (flags & wxFONTFLAG_UNDERLINED) != 0;
+ }
+
+ static bool GetStrikethroughFromFlags(int flags)
+ {
+ return (flags & wxFONTFLAG_STRIKETHROUGH) != 0;
+ }
+
+private:
+ // the currently default encoding: by default, it's the default system
+ // encoding, but may be changed by the application using
+ // SetDefaultEncoding() to make all subsequent fonts created without
+ // specifying encoding parameter using this encoding
+ static wxFontEncoding ms_encodingDefault;
+};
+
+// wxFontBase <-> wxString utilities, used by wxConfig
+WXDLLIMPEXP_CORE wxString wxToString(const wxFontBase& font);
+WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxFontBase* font);
+
+
+#if FUTURE_WXWIN_COMPATIBILITY_3_0
+#define wxDECLARE_FONT_COMPAT_SETTER \
+ wxDEPRECATED_FUTURE( void SetFamily(int family) ) \
+ { SetFamily((wxFontFamily)family); } \
+ wxDEPRECATED_FUTURE( void SetStyle(int style) ) \
+ { SetStyle((wxFontStyle)style); } \
+ wxDEPRECATED_FUTURE( void SetWeight(int weight) ) \
+ { SetWeight((wxFontWeight)weight); } \
+ wxDEPRECATED_FUTURE( void SetFamily(wxDeprecatedGUIConstants family) ) \
+ { SetFamily((wxFontFamily)family); } \
+ wxDEPRECATED_FUTURE( void SetStyle(wxDeprecatedGUIConstants style) ) \
+ { SetStyle((wxFontStyle)style); } \
+ wxDEPRECATED_FUTURE( void SetWeight(wxDeprecatedGUIConstants weight) ) \
+ { SetWeight((wxFontWeight)weight); }
+#else
+#define wxDECLARE_FONT_COMPAT_SETTER /*empty*/
+#endif
+
+// this macro must be used in all derived wxFont classes declarations
+#define wxDECLARE_COMMON_FONT_METHODS() \
+ wxDECLARE_FONT_COMPAT_SETTER \
+ \
+ /* functions for modifying font in place */ \
+ wxFont& MakeBold(); \
+ wxFont& MakeItalic(); \
+ wxFont& MakeUnderlined(); \
+ wxFont& MakeStrikethrough(); \
+ wxFont& MakeLarger() { return Scale(1.2f); } \
+ wxFont& MakeSmaller() { return Scale(1/1.2f); } \
+ wxFont& Scale(float x); \
+ /* functions for creating fonts based on this one */ \
+ wxFont Bold() const; \
+ wxFont Italic() const; \
+ wxFont Underlined() const; \
+ wxFont Strikethrough() const; \
+ wxFont Larger() const { return Scaled(1.2f); } \
+ wxFont Smaller() const { return Scaled(1/1.2f); } \
+ wxFont Scaled(float x) const
+
+// include the real class declaration
+#if defined(__WXMSW__)
+ #include "wx/msw/font.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/font.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/font.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/font.h"
+#elif defined(__WXX11__)
+ #include "wx/x11/font.h"
+#elif defined(__WXDFB__)
+ #include "wx/dfb/font.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/font.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/font.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/font.h"
+#endif
+
+class WXDLLIMPEXP_CORE wxFontList: public wxGDIObjListBase
+{
+public:
+ wxFont *FindOrCreateFont(int pointSize,
+ wxFontFamily family,
+ wxFontStyle style,
+ wxFontWeight weight,
+ bool underline = false,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
+
+#if FUTURE_WXWIN_COMPATIBILITY_3_0
+ wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight,
+ bool underline = false,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
+ { return FindOrCreateFont(pointSize, (wxFontFamily)family, (wxFontStyle)style,
+ (wxFontWeight)weight, underline, face, encoding); }
+#endif
+
+#if WXWIN_COMPATIBILITY_2_6
+ wxDEPRECATED( void AddFont(wxFont*) );
+ wxDEPRECATED( void RemoveFont(wxFont*) );
+#endif
+};
+
+extern WXDLLIMPEXP_DATA_CORE(wxFontList*) wxTheFontList;
+
+
+// provide comparison operators to allow code such as
+//
+// if ( font.GetStyle() == wxFONTSTYLE_SLANT )
+//
+// to compile without warnings which it would otherwise provoke from some
+// compilers as it compares elements of different enums
+#if FUTURE_WXWIN_COMPATIBILITY_3_0
+
+// Unfortunately some compilers have ambiguity issues when enum comparisons are
+// overloaded so we have to disable the overloads in this case, see
+// wxCOMPILER_NO_OVERLOAD_ON_ENUM definition in wx/platform.h for more details.
+#ifndef wxCOMPILER_NO_OVERLOAD_ON_ENUM
+
+inline bool operator==(wxFontFamily s, wxDeprecatedGUIConstants t)
+{ return static_cast<int>(s) == static_cast<int>(t); }
+inline bool operator!=(wxFontFamily s, wxDeprecatedGUIConstants t)
+{ return !(s == t); }
+inline bool operator==(wxFontStyle s, wxDeprecatedGUIConstants t)
+{ return static_cast<int>(s) == static_cast<int>(t); }
+inline bool operator!=(wxFontStyle s, wxDeprecatedGUIConstants t)
+{ return !(s == t); }
+inline bool operator==(wxFontWeight s, wxDeprecatedGUIConstants t)
+{ return static_cast<int>(s) == static_cast<int>(t); }
+inline bool operator!=(wxFontWeight s, wxDeprecatedGUIConstants t)
+{ return !(s == t); }
+
+#endif // // wxCOMPILER_NO_OVERLOAD_ON_ENUM
+
+#endif // FUTURE_WXWIN_COMPATIBILITY_3_0
+
+#endif
+ // _WX_FONT_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/fontdata.h
+// Author: Julian Smart
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FONTDATA_H_
+#define _WX_FONTDATA_H_
+
+#include "wx/font.h"
+#include "wx/colour.h"
+#include "wx/encinfo.h"
+
+class WXDLLIMPEXP_CORE wxFontData : public wxObject
+{
+public:
+ wxFontData();
+ virtual ~wxFontData();
+
+ wxFontData(const wxFontData& data);
+ wxFontData& operator=(const wxFontData& data);
+
+ void SetAllowSymbols(bool flag) { m_allowSymbols = flag; }
+ bool GetAllowSymbols() const { return m_allowSymbols; }
+
+ void SetColour(const wxColour& colour) { m_fontColour = colour; }
+ const wxColour& GetColour() const { return m_fontColour; }
+
+ void SetShowHelp(bool flag) { m_showHelp = flag; }
+ bool GetShowHelp() const { return m_showHelp; }
+
+ void EnableEffects(bool flag) { m_enableEffects = flag; }
+ bool GetEnableEffects() const { return m_enableEffects; }
+
+ void SetInitialFont(const wxFont& font) { m_initialFont = font; }
+ wxFont GetInitialFont() const { return m_initialFont; }
+
+ void SetChosenFont(const wxFont& font) { m_chosenFont = font; }
+ wxFont GetChosenFont() const { return m_chosenFont; }
+
+ void SetRange(int minRange, int maxRange) { m_minSize = minRange; m_maxSize = maxRange; }
+
+ // encoding info is split into 2 parts: the logical wxWin encoding
+ // (wxFontEncoding) and a structure containing the native parameters for
+ // it (wxNativeEncodingInfo)
+ wxFontEncoding GetEncoding() const { return m_encoding; }
+ void SetEncoding(wxFontEncoding encoding) { m_encoding = encoding; }
+
+ wxNativeEncodingInfo& EncodingInfo() { return m_encodingInfo; }
+
+
+ // public for backwards compatibility only: don't use directly
+ wxColour m_fontColour;
+ bool m_showHelp;
+ bool m_allowSymbols;
+ bool m_enableEffects;
+ wxFont m_initialFont;
+ wxFont m_chosenFont;
+ int m_minSize;
+ int m_maxSize;
+
+private:
+ wxFontEncoding m_encoding;
+ wxNativeEncodingInfo m_encodingInfo;
+
+ DECLARE_DYNAMIC_CLASS(wxFontData)
+};
+
+#endif // _WX_FONTDATA_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/fontdlg.h
+// Purpose: common interface for different wxFontDialog classes
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 12.05.02
+// Copyright: (c) 1997-2002 wxWidgets team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FONTDLG_H_BASE_
+#define _WX_FONTDLG_H_BASE_
+
+#include "wx/defs.h" // for wxUSE_FONTDLG
+
+#if wxUSE_FONTDLG
+
+#include "wx/dialog.h" // the base class
+#include "wx/fontdata.h"
+
+// ----------------------------------------------------------------------------
+// wxFontDialog interface
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFontDialogBase : public wxDialog
+{
+public:
+ // create the font dialog
+ wxFontDialogBase() { }
+ wxFontDialogBase(wxWindow *parent) { m_parent = parent; }
+ wxFontDialogBase(wxWindow *parent, const wxFontData& data)
+ { m_parent = parent; InitFontData(&data); }
+
+ bool Create(wxWindow *parent)
+ { return DoCreate(parent); }
+ bool Create(wxWindow *parent, const wxFontData& data)
+ { InitFontData(&data); return Create(parent); }
+
+ // retrieve the font data
+ const wxFontData& GetFontData() const { return m_fontData; }
+ wxFontData& GetFontData() { return m_fontData; }
+
+#if WXWIN_COMPATIBILITY_2_6
+ // deprecated interface, for compatibility only, don't use
+ wxDEPRECATED( wxFontDialogBase(wxWindow *parent, const wxFontData *data) );
+
+ wxDEPRECATED( bool Create(wxWindow *parent, const wxFontData *data) );
+#endif // WXWIN_COMPATIBILITY_2_6
+
+protected:
+ virtual bool DoCreate(wxWindow *parent) { m_parent = parent; return true; }
+
+ void InitFontData(const wxFontData *data = NULL)
+ { if ( data ) m_fontData = *data; }
+
+ wxFontData m_fontData;
+
+ wxDECLARE_NO_COPY_CLASS(wxFontDialogBase);
+};
+
+#if WXWIN_COMPATIBILITY_2_6
+ // deprecated interface, for compatibility only, don't use
+inline wxFontDialogBase::wxFontDialogBase(wxWindow *parent, const wxFontData *data)
+{ m_parent = parent; InitFontData(data); }
+
+inline bool wxFontDialogBase::Create(wxWindow *parent, const wxFontData *data)
+{ InitFontData(data); return Create(parent); }
+#endif // WXWIN_COMPATIBILITY_2_6
+
+// ----------------------------------------------------------------------------
+// platform-specific wxFontDialog implementation
+// ----------------------------------------------------------------------------
+
+#if defined( __WXOSX_MAC__ )
+//set to 1 to use native mac font and color dialogs
+#define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 1
+#else
+//not supported on these platforms, leave 0
+#define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 0
+#endif
+
+#if defined(__WXUNIVERSAL__) || \
+ defined(__WXMOTIF__) || \
+ defined(__WXCOCOA__) || \
+ defined(__WXWINCE__) || \
+ defined(__WXGPE__)
+
+ #include "wx/generic/fontdlgg.h"
+ #define wxFontDialog wxGenericFontDialog
+#elif defined(__WXMSW__)
+ #include "wx/msw/fontdlg.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/fontdlg.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/fontdlg.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/fontdlg.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/fontdlg.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// global public functions
+// ----------------------------------------------------------------------------
+
+// get the font from user and return it, returns wxNullFont if the dialog was
+// cancelled
+WXDLLIMPEXP_CORE wxFont wxGetFontFromUser(wxWindow *parent = NULL,
+ const wxFont& fontInit = wxNullFont,
+ const wxString& caption = wxEmptyString);
+
+#endif // wxUSE_FONTDLG
+
+#endif
+ // _WX_FONTDLG_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/fontenc.h
+// Purpose: wxFontEncoding constants
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 29.03.00
+// Copyright: (c) Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FONTENC_H_
+#define _WX_FONTENC_H_
+
+// font encodings
+enum wxFontEncoding
+{
+ wxFONTENCODING_SYSTEM = -1, // system default
+ wxFONTENCODING_DEFAULT, // current default encoding
+
+ // ISO8859 standard defines a number of single-byte charsets
+ wxFONTENCODING_ISO8859_1, // West European (Latin1)
+ wxFONTENCODING_ISO8859_2, // Central and East European (Latin2)
+ wxFONTENCODING_ISO8859_3, // Esperanto (Latin3)
+ wxFONTENCODING_ISO8859_4, // Baltic (old) (Latin4)
+ wxFONTENCODING_ISO8859_5, // Cyrillic
+ wxFONTENCODING_ISO8859_6, // Arabic
+ wxFONTENCODING_ISO8859_7, // Greek
+ wxFONTENCODING_ISO8859_8, // Hebrew
+ wxFONTENCODING_ISO8859_9, // Turkish (Latin5)
+ wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6)
+ wxFONTENCODING_ISO8859_11, // Thai
+ wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it
+ // here anyhow to make all ISO8859
+ // consecutive numbers
+ wxFONTENCODING_ISO8859_13, // Baltic (Latin7)
+ wxFONTENCODING_ISO8859_14, // Latin8
+ wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro)
+ wxFONTENCODING_ISO8859_MAX,
+
+ // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html)
+ wxFONTENCODING_KOI8, // KOI8 Russian
+ wxFONTENCODING_KOI8_U, // KOI8 Ukrainian
+ wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866
+ wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria
+
+ // what would we do without Microsoft? They have their own encodings
+ // for DOS
+ wxFONTENCODING_CP437, // original MS-DOS codepage
+ wxFONTENCODING_CP850, // CP437 merged with Latin1
+ wxFONTENCODING_CP852, // CP437 merged with Latin2
+ wxFONTENCODING_CP855, // another cyrillic encoding
+ wxFONTENCODING_CP866, // and another one
+ // and for Windows
+ wxFONTENCODING_CP874, // WinThai
+ wxFONTENCODING_CP932, // Japanese (shift-JIS)
+ wxFONTENCODING_CP936, // Chinese simplified (GB)
+ wxFONTENCODING_CP949, // Korean (Hangul charset, a.k.a. EUC-KR)
+ wxFONTENCODING_CP950, // Chinese (traditional - Big5)
+ wxFONTENCODING_CP1250, // WinLatin2
+ wxFONTENCODING_CP1251, // WinCyrillic
+ wxFONTENCODING_CP1252, // WinLatin1
+ wxFONTENCODING_CP1253, // WinGreek (8859-7)
+ wxFONTENCODING_CP1254, // WinTurkish
+ wxFONTENCODING_CP1255, // WinHebrew
+ wxFONTENCODING_CP1256, // WinArabic
+ wxFONTENCODING_CP1257, // WinBaltic (same as Latin 7)
+ wxFONTENCODING_CP1258, // WinVietnamese
+ wxFONTENCODING_CP1361, // Johab Korean character set.
+ wxFONTENCODING_CP12_MAX,
+
+ wxFONTENCODING_UTF7, // UTF-7 Unicode encoding
+ wxFONTENCODING_UTF8, // UTF-8 Unicode encoding
+ wxFONTENCODING_EUC_JP, // Extended Unix Codepage for Japanese
+ wxFONTENCODING_UTF16BE, // UTF-16 Big Endian Unicode encoding
+ wxFONTENCODING_UTF16LE, // UTF-16 Little Endian Unicode encoding
+ wxFONTENCODING_UTF32BE, // UTF-32 Big Endian Unicode encoding
+ wxFONTENCODING_UTF32LE, // UTF-32 Little Endian Unicode encoding
+
+ wxFONTENCODING_MACROMAN, // the standard mac encodings
+ wxFONTENCODING_MACJAPANESE,
+ wxFONTENCODING_MACCHINESETRAD,
+ wxFONTENCODING_MACKOREAN,
+ wxFONTENCODING_MACARABIC,
+ wxFONTENCODING_MACHEBREW,
+ wxFONTENCODING_MACGREEK,
+ wxFONTENCODING_MACCYRILLIC,
+ wxFONTENCODING_MACDEVANAGARI,
+ wxFONTENCODING_MACGURMUKHI,
+ wxFONTENCODING_MACGUJARATI,
+ wxFONTENCODING_MACORIYA,
+ wxFONTENCODING_MACBENGALI,
+ wxFONTENCODING_MACTAMIL,
+ wxFONTENCODING_MACTELUGU,
+ wxFONTENCODING_MACKANNADA,
+ wxFONTENCODING_MACMALAJALAM,
+ wxFONTENCODING_MACSINHALESE,
+ wxFONTENCODING_MACBURMESE,
+ wxFONTENCODING_MACKHMER,
+ wxFONTENCODING_MACTHAI,
+ wxFONTENCODING_MACLAOTIAN,
+ wxFONTENCODING_MACGEORGIAN,
+ wxFONTENCODING_MACARMENIAN,
+ wxFONTENCODING_MACCHINESESIMP,
+ wxFONTENCODING_MACTIBETAN,
+ wxFONTENCODING_MACMONGOLIAN,
+ wxFONTENCODING_MACETHIOPIC,
+ wxFONTENCODING_MACCENTRALEUR,
+ wxFONTENCODING_MACVIATNAMESE,
+ wxFONTENCODING_MACARABICEXT,
+ wxFONTENCODING_MACSYMBOL,
+ wxFONTENCODING_MACDINGBATS,
+ wxFONTENCODING_MACTURKISH,
+ wxFONTENCODING_MACCROATIAN,
+ wxFONTENCODING_MACICELANDIC,
+ wxFONTENCODING_MACROMANIAN,
+ wxFONTENCODING_MACCELTIC,
+ wxFONTENCODING_MACGAELIC,
+ wxFONTENCODING_MACKEYBOARD,
+
+ // more CJK encodings (for historical reasons some are already declared
+ // above)
+ wxFONTENCODING_ISO2022_JP, // ISO-2022-JP JIS encoding
+
+ wxFONTENCODING_MAX, // highest enumerated encoding value
+
+ wxFONTENCODING_MACMIN = wxFONTENCODING_MACROMAN ,
+ wxFONTENCODING_MACMAX = wxFONTENCODING_MACKEYBOARD ,
+
+ // aliases for endian-dependent UTF encodings
+#ifdef WORDS_BIGENDIAN
+ wxFONTENCODING_UTF16 = wxFONTENCODING_UTF16BE, // native UTF-16
+ wxFONTENCODING_UTF32 = wxFONTENCODING_UTF32BE, // native UTF-32
+#else // WORDS_BIGENDIAN
+ wxFONTENCODING_UTF16 = wxFONTENCODING_UTF16LE, // native UTF-16
+ wxFONTENCODING_UTF32 = wxFONTENCODING_UTF32LE, // native UTF-32
+#endif // WORDS_BIGENDIAN
+
+ // alias for the native Unicode encoding on this platform
+ // (this is used by wxEncodingConverter and wxUTFFile only for now)
+#if SIZEOF_WCHAR_T == 2
+ wxFONTENCODING_UNICODE = wxFONTENCODING_UTF16,
+#else // SIZEOF_WCHAR_T == 4
+ wxFONTENCODING_UNICODE = wxFONTENCODING_UTF32,
+#endif
+
+ // alternative names for Far Eastern encodings
+ // Chinese
+ wxFONTENCODING_GB2312 = wxFONTENCODING_CP936, // Simplified Chinese
+ wxFONTENCODING_BIG5 = wxFONTENCODING_CP950, // Traditional Chinese
+
+ // Japanese (see http://zsigri.tripod.com/fontboard/cjk/jis.html)
+ wxFONTENCODING_SHIFT_JIS = wxFONTENCODING_CP932, // Shift JIS
+
+ // Korean (CP 949 not actually the same but close enough)
+ wxFONTENCODING_EUC_KR = wxFONTENCODING_CP949,
+ wxFONTENCODING_JOHAB = wxFONTENCODING_CP1361,
+
+ // Vietnamese
+ wxFONTENCODING_VIETNAMESE = wxFONTENCODING_CP1258
+};
+
+#endif // _WX_FONTENC_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/fontenum.h
+// Purpose: wxFontEnumerator class for getting available fonts
+// Author: Julian Smart, Vadim Zeitlin
+// Modified by: extended to enumerate more than just font facenames and works
+// not only on Windows now (VZ)
+// Created: 04/01/98
+// Copyright: (c) Julian Smart, Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FONTENUM_H_
+#define _WX_FONTENUM_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_FONTENUM
+
+#include "wx/fontenc.h"
+#include "wx/arrstr.h"
+
+// ----------------------------------------------------------------------------
+// wxFontEnumerator enumerates all available fonts on the system or only the
+// fonts with given attributes
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFontEnumerator
+{
+public:
+ wxFontEnumerator() {}
+
+ // virtual dtor for the base class
+ virtual ~wxFontEnumerator() {}
+
+ // start enumerating font facenames (either all of them or those which
+ // support the given encoding) - will result in OnFacename() being
+ // called for each available facename (until they are exhausted or
+ // OnFacename returns false)
+ virtual bool EnumerateFacenames
+ (
+ wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all
+ bool fixedWidthOnly = false
+ );
+
+ // enumerate the different encodings either for given font facename or for
+ // all facenames - will result in OnFontEncoding() being called for each
+ // available (facename, encoding) couple
+ virtual bool EnumerateEncodings(const wxString& facename = wxEmptyString);
+
+ // callbacks which are called after one of EnumerateXXX() functions from
+ // above is invoked - all of them may return false to stop enumeration or
+ // true to continue with it
+
+ // called by EnumerateFacenames
+ virtual bool OnFacename(const wxString& WXUNUSED(facename))
+ { return true; }
+
+ // called by EnumerateEncodings
+ virtual bool OnFontEncoding(const wxString& WXUNUSED(facename),
+ const wxString& WXUNUSED(encoding))
+ { return true; }
+
+
+
+ // convenience function that returns array of facenames.
+ static wxArrayString
+ GetFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all
+ bool fixedWidthOnly = false);
+
+ // convenience function that returns array of all available encodings.
+ static wxArrayString GetEncodings(const wxString& facename = wxEmptyString);
+
+ // convenience function that returns true if the given face name exist
+ // in the user's system
+ static bool IsValidFacename(const wxString &str);
+
+private:
+#ifdef wxHAS_UTF8_FONTS
+ // helper for ports that only use UTF-8 encoding natively
+ bool EnumerateEncodingsUTF8(const wxString& facename);
+#endif
+
+ wxDECLARE_NO_COPY_CLASS(wxFontEnumerator);
+};
+
+#endif // wxUSE_FONTENUM
+
+#endif // _WX_FONTENUM_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/fontmap.h
+// Purpose: wxFontMapper class
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 04.11.99
+// Copyright: (c) Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FONTMAPPER_H_
+#define _WX_FONTMAPPER_H_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#if wxUSE_FONTMAP
+
+#include "wx/fontenc.h" // for wxFontEncoding
+
+#if wxUSE_GUI
+ #include "wx/fontutil.h" // for wxNativeEncodingInfo
+#endif // wxUSE_GUI
+
+#if wxUSE_CONFIG && wxUSE_FILECONFIG
+ class WXDLLIMPEXP_FWD_BASE wxConfigBase;
+#endif // wxUSE_CONFIG
+
+class WXDLLIMPEXP_FWD_CORE wxFontMapper;
+
+#if wxUSE_GUI
+ class WXDLLIMPEXP_FWD_CORE wxWindow;
+#endif // wxUSE_GUI
+
+// ============================================================================
+// wxFontMapper manages user-definable correspondence between wxWidgets font
+// encodings and the fonts present on the machine.
+//
+// This is a singleton class, font mapper objects can only be accessed using
+// wxFontMapper::Get().
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxFontMapperBase: this is a non-interactive class which just uses its built
+// in knowledge of the encodings equivalence
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxFontMapperBase
+{
+public:
+ // constructor and such
+ // ---------------------
+
+ // default ctor
+ wxFontMapperBase();
+
+ // virtual dtor for any base class
+ virtual ~wxFontMapperBase();
+
+ // return instance of the wxFontMapper singleton
+ // wxBase code only cares that it's a wxFontMapperBase
+ // In wxBase, wxFontMapper is only forward declared
+ // so one cannot implicitly cast from it to wxFontMapperBase.
+ static wxFontMapperBase *Get();
+
+ // set the singleton to 'mapper' instance and return previous one
+ static wxFontMapper *Set(wxFontMapper *mapper);
+
+ // delete the existing font mapper if any
+ static void Reset();
+
+
+ // translates charset strings to encoding
+ // --------------------------------------
+
+ // returns the encoding for the given charset (in the form of RFC 2046) or
+ // wxFONTENCODING_SYSTEM if couldn't decode it
+ //
+ // interactive parameter is ignored in the base class, we behave as if it
+ // were always false
+ virtual wxFontEncoding CharsetToEncoding(const wxString& charset,
+ bool interactive = true);
+
+ // information about supported encodings
+ // -------------------------------------
+
+ // get the number of font encodings we know about
+ static size_t GetSupportedEncodingsCount();
+
+ // get the n-th supported encoding
+ static wxFontEncoding GetEncoding(size_t n);
+
+ // return canonical name of this encoding (this is a short string,
+ // GetEncodingDescription() returns a longer one)
+ static wxString GetEncodingName(wxFontEncoding encoding);
+
+ // return a list of all names of this encoding (see GetEncodingName)
+ static const wxChar** GetAllEncodingNames(wxFontEncoding encoding);
+
+ // return user-readable string describing the given encoding
+ //
+ // NB: hard-coded now, but might change later (read it from config?)
+ static wxString GetEncodingDescription(wxFontEncoding encoding);
+
+ // find the encoding corresponding to the given name, inverse of
+ // GetEncodingName() and less general than CharsetToEncoding()
+ //
+ // returns wxFONTENCODING_MAX if the name is not a supported encoding
+ static wxFontEncoding GetEncodingFromName(const wxString& name);
+
+
+ // functions which allow to configure the config object used: by default,
+ // the global one (from wxConfigBase::Get() will be used) and the default
+ // root path for the config settings is the string returned by
+ // GetDefaultConfigPath()
+ // ----------------------------------------------------------------------
+
+#if wxUSE_CONFIG && wxUSE_FILECONFIG
+ // set the root config path to use (should be an absolute path)
+ void SetConfigPath(const wxString& prefix);
+
+ // return default config path
+ static const wxString& GetDefaultConfigPath();
+#endif // wxUSE_CONFIG
+
+
+ // returns true for the base class and false for a "real" font mapper object
+ // (implementation-only)
+ virtual bool IsDummy() { return true; }
+
+protected:
+#if wxUSE_CONFIG && wxUSE_FILECONFIG
+ // get the config object we're using -- either the global config object
+ // or a wxMemoryConfig object created by this class otherwise
+ wxConfigBase *GetConfig();
+
+ // gets the root path for our settings -- if it wasn't set explicitly, use
+ // GetDefaultConfigPath()
+ const wxString& GetConfigPath();
+
+ // change to the given (relative) path in the config, return true if ok
+ // (then GetConfig() will return something !NULL), false if no config
+ // object
+ //
+ // caller should provide a pointer to the string variable which should be
+ // later passed to RestorePath()
+ bool ChangePath(const wxString& pathNew, wxString *pathOld);
+
+ // restore the config path after use
+ void RestorePath(const wxString& pathOld);
+
+ // config object and path (in it) to use
+ wxConfigBase *m_configDummy;
+
+ wxString m_configRootPath;
+#endif // wxUSE_CONFIG
+
+ // the real implementation of the base class version of CharsetToEncoding()
+ //
+ // returns wxFONTENCODING_UNKNOWN if encoding is unknown and we shouldn't
+ // ask the user about it, wxFONTENCODING_SYSTEM if it is unknown but we
+ // should/could ask the user
+ int NonInteractiveCharsetToEncoding(const wxString& charset);
+
+private:
+ // the global fontmapper object or NULL
+ static wxFontMapper *sm_instance;
+
+ friend class wxFontMapperPathChanger;
+
+ wxDECLARE_NO_COPY_CLASS(wxFontMapperBase);
+};
+
+// ----------------------------------------------------------------------------
+// wxFontMapper: interactive extension of wxFontMapperBase
+//
+// The default implementations of all functions will ask the user if they are
+// not capable of finding the answer themselves and store the answer in a
+// config file (configurable via SetConfigXXX functions). This behaviour may
+// be disabled by giving the value of false to "interactive" parameter.
+// However, the functions will always consult the config file to allow the
+// user-defined values override the default logic and there is no way to
+// disable this -- which shouldn't be ever needed because if "interactive" was
+// never true, the config file is never created anyhow.
+// ----------------------------------------------------------------------------
+
+#if wxUSE_GUI
+
+class WXDLLIMPEXP_CORE wxFontMapper : public wxFontMapperBase
+{
+public:
+ // default ctor
+ wxFontMapper();
+
+ // virtual dtor for a base class
+ virtual ~wxFontMapper();
+
+ // working with the encodings
+ // --------------------------
+
+ // returns the encoding for the given charset (in the form of RFC 2046) or
+ // wxFONTENCODING_SYSTEM if couldn't decode it
+ virtual wxFontEncoding CharsetToEncoding(const wxString& charset,
+ bool interactive = true);
+
+ // find an alternative for the given encoding (which is supposed to not be
+ // available on this system). If successful, return true and fill info
+ // structure with the parameters required to create the font, otherwise
+ // return false
+ virtual bool GetAltForEncoding(wxFontEncoding encoding,
+ wxNativeEncodingInfo *info,
+ const wxString& facename = wxEmptyString,
+ bool interactive = true);
+
+ // version better suitable for 'public' use. Returns wxFontEcoding
+ // that can be used it wxFont ctor
+ bool GetAltForEncoding(wxFontEncoding encoding,
+ wxFontEncoding *alt_encoding,
+ const wxString& facename = wxEmptyString,
+ bool interactive = true);
+
+ // checks whether given encoding is available in given face or not.
+ //
+ // if no facename is given (default), return true if it's available in any
+ // facename at alll.
+ virtual bool IsEncodingAvailable(wxFontEncoding encoding,
+ const wxString& facename = wxEmptyString);
+
+
+ // configure the appearance of the dialogs we may popup
+ // ----------------------------------------------------
+
+ // the parent window for modal dialogs
+ void SetDialogParent(wxWindow *parent) { m_windowParent = parent; }
+
+ // the title for the dialogs (note that default is quite reasonable)
+ void SetDialogTitle(const wxString& title) { m_titleDialog = title; }
+
+ // GUI code needs to know it's a wxFontMapper because there
+ // are additional methods in the subclass.
+ static wxFontMapper *Get();
+
+ // pseudo-RTTI since we aren't a wxObject.
+ virtual bool IsDummy() { return false; }
+
+protected:
+ // GetAltForEncoding() helper: tests for the existence of the given
+ // encoding and saves the result in config if ok - this results in the
+ // following (desired) behaviour: when an unknown/unavailable encoding is
+ // requested for the first time, the user is asked about a replacement,
+ // but if he doesn't choose any and the default logic finds one, it will
+ // be saved in the config so that the user won't be asked about it any
+ // more
+ bool TestAltEncoding(const wxString& configEntry,
+ wxFontEncoding encReplacement,
+ wxNativeEncodingInfo *info);
+
+ // the title for our dialogs
+ wxString m_titleDialog;
+
+ // the parent window for our dialogs
+ wxWindow *m_windowParent;
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxFontMapper);
+};
+
+#endif // wxUSE_GUI
+
+// ----------------------------------------------------------------------------
+// global variables
+// ----------------------------------------------------------------------------
+
+// the default font mapper for wxWidgets programs do NOT use! This is for
+// backward compatibility, use wxFontMapper::Get() instead
+#define wxTheFontMapper (wxFontMapper::Get())
+
+#else // !wxUSE_FONTMAP
+
+#if wxUSE_GUI
+ // wxEncodingToCodepage (utils.cpp) needs wxGetNativeFontEncoding
+ #include "wx/fontutil.h"
+#endif
+
+#endif // wxUSE_FONTMAP/!wxUSE_FONTMAP
+
+#endif // _WX_FONTMAPPER_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/fontpicker.h
+// Purpose: wxFontPickerCtrl base header
+// Author: Francesco Montorsi
+// Modified by:
+// Created: 14/4/2006
+// Copyright: (c) Francesco Montorsi
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FONTPICKER_H_BASE_
+#define _WX_FONTPICKER_H_BASE_
+
+#include "wx/defs.h"
+
+
+#if wxUSE_FONTPICKERCTRL
+
+#include "wx/pickerbase.h"
+
+
+class WXDLLIMPEXP_FWD_CORE wxFontPickerEvent;
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxFontPickerWidgetNameStr[];
+extern WXDLLIMPEXP_DATA_CORE(const char) wxFontPickerCtrlNameStr[];
+
+
+// ----------------------------------------------------------------------------
+// wxFontPickerWidgetBase: a generic abstract interface which must be
+// implemented by controls used by wxFontPickerCtrl
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFontPickerWidgetBase
+{
+public:
+ wxFontPickerWidgetBase() { m_selectedFont = *wxNORMAL_FONT; }
+ virtual ~wxFontPickerWidgetBase() {}
+
+ wxFont GetSelectedFont() const
+ { return m_selectedFont; }
+ virtual void SetSelectedFont(const wxFont &f)
+ { m_selectedFont = f; UpdateFont(); }
+
+protected:
+
+ virtual void UpdateFont() = 0;
+
+ // the current font (may be invalid if none)
+ // NOTE: don't call this m_font as wxWindow::m_font already exists
+ wxFont m_selectedFont;
+};
+
+// Styles which must be supported by all controls implementing wxFontPickerWidgetBase
+// NB: these styles must be defined to carefully-chosen values to
+// avoid conflicts with wxButton's styles
+
+
+// keeps the label of the button updated with the fontface name + font size
+// E.g. choosing "Times New Roman bold, italic with size 10" from the fontdialog,
+// updates the wxFontButtonGeneric's label (overwriting any previous label)
+// with the "Times New Roman, 10" text (only fontface + fontsize is displayed
+// to avoid extralong labels).
+#define wxFNTP_FONTDESC_AS_LABEL 0x0008
+
+// uses the currently selected font to draw the label of the button
+#define wxFNTP_USEFONT_FOR_LABEL 0x0010
+
+#define wxFONTBTN_DEFAULT_STYLE \
+ (wxFNTP_FONTDESC_AS_LABEL | wxFNTP_USEFONT_FOR_LABEL)
+
+// native version currently only exists in wxGTK2
+#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
+ #include "wx/gtk/fontpicker.h"
+ #define wxFontPickerWidget wxFontButton
+#else
+ #include "wx/generic/fontpickerg.h"
+ #define wxFontPickerWidget wxGenericFontButton
+#endif
+
+
+// ----------------------------------------------------------------------------
+// wxFontPickerCtrl specific flags
+// ----------------------------------------------------------------------------
+
+#define wxFNTP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL)
+#define wxFNTP_DEFAULT_STYLE (wxFNTP_FONTDESC_AS_LABEL|wxFNTP_USEFONT_FOR_LABEL)
+
+// not a style but rather the default value of the maximum pointsize allowed
+#define wxFNTP_MAXPOINT_SIZE 100
+
+
+// ----------------------------------------------------------------------------
+// wxFontPickerCtrl: platform-independent class which embeds the
+// platform-dependent wxFontPickerWidget andm if wxFNTP_USE_TEXTCTRL style is
+// used, a textctrl next to it.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFontPickerCtrl : public wxPickerBase
+{
+public:
+ wxFontPickerCtrl()
+ : m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE)
+ {
+ }
+
+ virtual ~wxFontPickerCtrl() {}
+
+
+ wxFontPickerCtrl(wxWindow *parent,
+ wxWindowID id,
+ const wxFont& initial = wxNullFont,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxFNTP_DEFAULT_STYLE,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxFontPickerCtrlNameStr)
+ : m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE)
+ {
+ Create(parent, id, initial, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxFont& initial = wxNullFont,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxFNTP_DEFAULT_STYLE,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxFontPickerCtrlNameStr);
+
+
+public: // public API
+
+ // get the font chosen
+ wxFont GetSelectedFont() const
+ { return ((wxFontPickerWidget *)m_picker)->GetSelectedFont(); }
+
+ // sets currently displayed font
+ void SetSelectedFont(const wxFont& f);
+
+ // set/get the max pointsize
+ void SetMaxPointSize(unsigned int max)
+ { m_nMaxPointSize=max; }
+ unsigned int GetMaxPointSize() const
+ { return m_nMaxPointSize; }
+
+public: // internal functions
+
+ void UpdatePickerFromTextCtrl();
+ void UpdateTextCtrlFromPicker();
+
+ // event handler for our picker
+ void OnFontChange(wxFontPickerEvent &);
+
+ // used to convert wxString <-> wxFont
+ virtual wxString Font2String(const wxFont &font);
+ virtual wxFont String2Font(const wxString &font);
+
+protected:
+
+ // extracts the style for our picker from wxFontPickerCtrl's style
+ long GetPickerStyle(long style) const
+ { return (style & (wxFNTP_FONTDESC_AS_LABEL|wxFNTP_USEFONT_FOR_LABEL)); }
+
+ // the maximum pointsize allowed to the user
+ unsigned int m_nMaxPointSize;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxFontPickerCtrl)
+};
+
+
+// ----------------------------------------------------------------------------
+// wxFontPickerEvent: used by wxFontPickerCtrl only
+// ----------------------------------------------------------------------------
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FONTPICKER_CHANGED, wxFontPickerEvent );
+
+class WXDLLIMPEXP_CORE wxFontPickerEvent : public wxCommandEvent
+{
+public:
+ wxFontPickerEvent() {}
+ wxFontPickerEvent(wxObject *generator, int id, const wxFont &f)
+ : wxCommandEvent(wxEVT_FONTPICKER_CHANGED, id),
+ m_font(f)
+ {
+ SetEventObject(generator);
+ }
+
+ wxFont GetFont() const { return m_font; }
+ void SetFont(const wxFont &c) { m_font = c; }
+
+ // default copy ctor, assignment operator and dtor are ok
+ virtual wxEvent *Clone() const { return new wxFontPickerEvent(*this); }
+
+private:
+ wxFont m_font;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFontPickerEvent)
+};
+
+// ----------------------------------------------------------------------------
+// event types and macros
+// ----------------------------------------------------------------------------
+
+typedef void (wxEvtHandler::*wxFontPickerEventFunction)(wxFontPickerEvent&);
+
+#define wxFontPickerEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxFontPickerEventFunction, func)
+
+#define EVT_FONTPICKER_CHANGED(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_FONTPICKER_CHANGED, id, wxFontPickerEventHandler(fn))
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_FONTPICKER_CHANGED wxEVT_FONTPICKER_CHANGED
+
+
+#endif // wxUSE_FONTPICKERCTRL
+
+#endif
+ // _WX_FONTPICKER_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/fontutil.h
+// Purpose: font-related helper functions
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 05.11.99
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// General note: this header is private to wxWidgets and is not supposed to be
+// included by user code. The functions declared here are implemented in
+// msw/fontutil.cpp for Windows, unix/fontutil.cpp for GTK/Motif &c.
+
+#ifndef _WX_FONTUTIL_H_
+#define _WX_FONTUTIL_H_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/font.h" // for wxFont and wxFontEncoding
+
+#if defined(__WXMSW__)
+ #include "wx/msw/wrapwin.h"
+#endif
+
+class WXDLLIMPEXP_FWD_BASE wxArrayString;
+struct WXDLLIMPEXP_FWD_CORE wxNativeEncodingInfo;
+
+#if defined(_WX_X_FONTLIKE)
+
+// the symbolic names for the XLFD fields (with examples for their value)
+//
+// NB: we suppose that the font always starts with the empty token (font name
+// registry field) as we never use nor generate it anyhow
+enum wxXLFDField
+{
+ wxXLFD_FOUNDRY, // adobe
+ wxXLFD_FAMILY, // courier, times, ...
+ wxXLFD_WEIGHT, // black, bold, demibold, medium, regular, light
+ wxXLFD_SLANT, // r/i/o (roman/italique/oblique)
+ wxXLFD_SETWIDTH, // condensed, expanded, ...
+ wxXLFD_ADDSTYLE, // whatever - usually nothing
+ wxXLFD_PIXELSIZE, // size in pixels
+ wxXLFD_POINTSIZE, // size in points
+ wxXLFD_RESX, // 72, 75, 100, ...
+ wxXLFD_RESY,
+ wxXLFD_SPACING, // m/p/c (monospaced/proportional/character cell)
+ wxXLFD_AVGWIDTH, // average width in 1/10 pixels
+ wxXLFD_REGISTRY, // iso8859, rawin, koi8, ...
+ wxXLFD_ENCODING, // 1, r, r, ...
+ wxXLFD_MAX
+};
+
+#endif // _WX_X_FONTLIKE
+
+// ----------------------------------------------------------------------------
+// types
+// ----------------------------------------------------------------------------
+
+// wxNativeFontInfo is platform-specific font representation: this struct
+// should be considered as opaque font description only used by the native
+// functions, the user code can only get the objects of this type from
+// somewhere and pass it somewhere else (possibly save them somewhere using
+// ToString() and restore them using FromString())
+
+class WXDLLIMPEXP_CORE wxNativeFontInfo
+{
+public:
+#if wxUSE_PANGO
+ PangoFontDescription *description;
+
+ // Pango font description doesn't have these attributes, so we store them
+ // separately and handle them ourselves in {To,From}String() methods.
+ bool m_underlined;
+ bool m_strikethrough;
+#elif defined(_WX_X_FONTLIKE)
+ // the members can't be accessed directly as we only parse the
+ // xFontName on demand
+private:
+ // the components of the XLFD
+ wxString fontElements[wxXLFD_MAX];
+
+ // the full XLFD
+ wxString xFontName;
+
+ // true until SetXFontName() is called
+ bool m_isDefault;
+
+ // return true if we have already initialized fontElements
+ inline bool HasElements() const;
+
+public:
+ // init the elements from an XLFD, return true if ok
+ bool FromXFontName(const wxString& xFontName);
+
+ // return false if we were never initialized with a valid XLFD
+ bool IsDefault() const { return m_isDefault; }
+
+ // return the XLFD (using the fontElements if necessary)
+ wxString GetXFontName() const;
+
+ // get the given XFLD component
+ wxString GetXFontComponent(wxXLFDField field) const;
+
+ // change the font component
+ void SetXFontComponent(wxXLFDField field, const wxString& value);
+
+ // set the XFLD
+ void SetXFontName(const wxString& xFontName);
+#elif defined(__WXMSW__)
+ wxNativeFontInfo(const LOGFONT& lf_) : lf(lf_) { }
+
+ LOGFONT lf;
+#elif defined(__WXPM__)
+ // OS/2 native structures that define a font
+ FATTRS fa;
+ FONTMETRICS fm;
+ FACENAMEDESC fn;
+#elif defined(__WXOSX__)
+public:
+ wxNativeFontInfo(const wxNativeFontInfo& info) { Init(info); }
+ wxNativeFontInfo( int size,
+ wxFontFamily family,
+ wxFontStyle style,
+ wxFontWeight weight,
+ bool underlined,
+ const wxString& faceName,
+ wxFontEncoding encoding)
+ { Init(size,family,style,weight,underlined,faceName,encoding); }
+
+ ~wxNativeFontInfo() { Free(); }
+
+ wxNativeFontInfo& operator=(const wxNativeFontInfo& info)
+ {
+ if (this != &info)
+ {
+ Free();
+ Init(info);
+ }
+ return *this;
+ }
+
+ void Init(CTFontDescriptorRef descr);
+ void Init(const wxNativeFontInfo& info);
+ void Init(int size,
+ wxFontFamily family,
+ wxFontStyle style,
+ wxFontWeight weight,
+ bool underlined,
+ const wxString& faceName ,
+ wxFontEncoding encoding);
+
+ void Free();
+ void EnsureValid();
+
+ bool m_descriptorValid;
+
+#if wxOSX_USE_ATSU_TEXT
+ bool m_atsuFontValid;
+ // the atsu font ID
+ wxUint32 m_atsuFontID;
+ // the qd styles that are not intrinsic to the font above
+ wxInt16 m_atsuAdditionalQDStyles;
+#if wxOSX_USE_CARBON
+ wxInt16 m_qdFontFamily;
+ wxInt16 m_qdFontStyle;
+#endif
+#endif
+
+ int m_pointSize;
+ wxFontFamily m_family;
+ wxFontStyle m_style;
+ wxFontWeight m_weight;
+ bool m_underlined;
+ bool m_strikethrough;
+ wxString m_faceName;
+ wxFontEncoding m_encoding;
+public :
+#else // other platforms
+ //
+ // This is a generic implementation that should work on all ports
+ // without specific support by the port.
+ //
+ #define wxNO_NATIVE_FONTINFO
+
+ int pointSize;
+ wxFontFamily family;
+ wxFontStyle style;
+ wxFontWeight weight;
+ bool underlined;
+ bool strikethrough;
+ wxString faceName;
+ wxFontEncoding encoding;
+#endif // platforms
+
+ // default ctor (default copy ctor is ok)
+ wxNativeFontInfo() { Init(); }
+
+#if wxUSE_PANGO
+private:
+ void Init(const wxNativeFontInfo& info);
+ void Free();
+
+public:
+ wxNativeFontInfo(const wxNativeFontInfo& info) { Init(info); }
+ ~wxNativeFontInfo() { Free(); }
+
+ wxNativeFontInfo& operator=(const wxNativeFontInfo& info)
+ {
+ if (this != &info)
+ {
+ Free();
+ Init(info);
+ }
+ return *this;
+ }
+#endif // wxUSE_PANGO
+
+ // reset to the default state
+ void Init();
+
+ // init with the parameters of the given font
+ void InitFromFont(const wxFont& font)
+ {
+ // translate all font parameters
+ SetStyle((wxFontStyle)font.GetStyle());
+ SetWeight((wxFontWeight)font.GetWeight());
+ SetUnderlined(font.GetUnderlined());
+ SetStrikethrough(font.GetStrikethrough());
+#if defined(__WXMSW__)
+ if ( font.IsUsingSizeInPixels() )
+ SetPixelSize(font.GetPixelSize());
+ else
+ SetPointSize(font.GetPointSize());
+#else
+ SetPointSize(font.GetPointSize());
+#endif
+
+ // set the family/facename
+ SetFamily((wxFontFamily)font.GetFamily());
+ const wxString& facename = font.GetFaceName();
+ if ( !facename.empty() )
+ {
+ SetFaceName(facename);
+ }
+
+ // deal with encoding now (it may override the font family and facename
+ // so do it after setting them)
+ SetEncoding(font.GetEncoding());
+ }
+
+ // accessors and modifiers for the font elements
+ int GetPointSize() const;
+ wxSize GetPixelSize() const;
+ wxFontStyle GetStyle() const;
+ wxFontWeight GetWeight() const;
+ bool GetUnderlined() const;
+ bool GetStrikethrough() const;
+ wxString GetFaceName() const;
+ wxFontFamily GetFamily() const;
+ wxFontEncoding GetEncoding() const;
+
+ void SetPointSize(int pointsize);
+ void SetPixelSize(const wxSize& pixelSize);
+ void SetStyle(wxFontStyle style);
+ void SetWeight(wxFontWeight weight);
+ void SetUnderlined(bool underlined);
+ void SetStrikethrough(bool strikethrough);
+ bool SetFaceName(const wxString& facename);
+ void SetFamily(wxFontFamily family);
+ void SetEncoding(wxFontEncoding encoding);
+
+ // sets the first facename in the given array which is found
+ // to be valid. If no valid facename is given, sets the
+ // first valid facename returned by wxFontEnumerator::GetFacenames().
+ // Does not return a bool since it cannot fail.
+ void SetFaceName(const wxArrayString &facenames);
+
+
+ // it is important to be able to serialize wxNativeFontInfo objects to be
+ // able to store them (in config file, for example)
+ bool FromString(const wxString& s);
+ wxString ToString() const;
+
+ // we also want to present the native font descriptions to the user in some
+ // human-readable form (it is not platform independent neither, but can
+ // hopefully be understood by the user)
+ bool FromUserString(const wxString& s);
+ wxString ToUserString() const;
+};
+
+// ----------------------------------------------------------------------------
+// font-related functions (common)
+// ----------------------------------------------------------------------------
+
+// translate a wxFontEncoding into native encoding parameter (defined above),
+// returning true if an (exact) macth could be found, false otherwise (without
+// attempting any substitutions)
+WXDLLIMPEXP_CORE bool wxGetNativeFontEncoding(wxFontEncoding encoding,
+ wxNativeEncodingInfo *info);
+
+// test for the existence of the font described by this facename/encoding,
+// return true if such font(s) exist, false otherwise
+WXDLLIMPEXP_CORE bool wxTestFontEncoding(const wxNativeEncodingInfo& info);
+
+// ----------------------------------------------------------------------------
+// font-related functions (X and GTK)
+// ----------------------------------------------------------------------------
+
+#ifdef _WX_X_FONTLIKE
+ #include "wx/unix/fontutil.h"
+#endif // X || GDK
+
+#endif // _WX_FONTUTIL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/frame.h
+// Purpose: wxFrame class interface
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 15.11.99
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FRAME_H_BASE_
+#define _WX_FRAME_H_BASE_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/toplevel.h" // the base class
+#include "wx/statusbr.h"
+
+// the default names for various classs
+extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusLineNameStr[];
+extern WXDLLIMPEXP_DATA_CORE(const char) wxToolBarNameStr[];
+
+class WXDLLIMPEXP_FWD_CORE wxFrame;
+class WXDLLIMPEXP_FWD_CORE wxMenuBar;
+class WXDLLIMPEXP_FWD_CORE wxMenuItem;
+class WXDLLIMPEXP_FWD_CORE wxStatusBar;
+class WXDLLIMPEXP_FWD_CORE wxToolBar;
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// wxFrame-specific (i.e. not for wxDialog) styles
+//
+// Also see the bit summary table in wx/toplevel.h.
+#define wxFRAME_NO_TASKBAR 0x0002 // No taskbar button (MSW only)
+#define wxFRAME_TOOL_WINDOW 0x0004 // No taskbar button, no system menu
+#define wxFRAME_FLOAT_ON_PARENT 0x0008 // Always above its parent
+
+// ----------------------------------------------------------------------------
+// wxFrame is a top-level window with optional menubar, statusbar and toolbar
+//
+// For each of *bars, a frame may have several of them, but only one is
+// managed by the frame, i.e. resized/moved when the frame is and whose size
+// is accounted for in client size calculations - all others should be taken
+// care of manually. The CreateXXXBar() functions create this, main, XXXBar,
+// but the actual creation is done in OnCreateXXXBar() functions which may be
+// overridden to create custom objects instead of standard ones when
+// CreateXXXBar() is called.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFrameBase : public wxTopLevelWindow
+{
+public:
+ // construction
+ wxFrameBase();
+ virtual ~wxFrameBase();
+
+ wxFrame *New(wxWindow *parent,
+ wxWindowID winid,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr);
+
+ // frame state
+ // -----------
+
+ // get the origin of the client area (which may be different from (0, 0)
+ // if the frame has a toolbar) in client coordinates
+ virtual wxPoint GetClientAreaOrigin() const;
+
+
+ // menu bar functions
+ // ------------------
+
+#if wxUSE_MENUS
+ virtual void SetMenuBar(wxMenuBar *menubar);
+ virtual wxMenuBar *GetMenuBar() const { return m_frameMenuBar; }
+
+ // find the item by id in the frame menu bar: this is an internal function
+ // and exists mainly in order to be overridden in the MDI parent frame
+ // which also looks at its active child menu bar
+ virtual wxMenuItem *FindItemInMenuBar(int menuId) const;
+
+ // generate menu command corresponding to the given menu item
+ //
+ // returns true if processed
+ bool ProcessCommand(wxMenuItem *item);
+
+ // generate menu command corresponding to the given menu command id
+ //
+ // returns true if processed
+ bool ProcessCommand(int winid);
+#else
+ bool ProcessCommand(int WXUNUSED(winid)) { return false; }
+#endif // wxUSE_MENUS
+
+ // status bar functions
+ // --------------------
+#if wxUSE_STATUSBAR
+ // create the main status bar by calling OnCreateStatusBar()
+ virtual wxStatusBar* CreateStatusBar(int number = 1,
+ long style = wxSTB_DEFAULT_STYLE,
+ wxWindowID winid = 0,
+ const wxString& name = wxStatusLineNameStr);
+ // return a new status bar
+ virtual wxStatusBar *OnCreateStatusBar(int number,
+ long style,
+ wxWindowID winid,
+ const wxString& name);
+ // get the main status bar
+ virtual wxStatusBar *GetStatusBar() const { return m_frameStatusBar; }
+
+ // sets the main status bar
+ virtual void SetStatusBar(wxStatusBar *statBar);
+
+ // forward these to status bar
+ virtual void SetStatusText(const wxString &text, int number = 0);
+ virtual void SetStatusWidths(int n, const int widths_field[]);
+ void PushStatusText(const wxString &text, int number = 0);
+ void PopStatusText(int number = 0);
+
+ // set the status bar pane the help will be shown in
+ void SetStatusBarPane(int n) { m_statusBarPane = n; }
+ int GetStatusBarPane() const { return m_statusBarPane; }
+#endif // wxUSE_STATUSBAR
+
+ // toolbar functions
+ // -----------------
+
+#if wxUSE_TOOLBAR
+ // create main toolbar bycalling 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/set the main toolbar
+ virtual wxToolBar *GetToolBar() const { return m_frameToolBar; }
+ virtual void SetToolBar(wxToolBar *toolbar);
+#endif // wxUSE_TOOLBAR
+
+ // implementation only from now on
+ // -------------------------------
+
+ // event handlers
+#if wxUSE_MENUS
+#if wxUSE_STATUSBAR
+ void OnMenuOpen(wxMenuEvent& event);
+ void OnMenuClose(wxMenuEvent& event);
+ void OnMenuHighlight(wxMenuEvent& event);
+#endif // wxUSE_STATUSBAR
+
+ // send wxUpdateUIEvents for all menu items in the menubar,
+ // or just for menu if non-NULL
+ virtual void DoMenuUpdates(wxMenu* menu = NULL);
+#endif // wxUSE_MENUS
+
+ // do the UI update processing for this window
+ virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE);
+
+ // Implement internal behaviour (menu updating on some platforms)
+ virtual void OnInternalIdle();
+
+#if wxUSE_MENUS || wxUSE_TOOLBAR
+ // show help text for the currently selected menu or toolbar item
+ // (typically in the status bar) or hide it and restore the status bar text
+ // originally shown before the menu was opened if show == false
+ virtual void DoGiveHelp(const wxString& text, bool show);
+#endif
+
+ virtual bool IsClientAreaChild(const wxWindow *child) const
+ {
+ return !IsOneOfBars(child) && wxTopLevelWindow::IsClientAreaChild(child);
+ }
+
+protected:
+ // the frame main menu/status/tool bars
+ // ------------------------------------
+
+ // this (non virtual!) function should be called from dtor to delete the
+ // main menubar, statusbar and toolbar (if any)
+ void DeleteAllBars();
+
+ // test whether this window makes part of the frame
+ virtual bool IsOneOfBars(const wxWindow *win) const;
+
+#if wxUSE_MENUS
+ // override to update menu bar position when the frame size changes
+ virtual void PositionMenuBar() { }
+
+ // override to do something special when the menu bar is being removed
+ // from the frame
+ virtual void DetachMenuBar();
+
+ // override to do something special when the menu bar is attached to the
+ // frame
+ virtual void AttachMenuBar(wxMenuBar *menubar);
+
+ // Return true if we should update the menu item state from idle event
+ // handler or false if we should delay it until the menu is opened.
+ static bool ShouldUpdateMenuFromIdle();
+
+ wxMenuBar *m_frameMenuBar;
+#endif // wxUSE_MENUS
+
+#if wxUSE_STATUSBAR && (wxUSE_MENUS || wxUSE_TOOLBAR)
+ // the saved status bar text overwritten by DoGiveHelp()
+ wxString m_oldStatusText;
+
+ // the last help string we have shown in the status bar
+ wxString m_lastHelpShown;
+#endif
+
+#if wxUSE_STATUSBAR
+ // override to update status bar position (or anything else) when
+ // something changes
+ virtual void PositionStatusBar() { }
+
+ // show the help string for the given menu item using DoGiveHelp() if the
+ // given item does have a help string (as determined by FindInMenuBar()),
+ // return false if there is no help for such item
+ bool ShowMenuHelp(int helpid);
+
+ wxStatusBar *m_frameStatusBar;
+#endif // wxUSE_STATUSBAR
+
+
+ int m_statusBarPane;
+
+#if wxUSE_TOOLBAR
+ // override to update status bar position (or anything else) when
+ // something changes
+ virtual void PositionToolBar() { }
+
+ wxToolBar *m_frameToolBar;
+#endif // wxUSE_TOOLBAR
+
+#if wxUSE_MENUS && wxUSE_STATUSBAR
+ DECLARE_EVENT_TABLE()
+#endif // wxUSE_MENUS && wxUSE_STATUSBAR
+
+ wxDECLARE_NO_COPY_CLASS(wxFrameBase);
+};
+
+// include the real class declaration
+#if defined(__WXUNIVERSAL__) // && !defined(__WXMICROWIN__)
+ #include "wx/univ/frame.h"
+#else // !__WXUNIVERSAL__
+ #if defined(__WXMSW__)
+ #include "wx/msw/frame.h"
+ #elif defined(__WXGTK20__)
+ #include "wx/gtk/frame.h"
+ #elif defined(__WXGTK__)
+ #include "wx/gtk1/frame.h"
+ #elif defined(__WXMOTIF__)
+ #include "wx/motif/frame.h"
+ #elif defined(__WXMAC__)
+ #include "wx/osx/frame.h"
+ #elif defined(__WXCOCOA__)
+ #include "wx/cocoa/frame.h"
+ #elif defined(__WXPM__)
+ #include "wx/os2/frame.h"
+ #endif
+#endif
+
+#endif
+ // _WX_FRAME_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/fs_arc.h
+// Purpose: Archive file system
+// Author: Vaclav Slavik, Mike Wetherell
+// Copyright: (c) 1999 Vaclav Slavik, (c) 2006 Mike Wetherell
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FS_ARC_H_
+#define _WX_FS_ARC_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_FS_ARCHIVE
+
+#include "wx/filesys.h"
+#include "wx/hashmap.h"
+
+WX_DECLARE_STRING_HASH_MAP(int, wxArchiveFilenameHashMap);
+
+//---------------------------------------------------------------------------
+// wxArchiveFSHandler
+//---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxArchiveFSHandler : public wxFileSystemHandler
+{
+public:
+ wxArchiveFSHandler();
+ virtual bool CanOpen(const wxString& location);
+ virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
+ virtual wxString FindFirst(const wxString& spec, int flags = 0);
+ virtual wxString FindNext();
+ void Cleanup();
+ virtual ~wxArchiveFSHandler();
+
+private:
+ class wxArchiveFSCache *m_cache;
+ wxFileSystem m_fs;
+
+ // these vars are used by FindFirst/Next:
+ class wxArchiveFSCacheData *m_Archive;
+ struct wxArchiveFSEntry *m_FindEntry;
+ wxString m_Pattern, m_BaseDir, m_ZipFile;
+ bool m_AllowDirs, m_AllowFiles;
+ wxArchiveFilenameHashMap *m_DirsFound;
+
+ wxString DoFind();
+
+ wxDECLARE_NO_COPY_CLASS(wxArchiveFSHandler);
+ DECLARE_DYNAMIC_CLASS(wxArchiveFSHandler)
+};
+
+#endif // wxUSE_FS_ARCHIVE
+
+#endif // _WX_FS_ARC_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/fs_filter.h
+// Purpose: Filter file system handler
+// Author: Mike Wetherell
+// Copyright: (c) 2006 Mike Wetherell
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FS_FILTER_H_
+#define _WX_FS_FILTER_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_FILESYSTEM
+
+#include "wx/filesys.h"
+
+//---------------------------------------------------------------------------
+// wxFilterFSHandler
+//---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxFilterFSHandler : public wxFileSystemHandler
+{
+public:
+ wxFilterFSHandler() : wxFileSystemHandler() { }
+ virtual ~wxFilterFSHandler() { }
+
+ virtual bool CanOpen(const wxString& location);
+ virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
+
+ virtual wxString FindFirst(const wxString& spec, int flags = 0);
+ virtual wxString FindNext();
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxFilterFSHandler);
+};
+
+#endif // wxUSE_FILESYSTEM
+
+#endif // _WX_FS_FILTER_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/fs_inet.h
+// Purpose: HTTP and FTP file system
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FS_INET_H_
+#define _WX_FS_INET_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_FILESYSTEM && wxUSE_FS_INET && wxUSE_STREAMS && wxUSE_SOCKETS
+
+#include "wx/filesys.h"
+
+// ----------------------------------------------------------------------------
+// wxInternetFSHandler
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_NET wxInternetFSHandler : public wxFileSystemHandler
+{
+ public:
+ virtual bool CanOpen(const wxString& location);
+ virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
+};
+
+#endif
+ // wxUSE_FILESYSTEM && wxUSE_FS_INET && wxUSE_STREAMS && wxUSE_SOCKETS
+
+#endif // _WX_FS_INET_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/fs_mem.h
+// Purpose: in-memory file system
+// Author: Vaclav Slavik
+// Copyright: (c) 2000 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FS_MEM_H_
+#define _WX_FS_MEM_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_FILESYSTEM
+
+#include "wx/filesys.h"
+
+#include "wx/hashmap.h"
+
+class wxMemoryFSFile;
+WX_DECLARE_STRING_HASH_MAP(wxMemoryFSFile *, wxMemoryFSHash);
+
+#if wxUSE_GUI
+ #include "wx/bitmap.h"
+#endif // wxUSE_GUI
+
+// ----------------------------------------------------------------------------
+// wxMemoryFSHandlerBase
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMemoryFSHandlerBase : public wxFileSystemHandler
+{
+public:
+ wxMemoryFSHandlerBase();
+ virtual ~wxMemoryFSHandlerBase();
+
+ // Add file to list of files stored in memory. Stored data (bitmap, text or
+ // raw data) will be copied into private memory stream and available under
+ // name "memory:" + filename
+ static void AddFile(const wxString& filename, const wxString& textdata);
+ static void AddFile(const wxString& filename, const void *binarydata, size_t size);
+ static void AddFileWithMimeType(const wxString& filename,
+ const wxString& textdata,
+ const wxString& mimetype);
+ static void AddFileWithMimeType(const wxString& filename,
+ const void *binarydata, size_t size,
+ const wxString& mimetype);
+
+ // Remove file from memory FS and free occupied memory
+ static void RemoveFile(const wxString& filename);
+
+ virtual bool CanOpen(const wxString& location);
+ virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
+ virtual wxString FindFirst(const wxString& spec, int flags = 0);
+ virtual wxString FindNext();
+
+protected:
+ // check that the given file is not already present in m_Hash; logs an
+ // error and returns false if it does exist
+ static bool CheckDoesntExist(const wxString& filename);
+
+ // the hash map indexed by the names of the files stored in the memory FS
+ static wxMemoryFSHash m_Hash;
+
+ // the file name currently being searched for, i.e. the argument of the
+ // last FindFirst() call or empty string if FindFirst() hasn't been called
+ // yet or FindNext() didn't find anything
+ wxString m_findArgument;
+
+ // iterator into m_Hash used by FindFirst/Next(), possibly m_Hash.end() or
+ // even invalid (can only be used when m_findArgument is not empty)
+ wxMemoryFSHash::const_iterator m_findIter;
+};
+
+// ----------------------------------------------------------------------------
+// wxMemoryFSHandler
+// ----------------------------------------------------------------------------
+
+#if wxUSE_GUI
+
+// add GUI-only operations to the base class
+class WXDLLIMPEXP_CORE wxMemoryFSHandler : public wxMemoryFSHandlerBase
+{
+public:
+ // bring the base class versions into the scope, otherwise they would be
+ // inaccessible in wxMemoryFSHandler
+ // (unfortunately "using" can't be used as gcc 2.95 doesn't have it...)
+ static void AddFile(const wxString& filename, const wxString& textdata)
+ {
+ wxMemoryFSHandlerBase::AddFile(filename, textdata);
+ }
+
+ static void AddFile(const wxString& filename,
+ const void *binarydata,
+ size_t size)
+ {
+ wxMemoryFSHandlerBase::AddFile(filename, binarydata, size);
+ }
+ static void AddFileWithMimeType(const wxString& filename,
+ const wxString& textdata,
+ const wxString& mimetype)
+ {
+ wxMemoryFSHandlerBase::AddFileWithMimeType(filename,
+ textdata,
+ mimetype);
+ }
+ static void AddFileWithMimeType(const wxString& filename,
+ const void *binarydata, size_t size,
+ const wxString& mimetype)
+ {
+ wxMemoryFSHandlerBase::AddFileWithMimeType(filename,
+ binarydata, size,
+ mimetype);
+ }
+
+#if wxUSE_IMAGE
+ static void AddFile(const wxString& filename,
+ const wxImage& image,
+ wxBitmapType type);
+
+ static void AddFile(const wxString& filename,
+ const wxBitmap& bitmap,
+ wxBitmapType type);
+#endif // wxUSE_IMAGE
+
+};
+
+#else // !wxUSE_GUI
+
+// just the same thing as the base class in wxBase
+class WXDLLIMPEXP_BASE wxMemoryFSHandler : public wxMemoryFSHandlerBase
+{
+};
+
+#endif // wxUSE_GUI/!wxUSE_GUI
+
+#endif // wxUSE_FILESYSTEM
+
+#endif // _WX_FS_MEM_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/fs_zip.h
+// Purpose: wxZipFSHandler typedef for compatibility
+// Author: Mike Wetherell
+// Copyright: (c) 2006 Mike Wetherell
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FS_ZIP_H_
+#define _WX_FS_ZIP_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_FS_ZIP
+
+#include "wx/fs_arc.h"
+
+typedef wxArchiveFSHandler wxZipFSHandler;
+
+#endif // wxUSE_FS_ZIP
+
+#endif // _WX_FS_ZIP_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/fswatcher.h
+// Purpose: wxFileSystemWatcherBase
+// Author: Bartosz Bekier
+// Created: 2009-05-23
+// Copyright: (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FSWATCHER_BASE_H_
+#define _WX_FSWATCHER_BASE_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_FSWATCHER
+
+#include "wx/log.h"
+#include "wx/event.h"
+#include "wx/evtloop.h"
+#include "wx/filename.h"
+#include "wx/dir.h"
+#include "wx/hashmap.h"
+
+#define wxTRACE_FSWATCHER "fswatcher"
+
+// ----------------------------------------------------------------------------
+// wxFileSystemWatcherEventType & wxFileSystemWatcherEvent
+// ----------------------------------------------------------------------------
+
+/**
+ * Possible types of file system events.
+ * This is a subset that will work fine an all platforms (actually, we will
+ * see how it works on Mac).
+ *
+ * We got 2 types of error events:
+ * - warning: these are not fatal and further events can still be generated
+ * - error: indicates fatal error and causes that no more events will happen
+ */
+enum
+{
+ wxFSW_EVENT_CREATE = 0x01,
+ wxFSW_EVENT_DELETE = 0x02,
+ wxFSW_EVENT_RENAME = 0x04,
+ wxFSW_EVENT_MODIFY = 0x08,
+ wxFSW_EVENT_ACCESS = 0x10,
+ wxFSW_EVENT_ATTRIB = 0x20, // Currently this is wxGTK-only
+
+ // error events
+ wxFSW_EVENT_WARNING = 0x40,
+ wxFSW_EVENT_ERROR = 0x80,
+ wxFSW_EVENT_ALL = wxFSW_EVENT_CREATE | wxFSW_EVENT_DELETE |
+ wxFSW_EVENT_RENAME | wxFSW_EVENT_MODIFY |
+ wxFSW_EVENT_ACCESS | wxFSW_EVENT_ATTRIB |
+ wxFSW_EVENT_WARNING | wxFSW_EVENT_ERROR
+#ifdef wxHAS_INOTIFY
+ ,wxFSW_EVENT_UNMOUNT = 0x2000
+#endif
+};
+
+// Type of the path watched, used only internally for now.
+enum wxFSWPathType
+{
+ wxFSWPath_None, // Invalid value for an initialized watch.
+ wxFSWPath_File, // Plain file.
+ wxFSWPath_Dir, // Watch a directory and the files in it.
+ wxFSWPath_Tree // Watch a directory and all its children recursively.
+};
+
+// Type of the warning for the events notifying about them.
+enum wxFSWWarningType
+{
+ wxFSW_WARNING_NONE,
+ wxFSW_WARNING_GENERAL,
+ wxFSW_WARNING_OVERFLOW
+};
+
+/**
+ * Event containing information about file system change.
+ */
+class WXDLLIMPEXP_FWD_BASE wxFileSystemWatcherEvent;
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_FSWATCHER,
+ wxFileSystemWatcherEvent);
+
+class WXDLLIMPEXP_BASE wxFileSystemWatcherEvent: public wxEvent
+{
+public:
+ // Constructor for any kind of events, also used as default ctor.
+ wxFileSystemWatcherEvent(int changeType = 0, int watchid = wxID_ANY) :
+ wxEvent(watchid, wxEVT_FSWATCHER),
+ m_changeType(changeType),
+ m_warningType(wxFSW_WARNING_NONE)
+ {
+ }
+
+ // Constructor for the error or warning events.
+ wxFileSystemWatcherEvent(int changeType,
+ wxFSWWarningType warningType,
+ const wxString& errorMsg = wxString(),
+ int watchid = wxID_ANY) :
+ wxEvent(watchid, wxEVT_FSWATCHER),
+ m_changeType(changeType),
+ m_warningType(warningType),
+ m_errorMsg(errorMsg)
+ {
+ }
+
+ // Constructor for the normal events carrying information about the changes.
+ wxFileSystemWatcherEvent(int changeType,
+ const wxFileName& path, const wxFileName& newPath,
+ int watchid = wxID_ANY) :
+ wxEvent(watchid, wxEVT_FSWATCHER),
+ m_changeType(changeType),
+ m_warningType(wxFSW_WARNING_NONE),
+ m_path(path),
+ m_newPath(newPath)
+
+ {
+ }
+
+ /**
+ * Returns the path at which the event occurred.
+ */
+ const wxFileName& GetPath() const
+ {
+ return m_path;
+ }
+
+ /**
+ * Sets the path at which the event occurred
+ */
+ void SetPath(const wxFileName& path)
+ {
+ m_path = path;
+ }
+
+ /**
+ * In case of rename(move?) events, returns the new path related to the
+ * event. The "new" means newer in the sense of time. In case of other
+ * events it returns the same path as GetPath().
+ */
+ const wxFileName& GetNewPath() const
+ {
+ return m_newPath;
+ }
+
+ /**
+ * Sets the new path related to the event. See above.
+ */
+ void SetNewPath(const wxFileName& path)
+ {
+ m_newPath = path;
+ }
+
+ /**
+ * Returns the type of file system event that occurred.
+ */
+ int GetChangeType() const
+ {
+ return m_changeType;
+ }
+
+ virtual wxEvent* Clone() const
+ {
+ wxFileSystemWatcherEvent* evt = new wxFileSystemWatcherEvent(*this);
+ evt->m_errorMsg = m_errorMsg.Clone();
+ evt->m_path = wxFileName(m_path.GetFullPath().Clone());
+ evt->m_newPath = wxFileName(m_newPath.GetFullPath().Clone());
+ evt->m_warningType = m_warningType;
+ return evt;
+ }
+
+ virtual wxEventCategory GetEventCategory() const
+ {
+ // TODO this has to be merged with "similar" categories and changed
+ return wxEVT_CATEGORY_UNKNOWN;
+ }
+
+ /**
+ * Returns if this error is an error event
+ */
+ bool IsError() const
+ {
+ return (m_changeType & (wxFSW_EVENT_ERROR | wxFSW_EVENT_WARNING)) != 0;
+ }
+
+ wxString GetErrorDescription() const
+ {
+ return m_errorMsg;
+ }
+
+ wxFSWWarningType GetWarningType() const
+ {
+ return m_warningType;
+ }
+
+ /**
+ * Returns a wxString describing an event useful for debugging or testing
+ */
+ wxString ToString() const;
+
+protected:
+ int m_changeType;
+ wxFSWWarningType m_warningType;
+ wxFileName m_path;
+ wxFileName m_newPath;
+ wxString m_errorMsg;
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFileSystemWatcherEvent)
+};
+
+typedef void (wxEvtHandler::*wxFileSystemWatcherEventFunction)
+ (wxFileSystemWatcherEvent&);
+
+#define wxFileSystemWatcherEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxFileSystemWatcherEventFunction, func)
+
+#define EVT_FSWATCHER(winid, func) \
+ wx__DECLARE_EVT1(wxEVT_FSWATCHER, winid, wxFileSystemWatcherEventHandler(func))
+
+// ----------------------------------------------------------------------------
+// wxFileSystemWatcherBase: interface for wxFileSystemWatcher
+// ----------------------------------------------------------------------------
+
+// Simple container to store information about one watched path.
+class wxFSWatchInfo
+{
+public:
+ wxFSWatchInfo() :
+ m_events(-1), m_type(wxFSWPath_None), m_refcount(-1)
+ {
+ }
+
+ wxFSWatchInfo(const wxString& path,
+ int events,
+ wxFSWPathType type,
+ const wxString& filespec = wxString()) :
+ m_path(path), m_filespec(filespec), m_events(events), m_type(type),
+ m_refcount(1)
+ {
+ }
+
+ const wxString& GetPath() const
+ {
+ return m_path;
+ }
+
+ const wxString& GetFilespec() const { return m_filespec; }
+
+ int GetFlags() const
+ {
+ return m_events;
+ }
+
+ wxFSWPathType GetType() const
+ {
+ return m_type;
+ }
+
+ // Reference counting of watch entries is used to avoid watching the same
+ // file system path multiple times (this can happen even accidentally, e.g.
+ // when you have a recursive watch and then decide to watch some file or
+ // directory under it separately).
+ int IncRef()
+ {
+ return ++m_refcount;
+ }
+
+ int DecRef()
+ {
+ wxASSERT_MSG( m_refcount > 0, wxS("Trying to decrement a zero count") );
+ return --m_refcount;
+ }
+
+protected:
+ wxString m_path;
+ wxString m_filespec; // For tree watches, holds any filespec to apply
+ int m_events;
+ wxFSWPathType m_type;
+ int m_refcount;
+};
+
+WX_DECLARE_STRING_HASH_MAP(wxFSWatchInfo, wxFSWatchInfoMap);
+
+/**
+ * Encapsulation of platform-specific file system event mechanism
+ */
+class wxFSWatcherImpl;
+
+/**
+ * Main entry point for clients interested in file system events.
+ * Defines interface that can be used to receive that kind of events.
+ */
+class WXDLLIMPEXP_BASE wxFileSystemWatcherBase: public wxEvtHandler
+{
+public:
+ wxFileSystemWatcherBase();
+
+ virtual ~wxFileSystemWatcherBase();
+
+ /**
+ * Adds path to currently watched files. Any events concerning this
+ * particular path will be sent to handler. Optionally a filter can be
+ * specified to receive only events of particular type.
+ *
+ * Please note that when adding a dir, immediate children will be watched
+ * as well.
+ */
+ virtual bool Add(const wxFileName& path, int events = wxFSW_EVENT_ALL);
+
+ /**
+ * Like above, but recursively adds every file/dir in the tree rooted in
+ * path. Additionally a file mask can be specified to include only files
+ * of particular type.
+ */
+ virtual bool AddTree(const wxFileName& path, int events = wxFSW_EVENT_ALL,
+ const wxString& filespec = wxEmptyString);
+
+ /**
+ * Removes path from the list of watched paths.
+ */
+ virtual bool Remove(const wxFileName& path);
+
+ /**
+ * Same as above, but also removes every file belonging to the tree rooted
+ * at path.
+ */
+ virtual bool RemoveTree(const wxFileName& path);
+
+ /**
+ * Clears the list of currently watched paths.
+ */
+ virtual bool RemoveAll();
+
+ /**
+ * Returns the number of watched paths
+ */
+ int GetWatchedPathsCount() const;
+
+ /**
+ * Retrevies all watched paths and places them in wxArrayString. Returns
+ * the number of paths.
+ *
+ * TODO think about API here: we need to return more information (like is
+ * the path watched recursively)
+ */
+ int GetWatchedPaths(wxArrayString* paths) const;
+
+ wxEvtHandler* GetOwner() const
+ {
+ return m_owner;
+ }
+
+ void SetOwner(wxEvtHandler* handler)
+ {
+ if (!handler)
+ m_owner = this;
+ else
+ m_owner = handler;
+ }
+
+
+ // This is a semi-private function used by wxWidgets itself only.
+ //
+ // Delegates the real work of adding the path to wxFSWatcherImpl::Add() and
+ // updates m_watches if the new path was successfully added.
+ bool AddAny(const wxFileName& path, int events, wxFSWPathType type,
+ const wxString& filespec = wxString());
+
+protected:
+
+ static wxString GetCanonicalPath(const wxFileName& path)
+ {
+ wxFileName path_copy = wxFileName(path);
+ if ( !path_copy.Normalize() )
+ {
+ wxFAIL_MSG(wxString::Format("Unable to normalize path '%s'",
+ path.GetFullPath()));
+ return wxEmptyString;
+ }
+
+ return path_copy.GetFullPath();
+ }
+
+
+ wxFSWatchInfoMap m_watches; // path=>wxFSWatchInfo map
+ wxFSWatcherImpl* m_service; // file system events service
+ wxEvtHandler* m_owner; // handler for file system events
+
+ friend class wxFSWatcherImpl;
+};
+
+// include the platform specific file defining wxFileSystemWatcher
+// inheriting from wxFileSystemWatcherBase
+
+#ifdef wxHAS_INOTIFY
+ #include "wx/unix/fswatcher_inotify.h"
+ #define wxFileSystemWatcher wxInotifyFileSystemWatcher
+#elif defined(wxHAS_KQUEUE)
+ #include "wx/unix/fswatcher_kqueue.h"
+ #define wxFileSystemWatcher wxKqueueFileSystemWatcher
+#elif defined(__WINDOWS__)
+ #include "wx/msw/fswatcher.h"
+ #define wxFileSystemWatcher wxMSWFileSystemWatcher
+#else
+ #include "wx/generic/fswatcher.h"
+ #define wxFileSystemWatcher wxPollingFileSystemWatcher
+#endif
+
+#endif // wxUSE_FSWATCHER
+
+#endif /* _WX_FSWATCHER_BASE_H_ */
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gauge.h
+// Purpose: wxGauge interface
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 20.02.01
+// Copyright: (c) 1996-2001 wxWidgets team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GAUGE_H_BASE_
+#define _WX_GAUGE_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_GAUGE
+
+#include "wx/control.h"
+
+// ----------------------------------------------------------------------------
+// wxGauge style flags
+// ----------------------------------------------------------------------------
+
+#define wxGA_HORIZONTAL wxHORIZONTAL
+#define wxGA_VERTICAL wxVERTICAL
+
+// Win32 only, is default (and only) on some other platforms
+#define wxGA_SMOOTH 0x0020
+
+#if WXWIN_COMPATIBILITY_2_6
+ // obsolete style
+ #define wxGA_PROGRESSBAR 0
+#endif // WXWIN_COMPATIBILITY_2_6
+
+// GTK and Mac always have native implementation of the indeterminate mode
+// wxMSW has native implementation only if comctl32.dll >= 6.00
+#if !defined(__WXGTK20__) && !defined(__WXMAC__) && !defined(__WXCOCOA__)
+ #define wxGAUGE_EMULATE_INDETERMINATE_MODE 1
+#else
+ #define wxGAUGE_EMULATE_INDETERMINATE_MODE 0
+#endif
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxGaugeNameStr[];
+
+// ----------------------------------------------------------------------------
+// wxGauge: a progress bar
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxGaugeBase : public wxControl
+{
+public:
+ wxGaugeBase() { m_rangeMax = m_gaugePos = 0; }
+ virtual ~wxGaugeBase();
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ int range,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxGA_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxGaugeNameStr);
+
+ // determinate mode API
+
+ // set/get the control range
+ virtual void SetRange(int range);
+ virtual int GetRange() const;
+
+ virtual void SetValue(int pos);
+ virtual int GetValue() const;
+
+ // indeterminate mode API
+ virtual void Pulse();
+
+ // simple accessors
+ bool IsVertical() const { return HasFlag(wxGA_VERTICAL); }
+
+ // appearance params (not implemented for most ports)
+ virtual void SetShadowWidth(int w);
+ virtual int GetShadowWidth() const;
+
+ virtual void SetBezelFace(int w);
+ virtual int GetBezelFace() const;
+
+ // overridden base class virtuals
+ virtual bool AcceptsFocus() const { return false; }
+
+protected:
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ // the max position
+ int m_rangeMax;
+
+ // the current position
+ int m_gaugePos;
+
+#if wxGAUGE_EMULATE_INDETERMINATE_MODE
+ int m_nDirection; // can be wxRIGHT or wxLEFT
+#endif
+
+ wxDECLARE_NO_COPY_CLASS(wxGaugeBase);
+};
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/gauge.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/gauge.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/gauge.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/gauge.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/gauge.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/gauge.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/gauge.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/gauge.h"
+#endif
+
+#endif // wxUSE_GAUGE
+
+#endif
+ // _WX_GAUGE_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gbsizer.h
+// Purpose: wxGridBagSizer: A sizer that can lay out items in a grid,
+// with items at specified cells, and with the option of row
+// and/or column spanning
+//
+// Author: Robin Dunn
+// Created: 03-Nov-2003
+// Copyright: (c) Robin Dunn
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __WXGBSIZER_H__
+#define __WXGBSIZER_H__
+
+#include "wx/sizer.h"
+
+
+//---------------------------------------------------------------------------
+// Classes to represent a position in the grid and a size of an item in the
+// grid, IOW, the number of rows and columns it occupies. I chose to use these
+// instead of wxPoint and wxSize because they are (x,y) and usually pixel
+// oriented while grids and tables are usually thought of as (row,col) so some
+// confusion would definitely result in using wxPoint...
+//
+// NOTE: This should probably be refactored to a common RowCol data type which
+// is used for this and also for wxGridCellCoords.
+//---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxGBPosition
+{
+public:
+ wxGBPosition() : m_row(0), m_col(0) {}
+ wxGBPosition(int row, int col) : m_row(row), m_col(col) {}
+
+ // default copy ctor and assignment operator are okay.
+
+ int GetRow() const { return m_row; }
+ int GetCol() const { return m_col; }
+ void SetRow(int row) { m_row = row; }
+ void SetCol(int col) { m_col = col; }
+
+ bool operator==(const wxGBPosition& p) const { return m_row == p.m_row && m_col == p.m_col; }
+ bool operator!=(const wxGBPosition& p) const { return !(*this == p); }
+
+private:
+ int m_row;
+ int m_col;
+};
+
+
+class WXDLLIMPEXP_CORE wxGBSpan
+{
+public:
+ wxGBSpan() { Init(); }
+ wxGBSpan(int rowspan, int colspan)
+ {
+ // Initialize the members to valid values as not doing it may result in
+ // infinite loop in wxGBSizer code if the user passed 0 for any of
+ // them, see #12934.
+ Init();
+
+ SetRowspan(rowspan);
+ SetColspan(colspan);
+ }
+
+ // default copy ctor and assignment operator are okay.
+
+ // Factor constructor creating an invalid wxGBSpan: this is mostly supposed
+ // to be used as return value for functions returning wxGBSpan in case of
+ // errors.
+ static wxGBSpan Invalid()
+ {
+ return wxGBSpan(NULL);
+ }
+
+ int GetRowspan() const { return m_rowspan; }
+ int GetColspan() const { return m_colspan; }
+ void SetRowspan(int rowspan)
+ {
+ wxCHECK_RET( rowspan > 0, "Row span should be strictly positive" );
+
+ m_rowspan = rowspan;
+ }
+
+ void SetColspan(int colspan)
+ {
+ wxCHECK_RET( colspan > 0, "Column span should be strictly positive" );
+
+ m_colspan = colspan;
+ }
+
+ bool operator==(const wxGBSpan& o) const { return m_rowspan == o.m_rowspan && m_colspan == o.m_colspan; }
+ bool operator!=(const wxGBSpan& o) const { return !(*this == o); }
+
+private:
+ // This private ctor is used by Invalid() only.
+ wxGBSpan(struct InvalidCtorTag*)
+ {
+ m_rowspan =
+ m_colspan = -1;
+ }
+
+ void Init()
+ {
+ m_rowspan =
+ m_colspan = 1;
+ }
+
+ int m_rowspan;
+ int m_colspan;
+};
+
+
+extern WXDLLIMPEXP_DATA_CORE(const wxGBSpan) wxDefaultSpan;
+
+
+//---------------------------------------------------------------------------
+// wxGBSizerItem
+//---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxGridBagSizer;
+
+
+class WXDLLIMPEXP_CORE wxGBSizerItem : public wxSizerItem
+{
+public:
+ // spacer
+ wxGBSizerItem( int width,
+ int height,
+ const wxGBPosition& pos,
+ const wxGBSpan& span=wxDefaultSpan,
+ int flag=0,
+ int border=0,
+ wxObject* userData=NULL);
+
+ // window
+ wxGBSizerItem( wxWindow *window,
+ const wxGBPosition& pos,
+ const wxGBSpan& span=wxDefaultSpan,
+ int flag=0,
+ int border=0,
+ wxObject* userData=NULL );
+
+ // subsizer
+ wxGBSizerItem( wxSizer *sizer,
+ const wxGBPosition& pos,
+ const wxGBSpan& span=wxDefaultSpan,
+ int flag=0,
+ int border=0,
+ wxObject* userData=NULL );
+
+ // default ctor
+ wxGBSizerItem();
+
+
+ // Get the grid position of the item
+ wxGBPosition GetPos() const { return m_pos; }
+ void GetPos(int& row, int& col) const;
+
+ // Get the row and column spanning of the item
+ wxGBSpan GetSpan() const { return m_span; }
+ void GetSpan(int& rowspan, int& colspan) const;
+
+ // If the item is already a member of a sizer then first ensure that there
+ // is no other item that would intersect with this one at the new
+ // position, then set the new position. Returns true if the change is
+ // successful and after the next Layout the item will be moved.
+ bool SetPos( const wxGBPosition& pos );
+
+ // If the item is already a member of a sizer then first ensure that there
+ // is no other item that would intersect with this one with its new
+ // spanning size, then set the new spanning. Returns true if the change
+ // is successful and after the next Layout the item will be resized.
+ bool SetSpan( const wxGBSpan& span );
+
+ // Returns true if this item and the other item intersect
+ bool Intersects(const wxGBSizerItem& other);
+
+ // Returns true if the given pos/span would intersect with this item.
+ bool Intersects(const wxGBPosition& pos, const wxGBSpan& span);
+
+ // Get the row and column of the endpoint of this item
+ void GetEndPos(int& row, int& col);
+
+
+ wxGridBagSizer* GetGBSizer() const { return m_gbsizer; }
+ void SetGBSizer(wxGridBagSizer* sizer) { m_gbsizer = sizer; }
+
+
+protected:
+ wxGBPosition m_pos;
+ wxGBSpan m_span;
+ wxGridBagSizer* m_gbsizer; // so SetPos/SetSpan can check for intersects
+
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxGBSizerItem)
+ wxDECLARE_NO_COPY_CLASS(wxGBSizerItem);
+};
+
+
+//---------------------------------------------------------------------------
+// wxGridBagSizer
+//---------------------------------------------------------------------------
+
+
+class WXDLLIMPEXP_CORE wxGridBagSizer : public wxFlexGridSizer
+{
+public:
+ wxGridBagSizer(int vgap = 0, int hgap = 0 );
+
+ // The Add methods return true if the item was successfully placed at the
+ // given position, false if something was already there.
+ wxSizerItem* Add( wxWindow *window,
+ const wxGBPosition& pos,
+ const wxGBSpan& span = wxDefaultSpan,
+ int flag = 0,
+ int border = 0,
+ wxObject* userData = NULL );
+ wxSizerItem* Add( wxSizer *sizer,
+ const wxGBPosition& pos,
+ const wxGBSpan& span = wxDefaultSpan,
+ int flag = 0,
+ int border = 0,
+ wxObject* userData = NULL );
+ wxSizerItem* Add( int width,
+ int height,
+ const wxGBPosition& pos,
+ const wxGBSpan& span = wxDefaultSpan,
+ int flag = 0,
+ int border = 0,
+ wxObject* userData = NULL );
+ wxSizerItem* Add( wxGBSizerItem *item );
+
+
+ // Get/Set the size used for cells in the grid with no item.
+ wxSize GetEmptyCellSize() const { return m_emptyCellSize; }
+ void SetEmptyCellSize(const wxSize& sz) { m_emptyCellSize = sz; }
+
+ // Get the size of the specified cell, including hgap and vgap. Only
+ // valid after a Layout.
+ wxSize GetCellSize(int row, int col) const;
+
+ // Get the grid position of the specified item (non-recursive)
+ wxGBPosition GetItemPosition(wxWindow *window);
+ wxGBPosition GetItemPosition(wxSizer *sizer);
+ wxGBPosition GetItemPosition(size_t index);
+
+ // Set the grid position of the specified item. Returns true on success.
+ // If the move is not allowed (because an item is already there) then
+ // false is returned. (non-recursive)
+ bool SetItemPosition(wxWindow *window, const wxGBPosition& pos);
+ bool SetItemPosition(wxSizer *sizer, const wxGBPosition& pos);
+ bool SetItemPosition(size_t index, const wxGBPosition& pos);
+
+ // Get the row/col spanning of the specified item (non-recursive)
+ wxGBSpan GetItemSpan(wxWindow *window);
+ wxGBSpan GetItemSpan(wxSizer *sizer);
+ wxGBSpan GetItemSpan(size_t index);
+
+ // Set the row/col spanning of the specified item. Returns true on
+ // success. If the move is not allowed (because an item is already there)
+ // then false is returned. (non-recursive)
+ bool SetItemSpan(wxWindow *window, const wxGBSpan& span);
+ bool SetItemSpan(wxSizer *sizer, const wxGBSpan& span);
+ bool SetItemSpan(size_t index, const wxGBSpan& span);
+
+
+ // Find the sizer item for the given window or subsizer, returns NULL if
+ // not found. (non-recursive)
+ wxGBSizerItem* FindItem(wxWindow* window);
+ wxGBSizerItem* FindItem(wxSizer* sizer);
+
+
+ // Return the sizer item for the given grid cell, or NULL if there is no
+ // item at that position. (non-recursive)
+ wxGBSizerItem* FindItemAtPosition(const wxGBPosition& pos);
+
+
+ // Return the sizer item located at the point given in pt, or NULL if
+ // there is no item at that point. The (x,y) coordinates in pt correspond
+ // to the client coordinates of the window using the sizer for
+ // layout. (non-recursive)
+ wxGBSizerItem* FindItemAtPoint(const wxPoint& pt);
+
+
+ // Return the sizer item that has a matching user data (it only compares
+ // pointer values) or NULL if not found. (non-recursive)
+ wxGBSizerItem* FindItemWithData(const wxObject* userData);
+
+
+ // These are what make the sizer do size calculations and layout
+ virtual void RecalcSizes();
+ virtual wxSize CalcMin();
+
+
+ // Look at all items and see if any intersect (or would overlap) the given
+ // item. Returns true if so, false if there would be no overlap. If an
+ // excludeItem is given then it will not be checked for intersection, for
+ // example it may be the item we are checking the position of.
+ bool CheckForIntersection(wxGBSizerItem* item, wxGBSizerItem* excludeItem = NULL);
+ bool CheckForIntersection(const wxGBPosition& pos, const wxGBSpan& span, wxGBSizerItem* excludeItem = NULL);
+
+
+ // The Add base class virtuals should not be used with this class, but
+ // we'll try to make them automatically select a location for the item
+ // anyway.
+ virtual wxSizerItem* Add( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
+ virtual wxSizerItem* Add( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
+ virtual wxSizerItem* Add( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
+
+ // The Insert and Prepend base class virtuals that are not appropriate for
+ // this class and should not be used. Their implementation in this class
+ // simply fails.
+ virtual wxSizerItem* Add( wxSizerItem *item );
+ virtual wxSizerItem* Insert( size_t index, wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
+ virtual wxSizerItem* Insert( size_t index, wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
+ virtual wxSizerItem* Insert( size_t index, int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
+ virtual wxSizerItem* Insert( size_t index, wxSizerItem *item );
+ virtual wxSizerItem* Prepend( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
+ virtual wxSizerItem* Prepend( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
+ virtual wxSizerItem* Prepend( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
+ virtual wxSizerItem* Prepend( wxSizerItem *item );
+
+
+protected:
+ wxGBPosition FindEmptyCell();
+ void AdjustForOverflow();
+
+ wxSize m_emptyCellSize;
+
+
+private:
+
+ DECLARE_CLASS(wxGridBagSizer)
+ wxDECLARE_NO_COPY_CLASS(wxGridBagSizer);
+};
+
+//---------------------------------------------------------------------------
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gdicmn.h
+// Purpose: Common GDI classes, types and declarations
+// Author: Julian Smart
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GDICMNH__
+#define _WX_GDICMNH__
+
+// ---------------------------------------------------------------------------
+// headers
+// ---------------------------------------------------------------------------
+
+#include "wx/defs.h"
+#include "wx/list.h"
+#include "wx/string.h"
+#include "wx/fontenc.h"
+#include "wx/hashmap.h"
+#include "wx/math.h"
+
+// ---------------------------------------------------------------------------
+// forward declarations
+// ---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxBitmap;
+class WXDLLIMPEXP_FWD_CORE wxBrush;
+class WXDLLIMPEXP_FWD_CORE wxColour;
+class WXDLLIMPEXP_FWD_CORE wxCursor;
+class WXDLLIMPEXP_FWD_CORE wxFont;
+class WXDLLIMPEXP_FWD_CORE wxIcon;
+class WXDLLIMPEXP_FWD_CORE wxPalette;
+class WXDLLIMPEXP_FWD_CORE wxPen;
+class WXDLLIMPEXP_FWD_CORE wxRegion;
+class WXDLLIMPEXP_FWD_BASE wxString;
+class WXDLLIMPEXP_FWD_CORE wxIconBundle;
+class WXDLLIMPEXP_FWD_CORE wxPoint;
+
+// ---------------------------------------------------------------------------
+// constants
+// ---------------------------------------------------------------------------
+
+// Bitmap flags
+enum wxBitmapType
+{
+ wxBITMAP_TYPE_INVALID, // should be == 0 for compatibility!
+ wxBITMAP_TYPE_BMP,
+ wxBITMAP_TYPE_BMP_RESOURCE,
+ wxBITMAP_TYPE_RESOURCE = wxBITMAP_TYPE_BMP_RESOURCE,
+ wxBITMAP_TYPE_ICO,
+ wxBITMAP_TYPE_ICO_RESOURCE,
+ wxBITMAP_TYPE_CUR,
+ wxBITMAP_TYPE_CUR_RESOURCE,
+ wxBITMAP_TYPE_XBM,
+ wxBITMAP_TYPE_XBM_DATA,
+ wxBITMAP_TYPE_XPM,
+ wxBITMAP_TYPE_XPM_DATA,
+ wxBITMAP_TYPE_TIFF,
+ wxBITMAP_TYPE_TIF = wxBITMAP_TYPE_TIFF,
+ wxBITMAP_TYPE_TIFF_RESOURCE,
+ wxBITMAP_TYPE_TIF_RESOURCE = wxBITMAP_TYPE_TIFF_RESOURCE,
+ wxBITMAP_TYPE_GIF,
+ wxBITMAP_TYPE_GIF_RESOURCE,
+ wxBITMAP_TYPE_PNG,
+ wxBITMAP_TYPE_PNG_RESOURCE,
+ wxBITMAP_TYPE_JPEG,
+ wxBITMAP_TYPE_JPEG_RESOURCE,
+ wxBITMAP_TYPE_PNM,
+ wxBITMAP_TYPE_PNM_RESOURCE,
+ wxBITMAP_TYPE_PCX,
+ wxBITMAP_TYPE_PCX_RESOURCE,
+ wxBITMAP_TYPE_PICT,
+ wxBITMAP_TYPE_PICT_RESOURCE,
+ wxBITMAP_TYPE_ICON,
+ wxBITMAP_TYPE_ICON_RESOURCE,
+ wxBITMAP_TYPE_ANI,
+ wxBITMAP_TYPE_IFF,
+ wxBITMAP_TYPE_TGA,
+ wxBITMAP_TYPE_MACCURSOR,
+ wxBITMAP_TYPE_MACCURSOR_RESOURCE,
+
+ wxBITMAP_TYPE_MAX,
+ wxBITMAP_TYPE_ANY = 50
+};
+
+// Polygon filling mode
+enum wxPolygonFillMode
+{
+ wxODDEVEN_RULE = 1,
+ wxWINDING_RULE
+};
+
+// Standard cursors
+enum wxStockCursor
+{
+ wxCURSOR_NONE, // should be 0
+ wxCURSOR_ARROW,
+ wxCURSOR_RIGHT_ARROW,
+ wxCURSOR_BULLSEYE,
+ wxCURSOR_CHAR,
+ wxCURSOR_CROSS,
+ wxCURSOR_HAND,
+ wxCURSOR_IBEAM,
+ wxCURSOR_LEFT_BUTTON,
+ wxCURSOR_MAGNIFIER,
+ wxCURSOR_MIDDLE_BUTTON,
+ wxCURSOR_NO_ENTRY,
+ wxCURSOR_PAINT_BRUSH,
+ wxCURSOR_PENCIL,
+ wxCURSOR_POINT_LEFT,
+ wxCURSOR_POINT_RIGHT,
+ wxCURSOR_QUESTION_ARROW,
+ wxCURSOR_RIGHT_BUTTON,
+ wxCURSOR_SIZENESW,
+ wxCURSOR_SIZENS,
+ wxCURSOR_SIZENWSE,
+ wxCURSOR_SIZEWE,
+ wxCURSOR_SIZING,
+ wxCURSOR_SPRAYCAN,
+ wxCURSOR_WAIT,
+ wxCURSOR_WATCH,
+ wxCURSOR_BLANK,
+#ifdef __WXGTK__
+ wxCURSOR_DEFAULT, // standard X11 cursor
+#endif
+#ifdef __WXMAC__
+ wxCURSOR_COPY_ARROW , // MacOS Theme Plus arrow
+#endif
+#ifdef __X__
+ // Not yet implemented for Windows
+ wxCURSOR_CROSS_REVERSE,
+ wxCURSOR_DOUBLE_ARROW,
+ wxCURSOR_BASED_ARROW_UP,
+ wxCURSOR_BASED_ARROW_DOWN,
+#endif // X11
+ wxCURSOR_ARROWWAIT,
+#ifdef __WXMAC__
+ wxCURSOR_OPEN_HAND,
+ wxCURSOR_CLOSED_HAND,
+#endif
+
+ wxCURSOR_MAX
+};
+
+#ifndef __WXGTK__
+ #define wxCURSOR_DEFAULT wxCURSOR_ARROW
+#endif
+
+#ifndef __WXMAC__
+ // TODO CS supply openhand and closedhand cursors
+ #define wxCURSOR_OPEN_HAND wxCURSOR_HAND
+ #define wxCURSOR_CLOSED_HAND wxCURSOR_HAND
+#endif
+
+// ---------------------------------------------------------------------------
+// macros
+// ---------------------------------------------------------------------------
+
+#if defined(__WINDOWS__) || defined(__WXPM__)
+ #define wxHAS_IMAGES_IN_RESOURCES
+#endif
+
+/* Useful macro for creating icons portably, for example:
+
+ wxIcon *icon = new wxICON(sample);
+
+ expands into:
+
+ wxIcon *icon = new wxIcon("sample"); // On Windows
+ wxIcon *icon = new wxIcon(sample_xpm); // On wxGTK/Linux
+ */
+
+#ifdef __WINDOWS__
+ // Load from a resource
+ #define wxICON(X) wxIcon(wxT(#X))
+#elif defined(__WXPM__)
+ // Load from a resource
+ #define wxICON(X) wxIcon(wxT(#X))
+#elif defined(__WXDFB__)
+ // Initialize from an included XPM
+ #define wxICON(X) wxIcon( X##_xpm )
+#elif defined(__WXGTK__)
+ // Initialize from an included XPM
+ #define wxICON(X) wxIcon( X##_xpm )
+#elif defined(__WXMAC__)
+ // Initialize from an included XPM
+ #define wxICON(X) wxIcon( X##_xpm )
+#elif defined(__WXMOTIF__)
+ // Initialize from an included XPM
+ #define wxICON(X) wxIcon( X##_xpm )
+#elif defined(__WXX11__)
+ // Initialize from an included XPM
+ #define wxICON(X) wxIcon( X##_xpm )
+#else
+ // This will usually mean something on any platform
+ #define wxICON(X) wxIcon(wxT(#X))
+#endif // platform
+
+/* Another macro: this one is for portable creation of bitmaps. We assume that
+ under Unix bitmaps live in XPMs and under Windows they're in ressources.
+ */
+
+#if defined(__WINDOWS__) || defined(__WXPM__)
+ #define wxBITMAP(name) wxBitmap(wxT(#name), wxBITMAP_TYPE_BMP_RESOURCE)
+#elif defined(__WXGTK__) || \
+ defined(__WXMOTIF__) || \
+ defined(__WXX11__) || \
+ defined(__WXMAC__) || \
+ defined(__WXDFB__) || \
+ defined(__WXCOCOA__)
+ // Initialize from an included XPM
+ #define wxBITMAP(name) wxBitmap(name##_xpm)
+#else // other platforms
+ #define wxBITMAP(name) wxBitmap(name##_xpm, wxBITMAP_TYPE_XPM)
+#endif // platform
+
+// Macro for creating wxBitmap from in-memory PNG data.
+//
+// It reads PNG data from name_png static byte arrays that can be created using
+// e.g. misc/scripts/png2c.py.
+//
+// This macro exists mostly as a helper for wxBITMAP_PNG() below but also
+// because it's slightly more convenient to use than NewFromPNGData() directly.
+#define wxBITMAP_PNG_FROM_DATA(name) \
+ wxBitmap::NewFromPNGData(name##_png, WXSIZEOF(name##_png))
+
+// Similar to wxBITMAP but used for the bitmaps in PNG format.
+//
+// Under Windows they should be embedded into the resource file using RT_RCDATA
+// resource type and under OS X the PNG file with the specified name must be
+// available in the resource subdirectory of the bundle. Elsewhere, this is
+// exactly the same thing as wxBITMAP_PNG_FROM_DATA() described above.
+#if defined(__WINDOWS__) || defined(__WXOSX__)
+ #define wxBITMAP_PNG(name) wxBitmap(wxS(#name), wxBITMAP_TYPE_PNG_RESOURCE)
+#else
+ #define wxBITMAP_PNG(name) wxBITMAP_PNG_FROM_DATA(name)
+#endif
+
+// ===========================================================================
+// classes
+// ===========================================================================
+
+// ---------------------------------------------------------------------------
+// wxSize
+// ---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSize
+{
+public:
+ // members are public for compatibility, don't use them directly.
+ int x, y;
+
+ // constructors
+ wxSize() : x(0), y(0) { }
+ wxSize(int xx, int yy) : x(xx), y(yy) { }
+
+ // no copy ctor or assignment operator - the defaults are ok
+
+ wxSize& operator+=(const wxSize& sz) { x += sz.x; y += sz.y; return *this; }
+ wxSize& operator-=(const wxSize& sz) { x -= sz.x; y -= sz.y; return *this; }
+ wxSize& operator/=(int i) { x /= i; y /= i; return *this; }
+ wxSize& operator*=(int i) { x *= i; y *= i; return *this; }
+ wxSize& operator/=(unsigned int i) { x /= i; y /= i; return *this; }
+ wxSize& operator*=(unsigned int i) { x *= i; y *= i; return *this; }
+ wxSize& operator/=(long i) { x /= i; y /= i; return *this; }
+ wxSize& operator*=(long i) { x *= i; y *= i; return *this; }
+ wxSize& operator/=(unsigned long i) { x /= i; y /= i; return *this; }
+ wxSize& operator*=(unsigned long i) { x *= i; y *= i; return *this; }
+ wxSize& operator/=(double i) { x = int(x/i); y = int(y/i); return *this; }
+ wxSize& operator*=(double i) { x = int(x*i); y = int(y*i); return *this; }
+
+ void IncTo(const wxSize& sz)
+ { if ( sz.x > x ) x = sz.x; if ( sz.y > y ) y = sz.y; }
+ void DecTo(const wxSize& sz)
+ { if ( sz.x < x ) x = sz.x; if ( sz.y < y ) y = sz.y; }
+ void DecToIfSpecified(const wxSize& sz)
+ {
+ if ( sz.x != wxDefaultCoord && sz.x < x )
+ x = sz.x;
+ if ( sz.y != wxDefaultCoord && sz.y < y )
+ y = sz.y;
+ }
+
+ void IncBy(int dx, int dy) { x += dx; y += dy; }
+ void IncBy(const wxPoint& pt);
+ void IncBy(const wxSize& sz) { IncBy(sz.x, sz.y); }
+ void IncBy(int d) { IncBy(d, d); }
+
+ void DecBy(int dx, int dy) { IncBy(-dx, -dy); }
+ void DecBy(const wxPoint& pt);
+ void DecBy(const wxSize& sz) { DecBy(sz.x, sz.y); }
+ void DecBy(int d) { DecBy(d, d); }
+
+
+ wxSize& Scale(float xscale, float yscale)
+ { x = (int)(x*xscale); y = (int)(y*yscale); return *this; }
+
+ // accessors
+ void Set(int xx, int yy) { x = xx; y = yy; }
+ void SetWidth(int w) { x = w; }
+ void SetHeight(int h) { y = h; }
+
+ int GetWidth() const { return x; }
+ int GetHeight() const { return y; }
+
+ bool IsFullySpecified() const { return x != wxDefaultCoord && y != wxDefaultCoord; }
+
+ // combine this size with the other one replacing the default (i.e. equal
+ // to wxDefaultCoord) components of this object with those of the other
+ void SetDefaults(const wxSize& size)
+ {
+ if ( x == wxDefaultCoord )
+ x = size.x;
+ if ( y == wxDefaultCoord )
+ y = size.y;
+ }
+
+ // compatibility
+ int GetX() const { return x; }
+ int GetY() const { return y; }
+};
+
+inline bool operator==(const wxSize& s1, const wxSize& s2)
+{
+ return s1.x == s2.x && s1.y == s2.y;
+}
+
+inline bool operator!=(const wxSize& s1, const wxSize& s2)
+{
+ return s1.x != s2.x || s1.y != s2.y;
+}
+
+inline wxSize operator+(const wxSize& s1, const wxSize& s2)
+{
+ return wxSize(s1.x + s2.x, s1.y + s2.y);
+}
+
+inline wxSize operator-(const wxSize& s1, const wxSize& s2)
+{
+ return wxSize(s1.x - s2.x, s1.y - s2.y);
+}
+
+inline wxSize operator/(const wxSize& s, int i)
+{
+ return wxSize(s.x / i, s.y / i);
+}
+
+inline wxSize operator*(const wxSize& s, int i)
+{
+ return wxSize(s.x * i, s.y * i);
+}
+
+inline wxSize operator*(int i, const wxSize& s)
+{
+ return wxSize(s.x * i, s.y * i);
+}
+
+inline wxSize operator/(const wxSize& s, unsigned int i)
+{
+ return wxSize(s.x / i, s.y / i);
+}
+
+inline wxSize operator*(const wxSize& s, unsigned int i)
+{
+ return wxSize(s.x * i, s.y * i);
+}
+
+inline wxSize operator*(unsigned int i, const wxSize& s)
+{
+ return wxSize(s.x * i, s.y * i);
+}
+
+inline wxSize operator/(const wxSize& s, long i)
+{
+ return wxSize(s.x / i, s.y / i);
+}
+
+inline wxSize operator*(const wxSize& s, long i)
+{
+ return wxSize(int(s.x * i), int(s.y * i));
+}
+
+inline wxSize operator*(long i, const wxSize& s)
+{
+ return wxSize(int(s.x * i), int(s.y * i));
+}
+
+inline wxSize operator/(const wxSize& s, unsigned long i)
+{
+ return wxSize(int(s.x / i), int(s.y / i));
+}
+
+inline wxSize operator*(const wxSize& s, unsigned long i)
+{
+ return wxSize(int(s.x * i), int(s.y * i));
+}
+
+inline wxSize operator*(unsigned long i, const wxSize& s)
+{
+ return wxSize(int(s.x * i), int(s.y * i));
+}
+
+inline wxSize operator*(const wxSize& s, double i)
+{
+ return wxSize(int(s.x * i), int(s.y * i));
+}
+
+inline wxSize operator*(double i, const wxSize& s)
+{
+ return wxSize(int(s.x * i), int(s.y * i));
+}
+
+
+
+// ---------------------------------------------------------------------------
+// Point classes: with real or integer coordinates
+// ---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxRealPoint
+{
+public:
+ double x;
+ double y;
+
+ wxRealPoint() : x(0.0), y(0.0) { }
+ wxRealPoint(double xx, double yy) : x(xx), y(yy) { }
+ wxRealPoint(const wxPoint& pt);
+
+ // no copy ctor or assignment operator - the defaults are ok
+
+ //assignment operators
+ wxRealPoint& operator+=(const wxRealPoint& p) { x += p.x; y += p.y; return *this; }
+ wxRealPoint& operator-=(const wxRealPoint& p) { x -= p.x; y -= p.y; return *this; }
+
+ wxRealPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; }
+ wxRealPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; }
+};
+
+
+inline bool operator==(const wxRealPoint& p1, const wxRealPoint& p2)
+{
+ return wxIsSameDouble(p1.x, p2.x) && wxIsSameDouble(p1.y, p2.y);
+}
+
+inline bool operator!=(const wxRealPoint& p1, const wxRealPoint& p2)
+{
+ return !(p1 == p2);
+}
+
+inline wxRealPoint operator+(const wxRealPoint& p1, const wxRealPoint& p2)
+{
+ return wxRealPoint(p1.x + p2.x, p1.y + p2.y);
+}
+
+
+inline wxRealPoint operator-(const wxRealPoint& p1, const wxRealPoint& p2)
+{
+ return wxRealPoint(p1.x - p2.x, p1.y - p2.y);
+}
+
+
+inline wxRealPoint operator/(const wxRealPoint& s, int i)
+{
+ return wxRealPoint(s.x / i, s.y / i);
+}
+
+inline wxRealPoint operator*(const wxRealPoint& s, int i)
+{
+ return wxRealPoint(s.x * i, s.y * i);
+}
+
+inline wxRealPoint operator*(int i, const wxRealPoint& s)
+{
+ return wxRealPoint(s.x * i, s.y * i);
+}
+
+inline wxRealPoint operator/(const wxRealPoint& s, unsigned int i)
+{
+ return wxRealPoint(s.x / i, s.y / i);
+}
+
+inline wxRealPoint operator*(const wxRealPoint& s, unsigned int i)
+{
+ return wxRealPoint(s.x * i, s.y * i);
+}
+
+inline wxRealPoint operator*(unsigned int i, const wxRealPoint& s)
+{
+ return wxRealPoint(s.x * i, s.y * i);
+}
+
+inline wxRealPoint operator/(const wxRealPoint& s, long i)
+{
+ return wxRealPoint(s.x / i, s.y / i);
+}
+
+inline wxRealPoint operator*(const wxRealPoint& s, long i)
+{
+ return wxRealPoint(s.x * i, s.y * i);
+}
+
+inline wxRealPoint operator*(long i, const wxRealPoint& s)
+{
+ return wxRealPoint(s.x * i, s.y * i);
+}
+
+inline wxRealPoint operator/(const wxRealPoint& s, unsigned long i)
+{
+ return wxRealPoint(s.x / i, s.y / i);
+}
+
+inline wxRealPoint operator*(const wxRealPoint& s, unsigned long i)
+{
+ return wxRealPoint(s.x * i, s.y * i);
+}
+
+inline wxRealPoint operator*(unsigned long i, const wxRealPoint& s)
+{
+ return wxRealPoint(s.x * i, s.y * i);
+}
+
+inline wxRealPoint operator*(const wxRealPoint& s, double i)
+{
+ return wxRealPoint(int(s.x * i), int(s.y * i));
+}
+
+inline wxRealPoint operator*(double i, const wxRealPoint& s)
+{
+ return wxRealPoint(int(s.x * i), int(s.y * i));
+}
+
+
+// ----------------------------------------------------------------------------
+// wxPoint: 2D point with integer coordinates
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPoint
+{
+public:
+ int x, y;
+
+ wxPoint() : x(0), y(0) { }
+ wxPoint(int xx, int yy) : x(xx), y(yy) { }
+ wxPoint(const wxRealPoint& pt) : x(int(pt.x)), y(int(pt.y)) { }
+
+ // no copy ctor or assignment operator - the defaults are ok
+
+ //assignment operators
+ wxPoint& operator+=(const wxPoint& p) { x += p.x; y += p.y; return *this; }
+ wxPoint& operator-=(const wxPoint& p) { x -= p.x; y -= p.y; return *this; }
+
+ wxPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; }
+ wxPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; }
+
+ // check if both components are set/initialized
+ bool IsFullySpecified() const { return x != wxDefaultCoord && y != wxDefaultCoord; }
+
+ // fill in the unset components with the values from the other point
+ void SetDefaults(const wxPoint& pt)
+ {
+ if ( x == wxDefaultCoord )
+ x = pt.x;
+ if ( y == wxDefaultCoord )
+ y = pt.y;
+ }
+};
+
+
+// comparison
+inline bool operator==(const wxPoint& p1, const wxPoint& p2)
+{
+ return p1.x == p2.x && p1.y == p2.y;
+}
+
+inline bool operator!=(const wxPoint& p1, const wxPoint& p2)
+{
+ return !(p1 == p2);
+}
+
+
+// arithmetic operations (component wise)
+inline wxPoint operator+(const wxPoint& p1, const wxPoint& p2)
+{
+ return wxPoint(p1.x + p2.x, p1.y + p2.y);
+}
+
+inline wxPoint operator-(const wxPoint& p1, const wxPoint& p2)
+{
+ return wxPoint(p1.x - p2.x, p1.y - p2.y);
+}
+
+inline wxPoint operator+(const wxPoint& p, const wxSize& s)
+{
+ return wxPoint(p.x + s.x, p.y + s.y);
+}
+
+inline wxPoint operator-(const wxPoint& p, const wxSize& s)
+{
+ return wxPoint(p.x - s.x, p.y - s.y);
+}
+
+inline wxPoint operator+(const wxSize& s, const wxPoint& p)
+{
+ return wxPoint(p.x + s.x, p.y + s.y);
+}
+
+inline wxPoint operator-(const wxSize& s, const wxPoint& p)
+{
+ return wxPoint(s.x - p.x, s.y - p.y);
+}
+
+inline wxPoint operator-(const wxPoint& p)
+{
+ return wxPoint(-p.x, -p.y);
+}
+
+inline wxPoint operator/(const wxPoint& s, int i)
+{
+ return wxPoint(s.x / i, s.y / i);
+}
+
+inline wxPoint operator*(const wxPoint& s, int i)
+{
+ return wxPoint(s.x * i, s.y * i);
+}
+
+inline wxPoint operator*(int i, const wxPoint& s)
+{
+ return wxPoint(s.x * i, s.y * i);
+}
+
+inline wxPoint operator/(const wxPoint& s, unsigned int i)
+{
+ return wxPoint(s.x / i, s.y / i);
+}
+
+inline wxPoint operator*(const wxPoint& s, unsigned int i)
+{
+ return wxPoint(s.x * i, s.y * i);
+}
+
+inline wxPoint operator*(unsigned int i, const wxPoint& s)
+{
+ return wxPoint(s.x * i, s.y * i);
+}
+
+inline wxPoint operator/(const wxPoint& s, long i)
+{
+ return wxPoint(s.x / i, s.y / i);
+}
+
+inline wxPoint operator*(const wxPoint& s, long i)
+{
+ return wxPoint(int(s.x * i), int(s.y * i));
+}
+
+inline wxPoint operator*(long i, const wxPoint& s)
+{
+ return wxPoint(int(s.x * i), int(s.y * i));
+}
+
+inline wxPoint operator/(const wxPoint& s, unsigned long i)
+{
+ return wxPoint(s.x / i, s.y / i);
+}
+
+inline wxPoint operator*(const wxPoint& s, unsigned long i)
+{
+ return wxPoint(int(s.x * i), int(s.y * i));
+}
+
+inline wxPoint operator*(unsigned long i, const wxPoint& s)
+{
+ return wxPoint(int(s.x * i), int(s.y * i));
+}
+
+inline wxPoint operator*(const wxPoint& s, double i)
+{
+ return wxPoint(int(s.x * i), int(s.y * i));
+}
+
+inline wxPoint operator*(double i, const wxPoint& s)
+{
+ return wxPoint(int(s.x * i), int(s.y * i));
+}
+
+WX_DECLARE_LIST_WITH_DECL(wxPoint, wxPointList, class WXDLLIMPEXP_CORE);
+
+// ---------------------------------------------------------------------------
+// wxRect
+// ---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxRect
+{
+public:
+ wxRect()
+ : x(0), y(0), width(0), height(0)
+ { }
+ wxRect(int xx, int yy, int ww, int hh)
+ : x(xx), y(yy), width(ww), height(hh)
+ { }
+ wxRect(const wxPoint& topLeft, const wxPoint& bottomRight);
+ wxRect(const wxPoint& pt, const wxSize& size)
+ : x(pt.x), y(pt.y), width(size.x), height(size.y)
+ { }
+ wxRect(const wxSize& size)
+ : x(0), y(0), width(size.x), height(size.y)
+ { }
+
+ // default copy ctor and assignment operators ok
+
+ int GetX() const { return x; }
+ void SetX(int xx) { x = xx; }
+
+ int GetY() const { return y; }
+ void SetY(int yy) { y = yy; }
+
+ int GetWidth() const { return width; }
+ void SetWidth(int w) { width = w; }
+
+ int GetHeight() const { return height; }
+ void SetHeight(int h) { height = h; }
+
+ wxPoint GetPosition() const { return wxPoint(x, y); }
+ void SetPosition( const wxPoint &p ) { x = p.x; y = p.y; }
+
+ wxSize GetSize() const { return wxSize(width, height); }
+ void SetSize( const wxSize &s ) { width = s.GetWidth(); height = s.GetHeight(); }
+
+ bool IsEmpty() const { return (width <= 0) || (height <= 0); }
+
+ int GetLeft() const { return x; }
+ int GetTop() const { return y; }
+ int GetBottom() const { return y + height - 1; }
+ int GetRight() const { return x + width - 1; }
+
+ void SetLeft(int left) { x = left; }
+ void SetRight(int right) { width = right - x + 1; }
+ void SetTop(int top) { y = top; }
+ void SetBottom(int bottom) { height = bottom - y + 1; }
+
+ wxPoint GetTopLeft() const { return GetPosition(); }
+ wxPoint GetLeftTop() const { return GetTopLeft(); }
+ void SetTopLeft(const wxPoint &p) { SetPosition(p); }
+ void SetLeftTop(const wxPoint &p) { SetTopLeft(p); }
+
+ wxPoint GetBottomRight() const { return wxPoint(GetRight(), GetBottom()); }
+ wxPoint GetRightBottom() const { return GetBottomRight(); }
+ void SetBottomRight(const wxPoint &p) { SetRight(p.x); SetBottom(p.y); }
+ void SetRightBottom(const wxPoint &p) { SetBottomRight(p); }
+
+ wxPoint GetTopRight() const { return wxPoint(GetRight(), GetTop()); }
+ wxPoint GetRightTop() const { return GetTopRight(); }
+ void SetTopRight(const wxPoint &p) { SetRight(p.x); SetTop(p.y); }
+ void SetRightTop(const wxPoint &p) { SetTopRight(p); }
+
+ wxPoint GetBottomLeft() const { return wxPoint(GetLeft(), GetBottom()); }
+ wxPoint GetLeftBottom() const { return GetBottomLeft(); }
+ void SetBottomLeft(const wxPoint &p) { SetLeft(p.x); SetBottom(p.y); }
+ void SetLeftBottom(const wxPoint &p) { SetBottomLeft(p); }
+
+ // operations with rect
+ wxRect& Inflate(wxCoord dx, wxCoord dy);
+ wxRect& Inflate(const wxSize& d) { return Inflate(d.x, d.y); }
+ wxRect& Inflate(wxCoord d) { return Inflate(d, d); }
+ wxRect Inflate(wxCoord dx, wxCoord dy) const
+ {
+ wxRect r = *this;
+ r.Inflate(dx, dy);
+ return r;
+ }
+
+ wxRect& Deflate(wxCoord dx, wxCoord dy) { return Inflate(-dx, -dy); }
+ wxRect& Deflate(const wxSize& d) { return Inflate(-d.x, -d.y); }
+ wxRect& Deflate(wxCoord d) { return Inflate(-d); }
+ wxRect Deflate(wxCoord dx, wxCoord dy) const
+ {
+ wxRect r = *this;
+ r.Deflate(dx, dy);
+ return r;
+ }
+
+ void Offset(wxCoord dx, wxCoord dy) { x += dx; y += dy; }
+ void Offset(const wxPoint& pt) { Offset(pt.x, pt.y); }
+
+ wxRect& Intersect(const wxRect& rect);
+ wxRect Intersect(const wxRect& rect) const
+ {
+ wxRect r = *this;
+ r.Intersect(rect);
+ return r;
+ }
+
+ wxRect& Union(const wxRect& rect);
+ wxRect Union(const wxRect& rect) const
+ {
+ wxRect r = *this;
+ r.Union(rect);
+ return r;
+ }
+
+ // return true if the point is (not strcitly) inside the rect
+ bool Contains(int x, int y) const;
+ bool Contains(const wxPoint& pt) const { return Contains(pt.x, pt.y); }
+ // return true if the rectangle 'rect' is (not strictly) inside this rect
+ bool Contains(const wxRect& rect) const;
+
+#if WXWIN_COMPATIBILITY_2_6
+ // use Contains() instead
+ wxDEPRECATED( bool Inside(int x, int y) const );
+ wxDEPRECATED( bool Inside(const wxPoint& pt) const );
+ wxDEPRECATED( bool Inside(const wxRect& rect) const );
+#endif // WXWIN_COMPATIBILITY_2_6
+
+ // return true if the rectangles have a non empty intersection
+ bool Intersects(const wxRect& rect) const;
+
+ // like Union() but don't ignore empty rectangles
+ wxRect& operator+=(const wxRect& rect);
+
+ // intersections of two rectrangles not testing for empty rectangles
+ wxRect& operator*=(const wxRect& rect);
+
+ // centre this rectangle in the given (usually, but not necessarily,
+ // larger) one
+ wxRect CentreIn(const wxRect& r, int dir = wxBOTH) const
+ {
+ return wxRect(dir & wxHORIZONTAL ? r.x + (r.width - width)/2 : x,
+ dir & wxVERTICAL ? r.y + (r.height - height)/2 : y,
+ width, height);
+ }
+
+ wxRect CenterIn(const wxRect& r, int dir = wxBOTH) const
+ {
+ return CentreIn(r, dir);
+ }
+
+public:
+ int x, y, width, height;
+};
+
+
+// compare rectangles
+inline bool operator==(const wxRect& r1, const wxRect& r2)
+{
+ return (r1.x == r2.x) && (r1.y == r2.y) &&
+ (r1.width == r2.width) && (r1.height == r2.height);
+}
+
+inline bool operator!=(const wxRect& r1, const wxRect& r2)
+{
+ return !(r1 == r2);
+}
+
+// like Union() but don't treat empty rectangles specially
+WXDLLIMPEXP_CORE wxRect operator+(const wxRect& r1, const wxRect& r2);
+
+// intersections of two rectangles
+WXDLLIMPEXP_CORE wxRect operator*(const wxRect& r1, const wxRect& r2);
+
+
+
+
+#if WXWIN_COMPATIBILITY_2_6
+inline bool wxRect::Inside(int cx, int cy) const { return Contains(cx, cy); }
+inline bool wxRect::Inside(const wxPoint& pt) const { return Contains(pt); }
+inline bool wxRect::Inside(const wxRect& rect) const { return Contains(rect); }
+#endif // WXWIN_COMPATIBILITY_2_6
+
+
+// define functions which couldn't be defined above because of declarations
+// order
+inline void wxSize::IncBy(const wxPoint& pt) { IncBy(pt.x, pt.y); }
+inline void wxSize::DecBy(const wxPoint& pt) { DecBy(pt.x, pt.y); }
+
+// ---------------------------------------------------------------------------
+// Management of pens, brushes and fonts
+// ---------------------------------------------------------------------------
+
+typedef wxInt8 wxDash;
+
+class WXDLLIMPEXP_CORE wxGDIObjListBase {
+public:
+ wxGDIObjListBase();
+ ~wxGDIObjListBase();
+
+protected:
+ wxList list;
+};
+
+WX_DECLARE_STRING_HASH_MAP(wxColour*, wxStringToColourHashMap);
+
+class WXDLLIMPEXP_CORE wxColourDatabase
+{
+public:
+ wxColourDatabase();
+ ~wxColourDatabase();
+
+ // find colour by name or name for the given colour
+ wxColour Find(const wxString& name) const;
+ wxString FindName(const wxColour& colour) const;
+
+ // add a new colour to the database
+ void AddColour(const wxString& name, const wxColour& colour);
+
+#if WXWIN_COMPATIBILITY_2_6
+ // deprecated, use Find() instead
+ wxDEPRECATED( wxColour *FindColour(const wxString& name) );
+#endif // WXWIN_COMPATIBILITY_2_6
+
+
+#ifdef __WXPM__
+ // PM keeps its own type of colour table
+ long* m_palTable;
+ size_t m_nSize;
+#endif
+
+private:
+ // load the database with the built in colour values when called for the
+ // first time, do nothing after this
+ void Initialize();
+
+ wxStringToColourHashMap *m_map;
+};
+
+class WXDLLIMPEXP_CORE wxResourceCache: public wxList
+{
+public:
+ wxResourceCache() { }
+#if !wxUSE_STD_CONTAINERS
+ wxResourceCache(const unsigned int keyType) : wxList(keyType) { }
+#endif
+ virtual ~wxResourceCache();
+};
+
+// ---------------------------------------------------------------------------
+// global variables
+// ---------------------------------------------------------------------------
+
+
+/* Stock objects
+
+ wxStockGDI creates the stock GDI objects on demand. Pointers to the
+ created objects are stored in the ms_stockObject array, which is indexed
+ by the Item enum values. Platorm-specific fonts can be created by
+ implementing a derived class with an override for the GetFont function.
+ wxStockGDI operates as a singleton, accessed through the ms_instance
+ pointer. By default this pointer is set to an instance of wxStockGDI.
+ A derived class must arrange to set this pointer to an instance of itself.
+*/
+class WXDLLIMPEXP_CORE wxStockGDI
+{
+public:
+ enum Item {
+ BRUSH_BLACK,
+ BRUSH_BLUE,
+ BRUSH_CYAN,
+ BRUSH_GREEN,
+ BRUSH_YELLOW,
+ BRUSH_GREY,
+ BRUSH_LIGHTGREY,
+ BRUSH_MEDIUMGREY,
+ BRUSH_RED,
+ BRUSH_TRANSPARENT,
+ BRUSH_WHITE,
+ COLOUR_BLACK,
+ COLOUR_BLUE,
+ COLOUR_CYAN,
+ COLOUR_GREEN,
+ COLOUR_YELLOW,
+ COLOUR_LIGHTGREY,
+ COLOUR_RED,
+ COLOUR_WHITE,
+ CURSOR_CROSS,
+ CURSOR_HOURGLASS,
+ CURSOR_STANDARD,
+ FONT_ITALIC,
+ FONT_NORMAL,
+ FONT_SMALL,
+ FONT_SWISS,
+ PEN_BLACK,
+ PEN_BLACKDASHED,
+ PEN_BLUE,
+ PEN_CYAN,
+ PEN_GREEN,
+ PEN_YELLOW,
+ PEN_GREY,
+ PEN_LIGHTGREY,
+ PEN_MEDIUMGREY,
+ PEN_RED,
+ PEN_TRANSPARENT,
+ PEN_WHITE,
+ ITEMCOUNT
+ };
+
+ wxStockGDI();
+ virtual ~wxStockGDI();
+ static void DeleteAll();
+
+ static wxStockGDI& instance() { return *ms_instance; }
+
+ static const wxBrush* GetBrush(Item item);
+ static const wxColour* GetColour(Item item);
+ static const wxCursor* GetCursor(Item item);
+ // Can be overridden by platform-specific derived classes
+ virtual const wxFont* GetFont(Item item);
+ static const wxPen* GetPen(Item item);
+
+protected:
+ static wxStockGDI* ms_instance;
+
+ static wxObject* ms_stockObject[ITEMCOUNT];
+
+ wxDECLARE_NO_COPY_CLASS(wxStockGDI);
+};
+
+#define wxITALIC_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_ITALIC)
+#define wxNORMAL_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_NORMAL)
+#define wxSMALL_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_SMALL)
+#define wxSWISS_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_SWISS)
+
+#define wxBLACK_DASHED_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACKDASHED)
+#define wxBLACK_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACK)
+#define wxBLUE_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLUE)
+#define wxCYAN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_CYAN)
+#define wxGREEN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREEN)
+#define wxYELLOW_PEN wxStockGDI::GetPen(wxStockGDI::PEN_YELLOW)
+#define wxGREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREY)
+#define wxLIGHT_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_LIGHTGREY)
+#define wxMEDIUM_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_MEDIUMGREY)
+#define wxRED_PEN wxStockGDI::GetPen(wxStockGDI::PEN_RED)
+#define wxTRANSPARENT_PEN wxStockGDI::GetPen(wxStockGDI::PEN_TRANSPARENT)
+#define wxWHITE_PEN wxStockGDI::GetPen(wxStockGDI::PEN_WHITE)
+
+#define wxBLACK_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_BLACK)
+#define wxBLUE_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_BLUE)
+#define wxCYAN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_CYAN)
+#define wxGREEN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREEN)
+#define wxYELLOW_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_YELLOW)
+#define wxGREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREY)
+#define wxLIGHT_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_LIGHTGREY)
+#define wxMEDIUM_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_MEDIUMGREY)
+#define wxRED_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_RED)
+#define wxTRANSPARENT_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_TRANSPARENT)
+#define wxWHITE_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_WHITE)
+
+#define wxBLACK wxStockGDI::GetColour(wxStockGDI::COLOUR_BLACK)
+#define wxBLUE wxStockGDI::GetColour(wxStockGDI::COLOUR_BLUE)
+#define wxCYAN wxStockGDI::GetColour(wxStockGDI::COLOUR_CYAN)
+#define wxGREEN wxStockGDI::GetColour(wxStockGDI::COLOUR_GREEN)
+#define wxYELLOW wxStockGDI::GetColour(wxStockGDI::COLOUR_YELLOW)
+#define wxLIGHT_GREY wxStockGDI::GetColour(wxStockGDI::COLOUR_LIGHTGREY)
+#define wxRED wxStockGDI::GetColour(wxStockGDI::COLOUR_RED)
+#define wxWHITE wxStockGDI::GetColour(wxStockGDI::COLOUR_WHITE)
+
+#define wxCROSS_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_CROSS)
+#define wxHOURGLASS_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_HOURGLASS)
+#define wxSTANDARD_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_STANDARD)
+
+// 'Null' objects
+extern WXDLLIMPEXP_DATA_CORE(wxBitmap) wxNullBitmap;
+extern WXDLLIMPEXP_DATA_CORE(wxIcon) wxNullIcon;
+extern WXDLLIMPEXP_DATA_CORE(wxCursor) wxNullCursor;
+extern WXDLLIMPEXP_DATA_CORE(wxPen) wxNullPen;
+extern WXDLLIMPEXP_DATA_CORE(wxBrush) wxNullBrush;
+extern WXDLLIMPEXP_DATA_CORE(wxPalette) wxNullPalette;
+extern WXDLLIMPEXP_DATA_CORE(wxFont) wxNullFont;
+extern WXDLLIMPEXP_DATA_CORE(wxColour) wxNullColour;
+extern WXDLLIMPEXP_DATA_CORE(wxIconBundle) wxNullIconBundle;
+
+extern WXDLLIMPEXP_DATA_CORE(wxColourDatabase*) wxTheColourDatabase;
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxPanelNameStr[];
+
+extern WXDLLIMPEXP_DATA_CORE(const wxSize) wxDefaultSize;
+extern WXDLLIMPEXP_DATA_CORE(const wxPoint) wxDefaultPosition;
+
+// ---------------------------------------------------------------------------
+// global functions
+// ---------------------------------------------------------------------------
+
+// resource management
+extern void WXDLLIMPEXP_CORE wxInitializeStockLists();
+extern void WXDLLIMPEXP_CORE wxDeleteStockLists();
+
+// is the display colour (or monochrome)?
+extern bool WXDLLIMPEXP_CORE wxColourDisplay();
+
+// Returns depth of screen
+extern int WXDLLIMPEXP_CORE wxDisplayDepth();
+#define wxGetDisplayDepth wxDisplayDepth
+
+// get the display size
+extern void WXDLLIMPEXP_CORE wxDisplaySize(int *width, int *height);
+extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySize();
+extern void WXDLLIMPEXP_CORE wxDisplaySizeMM(int *width, int *height);
+extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySizeMM();
+extern wxSize WXDLLIMPEXP_CORE wxGetDisplayPPI();
+
+// Get position and size of the display workarea
+extern void WXDLLIMPEXP_CORE wxClientDisplayRect(int *x, int *y, int *width, int *height);
+extern wxRect WXDLLIMPEXP_CORE wxGetClientDisplayRect();
+
+// set global cursor
+extern void WXDLLIMPEXP_CORE wxSetCursor(const wxCursor& cursor);
+
+#endif
+ // _WX_GDICMNH__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gdiobj.h
+// Purpose: wxGDIObject base header
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GDIOBJ_H_BASE_
+#define _WX_GDIOBJ_H_BASE_
+
+#include "wx/object.h"
+
+// ----------------------------------------------------------------------------
+// wxGDIRefData is the base class for wxXXXData structures which contain the
+// real data for the GDI object and are shared among all wxWin objects sharing
+// the same native GDI object
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxGDIRefData : public wxObjectRefData
+{
+public:
+ // Default ctor which needs to be defined just because we use
+ // wxDECLARE_NO_COPY_CLASS() below.
+ wxGDIRefData() { }
+
+ // override this in the derived classes to check if this data object is
+ // really fully initialized
+ virtual bool IsOk() const { return true; }
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxGDIRefData);
+};
+
+// ----------------------------------------------------------------------------
+// wxGDIObject: base class for bitmaps, pens, brushes, ...
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxGDIObject : public wxObject
+{
+public:
+ // checks if the object can be used
+ virtual bool IsOk() const
+ {
+ // the cast here is safe because the derived classes always create
+ // wxGDIRefData objects
+ return m_refData && static_cast<wxGDIRefData *>(m_refData)->IsOk();
+ }
+
+ // don't use in the new code, use IsOk() instead
+ bool IsNull() const { return m_refData == NULL; }
+
+ // older version, for backwards compatibility only (but not deprecated
+ // because it's still widely used)
+ bool Ok() const { return IsOk(); }
+
+#if defined(__WXMSW__) || defined(__WXPM__)
+ // Creates the resource
+ virtual bool RealizeResource() { return false; }
+
+ // Frees the resource
+ virtual bool FreeResource(bool WXUNUSED(force) = false) { return false; }
+
+ virtual bool IsFree() const { return false; }
+
+ // Returns handle.
+ virtual WXHANDLE GetResourceHandle() const { return 0; }
+#endif // defined(__WXMSW__) || defined(__WXPM__)
+
+protected:
+ // replace base class functions using wxObjectRefData with our own which
+ // use wxGDIRefData to ensure that we always work with data objects of the
+ // correct type (i.e. derived from wxGDIRefData)
+ virtual wxObjectRefData *CreateRefData() const
+ {
+ return CreateGDIRefData();
+ }
+
+ virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const
+ {
+ return CloneGDIRefData(static_cast<const wxGDIRefData *>(data));
+ }
+
+ virtual wxGDIRefData *CreateGDIRefData() const = 0;
+ virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const = 0;
+
+ DECLARE_DYNAMIC_CLASS(wxGDIObject)
+};
+
+#endif // _WX_GDIOBJ_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/aboutdlgg.h
+// Purpose: generic wxAboutBox() implementation
+// Author: Vadim Zeitlin
+// Created: 2006-10-07
+// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_ABOUTDLGG_H_
+#define _WX_GENERIC_ABOUTDLGG_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_ABOUTDLG
+
+#include "wx/dialog.h"
+
+class WXDLLIMPEXP_FWD_ADV wxAboutDialogInfo;
+class WXDLLIMPEXP_FWD_CORE wxSizer;
+class WXDLLIMPEXP_FWD_CORE wxSizerFlags;
+
+// Under GTK and OS X "About" dialogs are not supposed to be modal, unlike MSW
+// and, presumably, all the other platforms.
+#ifndef wxUSE_MODAL_ABOUT_DIALOG
+ #if defined(__WXGTK__) || defined(__WXMAC__)
+ #define wxUSE_MODAL_ABOUT_DIALOG 0
+ #else
+ #define wxUSE_MODAL_ABOUT_DIALOG 1
+ #endif
+#endif // wxUSE_MODAL_ABOUT_DIALOG not defined
+
+// ----------------------------------------------------------------------------
+// wxGenericAboutDialog: generic "About" dialog implementation
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxGenericAboutDialog : public wxDialog
+{
+public:
+ // constructors and Create() method
+ // --------------------------------
+
+ // default ctor, you must use Create() to really initialize the dialog
+ wxGenericAboutDialog() { Init(); }
+
+ // ctor which fully initializes the object
+ wxGenericAboutDialog(const wxAboutDialogInfo& info, wxWindow* parent = NULL)
+ {
+ Init();
+
+ (void)Create(info, parent);
+ }
+
+ // this method must be called if and only if the default ctor was used
+ bool Create(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
+
+protected:
+ // this virtual method may be overridden to add some more controls to the
+ // dialog
+ //
+ // notice that for this to work you must call Create() from the derived
+ // class ctor and not use the base class ctor directly as otherwise the
+ // virtual function of the derived class wouldn't be called
+ virtual void DoAddCustomControls() { }
+
+ // add arbitrary control to the text sizer contents with the specified
+ // flags
+ void AddControl(wxWindow *win, const wxSizerFlags& flags);
+
+ // add arbitrary control to the text sizer contents and center it
+ void AddControl(wxWindow *win);
+
+ // add the text, if it's not empty, to the text sizer contents
+ void AddText(const wxString& text);
+
+#if wxUSE_COLLPANE
+ // add a wxCollapsiblePane containing the given text
+ void AddCollapsiblePane(const wxString& title, const wxString& text);
+#endif // wxUSE_COLLPANE
+
+private:
+ // common part of all ctors
+ void Init() { m_sizerText = NULL; }
+
+#if !wxUSE_MODAL_ABOUT_DIALOG
+ // An explicit handler for deleting the dialog when it's closed is needed
+ // when we show it non-modally.
+ void OnCloseWindow(wxCloseEvent& event);
+ void OnOK(wxCommandEvent& event);
+#endif // !wxUSE_MODAL_ABOUT_DIALOG
+
+ wxSizer *m_sizerText;
+};
+
+// unlike wxAboutBox which can show either the native or generic about dialog,
+// this function always shows the generic one
+WXDLLIMPEXP_ADV void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
+
+#endif // wxUSE_ABOUTDLG
+
+#endif // _WX_GENERIC_ABOUTDLGG_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/accel.h
+// Purpose: wxAcceleratorTable class
+// Author: Robert Roebling
+// Copyright: (c) Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_ACCEL_H_
+#define _WX_GENERIC_ACCEL_H_
+
+class WXDLLIMPEXP_FWD_CORE wxKeyEvent;
+
+// ----------------------------------------------------------------------------
+// wxAcceleratorTable
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxAcceleratorTable : public wxObject
+{
+public:
+ wxAcceleratorTable();
+ wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]);
+ virtual ~wxAcceleratorTable();
+
+ bool Ok() const { return IsOk(); }
+ bool IsOk() const;
+
+ void Add(const wxAcceleratorEntry& entry);
+ void Remove(const wxAcceleratorEntry& entry);
+
+ // implementation
+ // --------------
+
+ wxMenuItem *GetMenuItem(const wxKeyEvent& event) const;
+ int GetCommand(const wxKeyEvent& event) const;
+
+ const wxAcceleratorEntry *GetEntry(const wxKeyEvent& event) const;
+
+protected:
+ // ref counting code
+ virtual wxObjectRefData *CreateRefData() const;
+ virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
+};
+
+#endif // _WX_GENERIC_ACCEL_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/bmpcbox.h
+// Purpose: wxBitmapComboBox
+// Author: Jaakko Salli
+// Modified by:
+// Created: Aug-30-2006
+// Copyright: (c) Jaakko Salli
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_BMPCBOX_H_
+#define _WX_GENERIC_BMPCBOX_H_
+
+
+#define wxGENERIC_BITMAPCOMBOBOX 1
+
+#include "wx/odcombo.h"
+
+// ----------------------------------------------------------------------------
+// wxBitmapComboBox: a wxComboBox that allows images to be shown
+// in front of string items.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxBitmapComboBox : public wxOwnerDrawnComboBox,
+ public wxBitmapComboBoxBase
+{
+public:
+
+ // ctors and such
+ wxBitmapComboBox() : wxOwnerDrawnComboBox(), wxBitmapComboBoxBase()
+ {
+ Init();
+ }
+
+ wxBitmapComboBox(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0,
+ const wxString choices[] = NULL,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxBitmapComboBoxNameStr)
+ : wxOwnerDrawnComboBox(),
+ wxBitmapComboBoxBase()
+ {
+ Init();
+
+ (void)Create(parent, id, value, pos, size, n,
+ choices, style, validator, name);
+ }
+
+ wxBitmapComboBox(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ long style,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxBitmapComboBoxNameStr);
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value,
+ const wxPoint& pos,
+ const wxSize& size,
+ int n,
+ const wxString choices[],
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxBitmapComboBoxNameStr);
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxBitmapComboBoxNameStr);
+
+ virtual ~wxBitmapComboBox();
+
+ // Adds item with image to the end of the combo box.
+ int Append(const wxString& item, const wxBitmap& bitmap = wxNullBitmap);
+ int Append(const wxString& item, const wxBitmap& bitmap, void *clientData);
+ int Append(const wxString& item, const wxBitmap& bitmap, wxClientData *clientData);
+
+ // Inserts item with image into the list before pos. Not valid for wxCB_SORT
+ // styles, use Append instead.
+ int Insert(const wxString& item, const wxBitmap& bitmap, unsigned int pos);
+ int Insert(const wxString& item, const wxBitmap& bitmap,
+ unsigned int pos, void *clientData);
+ int Insert(const wxString& item, const wxBitmap& bitmap,
+ unsigned int pos, wxClientData *clientData);
+
+ // Sets the image for the given item.
+ virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap);
+ virtual bool SetFont(const wxFont& font);
+
+protected:
+
+ virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, int item, int flags) const;
+ virtual void OnDrawItem(wxDC& dc, const wxRect& rect, int item, int flags) const;
+ virtual wxCoord OnMeasureItem(size_t item) const;
+ virtual wxCoord OnMeasureItemWidth(size_t item) const;
+
+ // Event handlers
+ void OnSize(wxSizeEvent& event);
+
+ virtual wxSize DoGetBestSize() const;
+
+ virtual wxItemContainer* GetItemContainer() { return this; }
+ virtual wxWindow* GetControl() { return this; }
+
+ // wxItemContainer implementation
+ virtual int DoInsertItems(const wxArrayStringsAdapter & items,
+ unsigned int pos,
+ void **clientData, wxClientDataType type);
+ virtual void DoClear();
+ virtual void DoDeleteOneItem(unsigned int n);
+
+private:
+ bool m_inResize;
+
+ void Init();
+
+ DECLARE_EVENT_TABLE()
+
+ DECLARE_DYNAMIC_CLASS(wxBitmapComboBox)
+};
+
+#endif // _WX_GENERIC_BMPCBOX_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/busyinfo.h
+// Purpose: Information window (when app is busy)
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_BUSYINFO_H_
+#define _WX_BUSYINFO_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_BUSYINFO
+
+#include "wx/object.h"
+
+class WXDLLIMPEXP_FWD_CORE wxFrame;
+class WXDLLIMPEXP_FWD_CORE wxWindow;
+
+//--------------------------------------------------------------------------------
+// wxBusyInfo
+// Displays progress information
+// Can be used in exactly same way as wxBusyCursor
+//--------------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxBusyInfo : public wxObject
+{
+public:
+ wxBusyInfo(const wxString& message, wxWindow *parent = NULL);
+
+ virtual ~wxBusyInfo();
+
+private:
+ wxFrame *m_InfoFrame;
+
+ wxDECLARE_NO_COPY_CLASS(wxBusyInfo);
+};
+
+#endif // wxUSE_BUSYINFO
+#endif // _WX_BUSYINFO_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/buttonbar.h
+// Purpose: wxButtonToolBar declaration
+// Author: Julian Smart, after Robert Roebling, Vadim Zeitlin, SciTech
+// Modified by:
+// Created: 2006-04-13
+// Copyright: (c) Julian Smart, Robert Roebling, Vadim Zeitlin,
+// SciTech Software, Inc.
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_BUTTONBAR_H_
+#define _WX_BUTTONBAR_H_
+
+#include "wx/bmpbuttn.h"
+#include "wx/toolbar.h"
+
+class WXDLLIMPEXP_FWD_CORE wxButtonToolBarTool;
+
+// ----------------------------------------------------------------------------
+// wxButtonToolBar
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxButtonToolBar : public wxToolBarBase
+{
+public:
+ // construction/destruction
+ wxButtonToolBar() { Init(); }
+ wxButtonToolBar(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxToolBarNameStr)
+ {
+ Init();
+
+ Create(parent, id, pos, size, style, name);
+ }
+
+ bool Create( wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxToolBarNameStr );
+
+ virtual ~wxButtonToolBar();
+
+ virtual bool Realize();
+
+ virtual void SetToolShortHelp(int id, const wxString& helpString);
+ virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
+
+protected:
+ // common part of all ctors
+ void Init();
+
+ // implement base class pure virtuals
+ virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
+ virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
+
+ virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
+ virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
+ virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
+
+ virtual wxToolBarToolBase *CreateTool(int id,
+ const wxString& label,
+ const wxBitmap& bmpNormal,
+ const wxBitmap& bmpDisabled,
+ wxItemKind kind,
+ wxObject *clientData,
+ const wxString& shortHelp,
+ const wxString& longHelp);
+ virtual wxToolBarToolBase *CreateTool(wxControl *control,
+ const wxString& label);
+
+ virtual wxSize DoGetBestClientSize() const;
+
+ // calculate layout
+ void DoLayout();
+
+ // get the bounding rect for the given tool
+ wxRect GetToolRect(wxToolBarToolBase *tool) const;
+
+ // get the rect limits depending on the orientation: top/bottom for a
+ // vertical toolbar, left/right for a horizontal one
+ void GetRectLimits(const wxRect& rect, wxCoord *start, wxCoord *end) const;
+
+ // receives button commands
+ void OnCommand(wxCommandEvent& event);
+
+ // paints a border
+ void OnPaint(wxPaintEvent& event);
+
+ // detects mouse clicks outside buttons
+ void OnLeftUp(wxMouseEvent& event);
+
+private:
+ // have we calculated the positions of our tools?
+ bool m_needsLayout;
+
+ // the width of a separator
+ wxCoord m_widthSeparator;
+
+ // the total size of all toolbar elements
+ wxCoord m_maxWidth,
+ m_maxHeight;
+
+ // the height of a label
+ int m_labelHeight;
+
+ // the space above the label
+ int m_labelMargin;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxButtonToolBar)
+ DECLARE_EVENT_TABLE()
+};
+
+#endif
+ // _WX_BUTTONBAR_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/calctrlg.h
+// Purpose: generic implementation of date-picker control
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 29.12.99
+// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_CALCTRLG_H
+#define _WX_GENERIC_CALCTRLG_H
+
+#include "wx/control.h" // the base class
+#include "wx/dcclient.h" // for wxPaintDC
+
+class WXDLLIMPEXP_FWD_CORE wxComboBox;
+class WXDLLIMPEXP_FWD_CORE wxStaticText;
+class WXDLLIMPEXP_FWD_CORE wxSpinCtrl;
+class WXDLLIMPEXP_FWD_CORE wxSpinEvent;
+
+// ----------------------------------------------------------------------------
+// wxGenericCalendarCtrl
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxGenericCalendarCtrl : public wxCalendarCtrlBase
+{
+public:
+ // construction
+ wxGenericCalendarCtrl() { Init(); }
+ wxGenericCalendarCtrl(wxWindow *parent,
+ wxWindowID id,
+ const wxDateTime& date = wxDefaultDateTime,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxCAL_SHOW_HOLIDAYS,
+ const wxString& name = wxCalendarNameStr);
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxDateTime& date = wxDefaultDateTime,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxCAL_SHOW_HOLIDAYS,
+ const wxString& name = wxCalendarNameStr);
+
+ virtual ~wxGenericCalendarCtrl();
+
+ virtual bool Destroy();
+
+ // set/get the current date
+ // ------------------------
+
+ virtual bool SetDate(const wxDateTime& date);
+ virtual wxDateTime GetDate() const { return m_date; }
+
+
+ // set/get the range in which selection can occur
+ // ---------------------------------------------
+
+ virtual bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime,
+ const wxDateTime& upperdate = wxDefaultDateTime);
+
+ virtual bool GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const;
+
+ // these functions are for generic version only, don't use them but use the
+ // Set/GetDateRange() above instead
+ bool SetLowerDateLimit(const wxDateTime& date = wxDefaultDateTime);
+ const wxDateTime& GetLowerDateLimit() const { return m_lowdate; }
+ bool SetUpperDateLimit(const wxDateTime& date = wxDefaultDateTime);
+ const wxDateTime& GetUpperDateLimit() const { return m_highdate; }
+
+
+ // calendar mode
+ // -------------
+
+ // some calendar styles can't be changed after the control creation by
+ // just using SetWindowStyle() and Refresh() and the functions below
+ // should be used instead for them
+
+ // corresponds to wxCAL_NO_MONTH_CHANGE bit
+ virtual bool EnableMonthChange(bool enable = true);
+
+ // corresponds to wxCAL_NO_YEAR_CHANGE bit, deprecated, generic only
+ void EnableYearChange(bool enable = true);
+
+
+ // customization
+ // -------------
+
+ virtual void Mark(size_t day, bool mark);
+
+ // all other functions in this section are for generic version only
+
+ // header colours are used for painting the weekdays at the top
+ virtual void SetHeaderColours(const wxColour& colFg, const wxColour& colBg)
+ {
+ m_colHeaderFg = colFg;
+ m_colHeaderBg = colBg;
+ }
+
+ virtual const wxColour& GetHeaderColourFg() const { return m_colHeaderFg; }
+ virtual const wxColour& GetHeaderColourBg() const { return m_colHeaderBg; }
+
+ // highlight colour is used for the currently selected date
+ virtual void SetHighlightColours(const wxColour& colFg, const wxColour& colBg)
+ {
+ m_colHighlightFg = colFg;
+ m_colHighlightBg = colBg;
+ }
+
+ virtual const wxColour& GetHighlightColourFg() const { return m_colHighlightFg; }
+ virtual const wxColour& GetHighlightColourBg() const { return m_colHighlightBg; }
+
+ // holiday colour is used for the holidays (if style & wxCAL_SHOW_HOLIDAYS)
+ virtual void SetHolidayColours(const wxColour& colFg, const wxColour& colBg)
+ {
+ m_colHolidayFg = colFg;
+ m_colHolidayBg = colBg;
+ }
+
+ virtual const wxColour& GetHolidayColourFg() const { return m_colHolidayFg; }
+ virtual const wxColour& GetHolidayColourBg() const { return m_colHolidayBg; }
+
+ virtual wxCalendarDateAttr *GetAttr(size_t day) const
+ {
+ wxCHECK_MSG( day > 0 && day < 32, NULL, wxT("invalid day") );
+
+ return m_attrs[day - 1];
+ }
+
+ virtual void SetAttr(size_t day, wxCalendarDateAttr *attr)
+ {
+ wxCHECK_RET( day > 0 && day < 32, wxT("invalid day") );
+
+ delete m_attrs[day - 1];
+ m_attrs[day - 1] = attr;
+ }
+
+ virtual void ResetAttr(size_t day) { SetAttr(day, NULL); }
+
+ virtual void SetHoliday(size_t day);
+
+ virtual wxCalendarHitTestResult HitTest(const wxPoint& pos,
+ wxDateTime *date = NULL,
+ wxDateTime::WeekDay *wd = NULL);
+
+ // implementation only from now on
+ // -------------------------------
+
+ // forward these functions to all subcontrols
+ virtual bool Enable(bool enable = true);
+ virtual bool Show(bool show = true);
+
+ virtual void SetWindowStyleFlag(long style);
+
+ virtual wxVisualAttributes GetDefaultAttributes() const
+ { return GetClassDefaultAttributes(GetWindowVariant()); }
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ void OnSysColourChanged(wxSysColourChangedEvent& event);
+
+protected:
+ // override some base class virtuals
+ virtual wxSize DoGetBestSize() const;
+ virtual void DoMoveWindow(int x, int y, int width, int height);
+ virtual void DoGetSize(int *width, int *height) const;
+
+private:
+ // common part of all ctors
+ void Init();
+
+ // startup colours and reinitialization after colour changes in system
+ void InitColours();
+
+ // event handlers
+ void OnPaint(wxPaintEvent& event);
+ void OnClick(wxMouseEvent& event);
+ void OnDClick(wxMouseEvent& event);
+ void OnChar(wxKeyEvent& event);
+ void OnMonthChange(wxCommandEvent& event);
+
+ void HandleYearChange(wxCommandEvent& event);
+ void OnYearChange(wxSpinEvent& event);
+ void OnYearTextChange(wxCommandEvent& event);
+
+ // (re)calc m_widthCol and m_heightRow
+ void RecalcGeometry();
+
+ // set the date and send the notification
+ void SetDateAndNotify(const wxDateTime& date);
+
+ // get the week (row, in range 1..6) for the given date
+ size_t GetWeek(const wxDateTime& date) const;
+
+ // get the date from which we start drawing days
+ wxDateTime GetStartDate() const;
+
+ // get the first/last days of the week corresponding to the current style
+ wxDateTime::WeekDay GetWeekStart() const
+ {
+ return HasFlag(wxCAL_MONDAY_FIRST) ? wxDateTime::Mon
+ : wxDateTime::Sun;
+ }
+
+ wxDateTime::WeekDay GetWeekEnd() const
+ {
+ return HasFlag(wxCAL_MONDAY_FIRST) ? wxDateTime::Sun
+ : wxDateTime::Sat;
+ }
+
+
+ // is this date shown?
+ bool IsDateShown(const wxDateTime& date) const;
+
+ // is this date in the currently allowed range?
+ bool IsDateInRange(const wxDateTime& date) const;
+
+ // adjust the date to the currently allowed range, return true if it was
+ // changed
+ bool AdjustDateToRange(wxDateTime *date) const;
+
+ // redraw the given date
+ void RefreshDate(const wxDateTime& date);
+
+ // change the date inside the same month/year
+ void ChangeDay(const wxDateTime& date);
+
+ // deprecated
+ bool AllowYearChange() const
+ {
+ return !(GetWindowStyle() & wxCAL_NO_YEAR_CHANGE);
+ }
+
+ // show the correct controls
+ void ShowCurrentControls();
+
+ // create the month combo and year spin controls
+ void CreateMonthComboBox();
+ void CreateYearSpinCtrl();
+
+public:
+ // get the currently shown control for month/year
+ wxControl *GetMonthControl() const;
+ wxControl *GetYearControl() const;
+
+private:
+ virtual void ResetHolidayAttrs();
+ virtual void RefreshHolidays() { Refresh(); }
+
+ // OnPaint helper-methods
+
+ // Highlight the [fromdate : todate] range using pen and brush
+ void HighlightRange(wxPaintDC* dc, const wxDateTime& fromdate, const wxDateTime& todate, const wxPen* pen, const wxBrush* brush);
+
+ // Get the "coordinates" for the date relative to the month currently displayed.
+ // using (day, week): upper left coord is (1, 1), lower right coord is (7, 6)
+ // if the date isn't visible (-1, -1) is put in (day, week) and false is returned
+ bool GetDateCoord(const wxDateTime& date, int *day, int *week) const;
+
+ // Set the flag for SetDate(): otherwise it would overwrite the year
+ // typed in by the user
+ void SetUserChangedYear() { m_userChangedYear = true; }
+
+
+ // the subcontrols
+ wxStaticText *m_staticMonth;
+ wxComboBox *m_comboMonth;
+
+ wxStaticText *m_staticYear;
+ wxSpinCtrl *m_spinYear;
+
+ // the current selection
+ wxDateTime m_date;
+
+ // the date-range
+ wxDateTime m_lowdate;
+ wxDateTime m_highdate;
+
+ // default attributes
+ wxColour m_colHighlightFg,
+ m_colHighlightBg,
+ m_colHolidayFg,
+ m_colHolidayBg,
+ m_colHeaderFg,
+ m_colHeaderBg,
+ m_colBackground,
+ m_colSurrounding;
+
+ // the attributes for each of the month days
+ wxCalendarDateAttr *m_attrs[31];
+
+ // the width and height of one column/row in the calendar
+ wxCoord m_widthCol,
+ m_heightRow,
+ m_rowOffset,
+ m_calendarWeekWidth;
+
+ wxRect m_leftArrowRect,
+ m_rightArrowRect;
+
+ // the week day names
+ wxString m_weekdays[7];
+
+ // true if SetDate() is being called as the result of changing the year in
+ // the year control
+ bool m_userChangedYear;
+
+ DECLARE_DYNAMIC_CLASS(wxGenericCalendarCtrl)
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxGenericCalendarCtrl);
+};
+
+#endif // _WX_GENERIC_CALCTRLG_H
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/caret.h
+// Purpose: generic wxCaret class
+// Author: Vadim Zeitlin (original code by Robert Roebling)
+// Modified by:
+// Created: 25.05.99
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CARET_H_
+#define _WX_CARET_H_
+
+#include "wx/timer.h"
+#include "wx/dc.h"
+#include "wx/overlay.h"
+
+#ifdef wxHAS_NATIVE_OVERLAY
+ #define wxHAS_CARET_USING_OVERLAYS
+#endif
+
+class WXDLLIMPEXP_FWD_CORE wxCaret;
+
+class WXDLLIMPEXP_CORE wxCaretTimer : public wxTimer
+{
+public:
+ wxCaretTimer(wxCaret *caret);
+ virtual void Notify();
+
+private:
+ wxCaret *m_caret;
+};
+
+class WXDLLIMPEXP_CORE wxCaret : public wxCaretBase
+{
+public:
+ // ctors
+ // -----
+ // default - use Create()
+ wxCaret() : m_timer(this) { InitGeneric(); }
+ // creates a block caret associated with the given window
+ wxCaret(wxWindowBase *window, int width, int height)
+ : wxCaretBase(window, width, height), m_timer(this) { InitGeneric(); }
+ wxCaret(wxWindowBase *window, const wxSize& size)
+ : wxCaretBase(window, size), m_timer(this) { InitGeneric(); }
+
+ virtual ~wxCaret();
+
+ // implementation
+ // --------------
+
+ // called by wxWindow (not using the event tables)
+ virtual void OnSetFocus();
+ virtual void OnKillFocus();
+
+ // called by wxCaretTimer
+ void OnTimer();
+
+protected:
+ virtual void DoShow();
+ virtual void DoHide();
+ virtual void DoMove();
+ virtual void DoSize();
+
+ // blink the caret once
+ void Blink();
+
+ // refresh the caret
+ void Refresh();
+
+ // draw the caret on the given DC
+ void DoDraw(wxDC *dc, wxWindow* win);
+
+private:
+ // GTK specific initialization
+ void InitGeneric();
+
+#ifdef wxHAS_CARET_USING_OVERLAYS
+ // the overlay for displaying the caret
+ wxOverlay m_overlay;
+#else
+ // the bitmap holding the part of window hidden by the caret when it was
+ // at (m_xOld, m_yOld)
+ wxBitmap m_bmpUnderCaret;
+ int m_xOld,
+ m_yOld;
+#endif
+
+ wxCaretTimer m_timer;
+ bool m_blinkedOut, // true => caret hidden right now
+ m_hasFocus; // true => our window has focus
+};
+
+#endif // _WX_CARET_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/choicdgg.h
+// Purpose: Generic choice dialogs
+// Author: Julian Smart
+// Modified by: 03.11.00: VZ to add wxArrayString and multiple sel functions
+// Created: 01/02/97
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_CHOICDGG_H_
+#define _WX_GENERIC_CHOICDGG_H_
+
+#include "wx/dynarray.h"
+#include "wx/dialog.h"
+
+class WXDLLIMPEXP_FWD_CORE wxListBoxBase;
+
+// ----------------------------------------------------------------------------
+// some (ugly...) constants
+// ----------------------------------------------------------------------------
+
+#define wxCHOICE_HEIGHT 150
+#define wxCHOICE_WIDTH 200
+
+#ifdef __WXWINCE__
+#define wxCHOICEDLG_STYLE \
+ (wxDEFAULT_DIALOG_STYLE | wxOK | wxCANCEL | wxCENTRE)
+#else
+#define wxCHOICEDLG_STYLE \
+ (wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE)
+#endif
+
+// ----------------------------------------------------------------------------
+// wxAnyChoiceDialog: a base class for dialogs containing a listbox
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxAnyChoiceDialog : public wxDialog
+{
+public:
+ wxAnyChoiceDialog() { }
+
+ wxAnyChoiceDialog(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ int n, const wxString *choices,
+ long styleDlg = wxCHOICEDLG_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ long styleLbox = wxLB_ALWAYS_SB)
+ {
+ (void)Create(parent, message, caption, n, choices,
+ styleDlg, pos, styleLbox);
+ }
+ wxAnyChoiceDialog(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ const wxArrayString& choices,
+ long styleDlg = wxCHOICEDLG_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ long styleLbox = wxLB_ALWAYS_SB)
+ {
+ (void)Create(parent, message, caption, choices,
+ styleDlg, pos, styleLbox);
+ }
+
+ bool Create(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ int n, const wxString *choices,
+ long styleDlg = wxCHOICEDLG_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ long styleLbox = wxLB_ALWAYS_SB);
+ bool Create(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ const wxArrayString& choices,
+ long styleDlg = wxCHOICEDLG_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ long styleLbox = wxLB_ALWAYS_SB);
+
+protected:
+ wxListBoxBase *m_listbox;
+
+ virtual wxListBoxBase *CreateList(int n,
+ const wxString *choices,
+ long styleLbox);
+
+ wxDECLARE_NO_COPY_CLASS(wxAnyChoiceDialog);
+};
+
+// ----------------------------------------------------------------------------
+// wxSingleChoiceDialog: a dialog with single selection listbox
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSingleChoiceDialog : public wxAnyChoiceDialog
+{
+public:
+ wxSingleChoiceDialog()
+ {
+ m_selection = -1;
+ }
+
+ wxSingleChoiceDialog(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ int n,
+ const wxString *choices,
+ void **clientData = NULL,
+ long style = wxCHOICEDLG_STYLE,
+ const wxPoint& pos = wxDefaultPosition)
+ {
+ Create(parent, message, caption, n, choices, clientData, style, pos);
+ }
+
+ wxSingleChoiceDialog(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ const wxArrayString& choices,
+ void **clientData = NULL,
+ long style = wxCHOICEDLG_STYLE,
+ const wxPoint& pos = wxDefaultPosition)
+ {
+ Create(parent, message, caption, choices, clientData, style, pos);
+ }
+
+ bool Create(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ int n,
+ const wxString *choices,
+ void **clientData = NULL,
+ long style = wxCHOICEDLG_STYLE,
+ const wxPoint& pos = wxDefaultPosition);
+ bool Create(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ const wxArrayString& choices,
+ void **clientData = NULL,
+ long style = wxCHOICEDLG_STYLE,
+ const wxPoint& pos = wxDefaultPosition);
+
+ void SetSelection(int sel);
+ int GetSelection() const { return m_selection; }
+ wxString GetStringSelection() const { return m_stringSelection; }
+ void* GetSelectionData() const { return m_clientData; }
+
+#if WXWIN_COMPATIBILITY_2_8
+ // Deprecated overloads taking "char**" client data.
+ wxDEPRECATED_CONSTRUCTOR
+ (
+ wxSingleChoiceDialog(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ int n,
+ const wxString *choices,
+ char **clientData,
+ long style = wxCHOICEDLG_STYLE,
+ const wxPoint& pos = wxDefaultPosition)
+ )
+ {
+ Create(parent, message, caption, n, choices,
+ (void**)clientData, style, pos);
+ }
+
+ wxDEPRECATED_CONSTRUCTOR
+ (
+ wxSingleChoiceDialog(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ const wxArrayString& choices,
+ char **clientData,
+ long style = wxCHOICEDLG_STYLE,
+ const wxPoint& pos = wxDefaultPosition)
+ )
+ {
+ Create(parent, message, caption, choices,
+ (void**)clientData, style, pos);
+ }
+
+ wxDEPRECATED_INLINE
+ (
+ bool Create(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ int n,
+ const wxString *choices,
+ char **clientData,
+ long style = wxCHOICEDLG_STYLE,
+ const wxPoint& pos = wxDefaultPosition),
+ return Create(parent, message, caption, n, choices,
+ (void**)clientData, style, pos);
+ )
+
+ wxDEPRECATED_INLINE
+ (
+ bool Create(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ const wxArrayString& choices,
+ char **clientData,
+ long style = wxCHOICEDLG_STYLE,
+ const wxPoint& pos = wxDefaultPosition),
+ return Create(parent, message, caption, choices,
+ (void**)clientData, style, pos);
+ )
+
+ // NB: no need to make it return wxChar, it's untyped
+ wxDEPRECATED_ACCESSOR
+ (
+ char* GetSelectionClientData() const,
+ (char*)GetSelectionData()
+ )
+#endif // WXWIN_COMPATIBILITY_2_8
+
+ // implementation from now on
+ void OnOK(wxCommandEvent& event);
+#ifndef __SMARTPHONE__
+ void OnListBoxDClick(wxCommandEvent& event);
+#endif
+#ifdef __WXWINCE__
+ void OnJoystickButtonDown(wxJoystickEvent& event);
+#endif
+
+protected:
+ int m_selection;
+ wxString m_stringSelection;
+
+ void DoChoice();
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxSingleChoiceDialog)
+ DECLARE_EVENT_TABLE()
+};
+
+// ----------------------------------------------------------------------------
+// wxMultiChoiceDialog: a dialog with multi selection listbox
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxMultiChoiceDialog : public wxAnyChoiceDialog
+{
+public:
+ wxMultiChoiceDialog() { }
+
+ wxMultiChoiceDialog(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ int n,
+ const wxString *choices,
+ long style = wxCHOICEDLG_STYLE,
+ const wxPoint& pos = wxDefaultPosition)
+ {
+ (void)Create(parent, message, caption, n, choices, style, pos);
+ }
+ wxMultiChoiceDialog(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ const wxArrayString& choices,
+ long style = wxCHOICEDLG_STYLE,
+ const wxPoint& pos = wxDefaultPosition)
+ {
+ (void)Create(parent, message, caption, choices, style, pos);
+ }
+
+ bool Create(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ int n,
+ const wxString *choices,
+ long style = wxCHOICEDLG_STYLE,
+ const wxPoint& pos = wxDefaultPosition);
+ bool Create(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ const wxArrayString& choices,
+ long style = wxCHOICEDLG_STYLE,
+ const wxPoint& pos = wxDefaultPosition);
+
+ void SetSelections(const wxArrayInt& selections);
+ wxArrayInt GetSelections() const { return m_selections; }
+
+ // implementation from now on
+ virtual bool TransferDataFromWindow();
+
+protected:
+#if wxUSE_CHECKLISTBOX
+ virtual wxListBoxBase *CreateList(int n,
+ const wxString *choices,
+ long styleLbox);
+#endif // wxUSE_CHECKLISTBOX
+
+ wxArrayInt m_selections;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxMultiChoiceDialog)
+};
+
+// ----------------------------------------------------------------------------
+// wrapper functions which can be used to get selection(s) from the user
+// ----------------------------------------------------------------------------
+
+// get the user selection as a string
+WXDLLIMPEXP_CORE wxString wxGetSingleChoice(const wxString& message,
+ const wxString& caption,
+ const wxArrayString& choices,
+ wxWindow *parent = NULL,
+ int x = wxDefaultCoord,
+ int y = wxDefaultCoord,
+ bool centre = true,
+ int width = wxCHOICE_WIDTH,
+ int height = wxCHOICE_HEIGHT,
+ int initialSelection = 0);
+
+WXDLLIMPEXP_CORE wxString wxGetSingleChoice(const wxString& message,
+ const wxString& caption,
+ int n, const wxString *choices,
+ wxWindow *parent = NULL,
+ int x = wxDefaultCoord,
+ int y = wxDefaultCoord,
+ bool centre = true,
+ int width = wxCHOICE_WIDTH,
+ int height = wxCHOICE_HEIGHT,
+ int initialSelection = 0);
+
+WXDLLIMPEXP_CORE wxString wxGetSingleChoice(const wxString& message,
+ const wxString& caption,
+ const wxArrayString& choices,
+ int initialSelection,
+ wxWindow *parent = NULL);
+
+WXDLLIMPEXP_CORE wxString wxGetSingleChoice(const wxString& message,
+ const wxString& caption,
+ int n, const wxString *choices,
+ int initialSelection,
+ wxWindow *parent = NULL);
+
+// Same as above but gets position in list of strings, instead of string,
+// or -1 if no selection
+WXDLLIMPEXP_CORE int wxGetSingleChoiceIndex(const wxString& message,
+ const wxString& caption,
+ const wxArrayString& choices,
+ wxWindow *parent = NULL,
+ int x = wxDefaultCoord,
+ int y = wxDefaultCoord,
+ bool centre = true,
+ int width = wxCHOICE_WIDTH,
+ int height = wxCHOICE_HEIGHT,
+ int initialSelection = 0);
+
+WXDLLIMPEXP_CORE int wxGetSingleChoiceIndex(const wxString& message,
+ const wxString& caption,
+ int n, const wxString *choices,
+ wxWindow *parent = NULL,
+ int x = wxDefaultCoord,
+ int y = wxDefaultCoord,
+ bool centre = true,
+ int width = wxCHOICE_WIDTH,
+ int height = wxCHOICE_HEIGHT,
+ int initialSelection = 0);
+
+WXDLLIMPEXP_CORE int wxGetSingleChoiceIndex(const wxString& message,
+ const wxString& caption,
+ const wxArrayString& choices,
+ int initialSelection,
+ wxWindow *parent = NULL);
+
+WXDLLIMPEXP_CORE int wxGetSingleChoiceIndex(const wxString& message,
+ const wxString& caption,
+ int n, const wxString *choices,
+ int initialSelection,
+ wxWindow *parent = NULL);
+
+// Return client data instead or NULL if canceled
+WXDLLIMPEXP_CORE void* wxGetSingleChoiceData(const wxString& message,
+ const wxString& caption,
+ const wxArrayString& choices,
+ void **client_data,
+ wxWindow *parent = NULL,
+ int x = wxDefaultCoord,
+ int y = wxDefaultCoord,
+ bool centre = true,
+ int width = wxCHOICE_WIDTH,
+ int height = wxCHOICE_HEIGHT,
+ int initialSelection = 0);
+
+WXDLLIMPEXP_CORE void* wxGetSingleChoiceData(const wxString& message,
+ const wxString& caption,
+ int n, const wxString *choices,
+ void **client_data,
+ wxWindow *parent = NULL,
+ int x = wxDefaultCoord,
+ int y = wxDefaultCoord,
+ bool centre = true,
+ int width = wxCHOICE_WIDTH,
+ int height = wxCHOICE_HEIGHT,
+ int initialSelection = 0);
+
+WXDLLIMPEXP_CORE void* wxGetSingleChoiceData(const wxString& message,
+ const wxString& caption,
+ const wxArrayString& choices,
+ void **client_data,
+ int initialSelection,
+ wxWindow *parent = NULL);
+
+
+WXDLLIMPEXP_CORE void* wxGetSingleChoiceData(const wxString& message,
+ const wxString& caption,
+ int n, const wxString *choices,
+ void **client_data,
+ int initialSelection,
+ wxWindow *parent = NULL);
+
+// fill the array with the indices of the chosen items, it will be empty
+// if no items were selected or Cancel was pressed - return the number of
+// selections or -1 if cancelled
+WXDLLIMPEXP_CORE int wxGetSelectedChoices(wxArrayInt& selections,
+ const wxString& message,
+ const wxString& caption,
+ int n, const wxString *choices,
+ wxWindow *parent = NULL,
+ int x = wxDefaultCoord,
+ int y = wxDefaultCoord,
+ bool centre = true,
+ int width = wxCHOICE_WIDTH,
+ int height = wxCHOICE_HEIGHT);
+
+WXDLLIMPEXP_CORE int wxGetSelectedChoices(wxArrayInt& selections,
+ const wxString& message,
+ const wxString& caption,
+ const wxArrayString& choices,
+ wxWindow *parent = NULL,
+ int x = wxDefaultCoord,
+ int y = wxDefaultCoord,
+ bool centre = true,
+ int width = wxCHOICE_WIDTH,
+ int height = wxCHOICE_HEIGHT);
+
+#if WXWIN_COMPATIBILITY_2_8
+// fill the array with the indices of the chosen items, it will be empty
+// if no items were selected or Cancel was pressed - return the number of
+// selections
+wxDEPRECATED( WXDLLIMPEXP_CORE size_t wxGetMultipleChoices(wxArrayInt& selections,
+ const wxString& message,
+ const wxString& caption,
+ int n, const wxString *choices,
+ wxWindow *parent = NULL,
+ int x = wxDefaultCoord,
+ int y = wxDefaultCoord,
+ bool centre = true,
+ int width = wxCHOICE_WIDTH,
+ int height = wxCHOICE_HEIGHT) );
+
+wxDEPRECATED( WXDLLIMPEXP_CORE size_t wxGetMultipleChoices(wxArrayInt& selections,
+ const wxString& message,
+ const wxString& caption,
+ const wxArrayString& choices,
+ wxWindow *parent = NULL,
+ int x = wxDefaultCoord,
+ int y = wxDefaultCoord,
+ bool centre = true,
+ int width = wxCHOICE_WIDTH,
+ int height = wxCHOICE_HEIGHT));
+#endif // WXWIN_COMPATIBILITY_2_8
+
+#endif // _WX_GENERIC_CHOICDGG_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/colrdlgg.h
+// Purpose: wxGenericColourDialog
+// Author: Julian Smart
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_COLORDLGG_H_
+#define _WX_COLORDLGG_H_
+
+#include "wx/gdicmn.h"
+#include "wx/dialog.h"
+
+#define wxID_ADD_CUSTOM 3000
+
+#if wxUSE_SLIDER
+
+ #define wxID_RED_SLIDER 3001
+ #define wxID_GREEN_SLIDER 3002
+ #define wxID_BLUE_SLIDER 3003
+
+ class WXDLLIMPEXP_FWD_CORE wxSlider;
+
+#endif // wxUSE_SLIDER
+
+class WXDLLIMPEXP_CORE wxGenericColourDialog : public wxDialog
+{
+public:
+ wxGenericColourDialog();
+ wxGenericColourDialog(wxWindow *parent,
+ wxColourData *data = NULL);
+ virtual ~wxGenericColourDialog();
+
+ bool Create(wxWindow *parent, wxColourData *data = NULL);
+
+ wxColourData &GetColourData() { return m_colourData; }
+
+ virtual int ShowModal();
+
+ // Internal functions
+ void OnMouseEvent(wxMouseEvent& event);
+ void OnPaint(wxPaintEvent& event);
+
+ virtual void CalculateMeasurements();
+ virtual void CreateWidgets();
+ virtual void InitializeColours();
+
+ virtual void PaintBasicColours(wxDC& dc);
+ virtual void PaintCustomColours(wxDC& dc);
+ virtual void PaintCustomColour(wxDC& dc);
+ virtual void PaintHighlight(wxDC& dc, bool draw);
+
+ virtual void OnBasicColourClick(int which);
+ virtual void OnCustomColourClick(int which);
+
+ void OnAddCustom(wxCommandEvent& event);
+
+#if wxUSE_SLIDER
+ void OnRedSlider(wxCommandEvent& event);
+ void OnGreenSlider(wxCommandEvent& event);
+ void OnBlueSlider(wxCommandEvent& event);
+#endif // wxUSE_SLIDER
+
+ void OnCloseWindow(wxCloseEvent& event);
+
+protected:
+ wxColourData m_colourData;
+
+ // Area reserved for grids of colours
+ wxRect m_standardColoursRect;
+ wxRect m_customColoursRect;
+ wxRect m_singleCustomColourRect;
+
+ // Size of each colour rectangle
+ wxPoint m_smallRectangleSize;
+
+ // For single customizable colour
+ wxPoint m_customRectangleSize;
+
+ // Grid spacing (between rectangles)
+ int m_gridSpacing;
+
+ // Section spacing (between left and right halves of dialog box)
+ int m_sectionSpacing;
+
+ // 48 'standard' colours
+ wxColour m_standardColours[48];
+
+ // 16 'custom' colours
+ wxColour m_customColours[16];
+
+ // Which colour is selected? An index into one of the two areas.
+ int m_colourSelection;
+ int m_whichKind; // 1 for standard colours, 2 for custom colours,
+
+#if wxUSE_SLIDER
+ wxSlider *m_redSlider;
+ wxSlider *m_greenSlider;
+ wxSlider *m_blueSlider;
+#endif // wxUSE_SLIDER
+
+ int m_buttonY;
+
+ int m_okButtonX;
+ int m_customButtonX;
+
+ // static bool colourDialogCancelled;
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxGenericColourDialog)
+};
+
+#endif // _WX_COLORDLGG_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/combo.h
+// Purpose: Generic wxComboCtrl
+// Author: Jaakko Salli
+// Modified by:
+// Created: Apr-30-2006
+// Copyright: (c) Jaakko Salli
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_COMBOCTRL_H_
+#define _WX_GENERIC_COMBOCTRL_H_
+
+#if wxUSE_COMBOCTRL
+
+// Only define generic if native doesn't have all the features
+#if !defined(wxCOMBOCONTROL_FULLY_FEATURED)
+
+// ----------------------------------------------------------------------------
+// Generic wxComboCtrl
+// ----------------------------------------------------------------------------
+
+#if defined(__WXUNIVERSAL__)
+
+// all actions of single line text controls are supported
+
+// popup/dismiss the choice window
+#define wxACTION_COMBOBOX_POPUP wxT("popup")
+#define wxACTION_COMBOBOX_DISMISS wxT("dismiss")
+
+#endif
+
+#include "wx/dcbuffer.h"
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[];
+
+class WXDLLIMPEXP_CORE wxGenericComboCtrl : public wxComboCtrlBase
+{
+public:
+ // ctors and such
+ wxGenericComboCtrl() : wxComboCtrlBase() { Init(); }
+
+ wxGenericComboCtrl(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxComboBoxNameStr)
+ : wxComboCtrlBase()
+ {
+ Init();
+
+ (void)Create(parent, id, value, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxComboBoxNameStr);
+
+ virtual ~wxGenericComboCtrl();
+
+ void SetCustomPaintWidth( int width );
+
+ virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const;
+
+ static int GetFeatures() { return wxComboCtrlFeatures::All; }
+
+#if defined(__WXUNIVERSAL__)
+ // we have our own input handler and our own actions
+ virtual bool PerformAction(const wxControlAction& action,
+ long numArg = 0l,
+ const wxString& strArg = wxEmptyString);
+#endif
+
+protected:
+
+ // Dummies for platform-specific wxTextEntry implementations
+#if defined(__WXUNIVERSAL__)
+ // Looks like there's nothing we need to override here
+#elif defined(__WXMOTIF__)
+ virtual WXWidget GetTextWidget() const { return NULL; }
+#elif defined(__WXGTK__)
+#if defined(__WXGTK20__)
+ virtual GtkEditable *GetEditable() const { return NULL; }
+ virtual GtkEntry *GetEntry() const { return NULL; }
+#endif
+#elif defined(__WXMAC__)
+ // Looks like there's nothing we need to override here
+#elif defined(__WXPM__)
+ virtual WXHWND GetEditHWND() const { return NULL; }
+#endif
+
+ // For better transparent background rendering
+ virtual bool HasTransparentBackground()
+ {
+ #if wxALWAYS_NATIVE_DOUBLE_BUFFER
+ #ifdef __WXGTK__
+ // Sanity check for GTK+
+ return IsDoubleBuffered();
+ #else
+ return true;
+ #endif
+ #else
+ return false;
+ #endif
+ }
+
+ // Mandatory virtuals
+ virtual void OnResize();
+
+ // Event handlers
+ void OnPaintEvent( wxPaintEvent& event );
+ void OnMouseEvent( wxMouseEvent& event );
+
+private:
+ void Init();
+
+ DECLARE_EVENT_TABLE()
+
+ DECLARE_DYNAMIC_CLASS(wxGenericComboCtrl)
+};
+
+
+#ifndef _WX_COMBOCONTROL_H_
+
+// If native wxComboCtrl was not defined, then prepare a simple
+// front-end so that wxRTTI works as expected.
+
+class WXDLLIMPEXP_CORE wxComboCtrl : public wxGenericComboCtrl
+{
+public:
+ wxComboCtrl() : wxGenericComboCtrl() {}
+
+ wxComboCtrl(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxComboBoxNameStr)
+ : wxGenericComboCtrl()
+ {
+ (void)Create(parent, id, value, pos, size, style, validator, name);
+ }
+
+ virtual ~wxComboCtrl() {}
+
+protected:
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxComboCtrl)
+};
+
+#endif // _WX_COMBOCONTROL_H_
+
+#else
+
+#define wxGenericComboCtrl wxComboCtrl
+
+#endif // !defined(wxCOMBOCONTROL_FULLY_FEATURED)
+
+#endif // wxUSE_COMBOCTRL
+#endif
+ // _WX_GENERIC_COMBOCTRL_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/custombgwin.h
+// Purpose: Generic implementation of wxCustomBackgroundWindow.
+// Author: Vadim Zeitlin
+// Created: 2011-10-10
+// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_CUSTOMBGWIN_H_
+#define _WX_GENERIC_CUSTOMBGWIN_H_
+
+#include "wx/bitmap.h"
+
+// A helper to avoid template bloat: this class contains all type-independent
+// code of wxCustomBackgroundWindow<> below.
+class wxCustomBackgroundWindowGenericBase : public wxCustomBackgroundWindowBase
+{
+public:
+ wxCustomBackgroundWindowGenericBase() { }
+
+protected:
+ void DoEraseBackground(wxEraseEvent& event, wxWindow* win)
+ {
+ wxDC& dc = *event.GetDC();
+
+ const wxSize clientSize = win->GetClientSize();
+ const wxSize bitmapSize = m_bitmapBg.GetSize();
+
+ for ( int x = 0; x < clientSize.x; x += bitmapSize.x )
+ {
+ for ( int y = 0; y < clientSize.y; y += bitmapSize.y )
+ {
+ dc.DrawBitmap(m_bitmapBg, x, y);
+ }
+ }
+ }
+
+
+ // The bitmap used for painting the background if valid.
+ wxBitmap m_bitmapBg;
+
+
+ wxDECLARE_NO_COPY_CLASS(wxCustomBackgroundWindowGenericBase);
+};
+
+// ----------------------------------------------------------------------------
+// wxCustomBackgroundWindow
+// ----------------------------------------------------------------------------
+
+template <class W>
+class wxCustomBackgroundWindow : public W,
+ public wxCustomBackgroundWindowGenericBase
+{
+public:
+ typedef W BaseWindowClass;
+
+ wxCustomBackgroundWindow() { }
+
+protected:
+ virtual void DoSetBackgroundBitmap(const wxBitmap& bmp)
+ {
+ m_bitmapBg = bmp;
+
+ if ( m_bitmapBg.IsOk() )
+ {
+ BaseWindowClass::Connect
+ (
+ wxEVT_ERASE_BACKGROUND,
+ wxEraseEventHandler(wxCustomBackgroundWindow::OnEraseBackground)
+ );
+ }
+ else
+ {
+ BaseWindowClass::Disconnect
+ (
+ wxEVT_ERASE_BACKGROUND,
+ wxEraseEventHandler(wxCustomBackgroundWindow::OnEraseBackground)
+ );
+ }
+ }
+
+private:
+ // Event handler for erasing the background which is only used when we have
+ // a valid background bitmap.
+ void OnEraseBackground(wxEraseEvent& event)
+ {
+ DoEraseBackground(event, this);
+ }
+
+
+ wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCustomBackgroundWindow, W);
+};
+
+#endif // _WX_GENERIC_CUSTOMBGWIN_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/dataview.h
+// Purpose: wxDataViewCtrl generic implementation header
+// Author: Robert Roebling
+// Modified By: Bo Yang
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __GENERICDATAVIEWCTRLH__
+#define __GENERICDATAVIEWCTRLH__
+
+#include "wx/defs.h"
+#include "wx/object.h"
+#include "wx/list.h"
+#include "wx/control.h"
+#include "wx/scrolwin.h"
+#include "wx/icon.h"
+#include "wx/vector.h"
+
+class WXDLLIMPEXP_FWD_ADV wxDataViewMainWindow;
+class WXDLLIMPEXP_FWD_ADV wxDataViewHeaderWindow;
+
+// ---------------------------------------------------------
+// wxDataViewColumn
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewColumn : public wxDataViewColumnBase
+{
+public:
+ wxDataViewColumn(const wxString& title,
+ wxDataViewRenderer *renderer,
+ unsigned int model_column,
+ int width = wxDVC_DEFAULT_WIDTH,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxDATAVIEW_COL_RESIZABLE)
+ : wxDataViewColumnBase(renderer, model_column),
+ m_title(title)
+ {
+ Init(width, align, flags);
+ }
+
+ wxDataViewColumn(const wxBitmap& bitmap,
+ wxDataViewRenderer *renderer,
+ unsigned int model_column,
+ int width = wxDVC_DEFAULT_WIDTH,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxDATAVIEW_COL_RESIZABLE)
+ : wxDataViewColumnBase(bitmap, renderer, model_column)
+ {
+ Init(width, align, flags);
+ }
+
+ // implement wxHeaderColumnBase methods
+ virtual void SetTitle(const wxString& title) { m_title = title; UpdateDisplay(); }
+ virtual wxString GetTitle() const { return m_title; }
+
+ virtual void SetWidth(int width) { m_width = width; UpdateDisplay(); }
+ virtual int GetWidth() const;
+
+ virtual void SetMinWidth(int minWidth) { m_minWidth = minWidth; UpdateDisplay(); }
+ virtual int GetMinWidth() const { return m_minWidth; }
+
+ virtual void SetAlignment(wxAlignment align) { m_align = align; UpdateDisplay(); }
+ virtual wxAlignment GetAlignment() const { return m_align; }
+
+ virtual void SetFlags(int flags) { m_flags = flags; UpdateDisplay(); }
+ virtual int GetFlags() const { return m_flags; }
+
+ virtual bool IsSortKey() const { return m_sort; }
+
+ virtual void UnsetAsSortKey();
+
+ virtual void SetSortOrder(bool ascending);
+
+ virtual bool IsSortOrderAscending() const { return m_sortAscending; }
+
+ virtual void SetBitmap( const wxBitmap& bitmap ) { wxDataViewColumnBase::SetBitmap(bitmap); UpdateDisplay(); }
+
+
+private:
+ // common part of all ctors
+ void Init(int width, wxAlignment align, int flags);
+
+ void UpdateDisplay();
+
+ wxString m_title;
+ int m_width,
+ m_minWidth;
+ wxAlignment m_align;
+ int m_flags;
+ bool m_sort,
+ m_sortAscending;
+
+ friend class wxDataViewHeaderWindowBase;
+ friend class wxDataViewHeaderWindow;
+ friend class wxDataViewHeaderWindowMSW;
+};
+
+// ---------------------------------------------------------
+// wxDataViewCtrl
+// ---------------------------------------------------------
+
+WX_DECLARE_LIST_WITH_DECL(wxDataViewColumn, wxDataViewColumnList,
+ class WXDLLIMPEXP_ADV);
+
+class WXDLLIMPEXP_ADV wxDataViewCtrl : public wxDataViewCtrlBase,
+ public wxScrollHelper
+{
+ friend class wxDataViewMainWindow;
+ friend class wxDataViewHeaderWindowBase;
+ friend class wxDataViewHeaderWindow;
+ friend class wxDataViewHeaderWindowMSW;
+ friend class wxDataViewColumn;
+
+public:
+ wxDataViewCtrl() : wxScrollHelper(this)
+ {
+ Init();
+ }
+
+ wxDataViewCtrl( wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxDataViewCtrlNameStr )
+ : wxScrollHelper(this)
+ {
+ Create(parent, id, pos, size, style, validator, name);
+ }
+
+ virtual ~wxDataViewCtrl();
+
+ void Init();
+
+ bool Create(wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxDataViewCtrlNameStr);
+
+ virtual bool AssociateModel( wxDataViewModel *model );
+
+ virtual bool AppendColumn( wxDataViewColumn *col );
+ virtual bool PrependColumn( wxDataViewColumn *col );
+ virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col );
+
+ virtual void DoSetExpanderColumn();
+ virtual void DoSetIndent();
+
+ virtual unsigned int GetColumnCount() const;
+ virtual wxDataViewColumn* GetColumn( unsigned int pos ) const;
+ virtual bool DeleteColumn( wxDataViewColumn *column );
+ virtual bool ClearColumns();
+ virtual int GetColumnPosition( const wxDataViewColumn *column ) const;
+
+ virtual wxDataViewColumn *GetSortingColumn() const;
+
+ virtual int GetSelectedItemsCount() const;
+ virtual int GetSelections( wxDataViewItemArray & sel ) const;
+ virtual void SetSelections( const wxDataViewItemArray & sel );
+ virtual void Select( const wxDataViewItem & item );
+ virtual void Unselect( const wxDataViewItem & item );
+ virtual bool IsSelected( const wxDataViewItem & item ) const;
+
+ virtual void SelectAll();
+ virtual void UnselectAll();
+
+ virtual void EnsureVisible( const wxDataViewItem & item,
+ const wxDataViewColumn *column = NULL );
+ virtual void HitTest( const wxPoint & point, wxDataViewItem & item,
+ wxDataViewColumn* &column ) const;
+ virtual wxRect GetItemRect( const wxDataViewItem & item,
+ const wxDataViewColumn *column = NULL ) const;
+
+ virtual bool SetRowHeight( int rowHeight );
+
+ virtual void Expand( const wxDataViewItem & item );
+ virtual void Collapse( const wxDataViewItem & item );
+ virtual bool IsExpanded( const wxDataViewItem & item ) const;
+
+ virtual void SetFocus();
+
+ virtual bool SetFont(const wxFont & font);
+
+#if wxUSE_DRAG_AND_DROP
+ virtual bool EnableDragSource( const wxDataFormat &format );
+ virtual bool EnableDropTarget( const wxDataFormat &format );
+#endif // wxUSE_DRAG_AND_DROP
+
+ virtual wxBorder GetDefaultBorder() const;
+
+ virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column);
+
+ // These methods are specific to generic wxDataViewCtrl implementation and
+ // should not be used in portable code.
+ wxColour GetAlternateRowColour() const { return m_alternateRowColour; }
+ void SetAlternateRowColour(const wxColour& colour);
+
+protected:
+ virtual void EnsureVisible( int row, int column );
+
+ // Notice that row here may be invalid (i.e. >= GetRowCount()), this is not
+ // an error and this function simply returns an invalid item in this case.
+ virtual wxDataViewItem GetItemByRow( unsigned int row ) const;
+ virtual int GetRowByItem( const wxDataViewItem & item ) const;
+
+ int GetSortingColumnIndex() const { return m_sortingColumnIdx; }
+ void SetSortingColumnIndex(int idx) { m_sortingColumnIdx = idx; }
+
+public: // utility functions not part of the API
+
+ // returns the "best" width for the idx-th column
+ unsigned int GetBestColumnWidth(int idx) const;
+
+ // called by header window after reorder
+ void ColumnMoved( wxDataViewColumn* col, unsigned int new_pos );
+
+ // update the display after a change to an individual column
+ void OnColumnChange(unsigned int idx);
+
+ // update after a change to the number of columns
+ void OnColumnsCountChanged();
+
+ wxWindow *GetMainWindow() { return (wxWindow*) m_clientArea; }
+
+ // return the index of the given column in m_cols
+ int GetColumnIndex(const wxDataViewColumn *column) const;
+
+ // Return the index of the column having the given model index.
+ int GetModelColumnIndex(unsigned int model_column) const;
+
+ // return the column displayed at the given position in the control
+ wxDataViewColumn *GetColumnAt(unsigned int pos) const;
+
+ virtual wxDataViewColumn *GetCurrentColumn() const;
+
+ virtual void OnInternalIdle();
+
+private:
+ virtual wxDataViewItem DoGetCurrentItem() const;
+ virtual void DoSetCurrentItem(const wxDataViewItem& item);
+
+ void InvalidateColBestWidths();
+ void InvalidateColBestWidth(int idx);
+ void UpdateColWidths();
+
+ wxDataViewColumnList m_cols;
+ // cached column best widths information, values are for
+ // respective columns from m_cols and the arrays have same size
+ struct CachedColWidthInfo
+ {
+ CachedColWidthInfo() : width(0), dirty(true) {}
+ int width; // cached width or 0 if not computed
+ bool dirty; // column was invalidated, header needs updating
+ };
+ wxVector<CachedColWidthInfo> m_colsBestWidths;
+ // This indicates that at least one entry in m_colsBestWidths has 'dirty'
+ // flag set. It's cheaper to check one flag in OnInternalIdle() than to
+ // iterate over m_colsBestWidths to check if anything needs to be done.
+ bool m_colsDirty;
+
+ wxDataViewModelNotifier *m_notifier;
+ wxDataViewMainWindow *m_clientArea;
+ wxDataViewHeaderWindow *m_headerArea;
+
+ // user defined color to draw row lines, may be invalid
+ wxColour m_alternateRowColour;
+
+ // the index of the column currently used for sorting or -1
+ int m_sortingColumnIdx;
+
+private:
+ void OnSize( wxSizeEvent &event );
+ virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size);
+
+ // we need to return a special WM_GETDLGCODE value to process just the
+ // arrows but let the other navigation characters through
+#ifdef __WXMSW__
+ virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
+#endif // __WXMSW__
+
+ WX_FORWARD_TO_SCROLL_HELPER()
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxDataViewCtrl)
+ wxDECLARE_NO_COPY_CLASS(wxDataViewCtrl);
+ DECLARE_EVENT_TABLE()
+};
+
+
+#endif // __GENERICDATAVIEWCTRLH__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/datectrl.h
+// Purpose: generic wxDatePickerCtrl implementation
+// Author: Andreas Pflug
+// Modified by:
+// Created: 2005-01-19
+// Copyright: (c) 2005 Andreas Pflug <pgadmin@pse-consulting.de>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_DATECTRL_H_
+#define _WX_GENERIC_DATECTRL_H_
+
+#include "wx/compositewin.h"
+
+class WXDLLIMPEXP_FWD_CORE wxComboCtrl;
+
+class WXDLLIMPEXP_FWD_ADV wxCalendarCtrl;
+class WXDLLIMPEXP_FWD_ADV wxCalendarComboPopup;
+
+class WXDLLIMPEXP_ADV wxDatePickerCtrlGeneric
+ : public wxCompositeWindow<wxDatePickerCtrlBase>
+{
+public:
+ // creating the control
+ wxDatePickerCtrlGeneric() { Init(); }
+ virtual ~wxDatePickerCtrlGeneric();
+ wxDatePickerCtrlGeneric(wxWindow *parent,
+ wxWindowID id,
+ const wxDateTime& date = wxDefaultDateTime,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxDatePickerCtrlNameStr)
+ {
+ Init();
+
+ (void)Create(parent, id, date, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxDateTime& date = wxDefaultDateTime,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxDatePickerCtrlNameStr);
+
+ // wxDatePickerCtrl methods
+ void SetValue(const wxDateTime& date);
+ wxDateTime GetValue() const;
+
+ bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const;
+ void SetRange(const wxDateTime &dt1, const wxDateTime &dt2);
+
+ bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime,
+ const wxDateTime& upperdate = wxDefaultDateTime);
+
+ // extra methods available only in this (generic) implementation
+ wxCalendarCtrl *GetCalendar() const;
+
+
+ // implementation only from now on
+ // -------------------------------
+
+ // overridden base class methods
+ virtual bool Destroy();
+
+protected:
+ virtual wxSize DoGetBestSize() const;
+
+private:
+ void Init();
+
+ // return the list of the windows composing this one
+ virtual wxWindowList GetCompositeWindowParts() const;
+
+ void OnText(wxCommandEvent &event);
+ void OnSize(wxSizeEvent& event);
+ void OnFocus(wxFocusEvent& event);
+
+#ifdef __WXOSX_COCOA__
+ virtual void OSXGenerateEvent(const wxDateTime& WXUNUSED(dt)) { }
+#endif
+
+ wxComboCtrl* m_combo;
+ wxCalendarComboPopup* m_popup;
+
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxDatePickerCtrlGeneric);
+};
+
+#endif // _WX_GENERIC_DATECTRL_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/dcpsg.h
+// Purpose: wxPostScriptDC class
+// Author: Julian Smart and others
+// Modified by:
+// Copyright: (c) Julian Smart and Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DCPSG_H_
+#define _WX_DCPSG_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT
+
+#include "wx/dc.h"
+#include "wx/dcprint.h"
+#include "wx/dialog.h"
+#include "wx/module.h"
+#include "wx/cmndata.h"
+#include "wx/strvararg.h"
+
+//-----------------------------------------------------------------------------
+// wxPostScriptDC
+//-----------------------------------------------------------------------------
+
+
+class WXDLLIMPEXP_CORE wxPostScriptDC : public wxDC
+{
+public:
+ wxPostScriptDC();
+
+ // Recommended constructor
+ wxPostScriptDC(const wxPrintData& printData);
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
+};
+
+class WXDLLIMPEXP_CORE wxPostScriptDCImpl : public wxDCImpl
+{
+public:
+ wxPostScriptDCImpl( wxPrinterDC *owner );
+ wxPostScriptDCImpl( wxPrinterDC *owner, const wxPrintData& data );
+ wxPostScriptDCImpl( wxPostScriptDC *owner );
+ wxPostScriptDCImpl( wxPostScriptDC *owner, const wxPrintData& data );
+
+ void Init();
+
+ virtual ~wxPostScriptDCImpl();
+
+ virtual bool Ok() const { return IsOk(); }
+ virtual bool IsOk() const;
+
+ bool CanDrawBitmap() const { return true; }
+
+ void Clear();
+ void SetFont( const wxFont& font );
+ void SetPen( const wxPen& pen );
+ void SetBrush( const wxBrush& brush );
+ void SetLogicalFunction( wxRasterOperationMode function );
+ void SetBackground( const wxBrush& brush );
+
+ void DestroyClippingRegion();
+
+ bool StartDoc(const wxString& message);
+ void EndDoc();
+ void StartPage();
+ void EndPage();
+
+ wxCoord GetCharHeight() const;
+ wxCoord GetCharWidth() const;
+ bool CanGetTextExtent() const { return true; }
+
+ // Resolution in pixels per logical inch
+ wxSize GetPPI() const;
+
+ virtual void ComputeScaleAndOrigin();
+
+ void SetBackgroundMode(int WXUNUSED(mode)) { }
+ void SetPalette(const wxPalette& WXUNUSED(palette)) { }
+
+ void SetPrintData(const wxPrintData& data);
+ wxPrintData& GetPrintData() { return m_printData; }
+
+ virtual int GetDepth() const { return 24; }
+
+ void PsPrint( const wxString& psdata );
+
+ // Overrridden for wxPrinterDC Impl
+
+ virtual int GetResolution() const;
+ virtual wxRect GetPaperRect() const;
+
+ virtual void* GetHandle() const { return NULL; }
+
+protected:
+ bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col,
+ wxFloodFillStyle style = wxFLOOD_SURFACE);
+ bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const;
+ void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
+ void DoCrossHair(wxCoord x, wxCoord y) ;
+ void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc);
+ void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea);
+ void DoDrawPoint(wxCoord x, wxCoord y);
+ void DoDrawLines(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
+ void DoDrawPolygon(int n, const wxPoint points[],
+ wxCoord xoffset = 0, wxCoord yoffset = 0,
+ wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
+ void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[],
+ wxCoord xoffset = 0, wxCoord yoffset = 0,
+ wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
+ void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
+ void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20);
+ void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
+#if wxUSE_SPLINES
+ void DoDrawSpline(const wxPointList *points);
+#endif
+ bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
+ wxDC *source, wxCoord xsrc, wxCoord ysrc,
+ wxRasterOperationMode rop = wxCOPY, bool useMask = false,
+ wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
+ void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
+ void DoDrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false);
+ void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
+ void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
+ void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
+ void DoSetDeviceClippingRegion( const wxRegion &WXUNUSED(clip))
+ {
+ wxFAIL_MSG( "not implemented" );
+ }
+ void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
+ wxCoord *descent = NULL,
+ wxCoord *externalLeading = NULL,
+ const wxFont *theFont = NULL) const;
+ void DoGetSize(int* width, int* height) const;
+ void DoGetSizeMM(int *width, int *height) const;
+
+ FILE* m_pstream; // PostScript output stream
+ unsigned char m_currentRed;
+ unsigned char m_currentGreen;
+ unsigned char m_currentBlue;
+ int m_pageNumber;
+ bool m_clipping;
+ double m_underlinePosition;
+ double m_underlineThickness;
+ wxPrintData m_printData;
+ double m_pageHeight;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPostScriptDCImpl)
+};
+
+#endif
+ // wxUSE_POSTSCRIPT && wxUSE_PRINTING_ARCHITECTURE
+
+#endif
+ // _WX_DCPSG_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/dirctrlg.h
+// Purpose: wxGenericDirCtrl class
+// Builds on wxDirCtrl class written by Robert Roebling for the
+// wxFile application, modified by Harm van der Heijden.
+// Further modified for Windows.
+// Author: Robert Roebling, Harm van der Heijden, Julian Smart et al
+// Modified by:
+// Created: 21/3/2000
+// Copyright: (c) Robert Roebling, Harm van der Heijden, Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DIRCTRL_H_
+#define _WX_DIRCTRL_H_
+
+#if wxUSE_DIRDLG
+
+#include "wx/treectrl.h"
+#include "wx/dialog.h"
+#include "wx/dirdlg.h"
+#include "wx/choice.h"
+
+//-----------------------------------------------------------------------------
+// classes
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
+class WXDLLIMPEXP_FWD_BASE wxHashTable;
+
+//-----------------------------------------------------------------------------
+// Extra styles for wxGenericDirCtrl
+//-----------------------------------------------------------------------------
+
+enum
+{
+ // Only allow directory viewing/selection, no files
+ wxDIRCTRL_DIR_ONLY = 0x0010,
+ // When setting the default path, select the first file in the directory
+ wxDIRCTRL_SELECT_FIRST = 0x0020,
+ // Show the filter list
+ wxDIRCTRL_SHOW_FILTERS = 0x0040,
+ // Use 3D borders on internal controls
+ wxDIRCTRL_3D_INTERNAL = 0x0080,
+ // Editable labels
+ wxDIRCTRL_EDIT_LABELS = 0x0100,
+ // Allow multiple selection
+ wxDIRCTRL_MULTIPLE = 0x0200
+};
+
+//-----------------------------------------------------------------------------
+// wxDirItemData
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDirItemData : public wxTreeItemData
+{
+public:
+ wxDirItemData(const wxString& path, const wxString& name, bool isDir);
+ virtual ~wxDirItemData(){}
+ void SetNewDirName(const wxString& path);
+
+ bool HasSubDirs() const;
+ bool HasFiles(const wxString& spec = wxEmptyString) const;
+
+ wxString m_path, m_name;
+ bool m_isHidden;
+ bool m_isExpanded;
+ bool m_isDir;
+};
+
+//-----------------------------------------------------------------------------
+// wxDirCtrl
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxDirFilterListCtrl;
+
+class WXDLLIMPEXP_CORE wxGenericDirCtrl: public wxControl
+{
+public:
+ wxGenericDirCtrl();
+ wxGenericDirCtrl(wxWindow *parent, const wxWindowID id = wxID_ANY,
+ const wxString &dir = wxDirDialogDefaultFolderStr,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDIRCTRL_3D_INTERNAL,
+ const wxString& filter = wxEmptyString,
+ int defaultFilter = 0,
+ const wxString& name = wxTreeCtrlNameStr )
+ {
+ Init();
+ Create(parent, id, dir, pos, size, style, filter, defaultFilter, name);
+ }
+
+ bool Create(wxWindow *parent, const wxWindowID id = wxID_ANY,
+ const wxString &dir = wxDirDialogDefaultFolderStr,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDIRCTRL_3D_INTERNAL,
+ const wxString& filter = wxEmptyString,
+ int defaultFilter = 0,
+ const wxString& name = wxTreeCtrlNameStr );
+
+ virtual void Init();
+
+ virtual ~wxGenericDirCtrl();
+
+ void OnExpandItem(wxTreeEvent &event );
+ void OnCollapseItem(wxTreeEvent &event );
+ void OnBeginEditItem(wxTreeEvent &event );
+ void OnEndEditItem(wxTreeEvent &event );
+ void OnTreeSelChange(wxTreeEvent &event);
+ void OnItemActivated(wxTreeEvent &event);
+ void OnSize(wxSizeEvent &event );
+
+ // Try to expand as much of the given path as possible.
+ virtual bool ExpandPath(const wxString& path);
+ // collapse the path
+ virtual bool CollapsePath(const wxString& path);
+
+ // Accessors
+
+ virtual inline wxString GetDefaultPath() const { return m_defaultPath; }
+ virtual void SetDefaultPath(const wxString& path) { m_defaultPath = path; }
+
+ // Get dir or filename
+ virtual wxString GetPath() const;
+ virtual void GetPaths(wxArrayString& paths) const;
+
+ // Get selected filename path only (else empty string).
+ // I.e. don't count a directory as a selection
+ virtual wxString GetFilePath() const;
+ virtual void GetFilePaths(wxArrayString& paths) const;
+ virtual void SetPath(const wxString& path);
+
+ virtual void SelectPath(const wxString& path, bool select = true);
+ virtual void SelectPaths(const wxArrayString& paths);
+
+ virtual void ShowHidden( bool show );
+ virtual bool GetShowHidden() { return m_showHidden; }
+
+ virtual wxString GetFilter() const { return m_filter; }
+ virtual void SetFilter(const wxString& filter);
+
+ virtual int GetFilterIndex() const { return m_currentFilter; }
+ virtual void SetFilterIndex(int n);
+
+ virtual wxTreeItemId GetRootId() { return m_rootId; }
+
+ virtual wxTreeCtrl* GetTreeCtrl() const { return m_treeCtrl; }
+ virtual wxDirFilterListCtrl* GetFilterListCtrl() const { return m_filterListCtrl; }
+
+ virtual void UnselectAll();
+
+ // Helper
+ virtual void SetupSections();
+
+ // Find the child that matches the first part of 'path'.
+ // E.g. if a child path is "/usr" and 'path' is "/usr/include"
+ // then the child for /usr is returned.
+ // If the path string has been used (we're at the leaf), done is set to true
+ virtual wxTreeItemId FindChild(wxTreeItemId parentId, const wxString& path, bool& done);
+
+ wxString GetPath(wxTreeItemId itemId) const;
+
+ // Resize the components of the control
+ virtual void DoResize();
+
+ // Collapse & expand the tree, thus re-creating it from scratch:
+ virtual void ReCreateTree();
+
+ // Collapse the entire tree
+ virtual void CollapseTree();
+
+ // overridden base class methods
+ virtual void SetFocus();
+
+protected:
+ virtual void ExpandRoot();
+ virtual void ExpandDir(wxTreeItemId parentId);
+ virtual void CollapseDir(wxTreeItemId parentId);
+ virtual const wxTreeItemId AddSection(const wxString& path, const wxString& name, int imageId = 0);
+ virtual wxTreeItemId AppendItem (const wxTreeItemId & parent,
+ const wxString & text,
+ int image = -1, int selectedImage = -1,
+ wxTreeItemData * data = NULL);
+ //void FindChildFiles(wxTreeItemId id, int dirFlags, wxArrayString& filenames);
+ virtual wxTreeCtrl* CreateTreeCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long treeStyle);
+
+ // Extract description and actual filter from overall filter string
+ bool ExtractWildcard(const wxString& filterStr, int n, wxString& filter, wxString& description);
+
+private:
+ void PopulateNode(wxTreeItemId node);
+ wxDirItemData* GetItemData(wxTreeItemId itemId);
+
+ bool m_showHidden;
+ wxTreeItemId m_rootId;
+ wxString m_defaultPath; // Starting path
+ long m_styleEx; // Extended style
+ wxString m_filter; // Wildcards in same format as per wxFileDialog
+ int m_currentFilter; // The current filter index
+ wxString m_currentFilterStr; // Current filter string
+ wxTreeCtrl* m_treeCtrl;
+ wxDirFilterListCtrl* m_filterListCtrl;
+
+private:
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxGenericDirCtrl)
+ wxDECLARE_NO_COPY_CLASS(wxGenericDirCtrl);
+};
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DIRCTRL_SELECTIONCHANGED, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DIRCTRL_FILEACTIVATED, wxTreeEvent );
+
+#define wx__DECLARE_DIRCTRL_EVT(evt, id, fn) \
+ wx__DECLARE_EVT1(wxEVT_DIRCTRL_ ## evt, id, wxTreeEventHandler(fn))
+
+#define EVT_DIRCTRL_SELECTIONCHANGED(id, fn) wx__DECLARE_DIRCTRL_EVT(SELECTIONCHANGED, id, fn)
+#define EVT_DIRCTRL_FILEACTIVATED(id, fn) wx__DECLARE_DIRCTRL_EVT(FILEACTIVATED, id, fn)
+
+//-----------------------------------------------------------------------------
+// wxDirFilterListCtrl
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDirFilterListCtrl: public wxChoice
+{
+public:
+ wxDirFilterListCtrl() { Init(); }
+ wxDirFilterListCtrl(wxGenericDirCtrl* parent, const wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0)
+ {
+ Init();
+ Create(parent, id, pos, size, style);
+ }
+
+ bool Create(wxGenericDirCtrl* parent, const wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0);
+
+ void Init();
+
+ virtual ~wxDirFilterListCtrl() {}
+
+ //// Operations
+ void FillFilterList(const wxString& filter, int defaultFilter);
+
+ //// Events
+ void OnSelFilter(wxCommandEvent& event);
+
+protected:
+ wxGenericDirCtrl* m_dirCtrl;
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_CLASS(wxDirFilterListCtrl)
+ wxDECLARE_NO_COPY_CLASS(wxDirFilterListCtrl);
+};
+
+#if !defined(__WXMSW__) && !defined(__WXMAC__) && !defined(__WXPM__)
+ #define wxDirCtrl wxGenericDirCtrl
+#endif
+
+// Symbols for accessing individual controls
+#define wxID_TREECTRL 7000
+#define wxID_FILTERLISTCTRL 7001
+
+#endif // wxUSE_DIRDLG
+
+//-------------------------------------------------------------------------
+// wxFileIconsTable - use wxTheFileIconsTable which is created as necessary
+//-------------------------------------------------------------------------
+
+#if wxUSE_DIRDLG || wxUSE_FILEDLG || wxUSE_FILECTRL
+
+class WXDLLIMPEXP_FWD_CORE wxImageList;
+
+class WXDLLIMPEXP_CORE wxFileIconsTable
+{
+public:
+ wxFileIconsTable();
+ ~wxFileIconsTable();
+
+ enum iconId_Type
+ {
+ folder,
+ folder_open,
+ computer,
+ drive,
+ cdrom,
+ floppy,
+ removeable,
+ file,
+ executable
+ };
+
+ int GetIconID(const wxString& extension, const wxString& mime = wxEmptyString);
+ wxImageList *GetSmallImageList();
+
+protected:
+ void Create(); // create on first use
+
+ wxImageList *m_smallImageList;
+ wxHashTable *m_HashTable;
+};
+
+// The global fileicons table
+extern WXDLLIMPEXP_DATA_CORE(wxFileIconsTable *) wxTheFileIconsTable;
+
+#endif // wxUSE_DIRDLG || wxUSE_FILEDLG || wxUSE_FILECTRL
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_DIRCTRL_SELECTIONCHANGED wxEVT_DIRCTRL_SELECTIONCHANGED
+#define wxEVT_COMMAND_DIRCTRL_FILEACTIVATED wxEVT_DIRCTRL_FILEACTIVATED
+
+#endif
+ // _WX_DIRCTRLG_H_
--- /dev/null
+//////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/dragimgg.h
+// Purpose: wxDragImage class: a kind of a cursor, that can cope
+// with more sophisticated images
+// Author: Julian Smart
+// Modified by:
+// Created: 29/2/2000
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DRAGIMGG_H_
+#define _WX_DRAGIMGG_H_
+
+#include "wx/bitmap.h"
+#include "wx/icon.h"
+#include "wx/cursor.h"
+#include "wx/treectrl.h"
+#include "wx/listctrl.h"
+#include "wx/log.h"
+#include "wx/overlay.h"
+
+/*
+ To use this class, create a wxDragImage when you start dragging, for example:
+
+ void MyTreeCtrl::OnBeginDrag(wxTreeEvent& event)
+ {
+#ifdef __WXMSW__
+ ::UpdateWindow((HWND) GetHWND()); // We need to implement this in wxWidgets
+#endif
+
+ CaptureMouse();
+
+ m_dragImage = new wxDragImage(* this, itemId);
+ m_dragImage->BeginDrag(wxPoint(0, 0), this);
+ m_dragImage->Move(pt, this);
+ m_dragImage->Show(this);
+ ...
+ }
+
+ In your OnMouseMove function, hide the image, do any display updating required,
+ then move and show the image again:
+
+ void MyTreeCtrl::OnMouseMove(wxMouseEvent& event)
+ {
+ if (m_dragMode == MY_TREE_DRAG_NONE)
+ {
+ event.Skip();
+ return;
+ }
+
+ // Prevent screen corruption by hiding the image
+ if (m_dragImage)
+ m_dragImage->Hide(this);
+
+ // Do some updating of the window, such as highlighting the drop target
+ ...
+
+#ifdef __WXMSW__
+ if (updateWindow)
+ ::UpdateWindow((HWND) GetHWND());
+#endif
+
+ // Move and show the image again
+ m_dragImage->Move(event.GetPosition(), this);
+ m_dragImage->Show(this);
+ }
+
+ Eventually we end the drag and delete the drag image.
+
+ void MyTreeCtrl::OnLeftUp(wxMouseEvent& event)
+ {
+ ...
+
+ // End the drag and delete the drag image
+ if (m_dragImage)
+ {
+ m_dragImage->EndDrag(this);
+ delete m_dragImage;
+ m_dragImage = NULL;
+ }
+ ReleaseMouse();
+ }
+*/
+
+/*
+ * wxGenericDragImage
+ */
+
+class WXDLLIMPEXP_CORE wxGenericDragImage: public wxObject
+{
+public:
+
+ // Ctors & dtor
+ ////////////////////////////////////////////////////////////////////////////
+
+ wxGenericDragImage(const wxCursor& cursor = wxNullCursor)
+ {
+ Init();
+ Create(cursor);
+ }
+
+ wxGenericDragImage(const wxBitmap& image, const wxCursor& cursor = wxNullCursor)
+ {
+ Init();
+
+ Create(image, cursor);
+ }
+
+ wxGenericDragImage(const wxIcon& image, const wxCursor& cursor = wxNullCursor)
+ {
+ Init();
+
+ Create(image, cursor);
+ }
+
+ wxGenericDragImage(const wxString& str, const wxCursor& cursor = wxNullCursor)
+ {
+ Init();
+
+ Create(str, cursor);
+ }
+
+#if WXWIN_COMPATIBILITY_2_6
+ // don't use in new code, use versions without hot spot parameter
+ wxDEPRECATED( wxGenericDragImage(const wxCursor& cursor, const wxPoint& cursorHotspot) );
+ wxDEPRECATED( wxGenericDragImage(const wxBitmap& image, const wxCursor& cursor, const wxPoint& cursorHotspot) );
+ wxDEPRECATED( wxGenericDragImage(const wxIcon& image, const wxCursor& cursor, const wxPoint& cursorHotspot) );
+ wxDEPRECATED( wxGenericDragImage(const wxString& str, const wxCursor& cursor, const wxPoint& cursorHotspot) );
+ wxDEPRECATED( bool Create(const wxCursor& cursor, const wxPoint& cursorHotspot) );
+ wxDEPRECATED( bool Create(const wxBitmap& image, const wxCursor& cursor, const wxPoint& cursorHotspot) );
+ wxDEPRECATED( bool Create(const wxIcon& image, const wxCursor& cursor, const wxPoint& cursorHotspot) );
+ wxDEPRECATED( bool Create(const wxString& str, const wxCursor& cursor, const wxPoint& cursorHotspot) );
+#endif // WXWIN_COMPATIBILITY_2_6
+
+#if wxUSE_TREECTRL
+ wxGenericDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id)
+ {
+ Init();
+
+ Create(treeCtrl, id);
+ }
+#endif
+
+#if wxUSE_LISTCTRL
+ wxGenericDragImage(const wxListCtrl& listCtrl, long id)
+ {
+ Init();
+
+ Create(listCtrl, id);
+ }
+#endif
+
+ virtual ~wxGenericDragImage();
+
+ // Attributes
+ ////////////////////////////////////////////////////////////////////////////
+
+#ifdef wxHAS_NATIVE_OVERLAY
+ // backing store is not used when native overlays are
+ void SetBackingBitmap(wxBitmap* WXUNUSED(bitmap)) { }
+#else
+ // For efficiency, tell wxGenericDragImage to use a bitmap that's already
+ // created (e.g. from last drag)
+ void SetBackingBitmap(wxBitmap* bitmap) { m_pBackingBitmap = bitmap; }
+#endif // wxHAS_NATIVE_OVERLAY/!wxHAS_NATIVE_OVERLAY
+
+ // Operations
+ ////////////////////////////////////////////////////////////////////////////
+
+ // Create a drag image with a virtual image (need to override DoDrawImage, GetImageRect)
+ bool Create(const wxCursor& cursor = wxNullCursor);
+
+ // Create a drag image from a bitmap and optional cursor
+ bool Create(const wxBitmap& image, const wxCursor& cursor = wxNullCursor);
+
+ // Create a drag image from an icon and optional cursor
+ bool Create(const wxIcon& image, const wxCursor& cursor = wxNullCursor);
+
+ // Create a drag image from a string and optional cursor
+ bool Create(const wxString& str, const wxCursor& cursor = wxNullCursor);
+
+#if wxUSE_TREECTRL
+ // Create a drag image for the given tree control item
+ bool Create(const wxTreeCtrl& treeCtrl, wxTreeItemId& id);
+#endif
+
+#if wxUSE_LISTCTRL
+ // Create a drag image for the given list control item
+ bool Create(const wxListCtrl& listCtrl, long id);
+#endif
+
+ // Begin drag. hotspot is the location of the drag position relative to the upper-left
+ // corner of the image.
+ bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = false, wxRect* rect = NULL);
+
+ // Begin drag. hotspot is the location of the drag position relative to the upper-left
+ // corner of the image. This is full screen only. fullScreenRect gives the
+ // position of the window on the screen, to restrict the drag to.
+ bool BeginDrag(const wxPoint& hotspot, wxWindow* window, wxWindow* fullScreenRect);
+
+ // End drag
+ bool EndDrag();
+
+ // Move the image: call from OnMouseMove. Pt is in window client coordinates if window
+ // is non-NULL, or in screen coordinates if NULL.
+ bool Move(const wxPoint& pt);
+
+ // Show the image
+ bool Show();
+
+ // Hide the image
+ bool Hide();
+
+ // Implementation
+ ////////////////////////////////////////////////////////////////////////////
+
+ void Init();
+
+ // Override this if you are using a virtual image (drawing your own image)
+ virtual wxRect GetImageRect(const wxPoint& pos) const;
+
+ // Override this if you are using a virtual image (drawing your own image)
+ virtual bool DoDrawImage(wxDC& dc, const wxPoint& pos) const;
+
+ // Override this if you wish to draw the window contents to the backing bitmap
+ // yourself. This can be desirable if you wish to avoid flicker by not having to
+ // redraw the window itself before dragging in order to be graphic-minus-dragged-objects.
+ // Instead, paint the drag image's backing bitmap to be correct, and leave the window
+ // to be updated only when dragging the objects away (thus giving a smoother appearance).
+ virtual bool UpdateBackingFromWindow(wxDC& windowDC, wxMemoryDC& destDC,
+ const wxRect& sourceRect, const wxRect& destRect) const;
+
+ // Erase and redraw simultaneously if possible
+ virtual bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos, bool eraseOld, bool drawNew);
+
+protected:
+ wxBitmap m_bitmap;
+ wxIcon m_icon;
+ wxCursor m_cursor;
+ wxCursor m_oldCursor;
+// wxPoint m_hotspot;
+ wxPoint m_offset; // The hostpot value passed to BeginDrag
+ wxPoint m_position;
+ bool m_isDirty;
+ bool m_isShown;
+ wxWindow* m_window;
+ wxDC* m_windowDC;
+
+#ifdef wxHAS_NATIVE_OVERLAY
+ wxOverlay m_overlay;
+ wxDCOverlay* m_dcOverlay;
+#else
+ // Stores the window contents while we're dragging the image around
+ wxBitmap m_backingBitmap;
+ wxBitmap* m_pBackingBitmap; // Pointer to existing backing bitmap
+ // (pass to wxGenericDragImage as an efficiency measure)
+ // A temporary bitmap for repairing/redrawing
+ wxBitmap m_repairBitmap;
+#endif // !wxHAS_NATIVE_OVERLAY
+
+ wxRect m_boundingRect;
+ bool m_fullScreen;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxGenericDragImage)
+ wxDECLARE_NO_COPY_CLASS(wxGenericDragImage);
+};
+
+#endif
+ // _WX_DRAGIMGG_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/dvrenderer.h
+// Purpose: wxDataViewRenderer for generic wxDataViewCtrl implementation
+// Author: Robert Roebling, Vadim Zeitlin
+// Created: 2009-11-07 (extracted from wx/generic/dataview.h)
+// Copyright: (c) 2006 Robert Roebling
+// (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_DVRENDERER_H_
+#define _WX_GENERIC_DVRENDERER_H_
+
+// ----------------------------------------------------------------------------
+// wxDataViewRenderer
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewCustomRendererBase
+{
+public:
+ wxDataViewRenderer( const wxString &varianttype,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+ virtual ~wxDataViewRenderer();
+
+ virtual wxDC *GetDC();
+
+ virtual void SetAlignment( int align );
+ virtual int GetAlignment() const;
+
+ virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE)
+ { m_ellipsizeMode = mode; }
+ virtual wxEllipsizeMode GetEllipsizeMode() const
+ { return m_ellipsizeMode; }
+
+ virtual void SetMode( wxDataViewCellMode mode )
+ { m_mode = mode; }
+ virtual wxDataViewCellMode GetMode() const
+ { return m_mode; }
+
+ // implementation
+
+ // This callback is used by generic implementation of wxDVC itself. It's
+ // different from the corresponding ActivateCell() method which should only
+ // be overridable for the custom renderers while the generic implementation
+ // uses this one for all of them, including the standard ones.
+
+ virtual bool WXActivateCell(const wxRect& WXUNUSED(cell),
+ wxDataViewModel *WXUNUSED(model),
+ const wxDataViewItem & WXUNUSED(item),
+ unsigned int WXUNUSED(col),
+ const wxMouseEvent* WXUNUSED(mouseEvent))
+ { return false; }
+
+private:
+ int m_align;
+ wxDataViewCellMode m_mode;
+
+ wxEllipsizeMode m_ellipsizeMode;
+
+ wxDC *m_dc;
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
+};
+
+#endif // _WX_GENERIC_DVRENDERER_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/dvrenderers.h
+// Purpose: All generic wxDataViewCtrl renderer classes
+// Author: Robert Roebling, Vadim Zeitlin
+// Created: 2009-11-07 (extracted from wx/generic/dataview.h)
+// Copyright: (c) 2006 Robert Roebling
+// (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_DVRENDERERS_H_
+#define _WX_GENERIC_DVRENDERERS_H_
+
+// ---------------------------------------------------------
+// wxDataViewCustomRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewCustomRenderer( const wxString &varianttype = wxT("string"),
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+
+ // see the explanation of the following WXOnXXX() methods in wx/generic/dvrenderer.h
+
+ virtual bool WXActivateCell(const wxRect& cell,
+ wxDataViewModel *model,
+ const wxDataViewItem& item,
+ unsigned int col,
+ const wxMouseEvent *mouseEvent)
+ {
+ return ActivateCell(cell, model, item, col, mouseEvent);
+ }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer)
+};
+
+
+// ---------------------------------------------------------
+// wxDataViewTextRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewTextRenderer( const wxString &varianttype = wxT("string"),
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+ bool SetValue( const wxVariant &value );
+ bool GetValue( wxVariant &value ) const;
+
+ virtual bool Render(wxRect cell, wxDC *dc, int state);
+ virtual wxSize GetSize() const;
+
+ // in-place editing
+ virtual bool HasEditorCtrl() const;
+ virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect,
+ const wxVariant &value );
+ virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value );
+
+protected:
+ wxString m_text;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewBitmapRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewBitmapRenderer( const wxString &varianttype = wxT("wxBitmap"),
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+ bool SetValue( const wxVariant &value );
+ bool GetValue( wxVariant &value ) const;
+
+ bool Render( wxRect cell, wxDC *dc, int state );
+ wxSize GetSize() const;
+
+private:
+ wxIcon m_icon;
+ wxBitmap m_bitmap;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewToggleRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewToggleRenderer( const wxString &varianttype = wxT("bool"),
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+ bool SetValue( const wxVariant &value );
+ bool GetValue( wxVariant &value ) const;
+
+ bool Render( wxRect cell, wxDC *dc, int state );
+ wxSize GetSize() const;
+
+ // Implementation only, don't use nor override
+ virtual bool WXActivateCell(const wxRect& cell,
+ wxDataViewModel *model,
+ const wxDataViewItem& item,
+ unsigned int col,
+ const wxMouseEvent *mouseEvent);
+private:
+ bool m_toggle;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewProgressRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewProgressRenderer( const wxString &label = wxEmptyString,
+ const wxString &varianttype = wxT("long"),
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+ bool SetValue( const wxVariant &value );
+ bool GetValue( wxVariant& value ) const;
+
+ virtual bool Render(wxRect cell, wxDC *dc, int state);
+ virtual wxSize GetSize() const;
+
+private:
+ wxString m_label;
+ int m_value;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewIconTextRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewIconTextRenderer( const wxString &varianttype = wxT("wxDataViewIconText"),
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+ bool SetValue( const wxVariant &value );
+ bool GetValue( wxVariant &value ) const;
+
+ virtual bool Render(wxRect cell, wxDC *dc, int state);
+ virtual wxSize GetSize() const;
+
+ virtual bool HasEditorCtrl() const { return true; }
+ virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect,
+ const wxVariant &value );
+ virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value );
+
+private:
+ wxDataViewIconText m_value;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer)
+};
+
+#endif // _WX_GENERIC_DVRENDERERS_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/fdrepdlg.h
+// Purpose: wxGenericFindReplaceDialog class
+// Author: Markus Greither
+// Modified by:
+// Created: 25/05/2001
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_FDREPDLG_H_
+#define _WX_GENERIC_FDREPDLG_H_
+
+class WXDLLIMPEXP_FWD_CORE wxCheckBox;
+class WXDLLIMPEXP_FWD_CORE wxRadioBox;
+class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
+
+// ----------------------------------------------------------------------------
+// wxGenericFindReplaceDialog: dialog for searching / replacing text
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxGenericFindReplaceDialog : public wxFindReplaceDialogBase
+{
+public:
+ wxGenericFindReplaceDialog() { Init(); }
+
+ wxGenericFindReplaceDialog(wxWindow *parent,
+ wxFindReplaceData *data,
+ const wxString& title,
+ int style = 0)
+ {
+ Init();
+
+ (void)Create(parent, data, title, style);
+ }
+
+ bool Create(wxWindow *parent,
+ wxFindReplaceData *data,
+ const wxString& title,
+ int style = 0);
+
+protected:
+ void Init();
+
+ void SendEvent(const wxEventType& evtType);
+
+ void OnFind(wxCommandEvent& event);
+ void OnReplace(wxCommandEvent& event);
+ void OnReplaceAll(wxCommandEvent& event);
+ void OnCancel(wxCommandEvent& event);
+
+ void OnUpdateFindUI(wxUpdateUIEvent& event);
+
+ void OnCloseWindow(wxCloseEvent& event);
+
+ wxCheckBox *m_chkCase,
+ *m_chkWord;
+
+ wxRadioBox *m_radioDir;
+
+ wxTextCtrl *m_textFind,
+ *m_textRepl;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxGenericFindReplaceDialog)
+
+ DECLARE_EVENT_TABLE()
+};
+
+#endif // _WX_GENERIC_FDREPDLG_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/filectrlg.h
+// Purpose: wxGenericFileCtrl Header
+// Author: Diaa M. Sami
+// Modified by:
+// Created: Jul-07-2007
+// Copyright: (c) Diaa M. Sami
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_FILECTRL_H_
+#define _WX_GENERIC_FILECTRL_H_
+
+#if wxUSE_FILECTRL
+
+#include "wx/containr.h"
+#include "wx/listctrl.h"
+#include "wx/filectrl.h"
+#include "wx/filename.h"
+
+class WXDLLIMPEXP_FWD_CORE wxCheckBox;
+class WXDLLIMPEXP_FWD_CORE wxChoice;
+class WXDLLIMPEXP_FWD_CORE wxStaticText;
+class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorDefaultWildcardStr[];
+
+//-----------------------------------------------------------------------------
+// wxFileData - a class to hold the file info for the wxFileListCtrl
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFileData
+{
+public:
+ enum fileType
+ {
+ is_file = 0x0000,
+ is_dir = 0x0001,
+ is_link = 0x0002,
+ is_exe = 0x0004,
+ is_drive = 0x0008
+ };
+
+ wxFileData() { Init(); }
+ // Full copy constructor
+ wxFileData( const wxFileData& fileData ) { Copy(fileData); }
+ // Create a filedata from this information
+ wxFileData( const wxString &filePath, const wxString &fileName,
+ fileType type, int image_id );
+
+ // make a full copy of the other wxFileData
+ void Copy( const wxFileData &other );
+
+ // (re)read the extra data about the file from the system
+ void ReadData();
+
+ // get the name of the file, dir, drive
+ wxString GetFileName() const { return m_fileName; }
+ // get the full path + name of the file, dir, path
+ wxString GetFilePath() const { return m_filePath; }
+ // Set the path + name and name of the item
+ void SetNewName( const wxString &filePath, const wxString &fileName );
+
+ // Get the size of the file in bytes
+ wxFileOffset GetSize() const { return m_size; }
+ // Get the type of file, either file extension or <DIR>, <LINK>, <DRIVE>
+ wxString GetFileType() const;
+ // get the last modification time
+ wxDateTime GetDateTime() const { return m_dateTime; }
+ // Get the time as a formatted string
+ wxString GetModificationTime() const;
+ // in UNIX get rwx for file, in MSW get attributes ARHS
+ wxString GetPermissions() const { return m_permissions; }
+ // Get the id of the image used in a wxImageList
+ int GetImageId() const { return m_image; }
+
+ bool IsFile() const { return !IsDir() && !IsLink() && !IsDrive(); }
+ bool IsDir() const { return (m_type & is_dir ) != 0; }
+ bool IsLink() const { return (m_type & is_link ) != 0; }
+ bool IsExe() const { return (m_type & is_exe ) != 0; }
+ bool IsDrive() const { return (m_type & is_drive) != 0; }
+
+ // Get/Set the type of file, file/dir/drive/link
+ int GetType() const { return m_type; }
+
+ // the wxFileListCtrl fields in report view
+ enum fileListFieldType
+ {
+ FileList_Name,
+ FileList_Size,
+ FileList_Type,
+ FileList_Time,
+#if defined(__UNIX__) || defined(__WIN32__)
+ FileList_Perm,
+#endif // defined(__UNIX__) || defined(__WIN32__)
+ FileList_Max
+ };
+
+ // Get the entry for report view of wxFileListCtrl
+ wxString GetEntry( fileListFieldType num ) const;
+
+ // Get a string representation of the file info
+ wxString GetHint() const;
+ // initialize a wxListItem attributes
+ void MakeItem( wxListItem &item );
+
+ // operators
+ wxFileData& operator = (const wxFileData& fd) { Copy(fd); return *this; }
+
+protected:
+ wxString m_fileName;
+ wxString m_filePath;
+ wxFileOffset m_size;
+ wxDateTime m_dateTime;
+ wxString m_permissions;
+ int m_type;
+ int m_image;
+
+private:
+ void Init();
+};
+
+//-----------------------------------------------------------------------------
+// wxFileListCtrl
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFileListCtrl : public wxListCtrl
+{
+public:
+ wxFileListCtrl();
+ wxFileListCtrl( wxWindow *win,
+ wxWindowID id,
+ const wxString &wild,
+ bool showHidden,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ long style = wxLC_LIST,
+ const wxValidator &validator = wxDefaultValidator,
+ const wxString &name = wxT("filelist") );
+ virtual ~wxFileListCtrl();
+
+ virtual void ChangeToListMode();
+ virtual void ChangeToReportMode();
+ virtual void ChangeToSmallIconMode();
+ virtual void ShowHidden( bool show = true );
+ bool GetShowHidden() const { return m_showHidden; }
+
+ virtual long Add( wxFileData *fd, wxListItem &item );
+ virtual void UpdateItem(const wxListItem &item);
+ virtual void UpdateFiles();
+ virtual void MakeDir();
+ virtual void GoToParentDir();
+ virtual void GoToHomeDir();
+ virtual void GoToDir( const wxString &dir );
+ virtual void SetWild( const wxString &wild );
+ wxString GetWild() const { return m_wild; }
+ wxString GetDir() const { return m_dirName; }
+
+ void OnListDeleteItem( wxListEvent &event );
+ void OnListDeleteAllItems( wxListEvent &event );
+ void OnListEndLabelEdit( wxListEvent &event );
+ void OnListColClick( wxListEvent &event );
+
+ virtual void SortItems(wxFileData::fileListFieldType field, bool forward);
+ bool GetSortDirection() const { return m_sort_forward; }
+ wxFileData::fileListFieldType GetSortField() const { return m_sort_field; }
+
+protected:
+ void FreeItemData(wxListItem& item);
+ void FreeAllItemsData();
+
+ wxString m_dirName;
+ bool m_showHidden;
+ wxString m_wild;
+
+ bool m_sort_forward;
+ wxFileData::fileListFieldType m_sort_field;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxFileListCtrl)
+ DECLARE_EVENT_TABLE()
+};
+
+class WXDLLIMPEXP_CORE wxGenericFileCtrl : public wxNavigationEnabled<wxControl>,
+ public wxFileCtrlBase
+{
+public:
+ wxGenericFileCtrl()
+ {
+ m_ignoreChanges = false;
+ }
+
+ wxGenericFileCtrl ( wxWindow *parent,
+ wxWindowID id,
+ const wxString& defaultDirectory = wxEmptyString,
+ const wxString& defaultFilename = wxEmptyString,
+ const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
+ long style = wxFC_DEFAULT_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ const wxString& name = wxFileCtrlNameStr )
+ {
+ m_ignoreChanges = false;
+ Create(parent, id, defaultDirectory, defaultFilename, wildCard,
+ style, pos, size, name );
+ }
+
+ virtual ~wxGenericFileCtrl() {}
+
+ bool Create( wxWindow *parent,
+ wxWindowID id,
+ const wxString& defaultDirectory = wxEmptyString,
+ const wxString& defaultFileName = wxEmptyString,
+ const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
+ long style = wxFC_DEFAULT_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ const wxString& name = wxFileCtrlNameStr );
+
+ virtual void SetWildcard( const wxString& wildCard );
+ virtual void SetFilterIndex( int filterindex );
+ virtual bool SetDirectory( const wxString& dir );
+
+ // Selects a certain file.
+ // In case the filename specified isn't found/couldn't be shown with
+ // currently selected filter, false is returned and nothing happens
+ virtual bool SetFilename( const wxString& name );
+
+ // Changes to a certain directory and selects a certain file.
+ // In case the filename specified isn't found/couldn't be shown with
+ // currently selected filter, false is returned and if directory exists
+ // it's chdir'ed to
+ virtual bool SetPath( const wxString& path );
+
+ virtual wxString GetFilename() const;
+ virtual wxString GetDirectory() const;
+ virtual wxString GetWildcard() const { return this->m_wildCard; }
+ virtual wxString GetPath() const;
+ virtual void GetPaths( wxArrayString& paths ) const;
+ virtual void GetFilenames( wxArrayString& files ) const;
+ virtual int GetFilterIndex() const { return m_filterIndex; }
+
+ virtual bool HasMultipleFileSelection() const
+ { return HasFlag(wxFC_MULTIPLE); }
+ virtual void ShowHidden(bool show) { m_list->ShowHidden( show ); }
+
+ void GoToParentDir();
+ void GoToHomeDir();
+
+ // get the directory currently shown in the control: this can be different
+ // from GetDirectory() if the user entered a full path (with a path other
+ // than the one currently shown in the control) in the text control
+ // manually
+ wxString GetShownDirectory() const { return m_list->GetDir(); }
+
+ wxFileListCtrl *GetFileList() { return m_list; }
+
+ void ChangeToReportMode() { m_list->ChangeToReportMode(); }
+ void ChangeToListMode() { m_list->ChangeToListMode(); }
+
+
+private:
+ void OnChoiceFilter( wxCommandEvent &event );
+ void OnCheck( wxCommandEvent &event );
+ void OnActivated( wxListEvent &event );
+ void OnTextEnter( wxCommandEvent &WXUNUSED( event ) );
+ void OnTextChange( wxCommandEvent &WXUNUSED( event ) );
+ void OnSelected( wxListEvent &event );
+ void HandleAction( const wxString &fn );
+
+ void DoSetFilterIndex( int filterindex );
+ void UpdateControls();
+
+ // the first of these methods can only be used for the controls with single
+ // selection (i.e. without wxFC_MULTIPLE style), the second one in any case
+ wxFileName DoGetFileName() const;
+ void DoGetFilenames( wxArrayString& filenames, bool fullPath ) const;
+
+ int m_style;
+
+ wxString m_filterExtension;
+ wxChoice *m_choice;
+ wxTextCtrl *m_text;
+ wxFileListCtrl *m_list;
+ wxCheckBox *m_check;
+ wxStaticText *m_static;
+
+ wxString m_dir;
+ wxString m_fileName;
+ wxString m_wildCard; // wild card in one string as we got it
+
+ int m_filterIndex;
+ bool m_inSelected;
+ bool m_ignoreChanges;
+ bool m_noSelChgEvent; // suppress selection changed events.
+
+ DECLARE_DYNAMIC_CLASS( wxGenericFileCtrl )
+ DECLARE_EVENT_TABLE()
+};
+
+#endif // wxUSE_FILECTRL
+
+#endif // _WX_GENERIC_FILECTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/filepickerg.h
+// Purpose: wxGenericFileDirButton, wxGenericFileButton, wxGenericDirButton
+// Author: Francesco Montorsi
+// Modified by:
+// Created: 14/4/2006
+// Copyright: (c) Francesco Montorsi
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FILEDIRPICKER_H_
+#define _WX_FILEDIRPICKER_H_
+
+#include "wx/button.h"
+#include "wx/filedlg.h"
+#include "wx/dirdlg.h"
+
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DIRPICKER_CHANGED, wxFileDirPickerEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILEPICKER_CHANGED, wxFileDirPickerEvent );
+
+
+//-----------------------------------------------------------------------------
+// wxGenericFileDirButton: a button which brings up a wx{File|Dir}Dialog
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxGenericFileDirButton : public wxButton,
+ public wxFileDirPickerWidgetBase
+{
+public:
+ wxGenericFileDirButton() { Init(); }
+ wxGenericFileDirButton(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label = wxFilePickerWidgetLabel,
+ const wxString& path = wxEmptyString,
+ const wxString &message = wxFileSelectorPromptStr,
+ const wxString &wildcard = wxFileSelectorDefaultWildcardStr,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxFilePickerWidgetNameStr)
+ {
+ Init();
+ Create(parent, id, label, path, message, wildcard,
+ pos, size, style, validator, name);
+ }
+
+ virtual wxControl *AsControl() { return this; }
+
+public: // overridable
+
+ virtual wxDialog *CreateDialog() = 0;
+
+ virtual wxWindow *GetDialogParent()
+ { return GetParent(); }
+
+ virtual wxEventType GetEventType() const = 0;
+
+ virtual void SetInitialDirectory(const wxString& dir);
+
+public:
+
+ bool Create(wxWindow *parent, wxWindowID id,
+ const wxString& label = wxFilePickerWidgetLabel,
+ const wxString& path = wxEmptyString,
+ const wxString &message = wxFileSelectorPromptStr,
+ const wxString &wildcard = wxFileSelectorDefaultWildcardStr,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxFilePickerWidgetNameStr);
+
+ // event handler for the click
+ void OnButtonClick(wxCommandEvent &);
+
+protected:
+ wxString m_message, m_wildcard;
+
+ // we just store the style passed to the ctor here instead of passing it to
+ // wxButton as some of our bits can conflict with wxButton styles and it
+ // just doesn't make sense to use picker styles for wxButton anyhow
+ long m_pickerStyle;
+
+ // Initial directory set by SetInitialDirectory() call or empty.
+ wxString m_initialDir;
+
+private:
+ // common part of all ctors
+ void Init() { m_pickerStyle = -1; }
+};
+
+
+//-----------------------------------------------------------------------------
+// wxGenericFileButton: a button which brings up a wxFileDialog
+//-----------------------------------------------------------------------------
+
+#define wxFILEBTN_DEFAULT_STYLE (wxFLP_OPEN)
+
+class WXDLLIMPEXP_CORE wxGenericFileButton : public wxGenericFileDirButton
+{
+public:
+ wxGenericFileButton() {}
+ wxGenericFileButton(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label = wxFilePickerWidgetLabel,
+ const wxString& path = wxEmptyString,
+ const wxString &message = wxFileSelectorPromptStr,
+ const wxString &wildcard = wxFileSelectorDefaultWildcardStr,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxFILEBTN_DEFAULT_STYLE,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxFilePickerWidgetNameStr)
+ {
+ Create(parent, id, label, path, message, wildcard,
+ pos, size, style, validator, name);
+ }
+
+public: // overridable
+
+ virtual long GetDialogStyle() const
+ {
+ // the derived class must initialize it if it doesn't use the
+ // non-default wxGenericFileDirButton ctor
+ wxASSERT_MSG( m_pickerStyle != -1,
+ "forgot to initialize m_pickerStyle?" );
+
+
+ long filedlgstyle = 0;
+
+ if ( m_pickerStyle & wxFLP_OPEN )
+ filedlgstyle |= wxFD_OPEN;
+ if ( m_pickerStyle & wxFLP_SAVE )
+ filedlgstyle |= wxFD_SAVE;
+ if ( m_pickerStyle & wxFLP_OVERWRITE_PROMPT )
+ filedlgstyle |= wxFD_OVERWRITE_PROMPT;
+ if ( m_pickerStyle & wxFLP_FILE_MUST_EXIST )
+ filedlgstyle |= wxFD_FILE_MUST_EXIST;
+ if ( m_pickerStyle & wxFLP_CHANGE_DIR )
+ filedlgstyle |= wxFD_CHANGE_DIR;
+
+ return filedlgstyle;
+ }
+
+ virtual wxDialog *CreateDialog();
+
+ wxEventType GetEventType() const
+ { return wxEVT_FILEPICKER_CHANGED; }
+
+protected:
+ void UpdateDialogPath(wxDialog *p)
+ { wxStaticCast(p, wxFileDialog)->SetPath(m_path); }
+ void UpdatePathFromDialog(wxDialog *p)
+ { m_path = wxStaticCast(p, wxFileDialog)->GetPath(); }
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxGenericFileButton)
+};
+
+
+//-----------------------------------------------------------------------------
+// wxGenericDirButton: a button which brings up a wxDirDialog
+//-----------------------------------------------------------------------------
+
+#define wxDIRBTN_DEFAULT_STYLE 0
+
+class WXDLLIMPEXP_CORE wxGenericDirButton : public wxGenericFileDirButton
+{
+public:
+ wxGenericDirButton() {}
+ wxGenericDirButton(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label = wxDirPickerWidgetLabel,
+ const wxString& path = wxEmptyString,
+ const wxString &message = wxDirSelectorPromptStr,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDIRBTN_DEFAULT_STYLE,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxDirPickerWidgetNameStr)
+ {
+ Create(parent, id, label, path, message, wxEmptyString,
+ pos, size, style, validator, name);
+ }
+
+public: // overridable
+
+ virtual long GetDialogStyle() const
+ {
+ long dirdlgstyle = wxDD_DEFAULT_STYLE;
+
+ if ( m_pickerStyle & wxDIRP_DIR_MUST_EXIST )
+ dirdlgstyle |= wxDD_DIR_MUST_EXIST;
+ if ( m_pickerStyle & wxDIRP_CHANGE_DIR )
+ dirdlgstyle |= wxDD_CHANGE_DIR;
+
+ return dirdlgstyle;
+ }
+
+ virtual wxDialog *CreateDialog();
+
+ wxEventType GetEventType() const
+ { return wxEVT_DIRPICKER_CHANGED; }
+
+protected:
+ void UpdateDialogPath(wxDialog *p)
+ { wxStaticCast(p, wxDirDialog)->SetPath(m_path); }
+ void UpdatePathFromDialog(wxDialog *p)
+ { m_path = wxStaticCast(p, wxDirDialog)->GetPath(); }
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxGenericDirButton)
+};
+
+// old wxEVT_COMMAND_* constants
+//#define wxEVT_COMMAND_DIRPICKER_CHANGED wxEVT_DIRPICKER_CHANGED
+//#define wxEVT_COMMAND_FILEPICKER_CHANGED wxEVT_FILEPICKER_CHANGED
+
+#endif // _WX_FILEDIRPICKER_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/fontdlgg.h
+// Purpose: wxGenericFontDialog
+// Author: Julian Smart
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_FONTDLGG_H
+#define _WX_GENERIC_FONTDLGG_H
+
+#include "wx/gdicmn.h"
+#include "wx/font.h"
+
+#ifdef __WXWINCE__
+#define USE_SPINCTRL_FOR_POINT_SIZE 1
+class WXDLLIMPEXP_FWD_CORE wxSpinEvent;
+#else
+#define USE_SPINCTRL_FOR_POINT_SIZE 0
+#endif
+
+/*
+ * FONT DIALOG
+ */
+
+class WXDLLIMPEXP_FWD_CORE wxChoice;
+class WXDLLIMPEXP_FWD_CORE wxText;
+class WXDLLIMPEXP_FWD_CORE wxCheckBox;
+class WXDLLIMPEXP_FWD_CORE wxFontPreviewer;
+
+enum
+{
+ wxID_FONT_UNDERLINE = 3000,
+ wxID_FONT_STYLE,
+ wxID_FONT_WEIGHT,
+ wxID_FONT_FAMILY,
+ wxID_FONT_COLOUR,
+ wxID_FONT_SIZE
+};
+
+class WXDLLIMPEXP_CORE wxGenericFontDialog : public wxFontDialogBase
+{
+public:
+ wxGenericFontDialog() { Init(); }
+ wxGenericFontDialog(wxWindow *parent)
+ : wxFontDialogBase(parent) { Init(); }
+ wxGenericFontDialog(wxWindow *parent, const wxFontData& data)
+ : wxFontDialogBase(parent, data) { Init(); }
+ virtual ~wxGenericFontDialog();
+
+ virtual int ShowModal();
+
+#if WXWIN_COMPATIBILITY_2_6
+ // deprecated, for backwards compatibility only
+ wxDEPRECATED( wxGenericFontDialog(wxWindow *parent, const wxFontData *data) );
+#endif // WXWIN_COMPATIBILITY_2_6
+
+ // Internal functions
+ void OnCloseWindow(wxCloseEvent& event);
+
+ virtual void CreateWidgets();
+ virtual void InitializeFont();
+
+ void OnChangeFont(wxCommandEvent& event);
+
+#if USE_SPINCTRL_FOR_POINT_SIZE
+ void OnChangeSize(wxSpinEvent& event);
+#endif
+
+protected:
+
+ virtual bool DoCreate(wxWindow *parent);
+
+private:
+
+ // common part of all ctors
+ void Init();
+
+ void DoChangeFont();
+
+ wxFont m_dialogFont;
+
+ wxChoice *m_familyChoice;
+ wxChoice *m_styleChoice;
+ wxChoice *m_weightChoice;
+ wxChoice *m_colourChoice;
+ wxCheckBox *m_underLineCheckBox;
+
+#if !USE_SPINCTRL_FOR_POINT_SIZE
+ wxChoice *m_pointSizeChoice;
+#endif
+
+ wxFontPreviewer *m_previewer;
+ bool m_useEvents;
+
+ // static bool fontDialogCancelled;
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxGenericFontDialog)
+};
+
+#if WXWIN_COMPATIBILITY_2_6
+ // deprecated, for backwards compatibility only
+inline wxGenericFontDialog::wxGenericFontDialog(wxWindow *parent, const wxFontData *data)
+ :wxFontDialogBase(parent) { Init(); InitFontData(data); Create(parent); }
+#endif // WXWIN_COMPATIBILITY_2_6
+
+#endif // _WX_GENERIC_FONTDLGG_H
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/fswatcher.h
+// Purpose: wxPollingFileSystemWatcher
+// Author: Bartosz Bekier
+// Created: 2009-05-26
+// Copyright: (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FSWATCHER_GENERIC_H_
+#define _WX_FSWATCHER_GENERIC_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_FSWATCHER
+
+class WXDLLIMPEXP_BASE wxPollingFileSystemWatcher : public wxFileSystemWatcherBase
+{
+public:
+
+};
+
+#endif // wxUSE_FSWATCHER
+
+#endif /* _WX_FSWATCHER_GENERIC_H_ */
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/grid.h
+// Purpose: wxGrid and related classes
+// Author: Michael Bedward (based on code by Julian Smart, Robin Dunn)
+// Modified by: Santiago Palacios
+// Created: 1/08/1999
+// Copyright: (c) Michael Bedward
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_GRID_H_
+#define _WX_GENERIC_GRID_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_GRID
+
+#include "wx/hashmap.h"
+
+#include "wx/scrolwin.h"
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+extern WXDLLIMPEXP_DATA_ADV(const char) wxGridNameStr[];
+
+// Default parameters for wxGrid
+//
+#define WXGRID_DEFAULT_NUMBER_ROWS 10
+#define WXGRID_DEFAULT_NUMBER_COLS 10
+#if defined(__WXMSW__) || defined(__WXGTK20__)
+#define WXGRID_DEFAULT_ROW_HEIGHT 25
+#else
+#define WXGRID_DEFAULT_ROW_HEIGHT 30
+#endif // __WXMSW__
+#define WXGRID_DEFAULT_COL_WIDTH 80
+#define WXGRID_DEFAULT_COL_LABEL_HEIGHT 32
+#define WXGRID_DEFAULT_ROW_LABEL_WIDTH 82
+#define WXGRID_LABEL_EDGE_ZONE 2
+#define WXGRID_MIN_ROW_HEIGHT 15
+#define WXGRID_MIN_COL_WIDTH 15
+#define WXGRID_DEFAULT_SCROLLBAR_WIDTH 16
+
+// type names for grid table values
+#define wxGRID_VALUE_STRING wxT("string")
+#define wxGRID_VALUE_BOOL wxT("bool")
+#define wxGRID_VALUE_NUMBER wxT("long")
+#define wxGRID_VALUE_FLOAT wxT("double")
+#define wxGRID_VALUE_CHOICE wxT("choice")
+
+#define wxGRID_VALUE_TEXT wxGRID_VALUE_STRING
+#define wxGRID_VALUE_LONG wxGRID_VALUE_NUMBER
+
+// magic constant which tells (to some functions) to automatically calculate
+// the appropriate size
+#define wxGRID_AUTOSIZE (-1)
+
+// many wxGrid methods work either with columns or rows, this enum is used for
+// the parameter indicating which one should it be
+enum wxGridDirection
+{
+ wxGRID_COLUMN,
+ wxGRID_ROW
+};
+
+// Flags used with wxGrid::Render() to select parts of the grid to draw.
+enum wxGridRenderStyle
+{
+ wxGRID_DRAW_ROWS_HEADER = 0x001,
+ wxGRID_DRAW_COLS_HEADER = 0x002,
+ wxGRID_DRAW_CELL_LINES = 0x004,
+ wxGRID_DRAW_BOX_RECT = 0x008,
+ wxGRID_DRAW_SELECTION = 0x010,
+ wxGRID_DRAW_DEFAULT = wxGRID_DRAW_ROWS_HEADER |
+ wxGRID_DRAW_COLS_HEADER |
+ wxGRID_DRAW_CELL_LINES |
+ wxGRID_DRAW_BOX_RECT
+};
+
+// ----------------------------------------------------------------------------
+// forward declarations
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_ADV wxGrid;
+class WXDLLIMPEXP_FWD_ADV wxGridCellAttr;
+class WXDLLIMPEXP_FWD_ADV wxGridCellAttrProviderData;
+class WXDLLIMPEXP_FWD_ADV wxGridColLabelWindow;
+class WXDLLIMPEXP_FWD_ADV wxGridCornerLabelWindow;
+class WXDLLIMPEXP_FWD_ADV wxGridRowLabelWindow;
+class WXDLLIMPEXP_FWD_ADV wxGridWindow;
+class WXDLLIMPEXP_FWD_ADV wxGridTypeRegistry;
+class WXDLLIMPEXP_FWD_ADV wxGridSelection;
+
+class WXDLLIMPEXP_FWD_CORE wxHeaderCtrl;
+class WXDLLIMPEXP_FWD_CORE wxCheckBox;
+class WXDLLIMPEXP_FWD_CORE wxComboBox;
+class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
+#if wxUSE_SPINCTRL
+class WXDLLIMPEXP_FWD_CORE wxSpinCtrl;
+#endif
+
+class wxGridFixedIndicesSet;
+
+class wxGridOperations;
+class wxGridRowOperations;
+class wxGridColumnOperations;
+class wxGridDirectionOperations;
+
+
+// ----------------------------------------------------------------------------
+// macros
+// ----------------------------------------------------------------------------
+
+#define wxSafeIncRef(p) if ( p ) (p)->IncRef()
+#define wxSafeDecRef(p) if ( p ) (p)->DecRef()
+
+// ----------------------------------------------------------------------------
+// wxGridCellWorker: common base class for wxGridCellRenderer and
+// wxGridCellEditor
+//
+// NB: this is more an implementation convenience than a design issue, so this
+// class is not documented and is not public at all
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxGridCellWorker : public wxClientDataContainer, public wxRefCounter
+{
+public:
+ wxGridCellWorker() { }
+
+ // interpret renderer parameters: arbitrary string whose interpretation is
+ // left to the derived classes
+ virtual void SetParameters(const wxString& params);
+
+protected:
+ // virtual dtor for any base class - private because only DecRef() can
+ // delete us
+ virtual ~wxGridCellWorker();
+
+private:
+ // suppress the stupid gcc warning about the class having private dtor and
+ // no friends
+ friend class wxGridCellWorkerDummyFriend;
+};
+
+// ----------------------------------------------------------------------------
+// wxGridCellRenderer: this class is responsible for actually drawing the cell
+// in the grid. You may pass it to the wxGridCellAttr (below) to change the
+// format of one given cell or to wxGrid::SetDefaultRenderer() to change the
+// view of all cells. This is an ABC, you will normally use one of the
+// predefined derived classes or derive your own class from it.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxGridCellRenderer : public wxGridCellWorker
+{
+public:
+ // draw the given cell on the provided DC inside the given rectangle
+ // using the style specified by the attribute and the default or selected
+ // state corresponding to the isSelected value.
+ //
+ // this pure virtual function has a default implementation which will
+ // prepare the DC using the given attribute: it will draw the rectangle
+ // with the bg colour from attr and set the text colour and font
+ virtual void Draw(wxGrid& grid,
+ wxGridCellAttr& attr,
+ wxDC& dc,
+ const wxRect& rect,
+ int row, int col,
+ bool isSelected) = 0;
+
+ // get the preferred size of the cell for its contents
+ virtual wxSize GetBestSize(wxGrid& grid,
+ wxGridCellAttr& attr,
+ wxDC& dc,
+ int row, int col) = 0;
+
+ // create a new object which is the copy of this one
+ virtual wxGridCellRenderer *Clone() const = 0;
+};
+
+// ----------------------------------------------------------------------------
+// wxGridCellEditor: This class is responsible for providing and manipulating
+// the in-place edit controls for the grid. Instances of wxGridCellEditor
+// (actually, instances of derived classes since it is an ABC) can be
+// associated with the cell attributes for individual cells, rows, columns, or
+// even for the entire grid.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxGridCellEditor : public wxGridCellWorker
+{
+public:
+ wxGridCellEditor();
+
+ bool IsCreated() const { return m_control != NULL; }
+ wxControl* GetControl() const { return m_control; }
+ void SetControl(wxControl* control) { m_control = control; }
+
+ wxGridCellAttr* GetCellAttr() const { return m_attr; }
+ void SetCellAttr(wxGridCellAttr* attr) { m_attr = attr; }
+
+ // Creates the actual edit control
+ virtual void Create(wxWindow* parent,
+ wxWindowID id,
+ wxEvtHandler* evtHandler) = 0;
+
+ // Size and position the edit control
+ virtual void SetSize(const wxRect& rect);
+
+ // Show or hide the edit control, use the specified attributes to set
+ // colours/fonts for it
+ virtual void Show(bool show, wxGridCellAttr *attr = NULL);
+
+ // Draws the part of the cell not occupied by the control: the base class
+ // version just fills it with background colour from the attribute
+ virtual void PaintBackground(wxDC& dc,
+ const wxRect& rectCell,
+ const wxGridCellAttr& attr);
+
+
+ // The methods called by wxGrid when a cell is edited: first BeginEdit() is
+ // called, then EndEdit() is and if it returns true and if the change is
+ // not vetoed by a user-defined event handler, finally ApplyEdit() is called
+
+ // Fetch the value from the table and prepare the edit control
+ // to begin editing. Set the focus to the edit control.
+ virtual void BeginEdit(int row, int col, wxGrid* grid) = 0;
+
+ // Returns false if nothing changed, otherwise returns true and return the
+ // new value in its string form in the newval output parameter.
+ //
+ // This should also store the new value in its real type internally so that
+ // it could be used by ApplyEdit() but it must not modify the grid as the
+ // change could still be vetoed.
+ virtual bool EndEdit(int row, int col, const wxGrid *grid,
+ const wxString& oldval, wxString *newval) = 0;
+
+ // Complete the editing of the current cell by storing the value saved by
+ // the previous call to EndEdit() in the grid
+ virtual void ApplyEdit(int row, int col, wxGrid* grid) = 0;
+
+
+ // Reset the value in the control back to its starting value
+ virtual void Reset() = 0;
+
+ // return true to allow the given key to start editing: the base class
+ // version only checks that the event has no modifiers. The derived
+ // classes are supposed to do "if ( base::IsAcceptedKey() && ... )" in
+ // their IsAcceptedKey() implementation, although, of course, it is not a
+ // mandatory requirment.
+ //
+ // NB: if the key is F2 (special), editing will always start and this
+ // method will not be called at all (but StartingKey() will)
+ virtual bool IsAcceptedKey(wxKeyEvent& event);
+
+ // If the editor is enabled by pressing keys on the grid, this will be
+ // called to let the editor do something about that first key if desired
+ virtual void StartingKey(wxKeyEvent& event);
+
+ // if the editor is enabled by clicking on the cell, this method will be
+ // called
+ virtual void StartingClick();
+
+ // Some types of controls on some platforms may need some help
+ // with the Return key.
+ virtual void HandleReturn(wxKeyEvent& event);
+
+ // Final cleanup
+ virtual void Destroy();
+
+ // create a new object which is the copy of this one
+ virtual wxGridCellEditor *Clone() const = 0;
+
+ // added GetValue so we can get the value which is in the control
+ virtual wxString GetValue() const = 0;
+
+protected:
+ // the dtor is private because only DecRef() can delete us
+ virtual ~wxGridCellEditor();
+
+ // the control we show on screen
+ wxControl* m_control;
+
+ // a temporary pointer to the attribute being edited
+ wxGridCellAttr* m_attr;
+
+ // if we change the colours/font of the control from the default ones, we
+ // must restore the default later and we save them here between calls to
+ // Show(true) and Show(false)
+ wxColour m_colFgOld,
+ m_colBgOld;
+ wxFont m_fontOld;
+
+ // suppress the stupid gcc warning about the class having private dtor and
+ // no friends
+ friend class wxGridCellEditorDummyFriend;
+
+ wxDECLARE_NO_COPY_CLASS(wxGridCellEditor);
+};
+
+// ----------------------------------------------------------------------------
+// wxGridHeaderRenderer and company: like wxGridCellRenderer but for headers
+// ----------------------------------------------------------------------------
+
+// Base class for corner window renderer: it is the simplest of all renderers
+// and only has a single function
+class WXDLLIMPEXP_ADV wxGridCornerHeaderRenderer
+{
+public:
+ // Draw the border around the corner window.
+ virtual void DrawBorder(const wxGrid& grid,
+ wxDC& dc,
+ wxRect& rect) const = 0;
+
+ // make the dtor of a class with virtual functions virtual to avoid g++
+ // warnings, even though this class is not supposed to be used
+ // polymorphically
+ virtual ~wxGridCornerHeaderRenderer() { }
+};
+
+
+// Base class for the row/column header cells renderers
+class WXDLLIMPEXP_ADV wxGridHeaderLabelsRenderer
+ : public wxGridCornerHeaderRenderer
+{
+public:
+ // Draw header cell label
+ virtual void DrawLabel(const wxGrid& grid,
+ wxDC& dc,
+ const wxString& value,
+ const wxRect& rect,
+ int horizAlign,
+ int vertAlign,
+ int textOrientation) const;
+};
+
+// Currently the row/column/corner renders don't need any methods other than
+// those already in wxGridHeaderLabelsRenderer but still define separate classes
+// for them for future extensions and also for better type safety (i.e. to
+// avoid inadvertently using a column header renderer for the row headers)
+class WXDLLIMPEXP_ADV wxGridRowHeaderRenderer
+ : public wxGridHeaderLabelsRenderer
+{
+};
+
+class WXDLLIMPEXP_ADV wxGridColumnHeaderRenderer
+ : public wxGridHeaderLabelsRenderer
+{
+};
+
+// Also define the default renderers which are used by wxGridCellAttrProvider
+// by default
+class WXDLLIMPEXP_ADV wxGridRowHeaderRendererDefault
+ : public wxGridRowHeaderRenderer
+{
+public:
+ virtual void DrawBorder(const wxGrid& grid,
+ wxDC& dc,
+ wxRect& rect) const;
+};
+
+// Column header cells renderers
+class WXDLLIMPEXP_ADV wxGridColumnHeaderRendererDefault
+ : public wxGridColumnHeaderRenderer
+{
+public:
+ virtual void DrawBorder(const wxGrid& grid,
+ wxDC& dc,
+ wxRect& rect) const;
+};
+
+// Header corner renderer
+class WXDLLIMPEXP_ADV wxGridCornerHeaderRendererDefault
+ : public wxGridCornerHeaderRenderer
+{
+public:
+ virtual void DrawBorder(const wxGrid& grid,
+ wxDC& dc,
+ wxRect& rect) const;
+};
+
+
+// ----------------------------------------------------------------------------
+// wxGridCellAttr: this class can be used to alter the cells appearance in
+// the grid by changing their colour/font/... from default. An object of this
+// class may be returned by wxGridTable::GetAttr().
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxGridCellAttr : public wxClientDataContainer, public wxRefCounter
+{
+public:
+ enum wxAttrKind
+ {
+ Any,
+ Default,
+ Cell,
+ Row,
+ Col,
+ Merged
+ };
+
+ // ctors
+ wxGridCellAttr(wxGridCellAttr *attrDefault = NULL)
+ {
+ Init(attrDefault);
+
+ SetAlignment(wxALIGN_INVALID, wxALIGN_INVALID);
+ }
+
+ // VZ: considering the number of members wxGridCellAttr has now, this ctor
+ // seems to be pretty useless... may be we should just remove it?
+ wxGridCellAttr(const wxColour& colText,
+ const wxColour& colBack,
+ const wxFont& font,
+ int hAlign,
+ int vAlign)
+ : m_colText(colText), m_colBack(colBack), m_font(font)
+ {
+ Init();
+ SetAlignment(hAlign, vAlign);
+ }
+
+ // creates a new copy of this object
+ wxGridCellAttr *Clone() const;
+ void MergeWith(wxGridCellAttr *mergefrom);
+
+ // setters
+ void SetTextColour(const wxColour& colText) { m_colText = colText; }
+ void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; }
+ void SetFont(const wxFont& font) { m_font = font; }
+ void SetAlignment(int hAlign, int vAlign)
+ {
+ m_hAlign = hAlign;
+ m_vAlign = vAlign;
+ }
+ void SetSize(int num_rows, int num_cols);
+ void SetOverflow(bool allow = true)
+ { m_overflow = allow ? Overflow : SingleCell; }
+ void SetReadOnly(bool isReadOnly = true)
+ { m_isReadOnly = isReadOnly ? ReadOnly : ReadWrite; }
+
+ // takes ownership of the pointer
+ void SetRenderer(wxGridCellRenderer *renderer)
+ { wxSafeDecRef(m_renderer); m_renderer = renderer; }
+ void SetEditor(wxGridCellEditor* editor)
+ { wxSafeDecRef(m_editor); m_editor = editor; }
+
+ void SetKind(wxAttrKind kind) { m_attrkind = kind; }
+
+ // accessors
+ bool HasTextColour() const { return m_colText.IsOk(); }
+ bool HasBackgroundColour() const { return m_colBack.IsOk(); }
+ bool HasFont() const { return m_font.IsOk(); }
+ bool HasAlignment() const
+ {
+ return m_hAlign != wxALIGN_INVALID || m_vAlign != wxALIGN_INVALID;
+ }
+ bool HasRenderer() const { return m_renderer != NULL; }
+ bool HasEditor() const { return m_editor != NULL; }
+ bool HasReadWriteMode() const { return m_isReadOnly != Unset; }
+ bool HasOverflowMode() const { return m_overflow != UnsetOverflow; }
+ bool HasSize() const { return m_sizeRows != 1 || m_sizeCols != 1; }
+
+ const wxColour& GetTextColour() const;
+ const wxColour& GetBackgroundColour() const;
+ const wxFont& GetFont() const;
+ void GetAlignment(int *hAlign, int *vAlign) const;
+
+ // unlike GetAlignment() which always overwrites its output arguments with
+ // the alignment values to use, falling back on default alignment if this
+ // attribute doesn't have any, this function will preserve the values of
+ // parameters on entry if the corresponding alignment is not set in this
+ // attribute meaning that they can be initialized to default alignment (and
+ // also that they must be initialized, unlike with GetAlignment())
+ void GetNonDefaultAlignment(int *hAlign, int *vAlign) const;
+
+ void GetSize(int *num_rows, int *num_cols) const;
+ bool GetOverflow() const
+ { return m_overflow != SingleCell; }
+ wxGridCellRenderer *GetRenderer(const wxGrid* grid, int row, int col) const;
+ wxGridCellEditor *GetEditor(const wxGrid* grid, int row, int col) const;
+
+ bool IsReadOnly() const { return m_isReadOnly == wxGridCellAttr::ReadOnly; }
+
+ wxAttrKind GetKind() { return m_attrkind; }
+
+ void SetDefAttr(wxGridCellAttr* defAttr) { m_defGridAttr = defAttr; }
+
+protected:
+ // the dtor is private because only DecRef() can delete us
+ virtual ~wxGridCellAttr()
+ {
+ wxSafeDecRef(m_renderer);
+ wxSafeDecRef(m_editor);
+ }
+
+private:
+ enum wxAttrReadMode
+ {
+ Unset = -1,
+ ReadWrite,
+ ReadOnly
+ };
+
+ enum wxAttrOverflowMode
+ {
+ UnsetOverflow = -1,
+ Overflow,
+ SingleCell
+ };
+
+ // the common part of all ctors
+ void Init(wxGridCellAttr *attrDefault = NULL);
+
+
+ wxColour m_colText,
+ m_colBack;
+ wxFont m_font;
+ int m_hAlign,
+ m_vAlign;
+ int m_sizeRows,
+ m_sizeCols;
+
+ wxAttrOverflowMode m_overflow;
+
+ wxGridCellRenderer* m_renderer;
+ wxGridCellEditor* m_editor;
+ wxGridCellAttr* m_defGridAttr;
+
+ wxAttrReadMode m_isReadOnly;
+
+ wxAttrKind m_attrkind;
+
+ // use Clone() instead
+ wxDECLARE_NO_COPY_CLASS(wxGridCellAttr);
+
+ // suppress the stupid gcc warning about the class having private dtor and
+ // no friends
+ friend class wxGridCellAttrDummyFriend;
+};
+
+// ----------------------------------------------------------------------------
+// wxGridCellAttrProvider: class used by wxGridTableBase to retrieve/store the
+// cell attributes.
+// ----------------------------------------------------------------------------
+
+// implementation note: we separate it from wxGridTableBase because we wish to
+// avoid deriving a new table class if possible, and sometimes it will be
+// enough to just derive another wxGridCellAttrProvider instead
+//
+// the default implementation is reasonably efficient for the generic case,
+// but you might still wish to implement your own for some specific situations
+// if you have performance problems with the stock one
+class WXDLLIMPEXP_ADV wxGridCellAttrProvider : public wxClientDataContainer
+{
+public:
+ wxGridCellAttrProvider();
+ virtual ~wxGridCellAttrProvider();
+
+ // DecRef() must be called on the returned pointer
+ virtual wxGridCellAttr *GetAttr(int row, int col,
+ wxGridCellAttr::wxAttrKind kind ) const;
+
+ // all these functions take ownership of the pointer, don't call DecRef()
+ // on it
+ virtual void SetAttr(wxGridCellAttr *attr, int row, int col);
+ virtual void SetRowAttr(wxGridCellAttr *attr, int row);
+ virtual void SetColAttr(wxGridCellAttr *attr, int col);
+
+ // these functions must be called whenever some rows/cols are deleted
+ // because the internal data must be updated then
+ void UpdateAttrRows( size_t pos, int numRows );
+ void UpdateAttrCols( size_t pos, int numCols );
+
+
+ // get renderers for the given row/column header label and the corner
+ // window: unlike cell renderers, these objects are not reference counted
+ // and are never NULL so they are returned by reference
+ virtual const wxGridColumnHeaderRenderer& GetColumnHeaderRenderer(int col);
+ virtual const wxGridRowHeaderRenderer& GetRowHeaderRenderer(int row);
+ virtual const wxGridCornerHeaderRenderer& GetCornerRenderer();
+
+private:
+ void InitData();
+
+ wxGridCellAttrProviderData *m_data;
+
+ wxDECLARE_NO_COPY_CLASS(wxGridCellAttrProvider);
+};
+
+// ----------------------------------------------------------------------------
+// wxGridCellCoords: location of a cell in the grid
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxGridCellCoords
+{
+public:
+ wxGridCellCoords() { m_row = m_col = -1; }
+ wxGridCellCoords( int r, int c ) { m_row = r; m_col = c; }
+
+ // default copy ctor is ok
+
+ int GetRow() const { return m_row; }
+ void SetRow( int n ) { m_row = n; }
+ int GetCol() const { return m_col; }
+ void SetCol( int n ) { m_col = n; }
+ void Set( int row, int col ) { m_row = row; m_col = col; }
+
+ wxGridCellCoords& operator=( const wxGridCellCoords& other )
+ {
+ if ( &other != this )
+ {
+ m_row=other.m_row;
+ m_col=other.m_col;
+ }
+ return *this;
+ }
+
+ bool operator==( const wxGridCellCoords& other ) const
+ {
+ return (m_row == other.m_row && m_col == other.m_col);
+ }
+
+ bool operator!=( const wxGridCellCoords& other ) const
+ {
+ return (m_row != other.m_row || m_col != other.m_col);
+ }
+
+ bool operator!() const
+ {
+ return (m_row == -1 && m_col == -1 );
+ }
+
+private:
+ int m_row;
+ int m_col;
+};
+
+
+// For comparisons...
+//
+extern WXDLLIMPEXP_ADV wxGridCellCoords wxGridNoCellCoords;
+extern WXDLLIMPEXP_ADV wxRect wxGridNoCellRect;
+
+// An array of cell coords...
+//
+WX_DECLARE_OBJARRAY_WITH_DECL(wxGridCellCoords, wxGridCellCoordsArray,
+ class WXDLLIMPEXP_ADV);
+
+// ----------------------------------------------------------------------------
+// Grid table classes
+// ----------------------------------------------------------------------------
+
+// the abstract base class
+class WXDLLIMPEXP_ADV wxGridTableBase : public wxObject,
+ public wxClientDataContainer
+{
+public:
+ wxGridTableBase();
+ virtual ~wxGridTableBase();
+
+ // You must override these functions in a derived table class
+ //
+
+ // return the number of rows and columns in this table
+ virtual int GetNumberRows() = 0;
+ virtual int GetNumberCols() = 0;
+
+ // the methods above are unfortunately non-const even though they should
+ // have been const -- but changing it now is not possible any longer as it
+ // would break the existing code overriding them, so instead we provide
+ // these const synonyms which can be used from const-correct code
+ int GetRowsCount() const
+ { return const_cast<wxGridTableBase *>(this)->GetNumberRows(); }
+ int GetColsCount() const
+ { return const_cast<wxGridTableBase *>(this)->GetNumberCols(); }
+
+
+ virtual bool IsEmptyCell( int row, int col )
+ {
+ return GetValue(row, col).empty();
+ }
+
+ bool IsEmpty(const wxGridCellCoords& coord)
+ {
+ return IsEmptyCell(coord.GetRow(), coord.GetCol());
+ }
+
+ virtual wxString GetValue( int row, int col ) = 0;
+ virtual void SetValue( int row, int col, const wxString& value ) = 0;
+
+ // Data type determination and value access
+ virtual wxString GetTypeName( int row, int col );
+ virtual bool CanGetValueAs( int row, int col, const wxString& typeName );
+ virtual bool CanSetValueAs( int row, int col, const wxString& typeName );
+
+ virtual long GetValueAsLong( int row, int col );
+ virtual double GetValueAsDouble( int row, int col );
+ virtual bool GetValueAsBool( int row, int col );
+
+ virtual void SetValueAsLong( int row, int col, long value );
+ virtual void SetValueAsDouble( int row, int col, double value );
+ virtual void SetValueAsBool( int row, int col, bool value );
+
+ // For user defined types
+ virtual void* GetValueAsCustom( int row, int col, const wxString& typeName );
+ virtual void SetValueAsCustom( int row, int col, const wxString& typeName, void* value );
+
+
+ // Overriding these is optional
+ //
+ virtual void SetView( wxGrid *grid ) { m_view = grid; }
+ virtual wxGrid * GetView() const { return m_view; }
+
+ virtual void Clear() {}
+ virtual bool InsertRows( size_t pos = 0, size_t numRows = 1 );
+ virtual bool AppendRows( size_t numRows = 1 );
+ virtual bool DeleteRows( size_t pos = 0, size_t numRows = 1 );
+ virtual bool InsertCols( size_t pos = 0, size_t numCols = 1 );
+ virtual bool AppendCols( size_t numCols = 1 );
+ virtual bool DeleteCols( size_t pos = 0, size_t numCols = 1 );
+
+ virtual wxString GetRowLabelValue( int row );
+ virtual wxString GetColLabelValue( int col );
+ virtual void SetRowLabelValue( int WXUNUSED(row), const wxString& ) {}
+ virtual void SetColLabelValue( int WXUNUSED(col), const wxString& ) {}
+
+ // Attribute handling
+ //
+
+ // give us the attr provider to use - we take ownership of the pointer
+ void SetAttrProvider(wxGridCellAttrProvider *attrProvider);
+
+ // get the currently used attr provider (may be NULL)
+ wxGridCellAttrProvider *GetAttrProvider() const { return m_attrProvider; }
+
+ // Does this table allow attributes? Default implementation creates
+ // a wxGridCellAttrProvider if necessary.
+ virtual bool CanHaveAttributes();
+
+ // by default forwarded to wxGridCellAttrProvider if any. May be
+ // overridden to handle attributes directly in the table.
+ virtual wxGridCellAttr *GetAttr( int row, int col,
+ wxGridCellAttr::wxAttrKind kind );
+
+
+ // these functions take ownership of the pointer
+ virtual void SetAttr(wxGridCellAttr* attr, int row, int col);
+ virtual void SetRowAttr(wxGridCellAttr *attr, int row);
+ virtual void SetColAttr(wxGridCellAttr *attr, int col);
+
+private:
+ wxGrid * m_view;
+ wxGridCellAttrProvider *m_attrProvider;
+
+ DECLARE_ABSTRACT_CLASS(wxGridTableBase)
+ wxDECLARE_NO_COPY_CLASS(wxGridTableBase);
+};
+
+
+// ----------------------------------------------------------------------------
+// wxGridTableMessage
+// ----------------------------------------------------------------------------
+
+// IDs for messages sent from grid table to view
+//
+enum wxGridTableRequest
+{
+ wxGRIDTABLE_REQUEST_VIEW_GET_VALUES = 2000,
+ wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES,
+ wxGRIDTABLE_NOTIFY_ROWS_INSERTED,
+ wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
+ wxGRIDTABLE_NOTIFY_ROWS_DELETED,
+ wxGRIDTABLE_NOTIFY_COLS_INSERTED,
+ wxGRIDTABLE_NOTIFY_COLS_APPENDED,
+ wxGRIDTABLE_NOTIFY_COLS_DELETED
+};
+
+class WXDLLIMPEXP_ADV wxGridTableMessage
+{
+public:
+ wxGridTableMessage();
+ wxGridTableMessage( wxGridTableBase *table, int id,
+ int comInt1 = -1,
+ int comInt2 = -1 );
+
+ void SetTableObject( wxGridTableBase *table ) { m_table = table; }
+ wxGridTableBase * GetTableObject() const { return m_table; }
+ void SetId( int id ) { m_id = id; }
+ int GetId() { return m_id; }
+ void SetCommandInt( int comInt1 ) { m_comInt1 = comInt1; }
+ int GetCommandInt() { return m_comInt1; }
+ void SetCommandInt2( int comInt2 ) { m_comInt2 = comInt2; }
+ int GetCommandInt2() { return m_comInt2; }
+
+private:
+ wxGridTableBase *m_table;
+ int m_id;
+ int m_comInt1;
+ int m_comInt2;
+
+ wxDECLARE_NO_COPY_CLASS(wxGridTableMessage);
+};
+
+
+
+// ------ wxGridStringArray
+// A 2-dimensional array of strings for data values
+//
+
+WX_DECLARE_OBJARRAY_WITH_DECL(wxArrayString, wxGridStringArray,
+ class WXDLLIMPEXP_ADV);
+
+
+
+// ------ wxGridStringTable
+//
+// Simplest type of data table for a grid for small tables of strings
+// that are stored in memory
+//
+
+class WXDLLIMPEXP_ADV wxGridStringTable : public wxGridTableBase
+{
+public:
+ wxGridStringTable();
+ wxGridStringTable( int numRows, int numCols );
+
+ // these are pure virtual in wxGridTableBase
+ //
+ virtual int GetNumberRows() { return static_cast<int>(m_data.size()); }
+ virtual int GetNumberCols() { return m_numCols; }
+ virtual wxString GetValue( int row, int col );
+ virtual void SetValue( int row, int col, const wxString& s );
+
+ // overridden functions from wxGridTableBase
+ //
+ void Clear();
+ bool InsertRows( size_t pos = 0, size_t numRows = 1 );
+ bool AppendRows( size_t numRows = 1 );
+ bool DeleteRows( size_t pos = 0, size_t numRows = 1 );
+ bool InsertCols( size_t pos = 0, size_t numCols = 1 );
+ bool AppendCols( size_t numCols = 1 );
+ bool DeleteCols( size_t pos = 0, size_t numCols = 1 );
+
+ void SetRowLabelValue( int row, const wxString& );
+ void SetColLabelValue( int col, const wxString& );
+ wxString GetRowLabelValue( int row );
+ wxString GetColLabelValue( int col );
+
+private:
+ wxGridStringArray m_data;
+
+ // notice that while we don't need to store the number of our rows as it's
+ // always equal to the size of m_data array, we do need to store the number
+ // of our columns as we can't retrieve it from m_data when the number of
+ // rows is 0 (see #10818)
+ int m_numCols;
+
+ // These only get used if you set your own labels, otherwise the
+ // GetRow/ColLabelValue functions return wxGridTableBase defaults
+ //
+ wxArrayString m_rowLabels;
+ wxArrayString m_colLabels;
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY( wxGridStringTable )
+};
+
+
+
+// ============================================================================
+// Grid view classes
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxGridSizesInfo stores information about sizes of the rows or columns.
+//
+// It assumes that most of the columns or rows have default size and so stores
+// the default size separately and uses a hash to map column or row numbers to
+// their non default size for those which don't have the default size.
+// ----------------------------------------------------------------------------
+
+// hash map to store positions as the keys and sizes as the values
+WX_DECLARE_HASH_MAP_WITH_DECL( unsigned, int, wxIntegerHash, wxIntegerEqual,
+ wxUnsignedToIntHashMap, class WXDLLIMPEXP_ADV );
+
+struct WXDLLIMPEXP_ADV wxGridSizesInfo
+{
+ // default ctor, initialize m_sizeDefault and m_customSizes later
+ wxGridSizesInfo() { }
+
+ // ctor used by wxGrid::Get{Col,Row}Sizes()
+ wxGridSizesInfo(int defSize, const wxArrayInt& allSizes);
+
+ // default copy ctor, assignment operator and dtor are ok
+
+ // Get the size of the element with the given index
+ int GetSize(unsigned pos) const;
+
+
+ // default size
+ int m_sizeDefault;
+
+ // position -> size map containing all elements with non-default size
+ wxUnsignedToIntHashMap m_customSizes;
+};
+
+// ----------------------------------------------------------------------------
+// wxGrid
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxGrid : public wxScrolledWindow
+{
+public:
+ // possible selection modes
+ enum wxGridSelectionModes
+ {
+ wxGridSelectCells = 0, // allow selecting anything
+ wxGridSelectRows = 1, // allow selecting only entire rows
+ wxGridSelectColumns = 2, // allow selecting only entire columns
+ wxGridSelectRowsOrColumns = wxGridSelectRows | wxGridSelectColumns
+ };
+
+ // Different behaviour of the TAB key when the end (or the beginning, for
+ // Shift-TAB) of the current row is reached:
+ enum TabBehaviour
+ {
+ Tab_Stop, // Do nothing, this is default.
+ Tab_Wrap, // Move to the next (or previous) row.
+ Tab_Leave // Move to the next (or previous) control.
+ };
+
+ // creation and destruction
+ // ------------------------
+
+ // ctor and Create() create the grid window, as with the other controls
+ wxGrid() { Init(); }
+
+ wxGrid(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxWANTS_CHARS,
+ const wxString& name = wxGridNameStr)
+ {
+ Init();
+
+ Create(parent, id, pos, size, style, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxWANTS_CHARS,
+ const wxString& name = wxGridNameStr);
+
+ virtual ~wxGrid();
+
+ // however to initialize grid data either CreateGrid() or SetTable() must
+ // be also called
+
+ // this is basically equivalent to
+ //
+ // SetTable(new wxGridStringTable(numRows, numCols), true, selmode)
+ //
+ bool CreateGrid( int numRows, int numCols,
+ wxGridSelectionModes selmode = wxGridSelectCells );
+
+ bool SetTable( wxGridTableBase *table,
+ bool takeOwnership = false,
+ wxGridSelectionModes selmode = wxGridSelectCells );
+
+ bool ProcessTableMessage(wxGridTableMessage&);
+
+ wxGridTableBase *GetTable() const { return m_table; }
+
+
+ void SetSelectionMode(wxGridSelectionModes selmode);
+ wxGridSelectionModes GetSelectionMode() const;
+
+ // ------ grid dimensions
+ //
+ int GetNumberRows() const { return m_numRows; }
+ int GetNumberCols() const { return m_numCols; }
+
+
+ // ------ display update functions
+ //
+ wxArrayInt CalcRowLabelsExposed( const wxRegion& reg ) const;
+
+ wxArrayInt CalcColLabelsExposed( const wxRegion& reg ) const;
+ wxGridCellCoordsArray CalcCellsExposed( const wxRegion& reg ) const;
+
+
+ void ClearGrid();
+ bool InsertRows(int pos = 0, int numRows = 1, bool updateLabels = true)
+ {
+ return DoModifyLines(&wxGridTableBase::InsertRows,
+ pos, numRows, updateLabels);
+ }
+ bool InsertCols(int pos = 0, int numCols = 1, bool updateLabels = true)
+ {
+ return DoModifyLines(&wxGridTableBase::InsertCols,
+ pos, numCols, updateLabels);
+ }
+
+ bool AppendRows(int numRows = 1, bool updateLabels = true)
+ {
+ return DoAppendLines(&wxGridTableBase::AppendRows, numRows, updateLabels);
+ }
+ bool AppendCols(int numCols = 1, bool updateLabels = true)
+ {
+ return DoAppendLines(&wxGridTableBase::AppendCols, numCols, updateLabels);
+ }
+
+ bool DeleteRows(int pos = 0, int numRows = 1, bool updateLabels = true)
+ {
+ return DoModifyLines(&wxGridTableBase::DeleteRows,
+ pos, numRows, updateLabels);
+ }
+ bool DeleteCols(int pos = 0, int numCols = 1, bool updateLabels = true)
+ {
+ return DoModifyLines(&wxGridTableBase::DeleteCols,
+ pos, numCols, updateLabels);
+ }
+
+ void DrawGridCellArea( wxDC& dc , const wxGridCellCoordsArray& cells );
+ void DrawGridSpace( wxDC& dc );
+ void DrawCellBorder( wxDC& dc, const wxGridCellCoords& );
+ void DrawAllGridLines( wxDC& dc, const wxRegion & reg );
+ void DrawCell( wxDC& dc, const wxGridCellCoords& );
+ void DrawHighlight(wxDC& dc, const wxGridCellCoordsArray& cells);
+
+ // this function is called when the current cell highlight must be redrawn
+ // and may be overridden by the user
+ virtual void DrawCellHighlight( wxDC& dc, const wxGridCellAttr *attr );
+
+ virtual void DrawRowLabels( wxDC& dc, const wxArrayInt& rows );
+ virtual void DrawRowLabel( wxDC& dc, int row );
+
+ virtual void DrawColLabels( wxDC& dc, const wxArrayInt& cols );
+ virtual void DrawColLabel( wxDC& dc, int col );
+
+ virtual void DrawCornerLabel(wxDC& dc);
+
+ // ------ Cell text drawing functions
+ //
+ void DrawTextRectangle( wxDC& dc, const wxString&, const wxRect&,
+ int horizontalAlignment = wxALIGN_LEFT,
+ int verticalAlignment = wxALIGN_TOP,
+ int textOrientation = wxHORIZONTAL ) const;
+
+ void DrawTextRectangle( wxDC& dc, const wxArrayString& lines, const wxRect&,
+ int horizontalAlignment = wxALIGN_LEFT,
+ int verticalAlignment = wxALIGN_TOP,
+ int textOrientation = wxHORIZONTAL ) const;
+
+ // ------ grid render function for printing
+ //
+ void Render( wxDC& dc,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ const wxGridCellCoords& topLeft = wxGridCellCoords(-1, -1),
+ const wxGridCellCoords& bottomRight = wxGridCellCoords(-1, -1),
+ int style = wxGRID_DRAW_DEFAULT );
+
+ // Split a string containing newline characters into an array of
+ // strings and return the number of lines
+ //
+ void StringToLines( const wxString& value, wxArrayString& lines ) const;
+
+ void GetTextBoxSize( const wxDC& dc,
+ const wxArrayString& lines,
+ long *width, long *height ) const;
+
+
+ // ------
+ // Code that does a lot of grid modification can be enclosed
+ // between BeginBatch() and EndBatch() calls to avoid screen
+ // flicker
+ //
+ void BeginBatch() { m_batchCount++; }
+ void EndBatch();
+
+ int GetBatchCount() { return m_batchCount; }
+
+ virtual void Refresh(bool eraseb = true, const wxRect* rect = NULL);
+
+ // Use this, rather than wxWindow::Refresh(), to force an
+ // immediate repainting of the grid. Has no effect if you are
+ // already inside a BeginBatch / EndBatch block.
+ //
+ // This function is necessary because wxGrid has a minimal OnPaint()
+ // handler to reduce screen flicker.
+ //
+ void ForceRefresh();
+
+
+ // ------ edit control functions
+ //
+ bool IsEditable() const { return m_editable; }
+ void EnableEditing( bool edit );
+
+ void EnableCellEditControl( bool enable = true );
+ void DisableCellEditControl() { EnableCellEditControl(false); }
+ bool CanEnableCellControl() const;
+ bool IsCellEditControlEnabled() const;
+ bool IsCellEditControlShown() const;
+
+ bool IsCurrentCellReadOnly() const;
+
+ void ShowCellEditControl();
+ void HideCellEditControl();
+ void SaveEditControlValue();
+
+
+ // ------ grid location functions
+ // Note that all of these functions work with the logical coordinates of
+ // grid cells and labels so you will need to convert from device
+ // coordinates for mouse events etc.
+ //
+ wxGridCellCoords XYToCell(int x, int y) const;
+ void XYToCell(int x, int y, wxGridCellCoords& coords) const
+ { coords = XYToCell(x, y); }
+ wxGridCellCoords XYToCell(const wxPoint& pos) const
+ { return XYToCell(pos.x, pos.y); }
+
+ // these functions return the index of the row/columns corresponding to the
+ // given logical position in pixels
+ //
+ // if clipToMinMax is false (default, wxNOT_FOUND is returned if the
+ // position is outside any row/column, otherwise the first/last element is
+ // returned in this case
+ int YToRow( int y, bool clipToMinMax = false ) const;
+ int XToCol( int x, bool clipToMinMax = false ) const;
+
+ int YToEdgeOfRow( int y ) const;
+ int XToEdgeOfCol( int x ) const;
+
+ wxRect CellToRect( int row, int col ) const;
+ wxRect CellToRect( const wxGridCellCoords& coords ) const
+ { return CellToRect( coords.GetRow(), coords.GetCol() ); }
+
+ int GetGridCursorRow() const { return m_currentCellCoords.GetRow(); }
+ int GetGridCursorCol() const { return m_currentCellCoords.GetCol(); }
+
+ // check to see if a cell is either wholly visible (the default arg) or
+ // at least partially visible in the grid window
+ //
+ bool IsVisible( int row, int col, bool wholeCellVisible = true ) const;
+ bool IsVisible( const wxGridCellCoords& coords, bool wholeCellVisible = true ) const
+ { return IsVisible( coords.GetRow(), coords.GetCol(), wholeCellVisible ); }
+ void MakeCellVisible( int row, int col );
+ void MakeCellVisible( const wxGridCellCoords& coords )
+ { MakeCellVisible( coords.GetRow(), coords.GetCol() ); }
+
+
+ // ------ grid cursor movement functions
+ //
+ void SetGridCursor(int row, int col) { SetCurrentCell(row, col); }
+ void SetGridCursor(const wxGridCellCoords& c) { SetCurrentCell(c); }
+
+ void GoToCell(int row, int col)
+ {
+ if ( SetCurrentCell(row, col) )
+ MakeCellVisible(row, col);
+ }
+
+ void GoToCell(const wxGridCellCoords& coords)
+ {
+ if ( SetCurrentCell(coords) )
+ MakeCellVisible(coords);
+ }
+
+ bool MoveCursorUp( bool expandSelection );
+ bool MoveCursorDown( bool expandSelection );
+ bool MoveCursorLeft( bool expandSelection );
+ bool MoveCursorRight( bool expandSelection );
+ bool MovePageDown();
+ bool MovePageUp();
+ bool MoveCursorUpBlock( bool expandSelection );
+ bool MoveCursorDownBlock( bool expandSelection );
+ bool MoveCursorLeftBlock( bool expandSelection );
+ bool MoveCursorRightBlock( bool expandSelection );
+
+ void SetTabBehaviour(TabBehaviour behaviour) { m_tabBehaviour = behaviour; }
+
+
+ // ------ label and gridline formatting
+ //
+ int GetDefaultRowLabelSize() const { return WXGRID_DEFAULT_ROW_LABEL_WIDTH; }
+ int GetRowLabelSize() const { return m_rowLabelWidth; }
+ int GetDefaultColLabelSize() const { return WXGRID_DEFAULT_COL_LABEL_HEIGHT; }
+ int GetColLabelSize() const { return m_colLabelHeight; }
+ wxColour GetLabelBackgroundColour() const { return m_labelBackgroundColour; }
+ wxColour GetLabelTextColour() const { return m_labelTextColour; }
+ wxFont GetLabelFont() const { return m_labelFont; }
+ void GetRowLabelAlignment( int *horiz, int *vert ) const;
+ void GetColLabelAlignment( int *horiz, int *vert ) const;
+ int GetColLabelTextOrientation() const;
+ wxString GetRowLabelValue( int row ) const;
+ wxString GetColLabelValue( int col ) const;
+
+ wxColour GetCellHighlightColour() const { return m_cellHighlightColour; }
+ int GetCellHighlightPenWidth() const { return m_cellHighlightPenWidth; }
+ int GetCellHighlightROPenWidth() const { return m_cellHighlightROPenWidth; }
+
+ // this one will use wxHeaderCtrl for the column labels
+ void UseNativeColHeader(bool native = true);
+
+ // this one will still draw them manually but using the native renderer
+ // instead of using the same appearance as for the row labels
+ void SetUseNativeColLabels( bool native = true );
+
+ void SetRowLabelSize( int width );
+ void SetColLabelSize( int height );
+ void HideRowLabels() { SetRowLabelSize( 0 ); }
+ void HideColLabels() { SetColLabelSize( 0 ); }
+ void SetLabelBackgroundColour( const wxColour& );
+ void SetLabelTextColour( const wxColour& );
+ void SetLabelFont( const wxFont& );
+ void SetRowLabelAlignment( int horiz, int vert );
+ void SetColLabelAlignment( int horiz, int vert );
+ void SetColLabelTextOrientation( int textOrientation );
+ void SetRowLabelValue( int row, const wxString& );
+ void SetColLabelValue( int col, const wxString& );
+ void SetCellHighlightColour( const wxColour& );
+ void SetCellHighlightPenWidth(int width);
+ void SetCellHighlightROPenWidth(int width);
+
+
+ // interactive grid mouse operations control
+ // -----------------------------------------
+
+ // functions globally enabling row/column interactive resizing (enabled by
+ // default)
+ void EnableDragRowSize( bool enable = true );
+ void DisableDragRowSize() { EnableDragRowSize( false ); }
+
+ void EnableDragColSize( bool enable = true );
+ void DisableDragColSize() { EnableDragColSize( false ); }
+
+ // if interactive resizing is enabled, some rows/columns can still have
+ // fixed size
+ void DisableRowResize(int row) { DoDisableLineResize(row, m_setFixedRows); }
+ void DisableColResize(int col) { DoDisableLineResize(col, m_setFixedCols); }
+
+ // these functions return whether the given row/column can be
+ // effectively resized: for this interactive resizing must be enabled
+ // and this index must not have been passed to DisableRow/ColResize()
+ bool CanDragRowSize(int row) const
+ { return m_canDragRowSize && DoCanResizeLine(row, m_setFixedRows); }
+ bool CanDragColSize(int col) const
+ { return m_canDragColSize && DoCanResizeLine(col, m_setFixedCols); }
+
+ // interactive column reordering (disabled by default)
+ void EnableDragColMove( bool enable = true );
+ void DisableDragColMove() { EnableDragColMove( false ); }
+ bool CanDragColMove() const { return m_canDragColMove; }
+
+ // interactive resizing of grid cells (enabled by default)
+ void EnableDragGridSize(bool enable = true);
+ void DisableDragGridSize() { EnableDragGridSize(false); }
+ bool CanDragGridSize() const { return m_canDragGridSize; }
+
+ // interactive dragging of cells (disabled by default)
+ void EnableDragCell( bool enable = true );
+ void DisableDragCell() { EnableDragCell( false ); }
+ bool CanDragCell() const { return m_canDragCell; }
+
+
+ // grid lines
+ // ----------
+
+ // enable or disable drawing of the lines
+ void EnableGridLines(bool enable = true);
+ bool GridLinesEnabled() const { return m_gridLinesEnabled; }
+
+ // by default grid lines stop at last column/row, but this may be changed
+ void ClipHorzGridLines(bool clip)
+ { DoClipGridLines(m_gridLinesClipHorz, clip); }
+ void ClipVertGridLines(bool clip)
+ { DoClipGridLines(m_gridLinesClipVert, clip); }
+ bool AreHorzGridLinesClipped() const { return m_gridLinesClipHorz; }
+ bool AreVertGridLinesClipped() const { return m_gridLinesClipVert; }
+
+ // this can be used to change the global grid lines colour
+ void SetGridLineColour(const wxColour& col);
+ wxColour GetGridLineColour() const { return m_gridLineColour; }
+
+ // these methods may be overridden to customize individual grid lines
+ // appearance
+ virtual wxPen GetDefaultGridLinePen();
+ virtual wxPen GetRowGridLinePen(int row);
+ virtual wxPen GetColGridLinePen(int col);
+
+
+ // attributes
+ // ----------
+
+ // this sets the specified attribute for this cell or in this row/col
+ void SetAttr(int row, int col, wxGridCellAttr *attr);
+ void SetRowAttr(int row, wxGridCellAttr *attr);
+ void SetColAttr(int col, wxGridCellAttr *attr);
+
+ // the grid can cache attributes for the recently used cells (currently it
+ // only caches one attribute for the most recently used one) and might
+ // notice that its value in the attribute provider has changed -- if this
+ // happens, call this function to force it
+ void RefreshAttr(int row, int col);
+
+ // returns the attribute we may modify in place: a new one if this cell
+ // doesn't have any yet or the existing one if it does
+ //
+ // DecRef() must be called on the returned pointer, as usual
+ wxGridCellAttr *GetOrCreateCellAttr(int row, int col) const;
+
+
+ // shortcuts for setting the column parameters
+
+ // set the format for the data in the column: default is string
+ void SetColFormatBool(int col);
+ void SetColFormatNumber(int col);
+ void SetColFormatFloat(int col, int width = -1, int precision = -1);
+ void SetColFormatCustom(int col, const wxString& typeName);
+
+ // ------ row and col formatting
+ //
+ int GetDefaultRowSize() const;
+ int GetRowSize( int row ) const;
+ bool IsRowShown(int row) const { return GetRowSize(row) != 0; }
+ int GetDefaultColSize() const;
+ int GetColSize( int col ) const;
+ bool IsColShown(int col) const { return GetColSize(col) != 0; }
+ wxColour GetDefaultCellBackgroundColour() const;
+ wxColour GetCellBackgroundColour( int row, int col ) const;
+ wxColour GetDefaultCellTextColour() const;
+ wxColour GetCellTextColour( int row, int col ) const;
+ wxFont GetDefaultCellFont() const;
+ wxFont GetCellFont( int row, int col ) const;
+ void GetDefaultCellAlignment( int *horiz, int *vert ) const;
+ void GetCellAlignment( int row, int col, int *horiz, int *vert ) const;
+ bool GetDefaultCellOverflow() const;
+ bool GetCellOverflow( int row, int col ) const;
+
+ // this function returns 1 in num_rows and num_cols for normal cells,
+ // positive numbers for a cell spanning multiple columns/rows (as set with
+ // SetCellSize()) and _negative_ numbers corresponding to the offset of the
+ // top left cell of the span from this one for the other cells covered by
+ // this cell
+ //
+ // the return value is CellSpan_None, CellSpan_Main or CellSpan_Inside for
+ // each of these cases respectively
+ enum CellSpan
+ {
+ CellSpan_Inside = -1,
+ CellSpan_None = 0,
+ CellSpan_Main
+ };
+
+ CellSpan GetCellSize( int row, int col, int *num_rows, int *num_cols ) const;
+
+ wxSize GetCellSize(const wxGridCellCoords& coords)
+ {
+ wxSize s;
+ GetCellSize(coords.GetRow(), coords.GetCol(), &s.x, &s.y);
+ return s;
+ }
+
+ // ------ row and col sizes
+ void SetDefaultRowSize( int height, bool resizeExistingRows = false );
+ void SetRowSize( int row, int height );
+ void HideRow(int row) { DoSetRowSize(row, 0); }
+ void ShowRow(int row) { DoSetRowSize(row, -1); }
+
+ void SetDefaultColSize( int width, bool resizeExistingCols = false );
+ void SetColSize( int col, int width );
+ void HideCol(int col) { DoSetColSize(col, 0); }
+ void ShowCol(int col) { DoSetColSize(col, -1); }
+
+ // the row and column sizes can be also set all at once using
+ // wxGridSizesInfo which holds all of them at once
+
+ wxGridSizesInfo GetColSizes() const
+ { return wxGridSizesInfo(GetDefaultColSize(), m_colWidths); }
+ wxGridSizesInfo GetRowSizes() const
+ { return wxGridSizesInfo(GetDefaultRowSize(), m_rowHeights); }
+
+ void SetColSizes(const wxGridSizesInfo& sizeInfo);
+ void SetRowSizes(const wxGridSizesInfo& sizeInfo);
+
+
+ // ------- columns (only, for now) reordering
+
+ // columns index <-> positions mapping: by default, the position of the
+ // column is the same as its index, but the columns can also be reordered
+ // (either by calling SetColPos() explicitly or by the user dragging the
+ // columns around) in which case their indices don't correspond to their
+ // positions on display any longer
+ //
+ // internally we always work with indices except for the functions which
+ // have "Pos" in their names (and which work with columns, not pixels) and
+ // only the display and hit testing code really cares about display
+ // positions at all
+
+ // set the positions of all columns at once (this method uses the same
+ // conventions as wxHeaderCtrl::SetColumnsOrder() for the order array)
+ void SetColumnsOrder(const wxArrayInt& order);
+
+ // return the column index corresponding to the given (valid) position
+ int GetColAt(int pos) const
+ {
+ return m_colAt.empty() ? pos : m_colAt[pos];
+ }
+
+ // reorder the columns so that the column with the given index is now shown
+ // as the position pos
+ void SetColPos(int idx, int pos);
+
+ // return the position at which the column with the given index is
+ // displayed: notice that this is a slow operation as we don't maintain the
+ // reverse mapping currently
+ int GetColPos(int idx) const
+ {
+ if ( m_colAt.IsEmpty() )
+ return idx;
+
+ for ( int i = 0; i < m_numCols; i++ )
+ {
+ if ( m_colAt[i] == idx )
+ return i;
+ }
+
+ wxFAIL_MSG( "invalid column index" );
+
+ return wxNOT_FOUND;
+ }
+
+ // reset the columns positions to the default order
+ void ResetColPos();
+
+
+ // automatically size the column or row to fit to its contents, if
+ // setAsMin is true, this optimal width will also be set as minimal width
+ // for this column
+ void AutoSizeColumn( int col, bool setAsMin = true )
+ { AutoSizeColOrRow(col, setAsMin, wxGRID_COLUMN); }
+ void AutoSizeRow( int row, bool setAsMin = true )
+ { AutoSizeColOrRow(row, setAsMin, wxGRID_ROW); }
+
+ // auto size all columns (very ineffective for big grids!)
+ void AutoSizeColumns( bool setAsMin = true )
+ { (void)SetOrCalcColumnSizes(false, setAsMin); }
+
+ void AutoSizeRows( bool setAsMin = true )
+ { (void)SetOrCalcRowSizes(false, setAsMin); }
+
+ // auto size the grid, that is make the columns/rows of the "right" size
+ // and also set the grid size to just fit its contents
+ void AutoSize();
+
+ // Note for both AutoSizeRowLabelSize and AutoSizeColLabelSize:
+ // If col equals to wxGRID_AUTOSIZE value then function autosizes labels column
+ // instead of data column. Note that this operation may be slow for large
+ // tables.
+ // autosize row height depending on label text
+ void AutoSizeRowLabelSize( int row );
+
+ // autosize column width depending on label text
+ void AutoSizeColLabelSize( int col );
+
+ // column won't be resized to be lesser width - this must be called during
+ // the grid creation because it won't resize the column if it's already
+ // narrower than the minimal width
+ void SetColMinimalWidth( int col, int width );
+ void SetRowMinimalHeight( int row, int width );
+
+ /* These members can be used to query and modify the minimal
+ * acceptable size of grid rows and columns. Call this function in
+ * your code which creates the grid if you want to display cells
+ * with a size smaller than the default acceptable minimum size.
+ * Like the members SetColMinimalWidth and SetRowMinimalWidth,
+ * the existing rows or columns will not be checked/resized.
+ */
+ void SetColMinimalAcceptableWidth( int width );
+ void SetRowMinimalAcceptableHeight( int width );
+ int GetColMinimalAcceptableWidth() const;
+ int GetRowMinimalAcceptableHeight() const;
+
+ void SetDefaultCellBackgroundColour( const wxColour& );
+ void SetCellBackgroundColour( int row, int col, const wxColour& );
+ void SetDefaultCellTextColour( const wxColour& );
+
+ void SetCellTextColour( int row, int col, const wxColour& );
+ void SetDefaultCellFont( const wxFont& );
+ void SetCellFont( int row, int col, const wxFont& );
+ void SetDefaultCellAlignment( int horiz, int vert );
+ void SetCellAlignment( int row, int col, int horiz, int vert );
+ void SetDefaultCellOverflow( bool allow );
+ void SetCellOverflow( int row, int col, bool allow );
+ void SetCellSize( int row, int col, int num_rows, int num_cols );
+
+ // takes ownership of the pointer
+ void SetDefaultRenderer(wxGridCellRenderer *renderer);
+ void SetCellRenderer(int row, int col, wxGridCellRenderer *renderer);
+ wxGridCellRenderer *GetDefaultRenderer() const;
+ wxGridCellRenderer* GetCellRenderer(int row, int col) const;
+
+ // takes ownership of the pointer
+ void SetDefaultEditor(wxGridCellEditor *editor);
+ void SetCellEditor(int row, int col, wxGridCellEditor *editor);
+ wxGridCellEditor *GetDefaultEditor() const;
+ wxGridCellEditor* GetCellEditor(int row, int col) const;
+
+
+
+ // ------ cell value accessors
+ //
+ wxString GetCellValue( int row, int col ) const
+ {
+ if ( m_table )
+ {
+ return m_table->GetValue( row, col );
+ }
+ else
+ {
+ return wxEmptyString;
+ }
+ }
+
+ wxString GetCellValue( const wxGridCellCoords& coords ) const
+ { return GetCellValue( coords.GetRow(), coords.GetCol() ); }
+
+ void SetCellValue( int row, int col, const wxString& s );
+ void SetCellValue( const wxGridCellCoords& coords, const wxString& s )
+ { SetCellValue( coords.GetRow(), coords.GetCol(), s ); }
+
+ // returns true if the cell can't be edited
+ bool IsReadOnly(int row, int col) const;
+
+ // make the cell editable/readonly
+ void SetReadOnly(int row, int col, bool isReadOnly = true);
+
+ // ------ select blocks of cells
+ //
+ void SelectRow( int row, bool addToSelected = false );
+ void SelectCol( int col, bool addToSelected = false );
+
+ void SelectBlock( int topRow, int leftCol, int bottomRow, int rightCol,
+ bool addToSelected = false );
+
+ void SelectBlock( const wxGridCellCoords& topLeft,
+ const wxGridCellCoords& bottomRight,
+ bool addToSelected = false )
+ { SelectBlock( topLeft.GetRow(), topLeft.GetCol(),
+ bottomRight.GetRow(), bottomRight.GetCol(),
+ addToSelected ); }
+
+ void SelectAll();
+
+ bool IsSelection() const;
+
+ // ------ deselect blocks or cells
+ //
+ void DeselectRow( int row );
+ void DeselectCol( int col );
+ void DeselectCell( int row, int col );
+
+ void ClearSelection();
+
+ bool IsInSelection( int row, int col ) const;
+
+ bool IsInSelection( const wxGridCellCoords& coords ) const
+ { return IsInSelection( coords.GetRow(), coords.GetCol() ); }
+
+ wxGridCellCoordsArray GetSelectedCells() const;
+ wxGridCellCoordsArray GetSelectionBlockTopLeft() const;
+ wxGridCellCoordsArray GetSelectionBlockBottomRight() const;
+ wxArrayInt GetSelectedRows() const;
+ wxArrayInt GetSelectedCols() const;
+
+ // This function returns the rectangle that encloses the block of cells
+ // limited by TopLeft and BottomRight cell in device coords and clipped
+ // to the client size of the grid window.
+ //
+ wxRect BlockToDeviceRect( const wxGridCellCoords & topLeft,
+ const wxGridCellCoords & bottomRight ) const;
+
+ // Access or update the selection fore/back colours
+ wxColour GetSelectionBackground() const
+ { return m_selectionBackground; }
+ wxColour GetSelectionForeground() const
+ { return m_selectionForeground; }
+
+ void SetSelectionBackground(const wxColour& c) { m_selectionBackground = c; }
+ void SetSelectionForeground(const wxColour& c) { m_selectionForeground = c; }
+
+
+ // Methods for a registry for mapping data types to Renderers/Editors
+ void RegisterDataType(const wxString& typeName,
+ wxGridCellRenderer* renderer,
+ wxGridCellEditor* editor);
+ // DJC MAPTEK
+ virtual wxGridCellEditor* GetDefaultEditorForCell(int row, int col) const;
+ wxGridCellEditor* GetDefaultEditorForCell(const wxGridCellCoords& c) const
+ { return GetDefaultEditorForCell(c.GetRow(), c.GetCol()); }
+ virtual wxGridCellRenderer* GetDefaultRendererForCell(int row, int col) const;
+ virtual wxGridCellEditor* GetDefaultEditorForType(const wxString& typeName) const;
+ virtual wxGridCellRenderer* GetDefaultRendererForType(const wxString& typeName) const;
+
+ // grid may occupy more space than needed for its rows/columns, this
+ // function allows to set how big this extra space is
+ void SetMargins(int extraWidth, int extraHeight)
+ {
+ m_extraWidth = extraWidth;
+ m_extraHeight = extraHeight;
+
+ CalcDimensions();
+ }
+
+ // Accessors for component windows
+ wxWindow* GetGridWindow() const { return (wxWindow*)m_gridWin; }
+ wxWindow* GetGridRowLabelWindow() const { return (wxWindow*)m_rowLabelWin; }
+ wxWindow* GetGridColLabelWindow() const { return m_colWindow; }
+ wxWindow* GetGridCornerLabelWindow() const { return (wxWindow*)m_cornerLabelWin; }
+
+ // This one can only be called if we are using the native header window
+ wxHeaderCtrl *GetGridColHeader() const
+ {
+ wxASSERT_MSG( m_useNativeHeader, "no column header window" );
+
+ // static_cast<> doesn't work without the full class declaration in
+ // view and we prefer to avoid adding more compile-time dependencies
+ // even at the cost of using reinterpret_cast<>
+ return reinterpret_cast<wxHeaderCtrl *>(m_colWindow);
+ }
+
+ // Allow adjustment of scroll increment. The default is (15, 15).
+ void SetScrollLineX(int x) { m_xScrollPixelsPerLine = x; }
+ void SetScrollLineY(int y) { m_yScrollPixelsPerLine = y; }
+ int GetScrollLineX() const { return m_xScrollPixelsPerLine; }
+ int GetScrollLineY() const { return m_yScrollPixelsPerLine; }
+
+ // ------- drag and drop
+#if wxUSE_DRAG_AND_DROP
+ virtual void SetDropTarget(wxDropTarget *dropTarget);
+#endif // wxUSE_DRAG_AND_DROP
+
+
+ // ------- sorting support
+
+ // wxGrid doesn't support sorting on its own but it can indicate the sort
+ // order in the column header (currently only if native header control is
+ // used though)
+
+ // return the column currently displaying the sort indicator or wxNOT_FOUND
+ // if none
+ int GetSortingColumn() const { return m_sortCol; }
+
+ // return true if this column is currently used for sorting
+ bool IsSortingBy(int col) const { return GetSortingColumn() == col; }
+
+ // return the current sorting order (on GetSortingColumn()): true for
+ // ascending sort and false for descending; it doesn't make sense to call
+ // it if GetSortingColumn() returns wxNOT_FOUND
+ bool IsSortOrderAscending() const { return m_sortIsAscending; }
+
+ // set the sorting column (or unsets any existing one if wxNOT_FOUND) and
+ // the order in which to sort
+ void SetSortingColumn(int col, bool ascending = true);
+
+ // unset any existing sorting column
+ void UnsetSortingColumn() { SetSortingColumn(wxNOT_FOUND); }
+
+#if WXWIN_COMPATIBILITY_2_8
+ // ------ For compatibility with previous wxGrid only...
+ //
+ // ************************************************
+ // ** Don't use these in new code because they **
+ // ** are liable to disappear in a future **
+ // ** revision **
+ // ************************************************
+ //
+
+ wxGrid( wxWindow *parent,
+ int x, int y, int w = wxDefaultCoord, int h = wxDefaultCoord,
+ long style = wxWANTS_CHARS,
+ const wxString& name = wxPanelNameStr )
+ {
+ Init();
+ Create(parent, wxID_ANY, wxPoint(x, y), wxSize(w, h), style, name);
+ }
+
+ void SetCellValue( const wxString& val, int row, int col )
+ { SetCellValue( row, col, val ); }
+
+ void UpdateDimensions()
+ { CalcDimensions(); }
+
+ int GetRows() const { return GetNumberRows(); }
+ int GetCols() const { return GetNumberCols(); }
+ int GetCursorRow() const { return GetGridCursorRow(); }
+ int GetCursorColumn() const { return GetGridCursorCol(); }
+
+ int GetScrollPosX() const { return 0; }
+ int GetScrollPosY() const { return 0; }
+
+ void SetScrollX( int WXUNUSED(x) ) { }
+ void SetScrollY( int WXUNUSED(y) ) { }
+
+ void SetColumnWidth( int col, int width )
+ { SetColSize( col, width ); }
+
+ int GetColumnWidth( int col ) const
+ { return GetColSize( col ); }
+
+ void SetRowHeight( int row, int height )
+ { SetRowSize( row, height ); }
+
+ // GetRowHeight() is below
+
+ int GetViewHeight() const // returned num whole rows visible
+ { return 0; }
+
+ int GetViewWidth() const // returned num whole cols visible
+ { return 0; }
+
+ void SetLabelSize( int orientation, int sz )
+ {
+ if ( orientation == wxHORIZONTAL )
+ SetColLabelSize( sz );
+ else
+ SetRowLabelSize( sz );
+ }
+
+ int GetLabelSize( int orientation ) const
+ {
+ if ( orientation == wxHORIZONTAL )
+ return GetColLabelSize();
+ else
+ return GetRowLabelSize();
+ }
+
+ void SetLabelAlignment( int orientation, int align )
+ {
+ if ( orientation == wxHORIZONTAL )
+ SetColLabelAlignment( align, wxALIGN_INVALID );
+ else
+ SetRowLabelAlignment( align, wxALIGN_INVALID );
+ }
+
+ int GetLabelAlignment( int orientation, int WXUNUSED(align) ) const
+ {
+ int h, v;
+ if ( orientation == wxHORIZONTAL )
+ {
+ GetColLabelAlignment( &h, &v );
+ return h;
+ }
+ else
+ {
+ GetRowLabelAlignment( &h, &v );
+ return h;
+ }
+ }
+
+ void SetLabelValue( int orientation, const wxString& val, int pos )
+ {
+ if ( orientation == wxHORIZONTAL )
+ SetColLabelValue( pos, val );
+ else
+ SetRowLabelValue( pos, val );
+ }
+
+ wxString GetLabelValue( int orientation, int pos) const
+ {
+ if ( orientation == wxHORIZONTAL )
+ return GetColLabelValue( pos );
+ else
+ return GetRowLabelValue( pos );
+ }
+
+ wxFont GetCellTextFont() const
+ { return m_defaultCellAttr->GetFont(); }
+
+ wxFont GetCellTextFont(int WXUNUSED(row), int WXUNUSED(col)) const
+ { return m_defaultCellAttr->GetFont(); }
+
+ void SetCellTextFont(const wxFont& fnt)
+ { SetDefaultCellFont( fnt ); }
+
+ void SetCellTextFont(const wxFont& fnt, int row, int col)
+ { SetCellFont( row, col, fnt ); }
+
+ void SetCellTextColour(const wxColour& val, int row, int col)
+ { SetCellTextColour( row, col, val ); }
+
+ void SetCellTextColour(const wxColour& col)
+ { SetDefaultCellTextColour( col ); }
+
+ void SetCellBackgroundColour(const wxColour& col)
+ { SetDefaultCellBackgroundColour( col ); }
+
+ void SetCellBackgroundColour(const wxColour& colour, int row, int col)
+ { SetCellBackgroundColour( row, col, colour ); }
+
+ bool GetEditable() const { return IsEditable(); }
+ void SetEditable( bool edit = true ) { EnableEditing( edit ); }
+ bool GetEditInPlace() const { return IsCellEditControlEnabled(); }
+
+ void SetEditInPlace(bool WXUNUSED(edit) = true) { }
+
+ void SetCellAlignment( int align, int row, int col)
+ { SetCellAlignment(row, col, align, wxALIGN_CENTER); }
+ void SetCellAlignment( int WXUNUSED(align) ) {}
+ void SetCellBitmap(wxBitmap *WXUNUSED(bitmap), int WXUNUSED(row), int WXUNUSED(col))
+ { }
+ void SetDividerPen(const wxPen& WXUNUSED(pen)) { }
+ wxPen& GetDividerPen() const;
+ void OnActivate(bool WXUNUSED(active)) {}
+
+ // ******** End of compatibility functions **********
+
+
+
+ // ------ control IDs
+ enum { wxGRID_CELLCTRL = 2000,
+ wxGRID_TOPCTRL };
+
+ // ------ control types
+ enum { wxGRID_TEXTCTRL = 2100,
+ wxGRID_CHECKBOX,
+ wxGRID_CHOICE,
+ wxGRID_COMBOBOX };
+
+ wxDEPRECATED_INLINE(bool CanDragRowSize() const, return m_canDragRowSize; )
+ wxDEPRECATED_INLINE(bool CanDragColSize() const, return m_canDragColSize; )
+#endif // WXWIN_COMPATIBILITY_2_8
+
+
+ // override some base class functions
+ virtual bool Enable(bool enable = true);
+ virtual wxWindow *GetMainWindowOfCompositeControl()
+ { return (wxWindow*)m_gridWin; }
+ virtual void Fit();
+
+ // implementation only
+ void CancelMouseCapture();
+
+protected:
+ virtual wxSize DoGetBestSize() const;
+
+ bool m_created;
+
+ wxGridWindow *m_gridWin;
+ wxGridCornerLabelWindow *m_cornerLabelWin;
+ wxGridRowLabelWindow *m_rowLabelWin;
+
+ // the real type of the column window depends on m_useNativeHeader value:
+ // if it is true, its dynamic type is wxHeaderCtrl, otherwise it is
+ // wxGridColLabelWindow, use accessors below when the real type matters
+ wxWindow *m_colWindow;
+
+ wxGridColLabelWindow *GetColLabelWindow() const
+ {
+ wxASSERT_MSG( !m_useNativeHeader, "no column label window" );
+
+ return reinterpret_cast<wxGridColLabelWindow *>(m_colWindow);
+ }
+
+ wxGridTableBase *m_table;
+ bool m_ownTable;
+
+ int m_numRows;
+ int m_numCols;
+
+ wxGridCellCoords m_currentCellCoords;
+
+ // the corners of the block being currently selected or wxGridNoCellCoords
+ wxGridCellCoords m_selectedBlockTopLeft;
+ wxGridCellCoords m_selectedBlockBottomRight;
+
+ // when selecting blocks of cells (either from the keyboard using Shift
+ // with cursor keys, or by dragging the mouse), the selection is anchored
+ // at m_currentCellCoords which defines one of the corners of the rectangle
+ // being selected -- and this variable defines the other corner, i.e. it's
+ // either m_selectedBlockTopLeft or m_selectedBlockBottomRight depending on
+ // which of them is not m_currentCellCoords
+ //
+ // if no block selection is in process, it is set to wxGridNoCellCoords
+ wxGridCellCoords m_selectedBlockCorner;
+
+ wxGridSelection *m_selection;
+
+ wxColour m_selectionBackground;
+ wxColour m_selectionForeground;
+
+ // NB: *never* access m_row/col arrays directly because they are created
+ // on demand, *always* use accessor functions instead!
+
+ // init the m_rowHeights/Bottoms arrays with default values
+ void InitRowHeights();
+
+ int m_defaultRowHeight;
+ int m_minAcceptableRowHeight;
+ wxArrayInt m_rowHeights;
+ wxArrayInt m_rowBottoms;
+
+ // init the m_colWidths/Rights arrays
+ void InitColWidths();
+
+ int m_defaultColWidth;
+ int m_minAcceptableColWidth;
+ wxArrayInt m_colWidths;
+ wxArrayInt m_colRights;
+
+ int m_sortCol;
+ bool m_sortIsAscending;
+
+ bool m_useNativeHeader,
+ m_nativeColumnLabels;
+
+ // get the col/row coords
+ int GetColWidth(int col) const;
+ int GetColLeft(int col) const;
+ int GetColRight(int col) const;
+
+ // this function must be public for compatibility...
+public:
+ int GetRowHeight(int row) const;
+protected:
+
+ int GetRowTop(int row) const;
+ int GetRowBottom(int row) const;
+
+ int m_rowLabelWidth;
+ int m_colLabelHeight;
+
+ // the size of the margin left to the right and bottom of the cell area
+ int m_extraWidth,
+ m_extraHeight;
+
+ wxColour m_labelBackgroundColour;
+ wxColour m_labelTextColour;
+ wxFont m_labelFont;
+
+ int m_rowLabelHorizAlign;
+ int m_rowLabelVertAlign;
+ int m_colLabelHorizAlign;
+ int m_colLabelVertAlign;
+ int m_colLabelTextOrientation;
+
+ bool m_defaultRowLabelValues;
+ bool m_defaultColLabelValues;
+
+ wxColour m_gridLineColour;
+ bool m_gridLinesEnabled;
+ bool m_gridLinesClipHorz,
+ m_gridLinesClipVert;
+ wxColour m_cellHighlightColour;
+ int m_cellHighlightPenWidth;
+ int m_cellHighlightROPenWidth;
+
+
+ // common part of AutoSizeColumn/Row() and GetBestSize()
+ int SetOrCalcColumnSizes(bool calcOnly, bool setAsMin = true);
+ int SetOrCalcRowSizes(bool calcOnly, bool setAsMin = true);
+
+ // common part of AutoSizeColumn/Row()
+ void AutoSizeColOrRow(int n, bool setAsMin, wxGridDirection direction);
+
+ // Calculate the minimum acceptable size for labels area
+ wxCoord CalcColOrRowLabelAreaMinSize(wxGridDirection direction);
+
+ // if a column has a minimal width, it will be the value for it in this
+ // hash table
+ wxLongToLongHashMap m_colMinWidths,
+ m_rowMinHeights;
+
+ // get the minimal width of the given column/row
+ int GetColMinimalWidth(int col) const;
+ int GetRowMinimalHeight(int col) const;
+
+ // do we have some place to store attributes in?
+ bool CanHaveAttributes() const;
+
+ // cell attribute cache (currently we only cache 1, may be will do
+ // more/better later)
+ struct CachedAttr
+ {
+ int row, col;
+ wxGridCellAttr *attr;
+ } m_attrCache;
+
+ // invalidates the attribute cache
+ void ClearAttrCache();
+
+ // adds an attribute to cache
+ void CacheAttr(int row, int col, wxGridCellAttr *attr) const;
+
+ // looks for an attr in cache, returns true if found
+ bool LookupAttr(int row, int col, wxGridCellAttr **attr) const;
+
+ // looks for the attr in cache, if not found asks the table and caches the
+ // result
+ wxGridCellAttr *GetCellAttr(int row, int col) const;
+ wxGridCellAttr *GetCellAttr(const wxGridCellCoords& coords ) const
+ { return GetCellAttr( coords.GetRow(), coords.GetCol() ); }
+
+ // the default cell attr object for cells that don't have their own
+ wxGridCellAttr* m_defaultCellAttr;
+
+
+ bool m_inOnKeyDown;
+ int m_batchCount;
+
+
+ wxGridTypeRegistry* m_typeRegistry;
+
+ enum CursorMode
+ {
+ WXGRID_CURSOR_SELECT_CELL,
+ WXGRID_CURSOR_RESIZE_ROW,
+ WXGRID_CURSOR_RESIZE_COL,
+ WXGRID_CURSOR_SELECT_ROW,
+ WXGRID_CURSOR_SELECT_COL,
+ WXGRID_CURSOR_MOVE_COL
+ };
+
+ // this method not only sets m_cursorMode but also sets the correct cursor
+ // for the given mode and, if captureMouse is not false releases the mouse
+ // if it was captured and captures it if it must be captured
+ //
+ // for this to work, you should always use it and not set m_cursorMode
+ // directly!
+ void ChangeCursorMode(CursorMode mode,
+ wxWindow *win = NULL,
+ bool captureMouse = true);
+
+ wxWindow *m_winCapture; // the window which captured the mouse
+
+ // this variable is used not for finding the correct current cursor but
+ // mainly for finding out what is going to happen if the mouse starts being
+ // dragged right now
+ //
+ // by default it is WXGRID_CURSOR_SELECT_CELL meaning that nothing else is
+ // going on, and it is set to one of RESIZE/SELECT/MOVE values while the
+ // corresponding operation will be started if the user starts dragging the
+ // mouse from the current position
+ CursorMode m_cursorMode;
+
+
+ //Column positions
+ wxArrayInt m_colAt;
+
+ bool m_canDragRowSize;
+ bool m_canDragColSize;
+ bool m_canDragColMove;
+ bool m_canDragGridSize;
+ bool m_canDragCell;
+
+ // the last position (horizontal or vertical depending on whether the user
+ // is resizing a column or a row) where a row or column separator line was
+ // dragged by the user or -1 of there is no drag operation in progress
+ int m_dragLastPos;
+ int m_dragRowOrCol;
+
+ // true if a drag operation is in progress; when this is true,
+ // m_startDragPos is valid, i.e. not wxDefaultPosition
+ bool m_isDragging;
+
+ // the position (in physical coordinates) where the user started dragging
+ // the mouse or wxDefaultPosition if mouse isn't being dragged
+ //
+ // notice that this can be != wxDefaultPosition while m_isDragging is still
+ // false because we wait until the mouse is moved some distance away before
+ // setting m_isDragging to true
+ wxPoint m_startDragPos;
+
+ bool m_waitForSlowClick;
+
+ wxGridCellCoords m_selectionStart;
+
+ wxCursor m_rowResizeCursor;
+ wxCursor m_colResizeCursor;
+
+ bool m_editable; // applies to whole grid
+ bool m_cellEditCtrlEnabled; // is in-place edit currently shown?
+
+ TabBehaviour m_tabBehaviour; // determines how the TAB key behaves
+
+ void Init(); // common part of all ctors
+ void Create();
+ void CreateColumnWindow();
+ void CalcDimensions();
+ void CalcWindowSizes();
+ bool Redimension( wxGridTableMessage& );
+
+
+ // generate the appropriate grid event and return -1 if it was vetoed, 1 if
+ // it was processed (but not vetoed) and 0 if it wasn't processed
+ int SendEvent(const wxEventType evtType,
+ int row, int col,
+ const wxMouseEvent& e);
+ int SendEvent(const wxEventType evtType,
+ const wxGridCellCoords& coords,
+ const wxMouseEvent& e)
+ { return SendEvent(evtType, coords.GetRow(), coords.GetCol(), e); }
+ int SendEvent(const wxEventType evtType,
+ int row, int col,
+ const wxString& s = wxString());
+ int SendEvent(const wxEventType evtType,
+ const wxGridCellCoords& coords,
+ const wxString& s = wxString())
+ { return SendEvent(evtType, coords.GetRow(), coords.GetCol(), s); }
+ int SendEvent(const wxEventType evtType, const wxString& s = wxString())
+ { return SendEvent(evtType, m_currentCellCoords, s); }
+
+ // send wxEVT_GRID_{ROW,COL}_SIZE or wxEVT_GRID_COL_AUTO_SIZE, return true
+ // if the event was processed, false otherwise
+ bool SendGridSizeEvent(wxEventType type,
+ int row, int col,
+ const wxMouseEvent& mouseEv);
+
+ void OnPaint( wxPaintEvent& );
+ void OnSize( wxSizeEvent& );
+ void OnKeyDown( wxKeyEvent& );
+ void OnKeyUp( wxKeyEvent& );
+ void OnChar( wxKeyEvent& );
+ void OnEraseBackground( wxEraseEvent& );
+ void OnHideEditor( wxCommandEvent& );
+
+
+ bool SetCurrentCell( const wxGridCellCoords& coords );
+ bool SetCurrentCell( int row, int col )
+ { return SetCurrentCell( wxGridCellCoords(row, col) ); }
+
+
+ // this function is called to extend the block being currently selected
+ // from mouse and keyboard event handlers
+ void UpdateBlockBeingSelected(int topRow, int leftCol,
+ int bottomRow, int rightCol);
+
+ void UpdateBlockBeingSelected(const wxGridCellCoords& topLeft,
+ const wxGridCellCoords& bottomRight)
+ { UpdateBlockBeingSelected(topLeft.GetRow(), topLeft.GetCol(),
+ bottomRight.GetRow(), bottomRight.GetCol()); }
+
+ // ------ functions to get/send data (see also public functions)
+ //
+ bool GetModelValues();
+ bool SetModelValues();
+
+ friend class WXDLLIMPEXP_FWD_ADV wxGridSelection;
+ friend class wxGridRowOperations;
+ friend class wxGridColumnOperations;
+
+ // they call our private Process{{Corner,Col,Row}Label,GridCell}MouseEvent()
+ friend class wxGridCornerLabelWindow;
+ friend class wxGridColLabelWindow;
+ friend class wxGridRowLabelWindow;
+ friend class wxGridWindow;
+ friend class wxGridHeaderRenderer;
+
+ friend class wxGridHeaderCtrl;
+
+private:
+
+ // implement wxScrolledWindow method to return m_gridWin size
+ virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size);
+
+ // redraw the grid lines, should be called after changing their attributes
+ void RedrawGridLines();
+
+ // draw all grid lines in the given cell region (unlike the public
+ // DrawAllGridLines() which just draws all of them)
+ void DrawRangeGridLines(wxDC& dc, const wxRegion& reg,
+ const wxGridCellCoords& topLeft,
+ const wxGridCellCoords& bottomRight);
+
+ // draw all lines from top to bottom row and left to right column in the
+ // rectangle determined by (top, left)-(bottom, right) -- but notice that
+ // the caller must have set up the clipping correctly, this rectangle is
+ // only used here for optimization
+ void DoDrawGridLines(wxDC& dc,
+ int top, int left,
+ int bottom, int right,
+ int topRow, int leftCol,
+ int bottomRight, int rightCol);
+
+ // common part of Clip{Horz,Vert}GridLines
+ void DoClipGridLines(bool& var, bool clip);
+
+ // update the sorting indicator shown in the specified column (whose index
+ // must be valid)
+ //
+ // this will use GetSortingColumn() and IsSortOrderAscending() to determine
+ // the sorting indicator to effectively show
+ void UpdateColumnSortingIndicator(int col);
+
+ // update the grid after changing the columns order (common part of
+ // SetColPos() and ResetColPos())
+ void RefreshAfterColPosChange();
+
+
+ // return the position (not index) of the column at the given logical pixel
+ // position
+ //
+ // this always returns a valid position, even if the coordinate is out of
+ // bounds (in which case first/last column is returned)
+ int XToPos(int x) const;
+
+
+ // event handlers and their helpers
+ // --------------------------------
+
+ // process mouse drag event in WXGRID_CURSOR_SELECT_CELL mode
+ bool DoGridCellDrag(wxMouseEvent& event,
+ const wxGridCellCoords& coords,
+ bool isFirstDrag);
+
+ // process row/column resizing drag event
+ void DoGridLineDrag(wxMouseEvent& event, const wxGridOperations& oper);
+
+ // process mouse drag event in the grid window
+ void DoGridDragEvent(wxMouseEvent& event, const wxGridCellCoords& coords);
+
+ // process different clicks on grid cells
+ void DoGridCellLeftDown(wxMouseEvent& event,
+ const wxGridCellCoords& coords,
+ const wxPoint& pos);
+ void DoGridCellLeftDClick(wxMouseEvent& event,
+ const wxGridCellCoords& coords,
+ const wxPoint& pos);
+ void DoGridCellLeftUp(wxMouseEvent& event, const wxGridCellCoords& coords);
+
+ // process movement (but not dragging) event in the grid cell area
+ void DoGridMouseMoveEvent(wxMouseEvent& event,
+ const wxGridCellCoords& coords,
+ const wxPoint& pos);
+
+ // process mouse events in the grid window
+ void ProcessGridCellMouseEvent(wxMouseEvent& event);
+
+ // process mouse events in the row/column labels/corner windows
+ void ProcessRowLabelMouseEvent(wxMouseEvent& event);
+ void ProcessColLabelMouseEvent(wxMouseEvent& event);
+ void ProcessCornerLabelMouseEvent(wxMouseEvent& event);
+
+ void DoColHeaderClick(int col);
+
+ void DoStartResizeCol(int col);
+ void DoUpdateResizeCol(int x);
+ void DoUpdateResizeColWidth(int w);
+ void DoStartMoveCol(int col);
+
+ void DoEndDragResizeRow(const wxMouseEvent& event);
+ void DoEndDragResizeCol(const wxMouseEvent& event);
+ void DoEndMoveCol(int pos);
+
+ // process a TAB keypress
+ void DoGridProcessTab(wxKeyboardState& kbdState);
+
+ // common implementations of methods defined for both rows and columns
+ void DeselectLine(int line, const wxGridOperations& oper);
+ bool DoEndDragResizeLine(const wxGridOperations& oper);
+ int PosToLinePos(int pos, bool clipToMinMax,
+ const wxGridOperations& oper) const;
+ int PosToLine(int pos, bool clipToMinMax,
+ const wxGridOperations& oper) const;
+ int PosToEdgeOfLine(int pos, const wxGridOperations& oper) const;
+
+ bool DoMoveCursor(bool expandSelection,
+ const wxGridDirectionOperations& diroper);
+ bool DoMoveCursorByPage(const wxGridDirectionOperations& diroper);
+ bool DoMoveCursorByBlock(bool expandSelection,
+ const wxGridDirectionOperations& diroper);
+ void AdvanceToNextNonEmpty(wxGridCellCoords& coords,
+ const wxGridDirectionOperations& diroper);
+
+ // common part of {Insert,Delete}{Rows,Cols}
+ bool DoModifyLines(bool (wxGridTableBase::*funcModify)(size_t, size_t),
+ int pos, int num, bool updateLabels);
+ // Append{Rows,Cols} is a bit different because of one less parameter
+ bool DoAppendLines(bool (wxGridTableBase::*funcAppend)(size_t),
+ int num, bool updateLabels);
+
+ // common part of Set{Col,Row}Sizes
+ void DoSetSizes(const wxGridSizesInfo& sizeInfo,
+ const wxGridOperations& oper);
+
+ // common part of Disable{Row,Col}Resize and CanDrag{Row,Col}Size
+ void DoDisableLineResize(int line, wxGridFixedIndicesSet *& setFixed);
+ bool DoCanResizeLine(int line, const wxGridFixedIndicesSet *setFixed) const;
+
+ // Helper of Render(): get grid size, origin offset and fill cell arrays
+ void GetRenderSizes( const wxGridCellCoords& topLeft,
+ const wxGridCellCoords& bottomRight,
+ wxPoint& pointOffSet, wxSize& sizeGrid,
+ wxGridCellCoordsArray& renderCells,
+ wxArrayInt& arrayCols, wxArrayInt& arrayRows );
+
+ // Helper of Render(): set the scale to draw the cells at the right size.
+ void SetRenderScale( wxDC& dc, const wxPoint& pos, const wxSize& size,
+ const wxSize& sizeGrid );
+
+ // Helper of Render(): get render start position from passed parameter
+ wxPoint GetRenderPosition( wxDC& dc, const wxPoint& position );
+
+ // Helper of Render(): draws a box around the rendered area
+ void DoRenderBox( wxDC& dc, const int& style,
+ const wxPoint& pointOffSet,
+ const wxSize& sizeCellArea,
+ const wxGridCellCoords& topLeft,
+ const wxGridCellCoords& bottomRight );
+
+ // Implementation of public Set{Row,Col}Size() and {Hide,Show}{Row,Col}().
+ // They interpret their height or width parameter slightly different from
+ // the public methods where -1 in it means "auto fit to the label" for the
+ // compatibility reasons. Here it means "show a previously hidden row or
+ // column" while 0 means "hide it" just as in the public methods. And any
+ // positive values are handled naturally, i.e. they just specify the size.
+ void DoSetRowSize( int row, int height );
+ void DoSetColSize( int col, int width );
+
+
+ // these sets contain the indices of fixed, i.e. non-resizable
+ // interactively, grid rows or columns and are NULL if there are no fixed
+ // elements (which is the default)
+ wxGridFixedIndicesSet *m_setFixedRows,
+ *m_setFixedCols;
+
+ DECLARE_DYNAMIC_CLASS( wxGrid )
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxGrid);
+};
+
+// ----------------------------------------------------------------------------
+// wxGridUpdateLocker prevents updates to a grid during its lifetime
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxGridUpdateLocker
+{
+public:
+ // if the pointer is NULL, Create() can be called later
+ wxGridUpdateLocker(wxGrid *grid = NULL)
+ {
+ Init(grid);
+ }
+
+ // can be called if ctor was used with a NULL pointer, must not be called
+ // more than once
+ void Create(wxGrid *grid)
+ {
+ wxASSERT_MSG( !m_grid, wxT("shouldn't be called more than once") );
+
+ Init(grid);
+ }
+
+ ~wxGridUpdateLocker()
+ {
+ if ( m_grid )
+ m_grid->EndBatch();
+ }
+
+private:
+ void Init(wxGrid *grid)
+ {
+ m_grid = grid;
+ if ( m_grid )
+ m_grid->BeginBatch();
+ }
+
+ wxGrid *m_grid;
+
+ wxDECLARE_NO_COPY_CLASS(wxGridUpdateLocker);
+};
+
+// ----------------------------------------------------------------------------
+// Grid event class and event types
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxGridEvent : public wxNotifyEvent,
+ public wxKeyboardState
+{
+public:
+ wxGridEvent()
+ : wxNotifyEvent()
+ {
+ Init(-1, -1, -1, -1, false);
+ }
+
+ wxGridEvent(int id,
+ wxEventType type,
+ wxObject* obj,
+ int row = -1, int col = -1,
+ int x = -1, int y = -1,
+ bool sel = true,
+ const wxKeyboardState& kbd = wxKeyboardState())
+ : wxNotifyEvent(type, id),
+ wxKeyboardState(kbd)
+ {
+ Init(row, col, x, y, sel);
+ SetEventObject(obj);
+ }
+
+ // explicitly specifying inline allows gcc < 3.4 to
+ // handle the deprecation attribute even in the constructor.
+ wxDEPRECATED_CONSTRUCTOR(
+ wxGridEvent(int id,
+ wxEventType type,
+ wxObject* obj,
+ int row, int col,
+ int x, int y,
+ bool sel,
+ bool control,
+ bool shift = false, bool alt = false, bool meta = false));
+
+ virtual int GetRow() { return m_row; }
+ virtual int GetCol() { return m_col; }
+ wxPoint GetPosition() { return wxPoint( m_x, m_y ); }
+ bool Selecting() { return m_selecting; }
+
+ virtual wxEvent *Clone() const { return new wxGridEvent(*this); }
+
+protected:
+ int m_row;
+ int m_col;
+ int m_x;
+ int m_y;
+ bool m_selecting;
+
+private:
+ void Init(int row, int col, int x, int y, bool sel)
+ {
+ m_row = row;
+ m_col = col;
+ m_x = x;
+ m_y = y;
+ m_selecting = sel;
+ }
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGridEvent)
+};
+
+class WXDLLIMPEXP_ADV wxGridSizeEvent : public wxNotifyEvent,
+ public wxKeyboardState
+{
+public:
+ wxGridSizeEvent()
+ : wxNotifyEvent()
+ {
+ Init(-1, -1, -1);
+ }
+
+ wxGridSizeEvent(int id,
+ wxEventType type,
+ wxObject* obj,
+ int rowOrCol = -1,
+ int x = -1, int y = -1,
+ const wxKeyboardState& kbd = wxKeyboardState())
+ : wxNotifyEvent(type, id),
+ wxKeyboardState(kbd)
+ {
+ Init(rowOrCol, x, y);
+
+ SetEventObject(obj);
+ }
+
+ wxDEPRECATED_CONSTRUCTOR(
+ wxGridSizeEvent(int id,
+ wxEventType type,
+ wxObject* obj,
+ int rowOrCol,
+ int x, int y,
+ bool control,
+ bool shift = false,
+ bool alt = false,
+ bool meta = false) );
+
+ int GetRowOrCol() { return m_rowOrCol; }
+ wxPoint GetPosition() { return wxPoint( m_x, m_y ); }
+
+ virtual wxEvent *Clone() const { return new wxGridSizeEvent(*this); }
+
+protected:
+ int m_rowOrCol;
+ int m_x;
+ int m_y;
+
+private:
+ void Init(int rowOrCol, int x, int y)
+ {
+ m_rowOrCol = rowOrCol;
+ m_x = x;
+ m_y = y;
+ }
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGridSizeEvent)
+};
+
+
+class WXDLLIMPEXP_ADV wxGridRangeSelectEvent : public wxNotifyEvent,
+ public wxKeyboardState
+{
+public:
+ wxGridRangeSelectEvent()
+ : wxNotifyEvent()
+ {
+ Init(wxGridNoCellCoords, wxGridNoCellCoords, false);
+ }
+
+ wxGridRangeSelectEvent(int id,
+ wxEventType type,
+ wxObject* obj,
+ const wxGridCellCoords& topLeft,
+ const wxGridCellCoords& bottomRight,
+ bool sel = true,
+ const wxKeyboardState& kbd = wxKeyboardState())
+ : wxNotifyEvent(type, id),
+ wxKeyboardState(kbd)
+ {
+ Init(topLeft, bottomRight, sel);
+
+ SetEventObject(obj);
+ }
+
+ wxDEPRECATED_CONSTRUCTOR(
+ wxGridRangeSelectEvent(int id,
+ wxEventType type,
+ wxObject* obj,
+ const wxGridCellCoords& topLeft,
+ const wxGridCellCoords& bottomRight,
+ bool sel,
+ bool control,
+ bool shift = false,
+ bool alt = false,
+ bool meta = false) );
+
+ wxGridCellCoords GetTopLeftCoords() { return m_topLeft; }
+ wxGridCellCoords GetBottomRightCoords() { return m_bottomRight; }
+ int GetTopRow() { return m_topLeft.GetRow(); }
+ int GetBottomRow() { return m_bottomRight.GetRow(); }
+ int GetLeftCol() { return m_topLeft.GetCol(); }
+ int GetRightCol() { return m_bottomRight.GetCol(); }
+ bool Selecting() { return m_selecting; }
+
+ virtual wxEvent *Clone() const { return new wxGridRangeSelectEvent(*this); }
+
+protected:
+ void Init(const wxGridCellCoords& topLeft,
+ const wxGridCellCoords& bottomRight,
+ bool selecting)
+ {
+ m_topLeft = topLeft;
+ m_bottomRight = bottomRight;
+ m_selecting = selecting;
+ }
+
+ wxGridCellCoords m_topLeft;
+ wxGridCellCoords m_bottomRight;
+ bool m_selecting;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGridRangeSelectEvent)
+};
+
+
+class WXDLLIMPEXP_ADV wxGridEditorCreatedEvent : public wxCommandEvent
+{
+public:
+ wxGridEditorCreatedEvent()
+ : wxCommandEvent()
+ {
+ m_row = 0;
+ m_col = 0;
+ m_ctrl = NULL;
+ }
+
+ wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj,
+ int row, int col, wxControl* ctrl);
+
+ int GetRow() { return m_row; }
+ int GetCol() { return m_col; }
+ wxControl* GetControl() { return m_ctrl; }
+ void SetRow(int row) { m_row = row; }
+ void SetCol(int col) { m_col = col; }
+ void SetControl(wxControl* ctrl) { m_ctrl = ctrl; }
+
+ virtual wxEvent *Clone() const { return new wxGridEditorCreatedEvent(*this); }
+
+private:
+ int m_row;
+ int m_col;
+ wxControl* m_ctrl;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGridEditorCreatedEvent)
+};
+
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_LEFT_CLICK, wxGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_RIGHT_DCLICK, wxGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_LABEL_RIGHT_CLICK, wxGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_LABEL_LEFT_DCLICK, wxGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_LABEL_RIGHT_DCLICK, wxGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_ROW_SIZE, wxGridSizeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_COL_SIZE, wxGridSizeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_COL_AUTO_SIZE, wxGridSizeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_RANGE_SELECT, wxGridRangeSelectEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_CHANGING, wxGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_CHANGED, wxGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_SELECT_CELL, wxGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_EDITOR_SHOWN, wxGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_EDITOR_HIDDEN, wxGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_EDITOR_CREATED, wxGridEditorCreatedEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_BEGIN_DRAG, wxGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_COL_MOVE, wxGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_COL_SORT, wxGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_GRID_TABBING, wxGridEvent );
+
+typedef void (wxEvtHandler::*wxGridEventFunction)(wxGridEvent&);
+typedef void (wxEvtHandler::*wxGridSizeEventFunction)(wxGridSizeEvent&);
+typedef void (wxEvtHandler::*wxGridRangeSelectEventFunction)(wxGridRangeSelectEvent&);
+typedef void (wxEvtHandler::*wxGridEditorCreatedEventFunction)(wxGridEditorCreatedEvent&);
+
+#define wxGridEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxGridEventFunction, func)
+
+#define wxGridSizeEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxGridSizeEventFunction, func)
+
+#define wxGridRangeSelectEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxGridRangeSelectEventFunction, func)
+
+#define wxGridEditorCreatedEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxGridEditorCreatedEventFunction, func)
+
+#define wx__DECLARE_GRIDEVT(evt, id, fn) \
+ wx__DECLARE_EVT1(wxEVT_GRID_ ## evt, id, wxGridEventHandler(fn))
+
+#define wx__DECLARE_GRIDSIZEEVT(evt, id, fn) \
+ wx__DECLARE_EVT1(wxEVT_GRID_ ## evt, id, wxGridSizeEventHandler(fn))
+
+#define wx__DECLARE_GRIDRANGESELEVT(evt, id, fn) \
+ wx__DECLARE_EVT1(wxEVT_GRID_ ## evt, id, wxGridRangeSelectEventHandler(fn))
+
+#define wx__DECLARE_GRIDEDITOREVT(evt, id, fn) \
+ wx__DECLARE_EVT1(wxEVT_GRID_ ## evt, id, wxGridEditorCreatedEventHandler(fn))
+
+#define EVT_GRID_CMD_CELL_LEFT_CLICK(id, fn) wx__DECLARE_GRIDEVT(CELL_LEFT_CLICK, id, fn)
+#define EVT_GRID_CMD_CELL_RIGHT_CLICK(id, fn) wx__DECLARE_GRIDEVT(CELL_RIGHT_CLICK, id, fn)
+#define EVT_GRID_CMD_CELL_LEFT_DCLICK(id, fn) wx__DECLARE_GRIDEVT(CELL_LEFT_DCLICK, id, fn)
+#define EVT_GRID_CMD_CELL_RIGHT_DCLICK(id, fn) wx__DECLARE_GRIDEVT(CELL_RIGHT_DCLICK, id, fn)
+#define EVT_GRID_CMD_LABEL_LEFT_CLICK(id, fn) wx__DECLARE_GRIDEVT(LABEL_LEFT_CLICK, id, fn)
+#define EVT_GRID_CMD_LABEL_RIGHT_CLICK(id, fn) wx__DECLARE_GRIDEVT(LABEL_RIGHT_CLICK, id, fn)
+#define EVT_GRID_CMD_LABEL_LEFT_DCLICK(id, fn) wx__DECLARE_GRIDEVT(LABEL_LEFT_DCLICK, id, fn)
+#define EVT_GRID_CMD_LABEL_RIGHT_DCLICK(id, fn) wx__DECLARE_GRIDEVT(LABEL_RIGHT_DCLICK, id, fn)
+#define EVT_GRID_CMD_ROW_SIZE(id, fn) wx__DECLARE_GRIDSIZEEVT(ROW_SIZE, id, fn)
+#define EVT_GRID_CMD_COL_SIZE(id, fn) wx__DECLARE_GRIDSIZEEVT(COL_SIZE, id, fn)
+#define EVT_GRID_CMD_COL_AUTO_SIZE(id, fn) wx__DECLARE_GRIDSIZEEVT(COL_AUTO_SIZE, id, fn)
+#define EVT_GRID_CMD_COL_MOVE(id, fn) wx__DECLARE_GRIDEVT(COL_MOVE, id, fn)
+#define EVT_GRID_CMD_COL_SORT(id, fn) wx__DECLARE_GRIDEVT(COL_SORT, id, fn)
+#define EVT_GRID_CMD_RANGE_SELECT(id, fn) wx__DECLARE_GRIDRANGESELEVT(RANGE_SELECT, id, fn)
+#define EVT_GRID_CMD_CELL_CHANGING(id, fn) wx__DECLARE_GRIDEVT(CELL_CHANGING, id, fn)
+#define EVT_GRID_CMD_CELL_CHANGED(id, fn) wx__DECLARE_GRIDEVT(CELL_CHANGED, id, fn)
+#define EVT_GRID_CMD_SELECT_CELL(id, fn) wx__DECLARE_GRIDEVT(SELECT_CELL, id, fn)
+#define EVT_GRID_CMD_EDITOR_SHOWN(id, fn) wx__DECLARE_GRIDEVT(EDITOR_SHOWN, id, fn)
+#define EVT_GRID_CMD_EDITOR_HIDDEN(id, fn) wx__DECLARE_GRIDEVT(EDITOR_HIDDEN, id, fn)
+#define EVT_GRID_CMD_EDITOR_CREATED(id, fn) wx__DECLARE_GRIDEDITOREVT(EDITOR_CREATED, id, fn)
+#define EVT_GRID_CMD_CELL_BEGIN_DRAG(id, fn) wx__DECLARE_GRIDEVT(CELL_BEGIN_DRAG, id, fn)
+#define EVT_GRID_CMD_TABBING(id, fn) wx__DECLARE_GRIDEVT(TABBING, id, fn)
+
+// same as above but for any id (exists mainly for backwards compatibility but
+// then it's also true that you rarely have multiple grid in the same window)
+#define EVT_GRID_CELL_LEFT_CLICK(fn) EVT_GRID_CMD_CELL_LEFT_CLICK(wxID_ANY, fn)
+#define EVT_GRID_CELL_RIGHT_CLICK(fn) EVT_GRID_CMD_CELL_RIGHT_CLICK(wxID_ANY, fn)
+#define EVT_GRID_CELL_LEFT_DCLICK(fn) EVT_GRID_CMD_CELL_LEFT_DCLICK(wxID_ANY, fn)
+#define EVT_GRID_CELL_RIGHT_DCLICK(fn) EVT_GRID_CMD_CELL_RIGHT_DCLICK(wxID_ANY, fn)
+#define EVT_GRID_LABEL_LEFT_CLICK(fn) EVT_GRID_CMD_LABEL_LEFT_CLICK(wxID_ANY, fn)
+#define EVT_GRID_LABEL_RIGHT_CLICK(fn) EVT_GRID_CMD_LABEL_RIGHT_CLICK(wxID_ANY, fn)
+#define EVT_GRID_LABEL_LEFT_DCLICK(fn) EVT_GRID_CMD_LABEL_LEFT_DCLICK(wxID_ANY, fn)
+#define EVT_GRID_LABEL_RIGHT_DCLICK(fn) EVT_GRID_CMD_LABEL_RIGHT_DCLICK(wxID_ANY, fn)
+#define EVT_GRID_ROW_SIZE(fn) EVT_GRID_CMD_ROW_SIZE(wxID_ANY, fn)
+#define EVT_GRID_COL_SIZE(fn) EVT_GRID_CMD_COL_SIZE(wxID_ANY, fn)
+#define EVT_GRID_COL_AUTO_SIZE(fn) EVT_GRID_CMD_COL_AUTO_SIZE(wxID_ANY, fn)
+#define EVT_GRID_COL_MOVE(fn) EVT_GRID_CMD_COL_MOVE(wxID_ANY, fn)
+#define EVT_GRID_COL_SORT(fn) EVT_GRID_CMD_COL_SORT(wxID_ANY, fn)
+#define EVT_GRID_RANGE_SELECT(fn) EVT_GRID_CMD_RANGE_SELECT(wxID_ANY, fn)
+#define EVT_GRID_CELL_CHANGING(fn) EVT_GRID_CMD_CELL_CHANGING(wxID_ANY, fn)
+#define EVT_GRID_CELL_CHANGED(fn) EVT_GRID_CMD_CELL_CHANGED(wxID_ANY, fn)
+#define EVT_GRID_SELECT_CELL(fn) EVT_GRID_CMD_SELECT_CELL(wxID_ANY, fn)
+#define EVT_GRID_EDITOR_SHOWN(fn) EVT_GRID_CMD_EDITOR_SHOWN(wxID_ANY, fn)
+#define EVT_GRID_EDITOR_HIDDEN(fn) EVT_GRID_CMD_EDITOR_HIDDEN(wxID_ANY, fn)
+#define EVT_GRID_EDITOR_CREATED(fn) EVT_GRID_CMD_EDITOR_CREATED(wxID_ANY, fn)
+#define EVT_GRID_CELL_BEGIN_DRAG(fn) EVT_GRID_CMD_CELL_BEGIN_DRAG(wxID_ANY, fn)
+#define EVT_GRID_TABBING(fn) EVT_GRID_CMD_TABBING(wxID_ANY, fn)
+
+// we used to have a single wxEVT_GRID_CELL_CHANGE event but it was split into
+// wxEVT_GRID_CELL_CHANGING and CHANGED ones in wx 2.9.0, however the CHANGED
+// is basically the same as the old CHANGE event so we keep the name for
+// compatibility
+#if WXWIN_COMPATIBILITY_2_8
+ #define wxEVT_GRID_CELL_CHANGE wxEVT_GRID_CELL_CHANGED
+
+ #define EVT_GRID_CMD_CELL_CHANGE EVT_GRID_CMD_CELL_CHANGED
+ #define EVT_GRID_CELL_CHANGE EVT_GRID_CELL_CHANGED
+#endif // WXWIN_COMPATIBILITY_2_8
+
+#if 0 // TODO: implement these ? others ?
+
+extern const int wxEVT_GRID_CREATE_CELL;
+extern const int wxEVT_GRID_CHANGE_LABELS;
+extern const int wxEVT_GRID_CHANGE_SEL_LABEL;
+
+#define EVT_GRID_CREATE_CELL(fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CREATE_CELL, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CHANGE_LABELS(fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CHANGE_LABELS, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CHANGE_SEL_LABEL(fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CHANGE_SEL_LABEL, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+
+#endif
+
+#endif // wxUSE_GRID
+#endif // _WX_GENERIC_GRID_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/gridctrl.h
+// Purpose: wxGrid controls
+// Author: Paul Gammans, Roger Gammans
+// Modified by:
+// Created: 11/04/2001
+// Copyright: (c) The Computer Surgery (paul@compsurg.co.uk)
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_GRIDCTRL_H_
+#define _WX_GENERIC_GRIDCTRL_H_
+
+#include "wx/grid.h"
+
+#if wxUSE_GRID
+
+#define wxGRID_VALUE_CHOICEINT wxT("choiceint")
+#define wxGRID_VALUE_DATETIME wxT("datetime")
+
+
+// the default renderer for the cells containing string data
+class WXDLLIMPEXP_ADV wxGridCellStringRenderer : public wxGridCellRenderer
+{
+public:
+ // draw the string
+ virtual void Draw(wxGrid& grid,
+ wxGridCellAttr& attr,
+ wxDC& dc,
+ const wxRect& rect,
+ int row, int col,
+ bool isSelected);
+
+ // return the string extent
+ virtual wxSize GetBestSize(wxGrid& grid,
+ wxGridCellAttr& attr,
+ wxDC& dc,
+ int row, int col);
+
+ virtual wxGridCellRenderer *Clone() const
+ { return new wxGridCellStringRenderer; }
+
+protected:
+ // set the text colours before drawing
+ void SetTextColoursAndFont(const wxGrid& grid,
+ const wxGridCellAttr& attr,
+ wxDC& dc,
+ bool isSelected);
+
+ // calc the string extent for given string/font
+ wxSize DoGetBestSize(const wxGridCellAttr& attr,
+ wxDC& dc,
+ const wxString& text);
+};
+
+// the default renderer for the cells containing numeric (long) data
+class WXDLLIMPEXP_ADV wxGridCellNumberRenderer : public wxGridCellStringRenderer
+{
+public:
+ // draw the string right aligned
+ virtual void Draw(wxGrid& grid,
+ wxGridCellAttr& attr,
+ wxDC& dc,
+ const wxRect& rect,
+ int row, int col,
+ bool isSelected);
+
+ virtual wxSize GetBestSize(wxGrid& grid,
+ wxGridCellAttr& attr,
+ wxDC& dc,
+ int row, int col);
+
+ virtual wxGridCellRenderer *Clone() const
+ { return new wxGridCellNumberRenderer; }
+
+protected:
+ wxString GetString(const wxGrid& grid, int row, int col);
+};
+
+class WXDLLIMPEXP_ADV wxGridCellFloatRenderer : public wxGridCellStringRenderer
+{
+public:
+ wxGridCellFloatRenderer(int width = -1,
+ int precision = -1,
+ int format = wxGRID_FLOAT_FORMAT_DEFAULT);
+
+ // get/change formatting parameters
+ int GetWidth() const { return m_width; }
+ void SetWidth(int width) { m_width = width; m_format.clear(); }
+ int GetPrecision() const { return m_precision; }
+ void SetPrecision(int precision) { m_precision = precision; m_format.clear(); }
+ int GetFormat() const { return m_style; }
+ void SetFormat(int format) { m_style = format; m_format.clear(); }
+
+ // draw the string right aligned with given width/precision
+ virtual void Draw(wxGrid& grid,
+ wxGridCellAttr& attr,
+ wxDC& dc,
+ const wxRect& rect,
+ int row, int col,
+ bool isSelected);
+
+ virtual wxSize GetBestSize(wxGrid& grid,
+ wxGridCellAttr& attr,
+ wxDC& dc,
+ int row, int col);
+
+ // parameters string format is "width[,precision[,format]]"
+ // with format being one of f|e|g|E|F|G
+ virtual void SetParameters(const wxString& params);
+
+ virtual wxGridCellRenderer *Clone() const;
+
+protected:
+ wxString GetString(const wxGrid& grid, int row, int col);
+
+private:
+ // formatting parameters
+ int m_width,
+ m_precision;
+
+ int m_style;
+ wxString m_format;
+};
+
+// renderer for boolean fields
+class WXDLLIMPEXP_ADV wxGridCellBoolRenderer : public wxGridCellRenderer
+{
+public:
+ // draw a check mark or nothing
+ virtual void Draw(wxGrid& grid,
+ wxGridCellAttr& attr,
+ wxDC& dc,
+ const wxRect& rect,
+ int row, int col,
+ bool isSelected);
+
+ // return the checkmark size
+ virtual wxSize GetBestSize(wxGrid& grid,
+ wxGridCellAttr& attr,
+ wxDC& dc,
+ int row, int col);
+
+ virtual wxGridCellRenderer *Clone() const
+ { return new wxGridCellBoolRenderer; }
+
+private:
+ static wxSize ms_sizeCheckMark;
+};
+
+
+#if wxUSE_DATETIME
+
+#include "wx/datetime.h"
+
+// the default renderer for the cells containing times and dates
+class WXDLLIMPEXP_ADV wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
+{
+public:
+ wxGridCellDateTimeRenderer(const wxString& outformat = wxDefaultDateTimeFormat,
+ const wxString& informat = wxDefaultDateTimeFormat);
+
+ // draw the string right aligned
+ virtual void Draw(wxGrid& grid,
+ wxGridCellAttr& attr,
+ wxDC& dc,
+ const wxRect& rect,
+ int row, int col,
+ bool isSelected);
+
+ virtual wxSize GetBestSize(wxGrid& grid,
+ wxGridCellAttr& attr,
+ wxDC& dc,
+ int row, int col);
+
+ virtual wxGridCellRenderer *Clone() const;
+
+ // output strptime()-like format string
+ virtual void SetParameters(const wxString& params);
+
+protected:
+ wxString GetString(const wxGrid& grid, int row, int col);
+
+ wxString m_iformat;
+ wxString m_oformat;
+ wxDateTime m_dateDef;
+ wxDateTime::TimeZone m_tz;
+};
+
+#endif // wxUSE_DATETIME
+
+// renders a number using the corresponding text string
+class WXDLLIMPEXP_ADV wxGridCellEnumRenderer : public wxGridCellStringRenderer
+{
+public:
+ wxGridCellEnumRenderer( const wxString& choices = wxEmptyString );
+
+ // draw the string right aligned
+ virtual void Draw(wxGrid& grid,
+ wxGridCellAttr& attr,
+ wxDC& dc,
+ const wxRect& rect,
+ int row, int col,
+ bool isSelected);
+
+ virtual wxSize GetBestSize(wxGrid& grid,
+ wxGridCellAttr& attr,
+ wxDC& dc,
+ int row, int col);
+
+ virtual wxGridCellRenderer *Clone() const;
+
+ // parameters string format is "item1[,item2[...,itemN]]" where itemN will
+ // be used if the cell value is N-1
+ virtual void SetParameters(const wxString& params);
+
+protected:
+ wxString GetString(const wxGrid& grid, int row, int col);
+
+ wxArrayString m_choices;
+};
+
+
+class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer
+{
+public:
+ wxGridCellAutoWrapStringRenderer() : wxGridCellStringRenderer() { }
+
+ virtual void Draw(wxGrid& grid,
+ wxGridCellAttr& attr,
+ wxDC& dc,
+ const wxRect& rect,
+ int row, int col,
+ bool isSelected);
+
+ virtual wxSize GetBestSize(wxGrid& grid,
+ wxGridCellAttr& attr,
+ wxDC& dc,
+ int row, int col);
+
+ virtual wxGridCellRenderer *Clone() const
+ { return new wxGridCellAutoWrapStringRenderer; }
+
+private:
+ wxArrayString GetTextLines( wxGrid& grid,
+ wxDC& dc,
+ const wxGridCellAttr& attr,
+ const wxRect& rect,
+ int row, int col);
+
+ // Helper methods of GetTextLines()
+
+ // Break a single logical line of text into several physical lines, all of
+ // which are added to the lines array. The lines are broken at maxWidth and
+ // the dc is used for measuring text extent only.
+ void BreakLine(wxDC& dc,
+ const wxString& logicalLine,
+ wxCoord maxWidth,
+ wxArrayString& lines);
+
+ // Break a word, which is supposed to be wider than maxWidth, into several
+ // lines, which are added to lines array and the last, incomplete, of which
+ // is returned in line output parameter.
+ //
+ // Returns the width of the last line.
+ wxCoord BreakWord(wxDC& dc,
+ const wxString& word,
+ wxCoord maxWidth,
+ wxArrayString& lines,
+ wxString& line);
+
+
+};
+
+#endif // wxUSE_GRID
+#endif // _WX_GENERIC_GRIDCTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/grideditors.h
+// Purpose: wxGridCellEditorEvtHandler and wxGrid editors
+// Author: Michael Bedward (based on code by Julian Smart, Robin Dunn)
+// Modified by: Santiago Palacios
+// Created: 1/08/1999
+// Copyright: (c) Michael Bedward
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_GRID_EDITORS_H_
+#define _WX_GENERIC_GRID_EDITORS_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_GRID
+
+#include "wx/scopedptr.h"
+
+class wxGridCellEditorEvtHandler : public wxEvtHandler
+{
+public:
+ wxGridCellEditorEvtHandler(wxGrid* grid, wxGridCellEditor* editor)
+ : m_grid(grid),
+ m_editor(editor),
+ m_inSetFocus(false)
+ {
+ }
+
+ void OnKillFocus(wxFocusEvent& event);
+ void OnKeyDown(wxKeyEvent& event);
+ void OnChar(wxKeyEvent& event);
+
+ void SetInSetFocus(bool inSetFocus) { m_inSetFocus = inSetFocus; }
+
+private:
+ wxGrid *m_grid;
+ wxGridCellEditor *m_editor;
+
+ // Work around the fact that a focus kill event can be sent to
+ // a combobox within a set focus event.
+ bool m_inSetFocus;
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxGridCellEditorEvtHandler)
+ wxDECLARE_NO_COPY_CLASS(wxGridCellEditorEvtHandler);
+};
+
+
+#if wxUSE_TEXTCTRL
+
+// the editor for string/text data
+class WXDLLIMPEXP_ADV wxGridCellTextEditor : public wxGridCellEditor
+{
+public:
+ wxEXPLICIT wxGridCellTextEditor(size_t maxChars = 0);
+
+ virtual void Create(wxWindow* parent,
+ wxWindowID id,
+ wxEvtHandler* evtHandler);
+ virtual void SetSize(const wxRect& rect);
+
+ virtual void PaintBackground(wxDC& dc,
+ const wxRect& rectCell,
+ const wxGridCellAttr& attr);
+
+ virtual bool IsAcceptedKey(wxKeyEvent& event);
+ virtual void BeginEdit(int row, int col, wxGrid* grid);
+ virtual bool EndEdit(int row, int col, const wxGrid* grid,
+ const wxString& oldval, wxString *newval);
+ virtual void ApplyEdit(int row, int col, wxGrid* grid);
+
+ virtual void Reset();
+ virtual void StartingKey(wxKeyEvent& event);
+ virtual void HandleReturn(wxKeyEvent& event);
+
+ // parameters string format is "max_width"
+ virtual void SetParameters(const wxString& params);
+ virtual void SetValidator(const wxValidator& validator);
+
+ virtual wxGridCellEditor *Clone() const;
+
+ // added GetValue so we can get the value which is in the control
+ virtual wxString GetValue() const;
+
+protected:
+ wxTextCtrl *Text() const { return (wxTextCtrl *)m_control; }
+
+ // parts of our virtual functions reused by the derived classes
+ void DoCreate(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler,
+ long style = 0);
+ void DoBeginEdit(const wxString& startValue);
+ void DoReset(const wxString& startValue);
+
+private:
+ size_t m_maxChars; // max number of chars allowed
+ wxScopedPtr<wxValidator> m_validator;
+ wxString m_value;
+
+ wxDECLARE_NO_COPY_CLASS(wxGridCellTextEditor);
+};
+
+// the editor for numeric (long) data
+class WXDLLIMPEXP_ADV wxGridCellNumberEditor : public wxGridCellTextEditor
+{
+public:
+ // allows to specify the range - if min == max == -1, no range checking is
+ // done
+ wxGridCellNumberEditor(int min = -1, int max = -1);
+
+ virtual void Create(wxWindow* parent,
+ wxWindowID id,
+ wxEvtHandler* evtHandler);
+
+ virtual bool IsAcceptedKey(wxKeyEvent& event);
+ virtual void BeginEdit(int row, int col, wxGrid* grid);
+ virtual bool EndEdit(int row, int col, const wxGrid* grid,
+ const wxString& oldval, wxString *newval);
+ virtual void ApplyEdit(int row, int col, wxGrid* grid);
+
+ virtual void Reset();
+ virtual void StartingKey(wxKeyEvent& event);
+
+ // parameters string format is "min,max"
+ virtual void SetParameters(const wxString& params);
+
+ virtual wxGridCellEditor *Clone() const
+ { return new wxGridCellNumberEditor(m_min, m_max); }
+
+ // added GetValue so we can get the value which is in the control
+ virtual wxString GetValue() const;
+
+protected:
+#if wxUSE_SPINCTRL
+ wxSpinCtrl *Spin() const { return (wxSpinCtrl *)m_control; }
+#endif
+
+ // if HasRange(), we use wxSpinCtrl - otherwise wxTextCtrl
+ bool HasRange() const
+ {
+#if wxUSE_SPINCTRL
+ return m_min != m_max;
+#else
+ return false;
+#endif
+ }
+
+ // string representation of our value
+ wxString GetString() const
+ { return wxString::Format(wxT("%ld"), m_value); }
+
+private:
+ int m_min,
+ m_max;
+
+ long m_value;
+
+ wxDECLARE_NO_COPY_CLASS(wxGridCellNumberEditor);
+};
+
+
+enum wxGridCellFloatFormat
+{
+ // Decimal floating point (%f)
+ wxGRID_FLOAT_FORMAT_FIXED = 0x0010,
+
+ // Scientific notation (mantise/exponent) using e character (%e)
+ wxGRID_FLOAT_FORMAT_SCIENTIFIC = 0x0020,
+
+ // Use the shorter of %e or %f (%g)
+ wxGRID_FLOAT_FORMAT_COMPACT = 0x0040,
+
+ // To use in combination with one of the above formats (%F/%E/%G)
+ wxGRID_FLOAT_FORMAT_UPPER = 0x0080,
+
+ // Format used by default.
+ wxGRID_FLOAT_FORMAT_DEFAULT = wxGRID_FLOAT_FORMAT_FIXED,
+
+ // A mask to extract format from the combination of flags.
+ wxGRID_FLOAT_FORMAT_MASK = wxGRID_FLOAT_FORMAT_FIXED |
+ wxGRID_FLOAT_FORMAT_SCIENTIFIC |
+ wxGRID_FLOAT_FORMAT_COMPACT |
+ wxGRID_FLOAT_FORMAT_UPPER
+};
+
+// the editor for floating point numbers (double) data
+class WXDLLIMPEXP_ADV wxGridCellFloatEditor : public wxGridCellTextEditor
+{
+public:
+ wxGridCellFloatEditor(int width = -1,
+ int precision = -1,
+ int format = wxGRID_FLOAT_FORMAT_DEFAULT);
+
+ virtual void Create(wxWindow* parent,
+ wxWindowID id,
+ wxEvtHandler* evtHandler);
+
+ virtual bool IsAcceptedKey(wxKeyEvent& event);
+ virtual void BeginEdit(int row, int col, wxGrid* grid);
+ virtual bool EndEdit(int row, int col, const wxGrid* grid,
+ const wxString& oldval, wxString *newval);
+ virtual void ApplyEdit(int row, int col, wxGrid* grid);
+
+ virtual void Reset();
+ virtual void StartingKey(wxKeyEvent& event);
+
+ virtual wxGridCellEditor *Clone() const
+ { return new wxGridCellFloatEditor(m_width, m_precision); }
+
+ // parameters string format is "width[,precision[,format]]"
+ // format to choose beween f|e|g|E|G (f is used by default)
+ virtual void SetParameters(const wxString& params);
+
+protected:
+ // string representation of our value
+ wxString GetString();
+
+private:
+ int m_width,
+ m_precision;
+ double m_value;
+
+ int m_style;
+ wxString m_format;
+
+ wxDECLARE_NO_COPY_CLASS(wxGridCellFloatEditor);
+};
+
+#endif // wxUSE_TEXTCTRL
+
+#if wxUSE_CHECKBOX
+
+// the editor for boolean data
+class WXDLLIMPEXP_ADV wxGridCellBoolEditor : public wxGridCellEditor
+{
+public:
+ wxGridCellBoolEditor() { }
+
+ virtual void Create(wxWindow* parent,
+ wxWindowID id,
+ wxEvtHandler* evtHandler);
+
+ virtual void SetSize(const wxRect& rect);
+ virtual void Show(bool show, wxGridCellAttr *attr = NULL);
+
+ virtual bool IsAcceptedKey(wxKeyEvent& event);
+ virtual void BeginEdit(int row, int col, wxGrid* grid);
+ virtual bool EndEdit(int row, int col, const wxGrid* grid,
+ const wxString& oldval, wxString *newval);
+ virtual void ApplyEdit(int row, int col, wxGrid* grid);
+
+ virtual void Reset();
+ virtual void StartingClick();
+ virtual void StartingKey(wxKeyEvent& event);
+
+ virtual wxGridCellEditor *Clone() const
+ { return new wxGridCellBoolEditor; }
+
+ // added GetValue so we can get the value which is in the control, see
+ // also UseStringValues()
+ virtual wxString GetValue() const;
+
+ // set the string values returned by GetValue() for the true and false
+ // states, respectively
+ static void UseStringValues(const wxString& valueTrue = wxT("1"),
+ const wxString& valueFalse = wxEmptyString);
+
+ // return true if the given string is equal to the string representation of
+ // true value which we currently use
+ static bool IsTrueValue(const wxString& value);
+
+protected:
+ wxCheckBox *CBox() const { return (wxCheckBox *)m_control; }
+
+private:
+ bool m_value;
+
+ static wxString ms_stringValues[2];
+
+ wxDECLARE_NO_COPY_CLASS(wxGridCellBoolEditor);
+};
+
+#endif // wxUSE_CHECKBOX
+
+#if wxUSE_COMBOBOX
+
+// the editor for string data allowing to choose from the list of strings
+class WXDLLIMPEXP_ADV wxGridCellChoiceEditor : public wxGridCellEditor
+{
+public:
+ // if !allowOthers, user can't type a string not in choices array
+ wxGridCellChoiceEditor(size_t count = 0,
+ const wxString choices[] = NULL,
+ bool allowOthers = false);
+ wxGridCellChoiceEditor(const wxArrayString& choices,
+ bool allowOthers = false);
+
+ virtual void Create(wxWindow* parent,
+ wxWindowID id,
+ wxEvtHandler* evtHandler);
+
+ virtual void SetSize(const wxRect& rect);
+
+ virtual void PaintBackground(wxDC& dc,
+ const wxRect& rectCell,
+ const wxGridCellAttr& attr);
+
+ virtual void BeginEdit(int row, int col, wxGrid* grid);
+ virtual bool EndEdit(int row, int col, const wxGrid* grid,
+ const wxString& oldval, wxString *newval);
+ virtual void ApplyEdit(int row, int col, wxGrid* grid);
+
+ virtual void Reset();
+
+ // parameters string format is "item1[,item2[...,itemN]]"
+ virtual void SetParameters(const wxString& params);
+
+ virtual wxGridCellEditor *Clone() const;
+
+ // added GetValue so we can get the value which is in the control
+ virtual wxString GetValue() const;
+
+protected:
+ wxComboBox *Combo() const { return (wxComboBox *)m_control; }
+
+ wxString m_value;
+ wxArrayString m_choices;
+ bool m_allowOthers;
+
+ wxDECLARE_NO_COPY_CLASS(wxGridCellChoiceEditor);
+};
+
+#endif // wxUSE_COMBOBOX
+
+#if wxUSE_COMBOBOX
+
+class WXDLLIMPEXP_ADV wxGridCellEnumEditor : public wxGridCellChoiceEditor
+{
+public:
+ wxGridCellEnumEditor( const wxString& choices = wxEmptyString );
+ virtual ~wxGridCellEnumEditor() {}
+
+ virtual wxGridCellEditor* Clone() const;
+
+ virtual void BeginEdit(int row, int col, wxGrid* grid);
+ virtual bool EndEdit(int row, int col, const wxGrid* grid,
+ const wxString& oldval, wxString *newval);
+ virtual void ApplyEdit(int row, int col, wxGrid* grid);
+
+private:
+ long m_index;
+
+ wxDECLARE_NO_COPY_CLASS(wxGridCellEnumEditor);
+};
+
+#endif // wxUSE_COMBOBOX
+
+class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
+{
+public:
+ wxGridCellAutoWrapStringEditor() : wxGridCellTextEditor() { }
+ virtual void Create(wxWindow* parent,
+ wxWindowID id,
+ wxEvtHandler* evtHandler);
+
+ virtual wxGridCellEditor *Clone() const
+ { return new wxGridCellAutoWrapStringEditor; }
+
+ wxDECLARE_NO_COPY_CLASS(wxGridCellAutoWrapStringEditor);
+};
+
+#endif // wxUSE_GRID
+
+#endif // _WX_GENERIC_GRID_EDITORS_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/gridsel.h
+// Purpose: wxGridSelection
+// Author: Stefan Neis
+// Modified by:
+// Created: 20/02/2000
+// Copyright: (c) Stefan Neis
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_GRIDSEL_H_
+#define _WX_GENERIC_GRIDSEL_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_GRID
+
+#include "wx/grid.h"
+
+class WXDLLIMPEXP_ADV wxGridSelection
+{
+public:
+ wxGridSelection(wxGrid *grid,
+ wxGrid::wxGridSelectionModes sel = wxGrid::wxGridSelectCells);
+
+ bool IsSelection();
+ bool IsInSelection(int row, int col);
+ bool IsInSelection(const wxGridCellCoords& coords)
+ {
+ return IsInSelection(coords.GetRow(), coords.GetCol());
+ }
+
+ void SetSelectionMode(wxGrid::wxGridSelectionModes selmode);
+ wxGrid::wxGridSelectionModes GetSelectionMode() { return m_selectionMode; }
+ void SelectRow(int row, const wxKeyboardState& kbd = wxKeyboardState());
+ void SelectCol(int col, const wxKeyboardState& kbd = wxKeyboardState());
+ void SelectBlock(int topRow, int leftCol,
+ int bottomRow, int rightCol,
+ const wxKeyboardState& kbd = wxKeyboardState(),
+ bool sendEvent = true );
+ void SelectBlock(const wxGridCellCoords& topLeft,
+ const wxGridCellCoords& bottomRight,
+ const wxKeyboardState& kbd = wxKeyboardState(),
+ bool sendEvent = true )
+ {
+ SelectBlock(topLeft.GetRow(), topLeft.GetCol(),
+ bottomRight.GetRow(), bottomRight.GetCol(),
+ kbd, sendEvent);
+ }
+
+ void SelectCell(int row, int col,
+ const wxKeyboardState& kbd = wxKeyboardState(),
+ bool sendEvent = true);
+ void SelectCell(const wxGridCellCoords& coords,
+ const wxKeyboardState& kbd = wxKeyboardState(),
+ bool sendEvent = true)
+ {
+ SelectCell(coords.GetRow(), coords.GetCol(), kbd, sendEvent);
+ }
+
+ void ToggleCellSelection(int row, int col,
+ const wxKeyboardState& kbd = wxKeyboardState());
+ void ToggleCellSelection(const wxGridCellCoords& coords,
+ const wxKeyboardState& kbd = wxKeyboardState())
+ {
+ ToggleCellSelection(coords.GetRow(), coords.GetCol(), kbd);
+ }
+
+ void ClearSelection();
+
+ void UpdateRows( size_t pos, int numRows );
+ void UpdateCols( size_t pos, int numCols );
+
+private:
+ int BlockContain( int topRow1, int leftCol1,
+ int bottomRow1, int rightCol1,
+ int topRow2, int leftCol2,
+ int bottomRow2, int rightCol2 );
+ // returns 1, if Block1 contains Block2,
+ // -1, if Block2 contains Block1,
+ // 0, otherwise
+
+ int BlockContainsCell( int topRow, int leftCol,
+ int bottomRow, int rightCol,
+ int row, int col )
+ // returns 1, if Block contains Cell,
+ // 0, otherwise
+ {
+ return ( topRow <= row && row <= bottomRow &&
+ leftCol <= col && col <= rightCol );
+ }
+
+ void SelectBlockNoEvent(int topRow, int leftCol,
+ int bottomRow, int rightCol)
+ {
+ SelectBlock(topRow, leftCol, bottomRow, rightCol,
+ wxKeyboardState(), false);
+ }
+
+ wxGridCellCoordsArray m_cellSelection;
+ wxGridCellCoordsArray m_blockSelectionTopLeft;
+ wxGridCellCoordsArray m_blockSelectionBottomRight;
+ wxArrayInt m_rowSelection;
+ wxArrayInt m_colSelection;
+
+ wxGrid *m_grid;
+ wxGrid::wxGridSelectionModes m_selectionMode;
+
+ friend class WXDLLIMPEXP_FWD_ADV wxGrid;
+
+ wxDECLARE_NO_COPY_CLASS(wxGridSelection);
+};
+
+#endif // wxUSE_GRID
+#endif // _WX_GENERIC_GRIDSEL_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/headerctrlg.h
+// Purpose: Generic wxHeaderCtrl implementation
+// Author: Vadim Zeitlin
+// Created: 2008-12-01
+// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_HEADERCTRLG_H_
+#define _WX_GENERIC_HEADERCTRLG_H_
+
+#include "wx/event.h"
+#include "wx/vector.h"
+#include "wx/overlay.h"
+
+// ----------------------------------------------------------------------------
+// wxHeaderCtrl
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxHeaderCtrl : public wxHeaderCtrlBase
+{
+public:
+ wxHeaderCtrl()
+ {
+ Init();
+ }
+
+ wxHeaderCtrl(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxHD_DEFAULT_STYLE,
+ const wxString& name = wxHeaderCtrlNameStr)
+ {
+ Init();
+
+ Create(parent, id, pos, size, style, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxHD_DEFAULT_STYLE,
+ const wxString& name = wxHeaderCtrlNameStr);
+
+ virtual ~wxHeaderCtrl();
+
+protected:
+ virtual wxSize DoGetBestSize() const;
+
+
+private:
+ // implement base class pure virtuals
+ virtual void DoSetCount(unsigned int count);
+ virtual unsigned int DoGetCount() const;
+ virtual void DoUpdate(unsigned int idx);
+
+ virtual void DoScrollHorz(int dx);
+
+ virtual void DoSetColumnsOrder(const wxArrayInt& order);
+ virtual wxArrayInt DoGetColumnsOrder() const;
+
+ // common part of all ctors
+ void Init();
+
+ // event handlers
+ void OnPaint(wxPaintEvent& event);
+ void OnMouse(wxMouseEvent& event);
+ void OnKeyDown(wxKeyEvent& event);
+ void OnCaptureLost(wxMouseCaptureLostEvent& event);
+
+ // move the column with given idx at given position (this doesn't generate
+ // any events but does refresh the display)
+ void DoMoveCol(unsigned int idx, unsigned int pos);
+
+ // return the horizontal start position of the given column in physical
+ // coordinates
+ int GetColStart(unsigned int idx) const;
+
+ // and the end position
+ int GetColEnd(unsigned int idx) const;
+
+ // refresh the given column [only]; idx must be valid
+ void RefreshCol(unsigned int idx);
+
+ // refresh the given column if idx is valid
+ void RefreshColIfNotNone(unsigned int idx);
+
+ // refresh all the controls starting from (and including) the given one
+ void RefreshColsAfter(unsigned int idx);
+
+ // return the column at the given position or -1 if it is beyond the
+ // rightmost column and put true into onSeparator output parameter if the
+ // position is near the divider at the right end of this column (notice
+ // that this means that we return column 0 even if the position is over
+ // column 1 but close enough to the divider separating it from column 0)
+ unsigned int FindColumnAtPoint(int x, bool *onSeparator = NULL) const;
+
+ // return true if a drag resizing operation is currently in progress
+ bool IsResizing() const;
+
+ // return true if a drag reordering operation is currently in progress
+ bool IsReordering() const;
+
+ // return true if any drag operation is currently in progress
+ bool IsDragging() const { return IsResizing() || IsReordering(); }
+
+ // end any drag operation currently in progress (resizing or reordering)
+ void EndDragging();
+
+ // cancel the drag operation currently in progress and generate an event
+ // about it
+ void CancelDragging();
+
+ // start (if m_colBeingResized is -1) or continue resizing the column
+ //
+ // this generates wxEVT_HEADER_BEGIN_RESIZE/RESIZING events and can
+ // cancel the operation if the user handler decides so
+ void StartOrContinueResizing(unsigned int col, int xPhysical);
+
+ // end the resizing operation currently in progress and generate an event
+ // about it with its cancelled flag set if xPhysical is -1
+ void EndResizing(int xPhysical);
+
+ // same functions as above but for column moving/reordering instead of
+ // resizing
+ void StartReordering(unsigned int col, int xPhysical);
+
+ // returns true if we did drag the column somewhere else or false if we
+ // didn't really move it -- in this case we consider that no reordering
+ // took place and that a normal column click event should be generated
+ bool EndReordering(int xPhysical);
+
+ // constrain the given position to be larger than the start position of the
+ // given column plus its minimal width and return the effective width
+ int ConstrainByMinWidth(unsigned int col, int& xPhysical);
+
+ // update the information displayed while a column is being moved around
+ void UpdateReorderingMarker(int xPhysical);
+
+ // clear any overlaid markers
+ void ClearMarkers();
+
+
+ // number of columns in the control currently
+ unsigned int m_numColumns;
+
+ // index of the column under mouse or -1 if none
+ unsigned int m_hover;
+
+ // the column being resized or -1 if there is no resizing operation in
+ // progress
+ unsigned int m_colBeingResized;
+
+ // the column being moved or -1 if there is no reordering operation in
+ // progress
+ unsigned int m_colBeingReordered;
+
+ // the distance from the start of m_colBeingReordered and the mouse
+ // position when the user started to drag it
+ int m_dragOffset;
+
+ // the horizontal scroll offset
+ int m_scrollOffset;
+
+ // the overlay display used during the dragging operations
+ wxOverlay m_overlay;
+
+ // the indices of the column appearing at the given position on the display
+ // (its size is always m_numColumns)
+ wxArrayInt m_colIndices;
+
+
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxHeaderCtrl);
+};
+
+#endif // _WX_GENERIC_HEADERCTRLG_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/helpext.h
+// Purpose: an external help controller for wxWidgets
+// Author: Karsten Ballueder (Ballueder@usa.net)
+// Modified by:
+// Copyright: (c) Karsten Ballueder 1998
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __WX_HELPEXT_H_
+#define __WX_HELPEXT_H_
+
+#if wxUSE_HELP
+
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/helpbase.h"
+
+
+// ----------------------------------------------------------------------------
+// wxExtHelpController
+// ----------------------------------------------------------------------------
+
+// This class implements help via an external browser.
+class WXDLLIMPEXP_ADV wxExtHelpController : public wxHelpControllerBase
+{
+public:
+ wxExtHelpController(wxWindow* parentWindow = NULL);
+ virtual ~wxExtHelpController();
+
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED(void SetBrowser(const wxString& browsername = wxEmptyString, bool isNetscape = false) );
+#endif
+
+ // Set viewer: new name for SetBrowser
+ virtual void SetViewer(const wxString& viewer = wxEmptyString,
+ long flags = wxHELP_NETSCAPE);
+
+ virtual bool Initialize(const wxString& dir, int WXUNUSED(server))
+ { return Initialize(dir); }
+
+ virtual bool Initialize(const wxString& dir);
+ virtual bool LoadFile(const wxString& file = wxEmptyString);
+ virtual bool DisplayContents(void);
+ virtual bool DisplaySection(int sectionNo);
+ virtual bool DisplaySection(const wxString& section);
+ virtual bool DisplayBlock(long blockNo);
+ virtual bool KeywordSearch(const wxString& k,
+ wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
+
+ virtual bool Quit(void);
+ virtual void OnQuit(void);
+
+ virtual bool DisplayHelp(const wxString &) ;
+
+ virtual void SetFrameParameters(const wxString& WXUNUSED(title),
+ const wxSize& WXUNUSED(size),
+ const wxPoint& WXUNUSED(pos) = wxDefaultPosition,
+ bool WXUNUSED(newFrameEachTime) = false)
+ {
+ // does nothing by default
+ }
+
+ virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL,
+ wxPoint *WXUNUSED(pos) = NULL,
+ bool *WXUNUSED(newFrameEachTime) = NULL)
+ {
+ return NULL; // does nothing by default
+ }
+
+protected:
+ // Filename of currently active map file.
+ wxString m_helpDir;
+
+ // How many entries do we have in the map file?
+ int m_NumOfEntries;
+
+ // A list containing all id,url,documentation triples.
+ wxList *m_MapList;
+
+private:
+ // parse a single line of the map file (called by LoadFile())
+ //
+ // return true if the line was valid or false otherwise
+ bool ParseMapFileLine(const wxString& line);
+
+ // Deletes the list and all objects.
+ void DeleteList(void);
+
+
+ // How to call the html viewer.
+ wxString m_BrowserName;
+
+ // Is the viewer a variant of netscape?
+ bool m_BrowserIsNetscape;
+
+ DECLARE_CLASS(wxExtHelpController)
+};
+
+#endif // wxUSE_HELP
+
+#endif // __WX_HELPEXT_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/hyperlink.h
+// Purpose: Hyperlink control
+// Author: David Norris <danorris@gmail.com>, Otto Wyss
+// Modified by: Ryan Norton, Francesco Montorsi
+// Created: 04/02/2005
+// Copyright: (c) 2005 David Norris
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERICHYPERLINKCTRL_H_
+#define _WX_GENERICHYPERLINKCTRL_H_
+
+// ----------------------------------------------------------------------------
+// wxGenericHyperlinkCtrl
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxGenericHyperlinkCtrl : public wxHyperlinkCtrlBase
+{
+public:
+ // Default constructor (for two-step construction).
+ wxGenericHyperlinkCtrl() { Init(); }
+
+ // Constructor.
+ wxGenericHyperlinkCtrl(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label, const wxString& url,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxHL_DEFAULT_STYLE,
+ const wxString& name = wxHyperlinkCtrlNameStr)
+ {
+ Init();
+ (void) Create(parent, id, label, url, pos, size, style, name);
+ }
+
+ // Creation function (for two-step construction).
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label, const wxString& url,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxHL_DEFAULT_STYLE,
+ const wxString& name = wxHyperlinkCtrlNameStr);
+
+
+ // get/set
+ wxColour GetHoverColour() const { return m_hoverColour; }
+ void SetHoverColour(const wxColour &colour) { m_hoverColour = colour; }
+
+ wxColour GetNormalColour() const { return m_normalColour; }
+ void SetNormalColour(const wxColour &colour);
+
+ wxColour GetVisitedColour() const { return m_visitedColour; }
+ void SetVisitedColour(const wxColour &colour);
+
+ wxString GetURL() const { return m_url; }
+ void SetURL (const wxString &url) { m_url=url; }
+
+ void SetVisited(bool visited = true) { m_visited=visited; }
+ bool GetVisited() const { return m_visited; }
+
+ // NOTE: also wxWindow::Set/GetLabel, wxWindow::Set/GetBackgroundColour,
+ // wxWindow::Get/SetFont, wxWindow::Get/SetCursor are important !
+
+
+protected:
+ // Helper used by this class itself and native MSW implementation that
+ // connects OnRightUp() and OnPopUpCopy() handlers.
+ void ConnectMenuHandlers();
+
+ // event handlers
+
+ // Renders the hyperlink.
+ void OnPaint(wxPaintEvent& event);
+
+ // Handle set/kill focus events (invalidate for painting focus rect)
+ void OnFocus(wxFocusEvent& event);
+
+ // Fire a HyperlinkEvent on space
+ void OnChar(wxKeyEvent& event);
+
+ // Returns the wxRect of the label of this hyperlink.
+ // This is different from the clientsize's rectangle when
+ // clientsize != bestsize and this rectangle is influenced
+ // by the alignment of the label (wxHL_ALIGN_*).
+ wxRect GetLabelRect() const;
+
+ // If the click originates inside the bounding box of the label,
+ // a flag is set so that an event will be fired when the left
+ // button is released.
+ void OnLeftDown(wxMouseEvent& event);
+
+ // If the click both originated and finished inside the bounding box
+ // of the label, a HyperlinkEvent is fired.
+ void OnLeftUp(wxMouseEvent& event);
+ void OnRightUp(wxMouseEvent& event);
+
+ // Changes the cursor to a hand, if the mouse is inside the label's
+ // bounding box.
+ void OnMotion(wxMouseEvent& event);
+
+ // Changes the cursor back to the default, if necessary.
+ void OnLeaveWindow(wxMouseEvent& event);
+
+ // handles "Copy URL" menuitem
+ void OnPopUpCopy(wxCommandEvent& event);
+
+ // overridden base class virtuals
+
+ // Returns the best size for the window, which is the size needed
+ // to display the text label.
+ virtual wxSize DoGetBestClientSize() const;
+
+ // creates a context menu with "Copy URL" menuitem
+ virtual void DoContextMenu(const wxPoint &);
+
+private:
+ // Common part of all ctors.
+ void Init();
+
+ // URL associated with the link. This is transmitted inside
+ // the HyperlinkEvent fired when the user clicks on the label.
+ wxString m_url;
+
+ // Foreground colours for various link types.
+ // NOTE: wxWindow::m_backgroundColour is used for background,
+ // wxWindow::m_foregroundColour is used to render non-visited links
+ wxColour m_hoverColour;
+ wxColour m_normalColour;
+ wxColour m_visitedColour;
+
+ // True if the mouse cursor is inside the label's bounding box.
+ bool m_rollover;
+
+ // True if the link has been clicked before.
+ bool m_visited;
+
+ // True if a click is in progress (left button down) and the click
+ // originated inside the label's bounding box.
+ bool m_clicking;
+};
+
+#endif // _WX_GENERICHYPERLINKCTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/icon.h
+// Purpose: wxIcon implementation for ports where it's same as wxBitmap
+// Author: Julian Smart
+// Modified by:
+// Created: 17/09/98
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_ICON_H_
+#define _WX_GENERIC_ICON_H_
+
+#include "wx/bitmap.h"
+
+//-----------------------------------------------------------------------------
+// wxIcon
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxIcon: public wxBitmap
+{
+public:
+ wxIcon();
+
+ wxIcon(const char* const* bits);
+#ifdef wxNEEDS_CHARPP
+ wxIcon(char **bits);
+#endif
+
+ // For compatibility with wxMSW where desired size is sometimes required to
+ // distinguish between multiple icons in a resource.
+ wxIcon( const wxString& filename,
+ wxBitmapType type = wxICON_DEFAULT_TYPE,
+ int WXUNUSED(desiredWidth)=-1, int WXUNUSED(desiredHeight)=-1 ) :
+ wxBitmap(filename, type)
+ {
+ }
+
+ wxIcon(const wxIconLocation& loc)
+ : wxBitmap(loc.GetFileName(), wxBITMAP_TYPE_ANY)
+ {
+ }
+
+ bool LoadFile(const wxString& name, wxBitmapType flags,
+ int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight))
+ { return wxBitmap::LoadFile(name, flags); }
+
+ // unhide the base class version
+ virtual bool LoadFile(const wxString& name,
+ wxBitmapType flags = wxICON_DEFAULT_TYPE)
+ { return wxBitmap::LoadFile(name, flags); }
+
+ // create from bitmap (which should have a mask unless it's monochrome):
+ // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
+ // ctors, assignment operators...), but it's ok to have such function
+ void CopyFromBitmap(const wxBitmap& bmp);
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxIcon)
+};
+
+#endif // _WX_GENERIC_ICON_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/imaglist.h
+// Purpose:
+// Author: Robert Roebling
+// Created: 01/02/97
+// Copyright: (c) 1998 Robert Roebling and Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_IMAGLISTG_H_
+#define _WX_IMAGLISTG_H_
+
+#include "wx/list.h"
+
+class WXDLLIMPEXP_FWD_CORE wxDC;
+class WXDLLIMPEXP_FWD_CORE wxBitmap;
+class WXDLLIMPEXP_FWD_CORE wxIcon;
+class WXDLLIMPEXP_FWD_CORE wxColour;
+
+
+class WXDLLIMPEXP_CORE wxGenericImageList: public wxObject
+{
+public:
+ wxGenericImageList() { m_width = m_height = 0; }
+ wxGenericImageList( int width, int height, bool mask = true, int initialCount = 1 );
+ virtual ~wxGenericImageList();
+ bool Create( int width, int height, bool mask = true, int initialCount = 1 );
+ bool Create();
+
+ virtual int GetImageCount() const;
+ virtual bool GetSize( int index, int &width, int &height ) const;
+
+ int Add( const wxBitmap& bitmap );
+ int Add( const wxBitmap& bitmap, const wxBitmap& mask );
+ int Add( const wxBitmap& bitmap, const wxColour& maskColour );
+ wxBitmap GetBitmap(int index) const;
+ wxIcon GetIcon(int index) const;
+ bool Replace( int index, const wxBitmap &bitmap );
+ bool Replace( int index, const wxBitmap &bitmap, const wxBitmap& mask );
+ bool Remove( int index );
+ bool RemoveAll();
+
+ virtual bool Draw(int index, wxDC& dc, int x, int y,
+ int flags = wxIMAGELIST_DRAW_NORMAL,
+ bool solidBackground = false);
+
+ // Internal use only
+ const wxBitmap *GetBitmapPtr(int index) const;
+private:
+ wxObjectList m_images;
+
+ int m_width;
+ int m_height;
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericImageList)
+};
+
+#ifndef wxHAS_NATIVE_IMAGELIST
+
+/*
+ * wxImageList has to be a real class or we have problems with
+ * the run-time information.
+ */
+
+class WXDLLIMPEXP_CORE wxImageList: public wxGenericImageList
+{
+ DECLARE_DYNAMIC_CLASS(wxImageList)
+
+public:
+ wxImageList() {}
+
+ wxImageList( int width, int height, bool mask = true, int initialCount = 1 )
+ : wxGenericImageList(width, height, mask, initialCount)
+ {
+ }
+};
+#endif // !wxHAS_NATIVE_IMAGELIST
+
+#endif // _WX_IMAGLISTG_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/infobar.h
+// Purpose: generic wxInfoBar class declaration
+// Author: Vadim Zeitlin
+// Created: 2009-07-28
+// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_INFOBAR_H_
+#define _WX_GENERIC_INFOBAR_H_
+
+class WXDLLIMPEXP_FWD_CORE wxBitmapButton;
+class WXDLLIMPEXP_FWD_CORE wxStaticBitmap;
+class WXDLLIMPEXP_FWD_CORE wxStaticText;
+
+// ----------------------------------------------------------------------------
+// wxInfoBar
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxInfoBarGeneric : public wxInfoBarBase
+{
+public:
+ // the usual ctors and Create() but remember that info bar is created
+ // hidden
+ wxInfoBarGeneric() { Init(); }
+
+ wxInfoBarGeneric(wxWindow *parent, wxWindowID winid = wxID_ANY)
+ {
+ Init();
+ Create(parent, winid);
+ }
+
+ bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY);
+
+
+ // implement base class methods
+ // ----------------------------
+
+ virtual void ShowMessage(const wxString& msg,
+ int flags = wxICON_INFORMATION);
+
+ virtual void Dismiss();
+
+ virtual void AddButton(wxWindowID btnid, const wxString& label = wxString());
+
+ virtual void RemoveButton(wxWindowID btnid);
+
+ // methods specific to this version
+ // --------------------------------
+
+ // set the effect(s) to use when showing/hiding the bar, may be
+ // wxSHOW_EFFECT_NONE to disable any effects entirely
+ //
+ // by default, slide to bottom/top is used when it's positioned on the top
+ // of the window for showing/hiding it and top/bottom when it's positioned
+ // at the bottom
+ void SetShowHideEffects(wxShowEffect showEffect, wxShowEffect hideEffect)
+ {
+ m_showEffect = showEffect;
+ m_hideEffect = hideEffect;
+ }
+
+ // get effect used when showing/hiding the window
+ wxShowEffect GetShowEffect() const;
+ wxShowEffect GetHideEffect() const;
+
+ // set the duration of animation used when showing/hiding the bar, in ms
+ void SetEffectDuration(int duration) { m_effectDuration = duration; }
+
+ // get the currently used effect animation duration
+ int GetEffectDuration() const { return m_effectDuration; }
+
+
+ // overridden base class methods
+ // -----------------------------
+
+ // setting the font of this window sets it for the text control inside it
+ // (default font is a larger and bold version of the normal one)
+ virtual bool SetFont(const wxFont& font);
+
+protected:
+ // info bar shouldn't have any border by default, the colour difference
+ // between it and the main window separates it well enough
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+
+ // update the parent to take our new or changed size into account (notably
+ // should be called when we're shown or hidden)
+ void UpdateParent();
+
+private:
+ // common part of all ctors
+ void Init();
+
+ // handler for the close button
+ void OnButton(wxCommandEvent& event);
+
+ // show/hide the bar
+ void DoShow();
+ void DoHide();
+
+ // determine the placement of the bar from its position in the containing
+ // sizer
+ enum BarPlacement
+ {
+ BarPlacement_Top,
+ BarPlacement_Bottom,
+ BarPlacement_Unknown
+ };
+
+ BarPlacement GetBarPlacement() const;
+
+
+ // different controls making up the bar
+ wxStaticBitmap *m_icon;
+ wxStaticText *m_text;
+ wxBitmapButton *m_button;
+
+ // the effects to use when showing/hiding and duration for them: by default
+ // the effect is determined by the info bar automatically depending on its
+ // position and the default duration is used
+ wxShowEffect m_showEffect,
+ m_hideEffect;
+ int m_effectDuration;
+
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxInfoBarGeneric);
+};
+
+#endif // _WX_GENERIC_INFOBAR_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/laywin.h
+// Purpose: Implements a simple layout algorithm, plus
+// wxSashLayoutWindow which is an example of a window with
+// layout-awareness (via event handlers). This is suited to
+// IDE-style window layout.
+// Author: Julian Smart
+// Modified by:
+// Created: 04/01/98
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_LAYWIN_H_G_
+#define _WX_LAYWIN_H_G_
+
+#if wxUSE_SASH
+ #include "wx/sashwin.h"
+#endif // wxUSE_SASH
+
+#include "wx/event.h"
+
+class WXDLLIMPEXP_FWD_ADV wxQueryLayoutInfoEvent;
+class WXDLLIMPEXP_FWD_ADV wxCalculateLayoutEvent;
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_QUERY_LAYOUT_INFO, wxQueryLayoutInfoEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_CALCULATE_LAYOUT, wxCalculateLayoutEvent );
+
+enum wxLayoutOrientation
+{
+ wxLAYOUT_HORIZONTAL,
+ wxLAYOUT_VERTICAL
+};
+
+enum wxLayoutAlignment
+{
+ wxLAYOUT_NONE,
+ wxLAYOUT_TOP,
+ wxLAYOUT_LEFT,
+ wxLAYOUT_RIGHT,
+ wxLAYOUT_BOTTOM
+};
+
+// Not sure this is necessary
+// Tell window which dimension we're sizing on
+#define wxLAYOUT_LENGTH_Y 0x0008
+#define wxLAYOUT_LENGTH_X 0x0000
+
+// Use most recently used length
+#define wxLAYOUT_MRU_LENGTH 0x0010
+
+// Only a query, so don't actually move it.
+#define wxLAYOUT_QUERY 0x0100
+
+/*
+ * This event is used to get information about window alignment,
+ * orientation and size.
+ */
+
+class WXDLLIMPEXP_ADV wxQueryLayoutInfoEvent: public wxEvent
+{
+public:
+ wxQueryLayoutInfoEvent(wxWindowID id = 0)
+ {
+ SetEventType(wxEVT_QUERY_LAYOUT_INFO);
+ m_requestedLength = 0;
+ m_flags = 0;
+ m_id = id;
+ m_alignment = wxLAYOUT_TOP;
+ m_orientation = wxLAYOUT_HORIZONTAL;
+ }
+
+ // Read by the app
+ void SetRequestedLength(int length) { m_requestedLength = length; }
+ int GetRequestedLength() const { return m_requestedLength; }
+
+ void SetFlags(int flags) { m_flags = flags; }
+ int GetFlags() const { return m_flags; }
+
+ // Set by the app
+ void SetSize(const wxSize& size) { m_size = size; }
+ wxSize GetSize() const { return m_size; }
+
+ void SetOrientation(wxLayoutOrientation orient) { m_orientation = orient; }
+ wxLayoutOrientation GetOrientation() const { return m_orientation; }
+
+ void SetAlignment(wxLayoutAlignment align) { m_alignment = align; }
+ wxLayoutAlignment GetAlignment() const { return m_alignment; }
+
+ virtual wxEvent *Clone() const { return new wxQueryLayoutInfoEvent(*this); }
+
+protected:
+ int m_flags;
+ int m_requestedLength;
+ wxSize m_size;
+ wxLayoutOrientation m_orientation;
+ wxLayoutAlignment m_alignment;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxQueryLayoutInfoEvent)
+};
+
+typedef void (wxEvtHandler::*wxQueryLayoutInfoEventFunction)(wxQueryLayoutInfoEvent&);
+
+#define wxQueryLayoutInfoEventHandler( func ) \
+ wxEVENT_HANDLER_CAST( wxQueryLayoutInfoEventFunction, func )
+
+#define EVT_QUERY_LAYOUT_INFO(func) \
+ wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_QUERY_LAYOUT_INFO, wxID_ANY, wxID_ANY, wxQueryLayoutInfoEventHandler( func ), NULL ),
+
+/*
+ * This event is used to take a bite out of the available client area.
+ */
+
+class WXDLLIMPEXP_ADV wxCalculateLayoutEvent: public wxEvent
+{
+public:
+ wxCalculateLayoutEvent(wxWindowID id = 0)
+ {
+ SetEventType(wxEVT_CALCULATE_LAYOUT);
+ m_flags = 0;
+ m_id = id;
+ }
+
+ // Read by the app
+ void SetFlags(int flags) { m_flags = flags; }
+ int GetFlags() const { return m_flags; }
+
+ // Set by the app
+ void SetRect(const wxRect& rect) { m_rect = rect; }
+ wxRect GetRect() const { return m_rect; }
+
+ virtual wxEvent *Clone() const { return new wxCalculateLayoutEvent(*this); }
+
+protected:
+ int m_flags;
+ wxRect m_rect;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCalculateLayoutEvent)
+};
+
+typedef void (wxEvtHandler::*wxCalculateLayoutEventFunction)(wxCalculateLayoutEvent&);
+
+#define wxCalculateLayoutEventHandler( func ) wxEVENT_HANDLER_CAST(wxCalculateLayoutEventFunction, func)
+
+#define EVT_CALCULATE_LAYOUT(func) \
+ wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_CALCULATE_LAYOUT, wxID_ANY, wxID_ANY, wxCalculateLayoutEventHandler( func ), NULL ),
+
+#if wxUSE_SASH
+
+// This is window that can remember alignment/orientation, does its own layout,
+// and can provide sashes too. Useful for implementing docked windows with sashes in
+// an IDE-style interface.
+class WXDLLIMPEXP_ADV wxSashLayoutWindow: public wxSashWindow
+{
+public:
+ wxSashLayoutWindow()
+ {
+ Init();
+ }
+
+ wxSashLayoutWindow(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = wxT("layoutWindow"))
+ {
+ Create(parent, id, pos, size, style, name);
+ }
+
+ bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = wxT("layoutWindow"));
+
+// Accessors
+ inline wxLayoutAlignment GetAlignment() const { return m_alignment; }
+ inline wxLayoutOrientation GetOrientation() const { return m_orientation; }
+
+ inline void SetAlignment(wxLayoutAlignment align) { m_alignment = align; }
+ inline void SetOrientation(wxLayoutOrientation orient) { m_orientation = orient; }
+
+ // Give the window default dimensions
+ inline void SetDefaultSize(const wxSize& size) { m_defaultSize = size; }
+
+// Event handlers
+ // Called by layout algorithm to allow window to take a bit out of the
+ // client rectangle, and size itself if not in wxLAYOUT_QUERY mode.
+ void OnCalculateLayout(wxCalculateLayoutEvent& event);
+
+ // Called by layout algorithm to retrieve information about the window.
+ void OnQueryLayoutInfo(wxQueryLayoutInfoEvent& event);
+
+private:
+ void Init();
+
+ wxLayoutAlignment m_alignment;
+ wxLayoutOrientation m_orientation;
+ wxSize m_defaultSize;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxSashLayoutWindow)
+ DECLARE_EVENT_TABLE()
+};
+
+#endif // wxUSE_SASH
+
+class WXDLLIMPEXP_FWD_CORE wxMDIParentFrame;
+class WXDLLIMPEXP_FWD_CORE wxFrame;
+
+// This class implements the layout algorithm
+class WXDLLIMPEXP_ADV wxLayoutAlgorithm: public wxObject
+{
+public:
+ wxLayoutAlgorithm() {}
+
+#if wxUSE_MDI_ARCHITECTURE
+ // The MDI client window is sized to whatever's left over.
+ bool LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* rect = NULL);
+#endif // wxUSE_MDI_ARCHITECTURE
+
+ // mainWindow is sized to whatever's left over. This function for backward
+ // compatibility; use LayoutWindow.
+ bool LayoutFrame(wxFrame* frame, wxWindow* mainWindow = NULL);
+
+ // mainWindow is sized to whatever's left over.
+ bool LayoutWindow(wxWindow* frame, wxWindow* mainWindow = NULL);
+};
+
+#endif
+ // _WX_LAYWIN_H_G_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/listctrl.h
+// Purpose: Generic list control
+// Author: Robert Roebling
+// Created: 01/02/97
+// Copyright: (c) 1998 Robert Roebling and Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_LISTCTRL_H_
+#define _WX_GENERIC_LISTCTRL_H_
+
+#include "wx/containr.h"
+#include "wx/scrolwin.h"
+#include "wx/textctrl.h"
+
+#if wxUSE_DRAG_AND_DROP
+class WXDLLIMPEXP_FWD_CORE wxDropTarget;
+#endif
+
+//-----------------------------------------------------------------------------
+// internal classes
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxListHeaderWindow;
+class WXDLLIMPEXP_FWD_CORE wxListMainWindow;
+
+//-----------------------------------------------------------------------------
+// wxListCtrl
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxGenericListCtrl: public wxNavigationEnabled<wxListCtrlBase>,
+ public wxScrollHelper
+{
+public:
+
+ wxGenericListCtrl() : wxScrollHelper(this)
+ {
+ Init();
+ }
+
+ wxGenericListCtrl( wxWindow *parent,
+ wxWindowID winid = wxID_ANY,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ long style = wxLC_ICON,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString &name = wxListCtrlNameStr)
+ : wxScrollHelper(this)
+ {
+ Create(parent, winid, pos, size, style, validator, name);
+ }
+
+ virtual ~wxGenericListCtrl();
+
+ void Init();
+
+ bool Create( wxWindow *parent,
+ wxWindowID winid = wxID_ANY,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ long style = wxLC_ICON,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString &name = wxListCtrlNameStr);
+
+ bool GetColumn( int col, wxListItem& item ) const;
+ bool SetColumn( int col, const wxListItem& item );
+ int GetColumnWidth( int col ) const;
+ bool SetColumnWidth( int col, int width);
+ int GetCountPerPage() const; // not the same in wxGLC as in Windows, I think
+ wxRect GetViewRect() const;
+
+ bool GetItem( wxListItem& info ) const;
+ bool SetItem( wxListItem& info ) ;
+ long SetItem( long index, int col, const wxString& label, int imageId = -1 );
+ int GetItemState( long item, long stateMask ) const;
+ bool SetItemState( long item, long state, long stateMask);
+ bool SetItemImage( long item, int image, int selImage = -1 );
+ bool SetItemColumnImage( long item, long column, int image );
+ wxString GetItemText( long item, int col = 0 ) const;
+ void SetItemText( long item, const wxString& str );
+ wxUIntPtr GetItemData( long item ) const;
+ bool SetItemPtrData(long item, wxUIntPtr data);
+ bool SetItemData(long item, long data) { return SetItemPtrData(item, data); }
+ bool GetItemRect( long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS ) const;
+ bool GetSubItemRect( long item, long subItem, wxRect& rect, int code = wxLIST_RECT_BOUNDS ) const;
+ bool GetItemPosition( long item, wxPoint& pos ) const;
+ bool SetItemPosition( long item, const wxPoint& pos ); // not supported in wxGLC
+ int GetItemCount() const;
+ int GetColumnCount() const;
+ void SetItemSpacing( int spacing, bool isSmall = false );
+ wxSize GetItemSpacing() const;
+ void SetItemTextColour( long item, const wxColour& col);
+ wxColour GetItemTextColour( long item ) const;
+ void SetItemBackgroundColour( long item, const wxColour &col);
+ wxColour GetItemBackgroundColour( long item ) const;
+ void SetItemFont( long item, const wxFont &f);
+ wxFont GetItemFont( long item ) const;
+ int GetSelectedItemCount() const;
+ wxColour GetTextColour() const;
+ void SetTextColour(const wxColour& col);
+ long GetTopItem() const;
+
+ void SetSingleStyle( long style, bool add = true ) ;
+ void SetWindowStyleFlag( long style );
+ void RecreateWindow() {}
+ long GetNextItem( long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE ) const;
+ wxImageList *GetImageList( int which ) const;
+ void SetImageList( wxImageList *imageList, int which );
+ void AssignImageList( wxImageList *imageList, int which );
+ bool Arrange( int flag = wxLIST_ALIGN_DEFAULT ); // always wxLIST_ALIGN_LEFT in wxGLC
+
+ void ClearAll();
+ bool DeleteItem( long item );
+ bool DeleteAllItems();
+ bool DeleteAllColumns();
+ bool DeleteColumn( int col );
+
+ void SetItemCount(long count);
+
+ wxTextCtrl *EditLabel(long item,
+ wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl));
+ wxTextCtrl* GetEditControl() const;
+ void Edit( long item ) { EditLabel(item); }
+
+ bool EnsureVisible( long item );
+ long FindItem( long start, const wxString& str, bool partial = false );
+ long FindItem( long start, wxUIntPtr data );
+ long FindItem( long start, const wxPoint& pt, int direction ); // not supported in wxGLC
+ long HitTest( const wxPoint& point, int& flags, long *pSubItem = NULL ) const;
+ long InsertItem(wxListItem& info);
+ long InsertItem( long index, const wxString& label );
+ long InsertItem( long index, int imageIndex );
+ long InsertItem( long index, const wxString& label, int imageIndex );
+ bool ScrollList( int dx, int dy );
+ bool SortItems( wxListCtrlCompare fn, wxIntPtr data );
+
+ // do we have a header window?
+ bool HasHeader() const
+ { return InReportView() && !HasFlag(wxLC_NO_HEADER); }
+
+ // refresh items selectively (only useful for virtual list controls)
+ void RefreshItem(long item);
+ void RefreshItems(long itemFrom, long itemTo);
+
+ virtual void EnableBellOnNoMatch(bool on = true);
+
+#if WXWIN_COMPATIBILITY_2_6
+ // obsolete, don't use
+ wxDEPRECATED( int GetItemSpacing( bool isSmall ) const );
+#endif // WXWIN_COMPATIBILITY_2_6
+
+
+ // overridden base class virtuals
+ // ------------------------------
+
+ virtual wxVisualAttributes GetDefaultAttributes() const
+ {
+ return GetClassDefaultAttributes(GetWindowVariant());
+ }
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ virtual void Update();
+
+
+ // implementation only from now on
+ // -------------------------------
+
+ // generic version extension, don't use in portable code
+ bool Update( long item );
+
+ void OnInternalIdle( );
+
+ // We have to hand down a few functions
+ virtual void Refresh(bool eraseBackground = true,
+ const wxRect *rect = NULL);
+
+ virtual bool SetBackgroundColour( const wxColour &colour );
+ virtual bool SetForegroundColour( const wxColour &colour );
+ virtual wxColour GetBackgroundColour() const;
+ virtual wxColour GetForegroundColour() const;
+ virtual bool SetFont( const wxFont &font );
+ virtual bool SetCursor( const wxCursor &cursor );
+
+#if wxUSE_DRAG_AND_DROP
+ virtual void SetDropTarget( wxDropTarget *dropTarget );
+ virtual wxDropTarget *GetDropTarget() const;
+#endif
+
+ virtual bool ShouldInheritColours() const { return false; }
+
+ // implementation
+ // --------------
+
+ wxImageList *m_imageListNormal;
+ wxImageList *m_imageListSmall;
+ wxImageList *m_imageListState; // what's that ?
+ bool m_ownsImageListNormal,
+ m_ownsImageListSmall,
+ m_ownsImageListState;
+ wxListHeaderWindow *m_headerWin;
+ wxListMainWindow *m_mainWin;
+
+protected:
+ // Implement base class pure virtual methods.
+ long DoInsertColumn(long col, const wxListItem& info);
+
+
+ virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
+
+ virtual wxSize DoGetBestClientSize() const;
+
+ // return the text for the given column of the given item
+ virtual wxString OnGetItemText(long item, long column) const;
+
+ // return the icon for the given item. In report view, OnGetItemImage will
+ // only be called for the first column. See OnGetItemColumnImage for
+ // details.
+ virtual int OnGetItemImage(long item) const;
+
+ // return the icon for the given item and column.
+ virtual int OnGetItemColumnImage(long item, long column) const;
+
+ // it calls our OnGetXXX() functions
+ friend class WXDLLIMPEXP_FWD_CORE wxListMainWindow;
+
+ virtual wxBorder GetDefaultBorder() const;
+
+ virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size);
+
+private:
+ void CreateOrDestroyHeaderWindowAsNeeded();
+ void OnScroll( wxScrollWinEvent& event );
+ void OnSize( wxSizeEvent &event );
+
+ // we need to return a special WM_GETDLGCODE value to process just the
+ // arrows but let the other navigation characters through
+#if defined(__WXMSW__) && !defined(__WXWINCE__) && !defined(__WXUNIVERSAL__)
+ virtual WXLRESULT
+ MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
+#endif // __WXMSW__
+
+ WX_FORWARD_TO_SCROLL_HELPER()
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxGenericListCtrl)
+};
+
+#if (!defined(__WXMSW__) || defined(__WXUNIVERSAL__)) && (!(defined(__WXMAC__) && wxOSX_USE_CARBON) || defined(__WXUNIVERSAL__ ))
+/*
+ * wxListCtrl has to be a real class or we have problems with
+ * the run-time information.
+ */
+
+class WXDLLIMPEXP_CORE wxListCtrl: public wxGenericListCtrl
+{
+ DECLARE_DYNAMIC_CLASS(wxListCtrl)
+
+public:
+ wxListCtrl() {}
+
+ wxListCtrl(wxWindow *parent, wxWindowID winid = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxLC_ICON,
+ const wxValidator &validator = wxDefaultValidator,
+ const wxString &name = wxListCtrlNameStr)
+ : wxGenericListCtrl(parent, winid, pos, size, style, validator, name)
+ {
+ }
+
+};
+#endif // !__WXMSW__ || __WXUNIVERSAL__
+
+#endif // _WX_GENERIC_LISTCTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/logg.h
+// Purpose: Assorted wxLogXXX functions, and wxLog (sink for logs)
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 29/01/98
+// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_LOGG_H_
+#define _WX_LOGG_H_
+
+#if wxUSE_GUI
+
+class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
+class WXDLLIMPEXP_FWD_CORE wxLogFrame;
+class WXDLLIMPEXP_FWD_CORE wxWindow;
+
+// ----------------------------------------------------------------------------
+// the following log targets are only compiled in if the we're compiling the
+// GUI part (andnot just the base one) of the library, they're implemented in
+// src/generic/logg.cpp *and not src/common/log.cpp unlike all the rest)
+// ----------------------------------------------------------------------------
+
+#if wxUSE_TEXTCTRL
+
+// log everything to a text window (GUI only of course)
+class WXDLLIMPEXP_CORE wxLogTextCtrl : public wxLog
+{
+public:
+ wxLogTextCtrl(wxTextCtrl *pTextCtrl);
+
+protected:
+ // implement sink function
+ virtual void DoLogText(const wxString& msg);
+
+private:
+ // the control we use
+ wxTextCtrl *m_pTextCtrl;
+
+ wxDECLARE_NO_COPY_CLASS(wxLogTextCtrl);
+};
+
+#endif // wxUSE_TEXTCTRL
+
+// ----------------------------------------------------------------------------
+// GUI log target, the default one for wxWidgets programs
+// ----------------------------------------------------------------------------
+
+#if wxUSE_LOGGUI
+
+class WXDLLIMPEXP_CORE wxLogGui : public wxLog
+{
+public:
+ // ctor
+ wxLogGui();
+
+ // show all messages that were logged since the last Flush()
+ virtual void Flush();
+
+protected:
+ virtual void DoLogRecord(wxLogLevel level,
+ const wxString& msg,
+ const wxLogRecordInfo& info);
+
+ // return the title to be used for the log dialog, depending on m_bErrors
+ // and m_bWarnings values
+ wxString GetTitle() const;
+
+ // return the icon (one of wxICON_XXX constants) to be used for the dialog
+ // depending on m_bErrors/m_bWarnings
+ int GetSeverityIcon() const;
+
+ // empty everything
+ void Clear();
+
+
+ wxArrayString m_aMessages; // the log message texts
+ wxArrayInt m_aSeverity; // one of wxLOG_XXX values
+ wxArrayLong m_aTimes; // the time of each message
+ bool m_bErrors, // do we have any errors?
+ m_bWarnings, // any warnings?
+ m_bHasMessages; // any messages at all?
+
+private:
+ // this method is called to show a single log message, it uses
+ // wxMessageBox() by default
+ virtual void DoShowSingleLogMessage(const wxString& message,
+ const wxString& title,
+ int style);
+
+ // this method is called to show multiple log messages, it uses wxLogDialog
+ virtual void DoShowMultipleLogMessages(const wxArrayString& messages,
+ const wxArrayInt& severities,
+ const wxArrayLong& times,
+ const wxString& title,
+ int style);
+};
+
+#endif // wxUSE_LOGGUI
+
+// ----------------------------------------------------------------------------
+// (background) log window: this class forwards all log messages to the log
+// target which was active when it was instantiated, but also collects them
+// to the log window. This window has its own menu which allows the user to
+// close it, clear the log contents or save it to the file.
+// ----------------------------------------------------------------------------
+
+#if wxUSE_LOGWINDOW
+
+class WXDLLIMPEXP_CORE wxLogWindow : public wxLogPassThrough
+{
+public:
+ wxLogWindow(wxWindow *pParent, // the parent frame (can be NULL)
+ const wxString& szTitle, // the title of the frame
+ bool bShow = true, // show window immediately?
+ bool bPassToOld = true); // pass messages to the old target?
+
+ virtual ~wxLogWindow();
+
+ // window operations
+ // show/hide the log window
+ void Show(bool bShow = true);
+ // retrieve the pointer to the frame
+ wxFrame *GetFrame() const;
+
+ // overridables
+ // called if the user closes the window interactively, will not be
+ // called if it is destroyed for another reason (such as when program
+ // exits) - return true from here to allow the frame to close, false
+ // to prevent this from happening
+ virtual bool OnFrameClose(wxFrame *frame);
+ // called right before the log frame is going to be deleted: will
+ // always be called unlike OnFrameClose()
+ virtual void OnFrameDelete(wxFrame *frame);
+
+protected:
+ virtual void DoLogTextAtLevel(wxLogLevel level, const wxString& msg);
+
+private:
+ wxLogFrame *m_pLogFrame; // the log frame
+
+ wxDECLARE_NO_COPY_CLASS(wxLogWindow);
+};
+
+#endif // wxUSE_LOGWINDOW
+
+#endif // wxUSE_GUI
+
+#endif // _WX_LOGG_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/msgdlgg.h
+// Purpose: Generic wxMessageDialog
+// Author: Julian Smart
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_MSGDLGG_H_
+#define _WX_GENERIC_MSGDLGG_H_
+
+class WXDLLIMPEXP_FWD_CORE wxSizer;
+
+class WXDLLIMPEXP_CORE wxGenericMessageDialog : public wxMessageDialogBase
+{
+public:
+ wxGenericMessageDialog(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption = wxMessageBoxCaptionStr,
+ long style = wxOK|wxCENTRE,
+ const wxPoint& pos = wxDefaultPosition);
+
+ virtual int ShowModal();
+
+protected:
+ // Creates a message dialog taking any options that have been set after
+ // object creation into account such as custom labels.
+ void DoCreateMsgdialog();
+
+ void OnYes(wxCommandEvent& event);
+ void OnNo(wxCommandEvent& event);
+ void OnHelp(wxCommandEvent& event);
+ void OnCancel(wxCommandEvent& event);
+
+ // can be overridden to provide more contents to the dialog
+ virtual void AddMessageDialogCheckBox(wxSizer *WXUNUSED(sizer)) { }
+ virtual void AddMessageDialogDetails(wxSizer *WXUNUSED(sizer)) { }
+
+private:
+ // Creates and returns a standard button sizer using the style of this
+ // dialog and the custom labels, if any.
+ //
+ // May return NULL on smart phone platforms not using buttons at all.
+ wxSizer *CreateMsgDlgButtonSizer();
+
+ wxPoint m_pos;
+ bool m_created;
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxGenericMessageDialog)
+};
+
+#endif // _WX_GENERIC_MSGDLGG_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/notebook.h
+// Purpose: wxNotebook class (a.k.a. property sheet, tabbed dialog)
+// Author: Julian Smart
+// Modified by:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_NOTEBOOK_H_
+#define _WX_NOTEBOOK_H_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+#include "wx/event.h"
+#include "wx/control.h"
+
+// ----------------------------------------------------------------------------
+// types
+// ----------------------------------------------------------------------------
+
+// fwd declarations
+class WXDLLIMPEXP_FWD_CORE wxImageList;
+class WXDLLIMPEXP_FWD_CORE wxWindow;
+class WXDLLIMPEXP_FWD_CORE wxTabView;
+
+// ----------------------------------------------------------------------------
+// wxNotebook
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase
+{
+public:
+ // ctors
+ // -----
+ // default for dynamic class
+ wxNotebook();
+ // the same arguments as for wxControl (@@@ any special styles?)
+ wxNotebook(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxNotebookNameStr);
+ // Create() function
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxNotebookNameStr);
+ // dtor
+ virtual ~wxNotebook();
+
+ // accessors
+ // ---------
+ // Find the position of the wxNotebookPage, wxNOT_FOUND if not found.
+ int FindPagePosition(wxNotebookPage* page) const;
+
+ // set the currently selected page, return the index of the previously
+ // selected one (or wxNOT_FOUND on error)
+ // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
+ int SetSelection(size_t nPage);
+ // cycle thru the tabs
+ // void AdvanceSelection(bool bForward = true);
+
+ // changes selected page without sending events
+ int ChangeSelection(size_t nPage);
+
+ // set/get the title of a page
+ bool SetPageText(size_t nPage, const wxString& strText);
+ wxString GetPageText(size_t nPage) const;
+
+ // get the number of rows for a control with wxNB_MULTILINE style (not all
+ // versions support it - they will always return 1 then)
+ virtual int GetRowCount() const ;
+
+ // sets/returns item's image index in the current image list
+ int GetPageImage(size_t nPage) const;
+ bool SetPageImage(size_t nPage, int nImage);
+
+ // control the appearance of the notebook pages
+ // set the size (the same for all pages)
+ void SetPageSize(const wxSize& size);
+ // set the padding between tabs (in pixels)
+ void SetPadding(const wxSize& padding);
+
+ // Sets the size of the tabs (assumes all tabs are the same size)
+ void SetTabSize(const wxSize& sz);
+
+ // operations
+ // ----------
+ // remove one page from the notebook, and delete the page.
+ bool DeletePage(size_t nPage);
+ bool DeletePage(wxNotebookPage* page);
+ // remove one page from the notebook, without deleting the page.
+ bool RemovePage(size_t nPage);
+ bool RemovePage(wxNotebookPage* page);
+ virtual wxWindow* DoRemovePage(size_t nPage);
+
+ // remove all pages
+ bool DeleteAllPages();
+ // the same as AddPage(), but adds it at the specified position
+ bool InsertPage(size_t nPage,
+ wxNotebookPage *pPage,
+ const wxString& strText,
+ bool bSelect = false,
+ int imageId = NO_IMAGE);
+
+ // callbacks
+ // ---------
+ void OnSize(wxSizeEvent& event);
+ void OnInternalIdle();
+ void OnSelChange(wxBookCtrlEvent& event);
+ void OnSetFocus(wxFocusEvent& event);
+ void OnNavigationKey(wxNavigationKeyEvent& event);
+
+ // base class virtuals
+ // -------------------
+ virtual void Command(wxCommandEvent& event);
+ virtual void SetConstraintSizes(bool recurse = true);
+ virtual bool DoPhase(int nPhase);
+
+ virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
+
+ // Implementation
+
+ // wxNotebook on Motif uses a generic wxTabView to implement itself.
+ wxTabView *GetTabView() const { return m_tabView; }
+ void SetTabView(wxTabView *v) { m_tabView = v; }
+
+ void OnMouseEvent(wxMouseEvent& event);
+ void OnPaint(wxPaintEvent& event);
+
+ virtual wxRect GetAvailableClientSize();
+
+ // Implementation: calculate the layout of the view rect
+ // and resize the children if required
+ bool RefreshLayout(bool force = true);
+
+protected:
+ // common part of all ctors
+ void Init();
+
+ // helper functions
+ void ChangePage(int nOldSel, int nSel); // change pages
+
+ wxTabView* m_tabView;
+
+ DECLARE_DYNAMIC_CLASS(wxNotebook)
+ DECLARE_EVENT_TABLE()
+};
+
+#endif // _WX_NOTEBOOK_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/notifmsg.h
+// Purpose: generic implementation of wxGenericNotificationMessage
+// Author: Vadim Zeitlin
+// Created: 2007-11-24
+// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_NOTIFMSG_H_
+#define _WX_GENERIC_NOTIFMSG_H_
+
+class wxNotificationMessageDialog;
+
+// ----------------------------------------------------------------------------
+// wxGenericNotificationMessage
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxGenericNotificationMessage : public wxNotificationMessageBase
+{
+public:
+ wxGenericNotificationMessage() { Init(); }
+ wxGenericNotificationMessage(const wxString& title,
+ const wxString& message = wxString(),
+ wxWindow *parent = NULL,
+ int flags = wxICON_INFORMATION)
+ : wxNotificationMessageBase(title, message, parent, flags)
+ {
+ Init();
+ }
+
+ virtual ~wxGenericNotificationMessage();
+
+
+ virtual bool Show(int timeout = Timeout_Auto);
+ virtual bool Close();
+
+ // generic implementation-specific methods
+
+ // get/set the default timeout (used if Timeout_Auto is specified)
+ static int GetDefaultTimeout() { return ms_timeout; }
+ static void SetDefaultTimeout(int timeout);
+
+private:
+ void Init();
+
+
+ // default timeout
+ static int ms_timeout;
+
+ // notification message is represented by a modeless dialog in this
+ // implementation
+ wxNotificationMessageDialog *m_dialog;
+
+
+ wxDECLARE_NO_COPY_CLASS(wxGenericNotificationMessage);
+};
+
+#endif // _WX_GENERIC_NOTIFMSG_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/numdlgg.h
+// Purpose: wxNumberEntryDialog class
+// Author: John Labenski
+// Modified by:
+// Created: 07.02.04 (extracted from textdlgg.cpp)
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __NUMDLGH_G__
+#define __NUMDLGH_G__
+
+#include "wx/defs.h"
+
+#if wxUSE_NUMBERDLG
+
+#include "wx/dialog.h"
+
+#if wxUSE_SPINCTRL
+ class WXDLLIMPEXP_FWD_CORE wxSpinCtrl;
+#else
+ class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
+#endif // wxUSE_SPINCTRL
+
+// ----------------------------------------------------------------------------
+// wxNumberEntryDialog: a dialog with spin control, [ok] and [cancel] buttons
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxNumberEntryDialog : public wxDialog
+{
+public:
+ wxNumberEntryDialog(wxWindow *parent,
+ const wxString& message,
+ const wxString& prompt,
+ const wxString& caption,
+ long value, long min, long max,
+ const wxPoint& pos = wxDefaultPosition);
+
+ long GetValue() const { return m_value; }
+
+ // implementation only
+ void OnOK(wxCommandEvent& event);
+ void OnCancel(wxCommandEvent& event);
+
+protected:
+
+#if wxUSE_SPINCTRL
+ wxSpinCtrl *m_spinctrl;
+#else
+ wxTextCtrl *m_spinctrl;
+#endif // wxUSE_SPINCTRL
+
+ long m_value, m_min, m_max;
+
+private:
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxNumberEntryDialog)
+ wxDECLARE_NO_COPY_CLASS(wxNumberEntryDialog);
+};
+
+// ----------------------------------------------------------------------------
+// function to get a number from user
+// ----------------------------------------------------------------------------
+
+WXDLLIMPEXP_CORE long
+ wxGetNumberFromUser(const wxString& message,
+ const wxString& prompt,
+ const wxString& caption,
+ long value = 0,
+ long min = 0,
+ long max = 100,
+ wxWindow *parent = NULL,
+ const wxPoint& pos = wxDefaultPosition);
+
+#endif // wxUSE_NUMBERDLG
+
+#endif // __NUMDLGH_G__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/paletteg.h
+// Purpose:
+// Author: Robert Roebling
+// Created: 01/02/97
+// Copyright: (c) 1998 Robert Roebling and Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef __WX_PALETTEG_H__
+#define __WX_PALETTEG_H__
+
+#include "wx/defs.h"
+#include "wx/object.h"
+#include "wx/gdiobj.h"
+#include "wx/gdicmn.h"
+
+//-----------------------------------------------------------------------------
+// classes
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxPalette;
+
+//-----------------------------------------------------------------------------
+// wxPalette
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPalette: public wxPaletteBase
+{
+public:
+ wxPalette();
+ wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue );
+ virtual ~wxPalette();
+
+ bool Create( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
+ int GetPixel( unsigned char red, unsigned char green, unsigned char blue ) const;
+ bool GetRGB( int pixel, unsigned char *red, unsigned char *green, unsigned char *blue ) const;
+
+ virtual int GetColoursCount() const;
+
+protected:
+ virtual wxGDIRefData *CreateGDIRefData() const;
+ virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPalette)
+};
+
+#endif // __WX_PALETTEG_H__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/panelg.h
+// Purpose: wxPanel: a container for child controls
+// Author: Julian Smart
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_PANELG_H_
+#define _WX_GENERIC_PANELG_H_
+
+#include "wx/bitmap.h"
+
+class WXDLLIMPEXP_CORE wxPanel : public wxPanelBase
+{
+public:
+ wxPanel() { }
+
+ // Constructor
+ wxPanel(wxWindow *parent,
+ wxWindowID winid = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxTAB_TRAVERSAL | wxNO_BORDER,
+ const wxString& name = wxPanelNameStr)
+ {
+ Create(parent, winid, pos, size, style, name);
+ }
+
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED_CONSTRUCTOR(
+ wxPanel(wxWindow *parent,
+ int x, int y, int width, int height,
+ long style = wxTAB_TRAVERSAL | wxNO_BORDER,
+ const wxString& name = wxPanelNameStr)
+ {
+ Create(parent, wxID_ANY, wxPoint(x, y), wxSize(width, height), style, name);
+ }
+ )
+#endif // WXWIN_COMPATIBILITY_2_8
+
+private:
+ wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxPanel);
+};
+
+#endif // _WX_GENERIC_PANELG_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/printps.h
+// Purpose: wxPostScriptPrinter, wxPostScriptPrintPreview
+// wxGenericPageSetupDialog
+// Author: Julian Smart
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __PRINTPSH__
+#define __PRINTPSH__
+
+#include "wx/prntbase.h"
+
+#if wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT
+
+// ----------------------------------------------------------------------------
+// Represents the printer: manages printing a wxPrintout object
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPostScriptPrinter : public wxPrinterBase
+{
+public:
+ wxPostScriptPrinter(wxPrintDialogData *data = NULL);
+ virtual ~wxPostScriptPrinter();
+
+ virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true);
+ virtual wxDC* PrintDialog(wxWindow *parent);
+ virtual bool Setup(wxWindow *parent);
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPostScriptPrinter)
+};
+
+// ----------------------------------------------------------------------------
+// wxPrintPreview: programmer creates an object of this class to preview a
+// wxPrintout.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPostScriptPrintPreview : public wxPrintPreviewBase
+{
+public:
+ wxPostScriptPrintPreview(wxPrintout *printout,
+ wxPrintout *printoutForPrinting = NULL,
+ wxPrintDialogData *data = NULL);
+ wxPostScriptPrintPreview(wxPrintout *printout,
+ wxPrintout *printoutForPrinting,
+ wxPrintData *data);
+
+ virtual ~wxPostScriptPrintPreview();
+
+ virtual bool Print(bool interactive);
+ virtual void DetermineScaling();
+
+private:
+ void Init(wxPrintout *printout, wxPrintout *printoutForPrinting);
+
+private:
+ DECLARE_CLASS(wxPostScriptPrintPreview)
+};
+
+#endif
+
+#endif
+// __PRINTPSH__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/prntdlgg.h
+// Purpose: wxGenericPrintDialog, wxGenericPrintSetupDialog,
+// wxGenericPageSetupDialog
+// Author: Julian Smart
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __PRINTDLGH_G_
+#define __PRINTDLGH_G_
+
+#include "wx/defs.h"
+
+#if wxUSE_PRINTING_ARCHITECTURE
+
+#include "wx/dialog.h"
+#include "wx/cmndata.h"
+#include "wx/prntbase.h"
+#include "wx/printdlg.h"
+#include "wx/listctrl.h"
+
+#include "wx/dc.h"
+#if wxUSE_POSTSCRIPT
+ #include "wx/dcps.h"
+#endif
+
+class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
+class WXDLLIMPEXP_FWD_CORE wxButton;
+class WXDLLIMPEXP_FWD_CORE wxCheckBox;
+class WXDLLIMPEXP_FWD_CORE wxComboBox;
+class WXDLLIMPEXP_FWD_CORE wxStaticText;
+class WXDLLIMPEXP_FWD_CORE wxRadioBox;
+class WXDLLIMPEXP_FWD_CORE wxPageSetupDialogData;
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// This is not clear why all these enums start with 10 or 30 but do not change it
+// without good reason to avoid some subtle backwards compatibility breakage
+
+enum
+{
+ wxPRINTID_STATIC = 10,
+ wxPRINTID_RANGE,
+ wxPRINTID_FROM,
+ wxPRINTID_TO,
+ wxPRINTID_COPIES,
+ wxPRINTID_PRINTTOFILE,
+ wxPRINTID_SETUP
+};
+
+enum
+{
+ wxPRINTID_LEFTMARGIN = 30,
+ wxPRINTID_RIGHTMARGIN,
+ wxPRINTID_TOPMARGIN,
+ wxPRINTID_BOTTOMMARGIN
+};
+
+enum
+{
+ wxPRINTID_PRINTCOLOUR = 10,
+ wxPRINTID_ORIENTATION,
+ wxPRINTID_COMMAND,
+ wxPRINTID_OPTIONS,
+ wxPRINTID_PAPERSIZE,
+ wxPRINTID_PRINTER
+};
+
+#if wxUSE_POSTSCRIPT
+
+//----------------------------------------------------------------------------
+// wxPostScriptNativeData
+//----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPostScriptPrintNativeData: public wxPrintNativeDataBase
+{
+public:
+ wxPostScriptPrintNativeData();
+ virtual ~wxPostScriptPrintNativeData();
+
+ virtual bool TransferTo( wxPrintData &data );
+ virtual bool TransferFrom( const wxPrintData &data );
+
+ virtual bool Ok() const { return IsOk(); }
+ virtual bool IsOk() const { return true; }
+
+ const wxString& GetPrinterCommand() const { return m_printerCommand; }
+ const wxString& GetPrinterOptions() const { return m_printerOptions; }
+ const wxString& GetPreviewCommand() const { return m_previewCommand; }
+ const wxString& GetFontMetricPath() const { return m_afmPath; }
+ double GetPrinterScaleX() const { return m_printerScaleX; }
+ double GetPrinterScaleY() const { return m_printerScaleY; }
+ long GetPrinterTranslateX() const { return m_printerTranslateX; }
+ long GetPrinterTranslateY() const { return m_printerTranslateY; }
+
+ void SetPrinterCommand(const wxString& command) { m_printerCommand = command; }
+ void SetPrinterOptions(const wxString& options) { m_printerOptions = options; }
+ void SetPreviewCommand(const wxString& command) { m_previewCommand = command; }
+ void SetFontMetricPath(const wxString& path) { m_afmPath = path; }
+ void SetPrinterScaleX(double x) { m_printerScaleX = x; }
+ void SetPrinterScaleY(double y) { m_printerScaleY = y; }
+ void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; }
+ void SetPrinterTranslateX(long x) { m_printerTranslateX = x; }
+ void SetPrinterTranslateY(long y) { m_printerTranslateY = y; }
+ void SetPrinterTranslation(long x, long y) { m_printerTranslateX = x; m_printerTranslateY = y; }
+
+#if wxUSE_STREAMS
+ wxOutputStream *GetOutputStream() { return m_outputStream; }
+ void SetOutputStream( wxOutputStream *output ) { m_outputStream = output; }
+#endif
+
+private:
+ wxString m_printerCommand;
+ wxString m_previewCommand;
+ wxString m_printerOptions;
+ wxString m_afmPath;
+ double m_printerScaleX;
+ double m_printerScaleY;
+ long m_printerTranslateX;
+ long m_printerTranslateY;
+#if wxUSE_STREAMS
+ wxOutputStream *m_outputStream;
+#endif
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPostScriptPrintNativeData)
+};
+
+// ----------------------------------------------------------------------------
+// Simulated Print and Print Setup dialogs for non-Windows platforms (and
+// Windows using PostScript print/preview)
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxGenericPrintDialog : public wxPrintDialogBase
+{
+public:
+ wxGenericPrintDialog(wxWindow *parent,
+ wxPrintDialogData* data = NULL);
+ wxGenericPrintDialog(wxWindow *parent, wxPrintData* data);
+
+ virtual ~wxGenericPrintDialog();
+
+ void OnSetup(wxCommandEvent& event);
+ void OnRange(wxCommandEvent& event);
+ void OnOK(wxCommandEvent& event);
+
+ virtual bool TransferDataFromWindow();
+ virtual bool TransferDataToWindow();
+
+ virtual int ShowModal();
+
+ wxPrintData& GetPrintData()
+ { return m_printDialogData.GetPrintData(); }
+
+ wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; }
+ wxDC *GetPrintDC();
+
+public:
+// wxStaticText* m_printerMessage;
+ wxButton* m_setupButton;
+// wxButton* m_helpButton;
+ wxRadioBox* m_rangeRadioBox;
+ wxTextCtrl* m_fromText;
+ wxTextCtrl* m_toText;
+ wxTextCtrl* m_noCopiesText;
+ wxCheckBox* m_printToFileCheckBox;
+// wxCheckBox* m_collateCopiesCheckBox;
+
+ wxPrintDialogData m_printDialogData;
+
+protected:
+ void Init(wxWindow *parent);
+
+private:
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog)
+};
+
+class WXDLLIMPEXP_CORE wxGenericPrintSetupDialog : public wxDialog
+{
+public:
+ // There are no configuration options for the dialog, so we
+ // just pass the wxPrintData object (no wxPrintSetupDialogData class needed)
+ wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data);
+ virtual ~wxGenericPrintSetupDialog();
+
+ void Init(wxPrintData* data);
+
+ void OnPrinter(wxListEvent& event);
+
+ virtual bool TransferDataFromWindow();
+ virtual bool TransferDataToWindow();
+
+ virtual wxComboBox *CreatePaperTypeChoice();
+
+public:
+ wxListCtrl* m_printerListCtrl;
+ wxRadioBox* m_orientationRadioBox;
+ wxTextCtrl* m_printerCommandText;
+ wxTextCtrl* m_printerOptionsText;
+ wxCheckBox* m_colourCheckBox;
+ wxComboBox* m_paperTypeChoice;
+
+ wxPrintData m_printData;
+ wxPrintData& GetPrintData() { return m_printData; }
+
+ // After pressing OK, write data here.
+ wxPrintData* m_targetData;
+
+private:
+ DECLARE_EVENT_TABLE()
+ DECLARE_CLASS(wxGenericPrintSetupDialog)
+};
+#endif
+ // wxUSE_POSTSCRIPT
+
+class WXDLLIMPEXP_CORE wxGenericPageSetupDialog : public wxPageSetupDialogBase
+{
+public:
+ wxGenericPageSetupDialog(wxWindow *parent = NULL,
+ wxPageSetupDialogData* data = NULL);
+ virtual ~wxGenericPageSetupDialog();
+
+ virtual bool TransferDataFromWindow();
+ virtual bool TransferDataToWindow();
+
+ virtual wxPageSetupDialogData& GetPageSetupDialogData();
+
+ void OnPrinter(wxCommandEvent& event);
+ wxComboBox *CreatePaperTypeChoice(int* x, int* y);
+
+public:
+ wxButton* m_printerButton;
+ wxRadioBox* m_orientationRadioBox;
+ wxTextCtrl* m_marginLeftText;
+ wxTextCtrl* m_marginTopText;
+ wxTextCtrl* m_marginRightText;
+ wxTextCtrl* m_marginBottomText;
+ wxComboBox* m_paperTypeChoice;
+
+ wxPageSetupDialogData m_pageData;
+
+private:
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericPageSetupDialog)
+};
+
+#endif
+
+#endif
+// __PRINTDLGH_G_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/progdlgg.h
+// Purpose: wxGenericProgressDialog class
+// Author: Karsten Ballueder
+// Modified by: Francesco Montorsi
+// Created: 09.05.1999
+// Copyright: (c) Karsten Ballueder
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef __PROGDLGH_G__
+#define __PROGDLGH_G__
+
+#include "wx/dialog.h"
+
+class WXDLLIMPEXP_FWD_CORE wxButton;
+class WXDLLIMPEXP_FWD_CORE wxEventLoop;
+class WXDLLIMPEXP_FWD_CORE wxGauge;
+class WXDLLIMPEXP_FWD_CORE wxStaticText;
+class WXDLLIMPEXP_FWD_CORE wxWindowDisabler;
+
+/*
+ Progress dialog which shows a moving progress bar.
+ Taken from the Mahogany project.
+*/
+class WXDLLIMPEXP_CORE wxGenericProgressDialog : public wxDialog
+{
+public:
+ wxGenericProgressDialog();
+ wxGenericProgressDialog(const wxString& title, const wxString& message,
+ int maximum = 100,
+ wxWindow *parent = NULL,
+ int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE);
+
+ virtual ~wxGenericProgressDialog();
+
+ bool Create(const wxString& title,
+ const wxString& message,
+ int maximum = 100,
+ wxWindow *parent = NULL,
+ int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE);
+
+ virtual bool Update(int value, const wxString& newmsg = wxEmptyString, bool *skip = NULL);
+ virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool *skip = NULL);
+
+ void Resume();
+
+ int GetValue() const;
+ int GetRange() const;
+ wxString GetMessage() const;
+
+ void SetRange(int maximum);
+
+ // Return whether "Cancel" or "Skip" button was pressed, always return
+ // false if the corresponding button is not shown.
+ bool WasCancelled() const;
+ bool WasSkipped() const;
+
+ // Must provide overload to avoid hiding it (and warnings about it)
+ virtual void Update() { wxDialog::Update(); }
+
+ virtual bool Show( bool show = true );
+
+ // This enum is an implementation detail and should not be used
+ // by user code.
+ enum State
+ {
+ Uncancelable = -1, // dialog can't be canceled
+ Canceled, // can be cancelled and, in fact, was
+ Continue, // can be cancelled but wasn't
+ Finished, // finished, waiting to be removed from screen
+ Dismissed // was closed by user after finishing
+ };
+
+protected:
+ // Update just the m_maximum field, this is used by public SetRange() but,
+ // unlike it, doesn't update the controls state. This makes it useful for
+ // both this class and its derived classes that don't use m_gauge to
+ // display progress.
+ void SetMaximum(int maximum);
+
+ // Return the labels to use for showing the elapsed/estimated/remaining
+ // times respectively.
+ static wxString GetElapsedLabel() { return wxGetTranslation("Elapsed time:"); }
+ static wxString GetEstimatedLabel() { return wxGetTranslation("Estimated time:"); }
+ static wxString GetRemainingLabel() { return wxGetTranslation("Remaining time:"); }
+
+
+ // Similar to wxWindow::HasFlag() but tests for a presence of a wxPD_XXX
+ // flag in our (separate) flags instead of using m_windowStyle.
+ bool HasPDFlag(int flag) const { return (m_pdStyle & flag) != 0; }
+
+ // Return the progress dialog style. Prefer to use HasPDFlag() if possible.
+ int GetPDStyle() const { return m_pdStyle; }
+ void SetPDStyle(int pdStyle) { m_pdStyle = pdStyle; }
+
+ // Updates estimated times from a given progress bar value and stores the
+ // results in provided arguments.
+ void UpdateTimeEstimates(int value,
+ unsigned long &elapsedTime,
+ unsigned long &estimatedTime,
+ unsigned long &remainingTime);
+
+ // Converts seconds to HH:mm:ss format.
+ static wxString GetFormattedTime(unsigned long timeInSec);
+
+ // callback for optional abort button
+ void OnCancel(wxCommandEvent&);
+
+ // callback for optional skip button
+ void OnSkip(wxCommandEvent&);
+
+ // callback to disable "hard" window closing
+ void OnClose(wxCloseEvent&);
+
+ // called to disable the other windows while this dialog is shown
+ void DisableOtherWindows();
+
+ // must be called to reenable the other windows temporarily disabled while
+ // the dialog was shown
+ void ReenableOtherWindows();
+
+ // Set the top level parent we store from the parent window provided when
+ // creating the dialog.
+ void SetTopParent(wxWindow* parent);
+
+ // return the top level parent window of this dialog (may be NULL)
+ wxWindow *GetTopParent() const { return m_parentTop; }
+
+
+ // continue processing or not (return value for Update())
+ State m_state;
+
+ // the maximum value
+ int m_maximum;
+
+#if defined(__WXMSW__ ) || defined(__WXPM__)
+ // the factor we use to always keep the value in 16 bit range as the native
+ // control only supports ranges from 0 to 65,535
+ size_t m_factor;
+#endif // __WXMSW__
+
+ // time when the dialog was created
+ unsigned long m_timeStart;
+ // time when the dialog was closed or cancelled
+ unsigned long m_timeStop;
+ // time between the moment the dialog was closed/cancelled and resume
+ unsigned long m_break;
+
+private:
+ // update the label to show the given time (in seconds)
+ static void SetTimeLabel(unsigned long val, wxStaticText *label);
+
+ // common part of all ctors
+ void Init();
+
+ // create the label with given text and another one to show the time nearby
+ // as the next windows in the sizer, returns the created control
+ wxStaticText *CreateLabel(const wxString& text, wxSizer *sizer);
+
+ // updates the label message
+ void UpdateMessage(const wxString &newmsg);
+
+ // common part of Update() and Pulse(), returns true if not cancelled
+ bool DoBeforeUpdate(bool *skip);
+
+ // common part of Update() and Pulse()
+ void DoAfterUpdate();
+
+ // shortcuts for enabling buttons
+ void EnableClose();
+ void EnableSkip(bool enable = true);
+ void EnableAbort(bool enable = true);
+ void DisableSkip() { EnableSkip(false); }
+ void DisableAbort() { EnableAbort(false); }
+
+ // the widget displaying current status (may be NULL)
+ wxGauge *m_gauge;
+ // the message displayed
+ wxStaticText *m_msg;
+ // displayed elapsed, estimated, remaining time
+ wxStaticText *m_elapsed,
+ *m_estimated,
+ *m_remaining;
+
+ // parent top level window (may be NULL)
+ wxWindow *m_parentTop;
+
+ // Progress dialog styles: this is not the same as m_windowStyle because
+ // wxPD_XXX constants clash with the existing TLW styles so to be sure we
+ // don't have any conflicts we just use a separate variable for storing
+ // them.
+ int m_pdStyle;
+
+ // skip some portion
+ bool m_skip;
+
+#if !defined(__SMARTPHONE__)
+ // the abort and skip buttons (or NULL if none)
+ wxButton *m_btnAbort;
+ wxButton *m_btnSkip;
+#endif
+
+ // saves the time when elapsed time was updated so there is only one
+ // update per second
+ unsigned long m_last_timeupdate;
+
+ // tells how often a change of the estimated time has to be confirmed
+ // before it is actually displayed - this reduces the frequency of updates
+ // of estimated and remaining time
+ int m_delay;
+
+ // counts the confirmations
+ int m_ctdelay;
+ unsigned long m_display_estimated;
+
+ // for wxPD_APP_MODAL case
+ wxWindowDisabler *m_winDisabler;
+
+ // Temporary event loop created by the dialog itself if there is no
+ // currently active loop when it is created.
+ wxEventLoop *m_tempEventLoop;
+
+
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxGenericProgressDialog);
+};
+
+#endif // __PROGDLGH_G__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/propdlg.h
+// Purpose: wxPropertySheetDialog
+// Author: Julian Smart
+// Modified by:
+// Created: 2005-03-12
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PROPDLG_H_
+#define _WX_PROPDLG_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_BOOKCTRL
+
+#include "wx/dialog.h"
+
+class WXDLLIMPEXP_FWD_CORE wxBookCtrlBase;
+
+//-----------------------------------------------------------------------------
+// wxPropertySheetDialog
+// A platform-independent properties dialog.
+//
+// * on PocketPC, a flat-look 'property sheet' notebook will be used, with
+// no OK/Cancel/Help buttons
+// * on other platforms, a normal notebook will be used, with standard buttons
+//
+// To use this class, call Create from your derived class.
+// Then create pages and add to the book control. Finally call CreateButtons and
+// LayoutDialog.
+//
+// For example:
+//
+// MyPropertySheetDialog::Create(...)
+// {
+// wxPropertySheetDialog::Create(...);
+//
+// // Add page
+// wxPanel* panel = new wxPanel(GetBookCtrl(), ...);
+// GetBookCtrl()->AddPage(panel, wxT("General"));
+//
+// CreateButtons();
+// LayoutDialog();
+// }
+//
+// Override CreateBookCtrl and AddBookCtrl to create and add a different
+// kind of book control.
+//-----------------------------------------------------------------------------
+
+enum wxPropertySheetDialogFlags
+{
+ // Use the platform default
+ wxPROPSHEET_DEFAULT = 0x0001,
+
+ // Use a notebook
+ wxPROPSHEET_NOTEBOOK = 0x0002,
+
+ // Use a toolbook
+ wxPROPSHEET_TOOLBOOK = 0x0004,
+
+ // Use a choicebook
+ wxPROPSHEET_CHOICEBOOK = 0x0008,
+
+ // Use a listbook
+ wxPROPSHEET_LISTBOOK = 0x0010,
+
+ // Use a wxButtonToolBar toolbook
+ wxPROPSHEET_BUTTONTOOLBOOK = 0x0020,
+
+ // Use a treebook
+ wxPROPSHEET_TREEBOOK = 0x0040,
+
+ // Shrink dialog to fit current page
+ wxPROPSHEET_SHRINKTOFIT = 0x0100
+};
+
+class WXDLLIMPEXP_ADV wxPropertySheetDialog : public wxDialog
+{
+public:
+ wxPropertySheetDialog() : wxDialog() { Init(); }
+
+ wxPropertySheetDialog(wxWindow* parent, wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& sz = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE,
+ const wxString& name = wxDialogNameStr)
+ {
+ Init();
+ Create(parent, id, title, pos, sz, style, name);
+ }
+
+ bool Create(wxWindow* parent, wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& sz = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE,
+ const wxString& name = wxDialogNameStr);
+
+//// Accessors
+
+ // Set and get the notebook
+ void SetBookCtrl(wxBookCtrlBase* book) { m_bookCtrl = book; }
+ wxBookCtrlBase* GetBookCtrl() const { return m_bookCtrl; }
+
+ // Override function in base
+ virtual wxWindow* GetContentWindow() const;
+
+ // Set and get the inner sizer
+ void SetInnerSize(wxSizer* sizer) { m_innerSizer = sizer; }
+ wxSizer* GetInnerSizer() const { return m_innerSizer ; }
+
+ // Set and get the book style
+ void SetSheetStyle(long sheetStyle) { m_sheetStyle = sheetStyle; }
+ long GetSheetStyle() const { return m_sheetStyle ; }
+
+ // Set and get the border around the whole dialog
+ void SetSheetOuterBorder(int border) { m_sheetOuterBorder = border; }
+ int GetSheetOuterBorder() const { return m_sheetOuterBorder ; }
+
+ // Set and get the border around the book control only
+ void SetSheetInnerBorder(int border) { m_sheetInnerBorder = border; }
+ int GetSheetInnerBorder() const { return m_sheetInnerBorder ; }
+
+/// Operations
+
+ // Creates the buttons (none on PocketPC)
+ virtual void CreateButtons(int flags = wxOK|wxCANCEL);
+
+ // Lay out the dialog, to be called after pages have been created
+ virtual void LayoutDialog(int centreFlags = wxBOTH);
+
+/// Implementation
+
+ // Creates the book control. If you want to use a different kind of
+ // control, override.
+ virtual wxBookCtrlBase* CreateBookCtrl();
+
+ // Adds the book control to the inner sizer.
+ virtual void AddBookCtrl(wxSizer* sizer);
+
+ // Set the focus
+ void OnActivate(wxActivateEvent& event);
+
+ // Resize dialog if necessary
+ void OnIdle(wxIdleEvent& event);
+
+private:
+ void Init();
+
+protected:
+ wxBookCtrlBase* m_bookCtrl;
+ wxSizer* m_innerSizer; // sizer for extra space
+ long m_sheetStyle;
+ int m_sheetOuterBorder;
+ int m_sheetInnerBorder;
+ int m_selectedPage;
+
+ DECLARE_DYNAMIC_CLASS(wxPropertySheetDialog)
+ DECLARE_EVENT_TABLE()
+};
+
+#endif // wxUSE_BOOKCTRL
+
+#endif // _WX_PROPDLG_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/richmsgdlgg.h
+// Purpose: wxGenericRichMessageDialog
+// Author: Rickard Westerlund
+// Created: 2010-07-04
+// Copyright: (c) 2010 wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_RICHMSGDLGG_H_
+#define _WX_GENERIC_RICHMSGDLGG_H_
+
+class WXDLLIMPEXP_FWD_CORE wxCheckBox;
+class WXDLLIMPEXP_FWD_CORE wxCollapsiblePane;
+class WXDLLIMPEXP_FWD_CORE wxCollapsiblePaneEvent;
+
+class WXDLLIMPEXP_CORE wxGenericRichMessageDialog
+ : public wxRichMessageDialogBase
+{
+public:
+ wxGenericRichMessageDialog(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ long style)
+ : wxRichMessageDialogBase( parent, message, caption, style ),
+ m_checkBox(NULL),
+ m_detailsPane(NULL)
+ { }
+
+ virtual bool IsCheckBoxChecked() const;
+
+protected:
+ wxCheckBox *m_checkBox;
+ wxCollapsiblePane *m_detailsPane;
+
+ // overrides methods in the base class
+ virtual void AddMessageDialogCheckBox(wxSizer *sizer);
+ virtual void AddMessageDialogDetails(wxSizer *sizer);
+
+private:
+ void OnPaneChanged(wxCollapsiblePaneEvent& event);
+
+ DECLARE_EVENT_TABLE()
+
+ wxDECLARE_NO_COPY_CLASS(wxGenericRichMessageDialog);
+};
+
+#endif // _WX_GENERIC_RICHMSGDLGG_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/sashwin.h
+// Purpose: wxSashWindow implementation. A sash window has an optional
+// sash on each edge, allowing it to be dragged. An event
+// is generated when the sash is released.
+// Author: Julian Smart
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SASHWIN_H_G_
+#define _WX_SASHWIN_H_G_
+
+#if wxUSE_SASH
+
+#include "wx/defs.h"
+#include "wx/window.h"
+#include "wx/string.h"
+
+#define wxSASH_DRAG_NONE 0
+#define wxSASH_DRAG_DRAGGING 1
+#define wxSASH_DRAG_LEFT_DOWN 2
+
+enum wxSashEdgePosition {
+ wxSASH_TOP = 0,
+ wxSASH_RIGHT,
+ wxSASH_BOTTOM,
+ wxSASH_LEFT,
+ wxSASH_NONE = 100
+};
+
+/*
+ * wxSashEdge represents one of the four edges of a window.
+ */
+
+class WXDLLIMPEXP_ADV wxSashEdge
+{
+public:
+ wxSashEdge()
+ { m_show = false;
+#if WXWIN_COMPATIBILITY_2_6
+ m_border = false;
+#endif
+ m_margin = 0; }
+
+ bool m_show; // Is the sash showing?
+#if WXWIN_COMPATIBILITY_2_6
+ bool m_border; // Do we draw a border?
+#endif
+ int m_margin; // The margin size
+};
+
+/*
+ * wxSashWindow flags
+ */
+
+#define wxSW_NOBORDER 0x0000
+//#define wxSW_3D 0x0010
+#define wxSW_BORDER 0x0020
+#define wxSW_3DSASH 0x0040
+#define wxSW_3DBORDER 0x0080
+#define wxSW_3D (wxSW_3DSASH | wxSW_3DBORDER)
+
+/*
+ * wxSashWindow allows any of its edges to have a sash which can be dragged
+ * to resize the window. The actual content window will be created as a child
+ * of wxSashWindow.
+ */
+
+class WXDLLIMPEXP_ADV wxSashWindow: public wxWindow
+{
+public:
+ // Default constructor
+ wxSashWindow()
+ {
+ Init();
+ }
+
+ // Normal constructor
+ wxSashWindow(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = wxT("sashWindow"))
+ {
+ Init();
+ Create(parent, id, pos, size, style, name);
+ }
+
+ virtual ~wxSashWindow();
+
+ bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = wxT("sashWindow"));
+
+ // Set whether there's a sash in this position
+ void SetSashVisible(wxSashEdgePosition edge, bool sash);
+
+ // Get whether there's a sash in this position
+ bool GetSashVisible(wxSashEdgePosition edge) const { return m_sashes[edge].m_show; }
+
+#if WXWIN_COMPATIBILITY_2_6
+ // Set whether there's a border in this position
+ // This value is unused in wxSashWindow.
+ void SetSashBorder(wxSashEdgePosition edge, bool border) { m_sashes[edge].m_border = border; }
+
+ // Get whether there's a border in this position
+ // This value is unused in wxSashWindow.
+ bool HasBorder(wxSashEdgePosition edge) const { return m_sashes[edge].m_border; }
+#endif
+
+ // Get border size
+ int GetEdgeMargin(wxSashEdgePosition edge) const { return m_sashes[edge].m_margin; }
+
+ // Sets the default sash border size
+ void SetDefaultBorderSize(int width) { m_borderSize = width; }
+
+ // Gets the default sash border size
+ int GetDefaultBorderSize() const { return m_borderSize; }
+
+ // Sets the addition border size between child and sash window
+ void SetExtraBorderSize(int width) { m_extraBorderSize = width; }
+
+ // Gets the addition border size between child and sash window
+ int GetExtraBorderSize() const { return m_extraBorderSize; }
+
+ virtual void SetMinimumSizeX(int min) { m_minimumPaneSizeX = min; }
+ virtual void SetMinimumSizeY(int min) { m_minimumPaneSizeY = min; }
+ virtual int GetMinimumSizeX() const { return m_minimumPaneSizeX; }
+ virtual int GetMinimumSizeY() const { return m_minimumPaneSizeY; }
+
+ virtual void SetMaximumSizeX(int max) { m_maximumPaneSizeX = max; }
+ virtual void SetMaximumSizeY(int max) { m_maximumPaneSizeY = max; }
+ virtual int GetMaximumSizeX() const { return m_maximumPaneSizeX; }
+ virtual int GetMaximumSizeY() const { return m_maximumPaneSizeY; }
+
+////////////////////////////////////////////////////////////////////////////
+// Implementation
+
+ // Paints the border and sash
+ void OnPaint(wxPaintEvent& event);
+
+ // Handles mouse events
+ void OnMouseEvent(wxMouseEvent& ev);
+
+ // Adjusts the panes
+ void OnSize(wxSizeEvent& event);
+
+#if defined(__WXMSW__) || defined(__WXMAC__)
+ // Handle cursor correctly
+ void OnSetCursor(wxSetCursorEvent& event);
+#endif // wxMSW
+
+ // Draws borders
+ void DrawBorders(wxDC& dc);
+
+ // Draws the sashes
+ void DrawSash(wxSashEdgePosition edge, wxDC& dc);
+
+ // Draws the sashes
+ void DrawSashes(wxDC& dc);
+
+ // Draws the sash tracker (for whilst moving the sash)
+ void DrawSashTracker(wxSashEdgePosition edge, int x, int y);
+
+ // Tests for x, y over sash
+ wxSashEdgePosition SashHitTest(int x, int y, int tolerance = 2);
+
+ // Resizes subwindows
+ void SizeWindows();
+
+ // Initialize colours
+ void InitColours();
+
+private:
+ void Init();
+
+ wxSashEdge m_sashes[4];
+ int m_dragMode;
+ wxSashEdgePosition m_draggingEdge;
+ int m_oldX;
+ int m_oldY;
+ int m_borderSize;
+ int m_extraBorderSize;
+ int m_firstX;
+ int m_firstY;
+ int m_minimumPaneSizeX;
+ int m_minimumPaneSizeY;
+ int m_maximumPaneSizeX;
+ int m_maximumPaneSizeY;
+ wxCursor* m_sashCursorWE;
+ wxCursor* m_sashCursorNS;
+ wxColour m_lightShadowColour;
+ wxColour m_mediumShadowColour;
+ wxColour m_darkShadowColour;
+ wxColour m_hilightColour;
+ wxColour m_faceColour;
+ bool m_mouseCaptured;
+ wxCursor* m_currentCursor;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxSashWindow)
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxSashWindow);
+};
+
+class WXDLLIMPEXP_FWD_ADV wxSashEvent;
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_SASH_DRAGGED, wxSashEvent );
+
+enum wxSashDragStatus
+{
+ wxSASH_STATUS_OK,
+ wxSASH_STATUS_OUT_OF_RANGE
+};
+
+class WXDLLIMPEXP_ADV wxSashEvent: public wxCommandEvent
+{
+public:
+ wxSashEvent(int id = 0, wxSashEdgePosition edge = wxSASH_NONE)
+ {
+ m_eventType = (wxEventType) wxEVT_SASH_DRAGGED;
+ m_id = id;
+ m_edge = edge;
+ }
+
+ wxSashEvent(const wxSashEvent& event)
+ : wxCommandEvent(event),
+ m_edge(event.m_edge),
+ m_dragRect(event.m_dragRect),
+ m_dragStatus(event.m_dragStatus) { }
+
+ void SetEdge(wxSashEdgePosition edge) { m_edge = edge; }
+ wxSashEdgePosition GetEdge() const { return m_edge; }
+
+ //// The rectangle formed by the drag operation
+ void SetDragRect(const wxRect& rect) { m_dragRect = rect; }
+ wxRect GetDragRect() const { return m_dragRect; }
+
+ //// Whether the drag caused the rectangle to be reversed (e.g.
+ //// dragging the top below the bottom)
+ void SetDragStatus(wxSashDragStatus status) { m_dragStatus = status; }
+ wxSashDragStatus GetDragStatus() const { return m_dragStatus; }
+
+ virtual wxEvent *Clone() const { return new wxSashEvent(*this); }
+
+private:
+ wxSashEdgePosition m_edge;
+ wxRect m_dragRect;
+ wxSashDragStatus m_dragStatus;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSashEvent)
+};
+
+typedef void (wxEvtHandler::*wxSashEventFunction)(wxSashEvent&);
+
+#define wxSashEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxSashEventFunction, func)
+
+#define EVT_SASH_DRAGGED(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_SASH_DRAGGED, id, wxSashEventHandler(fn))
+#define EVT_SASH_DRAGGED_RANGE(id1, id2, fn) \
+ wx__DECLARE_EVT2(wxEVT_SASH_DRAGGED, id1, id2, wxSashEventHandler(fn))
+
+#endif // wxUSE_SASH
+
+#endif
+ // _WX_SASHWIN_H_G_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/scrolwin.h
+// Purpose: generic wxScrollHelper
+// Author: Vadim Zeitlin
+// Created: 2008-12-24 (replacing old file with the same name)
+// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_SCROLLWIN_H_
+#define _WX_GENERIC_SCROLLWIN_H_
+
+// ----------------------------------------------------------------------------
+// generic wxScrollHelper implementation
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxScrollHelper : public wxScrollHelperBase
+{
+public:
+ wxScrollHelper(wxWindow *winToScroll);
+
+ // implement base class pure virtuals
+ virtual void AdjustScrollbars();
+ virtual bool IsScrollbarShown(int orient) const;
+
+protected:
+ virtual void DoScroll(int x, int y);
+ virtual void DoShowScrollbars(wxScrollbarVisibility horz,
+ wxScrollbarVisibility vert);
+
+private:
+ // helper of AdjustScrollbars(): does the work for the single scrollbar
+ //
+ // notice that the parameters passed by non-const references are modified
+ // by this function
+ void DoAdjustScrollbar(int orient,
+ int clientSize,
+ int virtSize,
+ int pixelsPerUnit,
+ int& scrollUnits,
+ int& scrollPosition,
+ int& scrollLinesPerPage,
+ wxScrollbarVisibility visibility);
+
+
+ wxScrollbarVisibility m_xVisibility,
+ m_yVisibility;
+
+ wxDECLARE_NO_COPY_CLASS(wxScrollHelper);
+};
+
+#endif // _WX_GENERIC_SCROLLWIN_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/spinctlg.h
+// Purpose: generic wxSpinCtrl class
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 28.10.99
+// Copyright: (c) Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_SPINCTRL_H_
+#define _WX_GENERIC_SPINCTRL_H_
+
+// ----------------------------------------------------------------------------
+// wxSpinCtrl is a combination of wxSpinButton and wxTextCtrl, so if
+// wxSpinButton is available, this is what we do - but if it isn't, we still
+// define wxSpinCtrl class which then has the same appearance as wxTextCtrl but
+// the different interface. This allows to write programs using wxSpinCtrl
+// without tons of #ifdefs.
+// ----------------------------------------------------------------------------
+
+#if wxUSE_SPINBTN
+
+#include "wx/compositewin.h"
+
+class WXDLLIMPEXP_FWD_CORE wxSpinButton;
+class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
+
+class wxSpinCtrlTextGeneric; // wxTextCtrl used for the wxSpinCtrlGenericBase
+
+// The !wxUSE_SPINBTN version's GetValue() function conflicts with the
+// wxTextCtrl's GetValue() and so you have to input a dummy int value.
+#define wxSPINCTRL_GETVALUE_FIX
+
+// ----------------------------------------------------------------------------
+// wxSpinCtrlGeneric is a combination of wxTextCtrl and wxSpinButton
+//
+// This class manages a double valued generic spinctrl through the DoGet/SetXXX
+// functions that are made public as Get/SetXXX functions for int or double
+// for the wxSpinCtrl and wxSpinCtrlDouble classes respectively to avoid
+// function ambiguity.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSpinCtrlGenericBase
+ : public wxNavigationEnabled<wxCompositeWindow<wxSpinCtrlBase> >
+{
+public:
+ wxSpinCtrlGenericBase() { Init(); }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
+ double min = 0, double max = 100, double initial = 0,
+ double inc = 1,
+ const wxString& name = wxT("wxSpinCtrl"));
+
+ virtual ~wxSpinCtrlGenericBase();
+
+ // accessors
+ // T GetValue() const
+ // T GetMin() const
+ // T GetMax() const
+ // T GetIncrement() const
+ virtual bool GetSnapToTicks() const { return m_snap_to_ticks; }
+ // unsigned GetDigits() const - wxSpinCtrlDouble only
+
+ // operations
+ virtual void SetValue(const wxString& text);
+ // void SetValue(T val)
+ // void SetRange(T minVal, T maxVal)
+ // void SetIncrement(T inc)
+ virtual void SetSnapToTicks(bool snap_to_ticks);
+ // void SetDigits(unsigned digits) - wxSpinCtrlDouble only
+
+ // Select text in the textctrl
+ void SetSelection(long from, long to);
+
+ // implementation from now on
+
+ // forward these functions to all subcontrols
+ virtual bool Enable(bool enable = true);
+ virtual bool Show(bool show = true);
+#if wxUSE_TOOLTIPS
+ virtual void DoSetToolTip(wxToolTip *tip);
+#endif // wxUSE_TOOLTIPS
+
+ virtual bool SetBackgroundColour(const wxColour& colour);
+
+ // get the subcontrols
+ wxTextCtrl *GetText() const { return m_textCtrl; }
+ wxSpinButton *GetSpinButton() const { return m_spinButton; }
+
+ // forwarded events from children windows
+ void OnSpinButton(wxSpinEvent& event);
+ void OnTextLostFocus(wxFocusEvent& event);
+ void OnTextChar(wxKeyEvent& event);
+
+ // this window itself is used only as a container for its sub windows so it
+ // shouldn't accept the focus at all and any attempts to explicitly set
+ // focus to it should give focus to its text constol part
+ virtual bool AcceptsFocus() const { return false; }
+ virtual void SetFocus();
+
+ friend class wxSpinCtrlTextGeneric;
+
+protected:
+ // override the base class virtuals involved into geometry calculations
+ virtual wxSize DoGetBestSize() const;
+ virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const;
+ virtual void DoMoveWindow(int x, int y, int width, int height);
+
+#ifdef __WXMSW__
+ // and, for MSW, enabling this window itself
+ virtual void DoEnable(bool enable);
+#endif // __WXMSW__
+
+ enum SendEvent
+ {
+ SendEvent_None,
+ SendEvent_Text
+ };
+
+ // generic double valued functions
+ double DoGetValue() const { return m_value; }
+ bool DoSetValue(double val, SendEvent sendEvent);
+ void DoSetRange(double min_val, double max_val);
+ void DoSetIncrement(double inc);
+
+ // update our value to reflect the text control contents (if it has been
+ // modified by user, do nothing otherwise)
+ //
+ // can also change the text control if its value is invalid
+ //
+ // return true if our value has changed
+ bool SyncSpinToText(SendEvent sendEvent);
+
+ // Send the correct event type
+ virtual void DoSendEvent() = 0;
+
+ // Convert the text to/from the corresponding value.
+ virtual bool DoTextToValue(const wxString& text, double *val) = 0;
+ virtual wxString DoValueToText(double val) = 0;
+
+ // check if the value is in range
+ bool InRange(double n) const { return (n >= m_min) && (n <= m_max); }
+
+ // ensure that the value is in range wrapping it round if necessary
+ double AdjustToFitInRange(double value) const;
+
+
+ double m_value;
+ double m_min;
+ double m_max;
+ double m_increment;
+ bool m_snap_to_ticks;
+
+ int m_spin_value;
+
+ // the subcontrols
+ wxTextCtrl *m_textCtrl;
+ wxSpinButton *m_spinButton;
+
+private:
+ // common part of all ctors
+ void Init();
+
+ // Implement pure virtual function inherited from wxCompositeWindow.
+ virtual wxWindowList GetCompositeWindowParts() const;
+
+ DECLARE_EVENT_TABLE()
+};
+
+#else // !wxUSE_SPINBTN
+
+#define wxSPINCTRL_GETVALUE_FIX int = 1
+
+// ----------------------------------------------------------------------------
+// wxSpinCtrl is just a text control
+// ----------------------------------------------------------------------------
+
+#include "wx/textctrl.h"
+
+class WXDLLIMPEXP_CORE wxSpinCtrlGenericBase : public wxTextCtrl
+{
+public:
+ wxSpinCtrlGenericBase() : m_value(0), m_min(0), m_max(100),
+ m_increment(1), m_snap_to_ticks(false),
+ m_format(wxT("%g")) { }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
+ double min = 0, double max = 100, double initial = 0,
+ double inc = 1,
+ const wxString& name = wxT("wxSpinCtrl"))
+ {
+ m_min = min;
+ m_max = max;
+ m_value = initial;
+ m_increment = inc;
+
+ bool ok = wxTextCtrl::Create(parent, id, value, pos, size, style,
+ wxDefaultValidator, name);
+ DoSetValue(initial, SendEvent_None);
+
+ return ok;
+ }
+
+ // accessors
+ // T GetValue() const
+ // T GetMin() const
+ // T GetMax() const
+ // T GetIncrement() const
+ virtual bool GetSnapToTicks() const { return m_snap_to_ticks; }
+ // unsigned GetDigits() const - wxSpinCtrlDouble only
+
+ // operations
+ virtual void SetValue(const wxString& text) { wxTextCtrl::SetValue(text); }
+ // void SetValue(T val)
+ // void SetRange(T minVal, T maxVal)
+ // void SetIncrement(T inc)
+ virtual void SetSnapToTicks(bool snap_to_ticks)
+ { m_snap_to_ticks = snap_to_ticks; }
+ // void SetDigits(unsigned digits) - wxSpinCtrlDouble only
+
+ // Select text in the textctrl
+ //void SetSelection(long from, long to);
+
+protected:
+ // generic double valued
+ double DoGetValue() const
+ {
+ double n;
+ if ( (wxSscanf(wxTextCtrl::GetValue(), wxT("%lf"), &n) != 1) )
+ n = INT_MIN;
+
+ return n;
+ }
+
+ bool DoSetValue(double val, SendEvent sendEvent)
+ {
+ wxString str(wxString::Format(m_format, val));
+ switch ( sendEvent )
+ {
+ case SendEvent_None:
+ wxTextCtrl::ChangeValue(str);
+ break;
+
+ case SendEvent_Text:
+ wxTextCtrl::SetValue(str);
+ break;
+ }
+
+ return true;
+ }
+ void DoSetRange(double min_val, double max_val)
+ {
+ m_min = min_val;
+ m_max = max_val;
+ }
+ void DoSetIncrement(double inc) { m_increment = inc; } // Note: unused
+
+ double m_value;
+ double m_min;
+ double m_max;
+ double m_increment;
+ bool m_snap_to_ticks;
+ wxString m_format;
+};
+
+#endif // wxUSE_SPINBTN/!wxUSE_SPINBTN
+
+#if !defined(wxHAS_NATIVE_SPINCTRL)
+
+//-----------------------------------------------------------------------------
+// wxSpinCtrl
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSpinCtrl : public wxSpinCtrlGenericBase
+{
+public:
+ wxSpinCtrl() { Init(); }
+ wxSpinCtrl(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
+ int min = 0, int max = 100, int initial = 0,
+ const wxString& name = wxT("wxSpinCtrl"))
+ {
+ Init();
+
+ Create(parent, id, value, pos, size, style, min, max, initial, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
+ int min = 0, int max = 100, int initial = 0,
+ const wxString& name = wxT("wxSpinCtrl"))
+ {
+ return wxSpinCtrlGenericBase::Create(parent, id, value, pos, size,
+ style, min, max, initial, 1, name);
+ }
+
+ // accessors
+ int GetValue(wxSPINCTRL_GETVALUE_FIX) const { return int(DoGetValue()); }
+ int GetMin() const { return int(m_min); }
+ int GetMax() const { return int(m_max); }
+ int GetIncrement() const { return int(m_increment); }
+
+ // operations
+ void SetValue(const wxString& value)
+ { wxSpinCtrlGenericBase::SetValue(value); }
+ void SetValue( int value ) { DoSetValue(value, SendEvent_None); }
+ void SetRange( int minVal, int maxVal ) { DoSetRange(minVal, maxVal); }
+ void SetIncrement(int inc) { DoSetIncrement(inc); }
+
+ virtual int GetBase() const { return m_base; }
+ virtual bool SetBase(int base);
+
+protected:
+ virtual void DoSendEvent();
+
+ virtual bool DoTextToValue(const wxString& text, double *val);
+ virtual wxString DoValueToText(double val);
+
+private:
+ // Common part of all ctors.
+ void Init()
+ {
+ m_base = 10;
+ }
+
+ int m_base;
+
+ DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
+};
+
+#endif // wxHAS_NATIVE_SPINCTRL
+
+//-----------------------------------------------------------------------------
+// wxSpinCtrlDouble
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSpinCtrlDouble : public wxSpinCtrlGenericBase
+{
+public:
+ wxSpinCtrlDouble() { Init(); }
+ wxSpinCtrlDouble(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
+ double min = 0, double max = 100, double initial = 0,
+ double inc = 1,
+ const wxString& name = wxT("wxSpinCtrlDouble"))
+ {
+ Init();
+
+ Create(parent, id, value, pos, size, style,
+ min, max, initial, inc, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
+ double min = 0, double max = 100, double initial = 0,
+ double inc = 1,
+ const wxString& name = wxT("wxSpinCtrlDouble"))
+ {
+ return wxSpinCtrlGenericBase::Create(parent, id, value, pos, size,
+ style, min, max, initial,
+ inc, name);
+ }
+
+ // accessors
+ double GetValue(wxSPINCTRL_GETVALUE_FIX) const { return DoGetValue(); }
+ double GetMin() const { return m_min; }
+ double GetMax() const { return m_max; }
+ double GetIncrement() const { return m_increment; }
+ unsigned GetDigits() const { return m_digits; }
+
+ // operations
+ void SetValue(const wxString& value)
+ { wxSpinCtrlGenericBase::SetValue(value); }
+ void SetValue(double value) { DoSetValue(value, SendEvent_None); }
+ void SetRange(double minVal, double maxVal) { DoSetRange(minVal, maxVal); }
+ void SetIncrement(double inc) { DoSetIncrement(inc); }
+ void SetDigits(unsigned digits);
+
+ // We don't implement bases support for floating point numbers, this is not
+ // very useful in practice.
+ virtual int GetBase() const { return 10; }
+ virtual bool SetBase(int WXUNUSED(base)) { return 0; }
+
+protected:
+ virtual void DoSendEvent();
+
+ virtual bool DoTextToValue(const wxString& text, double *val);
+ virtual wxString DoValueToText(double val);
+
+ unsigned m_digits;
+
+private:
+ // Common part of all ctors.
+ void Init()
+ {
+ m_digits = 0;
+ m_format = wxS("%g");
+ }
+
+ wxString m_format;
+
+ DECLARE_DYNAMIC_CLASS(wxSpinCtrlDouble)
+};
+
+#endif // _WX_GENERIC_SPINCTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/splash.h
+// Purpose: Splash screen class
+// Author: Julian Smart
+// Modified by:
+// Created: 28/6/2000
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SPLASH_H_
+#define _WX_SPLASH_H_
+
+#include "wx/bitmap.h"
+#include "wx/eventfilter.h"
+#include "wx/frame.h"
+#include "wx/timer.h"
+
+
+/*
+ * A window for displaying a splash screen
+ */
+
+#define wxSPLASH_CENTRE_ON_PARENT 0x01
+#define wxSPLASH_CENTRE_ON_SCREEN 0x02
+#define wxSPLASH_NO_CENTRE 0x00
+#define wxSPLASH_TIMEOUT 0x04
+#define wxSPLASH_NO_TIMEOUT 0x00
+
+class WXDLLIMPEXP_FWD_ADV wxSplashScreenWindow;
+
+/*
+ * wxSplashScreen
+ */
+
+class WXDLLIMPEXP_ADV wxSplashScreen: public wxFrame,
+ public wxEventFilter
+{
+public:
+ // for RTTI macros only
+ wxSplashScreen() { Init(); }
+ wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds,
+ wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP);
+ virtual ~wxSplashScreen();
+
+ void OnCloseWindow(wxCloseEvent& event);
+ void OnNotify(wxTimerEvent& event);
+
+ long GetSplashStyle() const { return m_splashStyle; }
+ wxSplashScreenWindow* GetSplashWindow() const { return m_window; }
+ int GetTimeout() const { return m_milliseconds; }
+
+ // Override wxEventFilter method to hide splash screen on any user input.
+ virtual int FilterEvent(wxEvent& event);
+
+protected:
+ // Common part of all ctors.
+ void Init();
+
+ wxSplashScreenWindow* m_window;
+ long m_splashStyle;
+ int m_milliseconds;
+ wxTimer m_timer;
+
+ DECLARE_DYNAMIC_CLASS(wxSplashScreen)
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxSplashScreen);
+};
+
+/*
+ * wxSplashScreenWindow
+ */
+
+class WXDLLIMPEXP_ADV wxSplashScreenWindow: public wxWindow
+{
+public:
+ wxSplashScreenWindow(const wxBitmap& bitmap, wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxNO_BORDER);
+
+ void OnPaint(wxPaintEvent& event);
+ void OnEraseBackground(wxEraseEvent& event);
+
+ void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
+ wxBitmap& GetBitmap() { return m_bitmap; }
+
+protected:
+ wxBitmap m_bitmap;
+
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxSplashScreenWindow);
+};
+
+
+#endif
+ // _WX_SPLASH_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/splitter.h
+// Purpose: wxSplitterWindow class
+// Author: Julian Smart
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_SPLITTER_H_
+#define _WX_GENERIC_SPLITTER_H_
+
+#include "wx/window.h" // base class declaration
+#include "wx/containr.h" // wxControlContainer
+
+class WXDLLIMPEXP_FWD_CORE wxSplitterEvent;
+
+// ---------------------------------------------------------------------------
+// splitter constants
+// ---------------------------------------------------------------------------
+
+enum wxSplitMode
+{
+ wxSPLIT_HORIZONTAL = 1,
+ wxSPLIT_VERTICAL
+};
+
+enum
+{
+ wxSPLIT_DRAG_NONE,
+ wxSPLIT_DRAG_DRAGGING,
+ wxSPLIT_DRAG_LEFT_DOWN
+};
+
+// ---------------------------------------------------------------------------
+// wxSplitterWindow maintains one or two panes, with
+// an optional vertical or horizontal split which
+// can be used with the mouse or programmatically.
+// ---------------------------------------------------------------------------
+
+// TODO:
+// 1) Perhaps make the borders sensitive to dragging in order to create a split.
+// The MFC splitter window manages scrollbars as well so is able to
+// put sash buttons on the scrollbars, but we probably don't want to go down
+// this path.
+// 2) for wxWidgets 2.0, we must find a way to set the WS_CLIPCHILDREN style
+// to prevent flickering. (WS_CLIPCHILDREN doesn't work in all cases so can't be
+// standard).
+
+class WXDLLIMPEXP_CORE wxSplitterWindow: public wxNavigationEnabled<wxWindow>
+{
+public:
+
+////////////////////////////////////////////////////////////////////////////
+// Public API
+
+ // Default constructor
+ wxSplitterWindow()
+ {
+ Init();
+ }
+
+ // Normal constructor
+ wxSplitterWindow(wxWindow *parent, wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_3D,
+ const wxString& name = wxT("splitter"))
+ {
+ Init();
+ Create(parent, id, pos, size, style, name);
+ }
+
+ virtual ~wxSplitterWindow();
+
+ bool Create(wxWindow *parent, wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_3D,
+ const wxString& name = wxT("splitter"));
+
+ // Gets the only or left/top pane
+ wxWindow *GetWindow1() const { return m_windowOne; }
+
+ // Gets the right/bottom pane
+ wxWindow *GetWindow2() const { return m_windowTwo; }
+
+ // Sets the split mode
+ void SetSplitMode(int mode)
+ {
+ wxASSERT_MSG( mode == wxSPLIT_VERTICAL || mode == wxSPLIT_HORIZONTAL,
+ wxT("invalid split mode") );
+
+ m_splitMode = (wxSplitMode)mode;
+ }
+
+ // Gets the split mode
+ wxSplitMode GetSplitMode() const { return m_splitMode; }
+
+ // Initialize with one window
+ void Initialize(wxWindow *window);
+
+ // Associates the given window with window 2, drawing the appropriate sash
+ // and changing the split mode.
+ // Does nothing and returns false if the window is already split.
+ // A sashPosition of 0 means choose a default sash position,
+ // negative sashPosition specifies the size of right/lower pane as it's
+ // absolute value rather than the size of left/upper pane.
+ virtual bool SplitVertically(wxWindow *window1,
+ wxWindow *window2,
+ int sashPosition = 0)
+ { return DoSplit(wxSPLIT_VERTICAL, window1, window2, sashPosition); }
+ virtual bool SplitHorizontally(wxWindow *window1,
+ wxWindow *window2,
+ int sashPosition = 0)
+ { return DoSplit(wxSPLIT_HORIZONTAL, window1, window2, sashPosition); }
+
+ // Removes the specified (or second) window from the view
+ // Doesn't actually delete the window.
+ bool Unsplit(wxWindow *toRemove = NULL);
+
+ // Replaces one of the windows with another one (neither old nor new
+ // parameter should be NULL)
+ bool ReplaceWindow(wxWindow *winOld, wxWindow *winNew);
+
+ // Make sure the child window sizes are updated. This is useful
+ // for reducing flicker by updating the sizes before a
+ // window is shown, if you know the overall size is correct.
+ void UpdateSize();
+
+ // Is the window split?
+ bool IsSplit() const { return (m_windowTwo != NULL); }
+
+ // Sets the border size
+ void SetBorderSize(int WXUNUSED(width)) { }
+
+ // Hide or show the sash and test whether it's currently hidden.
+ void SetSashInvisible(bool invisible = true);
+ bool IsSashInvisible() const { return HasFlag(wxSP_NOSASH); }
+
+ // Gets the current sash size which may be 0 if it's hidden and the default
+ // sash size.
+ int GetSashSize() const;
+ int GetDefaultSashSize() const;
+
+ // Gets the border size
+ int GetBorderSize() const;
+
+ // Set the sash position
+ void SetSashPosition(int position, bool redraw = true);
+
+ // Gets the sash position
+ int GetSashPosition() const { return m_sashPosition; }
+
+ // Set the sash gravity
+ void SetSashGravity(double gravity);
+
+ // Gets the sash gravity
+ double GetSashGravity() const { return m_sashGravity; }
+
+ // If this is zero, we can remove panes by dragging the sash.
+ void SetMinimumPaneSize(int min);
+ int GetMinimumPaneSize() const { return m_minimumPaneSize; }
+
+ // NB: the OnXXX() functions below are for backwards compatibility only,
+ // don't use them in new code but handle the events instead!
+
+ // called when the sash position is about to change, may return a new value
+ // for the sash or -1 to prevent the change from happening at all
+ virtual int OnSashPositionChanging(int newSashPosition);
+
+ // Called when the sash position is about to be changed, return
+ // false from here to prevent the change from taking place.
+ // Repositions sash to minimum position if pane would be too small.
+ // newSashPosition here is always positive or zero.
+ virtual bool OnSashPositionChange(int newSashPosition);
+
+ // If the sash is moved to an extreme position, a subwindow
+ // is removed from the splitter window, and the app is
+ // notified. The app should delete or hide the window.
+ virtual void OnUnsplit(wxWindow *removed);
+
+ // Called when the sash is double-clicked.
+ // The default behaviour is to remove the sash if the
+ // minimum pane size is zero.
+ virtual void OnDoubleClickSash(int x, int y);
+
+////////////////////////////////////////////////////////////////////////////
+// Implementation
+
+ // Paints the border and sash
+ void OnPaint(wxPaintEvent& event);
+
+ // Handles mouse events
+ void OnMouseEvent(wxMouseEvent& ev);
+
+ // Aborts dragging mode
+ void OnMouseCaptureLost(wxMouseCaptureLostEvent& event);
+
+ // Adjusts the panes
+ void OnSize(wxSizeEvent& event);
+
+ // In live mode, resize child windows in idle time
+ void OnInternalIdle();
+
+ // Draws the sash
+ virtual void DrawSash(wxDC& dc);
+
+ // Draws the sash tracker (for whilst moving the sash)
+ virtual void DrawSashTracker(int x, int y);
+
+ // Tests for x, y over sash
+ virtual bool SashHitTest(int x, int y);
+
+ // Resizes subwindows
+ virtual void SizeWindows();
+
+#ifdef __WXMAC__
+ virtual bool MacClipGrandChildren() const { return true ; }
+#endif
+
+ // Sets the sash size: this doesn't do anything and shouldn't be used at
+ // all any more.
+ wxDEPRECATED_INLINE( void SetSashSize(int WXUNUSED(width)), return; )
+
+protected:
+ // event handlers
+#if defined(__WXMSW__) || defined(__WXMAC__)
+ void OnSetCursor(wxSetCursorEvent& event);
+#endif // wxMSW
+
+ // send the given event, return false if the event was processed and vetoed
+ // by the user code
+ bool DoSendEvent(wxSplitterEvent& event);
+
+ // common part of all ctors
+ void Init();
+
+ // common part of SplitVertically() and SplitHorizontally()
+ bool DoSplit(wxSplitMode mode,
+ wxWindow *window1, wxWindow *window2,
+ int sashPosition);
+
+ // adjusts sash position with respect to min. pane and window sizes
+ int AdjustSashPosition(int sashPos) const;
+
+ // get either width or height depending on the split mode
+ int GetWindowSize() const;
+
+ // convert the user specified sash position which may be > 0 (as is), < 0
+ // (specifying the size of the right pane) or 0 (use default) to the real
+ // position to be passed to DoSetSashPosition()
+ int ConvertSashPosition(int sashPos) const;
+
+ // set the real sash position, sashPos here must be positive
+ //
+ // returns true if the sash position has been changed, false otherwise
+ bool DoSetSashPosition(int sashPos);
+
+ // set the sash position and send an event about it having been changed
+ void SetSashPositionAndNotify(int sashPos);
+
+ // callbacks executed when we detect that the mouse has entered or left
+ // the sash
+ virtual void OnEnterSash();
+ virtual void OnLeaveSash();
+
+ // set the cursor appropriate for the current split mode
+ void SetResizeCursor();
+
+ // redraw the splitter if its "hotness" changed if necessary
+ void RedrawIfHotSensitive(bool isHot);
+
+ // return the best size of the splitter equal to best sizes of its
+ // subwindows
+ virtual wxSize DoGetBestSize() const;
+
+
+ wxSplitMode m_splitMode;
+ wxWindow* m_windowOne;
+ wxWindow* m_windowTwo;
+ int m_dragMode;
+ int m_oldX; // current tracker position if not live mode
+ int m_oldY; // current tracker position if not live mode
+ int m_sashPosition; // Number of pixels from left or top
+ double m_sashGravity;
+ wxSize m_lastSize;
+ int m_requestedSashPosition;
+ int m_sashPositionCurrent; // while dragging
+ wxPoint m_ptStart; // mouse position when dragging started
+ int m_sashStart; // sash position when dragging started
+ int m_minimumPaneSize;
+ wxCursor m_sashCursorWE;
+ wxCursor m_sashCursorNS;
+ wxPen *m_sashTrackerPen;
+
+ // when in live mode, set this to true to resize children in idle
+ bool m_needUpdating:1;
+ bool m_permitUnsplitAlways:1;
+ bool m_isHot:1;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxSplitterWindow)
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxSplitterWindow);
+};
+
+// ----------------------------------------------------------------------------
+// event class and macros
+// ----------------------------------------------------------------------------
+
+// we reuse the same class for all splitter event types because this is the
+// usual wxWin convention, but the three event types have different kind of
+// data associated with them, so the accessors can be only used if the real
+// event type matches with the one for which the accessors make sense
+class WXDLLIMPEXP_CORE wxSplitterEvent : public wxNotifyEvent
+{
+public:
+ wxSplitterEvent(wxEventType type = wxEVT_NULL,
+ wxSplitterWindow *splitter = NULL)
+ : wxNotifyEvent(type)
+ {
+ SetEventObject(splitter);
+ if (splitter) m_id = splitter->GetId();
+ }
+ wxSplitterEvent(const wxSplitterEvent& event)
+ : wxNotifyEvent(event), m_data(event.m_data) { }
+
+ // SASH_POS_CHANGED methods
+
+ // setting the sash position to -1 prevents the change from taking place at
+ // all
+ void SetSashPosition(int pos)
+ {
+ wxASSERT( GetEventType() == wxEVT_SPLITTER_SASH_POS_CHANGED
+ || GetEventType() == wxEVT_SPLITTER_SASH_POS_CHANGING);
+
+ m_data.pos = pos;
+ }
+
+ int GetSashPosition() const
+ {
+ wxASSERT( GetEventType() == wxEVT_SPLITTER_SASH_POS_CHANGED
+ || GetEventType() == wxEVT_SPLITTER_SASH_POS_CHANGING);
+
+ return m_data.pos;
+ }
+
+ // UNSPLIT event methods
+ wxWindow *GetWindowBeingRemoved() const
+ {
+ wxASSERT( GetEventType() == wxEVT_SPLITTER_UNSPLIT );
+
+ return m_data.win;
+ }
+
+ // DCLICK event methods
+ int GetX() const
+ {
+ wxASSERT( GetEventType() == wxEVT_SPLITTER_DOUBLECLICKED );
+
+ return m_data.pt.x;
+ }
+
+ int GetY() const
+ {
+ wxASSERT( GetEventType() == wxEVT_SPLITTER_DOUBLECLICKED );
+
+ return m_data.pt.y;
+ }
+
+ virtual wxEvent *Clone() const { return new wxSplitterEvent(*this); }
+
+private:
+ friend class WXDLLIMPEXP_FWD_CORE wxSplitterWindow;
+
+ // data for the different types of event
+ union
+ {
+ int pos; // position for SASH_POS_CHANGED event
+ wxWindow *win; // window being removed for UNSPLIT event
+ struct
+ {
+ int x, y;
+ } pt; // position of double click for DCLICK event
+ } m_data;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSplitterEvent)
+};
+
+typedef void (wxEvtHandler::*wxSplitterEventFunction)(wxSplitterEvent&);
+
+#define wxSplitterEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxSplitterEventFunction, func)
+
+#define wx__DECLARE_SPLITTEREVT(evt, id, fn) \
+ wx__DECLARE_EVT1(wxEVT_SPLITTER_ ## evt, id, wxSplitterEventHandler(fn))
+
+#define EVT_SPLITTER_SASH_POS_CHANGED(id, fn) \
+ wx__DECLARE_SPLITTEREVT(SASH_POS_CHANGED, id, fn)
+
+#define EVT_SPLITTER_SASH_POS_CHANGING(id, fn) \
+ wx__DECLARE_SPLITTEREVT(SASH_POS_CHANGING, id, fn)
+
+#define EVT_SPLITTER_DCLICK(id, fn) \
+ wx__DECLARE_SPLITTEREVT(DOUBLECLICKED, id, fn)
+
+#define EVT_SPLITTER_UNSPLIT(id, fn) \
+ wx__DECLARE_SPLITTEREVT(UNSPLIT, id, fn)
+
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED wxEVT_SPLITTER_SASH_POS_CHANGED
+#define wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING wxEVT_SPLITTER_SASH_POS_CHANGING
+#define wxEVT_COMMAND_SPLITTER_DOUBLECLICKED wxEVT_SPLITTER_DOUBLECLICKED
+#define wxEVT_COMMAND_SPLITTER_UNSPLIT wxEVT_SPLITTER_UNSPLIT
+
+#endif // _WX_GENERIC_SPLITTER_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/srchctlg.h
+// Purpose: generic wxSearchCtrl class
+// Author: Vince Harron
+// Created: 2006-02-19
+// Copyright: Vince Harron
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_SEARCHCTRL_H_
+#define _WX_GENERIC_SEARCHCTRL_H_
+
+#if wxUSE_SEARCHCTRL
+
+#include "wx/bitmap.h"
+
+class WXDLLIMPEXP_FWD_CORE wxSearchButton;
+class WXDLLIMPEXP_FWD_CORE wxSearchTextCtrl;
+
+// ----------------------------------------------------------------------------
+// wxSearchCtrl is a combination of wxTextCtrl and wxSearchButton
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSearchCtrl : public wxSearchCtrlBase
+{
+public:
+ // creation
+ // --------
+
+ wxSearchCtrl();
+ wxSearchCtrl(wxWindow *parent, wxWindowID id,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxSearchCtrlNameStr);
+
+ virtual ~wxSearchCtrl();
+
+ bool Create(wxWindow *parent, wxWindowID id,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxSearchCtrlNameStr);
+
+#if wxUSE_MENUS
+ // get/set search button menu
+ // --------------------------
+ virtual void SetMenu( wxMenu* menu );
+ virtual wxMenu* GetMenu();
+#endif // wxUSE_MENUS
+
+ // get/set search options
+ // ----------------------
+ virtual void ShowSearchButton( bool show );
+ virtual bool IsSearchButtonVisible() const;
+
+ virtual void ShowCancelButton( bool show );
+ virtual bool IsCancelButtonVisible() const;
+
+ // TODO: In 2.9 these should probably be virtual, and declared in the base class...
+ void SetDescriptiveText(const wxString& text);
+ wxString GetDescriptiveText() const;
+
+ // accessors
+ // ---------
+
+ virtual wxString GetRange(long from, long to) const;
+
+ virtual int GetLineLength(long lineNo) const;
+ virtual wxString GetLineText(long lineNo) const;
+ virtual int GetNumberOfLines() const;
+
+ virtual bool IsModified() const;
+ virtual bool IsEditable() const;
+
+ // more readable flag testing methods
+ virtual bool IsSingleLine() const;
+ virtual bool IsMultiLine() const;
+
+ // If the return values from and to are the same, there is no selection.
+ virtual void GetSelection(long* from, long* to) const;
+
+ virtual wxString GetStringSelection() const;
+
+ // operations
+ // ----------
+
+ // editing
+ virtual void Clear();
+ virtual void Replace(long from, long to, const wxString& value);
+ virtual void Remove(long from, long to);
+
+ // load/save the controls contents from/to the file
+ virtual bool LoadFile(const wxString& file);
+ virtual bool SaveFile(const wxString& file = wxEmptyString);
+
+ // sets/clears the dirty flag
+ virtual void MarkDirty();
+ virtual void DiscardEdits();
+
+ // set the max number of characters which may be entered in a single line
+ // text control
+ virtual void SetMaxLength(unsigned long WXUNUSED(len));
+
+ // writing text inserts it at the current position, appending always
+ // inserts it at the end
+ virtual void WriteText(const wxString& text);
+ virtual void AppendText(const wxString& text);
+
+ // insert the character which would have resulted from this key event,
+ // return true if anything has been inserted
+ virtual bool EmulateKeyPress(const wxKeyEvent& event);
+
+ // text control under some platforms supports the text styles: these
+ // methods allow to apply the given text style to the given selection or to
+ // set/get the style which will be used for all appended text
+ virtual bool SetStyle(long start, long end, const wxTextAttr& style);
+ virtual bool GetStyle(long position, wxTextAttr& style);
+ virtual bool SetDefaultStyle(const wxTextAttr& style);
+ virtual const wxTextAttr& GetDefaultStyle() const;
+
+ // translate between the position (which is just an index in the text ctrl
+ // considering all its contents as a single strings) and (x, y) coordinates
+ // which represent column and line.
+ virtual long XYToPosition(long x, long y) const;
+ virtual bool PositionToXY(long pos, long *x, long *y) const;
+
+ virtual void ShowPosition(long pos);
+
+ // find the character at position given in pixels
+ //
+ // NB: pt is in device coords (not adjusted for the client area origin nor
+ // scrolling)
+ virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const;
+ virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
+ wxTextCoord *col,
+ wxTextCoord *row) const;
+
+ // Clipboard operations
+ virtual void Copy();
+ virtual void Cut();
+ virtual void Paste();
+
+ virtual bool CanCopy() const;
+ virtual bool CanCut() const;
+ virtual bool CanPaste() const;
+
+ // Undo/redo
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual bool CanUndo() const;
+ virtual bool CanRedo() const;
+
+ // Insertion point
+ virtual void SetInsertionPoint(long pos);
+ virtual void SetInsertionPointEnd();
+ virtual long GetInsertionPoint() const;
+ virtual wxTextPos GetLastPosition() const;
+
+ virtual void SetSelection(long from, long to);
+ virtual void SelectAll();
+ virtual void SetEditable(bool editable);
+
+#if 0
+
+ // override streambuf method
+#if wxHAS_TEXT_WINDOW_STREAM
+ int overflow(int i);
+#endif // wxHAS_TEXT_WINDOW_STREAM
+
+ // stream-like insertion operators: these are always available, whether we
+ // were, or not, compiled with streambuf support
+ wxTextCtrl& operator<<(const wxString& s);
+ wxTextCtrl& operator<<(int i);
+ wxTextCtrl& operator<<(long i);
+ wxTextCtrl& operator<<(float f);
+ wxTextCtrl& operator<<(double d);
+ wxTextCtrl& operator<<(const wxChar c);
+#endif
+
+ // do the window-specific processing after processing the update event
+ virtual void DoUpdateWindowUI(wxUpdateUIEvent& event);
+
+ virtual bool ShouldInheritColours() const;
+
+ // wxWindow overrides
+ virtual bool SetFont(const wxFont& font);
+ virtual bool SetBackgroundColour(const wxColour& colour);
+
+ // search control generic only
+ void SetSearchBitmap( const wxBitmap& bitmap );
+ void SetCancelBitmap( const wxBitmap& bitmap );
+#if wxUSE_MENUS
+ void SetSearchMenuBitmap( const wxBitmap& bitmap );
+#endif // wxUSE_MENUS
+
+protected:
+ virtual void DoSetValue(const wxString& value, int flags);
+ virtual wxString DoGetValue() const;
+
+ virtual bool DoLoadFile(const wxString& file, int fileType);
+ virtual bool DoSaveFile(const wxString& file, int fileType);
+
+ // override the base class virtuals involved into geometry calculations
+ virtual wxSize DoGetBestSize() const;
+ virtual void DoMoveWindow(int x, int y, int width, int height);
+ virtual void LayoutControls(int x, int y, int width, int height);
+
+ virtual void RecalcBitmaps();
+
+ void Init();
+
+ virtual wxBitmap RenderSearchBitmap( int x, int y, bool renderDrop );
+ virtual wxBitmap RenderCancelBitmap( int x, int y );
+
+ void OnCancelButton( wxCommandEvent& event );
+
+ void OnSetFocus( wxFocusEvent& event );
+ void OnSize( wxSizeEvent& event );
+
+ bool HasMenu() const
+ {
+#if wxUSE_MENUS
+ return m_menu != NULL;
+#else // !wxUSE_MENUS
+ return false;
+#endif // wxUSE_MENUS/!wxUSE_MENUS
+ }
+
+private:
+ friend class wxSearchButton;
+
+ // Implement pure virtual function inherited from wxCompositeWindow.
+ virtual wxWindowList GetCompositeWindowParts() const;
+
+#if wxUSE_MENUS
+ void PopupSearchMenu();
+#endif // wxUSE_MENUS
+
+ // the subcontrols
+ wxSearchTextCtrl *m_text;
+ wxSearchButton *m_searchButton;
+ wxSearchButton *m_cancelButton;
+#if wxUSE_MENUS
+ wxMenu *m_menu;
+#endif // wxUSE_MENUS
+
+ bool m_searchButtonVisible;
+ bool m_cancelButtonVisible;
+
+ bool m_searchBitmapUser;
+ bool m_cancelBitmapUser;
+#if wxUSE_MENUS
+ bool m_searchMenuBitmapUser;
+#endif // wxUSE_MENUS
+
+ wxBitmap m_searchBitmap;
+ wxBitmap m_cancelBitmap;
+#if wxUSE_MENUS
+ wxBitmap m_searchMenuBitmap;
+#endif // wxUSE_MENUS
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxSearchCtrl)
+
+ DECLARE_EVENT_TABLE()
+};
+
+#endif // wxUSE_SEARCHCTRL
+
+#endif // _WX_GENERIC_SEARCHCTRL_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/statbmpg.h
+// Purpose: wxGenericStaticBitmap header
+// Author: Marcin Wojdyr, Stefan Csomor
+// Created: 2008-06-16
+// Copyright: wxWidgets developers
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_STATBMP_H_
+#define _WX_GENERIC_STATBMP_H_
+
+#include "wx/statbmp.h"
+
+class WXDLLIMPEXP_CORE wxGenericStaticBitmap : public wxStaticBitmapBase
+{
+public:
+ wxGenericStaticBitmap() {}
+ wxGenericStaticBitmap(wxWindow *parent,
+ wxWindowID id,
+ const wxBitmap& bitmap,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxStaticBitmapNameStr)
+ {
+ Create(parent, id, bitmap, pos, size, style, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxBitmap& bitmap,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxStaticBitmapNameStr);
+
+ virtual void SetBitmap(const wxBitmap& bitmap)
+ {
+ m_bitmap = bitmap;
+ SetInitialSize(GetBitmapSize());
+ Refresh();
+ }
+
+ virtual wxBitmap GetBitmap() const { return m_bitmap; }
+
+ virtual void SetIcon(const wxIcon& icon)
+ {
+ m_bitmap.CopyFromIcon(icon);
+ SetInitialSize(GetBitmapSize());
+ Refresh();
+ }
+
+#if defined(__WXGTK20__) || defined(__WXMAC__)
+ // icons and bitmaps are really the same thing in wxGTK and wxMac
+ wxIcon GetIcon() const { return (const wxIcon &)m_bitmap; }
+#endif
+
+
+private:
+ wxSize GetBitmapSize()
+ {
+ return m_bitmap.IsOk() ? wxSize(m_bitmap.GetWidth(), m_bitmap.GetHeight())
+ : wxSize(16, 16); // this is completely arbitrary
+ }
+
+ void OnPaint(wxPaintEvent& event);
+
+ wxBitmap m_bitmap;
+
+ DECLARE_DYNAMIC_CLASS(wxGenericStaticBitmap)
+};
+
+
+#endif //_WX_GENERIC_STATBMP_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/stattextg.h
+// Purpose: wxGenericStaticText header
+// Author: Marcin Wojdyr
+// Created: 2008-06-26
+// Copyright: Marcin Wojdyr
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_STATTEXTG_H_
+#define _WX_GENERIC_STATTEXTG_H_
+
+// prevent it from including the platform-specific wxStaticText declaration as
+// this is not going to compile if it derives from wxGenericStaticText defined
+// below (currently this is only the case in wxUniv but it could also happen
+// with other ports)
+#define wxNO_PORT_STATTEXT_INCLUDE
+#include "wx/stattext.h"
+#undef wxNO_PORT_STATTEXT_INCLUDE
+
+class WXDLLIMPEXP_CORE wxGenericStaticText : public wxStaticTextBase
+{
+public:
+ wxGenericStaticText() { Init(); }
+
+ wxGenericStaticText(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxStaticTextNameStr)
+ {
+ Init();
+
+ Create(parent, id, label, pos, size, style, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxStaticTextNameStr);
+
+ virtual ~wxGenericStaticText();
+
+
+ // overridden base class virtual methods
+ virtual void SetLabel(const wxString& label);
+ virtual bool SetFont(const wxFont &font);
+
+protected:
+ virtual wxSize DoGetBestClientSize() const;
+
+ virtual wxString DoGetLabel() const { return m_label; }
+ virtual void DoSetLabel(const wxString& label);
+
+ void DoSetSize(int x, int y, int width, int height, int sizeFlags);
+
+#if wxUSE_MARKUP
+ virtual bool DoSetLabelMarkup(const wxString& markup);
+#endif // wxUSE_MARKUP
+
+private:
+ void Init()
+ {
+#if wxUSE_MARKUP
+ m_markupText = NULL;
+#endif // wxUSE_MARKUP
+ }
+
+ void OnPaint(wxPaintEvent& event);
+
+ void DoDrawLabel(wxDC& dc, const wxRect& rect);
+
+ // These fields are only used if m_markupText == NULL.
+ wxString m_label;
+ int m_mnemonic;
+
+#if wxUSE_MARKUP
+ class wxMarkupText *m_markupText;
+#endif // wxUSE_MARKUP
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericStaticText)
+};
+
+#endif // _WX_GENERIC_STATTEXTG_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/statusbr.h
+// Purpose: wxStatusBarGeneric class
+// Author: Julian Smart
+// Modified by: VZ at 05.02.00 to derive from wxStatusBarBase
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_STATUSBR_H_
+#define _WX_GENERIC_STATUSBR_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_STATUSBAR
+
+#include "wx/pen.h"
+#include "wx/arrstr.h"
+
+
+// ----------------------------------------------------------------------------
+// wxStatusBarGeneric
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxStatusBarGeneric : public wxStatusBarBase
+{
+public:
+ wxStatusBarGeneric() { Init(); }
+ wxStatusBarGeneric(wxWindow *parent,
+ wxWindowID winid = wxID_ANY,
+ long style = wxSTB_DEFAULT_STYLE,
+ const wxString& name = wxStatusBarNameStr)
+ {
+ Init();
+
+ Create(parent, winid, style, name);
+ }
+
+ virtual ~wxStatusBarGeneric();
+
+ bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY,
+ long style = wxSTB_DEFAULT_STYLE,
+ const wxString& name = wxStatusBarNameStr);
+
+ // implement base class methods
+ virtual void SetStatusWidths(int n, const int widths_field[]);
+ virtual bool GetFieldRect(int i, wxRect& rect) const;
+ virtual void SetMinHeight(int height);
+
+ virtual int GetBorderX() const { return m_borderX; }
+ virtual int GetBorderY() const { return m_borderY; }
+
+
+ // implementation only (not part of wxStatusBar public API):
+
+ int GetFieldFromPoint(const wxPoint& point) const;
+
+protected:
+ virtual void DoUpdateStatusText(int number);
+
+ // event handlers
+ void OnPaint(wxPaintEvent& event);
+ void OnSize(wxSizeEvent& event);
+
+ void OnLeftDown(wxMouseEvent& event);
+ void OnRightDown(wxMouseEvent& event);
+
+ // Responds to colour changes
+ void OnSysColourChanged(wxSysColourChangedEvent& event);
+
+protected:
+
+ virtual void DrawFieldText(wxDC& dc, const wxRect& rc, int i, int textHeight);
+ virtual void DrawField(wxDC& dc, int i, int textHeight);
+
+ void SetBorderX(int x);
+ void SetBorderY(int y);
+
+ virtual void InitColours();
+
+ // true if the status bar shows the size grip: for this it must have
+ // wxSTB_SIZEGRIP style and the window it is attached to must be resizable
+ // and not maximized
+ bool ShowsSizeGrip() const;
+
+ // returns the position and the size of the size grip
+ wxRect GetSizeGripRect() const;
+
+ // common part of all ctors
+ void Init();
+
+ // the last known size, fields widths must be updated whenever it's out of
+ // date
+ wxSize m_lastClientSize;
+
+ // the absolute widths of the status bar panes in pixels
+ wxArrayInt m_widthsAbs;
+
+ int m_borderX;
+ int m_borderY;
+
+ wxPen m_mediumShadowPen;
+ wxPen m_hilightPen;
+
+ virtual wxSize DoGetBestSize() const;
+
+private:
+ // Update m_lastClientSize and m_widthsAbs from the current size.
+ void DoUpdateFieldWidths();
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBarGeneric)
+};
+
+#endif // wxUSE_STATUSBAR
+
+#endif
+ // _WX_GENERIC_STATUSBR_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/textdlgg.h
+// Purpose: wxTextEntryDialog class
+// Author: Julian Smart
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TEXTDLGG_H_
+#define _WX_TEXTDLGG_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_TEXTDLG
+
+#include "wx/dialog.h"
+
+#if wxUSE_VALIDATORS
+#include "wx/valtext.h"
+#include "wx/textctrl.h"
+#endif
+
+class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxGetTextFromUserPromptStr[];
+extern WXDLLIMPEXP_DATA_CORE(const char) wxGetPasswordFromUserPromptStr[];
+
+#define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY)
+
+// ----------------------------------------------------------------------------
+// wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxTextEntryDialog : public wxDialog
+{
+public:
+ wxTextEntryDialog()
+ {
+ m_textctrl = NULL;
+ }
+
+ wxTextEntryDialog(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption = wxGetTextFromUserPromptStr,
+ const wxString& value = wxEmptyString,
+ long style = wxTextEntryDialogStyle,
+ const wxPoint& pos = wxDefaultPosition)
+ {
+ Create(parent, message, caption, value, style, pos);
+ }
+
+ bool Create(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption = wxGetTextFromUserPromptStr,
+ const wxString& value = wxEmptyString,
+ long style = wxTextEntryDialogStyle,
+ const wxPoint& pos = wxDefaultPosition);
+
+ void SetValue(const wxString& val);
+ wxString GetValue() const { return m_value; }
+
+ void SetMaxLength(unsigned long len);
+
+#if wxUSE_VALIDATORS
+ void SetTextValidator( const wxTextValidator& validator );
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED( void SetTextValidator( long style ) );
+#endif
+ void SetTextValidator( wxTextValidatorStyle style = wxFILTER_NONE );
+ wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); }
+#endif // wxUSE_VALIDATORS
+
+ virtual bool TransferDataToWindow();
+ virtual bool TransferDataFromWindow();
+
+ // implementation only
+ void OnOK(wxCommandEvent& event);
+
+protected:
+ wxTextCtrl *m_textctrl;
+ wxString m_value;
+ long m_dialogStyle;
+
+private:
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxTextEntryDialog)
+ wxDECLARE_NO_COPY_CLASS(wxTextEntryDialog);
+};
+
+// ----------------------------------------------------------------------------
+// wxPasswordEntryDialog: dialog with password control, [ok] and [cancel]
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPasswordEntryDialog : public wxTextEntryDialog
+{
+public:
+ wxPasswordEntryDialog(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption = wxGetPasswordFromUserPromptStr,
+ const wxString& value = wxEmptyString,
+ long style = wxTextEntryDialogStyle,
+ const wxPoint& pos = wxDefaultPosition);
+private:
+ DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog)
+ wxDECLARE_NO_COPY_CLASS(wxPasswordEntryDialog);
+};
+
+// ----------------------------------------------------------------------------
+// function to get a string from user
+// ----------------------------------------------------------------------------
+
+WXDLLIMPEXP_CORE wxString
+ wxGetTextFromUser(const wxString& message,
+ const wxString& caption = wxGetTextFromUserPromptStr,
+ const wxString& default_value = wxEmptyString,
+ wxWindow *parent = NULL,
+ wxCoord x = wxDefaultCoord,
+ wxCoord y = wxDefaultCoord,
+ bool centre = true);
+
+WXDLLIMPEXP_CORE wxString
+ wxGetPasswordFromUser(const wxString& message,
+ const wxString& caption = wxGetPasswordFromUserPromptStr,
+ const wxString& default_value = wxEmptyString,
+ wxWindow *parent = NULL,
+ wxCoord x = wxDefaultCoord,
+ wxCoord y = wxDefaultCoord,
+ bool centre = true);
+
+#endif
+ // wxUSE_TEXTDLG
+#endif // _WX_TEXTDLGG_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/timectrl.h
+// Purpose: Generic implementation of wxTimePickerCtrl.
+// Author: Paul Breen, Vadim Zeitlin
+// Created: 2011-09-22
+// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_TIMECTRL_H_
+#define _WX_GENERIC_TIMECTRL_H_
+
+#include "wx/containr.h"
+#include "wx/compositewin.h"
+
+class WXDLLIMPEXP_ADV wxTimePickerCtrlGeneric
+ : public wxCompositeWindow< wxNavigationEnabled<wxTimePickerCtrlBase> >
+{
+public:
+ typedef wxCompositeWindow< wxNavigationEnabled<wxTimePickerCtrlBase> > Base;
+
+ // Creating the control.
+ wxTimePickerCtrlGeneric() { Init(); }
+ virtual ~wxTimePickerCtrlGeneric();
+ wxTimePickerCtrlGeneric(wxWindow *parent,
+ wxWindowID id,
+ const wxDateTime& date = wxDefaultDateTime,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxTP_DEFAULT,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxTimePickerCtrlNameStr)
+ {
+ Init();
+
+ (void)Create(parent, id, date, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxDateTime& date = wxDefaultDateTime,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxTP_DEFAULT,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxTimePickerCtrlNameStr);
+
+ // Implement pure virtual wxTimePickerCtrlBase methods.
+ virtual void SetValue(const wxDateTime& date);
+ virtual wxDateTime GetValue() const;
+
+protected:
+ virtual wxSize DoGetBestSize() const;
+
+ virtual void DoMoveWindow(int x, int y, int width, int height);
+
+private:
+ void Init();
+
+ // Return the list of the windows composing this one.
+ virtual wxWindowList GetCompositeWindowParts() const;
+
+ // Implementation data.
+ class wxTimePickerGenericImpl* m_impl;
+
+ wxDECLARE_NO_COPY_CLASS(wxTimePickerCtrlGeneric);
+};
+
+#endif // _WX_GENERIC_TIMECTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/treectlg.h
+// Purpose: wxTreeCtrl class
+// Author: Robert Roebling
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) 1997,1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _GENERIC_TREECTRL_H_
+#define _GENERIC_TREECTRL_H_
+
+#if wxUSE_TREECTRL
+
+#include "wx/scrolwin.h"
+#include "wx/pen.h"
+
+// -----------------------------------------------------------------------------
+// forward declaration
+// -----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxGenericTreeItem;
+
+class WXDLLIMPEXP_FWD_CORE wxTreeItemData;
+
+class WXDLLIMPEXP_FWD_CORE wxTreeRenameTimer;
+class WXDLLIMPEXP_FWD_CORE wxTreeFindTimer;
+class WXDLLIMPEXP_FWD_CORE wxTreeTextCtrl;
+class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
+
+// -----------------------------------------------------------------------------
+// wxGenericTreeCtrl - the tree control
+// -----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxGenericTreeCtrl : public wxTreeCtrlBase,
+ public wxScrollHelper
+{
+public:
+ // creation
+ // --------
+
+ wxGenericTreeCtrl() : wxTreeCtrlBase(), wxScrollHelper(this) { Init(); }
+
+ wxGenericTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxTR_DEFAULT_STYLE,
+ const wxValidator &validator = wxDefaultValidator,
+ const wxString& name = wxTreeCtrlNameStr)
+ : wxTreeCtrlBase(),
+ wxScrollHelper(this)
+ {
+ Init();
+ Create(parent, id, pos, size, style, validator, name);
+ }
+
+ virtual ~wxGenericTreeCtrl();
+
+ bool Create(wxWindow *parent, wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxTR_DEFAULT_STYLE,
+ const wxValidator &validator = wxDefaultValidator,
+ const wxString& name = wxTreeCtrlNameStr);
+
+ // implement base class pure virtuals
+ // ----------------------------------
+
+ virtual unsigned int GetCount() const;
+
+ virtual unsigned int GetIndent() const { return m_indent; }
+ virtual void SetIndent(unsigned int indent);
+
+
+ virtual void SetImageList(wxImageList *imageList);
+ virtual void SetStateImageList(wxImageList *imageList);
+
+ virtual wxString GetItemText(const wxTreeItemId& item) const;
+ virtual int GetItemImage(const wxTreeItemId& item,
+ wxTreeItemIcon which = wxTreeItemIcon_Normal) const;
+ virtual wxTreeItemData *GetItemData(const wxTreeItemId& item) const;
+ virtual wxColour GetItemTextColour(const wxTreeItemId& item) const;
+ virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const;
+ virtual wxFont GetItemFont(const wxTreeItemId& item) const;
+
+ virtual void SetItemText(const wxTreeItemId& item, const wxString& text);
+ virtual void SetItemImage(const wxTreeItemId& item,
+ int image,
+ wxTreeItemIcon which = wxTreeItemIcon_Normal);
+ virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData *data);
+
+ virtual void SetItemHasChildren(const wxTreeItemId& item, bool has = true);
+ virtual void SetItemBold(const wxTreeItemId& item, bool bold = true);
+ virtual void SetItemDropHighlight(const wxTreeItemId& item, bool highlight = true);
+ virtual void SetItemTextColour(const wxTreeItemId& item, const wxColour& col);
+ virtual void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col);
+ virtual void SetItemFont(const wxTreeItemId& item, const wxFont& font);
+
+ virtual bool IsVisible(const wxTreeItemId& item) const;
+ virtual bool ItemHasChildren(const wxTreeItemId& item) const;
+ virtual bool IsExpanded(const wxTreeItemId& item) const;
+ virtual bool IsSelected(const wxTreeItemId& item) const;
+ virtual bool IsBold(const wxTreeItemId& item) const;
+
+ virtual size_t GetChildrenCount(const wxTreeItemId& item,
+ bool recursively = true) const;
+
+ // navigation
+ // ----------
+
+ virtual wxTreeItemId GetRootItem() const { return m_anchor; }
+ virtual wxTreeItemId GetSelection() const
+ {
+ wxASSERT_MSG( !HasFlag(wxTR_MULTIPLE),
+ wxT("must use GetSelections() with this control") );
+
+ return m_current;
+ }
+ virtual size_t GetSelections(wxArrayTreeItemIds&) const;
+ virtual wxTreeItemId GetFocusedItem() const { return m_current; }
+
+ virtual void ClearFocusedItem();
+ virtual void SetFocusedItem(const wxTreeItemId& item);
+
+ virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const;
+ virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item,
+ wxTreeItemIdValue& cookie) const;
+ virtual wxTreeItemId GetNextChild(const wxTreeItemId& item,
+ wxTreeItemIdValue& cookie) const;
+ virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const;
+ virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const;
+ virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const;
+
+ virtual wxTreeItemId GetFirstVisibleItem() const;
+ virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const;
+ virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const;
+
+
+ // operations
+ // ----------
+
+ virtual wxTreeItemId AddRoot(const wxString& text,
+ int image = -1, int selectedImage = -1,
+ wxTreeItemData *data = NULL);
+
+ virtual void Delete(const wxTreeItemId& item);
+ virtual void DeleteChildren(const wxTreeItemId& item);
+ virtual void DeleteAllItems();
+
+ virtual void Expand(const wxTreeItemId& item);
+ virtual void Collapse(const wxTreeItemId& item);
+ virtual void CollapseAndReset(const wxTreeItemId& item);
+ virtual void Toggle(const wxTreeItemId& item);
+
+ virtual void Unselect();
+ virtual void UnselectAll();
+ virtual void SelectItem(const wxTreeItemId& item, bool select = true);
+ virtual void SelectChildren(const wxTreeItemId& parent);
+
+ virtual void EnsureVisible(const wxTreeItemId& item);
+ virtual void ScrollTo(const wxTreeItemId& item);
+
+ virtual wxTextCtrl *EditLabel(const wxTreeItemId& item,
+ wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl));
+ virtual wxTextCtrl *GetEditControl() const;
+ virtual void EndEditLabel(const wxTreeItemId& item,
+ bool discardChanges = false);
+
+ virtual void EnableBellOnNoMatch(bool on = true);
+
+ virtual void SortChildren(const wxTreeItemId& item);
+
+ // items geometry
+ // --------------
+
+ virtual bool GetBoundingRect(const wxTreeItemId& item,
+ wxRect& rect,
+ bool textOnly = false) const;
+
+
+ // this version specific methods
+ // -----------------------------
+
+ wxImageList *GetButtonsImageList() const { return m_imageListButtons; }
+ void SetButtonsImageList(wxImageList *imageList);
+ void AssignButtonsImageList(wxImageList *imageList);
+
+ void SetDropEffectAboveItem( bool above = false ) { m_dropEffectAboveItem = above; }
+ bool GetDropEffectAboveItem() const { return m_dropEffectAboveItem; }
+
+ wxTreeItemId GetNext(const wxTreeItemId& item) const;
+
+#if WXWIN_COMPATIBILITY_2_6
+ // use EditLabel() instead
+ void Edit( const wxTreeItemId& item ) { EditLabel(item); }
+#endif // WXWIN_COMPATIBILITY_2_6
+
+ // implementation only from now on
+
+ // overridden base class virtuals
+ virtual bool SetBackgroundColour(const wxColour& colour);
+ virtual bool SetForegroundColour(const wxColour& colour);
+
+ virtual void Refresh(bool eraseBackground = true, const wxRect *rect = NULL);
+
+ virtual bool SetFont( const wxFont &font );
+ virtual void SetWindowStyle(const long styles);
+
+ // callbacks
+ void OnPaint( wxPaintEvent &event );
+ void OnSetFocus( wxFocusEvent &event );
+ void OnKillFocus( wxFocusEvent &event );
+ void OnKeyDown( wxKeyEvent &event );
+ void OnChar( wxKeyEvent &event );
+ void OnMouse( wxMouseEvent &event );
+ void OnGetToolTip( wxTreeEvent &event );
+ void OnSize( wxSizeEvent &event );
+ void OnInternalIdle( );
+
+ virtual wxVisualAttributes GetDefaultAttributes() const
+ {
+ return GetClassDefaultAttributes(GetWindowVariant());
+ }
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ // implementation helpers
+ void AdjustMyScrollbars();
+
+ WX_FORWARD_TO_SCROLL_HELPER()
+
+protected:
+ friend class wxGenericTreeItem;
+ friend class wxTreeRenameTimer;
+ friend class wxTreeFindTimer;
+ friend class wxTreeTextCtrl;
+
+ wxFont m_normalFont;
+ wxFont m_boldFont;
+
+ wxGenericTreeItem *m_anchor;
+ wxGenericTreeItem *m_current,
+ *m_key_current,
+ // A hint to select a parent item after deleting a child
+ *m_select_me;
+ unsigned short m_indent;
+ int m_lineHeight;
+ wxPen m_dottedPen;
+ wxBrush *m_hilightBrush,
+ *m_hilightUnfocusedBrush;
+ bool m_hasFocus;
+ bool m_dirty;
+ bool m_ownsImageListButtons;
+ bool m_isDragging; // true between BEGIN/END drag events
+ bool m_lastOnSame; // last click on the same item as prev
+ wxImageList *m_imageListButtons;
+
+ int m_dragCount;
+ wxPoint m_dragStart;
+ wxGenericTreeItem *m_dropTarget;
+ wxCursor m_oldCursor; // cursor is changed while dragging
+ wxGenericTreeItem *m_oldSelection;
+ wxGenericTreeItem *m_underMouse; // for visual effects
+
+ enum { NoEffect, BorderEffect, AboveEffect, BelowEffect } m_dndEffect;
+ wxGenericTreeItem *m_dndEffectItem;
+
+ wxTreeTextCtrl *m_textCtrl;
+
+
+ wxTimer *m_renameTimer;
+
+ // incremental search data
+ wxString m_findPrefix;
+ wxTimer *m_findTimer;
+ // This flag is set to 0 if the bell is disabled, 1 if it is enabled and -1
+ // if it is globally enabled but has been temporarily disabled because we
+ // had already beeped for this particular search.
+ int m_findBell;
+
+ bool m_dropEffectAboveItem;
+
+ // the common part of all ctors
+ void Init();
+
+ // overridden wxWindow methods
+ virtual void DoThaw();
+
+ // misc helpers
+ void SendDeleteEvent(wxGenericTreeItem *itemBeingDeleted);
+
+ void DrawBorder(const wxTreeItemId& item);
+ void DrawLine(const wxTreeItemId& item, bool below);
+ void DrawDropEffect(wxGenericTreeItem *item);
+
+ void DoSelectItem(const wxTreeItemId& id,
+ bool unselect_others = true,
+ bool extended_select = false);
+
+ virtual int DoGetItemState(const wxTreeItemId& item) const;
+ virtual void DoSetItemState(const wxTreeItemId& item, int state);
+
+ virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent,
+ size_t previous,
+ const wxString& text,
+ int image,
+ int selectedImage,
+ wxTreeItemData *data);
+ virtual wxTreeItemId DoInsertAfter(const wxTreeItemId& parent,
+ const wxTreeItemId& idPrevious,
+ const wxString& text,
+ int image = -1, int selImage = -1,
+ wxTreeItemData *data = NULL);
+ virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags) const;
+
+ // called by wxTextTreeCtrl when it marks itself for deletion
+ void ResetTextControl();
+
+ // find the first item starting with the given prefix after the given item
+ wxTreeItemId FindItem(const wxTreeItemId& id, const wxString& prefix) const;
+
+ bool HasButtons() const { return HasFlag(wxTR_HAS_BUTTONS); }
+
+ void CalculateLineHeight();
+ int GetLineHeight(wxGenericTreeItem *item) const;
+ void PaintLevel( wxGenericTreeItem *item, wxDC& dc, int level, int &y );
+ void PaintItem( wxGenericTreeItem *item, wxDC& dc);
+
+ void CalculateLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &y );
+ void CalculatePositions();
+
+ void RefreshSubtree( wxGenericTreeItem *item );
+ void RefreshLine( wxGenericTreeItem *item );
+
+ // redraw all selected items
+ void RefreshSelected();
+
+ // RefreshSelected() recursive helper
+ void RefreshSelectedUnder(wxGenericTreeItem *item);
+
+ void OnRenameTimer();
+ bool OnRenameAccept(wxGenericTreeItem *item, const wxString& value);
+ void OnRenameCancelled(wxGenericTreeItem *item);
+
+ void FillArray(wxGenericTreeItem*, wxArrayTreeItemIds&) const;
+ void SelectItemRange( wxGenericTreeItem *item1, wxGenericTreeItem *item2 );
+ bool TagAllChildrenUntilLast(wxGenericTreeItem *crt_item, wxGenericTreeItem *last_item, bool select);
+ bool TagNextChildren(wxGenericTreeItem *crt_item, wxGenericTreeItem *last_item, bool select);
+ void UnselectAllChildren( wxGenericTreeItem *item );
+ void ChildrenClosing(wxGenericTreeItem* item);
+
+ void DoDirtyProcessing();
+
+ virtual wxSize DoGetBestSize() const;
+
+private:
+ // Reset the state of the last find (i.e. keyboard incremental search)
+ // operation.
+ void ResetFindState();
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxGenericTreeCtrl)
+ wxDECLARE_NO_COPY_CLASS(wxGenericTreeCtrl);
+};
+
+#if !defined(__WXMSW__) || defined(__WXUNIVERSAL__)
+/*
+ * wxTreeCtrl has to be a real class or we have problems with
+ * the run-time information.
+ */
+
+class WXDLLIMPEXP_CORE wxTreeCtrl: public wxGenericTreeCtrl
+{
+ DECLARE_DYNAMIC_CLASS(wxTreeCtrl)
+
+public:
+ wxTreeCtrl() {}
+
+ wxTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxTR_DEFAULT_STYLE,
+ const wxValidator &validator = wxDefaultValidator,
+ const wxString& name = wxTreeCtrlNameStr)
+ : wxGenericTreeCtrl(parent, id, pos, size, style, validator, name)
+ {
+ }
+};
+#endif // !__WXMSW__ || __WXUNIVERSAL__
+
+#endif // wxUSE_TREECTRL
+
+#endif // _GENERIC_TREECTRL_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/wizard.h
+// Purpose: declaration of generic wxWizard class
+// Author: Vadim Zeitlin
+// Modified by: Robert Vazan (sizers)
+// Created: 28.09.99
+// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_WIZARD_H_
+#define _WX_GENERIC_WIZARD_H_
+
+// ----------------------------------------------------------------------------
+// wxWizard
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxButton;
+class WXDLLIMPEXP_FWD_CORE wxStaticBitmap;
+class WXDLLIMPEXP_FWD_ADV wxWizardEvent;
+class WXDLLIMPEXP_FWD_CORE wxBoxSizer;
+class WXDLLIMPEXP_FWD_ADV wxWizardSizer;
+
+class WXDLLIMPEXP_ADV wxWizard : public wxWizardBase
+{
+public:
+ // ctor
+ wxWizard() { Init(); }
+ wxWizard(wxWindow *parent,
+ int id = wxID_ANY,
+ const wxString& title = wxEmptyString,
+ const wxBitmap& bitmap = wxNullBitmap,
+ const wxPoint& pos = wxDefaultPosition,
+ long style = wxDEFAULT_DIALOG_STYLE)
+ {
+ Init();
+ Create(parent, id, title, bitmap, pos, style);
+ }
+ bool Create(wxWindow *parent,
+ int id = wxID_ANY,
+ const wxString& title = wxEmptyString,
+ const wxBitmap& bitmap = wxNullBitmap,
+ const wxPoint& pos = wxDefaultPosition,
+ long style = wxDEFAULT_DIALOG_STYLE);
+ void Init();
+ virtual ~wxWizard();
+
+ // implement base class pure virtuals
+ virtual bool RunWizard(wxWizardPage *firstPage);
+ virtual wxWizardPage *GetCurrentPage() const;
+ virtual void SetPageSize(const wxSize& size);
+ virtual wxSize GetPageSize() const;
+ virtual void FitToPage(const wxWizardPage *firstPage);
+ virtual wxSizer *GetPageAreaSizer() const;
+ virtual void SetBorder(int border);
+
+ /// set/get bitmap
+ const wxBitmap& GetBitmap() const { return m_bitmap; }
+ void SetBitmap(const wxBitmap& bitmap);
+
+ // implementation only from now on
+ // -------------------------------
+
+ // is the wizard running?
+ bool IsRunning() const { return m_page != NULL; }
+
+ // show the prev/next page, but call TransferDataFromWindow on the current
+ // page first and return false without changing the page if
+ // TransferDataFromWindow() returns false - otherwise, returns true
+ virtual bool ShowPage(wxWizardPage *page, bool goingForward = true);
+
+ // do fill the dialog with controls
+ // this is app-overridable to, for example, set help and tooltip text
+ virtual void DoCreateControls();
+
+ // Do the adaptation
+ virtual bool DoLayoutAdaptation();
+
+ // Set/get bitmap background colour
+ void SetBitmapBackgroundColour(const wxColour& colour) { m_bitmapBackgroundColour = colour; }
+ const wxColour& GetBitmapBackgroundColour() const { return m_bitmapBackgroundColour; }
+
+ // Set/get bitmap placement (centred, tiled etc.)
+ void SetBitmapPlacement(int placement) { m_bitmapPlacement = placement; }
+ int GetBitmapPlacement() const { return m_bitmapPlacement; }
+
+ // Set/get minimum bitmap width
+ void SetMinimumBitmapWidth(int w) { m_bitmapMinimumWidth = w; }
+ int GetMinimumBitmapWidth() const { return m_bitmapMinimumWidth; }
+
+ // Tile bitmap
+ static bool TileBitmap(const wxRect& rect, wxDC& dc, const wxBitmap& bitmap);
+
+protected:
+ // for compatibility only, doesn't do anything any more
+ void FinishLayout() { }
+
+ // Do fit, and adjust to screen size if necessary
+ virtual void DoWizardLayout();
+
+ // Resize bitmap if necessary
+ virtual bool ResizeBitmap(wxBitmap& bmp);
+
+ // was the dialog really created?
+ bool WasCreated() const { return m_btnPrev != NULL; }
+
+ // event handlers
+ void OnCancel(wxCommandEvent& event);
+ void OnBackOrNext(wxCommandEvent& event);
+ void OnHelp(wxCommandEvent& event);
+
+ void OnWizEvent(wxWizardEvent& event);
+
+ void AddBitmapRow(wxBoxSizer *mainColumn);
+ void AddStaticLine(wxBoxSizer *mainColumn);
+ void AddBackNextPair(wxBoxSizer *buttonRow);
+ void AddButtonRow(wxBoxSizer *mainColumn);
+
+ // the page size requested by user
+ wxSize m_sizePage;
+
+ // the dialog position from the ctor
+ wxPoint m_posWizard;
+
+ // wizard state
+ wxWizardPage *m_page; // the current page or NULL
+ wxBitmap m_bitmap; // the default bitmap to show
+
+ // wizard controls
+ wxButton *m_btnPrev, // the "<Back" button
+ *m_btnNext; // the "Next>" or "Finish" button
+ wxStaticBitmap *m_statbmp; // the control for the bitmap
+
+ // Border around page area sizer requested using SetBorder()
+ int m_border;
+
+ // Whether RunWizard() was called
+ bool m_started;
+
+ // Whether was modal (modeless has to be destroyed on finish or cancel)
+ bool m_wasModal;
+
+ // True if pages are laid out using the sizer
+ bool m_usingSizer;
+
+ // Page area sizer will be inserted here with padding
+ wxBoxSizer *m_sizerBmpAndPage;
+
+ // Actual position and size of pages
+ wxWizardSizer *m_sizerPage;
+
+ // Bitmap background colour if resizing bitmap
+ wxColour m_bitmapBackgroundColour;
+
+ // Bitmap placement flags
+ int m_bitmapPlacement;
+
+ // Minimum bitmap width
+ int m_bitmapMinimumWidth;
+
+ friend class wxWizardSizer;
+
+ DECLARE_DYNAMIC_CLASS(wxWizard)
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxWizard);
+};
+
+#endif // _WX_GENERIC_WIZARD_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/geometry.h
+// Purpose: Common Geometry Classes
+// Author: Stefan Csomor
+// Modified by:
+// Created: 08/05/99
+// Copyright: (c) 1999 Stefan Csomor
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GEOMETRY_H_
+#define _WX_GEOMETRY_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_GEOMETRY
+
+#include "wx/utils.h"
+#include "wx/gdicmn.h"
+#include "wx/math.h"
+
+class WXDLLIMPEXP_FWD_BASE wxDataInputStream;
+class WXDLLIMPEXP_FWD_BASE wxDataOutputStream;
+
+// clipping from Cohen-Sutherland
+
+enum wxOutCode
+{
+ wxInside = 0x00 ,
+ wxOutLeft = 0x01 ,
+ wxOutRight = 0x02 ,
+ wxOutTop = 0x08 ,
+ wxOutBottom = 0x04
+};
+
+class WXDLLIMPEXP_CORE wxPoint2DInt
+{
+public :
+ inline wxPoint2DInt();
+ inline wxPoint2DInt( wxInt32 x , wxInt32 y );
+ inline wxPoint2DInt( const wxPoint2DInt &pt );
+ inline wxPoint2DInt( const wxPoint &pt );
+
+ // noops for this class, just return the coords
+ inline void GetFloor( wxInt32 *x , wxInt32 *y ) const;
+ inline void GetRounded( wxInt32 *x , wxInt32 *y ) const;
+
+ inline wxDouble GetVectorLength() const;
+ wxDouble GetVectorAngle() const;
+ inline void SetVectorLength( wxDouble length );
+ void SetVectorAngle( wxDouble degrees );
+ void SetPolarCoordinates( wxInt32 angle , wxInt32 length );
+ // set the vector length to 1.0, preserving the angle
+ inline void Normalize();
+
+ inline wxDouble GetDistance( const wxPoint2DInt &pt ) const;
+ inline wxDouble GetDistanceSquare( const wxPoint2DInt &pt ) const;
+ inline wxInt32 GetDotProduct( const wxPoint2DInt &vec ) const;
+ inline wxInt32 GetCrossProduct( const wxPoint2DInt &vec ) const;
+
+ // the reflection of this point
+ inline wxPoint2DInt operator-();
+
+ inline wxPoint2DInt& operator=(const wxPoint2DInt& pt);
+ inline wxPoint2DInt& operator+=(const wxPoint2DInt& pt);
+ inline wxPoint2DInt& operator-=(const wxPoint2DInt& pt);
+ inline wxPoint2DInt& operator*=(const wxPoint2DInt& pt);
+ inline wxPoint2DInt& operator*=(wxDouble n);
+ inline wxPoint2DInt& operator*=(wxInt32 n);
+ inline wxPoint2DInt& operator/=(const wxPoint2DInt& pt);
+ inline wxPoint2DInt& operator/=(wxDouble n);
+ inline wxPoint2DInt& operator/=(wxInt32 n);
+ inline operator wxPoint() const;
+ inline bool operator==(const wxPoint2DInt& pt) const;
+ inline bool operator!=(const wxPoint2DInt& pt) const;
+
+#if wxUSE_STREAMS
+ void WriteTo( wxDataOutputStream &stream ) const;
+ void ReadFrom( wxDataInputStream &stream );
+#endif // wxUSE_STREAMS
+
+ wxInt32 m_x;
+ wxInt32 m_y;
+};
+
+inline wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2);
+inline wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2);
+inline wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2);
+inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt);
+inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n);
+inline wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2);
+inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n);
+
+inline wxPoint2DInt::wxPoint2DInt()
+{
+ m_x = 0;
+ m_y = 0;
+}
+
+inline wxPoint2DInt::wxPoint2DInt( wxInt32 x , wxInt32 y )
+{
+ m_x = x;
+ m_y = y;
+}
+
+inline wxPoint2DInt::wxPoint2DInt( const wxPoint2DInt &pt )
+{
+ m_x = pt.m_x;
+ m_y = pt.m_y;
+}
+
+inline wxPoint2DInt::wxPoint2DInt( const wxPoint &pt )
+{
+ m_x = pt.x;
+ m_y = pt.y;
+}
+
+inline void wxPoint2DInt::GetFloor( wxInt32 *x , wxInt32 *y ) const
+{
+ if ( x )
+ *x = m_x;
+ if ( y )
+ *y = m_y;
+}
+
+inline void wxPoint2DInt::GetRounded( wxInt32 *x , wxInt32 *y ) const
+{
+ GetFloor(x, y);
+}
+
+inline wxDouble wxPoint2DInt::GetVectorLength() const
+{
+ // cast needed MIPSpro compiler under SGI
+ return sqrt( (double)(m_x)*(m_x) + (m_y)*(m_y) );
+}
+
+inline void wxPoint2DInt::SetVectorLength( wxDouble length )
+{
+ wxDouble before = GetVectorLength();
+ m_x = (wxInt32)(m_x * length / before);
+ m_y = (wxInt32)(m_y * length / before);
+}
+
+inline void wxPoint2DInt::Normalize()
+{
+ SetVectorLength( 1 );
+}
+
+inline wxDouble wxPoint2DInt::GetDistance( const wxPoint2DInt &pt ) const
+{
+ return sqrt( GetDistanceSquare( pt ) );
+}
+
+inline wxDouble wxPoint2DInt::GetDistanceSquare( const wxPoint2DInt &pt ) const
+{
+ return ( (pt.m_x-m_x)*(pt.m_x-m_x) + (pt.m_y-m_y)*(pt.m_y-m_y) );
+}
+
+inline wxInt32 wxPoint2DInt::GetDotProduct( const wxPoint2DInt &vec ) const
+{
+ return ( m_x * vec.m_x + m_y * vec.m_y );
+}
+
+inline wxInt32 wxPoint2DInt::GetCrossProduct( const wxPoint2DInt &vec ) const
+{
+ return ( m_x * vec.m_y - vec.m_x * m_y );
+}
+
+inline wxPoint2DInt::operator wxPoint() const
+{
+ return wxPoint( m_x, m_y);
+}
+
+inline wxPoint2DInt wxPoint2DInt::operator-()
+{
+ return wxPoint2DInt( -m_x, -m_y);
+}
+
+inline wxPoint2DInt& wxPoint2DInt::operator=(const wxPoint2DInt& pt)
+{
+ if (this != &pt)
+ {
+ m_x = pt.m_x;
+ m_y = pt.m_y;
+ }
+ return *this;
+}
+
+inline wxPoint2DInt& wxPoint2DInt::operator+=(const wxPoint2DInt& pt)
+{
+ m_x = m_x + pt.m_x;
+ m_y = m_y + pt.m_y;
+ return *this;
+}
+
+inline wxPoint2DInt& wxPoint2DInt::operator-=(const wxPoint2DInt& pt)
+{
+ m_x = m_x - pt.m_x;
+ m_y = m_y - pt.m_y;
+ return *this;
+}
+
+inline wxPoint2DInt& wxPoint2DInt::operator*=(const wxPoint2DInt& pt)
+{
+ m_x = m_x + pt.m_x;
+ m_y = m_y + pt.m_y;
+ return *this;
+}
+
+inline wxPoint2DInt& wxPoint2DInt::operator/=(const wxPoint2DInt& pt)
+{
+ m_x = m_x - pt.m_x;
+ m_y = m_y - pt.m_y;
+ return *this;
+}
+
+inline bool wxPoint2DInt::operator==(const wxPoint2DInt& pt) const
+{
+ return m_x == pt.m_x && m_y == pt.m_y;
+}
+
+inline bool wxPoint2DInt::operator!=(const wxPoint2DInt& pt) const
+{
+ return m_x != pt.m_x || m_y != pt.m_y;
+}
+
+inline wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2)
+{
+ return wxPoint2DInt( pt1.m_x + pt2.m_x , pt1.m_y + pt2.m_y );
+}
+
+inline wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2)
+{
+ return wxPoint2DInt( pt1.m_x - pt2.m_x , pt1.m_y - pt2.m_y );
+}
+
+
+inline wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2)
+{
+ return wxPoint2DInt( pt1.m_x * pt2.m_x , pt1.m_y * pt2.m_y );
+}
+
+inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt)
+{
+ return wxPoint2DInt( pt.m_x * n , pt.m_y * n );
+}
+
+inline wxPoint2DInt operator*(wxDouble n , const wxPoint2DInt& pt)
+{
+ return wxPoint2DInt( (int) (pt.m_x * n) , (int) (pt.m_y * n) );
+}
+
+inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n)
+{
+ return wxPoint2DInt( pt.m_x * n , pt.m_y * n );
+}
+
+inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxDouble n)
+{
+ return wxPoint2DInt( (int) (pt.m_x * n) , (int) (pt.m_y * n) );
+}
+
+inline wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2)
+{
+ return wxPoint2DInt( pt1.m_x / pt2.m_x , pt1.m_y / pt2.m_y );
+}
+
+inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n)
+{
+ return wxPoint2DInt( pt.m_x / n , pt.m_y / n );
+}
+
+inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxDouble n)
+{
+ return wxPoint2DInt( (int) (pt.m_x / n) , (int) (pt.m_y / n) );
+}
+
+// wxPoint2Ds represent a point or a vector in a 2d coordinate system
+
+class WXDLLIMPEXP_CORE wxPoint2DDouble
+{
+public :
+ inline wxPoint2DDouble();
+ inline wxPoint2DDouble( wxDouble x , wxDouble y );
+ inline wxPoint2DDouble( const wxPoint2DDouble &pt );
+ wxPoint2DDouble( const wxPoint2DInt &pt )
+ { m_x = (wxDouble) pt.m_x ; m_y = (wxDouble) pt.m_y ; }
+ wxPoint2DDouble( const wxPoint &pt )
+ { m_x = (wxDouble) pt.x ; m_y = (wxDouble) pt.y ; }
+
+ // two different conversions to integers, floor and rounding
+ inline void GetFloor( wxInt32 *x , wxInt32 *y ) const;
+ inline void GetRounded( wxInt32 *x , wxInt32 *y ) const;
+
+ inline wxDouble GetVectorLength() const;
+ wxDouble GetVectorAngle() const ;
+ void SetVectorLength( wxDouble length );
+ void SetVectorAngle( wxDouble degrees );
+ void SetPolarCoordinates( wxDouble angle , wxDouble length );
+ // set the vector length to 1.0, preserving the angle
+ void Normalize();
+
+ inline wxDouble GetDistance( const wxPoint2DDouble &pt ) const;
+ inline wxDouble GetDistanceSquare( const wxPoint2DDouble &pt ) const;
+ inline wxDouble GetDotProduct( const wxPoint2DDouble &vec ) const;
+ inline wxDouble GetCrossProduct( const wxPoint2DDouble &vec ) const;
+
+ // the reflection of this point
+ inline wxPoint2DDouble operator-();
+
+ inline wxPoint2DDouble& operator=(const wxPoint2DDouble& pt);
+ inline wxPoint2DDouble& operator+=(const wxPoint2DDouble& pt);
+ inline wxPoint2DDouble& operator-=(const wxPoint2DDouble& pt);
+ inline wxPoint2DDouble& operator*=(const wxPoint2DDouble& pt);
+ inline wxPoint2DDouble& operator*=(wxDouble n);
+ inline wxPoint2DDouble& operator*=(wxInt32 n);
+ inline wxPoint2DDouble& operator/=(const wxPoint2DDouble& pt);
+ inline wxPoint2DDouble& operator/=(wxDouble n);
+ inline wxPoint2DDouble& operator/=(wxInt32 n);
+
+ inline bool operator==(const wxPoint2DDouble& pt) const;
+ inline bool operator!=(const wxPoint2DDouble& pt) const;
+
+ wxDouble m_x;
+ wxDouble m_y;
+};
+
+inline wxPoint2DDouble operator+(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2);
+inline wxPoint2DDouble operator-(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2);
+inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2);
+inline wxPoint2DDouble operator*(wxDouble n , const wxPoint2DDouble& pt);
+inline wxPoint2DDouble operator*(wxInt32 n , const wxPoint2DDouble& pt);
+inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxDouble n);
+inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxInt32 n);
+inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2);
+inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxDouble n);
+inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxInt32 n);
+
+inline wxPoint2DDouble::wxPoint2DDouble()
+{
+ m_x = 0.0;
+ m_y = 0.0;
+}
+
+inline wxPoint2DDouble::wxPoint2DDouble( wxDouble x , wxDouble y )
+{
+ m_x = x;
+ m_y = y;
+}
+
+inline wxPoint2DDouble::wxPoint2DDouble( const wxPoint2DDouble &pt )
+{
+ m_x = pt.m_x;
+ m_y = pt.m_y;
+}
+
+inline void wxPoint2DDouble::GetFloor( wxInt32 *x , wxInt32 *y ) const
+{
+ *x = (wxInt32) floor( m_x );
+ *y = (wxInt32) floor( m_y );
+}
+
+inline void wxPoint2DDouble::GetRounded( wxInt32 *x , wxInt32 *y ) const
+{
+ *x = (wxInt32) floor( m_x + 0.5 );
+ *y = (wxInt32) floor( m_y + 0.5);
+}
+
+inline wxDouble wxPoint2DDouble::GetVectorLength() const
+{
+ return sqrt( (m_x)*(m_x) + (m_y)*(m_y) ) ;
+}
+
+inline void wxPoint2DDouble::SetVectorLength( wxDouble length )
+{
+ wxDouble before = GetVectorLength() ;
+ m_x = (m_x * length / before) ;
+ m_y = (m_y * length / before) ;
+}
+
+inline void wxPoint2DDouble::Normalize()
+{
+ SetVectorLength( 1 );
+}
+
+inline wxDouble wxPoint2DDouble::GetDistance( const wxPoint2DDouble &pt ) const
+{
+ return sqrt( GetDistanceSquare( pt ) );
+}
+
+inline wxDouble wxPoint2DDouble::GetDistanceSquare( const wxPoint2DDouble &pt ) const
+{
+ return ( (pt.m_x-m_x)*(pt.m_x-m_x) + (pt.m_y-m_y)*(pt.m_y-m_y) );
+}
+
+inline wxDouble wxPoint2DDouble::GetDotProduct( const wxPoint2DDouble &vec ) const
+{
+ return ( m_x * vec.m_x + m_y * vec.m_y );
+}
+
+inline wxDouble wxPoint2DDouble::GetCrossProduct( const wxPoint2DDouble &vec ) const
+{
+ return ( m_x * vec.m_y - vec.m_x * m_y );
+}
+
+inline wxPoint2DDouble wxPoint2DDouble::operator-()
+{
+ return wxPoint2DDouble( -m_x, -m_y);
+}
+
+inline wxPoint2DDouble& wxPoint2DDouble::operator=(const wxPoint2DDouble& pt)
+{
+ if (this != &pt)
+ {
+ m_x = pt.m_x;
+ m_y = pt.m_y;
+ }
+ return *this;
+}
+
+inline wxPoint2DDouble& wxPoint2DDouble::operator+=(const wxPoint2DDouble& pt)
+{
+ m_x = m_x + pt.m_x;
+ m_y = m_y + pt.m_y;
+ return *this;
+}
+
+inline wxPoint2DDouble& wxPoint2DDouble::operator-=(const wxPoint2DDouble& pt)
+{
+ m_x = m_x - pt.m_x;
+ m_y = m_y - pt.m_y;
+ return *this;
+}
+
+inline wxPoint2DDouble& wxPoint2DDouble::operator*=(const wxPoint2DDouble& pt)
+{
+ m_x = m_x * pt.m_x;
+ m_y = m_y * pt.m_y;
+ return *this;
+}
+
+inline wxPoint2DDouble& wxPoint2DDouble::operator/=(const wxPoint2DDouble& pt)
+{
+ m_x = m_x / pt.m_x;
+ m_y = m_y / pt.m_y;
+ return *this;
+}
+
+inline bool wxPoint2DDouble::operator==(const wxPoint2DDouble& pt) const
+{
+ return wxIsSameDouble(m_x, pt.m_x) && wxIsSameDouble(m_y, pt.m_y);
+}
+
+inline bool wxPoint2DDouble::operator!=(const wxPoint2DDouble& pt) const
+{
+ return !(*this == pt);
+}
+
+inline wxPoint2DDouble operator+(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2)
+{
+ return wxPoint2DDouble( pt1.m_x + pt2.m_x , pt1.m_y + pt2.m_y );
+}
+
+inline wxPoint2DDouble operator-(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2)
+{
+ return wxPoint2DDouble( pt1.m_x - pt2.m_x , pt1.m_y - pt2.m_y );
+}
+
+
+inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2)
+{
+ return wxPoint2DDouble( pt1.m_x * pt2.m_x , pt1.m_y * pt2.m_y );
+}
+
+inline wxPoint2DDouble operator*(wxDouble n , const wxPoint2DDouble& pt)
+{
+ return wxPoint2DDouble( pt.m_x * n , pt.m_y * n );
+}
+
+inline wxPoint2DDouble operator*(wxInt32 n , const wxPoint2DDouble& pt)
+{
+ return wxPoint2DDouble( pt.m_x * n , pt.m_y * n );
+}
+
+inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxDouble n)
+{
+ return wxPoint2DDouble( pt.m_x * n , pt.m_y * n );
+}
+
+inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxInt32 n)
+{
+ return wxPoint2DDouble( pt.m_x * n , pt.m_y * n );
+}
+
+inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2)
+{
+ return wxPoint2DDouble( pt1.m_x / pt2.m_x , pt1.m_y / pt2.m_y );
+}
+
+inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxDouble n)
+{
+ return wxPoint2DDouble( pt.m_x / n , pt.m_y / n );
+}
+
+inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxInt32 n)
+{
+ return wxPoint2DDouble( pt.m_x / n , pt.m_y / n );
+}
+
+// wxRect2Ds are a axis-aligned rectangles, each side of the rect is parallel to the x- or m_y- axis. The rectangle is either defined by the
+// top left and bottom right corner, or by the top left corner and size. A point is contained within the rectangle if
+// left <= x < right and top <= m_y < bottom , thus it is a half open interval.
+
+class WXDLLIMPEXP_CORE wxRect2DDouble
+{
+public:
+ wxRect2DDouble()
+ { m_x = m_y = m_width = m_height = 0; }
+ wxRect2DDouble(wxDouble x, wxDouble y, wxDouble w, wxDouble h)
+ { m_x = x; m_y = y; m_width = w; m_height = h; }
+/*
+ wxRect2DDouble(const wxPoint2DDouble& topLeft, const wxPoint2DDouble& bottomRight);
+ wxRect2DDouble(const wxPoint2DDouble& pos, const wxSize& size);
+ wxRect2DDouble(const wxRect2DDouble& rect);
+*/
+ // single attribute accessors
+
+ wxPoint2DDouble GetPosition() const
+ { return wxPoint2DDouble(m_x, m_y); }
+ wxSize GetSize() const
+ { return wxSize((int) m_width, (int) m_height); }
+
+ // for the edge and corner accessors there are two setters counterparts, the Set.. functions keep the other corners at their
+ // position whenever sensible, the Move.. functions keep the size of the rect and move the other corners appropriately
+
+ inline wxDouble GetLeft() const { return m_x; }
+ inline void SetLeft( wxDouble n ) { m_width += m_x - n; m_x = n; }
+ inline void MoveLeftTo( wxDouble n ) { m_x = n; }
+ inline wxDouble GetTop() const { return m_y; }
+ inline void SetTop( wxDouble n ) { m_height += m_y - n; m_y = n; }
+ inline void MoveTopTo( wxDouble n ) { m_y = n; }
+ inline wxDouble GetBottom() const { return m_y + m_height; }
+ inline void SetBottom( wxDouble n ) { m_height += n - (m_y+m_height);}
+ inline void MoveBottomTo( wxDouble n ) { m_y = n - m_height; }
+ inline wxDouble GetRight() const { return m_x + m_width; }
+ inline void SetRight( wxDouble n ) { m_width += n - (m_x+m_width) ; }
+ inline void MoveRightTo( wxDouble n ) { m_x = n - m_width; }
+
+ inline wxPoint2DDouble GetLeftTop() const
+ { return wxPoint2DDouble( m_x , m_y ); }
+ inline void SetLeftTop( const wxPoint2DDouble &pt )
+ { m_width += m_x - pt.m_x; m_height += m_y - pt.m_y; m_x = pt.m_x; m_y = pt.m_y; }
+ inline void MoveLeftTopTo( const wxPoint2DDouble &pt )
+ { m_x = pt.m_x; m_y = pt.m_y; }
+ inline wxPoint2DDouble GetLeftBottom() const
+ { return wxPoint2DDouble( m_x , m_y + m_height ); }
+ inline void SetLeftBottom( const wxPoint2DDouble &pt )
+ { m_width += m_x - pt.m_x; m_height += pt.m_y - (m_y+m_height) ; m_x = pt.m_x; }
+ inline void MoveLeftBottomTo( const wxPoint2DDouble &pt )
+ { m_x = pt.m_x; m_y = pt.m_y - m_height; }
+ inline wxPoint2DDouble GetRightTop() const
+ { return wxPoint2DDouble( m_x+m_width , m_y ); }
+ inline void SetRightTop( const wxPoint2DDouble &pt )
+ { m_width += pt.m_x - ( m_x + m_width ); m_height += m_y - pt.m_y; m_y = pt.m_y; }
+ inline void MoveRightTopTo( const wxPoint2DDouble &pt )
+ { m_x = pt.m_x - m_width; m_y = pt.m_y; }
+ inline wxPoint2DDouble GetRightBottom() const
+ { return wxPoint2DDouble( m_x+m_width , m_y + m_height ); }
+ inline void SetRightBottom( const wxPoint2DDouble &pt )
+ { m_width += pt.m_x - ( m_x + m_width ); m_height += pt.m_y - (m_y+m_height);}
+ inline void MoveRightBottomTo( const wxPoint2DDouble &pt )
+ { m_x = pt.m_x - m_width; m_y = pt.m_y - m_height; }
+ inline wxPoint2DDouble GetCentre() const
+ { return wxPoint2DDouble( m_x+m_width/2 , m_y+m_height/2 ); }
+ inline void SetCentre( const wxPoint2DDouble &pt )
+ { MoveCentreTo( pt ); } // since this is impossible without moving...
+ inline void MoveCentreTo( const wxPoint2DDouble &pt )
+ { m_x += pt.m_x - (m_x+m_width/2) , m_y += pt.m_y -(m_y+m_height/2); }
+ inline wxOutCode GetOutCode( const wxPoint2DDouble &pt ) const
+ { return (wxOutCode) (( ( pt.m_x < m_x ) ? wxOutLeft : 0 ) +
+ ( ( pt.m_x > m_x + m_width ) ? wxOutRight : 0 ) +
+ ( ( pt.m_y < m_y ) ? wxOutTop : 0 ) +
+ ( ( pt.m_y > m_y + m_height ) ? wxOutBottom : 0 )); }
+ inline wxOutCode GetOutcode(const wxPoint2DDouble &pt) const
+ { return GetOutCode(pt) ; }
+ inline bool Contains( const wxPoint2DDouble &pt ) const
+ { return GetOutCode( pt ) == wxInside; }
+ inline bool Contains( const wxRect2DDouble &rect ) const
+ { return ( ( ( m_x <= rect.m_x ) && ( rect.m_x + rect.m_width <= m_x + m_width ) ) &&
+ ( ( m_y <= rect.m_y ) && ( rect.m_y + rect.m_height <= m_y + m_height ) ) ); }
+ inline bool IsEmpty() const
+ { return m_width <= 0 || m_height <= 0; }
+ inline bool HaveEqualSize( const wxRect2DDouble &rect ) const
+ { return wxIsSameDouble(rect.m_width, m_width) && wxIsSameDouble(rect.m_height, m_height); }
+
+ inline void Inset( wxDouble x , wxDouble y )
+ { m_x += x; m_y += y; m_width -= 2 * x; m_height -= 2 * y; }
+ inline void Inset( wxDouble left , wxDouble top ,wxDouble right , wxDouble bottom )
+ { m_x += left; m_y += top; m_width -= left + right; m_height -= top + bottom;}
+ inline void Offset( const wxPoint2DDouble &pt )
+ { m_x += pt.m_x; m_y += pt.m_y; }
+
+ void ConstrainTo( const wxRect2DDouble &rect );
+
+ inline wxPoint2DDouble Interpolate( wxInt32 widthfactor , wxInt32 heightfactor )
+ { return wxPoint2DDouble( m_x + m_width * widthfactor , m_y + m_height * heightfactor ); }
+
+ static void Intersect( const wxRect2DDouble &src1 , const wxRect2DDouble &src2 , wxRect2DDouble *dest );
+ inline void Intersect( const wxRect2DDouble &otherRect )
+ { Intersect( *this , otherRect , this ); }
+ inline wxRect2DDouble CreateIntersection( const wxRect2DDouble &otherRect ) const
+ { wxRect2DDouble result; Intersect( *this , otherRect , &result); return result; }
+ bool Intersects( const wxRect2DDouble &rect ) const;
+
+ static void Union( const wxRect2DDouble &src1 , const wxRect2DDouble &src2 , wxRect2DDouble *dest );
+ void Union( const wxRect2DDouble &otherRect )
+ { Union( *this , otherRect , this ); }
+ void Union( const wxPoint2DDouble &pt );
+ inline wxRect2DDouble CreateUnion( const wxRect2DDouble &otherRect ) const
+ { wxRect2DDouble result; Union( *this , otherRect , &result); return result; }
+
+ inline void Scale( wxDouble f )
+ { m_x *= f; m_y *= f; m_width *= f; m_height *= f;}
+ inline void Scale( wxInt32 num , wxInt32 denum )
+ { m_x *= ((wxDouble)num)/((wxDouble)denum); m_y *= ((wxDouble)num)/((wxDouble)denum);
+ m_width *= ((wxDouble)num)/((wxDouble)denum); m_height *= ((wxDouble)num)/((wxDouble)denum);}
+
+ wxRect2DDouble& operator = (const wxRect2DDouble& rect);
+ inline bool operator == (const wxRect2DDouble& rect) const
+ { return wxIsSameDouble(m_x, rect.m_x) && wxIsSameDouble(m_y, rect.m_y) && HaveEqualSize(rect); }
+ inline bool operator != (const wxRect2DDouble& rect) const
+ { return !(*this == rect); }
+
+ wxDouble m_x;
+ wxDouble m_y;
+ wxDouble m_width;
+ wxDouble m_height;
+};
+
+
+// wxRect2Ds are a axis-aligned rectangles, each side of the rect is parallel to the x- or m_y- axis. The rectangle is either defined by the
+// top left and bottom right corner, or by the top left corner and size. A point is contained within the rectangle if
+// left <= x < right and top <= m_y < bottom , thus it is a half open interval.
+
+class WXDLLIMPEXP_CORE wxRect2DInt
+{
+public:
+ wxRect2DInt() { m_x = m_y = m_width = m_height = 0; }
+ wxRect2DInt( const wxRect& r ) { m_x = r.x ; m_y = r.y ; m_width = r.width ; m_height = r.height ; }
+ wxRect2DInt(wxInt32 x, wxInt32 y, wxInt32 w, wxInt32 h) { m_x = x; m_y = y; m_width = w; m_height = h; }
+ wxRect2DInt(const wxPoint2DInt& topLeft, const wxPoint2DInt& bottomRight);
+ inline wxRect2DInt(const wxPoint2DInt& pos, const wxSize& size);
+ inline wxRect2DInt(const wxRect2DInt& rect);
+
+ // single attribute accessors
+
+ wxPoint2DInt GetPosition() const { return wxPoint2DInt(m_x, m_y); }
+ wxSize GetSize() const { return wxSize(m_width, m_height); }
+
+ // for the edge and corner accessors there are two setters counterparts, the Set.. functions keep the other corners at their
+ // position whenever sensible, the Move.. functions keep the size of the rect and move the other corners appropriately
+
+ inline wxInt32 GetLeft() const { return m_x; }
+ inline void SetLeft( wxInt32 n ) { m_width += m_x - n; m_x = n; }
+ inline void MoveLeftTo( wxInt32 n ) { m_x = n; }
+ inline wxInt32 GetTop() const { return m_y; }
+ inline void SetTop( wxInt32 n ) { m_height += m_y - n; m_y = n; }
+ inline void MoveTopTo( wxInt32 n ) { m_y = n; }
+ inline wxInt32 GetBottom() const { return m_y + m_height; }
+ inline void SetBottom( wxInt32 n ) { m_height += n - (m_y+m_height);}
+ inline void MoveBottomTo( wxInt32 n ) { m_y = n - m_height; }
+ inline wxInt32 GetRight() const { return m_x + m_width; }
+ inline void SetRight( wxInt32 n ) { m_width += n - (m_x+m_width) ; }
+ inline void MoveRightTo( wxInt32 n ) { m_x = n - m_width; }
+
+ inline wxPoint2DInt GetLeftTop() const { return wxPoint2DInt( m_x , m_y ); }
+ inline void SetLeftTop( const wxPoint2DInt &pt ) { m_width += m_x - pt.m_x; m_height += m_y - pt.m_y; m_x = pt.m_x; m_y = pt.m_y; }
+ inline void MoveLeftTopTo( const wxPoint2DInt &pt ) { m_x = pt.m_x; m_y = pt.m_y; }
+ inline wxPoint2DInt GetLeftBottom() const { return wxPoint2DInt( m_x , m_y + m_height ); }
+ inline void SetLeftBottom( const wxPoint2DInt &pt ) { m_width += m_x - pt.m_x; m_height += pt.m_y - (m_y+m_height) ; m_x = pt.m_x; }
+ inline void MoveLeftBottomTo( const wxPoint2DInt &pt ) { m_x = pt.m_x; m_y = pt.m_y - m_height; }
+ inline wxPoint2DInt GetRightTop() const { return wxPoint2DInt( m_x+m_width , m_y ); }
+ inline void SetRightTop( const wxPoint2DInt &pt ) { m_width += pt.m_x - ( m_x + m_width ); m_height += m_y - pt.m_y; m_y = pt.m_y; }
+ inline void MoveRightTopTo( const wxPoint2DInt &pt ) { m_x = pt.m_x - m_width; m_y = pt.m_y; }
+ inline wxPoint2DInt GetRightBottom() const { return wxPoint2DInt( m_x+m_width , m_y + m_height ); }
+ inline void SetRightBottom( const wxPoint2DInt &pt ) { m_width += pt.m_x - ( m_x + m_width ); m_height += pt.m_y - (m_y+m_height);}
+ inline void MoveRightBottomTo( const wxPoint2DInt &pt ) { m_x = pt.m_x - m_width; m_y = pt.m_y - m_height; }
+ inline wxPoint2DInt GetCentre() const { return wxPoint2DInt( m_x+m_width/2 , m_y+m_height/2 ); }
+ inline void SetCentre( const wxPoint2DInt &pt ) { MoveCentreTo( pt ); } // since this is impossible without moving...
+ inline void MoveCentreTo( const wxPoint2DInt &pt ) { m_x += pt.m_x - (m_x+m_width/2) , m_y += pt.m_y -(m_y+m_height/2); }
+ inline wxOutCode GetOutCode( const wxPoint2DInt &pt ) const
+ { return (wxOutCode) (( ( pt.m_x < m_x ) ? wxOutLeft : 0 ) +
+ ( ( pt.m_x >= m_x + m_width ) ? wxOutRight : 0 ) +
+ ( ( pt.m_y < m_y ) ? wxOutTop : 0 ) +
+ ( ( pt.m_y >= m_y + m_height ) ? wxOutBottom : 0 )); }
+ inline wxOutCode GetOutcode( const wxPoint2DInt &pt ) const
+ { return GetOutCode( pt ) ; }
+ inline bool Contains( const wxPoint2DInt &pt ) const
+ { return GetOutCode( pt ) == wxInside; }
+ inline bool Contains( const wxRect2DInt &rect ) const
+ { return ( ( ( m_x <= rect.m_x ) && ( rect.m_x + rect.m_width <= m_x + m_width ) ) &&
+ ( ( m_y <= rect.m_y ) && ( rect.m_y + rect.m_height <= m_y + m_height ) ) ); }
+ inline bool IsEmpty() const
+ { return ( m_width <= 0 || m_height <= 0 ); }
+ inline bool HaveEqualSize( const wxRect2DInt &rect ) const
+ { return ( rect.m_width == m_width && rect.m_height == m_height ); }
+
+ inline void Inset( wxInt32 x , wxInt32 y ) { m_x += x; m_y += y; m_width -= 2 * x; m_height -= 2 * y; }
+ inline void Inset( wxInt32 left , wxInt32 top ,wxInt32 right , wxInt32 bottom )
+ { m_x += left; m_y += top; m_width -= left + right; m_height -= top + bottom;}
+ inline void Offset( const wxPoint2DInt &pt ) { m_x += pt.m_x; m_y += pt.m_y; }
+ void ConstrainTo( const wxRect2DInt &rect );
+ inline wxPoint2DInt Interpolate( wxInt32 widthfactor , wxInt32 heightfactor ) { return wxPoint2DInt( m_x + m_width * widthfactor , m_y + m_height * heightfactor ); }
+
+ static void Intersect( const wxRect2DInt &src1 , const wxRect2DInt &src2 , wxRect2DInt *dest );
+ inline void Intersect( const wxRect2DInt &otherRect ) { Intersect( *this , otherRect , this ); }
+ inline wxRect2DInt CreateIntersection( const wxRect2DInt &otherRect ) const { wxRect2DInt result; Intersect( *this , otherRect , &result); return result; }
+ bool Intersects( const wxRect2DInt &rect ) const;
+
+ static void Union( const wxRect2DInt &src1 , const wxRect2DInt &src2 , wxRect2DInt *dest );
+ void Union( const wxRect2DInt &otherRect ) { Union( *this , otherRect , this ); }
+ void Union( const wxPoint2DInt &pt );
+ inline wxRect2DInt CreateUnion( const wxRect2DInt &otherRect ) const { wxRect2DInt result; Union( *this , otherRect , &result); return result; }
+
+ inline void Scale( wxInt32 f ) { m_x *= f; m_y *= f; m_width *= f; m_height *= f;}
+ inline void Scale( wxInt32 num , wxInt32 denum )
+ { m_x *= ((wxInt32)num)/((wxInt32)denum); m_y *= ((wxInt32)num)/((wxInt32)denum);
+ m_width *= ((wxInt32)num)/((wxInt32)denum); m_height *= ((wxInt32)num)/((wxInt32)denum);}
+
+ wxRect2DInt& operator = (const wxRect2DInt& rect);
+ bool operator == (const wxRect2DInt& rect) const;
+ bool operator != (const wxRect2DInt& rect) const;
+
+#if wxUSE_STREAMS
+ void WriteTo( wxDataOutputStream &stream ) const;
+ void ReadFrom( wxDataInputStream &stream );
+#endif // wxUSE_STREAMS
+
+ wxInt32 m_x;
+ wxInt32 m_y;
+ wxInt32 m_width;
+ wxInt32 m_height;
+};
+
+inline wxRect2DInt::wxRect2DInt( const wxRect2DInt &r )
+{
+ m_x = r.m_x;
+ m_y = r.m_y;
+ m_width = r.m_width;
+ m_height = r.m_height;
+}
+
+inline wxRect2DInt::wxRect2DInt( const wxPoint2DInt &a , const wxPoint2DInt &b)
+{
+ m_x = wxMin( a.m_x , b.m_x );
+ m_y = wxMin( a.m_y , b.m_y );
+ m_width = abs( a.m_x - b.m_x );
+ m_height = abs( a.m_y - b.m_y );
+}
+
+inline wxRect2DInt::wxRect2DInt( const wxPoint2DInt& pos, const wxSize& size)
+{
+ m_x = pos.m_x;
+ m_y = pos.m_y;
+ m_width = size.x;
+ m_height = size.y;
+}
+
+inline bool wxRect2DInt::operator == (const wxRect2DInt& rect) const
+{
+ return (m_x==rect.m_x && m_y==rect.m_y &&
+ m_width==rect.m_width && m_height==rect.m_height);
+}
+
+inline bool wxRect2DInt::operator != (const wxRect2DInt& rect) const
+{
+ return !(*this == rect);
+}
+
+class WXDLLIMPEXP_CORE wxTransform2D
+{
+public :
+ virtual ~wxTransform2D() { }
+ virtual void Transform( wxPoint2DInt* pt )const = 0;
+ virtual void Transform( wxRect2DInt* r ) const;
+ virtual wxPoint2DInt Transform( const wxPoint2DInt &pt ) const;
+ virtual wxRect2DInt Transform( const wxRect2DInt &r ) const ;
+
+ virtual void InverseTransform( wxPoint2DInt* pt ) const = 0;
+ virtual void InverseTransform( wxRect2DInt* r ) const ;
+ virtual wxPoint2DInt InverseTransform( const wxPoint2DInt &pt ) const ;
+ virtual wxRect2DInt InverseTransform( const wxRect2DInt &r ) const ;
+};
+
+
+#endif // wxUSE_GEOMETRY
+
+#endif // _WX_GEOMETRY_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gifdecod.h
+// Purpose: wxGIFDecoder, GIF reader for wxImage and wxAnimation
+// Author: Guillermo Rodriguez Garcia <guille@iies.es>
+// Version: 3.02
+// Copyright: (c) 1999 Guillermo Rodriguez Garcia
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GIFDECOD_H_
+#define _WX_GIFDECOD_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_STREAMS && wxUSE_GIF
+
+#include "wx/stream.h"
+#include "wx/image.h"
+#include "wx/animdecod.h"
+#include "wx/dynarray.h"
+
+// internal utility used to store a frame in 8bit-per-pixel format
+class GIFImage;
+
+
+// --------------------------------------------------------------------------
+// Constants
+// --------------------------------------------------------------------------
+
+// Error codes:
+// Note that the error code wxGIF_TRUNCATED means that the image itself
+// is most probably OK, but the decoder didn't reach the end of the data
+// stream; this means that if it was not reading directly from file,
+// the stream will not be correctly positioned.
+//
+enum wxGIFErrorCode
+{
+ wxGIF_OK = 0, // everything was OK
+ wxGIF_INVFORMAT, // error in GIF header
+ wxGIF_MEMERR, // error allocating memory
+ wxGIF_TRUNCATED // file appears to be truncated
+};
+
+// --------------------------------------------------------------------------
+// wxGIFDecoder class
+// --------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxGIFDecoder : public wxAnimationDecoder
+{
+public:
+ // constructor, destructor, etc.
+ wxGIFDecoder();
+ ~wxGIFDecoder();
+
+ // get data of current frame
+ unsigned char* GetData(unsigned int frame) const;
+ unsigned char* GetPalette(unsigned int frame) const;
+ unsigned int GetNcolours(unsigned int frame) const;
+ int GetTransparentColourIndex(unsigned int frame) const;
+ wxColour GetTransparentColour(unsigned int frame) const;
+
+ virtual wxSize GetFrameSize(unsigned int frame) const;
+ virtual wxPoint GetFramePosition(unsigned int frame) const;
+ virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const;
+ virtual long GetDelay(unsigned int frame) const;
+
+ // GIFs can contain both static images and animations
+ bool IsAnimation() const
+ { return m_nFrames > 1; }
+
+ // load function which returns more info than just Load():
+ wxGIFErrorCode LoadGIF( wxInputStream& stream );
+
+ // free all internal frames
+ void Destroy();
+
+ // implementation of wxAnimationDecoder's pure virtuals
+ virtual bool Load( wxInputStream& stream )
+ { return LoadGIF(stream) == wxGIF_OK; }
+
+ bool ConvertToImage(unsigned int frame, wxImage *image) const;
+
+ wxAnimationDecoder *Clone() const
+ { return new wxGIFDecoder; }
+ wxAnimationType GetType() const
+ { return wxANIMATION_TYPE_GIF; }
+
+private:
+ // wxAnimationDecoder pure virtual
+ virtual bool DoCanRead( wxInputStream& stream ) const;
+ // modifies current stream position (see wxAnimationDecoder::CanRead)
+
+ int getcode(wxInputStream& stream, int bits, int abfin);
+ wxGIFErrorCode dgif(wxInputStream& stream,
+ GIFImage *img, int interl, int bits);
+
+
+ // array of all frames
+ wxArrayPtrVoid m_frames;
+
+ // decoder state vars
+ int m_restbits; // remaining valid bits
+ unsigned int m_restbyte; // remaining bytes in this block
+ unsigned int m_lastbyte; // last byte read
+ unsigned char m_buffer[256]; // buffer for reading
+ unsigned char *m_bufp; // pointer to next byte in buffer
+
+ wxDECLARE_NO_COPY_CLASS(wxGIFDecoder);
+};
+
+#endif // wxUSE_STREAMS && wxUSE_GIF
+
+#endif // _WX_GIFDECOD_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/glcanvas.h
+// Purpose: wxGLCanvas base header
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GLCANVAS_H_BASE_
+#define _WX_GLCANVAS_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_GLCANVAS
+
+#include "wx/app.h"
+#include "wx/palette.h"
+#include "wx/window.h"
+
+class WXDLLIMPEXP_FWD_GL wxGLCanvas;
+class WXDLLIMPEXP_FWD_GL wxGLContext;
+
+// ----------------------------------------------------------------------------
+// Constants for attributes list
+// ----------------------------------------------------------------------------
+
+// Notice that not all implementation support options such as stereo, auxiliary
+// buffers, alpha channel, and accumulator buffer, use IsDisplaySupported() to
+// check for individual attributes support.
+enum
+{
+ WX_GL_RGBA = 1, // use true color palette (on if no attrs specified)
+ WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA
+ WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay
+ WX_GL_DOUBLEBUFFER, // use double buffering (on if no attrs specified)
+ WX_GL_STEREO, // use stereoscopic display
+ WX_GL_AUX_BUFFERS, // number of auxiliary buffers
+ WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits)
+ WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits)
+ WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits)
+ WX_GL_MIN_ALPHA, // use alpha buffer with most bits (> MIN_ALPHA bits)
+ WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32)
+ WX_GL_STENCIL_SIZE, // bits for stencil buffer
+ WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
+ WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
+ WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
+ WX_GL_MIN_ACCUM_ALPHA, // use alpha buffer with most bits (> MIN_ACCUM_ALPHA bits)
+ WX_GL_SAMPLE_BUFFERS, // 1 for multisampling support (antialiasing)
+ WX_GL_SAMPLES // 4 for 2x2 antialiasing supersampling on most graphics cards
+};
+
+#define wxGLCanvasName wxT("GLCanvas")
+
+// ----------------------------------------------------------------------------
+// wxGLContextBase: OpenGL rendering context
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_GL wxGLContextBase : public wxObject
+{
+public:
+ /*
+ The derived class should provide a ctor with this signature:
+
+ wxGLContext(wxGLCanvas *win, const wxGLContext *other = NULL);
+ */
+
+ // set this context as the current one
+ virtual bool SetCurrent(const wxGLCanvas& win) const = 0;
+};
+
+// ----------------------------------------------------------------------------
+// wxGLCanvasBase: window which can be used for OpenGL rendering
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_GL wxGLCanvasBase : public wxWindow
+{
+public:
+ // default ctor doesn't initialize the window, use Create() later
+ wxGLCanvasBase();
+
+ virtual ~wxGLCanvasBase();
+
+
+ /*
+ The derived class should provide a ctor with this signature:
+
+ wxGLCanvas(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ int* attribList = 0,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxGLCanvasName,
+ const wxPalette& palette = wxNullPalette);
+ */
+
+ // operations
+ // ----------
+
+ // set the given context associated with this window as the current one
+ bool SetCurrent(const wxGLContext& context) const;
+
+ // flush the back buffer (if we have it)
+ virtual bool SwapBuffers() = 0;
+
+
+ // accessors
+ // ---------
+
+ // check if the given attributes are supported without creating a canvas
+ static bool IsDisplaySupported(const int *attribList);
+
+#if wxUSE_PALETTE
+ const wxPalette *GetPalette() const { return &m_palette; }
+#endif // wxUSE_PALETTE
+
+ // miscellaneous helper functions
+ // ------------------------------
+
+ // call glcolor() for the colour with the given name, return false if
+ // colour not found
+ bool SetColour(const wxString& colour);
+
+ // return true if the extension with given name is supported
+ //
+ // notice that while this function is implemented for all of GLX, WGL and
+ // AGL the extensions names are usually not the same for different
+ // platforms and so the code using it still usually uses conditional
+ // compilation
+ static bool IsExtensionSupported(const char *extension);
+
+ // deprecated methods using the implicit wxGLContext
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED( wxGLContext* GetContext() const );
+
+ wxDEPRECATED( void SetCurrent() );
+
+ wxDEPRECATED( void OnSize(wxSizeEvent& event) );
+#endif // WXWIN_COMPATIBILITY_2_8
+
+#ifdef __WXUNIVERSAL__
+ // resolve the conflict with wxWindowUniv::SetCurrent()
+ virtual bool SetCurrent(bool doit) { return wxWindow::SetCurrent(doit); }
+#endif
+
+protected:
+ // override this to implement SetColour() in GL_INDEX_MODE
+ // (currently only implemented in wxX11 and wxMotif ports)
+ virtual int GetColourIndex(const wxColour& WXUNUSED(col)) { return -1; }
+
+ // check if the given extension name is present in the space-separated list
+ // of extensions supported by the current implementation such as returned
+ // by glXQueryExtensionsString() or glGetString(GL_EXTENSIONS)
+ static bool IsExtensionInList(const char *list, const char *extension);
+
+#if wxUSE_PALETTE
+ // create default palette if we're not using RGBA mode
+ // (not supported in most ports)
+ virtual wxPalette CreateDefaultPalette() { return wxNullPalette; }
+
+ wxPalette m_palette;
+#endif // wxUSE_PALETTE
+
+#if WXWIN_COMPATIBILITY_2_8
+ wxGLContext *m_glContext;
+#endif // WXWIN_COMPATIBILITY_2_8
+};
+
+// ----------------------------------------------------------------------------
+// wxGLApp: a special wxApp subclass for OpenGL applications which must be used
+// to select a visual compatible with the given attributes
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_GL wxGLAppBase : public wxApp
+{
+public:
+ wxGLAppBase() : wxApp() { }
+
+ // use this in the constructor of the user-derived wxGLApp class to
+ // determine if an OpenGL rendering context with these attributes
+ // is available - returns true if so, false if not.
+ virtual bool InitGLVisual(const int *attribList) = 0;
+};
+
+#if defined(__WXMSW__)
+ #include "wx/msw/glcanvas.h"
+#elif defined(__WXMOTIF__) || defined(__WXX11__)
+ #include "wx/x11/glcanvas.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/glcanvas.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/glcanvas.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/glcanvas.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/glcanvas.h"
+#else
+ #error "wxGLCanvas not supported in this wxWidgets port"
+#endif
+
+// wxMac and wxMSW don't need anything extra in wxGLAppBase, so declare it here
+#ifndef wxGL_APP_DEFINED
+
+class WXDLLIMPEXP_GL wxGLApp : public wxGLAppBase
+{
+public:
+ wxGLApp() : wxGLAppBase() { }
+
+ virtual bool InitGLVisual(const int *attribList);
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxGLApp)
+};
+
+#endif // !wxGL_APP_DEFINED
+
+// ----------------------------------------------------------------------------
+// wxGLAPI: an API wrapper that allows the use of 'old' APIs even on OpenGL
+// platforms that don't support it natively anymore, if the APIs are available
+// it's a mere redirect
+// ----------------------------------------------------------------------------
+
+#ifndef wxUSE_OPENGL_EMULATION
+ #define wxUSE_OPENGL_EMULATION 0
+#endif
+
+class WXDLLIMPEXP_GL wxGLAPI : public wxObject
+{
+public:
+ wxGLAPI();
+ ~wxGLAPI();
+
+ static void glFrustum(GLfloat left, GLfloat right, GLfloat bottom,
+ GLfloat top, GLfloat zNear, GLfloat zFar);
+ static void glBegin(GLenum mode);
+ static void glTexCoord2f(GLfloat s, GLfloat t);
+ static void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
+ static void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
+ static void glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
+ static void glColor3f(GLfloat r, GLfloat g, GLfloat b);
+ static void glEnd();
+};
+
+#endif // wxUSE_GLCANVAS
+
+#endif // _WX_GLCANVAS_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/graphics.h
+// Purpose: graphics context header
+// Author: Stefan Csomor
+// Modified by:
+// Created:
+// Copyright: (c) Stefan Csomor
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GRAPHICS_H_
+#define _WX_GRAPHICS_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_GRAPHICS_CONTEXT
+
+#include "wx/geometry.h"
+#include "wx/dynarray.h"
+#include "wx/dc.h"
+#include "wx/image.h"
+#include "wx/vector.h"
+
+enum wxAntialiasMode
+{
+ wxANTIALIAS_NONE, // should be 0
+ wxANTIALIAS_DEFAULT
+};
+
+enum wxInterpolationQuality
+{
+ // default interpolation
+ wxINTERPOLATION_DEFAULT,
+ // no interpolation
+ wxINTERPOLATION_NONE,
+ // fast interpolation, suited for interactivity
+ wxINTERPOLATION_FAST,
+ // better quality
+ wxINTERPOLATION_GOOD,
+ // best quality, not suited for interactivity
+ wxINTERPOLATION_BEST
+};
+
+enum wxCompositionMode
+{
+ // R = Result, S = Source, D = Destination, premultiplied with alpha
+ // Ra, Sa, Da their alpha components
+
+ // classic Porter-Duff compositions
+ // http://keithp.com/~keithp/porterduff/p253-porter.pdf
+
+ wxCOMPOSITION_INVALID = -1, /* indicates invalid/unsupported mode */
+ wxCOMPOSITION_CLEAR, /* R = 0 */
+ wxCOMPOSITION_SOURCE, /* R = S */
+ wxCOMPOSITION_OVER, /* R = S + D*(1 - Sa) */
+ wxCOMPOSITION_IN, /* R = S*Da */
+ wxCOMPOSITION_OUT, /* R = S*(1 - Da) */
+ wxCOMPOSITION_ATOP, /* R = S*Da + D*(1 - Sa) */
+
+ wxCOMPOSITION_DEST, /* R = D, essentially a noop */
+ wxCOMPOSITION_DEST_OVER, /* R = S*(1 - Da) + D */
+ wxCOMPOSITION_DEST_IN, /* R = D*Sa */
+ wxCOMPOSITION_DEST_OUT, /* R = D*(1 - Sa) */
+ wxCOMPOSITION_DEST_ATOP, /* R = S*(1 - Da) + D*Sa */
+ wxCOMPOSITION_XOR, /* R = S*(1 - Da) + D*(1 - Sa) */
+
+ // mathematical compositions
+ wxCOMPOSITION_ADD /* R = S + D */
+};
+
+class WXDLLIMPEXP_FWD_CORE wxWindowDC;
+class WXDLLIMPEXP_FWD_CORE wxMemoryDC;
+#if wxUSE_PRINTING_ARCHITECTURE
+class WXDLLIMPEXP_FWD_CORE wxPrinterDC;
+#endif
+#ifdef __WXMSW__
+#if wxUSE_ENH_METAFILE
+class WXDLLIMPEXP_FWD_CORE wxEnhMetaFileDC;
+#endif
+#endif
+class WXDLLIMPEXP_FWD_CORE wxGraphicsContext;
+class WXDLLIMPEXP_FWD_CORE wxGraphicsPath;
+class WXDLLIMPEXP_FWD_CORE wxGraphicsMatrix;
+class WXDLLIMPEXP_FWD_CORE wxGraphicsFigure;
+class WXDLLIMPEXP_FWD_CORE wxGraphicsRenderer;
+class WXDLLIMPEXP_FWD_CORE wxGraphicsPen;
+class WXDLLIMPEXP_FWD_CORE wxGraphicsBrush;
+class WXDLLIMPEXP_FWD_CORE wxGraphicsFont;
+class WXDLLIMPEXP_FWD_CORE wxGraphicsBitmap;
+
+/*
+ * notes about the graphics context apis
+ *
+ * angles : are measured in radians, 0.0 being in direction of positiv x axis, PI/2 being
+ * in direction of positive y axis.
+ */
+
+// Base class of all objects used for drawing in the new graphics API, the always point back to their
+// originating rendering engine, there is no dynamic unloading of a renderer currently allowed,
+// these references are not counted
+
+//
+// The data used by objects like graphics pens etc is ref counted, in order to avoid unnecessary expensive
+// duplication. Any operation on a shared instance that results in a modified state, uncouples this
+// instance from the other instances that were shared - using copy on write semantics
+//
+
+class WXDLLIMPEXP_FWD_CORE wxGraphicsObjectRefData;
+class WXDLLIMPEXP_FWD_CORE wxGraphicsBitmapData;
+class WXDLLIMPEXP_FWD_CORE wxGraphicsMatrixData;
+class WXDLLIMPEXP_FWD_CORE wxGraphicsPathData;
+
+class WXDLLIMPEXP_CORE wxGraphicsObject : public wxObject
+{
+public:
+ wxGraphicsObject();
+ wxGraphicsObject( wxGraphicsRenderer* renderer );
+ virtual ~wxGraphicsObject();
+
+ bool IsNull() const;
+
+ // returns the renderer that was used to create this instance, or NULL if it has not been initialized yet
+ wxGraphicsRenderer* GetRenderer() const;
+ wxGraphicsObjectRefData* GetGraphicsData() const;
+protected:
+ virtual wxObjectRefData* CreateRefData() const;
+ virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const;
+
+ DECLARE_DYNAMIC_CLASS(wxGraphicsObject)
+};
+
+class WXDLLIMPEXP_CORE wxGraphicsPen : public wxGraphicsObject
+{
+public:
+ wxGraphicsPen() {}
+ virtual ~wxGraphicsPen() {}
+private:
+ DECLARE_DYNAMIC_CLASS(wxGraphicsPen)
+};
+
+extern WXDLLIMPEXP_DATA_CORE(wxGraphicsPen) wxNullGraphicsPen;
+
+class WXDLLIMPEXP_CORE wxGraphicsBrush : public wxGraphicsObject
+{
+public:
+ wxGraphicsBrush() {}
+ virtual ~wxGraphicsBrush() {}
+private:
+ DECLARE_DYNAMIC_CLASS(wxGraphicsBrush)
+};
+
+extern WXDLLIMPEXP_DATA_CORE(wxGraphicsBrush) wxNullGraphicsBrush;
+
+class WXDLLIMPEXP_CORE wxGraphicsFont : public wxGraphicsObject
+{
+public:
+ wxGraphicsFont() {}
+ virtual ~wxGraphicsFont() {}
+private:
+ DECLARE_DYNAMIC_CLASS(wxGraphicsFont)
+};
+
+extern WXDLLIMPEXP_DATA_CORE(wxGraphicsFont) wxNullGraphicsFont;
+
+class WXDLLIMPEXP_CORE wxGraphicsBitmap : public wxGraphicsObject
+{
+public:
+ wxGraphicsBitmap() {}
+ virtual ~wxGraphicsBitmap() {}
+
+ // Convert bitmap to wxImage: this is more efficient than converting to
+ // wxBitmap first and then to wxImage and also works without X server
+ // connection under Unix that wxBitmap requires.
+#if wxUSE_IMAGE
+ wxImage ConvertToImage() const;
+#endif // wxUSE_IMAGE
+
+ void* GetNativeBitmap() const;
+
+ const wxGraphicsBitmapData* GetBitmapData() const
+ { return (const wxGraphicsBitmapData*) GetRefData(); }
+ wxGraphicsBitmapData* GetBitmapData()
+ { return (wxGraphicsBitmapData*) GetRefData(); }
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxGraphicsBitmap)
+};
+
+extern WXDLLIMPEXP_DATA_CORE(wxGraphicsBitmap) wxNullGraphicsBitmap;
+
+class WXDLLIMPEXP_CORE wxGraphicsMatrix : public wxGraphicsObject
+{
+public:
+ wxGraphicsMatrix() {}
+
+ virtual ~wxGraphicsMatrix() {}
+
+ // concatenates the matrix
+ virtual void Concat( const wxGraphicsMatrix *t );
+ void Concat( const wxGraphicsMatrix &t ) { Concat( &t ); }
+
+ // sets the matrix to the respective values
+ virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0,
+ wxDouble tx=0.0, wxDouble ty=0.0);
+
+ // gets the component valuess of the matrix
+ virtual void Get(wxDouble* a=NULL, wxDouble* b=NULL, wxDouble* c=NULL,
+ wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const;
+
+ // makes this the inverse matrix
+ virtual void Invert();
+
+ // returns true if the elements of the transformation matrix are equal ?
+ virtual bool IsEqual( const wxGraphicsMatrix* t) const;
+ bool IsEqual( const wxGraphicsMatrix& t) const { return IsEqual( &t ); }
+
+ // return true if this is the identity matrix
+ virtual bool IsIdentity() const;
+
+ //
+ // transformation
+ //
+
+ // add the translation to this matrix
+ virtual void Translate( wxDouble dx , wxDouble dy );
+
+ // add the scale to this matrix
+ virtual void Scale( wxDouble xScale , wxDouble yScale );
+
+ // add the rotation to this matrix (radians)
+ virtual void Rotate( wxDouble angle );
+
+ //
+ // apply the transforms
+ //
+
+ // applies that matrix to the point
+ virtual void TransformPoint( wxDouble *x, wxDouble *y ) const;
+
+ // applies the matrix except for translations
+ virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) const;
+
+ // returns the native representation
+ virtual void * GetNativeMatrix() const;
+
+ const wxGraphicsMatrixData* GetMatrixData() const
+ { return (const wxGraphicsMatrixData*) GetRefData(); }
+ wxGraphicsMatrixData* GetMatrixData()
+ { return (wxGraphicsMatrixData*) GetRefData(); }
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxGraphicsMatrix)
+};
+
+extern WXDLLIMPEXP_DATA_CORE(wxGraphicsMatrix) wxNullGraphicsMatrix;
+
+class WXDLLIMPEXP_CORE wxGraphicsPath : public wxGraphicsObject
+{
+public:
+ wxGraphicsPath() {}
+ virtual ~wxGraphicsPath() {}
+
+ //
+ // These are the path primitives from which everything else can be constructed
+ //
+
+ // begins a new subpath at (x,y)
+ virtual void MoveToPoint( wxDouble x, wxDouble y );
+ void MoveToPoint( const wxPoint2DDouble& p);
+
+ // adds a straight line from the current point to (x,y)
+ virtual void AddLineToPoint( wxDouble x, wxDouble y );
+ void AddLineToPoint( const wxPoint2DDouble& p);
+
+ // adds a cubic Bezier curve from the current point, using two control points and an end point
+ virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y );
+ void AddCurveToPoint( const wxPoint2DDouble& c1, const wxPoint2DDouble& c2, const wxPoint2DDouble& e);
+
+ // adds another path
+ virtual void AddPath( const wxGraphicsPath& path );
+
+ // closes the current sub-path
+ virtual void CloseSubpath();
+
+ // gets the last point of the current path, (0,0) if not yet set
+ virtual void GetCurrentPoint( wxDouble* x, wxDouble* y) const;
+ wxPoint2DDouble GetCurrentPoint() const;
+
+ // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle
+ virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise );
+ void AddArc( const wxPoint2DDouble& c, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise);
+
+ //
+ // These are convenience functions which - if not available natively will be assembled
+ // using the primitives from above
+ //
+
+ // adds a quadratic Bezier curve from the current point, using a control point and an end point
+ virtual void AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y );
+
+ // appends a rectangle as a new closed subpath
+ virtual void AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h );
+
+ // appends an ellipsis as a new closed subpath fitting the passed rectangle
+ virtual void AddCircle( wxDouble x, wxDouble y, wxDouble r );
+
+ // appends a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1)
+ virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r );
+
+ // appends an ellipse
+ virtual void AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h);
+
+ // appends a rounded rectangle
+ virtual void AddRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius);
+
+ // returns the native path
+ virtual void * GetNativePath() const;
+
+ // give the native path returned by GetNativePath() back (there might be some deallocations necessary)
+ virtual void UnGetNativePath(void *p)const;
+
+ // transforms each point of this path by the matrix
+ virtual void Transform( const wxGraphicsMatrix& matrix );
+
+ // gets the bounding box enclosing all points (possibly including control points)
+ virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h)const;
+ wxRect2DDouble GetBox()const;
+
+ virtual bool Contains( wxDouble x, wxDouble y, wxPolygonFillMode fillStyle = wxODDEVEN_RULE)const;
+ bool Contains( const wxPoint2DDouble& c, wxPolygonFillMode fillStyle = wxODDEVEN_RULE)const;
+
+ const wxGraphicsPathData* GetPathData() const
+ { return (const wxGraphicsPathData*) GetRefData(); }
+ wxGraphicsPathData* GetPathData()
+ { return (wxGraphicsPathData*) GetRefData(); }
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxGraphicsPath)
+};
+
+extern WXDLLIMPEXP_DATA_CORE(wxGraphicsPath) wxNullGraphicsPath;
+
+
+// Describes a single gradient stop.
+class wxGraphicsGradientStop
+{
+public:
+ wxGraphicsGradientStop(wxColour col = wxTransparentColour,
+ float pos = 0.)
+ : m_col(col),
+ m_pos(pos)
+ {
+ }
+
+ // default copy ctor, assignment operator and dtor are ok
+
+ const wxColour& GetColour() const { return m_col; }
+ void SetColour(const wxColour& col) { m_col = col; }
+
+ float GetPosition() const { return m_pos; }
+ void SetPosition(float pos)
+ {
+ wxASSERT_MSG( pos >= 0 && pos <= 1, "invalid gradient stop position" );
+
+ m_pos = pos;
+ }
+
+private:
+ // The colour of this gradient band.
+ wxColour m_col;
+
+ // Its starting position: 0 is the beginning and 1 is the end.
+ float m_pos;
+};
+
+// A collection of gradient stops ordered by their positions (from lowest to
+// highest). The first stop (index 0, position 0.0) is always the starting
+// colour and the last one (index GetCount() - 1, position 1.0) is the end
+// colour.
+class WXDLLIMPEXP_CORE wxGraphicsGradientStops
+{
+public:
+ wxGraphicsGradientStops(wxColour startCol = wxTransparentColour,
+ wxColour endCol = wxTransparentColour)
+ {
+ // we can't use Add() here as it relies on having start/end stops as
+ // first/last array elements so do it manually
+ m_stops.push_back(wxGraphicsGradientStop(startCol, 0.f));
+ m_stops.push_back(wxGraphicsGradientStop(endCol, 1.f));
+ }
+
+ // default copy ctor, assignment operator and dtor are ok for this class
+
+
+ // Add a stop in correct order.
+ void Add(const wxGraphicsGradientStop& stop);
+ void Add(wxColour col, float pos) { Add(wxGraphicsGradientStop(col, pos)); }
+
+ // Get the number of stops.
+ size_t GetCount() const { return m_stops.size(); }
+
+ // Return the stop at the given index (which must be valid).
+ wxGraphicsGradientStop Item(unsigned n) const { return m_stops.at(n); }
+
+ // Get/set start and end colours.
+ void SetStartColour(wxColour col)
+ { m_stops[0].SetColour(col); }
+ wxColour GetStartColour() const
+ { return m_stops[0].GetColour(); }
+ void SetEndColour(wxColour col)
+ { m_stops[m_stops.size() - 1].SetColour(col); }
+ wxColour GetEndColour() const
+ { return m_stops[m_stops.size() - 1].GetColour(); }
+
+private:
+ // All the stops stored in ascending order of positions.
+ wxVector<wxGraphicsGradientStop> m_stops;
+};
+
+class WXDLLIMPEXP_CORE wxGraphicsContext : public wxGraphicsObject
+{
+public:
+ wxGraphicsContext(wxGraphicsRenderer* renderer);
+
+ virtual ~wxGraphicsContext();
+
+ static wxGraphicsContext* Create( const wxWindowDC& dc);
+ static wxGraphicsContext * Create( const wxMemoryDC& dc);
+#if wxUSE_PRINTING_ARCHITECTURE
+ static wxGraphicsContext * Create( const wxPrinterDC& dc);
+#endif
+#ifdef __WXMSW__
+#if wxUSE_ENH_METAFILE
+ static wxGraphicsContext * Create( const wxEnhMetaFileDC& dc);
+#endif
+#endif
+
+ static wxGraphicsContext* CreateFromNative( void * context );
+
+ static wxGraphicsContext* CreateFromNativeWindow( void * window );
+
+ static wxGraphicsContext* Create( wxWindow* window );
+
+#if wxUSE_IMAGE
+ // Create a context for drawing onto a wxImage. The image life time must be
+ // greater than that of the context itself as when the context is destroyed
+ // it will copy its contents to the specified image.
+ static wxGraphicsContext* Create(wxImage& image);
+#endif // wxUSE_IMAGE
+
+ // create a context that can be used for measuring texts only, no drawing allowed
+ static wxGraphicsContext * Create();
+
+ // begin a new document (relevant only for printing / pdf etc) if there is a progress dialog, message will be shown
+ virtual bool StartDoc( const wxString& message );
+
+ // done with that document (relevant only for printing / pdf etc)
+ virtual void EndDoc();
+
+ // opens a new page (relevant only for printing / pdf etc) with the given size in points
+ // (if both are null the default page size will be used)
+ virtual void StartPage( wxDouble width = 0, wxDouble height = 0 );
+
+ // ends the current page (relevant only for printing / pdf etc)
+ virtual void EndPage();
+
+ // make sure that the current content of this context is immediately visible
+ virtual void Flush();
+
+ wxGraphicsPath CreatePath() const;
+
+ virtual wxGraphicsPen CreatePen(const wxPen& pen) const;
+
+ virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) const;
+
+ // sets the brush to a linear gradient, starting at (x1,y1) and ending at
+ // (x2,y2) with the given boundary colours or the specified stops
+ wxGraphicsBrush
+ CreateLinearGradientBrush(wxDouble x1, wxDouble y1,
+ wxDouble x2, wxDouble y2,
+ const wxColour& c1, const wxColour& c2) const;
+ wxGraphicsBrush
+ CreateLinearGradientBrush(wxDouble x1, wxDouble y1,
+ wxDouble x2, wxDouble y2,
+ const wxGraphicsGradientStops& stops) const;
+
+ // sets the brush to a radial gradient originating at (xo,yc) and ending
+ // on a circle around (xc,yc) with the given radius; the colours may be
+ // specified by just the two extremes or the full array of gradient stops
+ wxGraphicsBrush
+ CreateRadialGradientBrush(wxDouble xo, wxDouble yo,
+ wxDouble xc, wxDouble yc, wxDouble radius,
+ const wxColour& oColor, const wxColour& cColor) const;
+
+ wxGraphicsBrush
+ CreateRadialGradientBrush(wxDouble xo, wxDouble yo,
+ wxDouble xc, wxDouble yc, wxDouble radius,
+ const wxGraphicsGradientStops& stops) const;
+
+ // creates a font
+ virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) const;
+ virtual wxGraphicsFont CreateFont(double sizeInPixels,
+ const wxString& facename,
+ int flags = wxFONTFLAG_DEFAULT,
+ const wxColour& col = *wxBLACK) const;
+
+ // create a native bitmap representation
+ virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) const;
+#if wxUSE_IMAGE
+ wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image) const;
+#endif // wxUSE_IMAGE
+
+ // create a native bitmap representation
+ virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) const;
+
+ // create a 'native' matrix corresponding to these values
+ virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0,
+ wxDouble tx=0.0, wxDouble ty=0.0) const;
+
+ wxGraphicsMatrix CreateMatrix( const wxAffineMatrix2DBase& mat ) const
+ {
+ wxMatrix2D mat2D;
+ wxPoint2DDouble tr;
+ mat.Get(&mat2D, &tr);
+
+ return CreateMatrix(mat2D.m_11, mat2D.m_12, mat2D.m_21, mat2D.m_22,
+ tr.m_x, tr.m_y);
+ }
+
+ // push the current state of the context, ie the transformation matrix on a stack
+ virtual void PushState() = 0;
+
+ // pops a stored state from the stack
+ virtual void PopState() = 0;
+
+ // clips drawings to the region intersected with the current clipping region
+ virtual void Clip( const wxRegion ®ion ) = 0;
+
+ // clips drawings to the rect intersected with the current clipping region
+ virtual void Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0;
+
+ // resets the clipping to original extent
+ virtual void ResetClip() = 0;
+
+ // returns the native context
+ virtual void * GetNativeContext() = 0;
+
+ // returns the current shape antialiasing mode
+ virtual wxAntialiasMode GetAntialiasMode() const { return m_antialias; }
+
+ // sets the antialiasing mode, returns true if it supported
+ virtual bool SetAntialiasMode(wxAntialiasMode antialias) = 0;
+
+ // returns the current interpolation quality
+ virtual wxInterpolationQuality GetInterpolationQuality() const { return m_interpolation; }
+
+ // sets the interpolation quality, returns true if it supported
+ virtual bool SetInterpolationQuality(wxInterpolationQuality interpolation) = 0;
+
+ // returns the current compositing operator
+ virtual wxCompositionMode GetCompositionMode() const { return m_composition; }
+
+ // sets the compositing operator, returns true if it supported
+ virtual bool SetCompositionMode(wxCompositionMode op) = 0;
+
+ // returns the size of the graphics context in device coordinates
+ void GetSize(wxDouble* width, wxDouble* height) const
+ {
+ if ( width )
+ *width = m_width;
+ if ( height )
+ *height = m_height;
+ }
+
+ // returns the resolution of the graphics context in device points per inch
+ virtual void GetDPI( wxDouble* dpiX, wxDouble* dpiY);
+
+#if 0
+ // sets the current alpha on this context
+ virtual void SetAlpha( wxDouble alpha );
+
+ // returns the alpha on this context
+ virtual wxDouble GetAlpha() const;
+#endif
+
+ // all rendering is done into a fully transparent temporary context
+ virtual void BeginLayer(wxDouble opacity) = 0;
+
+ // composites back the drawings into the context with the opacity given at
+ // the BeginLayer call
+ virtual void EndLayer() = 0;
+
+ //
+ // transformation : changes the current transformation matrix CTM of the context
+ //
+
+ // translate
+ virtual void Translate( wxDouble dx , wxDouble dy ) = 0;
+
+ // scale
+ virtual void Scale( wxDouble xScale , wxDouble yScale ) = 0;
+
+ // rotate (radians)
+ virtual void Rotate( wxDouble angle ) = 0;
+
+ // concatenates this transform with the current transform of this context
+ virtual void ConcatTransform( const wxGraphicsMatrix& matrix ) = 0;
+
+ // sets the transform of this context
+ virtual void SetTransform( const wxGraphicsMatrix& matrix ) = 0;
+
+ // gets the matrix of this context
+ virtual wxGraphicsMatrix GetTransform() const = 0;
+ //
+ // setting the paint
+ //
+
+ // sets the pen
+ virtual void SetPen( const wxGraphicsPen& pen );
+
+ void SetPen( const wxPen& pen );
+
+ // sets the brush for filling
+ virtual void SetBrush( const wxGraphicsBrush& brush );
+
+ void SetBrush( const wxBrush& brush );
+
+ // sets the font
+ virtual void SetFont( const wxGraphicsFont& font );
+
+ void SetFont( const wxFont& font, const wxColour& colour );
+
+
+ // strokes along a path with the current pen
+ virtual void StrokePath( const wxGraphicsPath& path ) = 0;
+
+ // fills a path with the current brush
+ virtual void FillPath( const wxGraphicsPath& path, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ) = 0;
+
+ // draws a path by first filling and then stroking
+ virtual void DrawPath( const wxGraphicsPath& path, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
+
+ //
+ // text
+ //
+
+ void DrawText( const wxString &str, wxDouble x, wxDouble y )
+ { DoDrawText(str, x, y); }
+
+ void DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle )
+ { DoDrawRotatedText(str, x, y, angle); }
+
+ void DrawText( const wxString &str, wxDouble x, wxDouble y,
+ const wxGraphicsBrush& backgroundBrush )
+ { DoDrawFilledText(str, x, y, backgroundBrush); }
+
+ void DrawText( const wxString &str, wxDouble x, wxDouble y,
+ wxDouble angle, const wxGraphicsBrush& backgroundBrush )
+ { DoDrawRotatedFilledText(str, x, y, angle, backgroundBrush); }
+
+
+ virtual void GetTextExtent( const wxString &text, wxDouble *width, wxDouble *height,
+ wxDouble *descent = NULL, wxDouble *externalLeading = NULL ) const = 0;
+
+ virtual void GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const = 0;
+
+ //
+ // image support
+ //
+
+ virtual void DrawBitmap( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0;
+
+ virtual void DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0;
+
+ virtual void DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0;
+
+ //
+ // convenience methods
+ //
+
+ // strokes a single line
+ virtual void StrokeLine( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2);
+
+ // stroke lines connecting each of the points
+ virtual void StrokeLines( size_t n, const wxPoint2DDouble *points);
+
+ // stroke disconnected lines from begin to end points
+ virtual void StrokeLines( size_t n, const wxPoint2DDouble *beginPoints, const wxPoint2DDouble *endPoints);
+
+ // draws a polygon
+ virtual void DrawLines( size_t n, const wxPoint2DDouble *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
+
+ // draws a rectangle
+ virtual void DrawRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h);
+
+ // draws an ellipse
+ virtual void DrawEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h);
+
+ // draws a rounded rectangle
+ virtual void DrawRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius);
+
+ // wrappers using wxPoint2DDouble TODO
+
+ // helper to determine if a 0.5 offset should be applied for the drawing operation
+ virtual bool ShouldOffset() const { return false; }
+
+ // indicates whether the context should try to offset for pixel boundaries, this only makes sense on
+ // bitmap devices like screen, by default this is turned off
+ virtual void EnableOffset(bool enable = true);
+
+ void DisableOffset() { EnableOffset(false); }
+ bool OffsetEnabled() { return m_enableOffset; }
+
+protected:
+ // These fields must be initialized in the derived class ctors.
+ wxDouble m_width,
+ m_height;
+
+ wxGraphicsPen m_pen;
+ wxGraphicsBrush m_brush;
+ wxGraphicsFont m_font;
+ wxAntialiasMode m_antialias;
+ wxCompositionMode m_composition;
+ wxInterpolationQuality m_interpolation;
+ bool m_enableOffset;
+
+protected:
+ // implementations of overloaded public functions: we use different names
+ // for them to avoid the virtual function hiding problems in the derived
+ // classes
+ virtual void DoDrawText(const wxString& str, wxDouble x, wxDouble y) = 0;
+ virtual void DoDrawRotatedText(const wxString& str, wxDouble x, wxDouble y,
+ wxDouble angle);
+ virtual void DoDrawFilledText(const wxString& str, wxDouble x, wxDouble y,
+ const wxGraphicsBrush& backgroundBrush);
+ virtual void DoDrawRotatedFilledText(const wxString& str,
+ wxDouble x, wxDouble y,
+ wxDouble angle,
+ const wxGraphicsBrush& backgroundBrush);
+
+ wxDECLARE_NO_COPY_CLASS(wxGraphicsContext);
+ DECLARE_ABSTRACT_CLASS(wxGraphicsContext)
+};
+
+#if 0
+
+//
+// A graphics figure allows to cache path, pen etc creations, also will be a basis for layering/grouping elements
+//
+
+class WXDLLIMPEXP_CORE wxGraphicsFigure : public wxGraphicsObject
+{
+public:
+ wxGraphicsFigure(wxGraphicsRenderer* renderer);
+
+ virtual ~wxGraphicsFigure();
+
+ void SetPath( wxGraphicsMatrix* matrix );
+
+ void SetMatrix( wxGraphicsPath* path);
+
+ // draws this object on the context
+ virtual void Draw( wxGraphicsContext* cg );
+
+ // returns the path of this object
+ wxGraphicsPath* GetPath() { return m_path; }
+
+ // returns the transformation matrix of this object, may be null if there is no transformation necessary
+ wxGraphicsMatrix* GetMatrix() { return m_matrix; }
+
+private:
+ wxGraphicsMatrix* m_matrix;
+ wxGraphicsPath* m_path;
+
+ DECLARE_DYNAMIC_CLASS(wxGraphicsFigure)
+};
+
+#endif
+
+//
+// The graphics renderer is the instance corresponding to the rendering engine used, eg there is ONE core graphics renderer
+// instance on OSX. This instance is pointed back to by all objects created by it. Therefore you can create eg additional
+// paths at any point from a given matrix etc.
+//
+
+class WXDLLIMPEXP_CORE wxGraphicsRenderer : public wxObject
+{
+public:
+ wxGraphicsRenderer() {}
+
+ virtual ~wxGraphicsRenderer() {}
+
+ static wxGraphicsRenderer* GetDefaultRenderer();
+
+ static wxGraphicsRenderer* GetCairoRenderer();
+ // Context
+
+ virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc) = 0;
+ virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc) = 0;
+#if wxUSE_PRINTING_ARCHITECTURE
+ virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc) = 0;
+#endif
+#ifdef __WXMSW__
+#if wxUSE_ENH_METAFILE
+ virtual wxGraphicsContext * CreateContext( const wxEnhMetaFileDC& dc) = 0;
+#endif
+#endif
+
+ virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ) = 0;
+
+ virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window ) = 0;
+
+ virtual wxGraphicsContext * CreateContext( wxWindow* window ) = 0;
+
+#if wxUSE_IMAGE
+ virtual wxGraphicsContext * CreateContextFromImage(wxImage& image) = 0;
+#endif // wxUSE_IMAGE
+
+ // create a context that can be used for measuring texts only, no drawing allowed
+ virtual wxGraphicsContext * CreateMeasuringContext() = 0;
+
+ // Path
+
+ virtual wxGraphicsPath CreatePath() = 0;
+
+ // Matrix
+
+ virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0,
+ wxDouble tx=0.0, wxDouble ty=0.0) = 0;
+
+ // Paints
+
+ virtual wxGraphicsPen CreatePen(const wxPen& pen) = 0;
+
+ virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) = 0;
+
+ // Gradient brush creation functions may not honour all the stops specified
+ // stops and use just its boundary colours (this is currently the case
+ // under OS X)
+ virtual wxGraphicsBrush
+ CreateLinearGradientBrush(wxDouble x1, wxDouble y1,
+ wxDouble x2, wxDouble y2,
+ const wxGraphicsGradientStops& stops) = 0;
+
+ virtual wxGraphicsBrush
+ CreateRadialGradientBrush(wxDouble xo, wxDouble yo,
+ wxDouble xc, wxDouble yc,
+ wxDouble radius,
+ const wxGraphicsGradientStops& stops) = 0;
+
+ // sets the font
+ virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) = 0;
+ virtual wxGraphicsFont CreateFont(double sizeInPixels,
+ const wxString& facename,
+ int flags = wxFONTFLAG_DEFAULT,
+ const wxColour& col = *wxBLACK) = 0;
+
+ // create a native bitmap representation
+ virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) = 0;
+#if wxUSE_IMAGE
+ virtual wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image) = 0;
+ virtual wxImage CreateImageFromBitmap(const wxGraphicsBitmap& bmp) = 0;
+#endif // wxUSE_IMAGE
+
+ // create a graphics bitmap from a native bitmap
+ virtual wxGraphicsBitmap CreateBitmapFromNativeBitmap( void* bitmap ) = 0;
+
+ // create a subimage from a native image representation
+ virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0;
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxGraphicsRenderer);
+ DECLARE_ABSTRACT_CLASS(wxGraphicsRenderer)
+};
+
+
+#if wxUSE_IMAGE
+inline
+wxImage wxGraphicsBitmap::ConvertToImage() const
+{
+ wxGraphicsRenderer* renderer = GetRenderer();
+ return renderer ? renderer->CreateImageFromBitmap(*this) : wxNullImage;
+}
+#endif // wxUSE_IMAGE
+
+#endif // wxUSE_GRAPHICS_CONTEXT
+
+#endif // _WX_GRAPHICS_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/grid.h
+// Purpose: wxGrid base header
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GRID_H_BASE_
+#define _WX_GRID_H_BASE_
+
+#include "wx/generic/grid.h"
+
+// these headers used to be included from the above header but isn't any more,
+// still do it from here for compatibility
+#include "wx/generic/grideditors.h"
+#include "wx/generic/gridctrl.h"
+
+#endif // _WX_GRID_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/accel.h
+// Purpose: wxAcceleratorTable redirection file
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// VZ: keeping the old file just in case we're going to have a native GTK+
+// wxAcceleratorTable implementation one day, but for now use the generic
+// version
+#include "wx/generic/accel.h"
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/animate.h
+// Purpose: Animation classes
+// Author: Julian Smart and Guillermo Rodriguez Garcia
+// Modified by: Francesco Montorsi
+// Created: 13/8/99
+// Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTKANIMATEH__
+#define _WX_GTKANIMATEH__
+
+typedef struct _GdkPixbufAnimation GdkPixbufAnimation;
+typedef struct _GdkPixbufAnimationIter GdkPixbufAnimationIter;
+
+// ----------------------------------------------------------------------------
+// wxAnimation
+// Unlike the generic wxAnimation object (see generic\animate.cpp), we won't
+// use directly wxAnimationHandlers as gdk-pixbuf already provides the
+// concept of handler and will automatically use the available handlers.
+// Like generic wxAnimation object, this implementation of wxAnimation is
+// refcounted so that assignment is very fast
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxAnimation : public wxAnimationBase
+{
+public:
+ wxAnimation(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY)
+ : m_pixbuf(NULL) { LoadFile(name, type); }
+ wxAnimation(GdkPixbufAnimation *p = NULL);
+ wxAnimation(const wxAnimation&);
+ ~wxAnimation() { UnRef(); }
+
+ wxAnimation& operator= (const wxAnimation&);
+
+ virtual bool IsOk() const
+ { return m_pixbuf != NULL; }
+
+
+ // unfortunately GdkPixbufAnimation does not expose these info:
+
+ virtual unsigned int GetFrameCount() const { return 0; }
+ virtual wxImage GetFrame(unsigned int frame) const;
+
+ // we can retrieve the delay for a frame only after building
+ // a GdkPixbufAnimationIter...
+ virtual int GetDelay(unsigned int WXUNUSED(frame)) const { return 0; }
+
+ virtual wxSize GetSize() const;
+
+ virtual bool LoadFile(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY);
+ virtual bool Load(wxInputStream &stream, wxAnimationType type = wxANIMATION_TYPE_ANY);
+
+ // Implementation
+public: // used by GTK callbacks
+
+ GdkPixbufAnimation *GetPixbuf() const
+ { return m_pixbuf; }
+ void SetPixbuf(GdkPixbufAnimation* p);
+
+protected:
+ GdkPixbufAnimation *m_pixbuf;
+
+private:
+ void UnRef();
+
+ typedef wxAnimationBase base_type;
+ DECLARE_DYNAMIC_CLASS(wxAnimation)
+};
+
+
+// ----------------------------------------------------------------------------
+// wxAnimationCtrl
+// ----------------------------------------------------------------------------
+
+// Resize to animation size if this is set
+#define wxAN_FIT_ANIMATION 0x0010
+
+class WXDLLIMPEXP_ADV wxAnimationCtrl: public wxAnimationCtrlBase
+{
+public:
+ wxAnimationCtrl() { Init(); }
+ wxAnimationCtrl(wxWindow *parent,
+ wxWindowID id,
+ const wxAnimation& anim = wxNullAnimation,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxAC_DEFAULT_STYLE,
+ const wxString& name = wxAnimationCtrlNameStr)
+ {
+ Init();
+
+ Create(parent, id, anim, pos, size, style, name);
+ }
+
+ bool Create(wxWindow *parent, wxWindowID id,
+ const wxAnimation& anim = wxNullAnimation,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxAC_DEFAULT_STYLE,
+ const wxString& name = wxAnimationCtrlNameStr);
+
+ ~wxAnimationCtrl();
+
+public: // event handler
+
+ void OnTimer(wxTimerEvent &);
+
+public: // public API
+
+ virtual bool LoadFile(const wxString& filename, wxAnimationType type = wxANIMATION_TYPE_ANY);
+ virtual bool Load(wxInputStream& stream, wxAnimationType type = wxANIMATION_TYPE_ANY);
+
+ virtual void SetAnimation(const wxAnimation &anim);
+ virtual wxAnimation GetAnimation() const
+ { return wxAnimation(m_anim); }
+
+ virtual bool Play();
+ virtual void Stop();
+
+ virtual bool IsPlaying() const;
+
+ bool SetBackgroundColour( const wxColour &colour );
+
+protected:
+
+ virtual void DisplayStaticImage();
+ virtual wxSize DoGetBestSize() const;
+ void FitToAnimation();
+ void ClearToBackgroundColour();
+
+ void ResetAnim();
+ void ResetIter();
+
+protected: // internal vars
+
+ GdkPixbufAnimation *m_anim;
+ GdkPixbufAnimationIter *m_iter;
+
+ wxTimer m_timer;
+ bool m_bPlaying;
+
+private:
+ typedef wxAnimationCtrlBase base_type;
+
+ void Init();
+
+ DECLARE_DYNAMIC_CLASS(wxAnimationCtrl)
+ DECLARE_EVENT_TABLE()
+};
+
+#endif // _WX_GTKANIMATEH__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/anybutton.h
+// Purpose: wxGTK wxAnyButton class declaration
+// Author: Robert Roebling
+// Created: 1998-05-20 (extracted from button.h)
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_ANYBUTTON_H_
+#define _WX_GTK_ANYBUTTON_H_
+
+//-----------------------------------------------------------------------------
+// wxAnyButton
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxAnyButton : public wxAnyButtonBase
+{
+public:
+ wxAnyButton()
+ {
+ m_isCurrent =
+ m_isPressed = false;
+ }
+
+ virtual bool Enable( bool enable = true );
+
+ // implementation
+ // --------------
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ // called from GTK callbacks: they update the button state and call
+ // GTKUpdateBitmap()
+ void GTKMouseEnters();
+ void GTKMouseLeaves();
+ void GTKPressed();
+ void GTKReleased();
+
+protected:
+ virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+
+ virtual wxBitmap DoGetBitmap(State which) const;
+ virtual void DoSetBitmap(const wxBitmap& bitmap, State which);
+ virtual void DoSetBitmapPosition(wxDirection dir);
+
+private:
+ typedef wxAnyButtonBase base_type;
+
+ // focus event handler: calls GTKUpdateBitmap()
+ void GTKOnFocus(wxFocusEvent& event);
+
+ // update the bitmap to correspond to the current button state
+ void GTKUpdateBitmap();
+
+ // return the current button state from m_isXXX flags (which means that it
+ // might not correspond to the real current state as e.g. m_isCurrent will
+ // never be true if we don't have a valid current bitmap)
+ State GTKGetCurrentState() const;
+
+ // show the given bitmap (must be valid)
+ void GTKDoShowBitmap(const wxBitmap& bitmap);
+
+
+ // the bitmaps for the different state of the buttons, all of them may be
+ // invalid and the button only shows a bitmap at all if State_Normal bitmap
+ // is valid
+ wxBitmap m_bitmaps[State_Max];
+
+ // true iff mouse is currently over the button
+ bool m_isCurrent;
+
+ // true iff the button is in pressed state
+ bool m_isPressed;
+
+ wxDECLARE_NO_COPY_CLASS(wxAnyButton);
+};
+
+#endif // _WX_GTK_ANYBUTTON_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/app.h
+// Purpose: wxApp definition for wxGTK
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling, Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_APP_H_
+#define _WX_GTK_APP_H_
+
+//-----------------------------------------------------------------------------
+// classes
+//-----------------------------------------------------------------------------
+
+#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2
+typedef struct _HildonProgram HildonProgram;
+#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2
+
+//-----------------------------------------------------------------------------
+// wxApp
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxApp: public wxAppBase
+{
+public:
+ wxApp();
+ virtual ~wxApp();
+
+ /* override for altering the way wxGTK intializes the GUI
+ * (palette/visual/colorcube). under wxMSW, OnInitGui() does nothing by
+ * default. when overriding this method, the code in it is likely to be
+ * platform dependent, otherwise use OnInit(). */
+ virtual bool SetNativeTheme(const wxString& theme);
+ virtual bool OnInitGui();
+
+ // override base class (pure) virtuals
+ virtual void WakeUpIdle();
+
+ virtual bool Initialize(int& argc, wxChar **argv);
+ virtual void CleanUp();
+
+ virtual void OnAssertFailure(const wxChar *file,
+ int line,
+ const wxChar *func,
+ const wxChar *cond,
+ const wxChar *msg);
+
+ // GTK-specific methods
+ // -------------------
+
+ // this can be overridden to return a specific visual to be used for GTK+
+ // instead of the default one (it's used by wxGLApp)
+ //
+ // must return XVisualInfo pointer (it is not freed by caller)
+ virtual void *GetXVisualInfo() { return NULL; }
+
+ // Check if we're using a global menu. Currently this is only true when
+ // running under Ubuntu Unity and global menu is not disabled.
+ //
+ // This is mostly used in the implementation in order to work around
+ // various bugs arising due to this.
+ static bool GTKIsUsingGlobalMenu();
+
+#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2
+ // Maemo-specific method: get the main program object
+ HildonProgram *GetHildonProgram();
+#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2
+
+ // implementation only from now on
+ // -------------------------------
+
+ // check for pending events, without interference from our idle source
+ bool EventsPending();
+ bool DoIdle();
+
+private:
+ // true if we're inside an assert modal dialog
+ bool m_isInAssert;
+
+#if wxUSE_THREADS
+ wxMutex m_idleMutex;
+#endif
+ unsigned m_idleSourceId;
+
+#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2
+ HildonProgram *m_hildonProgram;
+#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2
+
+ DECLARE_DYNAMIC_CLASS(wxApp)
+};
+
+#endif // _WX_GTK_APP_H_
--- /dev/null
+/* ///////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/assertdlg_gtk.h
+// Purpose: GtkAssertDialog
+// Author: Francesco Montorsi
+// Copyright: (c) 2006 Francesco Montorsi
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////// */
+
+#ifndef _WX_GTK_ASSERTDLG_H_
+#define _WX_GTK_ASSERTDLG_H_
+
+#define GTK_TYPE_ASSERT_DIALOG (gtk_assert_dialog_get_type ())
+#define GTK_ASSERT_DIALOG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_ASSERT_DIALOG, GtkAssertDialog))
+#define GTK_ASSERT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ASSERT_DIALOG, GtkAssertDialogClass))
+#define GTK_IS_ASSERT_DIALOG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_ASSERT_DIALOG))
+#define GTK_IS_ASSERT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ASSERT_DIALOG))
+#define GTK_ASSERT_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ASSERT_DIALOG, GtkAssertDialogClass))
+
+typedef struct _GtkAssertDialog GtkAssertDialog;
+typedef struct _GtkAssertDialogClass GtkAssertDialogClass;
+typedef void (*GtkAssertDialogStackFrameCallback)(void *);
+
+struct _GtkAssertDialog
+{
+ GtkDialog parent_instance;
+
+ /* GtkAssertDialog widgets */
+ GtkWidget *expander;
+ GtkWidget *message;
+ GtkWidget *treeview;
+
+ GtkWidget *shownexttime;
+
+ /* callback for processing the stack frame */
+ GtkAssertDialogStackFrameCallback callback;
+ void *userdata;
+};
+
+struct _GtkAssertDialogClass
+{
+ GtkDialogClass parent_class;
+};
+
+typedef enum
+{
+ GTK_ASSERT_DIALOG_STOP,
+ GTK_ASSERT_DIALOG_CONTINUE,
+ GTK_ASSERT_DIALOG_CONTINUE_SUPPRESSING
+} GtkAssertDialogResponseID;
+
+
+
+
+GType gtk_assert_dialog_get_type(void);
+GtkWidget *gtk_assert_dialog_new(void);
+
+/* get the assert message */
+gchar *gtk_assert_dialog_get_message(GtkAssertDialog *assertdlg);
+
+/* set the assert message */
+void gtk_assert_dialog_set_message(GtkAssertDialog *assertdlg, const gchar *msg);
+
+/* get a string containing all stack frames appended to the dialog */
+gchar *gtk_assert_dialog_get_backtrace(GtkAssertDialog *assertdlg);
+
+/* sets the callback to use when the user wants to see the stackframe */
+void gtk_assert_dialog_set_backtrace_callback(GtkAssertDialog *assertdlg,
+ GtkAssertDialogStackFrameCallback callback,
+ void *userdata);
+
+/* appends a stack frame to the dialog */
+void gtk_assert_dialog_append_stack_frame(GtkAssertDialog *dlg,
+ const gchar *function,
+ const gchar *sourcefile,
+ guint line_number);
+
+#endif /* _WX_GTK_ASSERTDLG_H_ */
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/bitmap.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_BITMAP_H_
+#define _WX_GTK_BITMAP_H_
+
+#ifdef __WXGTK3__
+typedef struct _cairo cairo_t;
+typedef struct _cairo_surface cairo_surface_t;
+#endif
+typedef struct _GdkPixbuf GdkPixbuf;
+class WXDLLIMPEXP_FWD_CORE wxPixelDataBase;
+
+//-----------------------------------------------------------------------------
+// wxMask
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxMask: public wxMaskBase
+{
+public:
+ wxMask();
+ wxMask(const wxMask& mask);
+ wxMask( const wxBitmap& bitmap, const wxColour& colour );
+#if wxUSE_PALETTE
+ wxMask( const wxBitmap& bitmap, int paletteIndex );
+#endif // wxUSE_PALETTE
+ wxMask( const wxBitmap& bitmap );
+ virtual ~wxMask();
+ wxBitmap GetBitmap() const;
+
+ // implementation
+#ifdef __WXGTK3__
+ wxMask(cairo_surface_t*);
+ operator cairo_surface_t*() const;
+#else
+ wxMask(GdkPixmap*);
+ operator GdkPixmap*() const;
+#endif
+
+protected:
+ virtual void FreeData();
+ virtual bool InitFromColour(const wxBitmap& bitmap, const wxColour& colour);
+ virtual bool InitFromMonoBitmap(const wxBitmap& bitmap);
+
+private:
+#ifdef __WXGTK3__
+ cairo_surface_t* m_bitmap;
+#else
+ GdkPixmap* m_bitmap;
+#endif
+
+ DECLARE_DYNAMIC_CLASS(wxMask)
+};
+
+//-----------------------------------------------------------------------------
+// wxBitmap
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
+{
+public:
+ wxBitmap() { }
+ wxBitmap( int width, int height, int depth = wxBITMAP_SCREEN_DEPTH )
+ { Create(width, height, depth); }
+ wxBitmap( const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH )
+ { Create(sz, depth); }
+ wxBitmap( const char bits[], int width, int height, int depth = 1 );
+ wxBitmap( const char* const* bits );
+#ifdef wxNEEDS_CHARPP
+ // needed for old GCC
+ wxBitmap(char** data)
+ { *this = wxBitmap(const_cast<const char* const*>(data)); }
+#endif
+ wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE );
+#if wxUSE_IMAGE
+ wxBitmap(const wxImage& image, int depth = wxBITMAP_SCREEN_DEPTH);
+#endif // wxUSE_IMAGE
+ wxBitmap(GdkPixbuf* pixbuf, int depth = 0);
+ virtual ~wxBitmap();
+
+ bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
+ bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH)
+ { return Create(sz.GetWidth(), sz.GetHeight(), depth); }
+ bool Create(int width, int height, const wxDC& WXUNUSED(dc))
+ { return Create(width,height); }
+
+
+ virtual int GetHeight() const;
+ virtual int GetWidth() const;
+ virtual int GetDepth() const;
+
+#if wxUSE_IMAGE
+ wxImage ConvertToImage() const;
+#endif // wxUSE_IMAGE
+
+ // copies the contents and mask of the given (colour) icon to the bitmap
+ virtual bool CopyFromIcon(const wxIcon& icon);
+
+ wxMask *GetMask() const;
+ void SetMask( wxMask *mask );
+
+ wxBitmap GetSubBitmap( const wxRect& rect ) const;
+
+ bool SaveFile(const wxString &name, wxBitmapType type,
+ const wxPalette *palette = NULL) const;
+ bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE);
+
+#if wxUSE_PALETTE
+ wxPalette *GetPalette() const;
+ void SetPalette(const wxPalette& palette);
+ wxPalette *GetColourMap() const { return GetPalette(); }
+#endif // wxUSE_PALETTE
+
+ static void InitStandardHandlers();
+
+ // implementation
+ // --------------
+
+ void SetHeight( int height );
+ void SetWidth( int width );
+ void SetDepth( int depth );
+
+#ifdef __WXGTK3__
+ GdkPixbuf* GetPixbufNoMask() const;
+ cairo_t* CairoCreate() const;
+ void Draw(cairo_t* cr, int x, int y, bool useMask = true, const wxColour* fg = NULL, const wxColour* bg = NULL) const;
+ void SetSourceSurface(cairo_t* cr, int x, int y, const wxColour* fg = NULL, const wxColour* bg = NULL) const;
+#else
+ GdkPixmap *GetPixmap() const;
+ bool HasPixmap() const;
+ bool HasPixbuf() const;
+ wxBitmap(GdkPixmap* pixmap);
+#endif
+ GdkPixbuf *GetPixbuf() const;
+
+ // raw bitmap access support functions
+ void *GetRawData(wxPixelDataBase& data, int bpp);
+ void UngetRawData(wxPixelDataBase& data);
+
+ bool HasAlpha() const;
+
+protected:
+#ifndef __WXGTK3__
+#if wxUSE_IMAGE
+ bool CreateFromImage(const wxImage& image, int depth);
+#endif // wxUSE_IMAGE
+#endif
+
+ virtual wxGDIRefData* CreateGDIRefData() const;
+ virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const;
+
+private:
+#ifndef __WXGTK3__
+ void SetPixmap(GdkPixmap* pixmap);
+#if wxUSE_IMAGE
+ // to be called from CreateFromImage only!
+ bool CreateFromImageAsPixmap(const wxImage& image, int depth);
+ bool CreateFromImageAsPixbuf(const wxImage& image);
+#endif // wxUSE_IMAGE
+
+public:
+ // implementation only
+ enum Representation
+ {
+ Pixmap,
+ Pixbuf
+ };
+ // removes other representations from memory, keeping only 'keep'
+ // (wxBitmap may keep same bitmap e.g. as both pixmap and pixbuf):
+ void PurgeOtherRepresentations(Representation keep);
+#endif
+
+ DECLARE_DYNAMIC_CLASS(wxBitmap)
+};
+
+#endif // _WX_GTK_BITMAP_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/bmpbutton.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_BMPBUTTON_H_
+#define _WX_GTK_BMPBUTTON_H_
+
+// ----------------------------------------------------------------------------
+// wxBitmapButton
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxBitmapButton : public wxBitmapButtonBase
+{
+public:
+ wxBitmapButton() { }
+
+ wxBitmapButton(wxWindow *parent,
+ wxWindowID id,
+ const wxBitmap& bitmap,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr)
+ {
+ Create(parent, id, bitmap, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxBitmap& bitmap,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr);
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxBitmapButton)
+};
+
+#endif // _WX_GTK_BMPBUTTON_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/bmpcbox.h
+// Purpose: wxBitmapComboBox
+// Author: Jaakko Salli
+// Created: 2008-05-19
+// Copyright: (c) 2008 Jaakko Salli
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_BMPCBOX_H_
+#define _WX_GTK_BMPCBOX_H_
+
+
+#include "wx/combobox.h"
+
+// ----------------------------------------------------------------------------
+// wxBitmapComboBox: a wxComboBox that allows images to be shown
+// in front of string items.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxBitmapComboBox : public wxComboBox,
+ public wxBitmapComboBoxBase
+{
+public:
+ // ctors and such
+ wxBitmapComboBox() : wxComboBox(), wxBitmapComboBoxBase()
+ {
+ Init();
+ }
+
+ wxBitmapComboBox(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0,
+ const wxString choices[] = NULL,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxBitmapComboBoxNameStr)
+ : wxComboBox(),
+ wxBitmapComboBoxBase()
+ {
+ Init();
+
+ (void)Create(parent, id, value, pos, size, n,
+ choices, style, validator, name);
+ }
+
+ wxBitmapComboBox(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ long style,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxBitmapComboBoxNameStr);
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value,
+ const wxPoint& pos,
+ const wxSize& size,
+ int n,
+ const wxString choices[],
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxBitmapComboBoxNameStr);
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxBitmapComboBoxNameStr);
+
+ virtual ~wxBitmapComboBox();
+
+ // Sets the image for the given item.
+ virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap);
+
+ // Returns the image of the item with the given index.
+ virtual wxBitmap GetItemBitmap(unsigned int n) const;
+
+ // Returns size of the image used in list
+ virtual wxSize GetBitmapSize() const
+ {
+ return m_bitmapSize;
+ }
+
+ // Adds item with image to the end of the combo box.
+ int Append(const wxString& item, const wxBitmap& bitmap = wxNullBitmap);
+ int Append(const wxString& item, const wxBitmap& bitmap, void *clientData);
+ int Append(const wxString& item, const wxBitmap& bitmap, wxClientData *clientData);
+
+ // Inserts item with image into the list before pos. Not valid for wxCB_SORT
+ // styles, use Append instead.
+ int Insert(const wxString& item, const wxBitmap& bitmap, unsigned int pos);
+ int Insert(const wxString& item, const wxBitmap& bitmap,
+ unsigned int pos, void *clientData);
+ int Insert(const wxString& item, const wxBitmap& bitmap,
+ unsigned int pos, wxClientData *clientData);
+
+ // Override some wxTextEntry interface.
+ virtual void WriteText(const wxString& value);
+
+ virtual wxString GetValue() const;
+ virtual void Remove(long from, long to);
+
+ virtual void SetInsertionPoint(long pos);
+ virtual long GetInsertionPoint() const;
+ virtual long GetLastPosition() const;
+
+ virtual void SetSelection(long from, long to);
+ virtual void GetSelection(long *from, long *to) const;
+
+ virtual void SetSelection(int n) { wxComboBox::SetSelection(n); }
+ virtual int GetSelection() const { return wxComboBox::GetSelection(); }
+
+ virtual bool IsEditable() const;
+ virtual void SetEditable(bool editable);
+
+ virtual GtkWidget* GetConnectWidget();
+
+protected:
+ virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+
+ virtual void GTKCreateComboBoxWidget();
+ virtual void GTKInsertComboBoxTextItem( unsigned int n, const wxString& text );
+
+ virtual wxSize DoGetBestSize() const;
+
+ wxSize m_bitmapSize;
+ int m_bitmapCellIndex;
+
+private:
+ void Init();
+
+ DECLARE_DYNAMIC_CLASS(wxBitmapComboBox)
+};
+
+#endif // _WX_GTK_BMPCBOX_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/brush.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_BRUSH_H_
+#define _WX_GTK_BRUSH_H_
+
+class WXDLLIMPEXP_FWD_CORE wxBitmap;
+class WXDLLIMPEXP_FWD_CORE wxColour;
+
+//-----------------------------------------------------------------------------
+// wxBrush
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxBrush: public wxBrushBase
+{
+public:
+ wxBrush() { }
+
+ wxBrush( const wxColour &colour, wxBrushStyle style = wxBRUSHSTYLE_SOLID );
+#if FUTURE_WXWIN_COMPATIBILITY_3_0
+ wxDEPRECATED_FUTURE( wxBrush(const wxColour& col, int style) );
+#endif
+ wxBrush( const wxBitmap &stippleBitmap );
+ virtual ~wxBrush();
+
+ bool operator==(const wxBrush& brush) const;
+ bool operator!=(const wxBrush& brush) const { return !(*this == brush); }
+
+ wxBrushStyle GetStyle() const;
+ wxColour GetColour() const;
+ wxBitmap *GetStipple() const;
+
+ void SetColour( const wxColour& col );
+ void SetColour( unsigned char r, unsigned char g, unsigned char b );
+ void SetStyle( wxBrushStyle style );
+ void SetStipple( const wxBitmap& stipple );
+
+#if FUTURE_WXWIN_COMPATIBILITY_3_0
+ wxDEPRECATED_FUTURE( void SetStyle(int style) )
+ { SetStyle((wxBrushStyle)style); }
+#endif
+
+protected:
+ virtual wxGDIRefData *CreateGDIRefData() const;
+ virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
+
+ DECLARE_DYNAMIC_CLASS(wxBrush)
+};
+
+#endif // _WX_GTK_BRUSH_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/button.h
+// Purpose: wxGTK wxButton class declaration
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_BUTTON_H_
+#define _WX_GTK_BUTTON_H_
+
+//-----------------------------------------------------------------------------
+// wxButton
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxButton : public wxButtonBase
+{
+public:
+ wxButton() {}
+ wxButton(wxWindow *parent, wxWindowID id,
+ const wxString& label = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr)
+ {
+ Create(parent, id, label, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent, wxWindowID id,
+ const wxString& label = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr);
+
+ virtual wxWindow *SetDefault();
+ virtual void SetLabel( const wxString &label );
+
+ // implementation
+ // --------------
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ // helper to allow access to protected member from GTK callback
+ void MoveWindow(int x, int y, int width, int height) { DoMoveWindow(x, y, width, height); }
+
+ // called from GTK callbacks: they update the button state and call
+ // GTKUpdateBitmap()
+ void GTKMouseEnters();
+ void GTKMouseLeaves();
+ void GTKPressed();
+ void GTKReleased();
+
+protected:
+ virtual wxSize DoGetBestSize() const;
+ virtual void DoApplyWidgetStyle(GtkRcStyle *style);
+
+#if wxUSE_MARKUP
+ virtual bool DoSetLabelMarkup(const wxString& markup);
+#endif // wxUSE_MARKUP
+
+private:
+ typedef wxButtonBase base_type;
+
+ // Return the GtkLabel used by this button.
+ GtkLabel *GTKGetLabel() const;
+
+ DECLARE_DYNAMIC_CLASS(wxButton)
+};
+
+#endif // _WX_GTK_BUTTON_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/calctrl.h
+// Purpose: wxGtkCalendarCtrl control
+// Author: Marcin Wojdyr
+// Copyright: (C) 2008 Marcin Wojdyr
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef GTK_CALCTRL_H__
+#define GTK_CALCTRL_H__
+
+class WXDLLIMPEXP_ADV wxGtkCalendarCtrl : public wxCalendarCtrlBase
+{
+public:
+ wxGtkCalendarCtrl() {}
+ wxGtkCalendarCtrl(wxWindow *parent,
+ wxWindowID id,
+ const wxDateTime& date = wxDefaultDateTime,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxCAL_SHOW_HOLIDAYS,
+ const wxString& name = wxCalendarNameStr)
+ {
+ Create(parent, id, date, pos, size, style, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxDateTime& date = wxDefaultDateTime,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxCAL_SHOW_HOLIDAYS,
+ const wxString& name = wxCalendarNameStr);
+
+ virtual ~wxGtkCalendarCtrl() {}
+
+ virtual bool SetDate(const wxDateTime& date);
+ virtual wxDateTime GetDate() const;
+
+ virtual bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime,
+ const wxDateTime& upperdate = wxDefaultDateTime);
+ virtual bool GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const;
+
+ virtual bool EnableMonthChange(bool enable = true);
+
+ virtual void Mark(size_t day, bool mark);
+
+ // implementation
+ // --------------
+
+ void GTKGenerateEvent(wxEventType type);
+
+private:
+ bool IsInValidRange(const wxDateTime& dt) const;
+
+ // Range of the dates that can be selected by user, either or both may be
+ // invalid to indicate that no corresponding restriction is set.
+ wxDateTime m_validStart,
+ m_validEnd;
+
+ // Last known selected date, may be different from the real selection in
+ // the control while a handler for day-selected is running.
+ wxDateTime m_selectedDate;
+
+ DECLARE_DYNAMIC_CLASS(wxGtkCalendarCtrl)
+ wxDECLARE_NO_COPY_CLASS(wxGtkCalendarCtrl);
+};
+
+#endif // GTK_CALCTRL_H__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/checkbox.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTKCHECKBOX_H_
+#define _WX_GTKCHECKBOX_H_
+
+// ----------------------------------------------------------------------------
+// wxCheckBox
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxCheckBox : public wxCheckBoxBase
+{
+public:
+ wxCheckBox();
+ ~wxCheckBox();
+ wxCheckBox( wxWindow *parent, wxWindowID id, const wxString& 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);
+ }
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxCheckBoxNameStr );
+
+ void SetValue( bool state );
+ bool GetValue() const;
+
+ virtual void SetLabel( const wxString& label );
+ virtual bool Enable( bool enable = true );
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ // implementation
+ void GTKDisableEvents();
+ void GTKEnableEvents();
+
+protected:
+ virtual void DoApplyWidgetStyle(GtkRcStyle *style);
+ virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+
+ void DoSet3StateValue(wxCheckBoxState state);
+ wxCheckBoxState DoGet3StateValue() const;
+
+private:
+ typedef wxCheckBoxBase base_type;
+
+ GtkWidget *m_widgetCheckbox;
+ GtkWidget *m_widgetLabel;
+
+ DECLARE_DYNAMIC_CLASS(wxCheckBox)
+};
+
+#endif // _WX_GTKCHECKBOX_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/checklst.h
+// Purpose: wxCheckListBox class
+// Author: Robert Roebling
+// Modified by:
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTKCHECKLIST_H_
+#define _WX_GTKCHECKLIST_H_
+
+//-----------------------------------------------------------------------------
+// wxCheckListBox
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase
+{
+public:
+ wxCheckListBox();
+ wxCheckListBox(wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int nStrings = 0,
+ const wxString *choices = NULL,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxListBoxNameStr);
+ wxCheckListBox(wxWindow *parent, wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxListBoxNameStr);
+
+ virtual bool IsChecked(unsigned int index) const;
+ virtual void Check(unsigned int index, bool check = true);
+
+ int GetItemHeight() const;
+
+ void DoCreateCheckList();
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxCheckListBox)
+};
+
+#endif // _WX_GTKCHECKLIST_H_
--- /dev/null
+/*
+ * Name: wx/gtk/chkconf.h
+ * Purpose: wxGTK-specific settings consistency checks
+ * Author: Vadim Zeitlin
+ * Created: 2007-07-19 (extracted from wx/chkconf.h)
+ * Copyright: (c) 2000-2007 Vadim Zeitlin <vadim@wxwidgets.org>
+ * Licence: wxWindows licence
+ */
+
+#ifndef __WXUNIVERSAL__
+# if wxUSE_MDI_ARCHITECTURE && !wxUSE_MENUS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "MDI requires wxUSE_MENUS in wxGTK"
+# else
+# undef wxUSE_MENUS
+# define wxUSE_MENUS 1
+# endif
+# endif
+#endif /* !__WXUNIVERSAL__ */
+
+#if wxUSE_JOYSTICK
+# if !wxUSE_THREADS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxJoystick requires threads in wxGTK"
+# else
+# undef wxUSE_JOYSTICK
+# define wxUSE_JOYSTICK 0
+# endif
+# endif
+#endif /* wxUSE_JOYSTICK */
+
+#if wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW && !wxUSE_POSTSCRIPT
+# undef wxUSE_POSTSCRIPT
+# define wxUSE_POSTSCRIPT 1
+#endif
+
+#if wxUSE_OWNER_DRAWN
+# undef wxUSE_OWNER_DRAWN
+# define wxUSE_OWNER_DRAWN 0
+#endif
+
+#if wxUSE_METAFILE
+# undef wxUSE_METAFILE
+# define wxUSE_METAFILE 0
+#endif
+
+#if wxUSE_ENH_METAFILE
+# undef wxUSE_ENH_METAFILE
+# define wxUSE_ENH_METAFILE 0
+#endif
+
+#ifndef __UNIX__
+
+# undef wxUSE_WEBVIEW
+# define wxUSE_WEBVIEW 0
+# undef wxUSE_WEBVIEW_WEBKIT
+# define wxUSE_WEBVIEW_WEBKIT 0
+
+# undef wxUSE_MEDIACTRL
+# define wxUSE_MEDIACTRL 0
+
+ /*
+ We could use GDK_WINDOWING_X11 for those but this would require
+ including gdk/gdk.h and we don't want to do it from here, so assume
+ we're not using X11 if we're not under Unix.
+ */
+
+# undef wxUSE_UIACTIONSIMULATOR
+# define wxUSE_UIACTIONSIMULATOR 0
+
+# undef wxUSE_GLCANVAS
+# define wxUSE_GLCANVAS 0
+
+#endif /* __UNIX__ */
+
+/*
+ We always need Cairo with wxGTK, enable it if necessary (this can only
+ happen under Windows).
+ */
+#ifdef __WINDOWS__
+
+#if !wxUSE_CAIRO
+# undef wxUSE_CAIRO
+# define wxUSE_CAIRO 1
+#endif
+
+#endif /* __WINDOWS__ */
+
+#ifdef __WXGTK3__
+ #if !wxUSE_GRAPHICS_CONTEXT
+ #ifdef wxABORT_ON_CONFIG_ERROR
+ #error "GTK+ 3 support requires wxGraphicsContext"
+ #else
+ #undef wxUSE_GRAPHICS_CONTEXT
+ #define wxUSE_GRAPHICS_CONTEXT 1
+ #endif
+ #endif
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/choice.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_CHOICE_H_
+#define _WX_GTK_CHOICE_H_
+
+class WXDLLIMPEXP_FWD_BASE wxSortedArrayString;
+class WXDLLIMPEXP_FWD_BASE wxArrayString;
+
+//-----------------------------------------------------------------------------
+// wxChoice
+//-----------------------------------------------------------------------------
+
+class wxGtkCollatedArrayString;
+
+class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase
+{
+public:
+ wxChoice()
+ {
+ Init();
+ }
+ wxChoice( wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0, const wxString choices[] = (const wxString *) NULL,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxChoiceNameStr )
+ {
+ Init();
+ Create(parent, id, pos, size, n, choices, style, validator, name);
+ }
+ wxChoice( wxWindow *parent, wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxChoiceNameStr )
+ {
+ Init();
+ Create(parent, id, pos, size, choices, style, validator, name);
+ }
+ virtual ~wxChoice();
+ bool Create( wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0, const wxString choices[] = NULL,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxChoiceNameStr );
+ bool Create( wxWindow *parent, wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxChoiceNameStr );
+
+ int GetSelection() const;
+ void SetSelection(int n);
+
+ virtual unsigned int GetCount() const;
+ virtual int FindString(const wxString& s, bool bCase = false) const;
+ virtual wxString GetString(unsigned int n) const;
+ virtual void SetString(unsigned int n, const wxString& string);
+
+ virtual void SetColumns(int n=1);
+ virtual int GetColumns() const;
+
+ virtual void GTKDisableEvents();
+ virtual void GTKEnableEvents();
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+protected:
+ // this array is only used for controls with wxCB_SORT style, so only
+ // allocate it if it's needed (hence using pointer)
+ wxGtkCollatedArrayString *m_strings;
+
+ // contains the client data for the items
+ wxArrayPtrVoid m_clientData;
+
+ // index to GtkListStore cell which displays the item text
+ int m_stringCellIndex;
+
+ virtual wxSize DoGetBestSize() const;
+ virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const;
+ virtual int DoInsertItems(const wxArrayStringsAdapter& items,
+ unsigned int pos,
+ void **clientData, wxClientDataType type);
+ virtual void DoSetItemClientData(unsigned int n, void* clientData);
+ virtual void* DoGetItemClientData(unsigned int n) const;
+ virtual void DoClear();
+ virtual void DoDeleteOneItem(unsigned int n);
+
+ virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+ virtual void DoApplyWidgetStyle(GtkRcStyle *style);
+
+ // in derived classes, implement this to insert list store entry
+ // with all items default except text
+ virtual void GTKInsertComboBoxTextItem( unsigned int n, const wxString& text );
+
+private:
+ void Init();
+
+ DECLARE_DYNAMIC_CLASS(wxChoice)
+};
+
+
+#endif // _WX_GTK_CHOICE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/clipbrd.h
+// Purpose: wxClipboard for wxGTK
+// Author: Robert Roebling, Vadim Zeitlin
+// Copyright: (c) 1998 Robert Roebling
+// (c) 2007 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_CLIPBOARD_H_
+#define _WX_GTK_CLIPBOARD_H_
+
+// ----------------------------------------------------------------------------
+// wxClipboard
+// ----------------------------------------------------------------------------
+
+#include "wx/weakref.h"
+
+class WXDLLIMPEXP_CORE wxClipboard : public wxClipboardBase
+{
+public:
+ // there are several clipboards in X11 (and in GDK)
+ enum Kind
+ {
+ Primary,
+ Clipboard
+ };
+
+ wxClipboard();
+ virtual ~wxClipboard();
+
+ // open the clipboard before SetData() and GetData()
+ virtual bool Open();
+
+ // close the clipboard after SetData() and GetData()
+ virtual void Close();
+
+ // query whether the clipboard is opened
+ virtual bool IsOpened() const;
+
+ // set the clipboard data. all other formats will be deleted.
+ virtual bool SetData( wxDataObject *data );
+
+ // add to the clipboard data.
+ virtual bool AddData( wxDataObject *data );
+
+ // ask if data in correct format is available
+ virtual bool IsSupported( const wxDataFormat& format );
+
+ // ask if data in correct format is available
+ virtual bool IsSupportedAsync( wxEvtHandler *sink );
+
+ // fill data with data on the clipboard (if available)
+ virtual bool GetData( wxDataObject& data );
+
+ // clears wxTheClipboard and the system's clipboard if possible
+ virtual void Clear();
+
+
+
+ // implementation from now on
+ // --------------------------
+
+ // get our clipboard item (depending on m_usePrimary value)
+ GdkAtom GTKGetClipboardAtom() const;
+
+ // get the data object currently being requested
+ wxDataObject *GTKGetDataObject( GdkAtom atom );
+
+ // clear the data for the given clipboard kind
+ void GTKClearData(Kind kind);
+
+ // called when selection data is received
+ void GTKOnSelectionReceived(const GtkSelectionData& sel);
+
+ // called when available target information is received
+ bool GTKOnTargetReceived(const wxDataFormat& format);
+
+private:
+ // the data object for the specific selection
+ wxDataObject *& Data(Kind kind)
+ {
+ return kind == Primary ? m_dataPrimary : m_dataClipboard;
+ }
+
+ // the data object we're currently using
+ wxDataObject *& Data()
+ {
+ return Data(m_usePrimary ? Primary : Clipboard);
+ }
+
+
+ // set or unset selection ownership
+ bool SetSelectionOwner(bool set = true);
+
+ // add atom to the list of supported targets
+ void AddSupportedTarget(GdkAtom atom);
+
+ // check if the given format is supported
+ bool DoIsSupported(const wxDataFormat& format);
+
+
+ // both of these pointers can be non-NULL simultaneously but we only use
+ // one of them at any moment depending on m_usePrimary value, use Data()
+ // (from inside) or GTKGetDataObject() (from outside) accessors
+ wxDataObject *m_dataPrimary,
+ *m_dataClipboard;
+
+ // this is used to temporarily hold the object passed to our GetData() so
+ // that GTK callbacks could access it
+ wxDataObject *m_receivedData;
+
+ // used to pass information about the format we need from DoIsSupported()
+ // to GTKOnTargetReceived()
+ GdkAtom m_targetRequested;
+
+ GtkWidget *m_clipboardWidget; // for getting and offering data
+ GtkWidget *m_targetsWidget; // for getting list of supported formats
+
+ // ID of the connection to "selection_get" signal, initially 0.
+ unsigned long m_idSelectionGetHandler;
+
+ bool m_open;
+ bool m_formatSupported;
+
+public:
+ // async stuff
+ wxEvtHandlerRef m_sink;
+private:
+ GtkWidget *m_targetsWidgetAsync; // for getting list of supported formats
+
+ DECLARE_DYNAMIC_CLASS(wxClipboard)
+};
+
+#endif // _WX_GTK_CLIPBOARD_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/clrpicker.h
+// Purpose: wxColourButton header
+// Author: Francesco Montorsi
+// Modified by:
+// Created: 14/4/2006
+// Copyright: (c) Francesco Montorsi
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_CLRPICKER_H_
+#define _WX_GTK_CLRPICKER_H_
+
+#include "wx/button.h"
+
+//-----------------------------------------------------------------------------
+// wxColourButton
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxColourButton : public wxButton,
+ public wxColourPickerWidgetBase
+{
+public:
+ wxColourButton() : m_topParent(NULL) {}
+ wxColourButton(wxWindow *parent,
+ wxWindowID id,
+ const wxColour& initial = *wxBLACK,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxCLRBTN_DEFAULT_STYLE,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxColourPickerWidgetNameStr)
+ : m_topParent(NULL)
+ {
+ Create(parent, id, initial, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxColour& initial = *wxBLACK,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxCLRBTN_DEFAULT_STYLE,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxColourPickerWidgetNameStr);
+
+ virtual ~wxColourButton();
+
+protected:
+ void UpdateColour();
+
+public: // used by the GTK callback only
+
+ void GTKSetColour(const wxColour& colour)
+ { m_colour = colour; }
+
+ wxWindow *m_topParent;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxColourButton)
+};
+
+#endif // _WX_GTK_CLRPICKER_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/collpane.h
+// Purpose: wxCollapsiblePane
+// Author: Francesco Montorsi
+// Modified by:
+// Created: 8/10/2006
+// Copyright: (c) Francesco Montorsi
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_COLLAPSABLE_PANEL_H_GTK_
+#define _WX_COLLAPSABLE_PANEL_H_GTK_
+
+// ----------------------------------------------------------------------------
+// wxCollapsiblePane
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxCollapsiblePane : public wxCollapsiblePaneBase
+{
+public:
+ wxCollapsiblePane() { Init(); }
+
+ wxCollapsiblePane(wxWindow *parent,
+ wxWindowID winid,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxCP_DEFAULT_STYLE,
+ const wxValidator& val = wxDefaultValidator,
+ const wxString& name = wxCollapsiblePaneNameStr)
+ {
+ Init();
+
+ Create(parent, winid, label, pos, size, style, val, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID winid,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxCP_DEFAULT_STYLE,
+ const wxValidator& val = wxDefaultValidator,
+ const wxString& name = wxCollapsiblePaneNameStr);
+
+ virtual void Collapse(bool collapse = true);
+ virtual bool IsCollapsed() const;
+ virtual void SetLabel(const wxString& str);
+
+ virtual wxWindow *GetPane() const { return m_pPane; }
+ virtual wxString GetLabel() const { return m_strLabel; }
+
+protected:
+ virtual wxSize DoGetBestSize() const;
+
+public: // used by GTK callbacks
+ bool m_bIgnoreNextChange;
+ wxSize m_szCollapsed;
+
+ wxWindow *m_pPane;
+
+ // the button label without ">>" or "<<"
+ wxString m_strLabel;
+
+private:
+ void Init()
+ {
+ m_bIgnoreNextChange = false;
+ }
+
+ void OnSize(wxSizeEvent&);
+ virtual void AddChildGTK(wxWindowGTK* child);
+ GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+
+ DECLARE_DYNAMIC_CLASS(wxCollapsiblePane)
+ DECLARE_EVENT_TABLE()
+};
+
+#endif // _WX_COLLAPSABLE_PANEL_H_GTK_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/colordlg.h
+// Purpose: wxColourDialog
+// Author: Vaclav Slavik
+// Modified by:
+// Created: 2004/06/04
+// Copyright: (c) Vaclav Slavik, 2004
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_COLORDLG_H_
+#define _WX_GTK_COLORDLG_H_
+
+#include "wx/dialog.h"
+
+class WXDLLIMPEXP_CORE wxColourDialog : public wxDialog
+{
+public:
+ wxColourDialog() {}
+ wxColourDialog(wxWindow *parent,
+ wxColourData *data = NULL);
+ virtual ~wxColourDialog() {}
+
+ bool Create(wxWindow *parent, wxColourData *data = NULL);
+
+ wxColourData &GetColourData() { return m_data; }
+
+ virtual int ShowModal();
+
+protected:
+ // implement some base class methods to do nothing to avoid asserts and
+ // GTK warnings, since this is not a real wxDialog.
+ virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
+ int WXUNUSED(width), int WXUNUSED(height),
+ int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {}
+ virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y),
+ int WXUNUSED(width), int WXUNUSED(height)) {}
+
+ // copy data between the dialog and m_colourData:
+ void ColourDataToDialog();
+ void DialogToColourData();
+
+ wxColourData m_data;
+
+ DECLARE_DYNAMIC_CLASS(wxColourDialog)
+};
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/colour.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_COLOUR_H_
+#define _WX_GTK_COLOUR_H_
+
+#ifdef __WXGTK3__
+typedef struct _GdkRGBA GdkRGBA;
+#endif
+
+//-----------------------------------------------------------------------------
+// wxColour
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxColour : public wxColourBase
+{
+public:
+ // constructors
+ // ------------
+ DEFINE_STD_WXCOLOUR_CONSTRUCTORS
+ wxColour(const GdkColor& gdkColor);
+#ifdef __WXGTK3__
+ wxColour(const GdkRGBA& gdkRGBA);
+#endif
+
+ virtual ~wxColour();
+
+ bool operator==(const wxColour& col) const;
+ bool operator!=(const wxColour& col) const { return !(*this == col); }
+
+ unsigned char Red() const;
+ unsigned char Green() const;
+ unsigned char Blue() const;
+ unsigned char Alpha() const;
+
+ // Implementation part
+#ifdef __WXGTK3__
+ operator const GdkRGBA*() const;
+#else
+ void CalcPixel( GdkColormap *cmap );
+ int GetPixel() const;
+#endif
+ const GdkColor *GetColor() const;
+
+protected:
+ virtual void
+ InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
+
+ virtual bool FromString(const wxString& str);
+
+ DECLARE_DYNAMIC_CLASS(wxColour)
+};
+
+#endif // _WX_GTK_COLOUR_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/combobox.h
+// Purpose:
+// Author: Robert Roebling
+// Created: 01/02/97
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_COMBOBOX_H_
+#define _WX_GTK_COMBOBOX_H_
+
+#include "wx/choice.h"
+
+typedef struct _GtkEntry GtkEntry;
+
+//-----------------------------------------------------------------------------
+// wxComboBox
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxComboBox : public wxChoice,
+ public wxTextEntry
+{
+public:
+ wxComboBox()
+ : wxChoice(), wxTextEntry()
+ {
+ Init();
+ }
+ wxComboBox(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0, const wxString choices[] = NULL,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxComboBoxNameStr)
+ : wxChoice(), wxTextEntry()
+ {
+ Init();
+ Create(parent, id, value, pos, size, n, choices, style, validator, name);
+ }
+
+ wxComboBox(wxWindow *parent, wxWindowID id,
+ const wxString& value,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxComboBoxNameStr)
+ : wxChoice(), wxTextEntry()
+ {
+ Init();
+ Create(parent, id, value, pos, size, choices, style, validator, name);
+ }
+ ~wxComboBox();
+
+ bool Create(wxWindow *parent, wxWindowID id,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0, const wxString choices[] = (const wxString *) NULL,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxComboBoxNameStr);
+ bool Create(wxWindow *parent, wxWindowID id,
+ const wxString& value,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxComboBoxNameStr);
+
+ // Set/GetSelection() from wxTextEntry and wxChoice
+
+ virtual void SetSelection(int n) { wxChoice::SetSelection(n); }
+ virtual void SetSelection(long from, long to)
+ { wxTextEntry::SetSelection(from, to); }
+
+ virtual int GetSelection() const { return wxChoice::GetSelection(); }
+ virtual void GetSelection(long *from, long *to) const
+ { return wxTextEntry::GetSelection(from, to); }
+
+ virtual wxString GetStringSelection() const
+ {
+ return wxItemContainer::GetStringSelection();
+ }
+
+ virtual void SetString(unsigned int n, const wxString& string);
+
+ virtual void Popup();
+ virtual void Dismiss();
+
+ virtual void Clear()
+ {
+ wxTextEntry::Clear();
+ wxItemContainer::Clear();
+ }
+
+ // See wxComboBoxBase discussion of IsEmpty().
+ bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
+ bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
+
+ void OnChar( wxKeyEvent &event );
+
+ virtual void SetValue(const wxString& value);
+
+ // Standard event handling
+ void OnCut(wxCommandEvent& event);
+ void OnCopy(wxCommandEvent& event);
+ void OnPaste(wxCommandEvent& event);
+ void OnUndo(wxCommandEvent& event);
+ void OnRedo(wxCommandEvent& event);
+ void OnDelete(wxCommandEvent& event);
+ void OnSelectAll(wxCommandEvent& event);
+
+ void OnUpdateCut(wxUpdateUIEvent& event);
+ void OnUpdateCopy(wxUpdateUIEvent& event);
+ void OnUpdatePaste(wxUpdateUIEvent& event);
+ void OnUpdateUndo(wxUpdateUIEvent& event);
+ void OnUpdateRedo(wxUpdateUIEvent& event);
+ void OnUpdateDelete(wxUpdateUIEvent& event);
+ void OnUpdateSelectAll(wxUpdateUIEvent& event);
+
+ virtual void GTKDisableEvents();
+ virtual void GTKEnableEvents();
+ GtkWidget* GetConnectWidget();
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+protected:
+ // From wxWindowGTK:
+ virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+
+ // Widgets that use the style->base colour for the BG colour should
+ // override this and return true.
+ virtual bool UseGTKStyleBase() const { return true; }
+
+ // Override in derived classes to create combo box widgets with
+ // custom list stores.
+ virtual void GTKCreateComboBoxWidget();
+
+ virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const;
+
+ virtual GtkEntry *GetEntry() const
+ { return m_entry; }
+
+ GtkEntry* m_entry;
+
+private:
+ // From wxTextEntry:
+ virtual wxWindow *GetEditableWindow() { return this; }
+ virtual GtkEditable *GetEditable() const;
+ virtual void EnableTextChangedEvents(bool enable);
+
+ void Init();
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox)
+ DECLARE_EVENT_TABLE()
+};
+
+#endif // _WX_GTK_COMBOBOX_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/control.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling, Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_CONTROL_H_
+#define _WX_GTK_CONTROL_H_
+
+typedef struct _GtkLabel GtkLabel;
+typedef struct _GtkFrame GtkFrame;
+typedef struct _GtkEntry GtkEntry;
+
+//-----------------------------------------------------------------------------
+// wxControl
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxControl : public wxControlBase
+{
+ typedef wxControlBase base_type;
+public:
+ wxControl();
+ wxControl(wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxControlNameStr)
+ {
+ Create(parent, id, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxControlNameStr);
+
+ virtual wxVisualAttributes GetDefaultAttributes() const;
+#ifdef __WXGTK3__
+ virtual bool SetFont(const wxFont& font);
+#endif
+
+protected:
+ virtual wxSize DoGetBestSize() const;
+ void PostCreation(const wxSize& size);
+
+ // sets the label to the given string and also sets it for the given widget
+ void GTKSetLabelForLabel(GtkLabel *w, const wxString& label);
+#if wxUSE_MARKUP
+ void GTKSetLabelWithMarkupForLabel(GtkLabel *w, const wxString& label);
+#endif // wxUSE_MARKUP
+
+ // GtkFrame helpers
+ GtkWidget* GTKCreateFrame(const wxString& label);
+ void GTKSetLabelForFrame(GtkFrame *w, const wxString& label);
+ void GTKFrameApplyWidgetStyle(GtkFrame* w, GtkRcStyle* rc);
+ void GTKFrameSetMnemonicWidget(GtkFrame* w, GtkWidget* widget);
+
+ // remove mnemonics ("&"s) from the label
+ static wxString GTKRemoveMnemonics(const wxString& label);
+
+ // converts wx label to GTK+ label, i.e. basically replace "&"s with "_"s
+ static wxString GTKConvertMnemonics(const wxString &label);
+
+ // converts wx label to GTK+ labels preserving Pango markup
+ static wxString GTKConvertMnemonicsWithMarkup(const wxString& label);
+
+ // These are used by GetDefaultAttributes
+ static wxVisualAttributes
+ GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
+ bool useBase = false,
+ int state = 0);
+
+ // Widgets that use the style->base colour for the BG colour should
+ // override this and return true.
+ virtual bool UseGTKStyleBase() const { return false; }
+
+ // Fix sensitivity due to bug in GTK+ < 2.14
+ void GTKFixSensitivity(bool onlyIfUnderMouse = true);
+
+ // Ask GTK+ for preferred size. Use it after setting the font.
+ wxSize GTKGetPreferredSize(GtkWidget* widget) const;
+
+ // Inner margins in a GtkEntry
+ wxPoint GTKGetEntryMargins(GtkEntry* entry) const;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxControl)
+};
+
+#endif // _WX_GTK_CONTROL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/cursor.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_CURSOR_H_
+#define _WX_GTK_CURSOR_H_
+
+#include "wx/gdiobj.h"
+#include "wx/gdicmn.h"
+
+class WXDLLIMPEXP_FWD_CORE wxColour;
+class WXDLLIMPEXP_FWD_CORE wxImage;
+
+//-----------------------------------------------------------------------------
+// wxCursor
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject
+{
+public:
+ wxCursor();
+ wxCursor(wxStockCursor id) { InitFromStock(id); }
+#if WXWIN_COMPATIBILITY_2_8
+ wxCursor(int id) { InitFromStock((wxStockCursor)id); }
+#endif
+#if wxUSE_IMAGE
+ wxCursor( const wxImage & image );
+ wxCursor(const wxString& name,
+ wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
+ int hotSpotX = 0, int hotSpotY = 0);
+#endif
+ wxCursor( const char bits[], int width, int height,
+ int hotSpotX = -1, int hotSpotY = -1,
+ const char maskBits[] = NULL,
+ const wxColour* fg = NULL, const wxColour* bg = NULL);
+ virtual ~wxCursor();
+
+ // implementation
+
+ GdkCursor *GetCursor() const;
+
+protected:
+ void InitFromStock(wxStockCursor);
+#if wxUSE_IMAGE
+ void InitFromImage(const wxImage& image);
+#endif
+
+ virtual wxGDIRefData *CreateGDIRefData() const;
+ virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxCursor)
+};
+
+#endif // _WX_GTK_CURSOR_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/dataform.h
+// Purpose: declaration of the wxDataFormat class
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 19.10.99 (extracted from gtk/dataobj.h)
+// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_DATAFORM_H
+#define _WX_GTK_DATAFORM_H
+
+class WXDLLIMPEXP_CORE wxDataFormat
+{
+public:
+ // the clipboard formats under GDK are GdkAtoms
+ typedef GdkAtom NativeFormat;
+
+ wxDataFormat();
+ wxDataFormat( wxDataFormatId type );
+ wxDataFormat( NativeFormat format );
+
+ // we have to provide all the overloads to allow using strings instead of
+ // data formats (as a lot of existing code does)
+ wxDataFormat( const wxString& id ) { InitFromString(id); }
+ wxDataFormat( const char *id ) { InitFromString(id); }
+ wxDataFormat( const wchar_t *id ) { InitFromString(id); }
+ wxDataFormat( const wxCStrData& id ) { InitFromString(id); }
+
+ wxDataFormat& operator=(const wxDataFormat& format)
+ {
+ if (&format != this)
+ {
+ m_type = format.m_type;
+ m_format = format.m_format;
+ }
+ return *this;
+ }
+ wxDataFormat& operator=(NativeFormat format)
+ { SetId(format); return *this; }
+
+ // comparison (must have both versions)
+ bool operator==(NativeFormat format) const
+ { return m_format == (NativeFormat)format; }
+ bool operator!=(NativeFormat format) const
+ { return m_format != (NativeFormat)format; }
+ bool operator==(wxDataFormatId format) const
+ { return m_type == (wxDataFormatId)format; }
+ bool operator!=(wxDataFormatId format) const
+ { return m_type != (wxDataFormatId)format; }
+
+ // explicit and implicit conversions to NativeFormat which is one of
+ // standard data types (implicit conversion is useful for preserving the
+ // compatibility with old code)
+ NativeFormat GetFormatId() const { return m_format; }
+ operator NativeFormat() const { return m_format; }
+
+ void SetId( NativeFormat format );
+
+ // string ids are used for custom types - this SetId() must be used for
+ // application-specific formats
+ wxString GetId() const;
+ void SetId( const wxString& id );
+
+ // implementation
+ wxDataFormatId GetType() const;
+ void SetType( wxDataFormatId type );
+
+private:
+ // common part of ctors from format name
+ void InitFromString(const wxString& id);
+
+ wxDataFormatId m_type;
+ NativeFormat m_format;
+
+ void PrepareFormats();
+};
+
+#endif // _WX_GTK_DATAFORM_H
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/dataobj.h
+// Purpose: declaration of the wxDataObject
+// Author: Robert Roebling
+// Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_DATAOBJ_H_
+#define _WX_GTK_DATAOBJ_H_
+
+// ----------------------------------------------------------------------------
+// wxDataObject is the same as wxDataObjectBase under wxGTK
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDataObject : public wxDataObjectBase
+{
+public:
+ wxDataObject();
+ virtual ~wxDataObject();
+
+ virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const;
+};
+
+#endif // _WX_GTK_DATAOBJ_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/dataobj2.h
+// Purpose: declaration of standard wxDataObjectSimple-derived classes
+// Author: Robert Roebling
+// Created: 19.10.99 (extracted from gtk/dataobj.h)
+// Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_DATAOBJ2_H_
+#define _WX_GTK_DATAOBJ2_H_
+
+// ----------------------------------------------------------------------------
+// wxBitmapDataObject is a specialization of wxDataObject for bitmaps
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase
+{
+public:
+ // ctors
+ wxBitmapDataObject();
+ wxBitmapDataObject(const wxBitmap& bitmap);
+
+ // destr
+ virtual ~wxBitmapDataObject();
+
+ // override base class virtual to update PNG data too
+ virtual void SetBitmap(const wxBitmap& bitmap);
+
+ // implement base class pure virtuals
+ // ----------------------------------
+
+ virtual size_t GetDataSize() const { return m_pngSize; }
+ virtual bool GetDataHere(void *buf) const;
+ virtual bool SetData(size_t len, const void *buf);
+ // Must provide overloads to avoid hiding them (and warnings about it)
+ virtual size_t GetDataSize(const wxDataFormat&) const
+ {
+ return GetDataSize();
+ }
+ virtual bool GetDataHere(const wxDataFormat&, void *buf) const
+ {
+ return GetDataHere(buf);
+ }
+ virtual bool SetData(const wxDataFormat&, size_t len, const void *buf)
+ {
+ return SetData(len, buf);
+ }
+
+protected:
+ void Clear() { free(m_pngData); }
+ void ClearAll() { Clear(); Init(); }
+
+ size_t m_pngSize;
+ void *m_pngData;
+
+ void DoConvertToPng();
+
+private:
+ void Init() { m_pngData = NULL; m_pngSize = 0; }
+};
+
+// ----------------------------------------------------------------------------
+// wxFileDataObject is a specialization of wxDataObject for file names
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase
+{
+public:
+ // implement base class pure virtuals
+ // ----------------------------------
+
+ void AddFile( const wxString &filename );
+
+ virtual size_t GetDataSize() const;
+ virtual bool GetDataHere(void *buf) const;
+ virtual bool SetData(size_t len, const void *buf);
+ // Must provide overloads to avoid hiding them (and warnings about it)
+ virtual size_t GetDataSize(const wxDataFormat&) const
+ {
+ return GetDataSize();
+ }
+ virtual bool GetDataHere(const wxDataFormat&, void *buf) const
+ {
+ return GetDataHere(buf);
+ }
+ virtual bool SetData(const wxDataFormat&, size_t len, const void *buf)
+ {
+ return SetData(len, buf);
+ }
+};
+
+// ----------------------------------------------------------------------------
+// wxURLDataObject is a specialization of wxDataObject for URLs
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxURLDataObject : public wxDataObjectComposite
+{
+public:
+ wxURLDataObject(const wxString& url = wxEmptyString);
+
+ wxString GetURL() const;
+ void SetURL(const wxString& url);
+
+private:
+ class wxTextURIListDataObject* const m_dobjURIList;
+ wxTextDataObject* const m_dobjText;
+
+ wxDECLARE_NO_COPY_CLASS(wxURLDataObject);
+};
+
+
+#endif // _WX_GTK_DATAOBJ2_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/dataview.h
+// Purpose: wxDataViewCtrl GTK+2 implementation header
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTKDATAVIEWCTRL_H_
+#define _WX_GTKDATAVIEWCTRL_H_
+
+#include "wx/list.h"
+
+class WXDLLIMPEXP_FWD_ADV wxDataViewCtrlInternal;
+
+struct _GtkTreePath;
+
+// ---------------------------------------------------------
+// wxDataViewColumn
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewColumn: public wxDataViewColumnBase
+{
+public:
+ wxDataViewColumn( const wxString &title, wxDataViewRenderer *renderer,
+ unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn( const wxBitmap &bitmap, wxDataViewRenderer *renderer,
+ unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+
+
+ // setters:
+
+ virtual void SetTitle( const wxString &title );
+ virtual void SetBitmap( const wxBitmap &bitmap );
+
+ virtual void SetOwner( wxDataViewCtrl *owner );
+
+ virtual void SetAlignment( wxAlignment align );
+
+ virtual void SetSortable( bool sortable );
+ virtual void SetSortOrder( bool ascending );
+
+ virtual void SetResizeable( bool resizable );
+ virtual void SetHidden( bool hidden );
+
+ virtual void SetMinWidth( int minWidth );
+ virtual void SetWidth( int width );
+
+ virtual void SetReorderable( bool reorderable );
+
+ virtual void SetFlags(int flags) { SetIndividualFlags(flags); }
+
+ // getters:
+
+ virtual wxString GetTitle() const;
+ virtual wxAlignment GetAlignment() const;
+
+ virtual bool IsSortable() const;
+ virtual bool IsSortOrderAscending() const;
+ virtual bool IsSortKey() const;
+
+ virtual bool IsResizeable() const;
+ virtual bool IsHidden() const;
+
+ virtual int GetWidth() const;
+ virtual int GetMinWidth() const;
+
+ virtual bool IsReorderable() const;
+
+ virtual int GetFlags() const { return GetFromIndividualFlags(); }
+
+ // implementation
+ GtkWidget* GetGtkHandle() const { return m_column; }
+
+private:
+ // holds the GTK handle
+ GtkWidget *m_column;
+
+ // holds GTK handles for title/bitmap in the header
+ GtkWidget *m_image;
+ GtkWidget *m_label;
+
+ // delayed connection to mouse events
+ friend class wxDataViewCtrl;
+ void OnInternalIdle();
+ bool m_isConnected;
+
+ void Init(wxAlignment align, int flags, int width);
+};
+
+WX_DECLARE_LIST_WITH_DECL(wxDataViewColumn, wxDataViewColumnList,
+ class WXDLLIMPEXP_ADV);
+
+// ---------------------------------------------------------
+// wxDataViewCtrl
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewCtrl: public wxDataViewCtrlBase
+{
+public:
+ wxDataViewCtrl()
+ {
+ Init();
+ }
+
+ wxDataViewCtrl( wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxDataViewCtrlNameStr )
+ {
+ Init();
+
+ Create(parent, id, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxDataViewCtrlNameStr);
+
+ virtual ~wxDataViewCtrl();
+
+ virtual bool AssociateModel( wxDataViewModel *model );
+
+ virtual bool PrependColumn( wxDataViewColumn *col );
+ virtual bool AppendColumn( wxDataViewColumn *col );
+ virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col );
+
+ virtual unsigned int GetColumnCount() const;
+ virtual wxDataViewColumn* GetColumn( unsigned int pos ) const;
+ virtual bool DeleteColumn( wxDataViewColumn *column );
+ virtual bool ClearColumns();
+ virtual int GetColumnPosition( const wxDataViewColumn *column ) const;
+
+ virtual wxDataViewColumn *GetSortingColumn() const;
+
+ virtual int GetSelectedItemsCount() const;
+ virtual int GetSelections( wxDataViewItemArray & sel ) const;
+ virtual void SetSelections( const wxDataViewItemArray & sel );
+ virtual void Select( const wxDataViewItem & item );
+ virtual void Unselect( const wxDataViewItem & item );
+ virtual bool IsSelected( const wxDataViewItem & item ) const;
+ virtual void SelectAll();
+ virtual void UnselectAll();
+
+ virtual void EnsureVisible( const wxDataViewItem& item,
+ const wxDataViewColumn *column = NULL );
+ virtual void HitTest( const wxPoint &point,
+ wxDataViewItem &item,
+ wxDataViewColumn *&column ) const;
+ virtual wxRect GetItemRect( const wxDataViewItem &item,
+ const wxDataViewColumn *column = NULL ) const;
+
+ virtual bool SetRowHeight( int rowHeight );
+
+ virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column);
+
+ virtual void Expand( const wxDataViewItem & item );
+ virtual void Collapse( const wxDataViewItem & item );
+ virtual bool IsExpanded( const wxDataViewItem & item ) const;
+
+ virtual bool EnableDragSource( const wxDataFormat &format );
+ virtual bool EnableDropTarget( const wxDataFormat &format );
+
+ virtual wxDataViewColumn *GetCurrentColumn() const;
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ wxWindow *GetMainWindow() { return (wxWindow*) this; }
+
+ GtkWidget *GtkGetTreeView() { return m_treeview; }
+ wxDataViewCtrlInternal* GtkGetInternal() { return m_internal; }
+
+ // Convert GTK path to our item. Returned item may be invalid if get_iter()
+ // failed.
+ wxDataViewItem GTKPathToItem(struct _GtkTreePath *path) const;
+
+ virtual void OnInternalIdle();
+
+ int GTKGetUniformRowHeight() const { return m_uniformRowHeight; }
+
+protected:
+ virtual void DoSetExpanderColumn();
+ virtual void DoSetIndent();
+
+ virtual void DoApplyWidgetStyle(GtkRcStyle *style);
+
+private:
+ void Init();
+
+ virtual wxDataViewItem DoGetCurrentItem() const;
+ virtual void DoSetCurrentItem(const wxDataViewItem& item);
+
+ // Return wxDataViewColumn matching the given GtkTreeViewColumn.
+ //
+ // If the input argument is NULL, return NULL too. Otherwise we must find
+ // the matching column and assert if we didn't.
+ wxDataViewColumn* FromGTKColumn(GtkTreeViewColumn *gtk_col) const;
+
+ friend class wxDataViewCtrlDCImpl;
+ friend class wxDataViewColumn;
+ friend class wxDataViewCtrlInternal;
+
+ GtkWidget *m_treeview;
+ wxDataViewCtrlInternal *m_internal;
+ wxDataViewColumnList m_cols;
+ wxDataViewItem m_ensureVisibleDefered;
+
+ // By default this is set to -1 and the height of the rows is determined by
+ // GetRect() methods of the renderers but this can be set to a positive
+ // value to force the height of all rows to the given value.
+ int m_uniformRowHeight;
+
+ virtual void AddChildGTK(wxWindowGTK* child);
+ void GtkEnableSelectionEvents();
+ void GtkDisableSelectionEvents();
+
+ DECLARE_DYNAMIC_CLASS(wxDataViewCtrl)
+ wxDECLARE_NO_COPY_CLASS(wxDataViewCtrl);
+};
+
+
+#endif // _WX_GTKDATAVIEWCTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/dialog.h
+// Purpose:
+// Author: Robert Roebling
+// Created:
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTKDIALOG_H_
+#define _WX_GTKDIALOG_H_
+
+class WXDLLIMPEXP_FWD_CORE wxGUIEventLoop;
+
+//-----------------------------------------------------------------------------
+// wxDialog
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDialog: public wxDialogBase
+{
+public:
+ wxDialog() { Init(); }
+ wxDialog( wxWindow *parent, wxWindowID id,
+ const wxString &title,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE,
+ const wxString &name = wxDialogNameStr );
+ bool Create( wxWindow *parent, wxWindowID id,
+ const wxString &title,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE,
+ const wxString &name = wxDialogNameStr );
+ virtual ~wxDialog();
+
+ virtual bool Show( bool show = true );
+ virtual int ShowModal();
+ virtual void EndModal( int retCode );
+ virtual bool IsModal() const;
+
+private:
+ // common part of all ctors
+ void Init();
+
+ bool m_modalShowing;
+ wxGUIEventLoop *m_modalLoop;
+
+ DECLARE_DYNAMIC_CLASS(wxDialog)
+};
+
+#endif // _WX_GTKDIALOG_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/dirdlg.h
+// Purpose: wxDirDialog
+// Author: Francesco Montorsi
+// Copyright: (c) 2006 Francesco Montorsi
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __GTKDIRDLGH__
+#define __GTKDIRDLGH__
+
+//-------------------------------------------------------------------------
+// wxDirDialog
+//-------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDirDialog : public wxDirDialogBase
+{
+public:
+ wxDirDialog() { }
+
+ wxDirDialog(wxWindow *parent,
+ const wxString& message = wxDirSelectorPromptStr,
+ const wxString& defaultPath = wxEmptyString,
+ long style = wxDD_DEFAULT_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ const wxString& name = wxDirDialogNameStr);
+ bool Create(wxWindow *parent,
+ const wxString& message = wxDirSelectorPromptStr,
+ const wxString& defaultPath = wxEmptyString,
+ long style = wxDD_DEFAULT_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ const wxString& name = wxDirDialogNameStr);
+ virtual ~wxDirDialog() { }
+
+
+public: // overrides from wxGenericDirDialog
+
+ wxString GetPath() const;
+ void SetPath(const wxString& path);
+
+
+ // Implementation only.
+
+ void GTKOnAccept();
+ void GTKOnCancel();
+
+protected:
+ // override this from wxTLW since the native
+ // form doesn't have any m_wxwindow
+ virtual void DoSetSize(int x, int y,
+ int width, int height,
+ int sizeFlags = wxSIZE_AUTO);
+
+
+private:
+ wxString m_selectedDirectory;
+
+ DECLARE_DYNAMIC_CLASS(wxDirDialog)
+};
+
+#endif // __GTKDIRDLGH__
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/dnd.h
+// Purpose: declaration of the wxDropTarget class
+// Author: Robert Roebling
+// Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_DND_H_
+#define _WX_GTK_DND_H_
+
+#include "wx/icon.h"
+
+// ----------------------------------------------------------------------------
+// macros
+// ----------------------------------------------------------------------------
+
+// this macro may be used instead for wxDropSource ctor arguments: it will use
+// the icon 'name' from an XPM file under GTK, but will expand to something
+// else under MSW. If you don't use it, you will have to use #ifdef in the
+// application code.
+#define wxDROP_ICON(name) wxICON(name)
+
+//-------------------------------------------------------------------------
+// wxDropTarget
+//-------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDropTarget: public wxDropTargetBase
+{
+public:
+ wxDropTarget(wxDataObject *dataObject = NULL );
+
+ virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
+ virtual bool OnDrop(wxCoord x, wxCoord y);
+ virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
+ virtual bool GetData();
+
+ // Can only be called during OnXXX methods.
+ wxDataFormat GetMatchingPair();
+
+ // implementation
+
+ GdkAtom GTKGetMatchingPair(bool quiet = false);
+ wxDragResult GTKFigureOutSuggestedAction();
+
+ void GtkRegisterWidget( GtkWidget *widget );
+ void GtkUnregisterWidget( GtkWidget *widget );
+
+ GdkDragContext *m_dragContext;
+ GtkWidget *m_dragWidget;
+ GtkSelectionData *m_dragData;
+ unsigned m_dragTime;
+ bool m_firstMotion; // gdk has no "gdk_drag_enter" event
+
+ void GTKSetDragContext( GdkDragContext *dc ) { m_dragContext = dc; }
+ void GTKSetDragWidget( GtkWidget *w ) { m_dragWidget = w; }
+ void GTKSetDragData( GtkSelectionData *sd ) { m_dragData = sd; }
+ void GTKSetDragTime(unsigned time) { m_dragTime = time; }
+};
+
+//-------------------------------------------------------------------------
+// wxDropSource
+//-------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase
+{
+public:
+ // constructor. set data later with SetData()
+ wxDropSource( wxWindow *win = NULL,
+ const wxIcon © = wxNullIcon,
+ const wxIcon &move = wxNullIcon,
+ const wxIcon &none = wxNullIcon);
+
+ // constructor for setting one data object
+ wxDropSource( wxDataObject& data,
+ wxWindow *win,
+ const wxIcon © = wxNullIcon,
+ const wxIcon &move = wxNullIcon,
+ const wxIcon &none = wxNullIcon);
+
+ virtual ~wxDropSource();
+
+ // set the icon corresponding to given drag result
+ void SetIcon(wxDragResult res, const wxIcon& icon)
+ {
+ if ( res == wxDragCopy )
+ m_iconCopy = icon;
+ else if ( res == wxDragMove )
+ m_iconMove = icon;
+ else
+ m_iconNone = icon;
+ }
+
+ // start drag action
+ virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
+
+ void PrepareIcon( int action, GdkDragContext *context );
+
+ GtkWidget *m_widget;
+ GtkWidget *m_iconWindow;
+ GdkDragContext *m_dragContext;
+ wxWindow *m_window;
+
+ wxDragResult m_retValue;
+ wxIcon m_iconCopy,
+ m_iconMove,
+ m_iconNone;
+
+ bool m_waiting;
+
+private:
+ // common part of both ctors
+ void SetIcons(const wxIcon& copy,
+ const wxIcon& move,
+ const wxIcon& none);
+
+ // GTK implementation
+ void GTKConnectDragSignals();
+ void GTKDisconnectDragSignals();
+
+};
+
+#endif // _WX_GTK_DND_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/dvrenderer.h
+// Purpose: wxDataViewRenderer for GTK wxDataViewCtrl implementation
+// Author: Robert Roebling, Vadim Zeitlin
+// Created: 2009-11-07 (extracted from wx/gtk/dataview.h)
+// Copyright: (c) 2006 Robert Roebling
+// (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_DVRENDERER_H_
+#define _WX_GTK_DVRENDERER_H_
+
+typedef struct _GtkCellRendererText GtkCellRendererText;
+typedef struct _GtkTreeViewColumn GtkTreeViewColumn;
+
+// ----------------------------------------------------------------------------
+// wxDataViewRenderer
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewRendererBase
+{
+public:
+ wxDataViewRenderer( const wxString &varianttype,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+ virtual void SetMode( wxDataViewCellMode mode );
+ virtual wxDataViewCellMode GetMode() const;
+
+ virtual void SetAlignment( int align );
+ virtual int GetAlignment() const;
+
+ virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE);
+ virtual wxEllipsizeMode GetEllipsizeMode() const;
+
+ // GTK-specific implementation
+ // ---------------------------
+
+ // pack the GTK cell renderers used by this renderer to the given column
+ //
+ // by default only a single m_renderer is used but some renderers use more
+ // than one GTK cell renderer
+ virtual void GtkPackIntoColumn(GtkTreeViewColumn *column);
+
+ // called when the cell value was edited by user with the new value
+ //
+ // it validates the new value and notifies the model about the change by
+ // calling GtkOnCellChanged() if it was accepted
+ virtual void GtkOnTextEdited(const char *itempath, const wxString& value);
+
+ GtkCellRenderer* GetGtkHandle() { return m_renderer; }
+ void GtkInitHandlers();
+ void GtkUpdateAlignment() { GtkApplyAlignment(m_renderer); }
+
+ // should be overridden to return true if the renderer supports properties
+ // corresponding to wxDataViewItemAttr field, see wxGtkTreeCellDataFunc()
+ // for details
+ virtual bool GtkSupportsAttrs() const { return false; }
+
+ // if GtkSupportsAttrs() returns true, this function will be called to
+ // effectively set the attribute to use for rendering the next item
+ //
+ // it should return true if the attribute had any non-default properties
+ virtual bool GtkSetAttr(const wxDataViewItemAttr& WXUNUSED(attr))
+ { return false; }
+
+
+ // these functions are only called if GtkSupportsAttrs() returns true and
+ // are used to remember whether the renderer currently uses the default
+ // attributes or if we changed (and not reset them)
+ bool GtkIsUsingDefaultAttrs() const { return m_usingDefaultAttrs; }
+ void GtkSetUsingDefaultAttrs(bool def) { m_usingDefaultAttrs = def; }
+
+ // return the text renderer used by this renderer for setting text cell
+ // specific attributes: can return NULL if this renderer doesn't render any
+ // text
+ virtual GtkCellRendererText *GtkGetTextRenderer() const { return NULL; }
+
+ wxDataViewCellMode GtkGetMode() { return m_mode; }
+
+protected:
+ virtual void GtkOnCellChanged(const wxVariant& value,
+ const wxDataViewItem& item,
+ unsigned col);
+
+ // Apply our effective alignment (i.e. m_alignment if specified or the
+ // associated column alignment by default) to the given renderer.
+ void GtkApplyAlignment(GtkCellRenderer *renderer);
+
+ GtkCellRenderer *m_renderer;
+ int m_alignment;
+ wxDataViewCellMode m_mode;
+
+ // true if we hadn't changed any visual attributes or restored them since
+ // doing this
+ bool m_usingDefaultAttrs;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
+};
+
+#endif // _WX_GTK_DVRENDERER_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/dvrenderers.h
+// Purpose: All GTK wxDataViewCtrl renderer classes
+// Author: Robert Roebling, Vadim Zeitlin
+// Created: 2009-11-07 (extracted from wx/gtk/dataview.h)
+// Copyright: (c) 2006 Robert Roebling
+// (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_DVRENDERERS_H_
+#define _WX_GTK_DVRENDERERS_H_
+
+#ifdef __WXGTK3__
+ typedef struct _cairo_rectangle_int cairo_rectangle_int_t;
+ typedef cairo_rectangle_int_t GdkRectangle;
+#else
+ typedef struct _GdkRectangle GdkRectangle;
+#endif
+
+// ---------------------------------------------------------
+// wxDataViewTextRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewTextRenderer( const wxString &varianttype = "string",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+ virtual bool SetValue( const wxVariant &value )
+ {
+ return SetTextValue(value);
+ }
+
+ virtual bool GetValue( wxVariant &value ) const
+ {
+ wxString str;
+ if ( !GetTextValue(str) )
+ return false;
+
+ value = str;
+
+ return true;
+ }
+
+ virtual void SetAlignment( int align );
+
+ virtual bool GtkSupportsAttrs() const { return true; }
+ virtual bool GtkSetAttr(const wxDataViewItemAttr& attr);
+
+ virtual GtkCellRendererText *GtkGetTextRenderer() const;
+
+protected:
+ // implementation of Set/GetValue()
+ bool SetTextValue(const wxString& str);
+ bool GetTextValue(wxString& str) const;
+
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewBitmapRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewBitmapRenderer( const wxString &varianttype = "wxBitmap",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+ bool SetValue( const wxVariant &value );
+ bool GetValue( wxVariant &value ) const;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewToggleRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewToggleRenderer( const wxString &varianttype = "bool",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+ bool SetValue( const wxVariant &value );
+ bool GetValue( wxVariant &value ) const;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewCustomRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewCustomRendererBase
+{
+public:
+ wxDataViewCustomRenderer( const wxString &varianttype = "string",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT,
+ bool no_init = false );
+ virtual ~wxDataViewCustomRenderer();
+
+
+ // Create DC on request
+ virtual wxDC *GetDC();
+
+ // override the base class function to use GTK text cell renderer
+ virtual void RenderText(const wxString& text,
+ int xoffset,
+ wxRect cell,
+ wxDC *dc,
+ int state);
+
+ struct GTKRenderParams;
+
+ // store GTK render call parameters for possible later use
+ void GTKSetRenderParams(GTKRenderParams* renderParams)
+ {
+ m_renderParams = renderParams;
+ }
+
+ // we may or not support attributes, as we don't know it, return true to
+ // make it possible to use them
+ virtual bool GtkSupportsAttrs() const { return true; }
+
+ virtual bool GtkSetAttr(const wxDataViewItemAttr& attr)
+ {
+ SetAttr(attr);
+ return !attr.IsDefault();
+ }
+
+ virtual GtkCellRendererText *GtkGetTextRenderer() const;
+
+private:
+ bool Init(wxDataViewCellMode mode, int align);
+
+ // Called from GtkGetTextRenderer() to really create the renderer if
+ // necessary.
+ void GtkInitTextRenderer();
+
+ wxDC *m_dc;
+
+ GtkCellRendererText *m_text_renderer;
+
+ // parameters of the original render() call stored so that we could pass
+ // them forward to m_text_renderer if our RenderText() is called
+ GTKRenderParams* m_renderParams;
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewProgressRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewCustomRenderer
+{
+public:
+ wxDataViewProgressRenderer( const wxString &label = wxEmptyString,
+ const wxString &varianttype = "long",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+ virtual ~wxDataViewProgressRenderer();
+
+ bool SetValue( const wxVariant &value );
+ bool GetValue( wxVariant &value ) const;
+
+ virtual bool Render( wxRect cell, wxDC *dc, int state );
+ virtual wxSize GetSize() const;
+
+private:
+ void GTKSetLabel();
+
+ wxString m_label;
+ int m_value;
+
+#if !wxUSE_UNICODE
+ // Flag used to indicate that we need to set the label because we were
+ // unable to do it in the ctor (see comments there).
+ bool m_needsToSetLabel;
+#endif // !wxUSE_UNICODE
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewIconTextRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewTextRenderer
+{
+public:
+ wxDataViewIconTextRenderer( const wxString &varianttype = "wxDataViewIconText",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+ virtual ~wxDataViewIconTextRenderer();
+
+ bool SetValue( const wxVariant &value );
+ bool GetValue( wxVariant &value ) const;
+
+ virtual void GtkPackIntoColumn(GtkTreeViewColumn *column);
+
+protected:
+ virtual void GtkOnCellChanged(const wxVariant& value,
+ const wxDataViewItem& item,
+ unsigned col);
+
+private:
+ wxDataViewIconText m_value;
+
+ // we use the base class m_renderer for the text and this one for the icon
+ GtkCellRenderer *m_rendererIcon;
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer)
+};
+
+// -------------------------------------
+// wxDataViewChoiceRenderer
+// -------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewChoiceRenderer: public wxDataViewCustomRenderer
+{
+public:
+ wxDataViewChoiceRenderer(const wxArrayString &choices,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
+ int alignment = wxDVR_DEFAULT_ALIGNMENT );
+ virtual bool Render( wxRect rect, wxDC *dc, int state );
+ virtual wxSize GetSize() const;
+ virtual bool SetValue( const wxVariant &value );
+ virtual bool GetValue( wxVariant &value ) const;
+
+ void SetAlignment( int align );
+
+ wxString GetChoice(size_t index) const { return m_choices[index]; }
+ const wxArrayString& GetChoices() const { return m_choices; }
+
+private:
+ wxArrayString m_choices;
+ wxString m_data;
+};
+
+// ----------------------------------------------------------------------------
+// wxDataViewChoiceByIndexRenderer
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewChoiceByIndexRenderer: public wxDataViewChoiceRenderer
+{
+public:
+ wxDataViewChoiceByIndexRenderer( const wxArrayString &choices,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
+ int alignment = wxDVR_DEFAULT_ALIGNMENT );
+
+ virtual bool SetValue( const wxVariant &value );
+ virtual bool GetValue( wxVariant &value ) const;
+
+private:
+ virtual void GtkOnTextEdited(const char *itempath, const wxString& str);
+};
+
+
+
+#endif // _WX_GTK_DVRENDERERS_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/evtloop.h
+// Purpose: wxGTK event loop implementation
+// Author: Vadim Zeitlin
+// Created: 2008-12-27
+// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_EVTLOOP_H_
+#define _WX_GTK_EVTLOOP_H_
+
+// ----------------------------------------------------------------------------
+// wxGUIEventLoop for wxGTK
+// ----------------------------------------------------------------------------
+
+typedef union _GdkEvent GdkEvent;
+
+class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxEventLoopBase
+{
+public:
+ wxGUIEventLoop();
+
+ virtual void ScheduleExit(int rc = 0);
+ virtual bool Pending() const;
+ virtual bool Dispatch();
+ virtual int DispatchTimeout(unsigned long timeout);
+ virtual void WakeUp();
+ virtual bool YieldFor(long eventsToProcess);
+
+ void StoreGdkEventForLaterProcessing(GdkEvent* ev)
+ { m_arrGdkEvents.Add(ev); }
+
+protected:
+ virtual int DoRun();
+
+private:
+ // the exit code of this event loop
+ int m_exitcode;
+
+ // used to temporarily store events in DoYield()
+ wxArrayPtrVoid m_arrGdkEvents;
+
+ wxDECLARE_NO_COPY_CLASS(wxGUIEventLoop);
+};
+
+#endif // _WX_GTK_EVTLOOP_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/evtloopsrc.h
+// Purpose: wxGTKEventLoopSource class
+// Author: Vadim Zeitlin
+// Created: 2009-10-21
+// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_EVTLOOPSRC_H_
+#define _WX_GTK_EVTLOOPSRC_H_
+
+// ----------------------------------------------------------------------------
+// wxGTKEventLoopSource: wxEventLoopSource for GTK port
+// ----------------------------------------------------------------------------
+
+class wxGTKEventLoopSource : public wxEventLoopSource
+{
+public:
+ // sourceId is the id of the watch in GTK context, not the FD of the file
+ // this source corresponds to
+ wxGTKEventLoopSource(unsigned sourceId,
+ wxEventLoopSourceHandler *handler,
+ int flags)
+ : wxEventLoopSource(handler, flags),
+ m_sourceId(sourceId)
+ {
+ }
+
+ virtual ~wxGTKEventLoopSource();
+
+private:
+ const unsigned m_sourceId;
+
+ wxDECLARE_NO_COPY_CLASS(wxGTKEventLoopSource);
+};
+
+#endif // _WX_GTK_EVTLOOPSRC_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/filectrl.h
+// Purpose: wxGtkFileCtrl Header
+// Author: Diaa M. Sami
+// Modified by:
+// Created: Aug-10-2007
+// Copyright: (c) Diaa M. Sami
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef _WX_GTK_FILECTRL_H_
+#define _WX_GTK_FILECTRL_H_
+
+#include "wx/control.h"
+#include "wx/filectrl.h"
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorDefaultWildcardStr[];
+
+typedef struct _GtkFileChooser GtkFileChooser;
+
+// [GTK] current problems:
+// All methods(e.g. SetFilename(), SetPath(), etc) which change the state of
+// the control result in events fired, such events should be suppressed.
+// ------
+// Sometimes a selection event(with 0 files) is fired before
+// wxEVT_FILECTRL_FOLDERCHANGED, unfortunately this can hardly be detected!
+
+// A wx wrapper for any Gtk object implementing the interface GtkFileChooser
+
+class WXDLLIMPEXP_CORE wxGtkFileChooser
+{
+public:
+ wxGtkFileChooser() { m_ignoreNextFilterEvent = false; }
+
+ void SetWidget(GtkFileChooser *w);
+
+ wxString GetPath() const;
+ void GetPaths( wxArrayString& paths ) const;
+ wxString GetDirectory() const;
+ wxString GetFilename() const;
+ void GetFilenames( wxArrayString& files ) const;
+ int GetFilterIndex() const;
+
+ bool SetPath( const wxString& path );
+ bool SetDirectory( const wxString& dir );
+ void SetWildcard( const wxString& wildCard );
+ void SetFilterIndex( int filterIndex );
+
+ bool HasFilterChoice() const;
+
+ bool ShouldIgnoreNextFilterEvent() const { return m_ignoreNextFilterEvent; }
+
+ wxString GetCurrentWildCard() const
+ { return m_wildcards[GetFilterIndex()]; }
+
+private:
+ GtkFileChooser *m_widget;
+ // First wildcard in filter, to be used when the user
+ // saves a file without giving an extension.
+ wxArrayString m_wildcards;
+
+ // If true, ignore the next event because it was generated by us and not
+ // the user.
+ bool m_ignoreNextFilterEvent;
+};
+
+#if wxUSE_FILECTRL
+
+class WXDLLIMPEXP_CORE wxGtkFileCtrl: public wxControl,
+ public wxFileCtrlBase
+{
+public:
+ wxGtkFileCtrl () { Init(); }
+
+ wxGtkFileCtrl ( wxWindow *parent,
+ wxWindowID id,
+ const wxString& defaultDirectory = wxEmptyString,
+ const wxString& defaultFilename = wxEmptyString,
+ const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
+ long style = wxFC_DEFAULT_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ const wxString& name = wxFileCtrlNameStr )
+ {
+ Init();
+ Create( parent, id, defaultDirectory, defaultFilename, wildCard, style, pos, size, name );
+ }
+
+ virtual ~wxGtkFileCtrl();
+
+ bool Create( wxWindow *parent,
+ wxWindowID id,
+ const wxString& defaultDirectory = wxEmptyString,
+ const wxString& defaultFileName = wxEmptyString,
+ const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
+ long style = wxFC_DEFAULT_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ const wxString& name = wxFileCtrlNameStr );
+
+ virtual void SetWildcard( const wxString& wildCard );
+ virtual void SetFilterIndex( int filterIndex );
+ virtual bool SetDirectory( const wxString& dir );
+ virtual bool SetFilename( const wxString& name );
+ virtual bool SetPath( const wxString& path );
+
+ virtual wxString GetFilename() const;
+ virtual wxString GetDirectory() const;
+ virtual wxString GetWildcard() const { return this->m_wildCard; }
+ virtual wxString GetPath() const;
+ virtual void GetPaths( wxArrayString& paths ) const;
+ virtual void GetFilenames( wxArrayString& files ) const;
+ virtual int GetFilterIndex() const { return m_fc.GetFilterIndex(); }
+
+ virtual bool HasMultipleFileSelection() const { return HasFlag( wxFC_MULTIPLE ); }
+ virtual void ShowHidden(bool show);
+
+ virtual bool HasFilterChoice() const
+ { return m_fc.HasFilterChoice(); }
+
+
+ // Implementation only from now on.
+ bool GTKShouldIgnoreNextFilterEvent() const
+ { return m_fc.ShouldIgnoreNextFilterEvent(); }
+
+ bool m_checkNextSelEvent;
+ bool m_ignoreNextFolderChangeEvent;
+
+protected:
+ GtkFileChooser *m_fcWidget;
+ wxGtkFileChooser m_fc;
+ wxString m_wildCard;
+
+private:
+ void Init();
+
+ DECLARE_DYNAMIC_CLASS( wxGtkFileCtrl )
+};
+
+#endif // wxUSE_FILECTRL
+
+#endif // _WX_GTK_FILECTRL_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/filedlg.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTKFILEDLG_H_
+#define _WX_GTKFILEDLG_H_
+
+#include "wx/gtk/filectrl.h" // for wxGtkFileChooser
+
+//-------------------------------------------------------------------------
+// wxFileDialog
+//-------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFileDialog: public wxFileDialogBase
+{
+public:
+ wxFileDialog() { }
+
+ wxFileDialog(wxWindow *parent,
+ const wxString& message = wxFileSelectorPromptStr,
+ const wxString& defaultDir = wxEmptyString,
+ const wxString& defaultFile = wxEmptyString,
+ const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
+ long style = wxFD_DEFAULT_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& sz = wxDefaultSize,
+ const wxString& name = wxFileDialogNameStr);
+ bool Create(wxWindow *parent,
+ const wxString& message = wxFileSelectorPromptStr,
+ const wxString& defaultDir = wxEmptyString,
+ const wxString& defaultFile = wxEmptyString,
+ const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
+ long style = wxFD_DEFAULT_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& sz = wxDefaultSize,
+ const wxString& name = wxFileDialogNameStr);
+ virtual ~wxFileDialog();
+
+ virtual wxString GetPath() const;
+ virtual void GetPaths(wxArrayString& paths) const;
+ virtual wxString GetFilename() const;
+ virtual void GetFilenames(wxArrayString& files) const;
+ virtual int GetFilterIndex() const;
+
+ virtual void SetMessage(const wxString& message);
+ virtual void SetPath(const wxString& path);
+ virtual void SetDirectory(const wxString& dir);
+ virtual void SetFilename(const wxString& name);
+ virtual void SetWildcard(const wxString& wildCard);
+ virtual void SetFilterIndex(int filterIndex);
+
+ virtual int ShowModal();
+
+ virtual bool SupportsExtraControl() const { return true; }
+
+ // Implementation only.
+ void GTKSelectionChanged(const wxString& filename);
+
+
+protected:
+ // override this from wxTLW since the native
+ // form doesn't have any m_wxwindow
+ virtual void DoSetSize(int x, int y,
+ int width, int height,
+ int sizeFlags = wxSIZE_AUTO);
+
+
+private:
+ void OnFakeOk( wxCommandEvent &event );
+ void OnSize(wxSizeEvent&);
+ virtual void AddChildGTK(wxWindowGTK* child);
+
+ wxGtkFileChooser m_fc;
+
+ DECLARE_DYNAMIC_CLASS(wxFileDialog)
+ DECLARE_EVENT_TABLE()
+};
+
+#endif // _WX_GTKFILEDLG_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/filehistory.h
+// Purpose: GTK+ bits for wxFileHistory
+// Author: Vaclav Slavik
+// Created: 2010-05-06
+// Copyright: (c) 2010 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_FILEHISTORY_H_
+#define _WX_GTK_FILEHISTORY_H_
+
+class WXDLLIMPEXP_CORE wxFileHistory : public wxFileHistoryBase
+{
+public:
+ wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1)
+ : wxFileHistoryBase(maxFiles, idBase) {}
+
+ virtual void AddFileToHistory(const wxString& file);
+
+ DECLARE_DYNAMIC_CLASS(wxFileHistory)
+};
+
+#endif // _WX_GTK_FILEHISTORY_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/filedirpicker.h
+// Purpose: wxFileButton, wxDirButton header
+// Author: Francesco Montorsi
+// Modified by:
+// Created: 14/4/2006
+// Copyright: (c) Francesco Montorsi
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_FILEPICKER_H_
+#define _WX_GTK_FILEPICKER_H_
+
+// since GtkColorButton is available only for GTK+ >= 2.4,
+// we need to use generic versions if we detect (at runtime)
+// that GTK+ < 2.4
+#include "wx/generic/filepickerg.h"
+
+//-----------------------------------------------------------------------------
+// wxFileButton and wxDirButton shared code
+// (cannot be a base class since they need to derive from wxGenericFileButton
+// and from wxGenericDirButton classes !)
+//-----------------------------------------------------------------------------
+
+#define FILEDIRBTN_OVERRIDES \
+ /* NULL is because of a problem with destruction order which happens */ \
+ /* if we pass GetParent(): in fact, this GTK native implementation */ \
+ /* needs to create the dialog in ::Create() and not for each user */ \
+ /* request in response to the user click as the generic implementation */ \
+ /* does. */ \
+ virtual wxWindow *GetDialogParent() \
+ { \
+ return NULL; \
+ } \
+ \
+ /* even if wx derive from wxGenericFileButton, i.e. from wxButton, our */ \
+ /* native GTK+ widget does not derive from GtkButton thus *all* uses */ \
+ /* GTK_BUTTON(m_widget) macro done by wxButton must be bypassed to */ \
+ /* avoid bunch of GTK+ warnings like: */ \
+ /* invalid cast from `GtkFileChooserButton' to `GtkButton' */ \
+ /* so, override wxButton::GTKGetWindow and return NULL as GTK+ doesn't */ \
+ /* give us access to the internal GdkWindow of a GtkFileChooserButton */ \
+protected: \
+ virtual GdkWindow * \
+ GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const \
+ { return NULL; }
+
+
+//-----------------------------------------------------------------------------
+// wxFileButton
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFileButton : public wxGenericFileButton
+{
+public:
+ wxFileButton() { Init(); }
+ wxFileButton(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label = wxFilePickerWidgetLabel,
+ const wxString &path = wxEmptyString,
+ const wxString &message = wxFileSelectorPromptStr,
+ const wxString &wildcard = wxFileSelectorDefaultWildcardStr,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxFILEBTN_DEFAULT_STYLE,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxFilePickerWidgetNameStr)
+ {
+ Init();
+ m_pickerStyle = style;
+ Create(parent, id, label, path, message, wildcard,
+ pos, size, style, validator, name);
+ }
+
+ virtual ~wxFileButton();
+
+
+public: // overrides
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label = wxFilePickerWidgetLabel,
+ const wxString &path = wxEmptyString,
+ const wxString &message = wxFileSelectorPromptStr,
+ const wxString &wildcard = wxFileSelectorDefaultWildcardStr,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxFilePickerWidgetNameStr);
+
+ // event handler for the click
+ void OnDialogOK(wxCommandEvent &);
+
+ virtual void SetPath(const wxString &str);
+ virtual void SetInitialDirectory(const wxString& dir);
+
+ // see macro defined above
+ FILEDIRBTN_OVERRIDES
+
+protected:
+ wxDialog *m_dialog;
+
+private:
+ // common part of all ctors
+ void Init() { m_dialog = NULL; }
+
+ DECLARE_DYNAMIC_CLASS(wxFileButton)
+};
+
+
+//-----------------------------------------------------------------------------
+// wxDirButton
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDirButton : public wxGenericDirButton
+{
+public:
+ wxDirButton() { Init(); }
+ wxDirButton(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label = wxFilePickerWidgetLabel,
+ const wxString &path = wxEmptyString,
+ const wxString &message = wxFileSelectorPromptStr,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDIRBTN_DEFAULT_STYLE,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxFilePickerWidgetNameStr)
+ {
+ Init();
+
+ m_pickerStyle = style;
+
+ Create(parent, id, label, path, message, wxEmptyString,
+ pos, size, style, validator, name);
+ }
+
+ virtual ~wxDirButton();
+
+
+public: // overrides
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label = wxFilePickerWidgetLabel,
+ const wxString &path = wxEmptyString,
+ const wxString &message = wxFileSelectorPromptStr,
+ const wxString &wildcard = wxFileSelectorDefaultWildcardStr,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxFilePickerWidgetNameStr);
+
+
+ // GtkFileChooserButton does not support GTK_FILE_CHOOSER_CREATE_FOLDER
+ // thus we must ensure that the wxDD_DIR_MUST_EXIST style was given
+ long GetDialogStyle() const
+ {
+ return (wxGenericDirButton::GetDialogStyle() | wxDD_DIR_MUST_EXIST);
+ }
+
+ virtual void SetPath(const wxString &str);
+ virtual void SetInitialDirectory(const wxString& dir);
+
+ // see macro defined above
+ FILEDIRBTN_OVERRIDES
+
+protected:
+ wxDialog *m_dialog;
+
+public: // used by the GTK callback only
+
+ bool m_bIgnoreNextChange;
+
+ void GTKUpdatePath(const char *gtkpath);
+
+private:
+ void Init()
+ {
+ m_dialog = NULL;
+ m_bIgnoreNextChange = false;
+ }
+
+ DECLARE_DYNAMIC_CLASS(wxDirButton)
+};
+
+#undef FILEDIRBTN_OVERRIDES
+
+#endif // _WX_GTK_FILEPICKER_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/font.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_FONT_H_
+#define _WX_GTK_FONT_H_
+
+// ----------------------------------------------------------------------------
+// wxFont
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFont : public wxFontBase
+{
+public:
+ wxFont() { }
+
+ wxFont(const wxFontInfo& info);
+
+ wxFont(const wxString& nativeFontInfoString)
+ {
+ Create(nativeFontInfoString);
+ }
+
+ wxFont(const wxNativeFontInfo& info);
+
+#if FUTURE_WXWIN_COMPATIBILITY_3_0
+ wxFont(int size,
+ int family,
+ int style,
+ int weight,
+ bool underlined = false,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
+ {
+ (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
+ }
+#endif
+
+ wxFont(int size,
+ wxFontFamily family,
+ wxFontStyle style,
+ wxFontWeight weight,
+ bool underlined = false,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
+ {
+ Create(size, family, style, weight, underlined, face, encoding);
+ }
+
+ wxFont(const wxSize& pixelSize,
+ wxFontFamily family,
+ wxFontStyle style,
+ wxFontWeight weight,
+ bool underlined = false,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
+ {
+ Create(10, family, style, weight, underlined, face, encoding);
+ SetPixelSize(pixelSize);
+ }
+
+ bool Create(int size,
+ wxFontFamily family,
+ wxFontStyle style,
+ wxFontWeight weight,
+ bool underlined = false,
+ const wxString& face = wxEmptyString,
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
+
+ // wxGTK-specific
+ bool Create(const wxString& fontname);
+
+ virtual ~wxFont();
+
+ // implement base class pure virtuals
+ virtual int GetPointSize() const;
+ virtual wxFontStyle GetStyle() const;
+ virtual wxFontWeight GetWeight() const;
+ virtual wxString GetFaceName() const;
+ virtual bool GetUnderlined() const;
+ virtual bool GetStrikethrough() const;
+ virtual wxFontEncoding GetEncoding() const;
+ virtual const wxNativeFontInfo *GetNativeFontInfo() const;
+ virtual bool IsFixedWidth() const;
+
+ virtual void SetPointSize( int pointSize );
+ virtual void SetFamily(wxFontFamily family);
+ virtual void SetStyle(wxFontStyle style);
+ virtual void SetWeight(wxFontWeight weight);
+ virtual bool SetFaceName( const wxString& faceName );
+ virtual void SetUnderlined( bool underlined );
+ virtual void SetStrikethrough(bool strikethrough);
+ virtual void SetEncoding(wxFontEncoding encoding);
+
+ wxDECLARE_COMMON_FONT_METHODS();
+
+ // Set Pango attributes in the specified layout. Currently only
+ // underlined and strike-through attributes are handled by this function.
+ //
+ // If neither of them is specified, returns false, otherwise sets up the
+ // attributes and returns true.
+ bool GTKSetPangoAttrs(PangoLayout* layout) const;
+
+ // implementation from now on
+ void Unshare();
+
+ // no data :-)
+
+protected:
+ virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info );
+
+ virtual wxGDIRefData* CreateGDIRefData() const;
+ virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const;
+
+ virtual wxFontFamily DoGetFamily() const;
+
+private:
+ void Init();
+
+ DECLARE_DYNAMIC_CLASS(wxFont)
+};
+
+#endif // _WX_GTK_FONT_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/fontdlg.h
+// Purpose: wxFontDialog
+// Author: Robert Roebling
+// Created:
+// Copyright: (c) Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_FONTDLG_H_
+#define _WX_GTK_FONTDLG_H_
+
+//-----------------------------------------------------------------------------
+// wxFontDialog
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFontDialog : public wxFontDialogBase
+{
+public:
+ wxFontDialog() : wxFontDialogBase() { /* must be Create()d later */ }
+ wxFontDialog(wxWindow *parent)
+ : wxFontDialogBase(parent) { Create(parent); }
+ wxFontDialog(wxWindow *parent, const wxFontData& data)
+ : wxFontDialogBase(parent, data) { Create(parent, data); }
+
+ virtual ~wxFontDialog();
+
+#if WXWIN_COMPATIBILITY_2_6
+ // deprecated interface, don't use
+ wxDEPRECATED( wxFontDialog(wxWindow *parent, const wxFontData *data) );
+#endif // WXWIN_COMPATIBILITY_2_6
+
+protected:
+ // create the GTK dialog
+ virtual bool DoCreate(wxWindow *parent);
+
+ DECLARE_DYNAMIC_CLASS(wxFontDialog)
+};
+
+#if WXWIN_COMPATIBILITY_2_6
+ // deprecated interface, don't use
+inline wxFontDialog::wxFontDialog(wxWindow *parent, const wxFontData *data)
+ : wxFontDialogBase(parent) { InitFontData(data); Create(parent); }
+#endif // WXWIN_COMPATIBILITY_2_6
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/fontpicker.h
+// Purpose: wxFontButton header
+// Author: Francesco Montorsi
+// Modified by:
+// Created: 14/4/2006
+// Copyright: (c) Francesco Montorsi
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_FONTPICKER_H_
+#define _WX_GTK_FONTPICKER_H_
+
+#include "wx/button.h"
+
+//-----------------------------------------------------------------------------
+// wxFontButton
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFontButton : public wxButton,
+ public wxFontPickerWidgetBase
+{
+public:
+ wxFontButton() {}
+ wxFontButton(wxWindow *parent,
+ wxWindowID id,
+ const wxFont& initial = wxNullFont,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxFONTBTN_DEFAULT_STYLE,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxFontPickerWidgetNameStr)
+ {
+ Create(parent, id, initial, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxFont& initial = wxNullFont,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxFONTBTN_DEFAULT_STYLE,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxFontPickerWidgetNameStr);
+
+ virtual ~wxFontButton();
+
+protected:
+ void UpdateFont();
+
+
+public: // used by the GTK callback only
+
+ void SetNativeFontInfo(const char *gtkdescription)
+ { m_selectedFont.SetNativeFontInfo(wxString::FromAscii(gtkdescription)); }
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxFontButton)
+};
+
+#endif // _WX_GTK_FONTPICKER_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/frame.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling, Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_FRAME_H_
+#define _WX_GTK_FRAME_H_
+
+//-----------------------------------------------------------------------------
+// wxFrame
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase
+{
+public:
+ // construction
+ wxFrame() { Init(); }
+ wxFrame(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr)
+ {
+ Init();
+
+ Create(parent, id, title, pos, size, style, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr);
+
+ virtual ~wxFrame();
+
+#if wxUSE_STATUSBAR
+ void SetStatusBar(wxStatusBar *statbar);
+#endif // wxUSE_STATUSBAR
+
+#if wxUSE_TOOLBAR
+ void SetToolBar(wxToolBar *toolbar);
+#endif // wxUSE_TOOLBAR
+
+ virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
+ wxPoint GetClientAreaOrigin() const { return wxPoint(0, 0); }
+
+#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2
+ // in Hildon environment all frames are always shown maximized
+ virtual bool IsMaximized() const { return true; }
+#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2
+
+ // implementation from now on
+ // --------------------------
+
+ virtual bool SendIdleEvents(wxIdleEvent& event);
+
+protected:
+ // override wxWindow methods to take into account tool/menu/statusbars
+ virtual void DoGetClientSize( int *width, int *height ) const;
+
+#if wxUSE_MENUS_NATIVE
+ virtual void DetachMenuBar();
+ virtual void AttachMenuBar(wxMenuBar *menubar);
+#endif // wxUSE_MENUS_NATIVE
+
+private:
+ void Init();
+
+ long m_fsSaveFlag;
+
+ DECLARE_DYNAMIC_CLASS(wxFrame)
+};
+
+#endif // _WX_GTK_FRAME_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/gauge.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_GAUGE_H_
+#define _WX_GTK_GAUGE_H_
+
+//-----------------------------------------------------------------------------
+// wxGauge
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxGauge: public wxControl
+{
+public:
+ wxGauge() { Init(); }
+
+ wxGauge( wxWindow *parent,
+ wxWindowID id,
+ int range,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxGA_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxGaugeNameStr )
+ {
+ Init();
+
+ Create(parent, id, range, pos, size, style, validator, name);
+ }
+
+ bool Create( wxWindow *parent,
+ wxWindowID id, int range,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxGA_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxGaugeNameStr );
+
+ void SetShadowWidth( int WXUNUSED(w) ) { }
+ void SetBezelFace( int WXUNUSED(w) ) { }
+ int GetShadowWidth() const { return 0; }
+ int GetBezelFace() const { return 0; }
+
+ // determinate mode API
+ void SetRange( int r );
+ void SetValue( int pos );
+
+ int GetRange() const;
+ int GetValue() const;
+
+ // indeterminate mode API
+ virtual void Pulse();
+
+ bool IsVertical() const { return HasFlag(wxGA_VERTICAL); }
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ virtual wxVisualAttributes GetDefaultAttributes() const;
+
+ // implementation
+ // -------------
+
+ // the max and current gauge values
+ int m_rangeMax,
+ m_gaugePos;
+
+protected:
+ // set the gauge value to the value of m_gaugePos
+ void DoSetGauge();
+
+ virtual wxSize DoGetBestSize() const;
+
+private:
+ void Init() { m_rangeMax = m_gaugePos = 0; }
+
+ DECLARE_DYNAMIC_CLASS(wxGauge)
+};
+
+#endif
+ // _WX_GTK_GAUGE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/glcanvas.h
+// Purpose: wxGLCanvas, for using OpenGL/Mesa with wxWidgets and GTK
+// Author: Robert Roebling
+// Modified by:
+// Created: 17/8/98
+// Copyright: (c) Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GLCANVAS_H_
+#define _WX_GLCANVAS_H_
+
+#include "wx/unix/glx11.h"
+
+//---------------------------------------------------------------------------
+// wxGLCanvas
+//---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasX11
+{
+public:
+ wxGLCanvas(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const int *attribList = NULL,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxGLCanvasName,
+ const wxPalette& palette = wxNullPalette);
+
+ bool Create(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxGLCanvasName,
+ const int *attribList = NULL,
+ const wxPalette& palette = wxNullPalette);
+
+ virtual bool SetBackgroundStyle(wxBackgroundStyle style);
+
+ // implement wxGLCanvasX11 methods
+ // --------------------------------
+
+ virtual Window GetXWindow() const;
+
+
+ // deprecated methods
+ // ------------------
+
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED(
+ wxGLCanvas(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxGLCanvasName,
+ const int *attribList = NULL,
+ const wxPalette& palette = wxNullPalette)
+ );
+
+ wxDEPRECATED(
+ wxGLCanvas(wxWindow *parent,
+ const wxGLContext *shared,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxGLCanvasName,
+ const int *attribList = NULL,
+ const wxPalette& palette = wxNullPalette)
+ );
+
+ wxDEPRECATED(
+ wxGLCanvas(wxWindow *parent,
+ const wxGLCanvas *shared,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxGLCanvasName,
+ const int *attribList = NULL,
+ const wxPalette& palette = wxNullPalette)
+ );
+
+ // called from "realized" callback to create the implicit context if needed
+ void GTKInitImplicitContext();
+#endif // WXWIN_COMPATIBILITY_2_8
+
+ // implementation from now on
+ void OnInternalIdle();
+
+ bool m_exposed;
+#ifdef __WXGTK3__
+ cairo_t* m_cairoPaintContext;
+#endif
+
+#if WXWIN_COMPATIBILITY_2_8
+ wxGLContext *m_sharedContext;
+ wxGLCanvas *m_sharedContextOf;
+ const bool m_createImplicitContext;
+#endif // WXWIN_COMPATIBILITY_2_8
+
+private:
+ DECLARE_CLASS(wxGLCanvas)
+};
+
+#endif // _WX_GLCANVAS_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/gnome/gvfs.h
+// Author: Robert Roebling
+// Purpose: GNOME VFS support
+// Created: 17/03/06
+// Copyright: Robert Roebling
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_GVFS_H_
+#define _WX_GTK_GVFS_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_MIMETYPE && wxUSE_LIBGNOMEVFS
+
+#include "wx/string.h"
+#include "wx/unix/mimetype.h"
+
+//----------------------------------------------------------------------------
+// wxGnomeVFSMimeTypesManagerImpl
+//----------------------------------------------------------------------------
+
+class wxGnomeVFSMimeTypesManagerImpl: public wxMimeTypesManagerImpl
+{
+public:
+ wxGnomeVFSMimeTypesManagerImpl() { }
+
+protected:
+ virtual bool DoAssociation(const wxString& strType,
+ const wxString& strIcon,
+ wxMimeTypeCommands *entry,
+ const wxArrayString& strExtensions,
+ const wxString& strDesc);
+};
+
+//----------------------------------------------------------------------------
+// wxGnomeVFSMimeTypesManagerFactory
+//----------------------------------------------------------------------------
+
+class wxGnomeVFSMimeTypesManagerFactory: public wxMimeTypesManagerFactory
+{
+public:
+ wxGnomeVFSMimeTypesManagerFactory() {}
+
+ virtual wxMimeTypesManagerImpl *CreateMimeTypesManagerImpl();
+};
+
+#endif
+ // wxUSE_MIMETYPE
+
+#endif
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/hildon/notifmsg.h
+// Purpose: Hildon implementation of wxNotificationMessage
+// Author: Vadim Zeitlin
+// Created: 2007-11-21
+// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_HILDON_NOTIFMSG_H_
+#define _WX_GTK_HILDON_NOTIFMSG_H_
+
+typedef struct _HildonBanner HildonBanner;
+
+// ----------------------------------------------------------------------------
+// wxNotificationMessage
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxNotificationMessage : public wxNotificationMessageBase
+{
+public:
+ wxNotificationMessage() { Init(); }
+ wxNotificationMessage(const wxString& title,
+ const wxString& message = wxString(),
+ wxWindow *parent = NULL)
+ : wxNotificationMessageBase(title, message, parent)
+ {
+ Init();
+ }
+
+ virtual ~wxNotificationMessage();
+
+
+ virtual bool Show(int timeout = Timeout_Auto);
+ virtual bool Close();
+
+private:
+ void Init() { m_banner = NULL; }
+
+ // return the string containing markup for both the title and, if
+ // specified, the message
+ wxString HildonGetMarkup() const;
+
+ // returns the widget of the parent GtkWindow to use or NULL
+ GtkWidget *HildonGetWindow() const;
+
+
+ // the banner we're showing, only non-NULL if it's an animation or progress
+ // banner as the informational dialog times out on its own and we don't
+ // need to store it (nor do we have any way to get its widget anyhow)
+ GtkWidget *m_banner;
+
+
+ wxDECLARE_NO_COPY_CLASS(wxNotificationMessage);
+};
+
+#endif // _WX_GTK_HILDON_NOTIFMSG_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/hyperlink.h
+// Purpose: Hyperlink control
+// Author: Francesco Montorsi
+// Modified by:
+// Created: 14/2/2007
+// Copyright: (c) 2007 Francesco Montorsi
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTKHYPERLINKCTRL_H_
+#define _WX_GTKHYPERLINKCTRL_H_
+
+#include "wx/generic/hyperlink.h"
+
+// ----------------------------------------------------------------------------
+// wxHyperlinkCtrl
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxHyperlinkCtrl : public wxGenericHyperlinkCtrl
+{
+public:
+ // Default constructor (for two-step construction).
+ wxHyperlinkCtrl() { }
+
+ // Constructor.
+ wxHyperlinkCtrl(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label, const wxString& url,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxHL_DEFAULT_STYLE,
+ const wxString& name = wxHyperlinkCtrlNameStr)
+ {
+ (void)Create(parent, id, label, url, pos, size, style, name);
+ }
+
+ // Creation function (for two-step construction).
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label, const wxString& url,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxHL_DEFAULT_STYLE,
+ const wxString& name = wxHyperlinkCtrlNameStr);
+
+
+ // get/set
+ virtual wxColour GetHoverColour() const;
+ virtual void SetHoverColour(const wxColour &colour);
+
+ virtual wxColour GetNormalColour() const;
+ virtual void SetNormalColour(const wxColour &colour);
+
+ virtual wxColour GetVisitedColour() const;
+ virtual void SetVisitedColour(const wxColour &colour);
+
+ virtual wxString GetURL() const;
+ virtual void SetURL(const wxString &url);
+
+ virtual void SetLabel(const wxString &label);
+
+protected:
+ virtual wxSize DoGetBestSize() const;
+ virtual wxSize DoGetBestClientSize() const;
+
+ virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+
+ DECLARE_DYNAMIC_CLASS(wxHyperlinkCtrl)
+};
+
+#endif // _WX_GTKHYPERLINKCTRL_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/infobar.h
+// Purpose: native implementation of wxInfoBar for GTK+ 2.18 and later
+// Author: Vadim Zeitlin
+// Created: 2009-09-26
+// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_INFOBAR_H_
+#define _WX_GTK_INFOBAR_H_
+
+#include "wx/generic/infobar.h"
+
+// ----------------------------------------------------------------------------
+// wxInfoBar for GTK+
+// ----------------------------------------------------------------------------
+
+// notice that the native GTK+ implementation is only available since
+// (relatively recent) 2.18 so we inherit from the generic one to be able to
+// fall back to it if GTK+ version is determined to be too old during run-time
+class WXDLLIMPEXP_CORE wxInfoBar : public wxInfoBarGeneric
+{
+public:
+ wxInfoBar() { Init(); }
+
+ wxInfoBar(wxWindow *parent, wxWindowID winid = wxID_ANY)
+ {
+ Init();
+ Create(parent, winid);
+ }
+
+ bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY);
+
+ virtual ~wxInfoBar();
+
+ // implement base class methods
+ // ----------------------------
+
+ virtual void ShowMessage(const wxString& msg,
+ int flags = wxICON_INFORMATION);
+
+ virtual void Dismiss();
+
+ virtual void AddButton(wxWindowID btnid,
+ const wxString& label = wxString());
+
+ virtual void RemoveButton(wxWindowID btnid);
+
+ // implementation only
+ // -------------------
+
+ void GTKResponse(int btnid);
+
+protected:
+ virtual void DoApplyWidgetStyle(GtkRcStyle *style);
+
+private:
+ void Init() { m_impl = NULL; }
+
+ // add a button with the given id/label and return its widget
+ GtkWidget *GTKAddButton(wxWindowID btnid,
+ const wxString& label = wxString());
+
+
+ // only used when the native implementation is really being used
+ class wxInfoBarGTKImpl *m_impl;
+
+ wxDECLARE_NO_COPY_CLASS(wxInfoBar);
+};
+
+#endif // _WX_GTK_INFOBAR_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/listbox.h
+// Purpose: wxListBox class declaration
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_LISTBOX_H_
+#define _WX_GTK_LISTBOX_H_
+
+struct _wxTreeEntry;
+struct _GtkTreeIter;
+
+//-----------------------------------------------------------------------------
+// wxListBox
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase
+{
+public:
+ // ctors and such
+ wxListBox()
+ {
+ Init();
+ }
+ wxListBox( wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0, const wxString choices[] = (const wxString *) NULL,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxListBoxNameStr )
+ {
+ Init();
+ Create(parent, id, pos, size, n, choices, style, validator, name);
+ }
+ wxListBox( wxWindow *parent, wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxListBoxNameStr )
+ {
+ Init();
+ Create(parent, id, pos, size, choices, style, validator, name);
+ }
+ virtual ~wxListBox();
+
+ bool Create(wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0, const wxString choices[] = (const wxString *) NULL,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxListBoxNameStr);
+ bool Create(wxWindow *parent, wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxListBoxNameStr);
+
+ virtual unsigned int GetCount() const;
+ virtual wxString GetString(unsigned int n) const;
+ virtual void SetString(unsigned int n, const wxString& s);
+ virtual int FindString(const wxString& s, bool bCase = false) const;
+
+ virtual bool IsSelected(int n) const;
+ virtual int GetSelection() const;
+ virtual int GetSelections(wxArrayInt& aSelections) const;
+
+ virtual void EnsureVisible(int n);
+
+ virtual void Update();
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ // implementation from now on
+
+ virtual GtkWidget *GetConnectWidget();
+
+ struct _GtkTreeView *m_treeview;
+ struct _GtkListStore *m_liststore;
+
+#if wxUSE_CHECKLISTBOX
+ bool m_hasCheckBoxes;
+#endif // wxUSE_CHECKLISTBOX
+
+ struct _wxTreeEntry* GTKGetEntry(unsigned pos) const;
+
+ void GTKDisableEvents();
+ void GTKEnableEvents();
+
+ void GTKOnSelectionChanged();
+ void GTKOnActivated(int item);
+
+protected:
+ virtual void DoClear();
+ virtual void DoDeleteOneItem(unsigned int n);
+ virtual wxSize DoGetBestSize() const;
+ virtual void DoApplyWidgetStyle(GtkRcStyle *style);
+ virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+
+ virtual void DoSetSelection(int n, bool select);
+
+ virtual int DoInsertItems(const wxArrayStringsAdapter& items,
+ unsigned int pos,
+ void **clientData, wxClientDataType type);
+ virtual int DoInsertOneItem(const wxString& item, unsigned int pos);
+
+ virtual void DoSetFirstItem(int n);
+ virtual void DoSetItemClientData(unsigned int n, void* clientData);
+ virtual void* DoGetItemClientData(unsigned int n) const;
+ virtual int DoListHitTest(const wxPoint& point) const;
+
+ // get the iterator for the given index, returns false if invalid
+ bool GTKGetIteratorFor(unsigned pos, _GtkTreeIter *iter) const;
+
+ // get the index for the given iterator, return wxNOT_FOUND on failure
+ int GTKGetIndexFor(_GtkTreeIter& iter) const;
+
+ // common part of DoSetFirstItem() and EnsureVisible()
+ void DoScrollToCell(int n, float alignY, float alignX);
+
+private:
+ void Init(); //common construction
+
+ DECLARE_DYNAMIC_CLASS(wxListBox)
+};
+
+#endif // _WX_GTK_LISTBOX_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/mdi.h
+// Purpose: TDI-based MDI implementation for wxGTK
+// Author: Robert Roebling
+// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
+// Copyright: (c) 1998 Robert Roebling
+// (c) 2008 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_MDI_H_
+#define _WX_GTK_MDI_H_
+
+#include "wx/frame.h"
+
+class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
+class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
+
+typedef struct _GtkNotebook GtkNotebook;
+
+//-----------------------------------------------------------------------------
+// wxMDIParentFrame
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
+{
+public:
+ wxMDIParentFrame() { Init(); }
+ wxMDIParentFrame(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
+ const wxString& name = wxFrameNameStr)
+ {
+ Init();
+
+ (void)Create(parent, id, title, pos, size, style, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
+ const wxString& name = wxFrameNameStr);
+
+ // we don't store the active child in m_currentChild unlike the base class
+ // version so override this method to find it dynamically
+ virtual wxMDIChildFrame *GetActiveChild() const;
+
+ // implement base class pure virtuals
+ // ----------------------------------
+
+ virtual void ActivateNext();
+ virtual void ActivatePrevious();
+
+ static bool IsTDI() { return true; }
+
+ // implementation
+
+ bool m_justInserted;
+
+ virtual void OnInternalIdle();
+
+protected:
+ virtual void DoGetClientSize(int* width, int* height) const;
+
+private:
+ friend class wxMDIChildFrame;
+ void Init();
+
+ DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
+};
+
+//-----------------------------------------------------------------------------
+// wxMDIChildFrame
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxTDIChildFrame
+{
+public:
+ wxMDIChildFrame() { Init(); }
+ wxMDIChildFrame(wxMDIParentFrame *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr)
+ {
+ Init();
+
+ Create(parent, id, title, pos, size, style, name);
+ }
+
+ bool Create(wxMDIParentFrame *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr);
+
+ virtual ~wxMDIChildFrame();
+
+ virtual void SetMenuBar( wxMenuBar *menu_bar );
+ virtual wxMenuBar *GetMenuBar() const;
+
+ virtual void Activate();
+
+ virtual void SetTitle(const wxString& title);
+
+ // implementation
+
+ void OnActivate( wxActivateEvent& event );
+ void OnMenuHighlight( wxMenuEvent& event );
+ virtual void GTKHandleRealized();
+
+ wxMenuBar *m_menuBar;
+ bool m_justInserted;
+
+private:
+ void Init();
+
+ GtkNotebook *GTKGetNotebook() const;
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
+};
+
+//-----------------------------------------------------------------------------
+// wxMDIClientWindow
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase
+{
+public:
+ wxMDIClientWindow() { }
+ ~wxMDIClientWindow();
+
+ virtual bool CreateClient(wxMDIParentFrame *parent,
+ long style = wxVSCROLL | wxHSCROLL);
+
+private:
+ virtual void AddChildGTK(wxWindowGTK* child);
+
+ DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
+};
+
+#endif // _WX_GTK_MDI_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/menu.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling, Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTKMENU_H_
+#define _WX_GTKMENU_H_
+
+//-----------------------------------------------------------------------------
+// wxMenuBar
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxMenuBar : public wxMenuBarBase
+{
+public:
+ // ctors
+ wxMenuBar();
+ wxMenuBar(long style);
+ wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0);
+ ~wxMenuBar();
+
+ // implement base class (pure) virtuals
+ virtual bool Append( wxMenu *menu, const wxString &title );
+ virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title);
+ virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title);
+ virtual wxMenu *Remove(size_t pos);
+
+ virtual int FindMenuItem(const wxString& menuString,
+ const wxString& itemString) const;
+ virtual wxMenuItem* FindItem( int id, wxMenu **menu = NULL ) const;
+
+ virtual void EnableTop( size_t pos, bool flag );
+ virtual bool IsEnabledTop(size_t pos) const;
+ virtual void SetMenuLabel( size_t pos, const wxString& label );
+ virtual wxString GetMenuLabel( size_t pos ) const;
+
+ void SetLayoutDirection(wxLayoutDirection dir);
+ wxLayoutDirection GetLayoutDirection() const;
+
+ virtual void Attach(wxFrame *frame);
+ virtual void Detach();
+
+private:
+ // common part of Append and Insert
+ void GtkAppend(wxMenu* menu, const wxString& title, int pos = -1);
+
+ void Init(size_t n, wxMenu *menus[], const wxString titles[], long style);
+
+ // wxMenuBar is not a top level window but it still doesn't need a parent
+ // window
+ virtual bool GTKNeedsParent() const { return false; }
+
+ GtkWidget* m_menubar;
+
+ DECLARE_DYNAMIC_CLASS(wxMenuBar)
+};
+
+//-----------------------------------------------------------------------------
+// wxMenu
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxMenu : public wxMenuBase
+{
+public:
+ // ctors & dtor
+ wxMenu(const wxString& title, long style = 0)
+ : wxMenuBase(title, style) { Init(); }
+
+ wxMenu(long style = 0) : wxMenuBase(style) { Init(); }
+
+ virtual ~wxMenu();
+
+ void Attach(wxMenuBarBase *menubar);
+
+ void SetLayoutDirection(const wxLayoutDirection dir);
+ wxLayoutDirection GetLayoutDirection() const;
+
+ // Returns the title, with mnemonics translated to wx format
+ wxString GetTitle() const;
+
+ // Sets the title, with mnemonics translated to gtk format
+ virtual void SetTitle(const wxString& title);
+
+ // implementation GTK only
+ GtkWidget *m_menu; // GtkMenu
+ GtkWidget *m_owner;
+ GtkAccelGroup *m_accel;
+ bool m_popupShown;
+
+protected:
+ virtual wxMenuItem* DoAppend(wxMenuItem *item);
+ virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item);
+ virtual wxMenuItem* DoRemove(wxMenuItem *item);
+
+private:
+ // common code for all constructors:
+ void Init();
+
+ // common part of Append (if pos == -1) and Insert
+ void GtkAppend(wxMenuItem* item, int pos = -1);
+
+
+ DECLARE_DYNAMIC_CLASS(wxMenu)
+};
+
+#endif
+ // _WX_GTKMENU_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/menuitem.h
+// Purpose: wxMenuItem class
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTKMENUITEM_H_
+#define _WX_GTKMENUITEM_H_
+
+#include "wx/bitmap.h"
+
+//-----------------------------------------------------------------------------
+// wxMenuItem
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase
+{
+public:
+ wxMenuItem(wxMenu *parentMenu = NULL,
+ int id = wxID_SEPARATOR,
+ const wxString& text = wxEmptyString,
+ const wxString& help = wxEmptyString,
+ wxItemKind kind = wxITEM_NORMAL,
+ wxMenu *subMenu = NULL);
+ virtual ~wxMenuItem();
+
+ // implement base class virtuals
+ virtual void SetItemLabel( const wxString& str );
+ virtual void Enable( bool enable = true );
+ virtual void Check( bool check = true );
+ virtual bool IsChecked() const;
+ virtual void SetBitmap(const wxBitmap& bitmap);
+ virtual const wxBitmap& GetBitmap() const { return m_bitmap; }
+
+ // implementation
+ void SetMenuItem(GtkWidget *menuItem);
+ GtkWidget *GetMenuItem() const { return m_menuItem; }
+ void SetGtkLabel();
+
+#if WXWIN_COMPATIBILITY_2_8
+ // compatibility only, don't use in new code
+ wxDEPRECATED_CONSTRUCTOR(
+ wxMenuItem(wxMenu *parentMenu,
+ int id,
+ const wxString& text,
+ const wxString& help,
+ bool isCheckable,
+ wxMenu *subMenu = NULL)
+ );
+#endif
+
+private:
+ wxBitmap m_bitmap; // Bitmap for menuitem, if any
+ GtkWidget *m_menuItem; // GtkMenuItem
+
+ DECLARE_DYNAMIC_CLASS(wxMenuItem)
+};
+
+#endif // _WX_GTKMENUITEM_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/minifram.h
+// Purpose: wxMiniFrame class
+// Author: Robert Roebling
+// Copyright: (c) Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_MINIFRAME_H_
+#define _WX_GTK_MINIFRAME_H_
+
+#include "wx/bitmap.h"
+#include "wx/frame.h"
+
+//-----------------------------------------------------------------------------
+// wxMiniFrame
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxMiniFrame: public wxFrame
+{
+ DECLARE_DYNAMIC_CLASS(wxMiniFrame)
+
+public:
+ wxMiniFrame() {}
+ wxMiniFrame(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxCAPTION | wxRESIZE_BORDER,
+ const wxString& name = wxFrameNameStr)
+ {
+ Create(parent, id, title, pos, size, style, name);
+ }
+ ~wxMiniFrame();
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxCAPTION | wxRESIZE_BORDER,
+ const wxString& name = wxFrameNameStr);
+
+ virtual void SetTitle( const wxString &title );
+
+protected:
+ virtual void DoSetSizeHints( int minW, int minH,
+ int maxW, int maxH,
+ int incW, int incH );
+ virtual void DoGetClientSize(int* width, int* height) const;
+
+ // implementation
+public:
+ bool m_isDragging;
+ int m_oldX,m_oldY;
+ int m_diffX,m_diffY;
+ wxBitmap m_closeButton;
+ int m_miniEdge;
+ int m_miniTitle;
+};
+
+#endif // _WX_GTK_MINIFRAME_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/msgdlg.h
+// Purpose: wxMessageDialog for GTK+2
+// Author: Vaclav Slavik
+// Modified by:
+// Created: 2003/02/28
+// Copyright: (c) Vaclav Slavik, 2003
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_MSGDLG_H_
+#define _WX_GTK_MSGDLG_H_
+
+class WXDLLIMPEXP_CORE wxMessageDialog : public wxMessageDialogBase
+{
+public:
+ wxMessageDialog(wxWindow *parent, const wxString& message,
+ const wxString& caption = wxMessageBoxCaptionStr,
+ long style = wxOK|wxCENTRE,
+ const wxPoint& pos = wxDefaultPosition);
+
+ virtual int ShowModal();
+ virtual bool Show(bool WXUNUSED(show) = true) { return false; }
+
+protected:
+ // implement some base class methods to do nothing to avoid asserts and
+ // GTK warnings, since this is not a real wxDialog.
+ virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
+ int WXUNUSED(width), int WXUNUSED(height),
+ int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {}
+ virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y),
+ int WXUNUSED(width), int WXUNUSED(height)) {}
+ // override to convert wx mnemonics to GTK+ ones and handle stock ids
+ virtual void DoSetCustomLabel(wxString& var, const ButtonLabel& label);
+
+private:
+ // override to use stock GTK+ defaults instead of just string ones
+ virtual wxString GetDefaultYesLabel() const;
+ virtual wxString GetDefaultNoLabel() const;
+ virtual wxString GetDefaultOKLabel() const;
+ virtual wxString GetDefaultCancelLabel() const;
+ virtual wxString GetDefaultHelpLabel() const;
+
+ // create the real GTK+ dialog: this is done from ShowModal() to allow
+ // changing the message between constructing the dialog and showing it
+ void GTKCreateMsgDialog();
+
+ DECLARE_DYNAMIC_CLASS(wxMessageDialog)
+};
+
+#endif // _WX_GTK_MSGDLG_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/nonownedwnd.h
+// Purpose: wxGTK-specific wxNonOwnedWindow declaration.
+// Author: Vadim Zeitlin
+// Created: 2011-10-12
+// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_NONOWNEDWND_H_
+#define _WX_GTK_NONOWNEDWND_H_
+
+class wxNonOwnedWindowShapeImpl;
+
+// ----------------------------------------------------------------------------
+// wxNonOwnedWindow contains code common to wx{Popup,TopLevel}Window in wxGTK.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxNonOwnedWindowBase
+{
+public:
+ wxNonOwnedWindow() { m_shapeImpl = NULL; }
+ virtual ~wxNonOwnedWindow();
+
+ // Overridden to actually set the shape when the window becomes realized.
+ virtual void GTKHandleRealized();
+
+protected:
+ virtual bool DoClearShape();
+ virtual bool DoSetRegionShape(const wxRegion& region);
+#if wxUSE_GRAPHICS_CONTEXT
+ virtual bool DoSetPathShape(const wxGraphicsPath& path);
+#endif // wxUSE_GRAPHICS_CONTEXT
+
+
+private:
+ // If non-NULL, contains information about custom window shape.
+ wxNonOwnedWindowShapeImpl* m_shapeImpl;
+
+ wxDECLARE_NO_COPY_CLASS(wxNonOwnedWindow);
+};
+
+#endif // _WX_GTK_NONOWNEDWND_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/notebook.h
+// Purpose: wxNotebook class
+// Author: Robert Roebling
+// Modified by:
+// Copyright: (c) Julian Smart and Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTKNOTEBOOK_H_
+#define _WX_GTKNOTEBOOK_H_
+
+//-----------------------------------------------------------------------------
+// internal class
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxGtkNotebookPage;
+
+#include "wx/list.h"
+WX_DECLARE_LIST(wxGtkNotebookPage, wxGtkNotebookPagesList);
+
+//-----------------------------------------------------------------------------
+// wxNotebook
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase
+{
+public:
+ // default for dynamic class
+ wxNotebook();
+ // the same arguments as for wxControl
+ wxNotebook(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxNotebookNameStr);
+ // Create() function
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxNotebookNameStr);
+ // dtor
+ virtual ~wxNotebook();
+
+ // accessors
+ // ---------
+
+ // set the currently selected page, return the index of the previously
+ // selected one (or wxNOT_FOUND on error)
+ // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
+ int SetSelection(size_t nPage) { return DoSetSelection(nPage, SetSelection_SendEvent); }
+ // get the currently selected page
+ int GetSelection() const;
+
+ // changes selected page without sending events
+ int ChangeSelection(size_t nPage) { return DoSetSelection(nPage); }
+
+ // set/get the title of a page
+ bool SetPageText(size_t nPage, const wxString& strText);
+ wxString GetPageText(size_t nPage) const;
+
+ // sets/returns item's image index in the current image list
+ int GetPageImage(size_t nPage) const;
+ bool SetPageImage(size_t nPage, int nImage);
+
+ // control the appearance of the notebook pages
+ // set the padding between tabs (in pixels)
+ void SetPadding(const wxSize& padding);
+ // sets the size of the tabs (assumes all tabs are the same size)
+ void SetTabSize(const wxSize& sz);
+
+ // geometry
+ virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
+ virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
+
+ // operations
+ // ----------
+ // remove all pages
+ bool DeleteAllPages();
+
+ // adds a new page to the notebook (it will be deleted by the notebook,
+ // don't delete it yourself). If bSelect, this page becomes active.
+ // the same as AddPage(), but adds it at the specified position
+ bool InsertPage( size_t position,
+ wxNotebookPage *win,
+ const wxString& strText,
+ bool bSelect = false,
+ int imageId = NO_IMAGE );
+
+ // handler for tab navigation
+ // --------------------------
+ void OnNavigationKey(wxNavigationKeyEvent& event);
+
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ // implementation
+ // --------------
+
+#if wxUSE_CONSTRAINTS
+ void SetConstraintSizes(bool recurse);
+ bool DoPhase(int phase);
+#endif
+
+ // Called by GTK event handler when the current page is definitely changed.
+ void GTKOnPageChanged();
+
+ // helper function
+ wxGtkNotebookPage* GetNotebookPage(int page) const;
+
+ // the additional page data (the pages themselves are in m_pages array)
+ wxGtkNotebookPagesList m_pagesData;
+
+ // we need to store the old selection since there
+ // is no other way to know about it at the time
+ // of the change selection event
+ int m_oldSelection;
+
+protected:
+ // set all page's attributes
+ virtual void DoApplyWidgetStyle(GtkRcStyle *style);
+ virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+
+ // remove one page from the notebook but do not destroy it
+ virtual wxNotebookPage *DoRemovePage(size_t nPage);
+
+ int DoSetSelection(size_t nPage, int flags = 0);
+
+private:
+ // the padding set by SetPadding()
+ int m_padding;
+
+ void Init();
+ virtual void AddChildGTK(wxWindowGTK* child);
+
+ DECLARE_DYNAMIC_CLASS(wxNotebook)
+ DECLARE_EVENT_TABLE()
+};
+
+#endif // _WX_GTKNOTEBOOK_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/notifmsg.h
+// Purpose: wxNotificationMessage for wxGTK.
+// Author: Vadim Zeitlin
+// Created: 2012-07-25
+// Copyright: (c) 2012 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_NOTIFMSG_H_
+#define _WX_GTK_NOTIFMSG_H_
+
+typedef struct _NotifyNotification NotifyNotification;
+
+// ----------------------------------------------------------------------------
+// wxNotificationMessage
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxNotificationMessage : public wxNotificationMessageBase
+{
+public:
+ wxNotificationMessage() { Init(); }
+ wxNotificationMessage(const wxString& title,
+ const wxString& message = wxString(),
+ wxWindow *parent = NULL,
+ int flags = wxICON_INFORMATION)
+ : wxNotificationMessageBase(title, message, parent, flags)
+ {
+ Init();
+ }
+
+ virtual ~wxNotificationMessage();
+
+
+ virtual bool Show(int timeout = Timeout_Auto);
+ virtual bool Close();
+
+ // Set the name of the icon to use, overriding the default icon determined
+ // by the flags. Call with empty string to reset custom icon.
+ bool GTKSetIconName(const wxString& name);
+
+private:
+ void Init() { m_notification = NULL; }
+
+ NotifyNotification* m_notification;
+ wxString m_iconName;
+
+ wxDECLARE_NO_COPY_CLASS(wxNotificationMessage);
+};
+
+#endif // _WX_GTK_NOTIFMSG_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/pen.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_PEN_H_
+#define _WX_GTK_PEN_H_
+
+typedef signed char wxGTKDash;
+
+//-----------------------------------------------------------------------------
+// wxPen
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPen: public wxPenBase
+{
+public:
+ wxPen() { }
+
+ wxPen( const wxColour &colour, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID );
+#if FUTURE_WXWIN_COMPATIBILITY_3_0
+ wxDEPRECATED_FUTURE( wxPen(const wxColour& col, int width, int style) );
+#endif
+
+ virtual ~wxPen();
+
+ bool operator==(const wxPen& pen) const;
+ bool operator!=(const wxPen& pen) const { return !(*this == pen); }
+
+ void SetColour( const wxColour &colour );
+ void SetColour( unsigned char red, unsigned char green, unsigned char blue );
+ void SetCap( wxPenCap capStyle );
+ void SetJoin( wxPenJoin joinStyle );
+ void SetStyle( wxPenStyle style );
+ void SetWidth( int width );
+ void SetDashes( int number_of_dashes, const wxDash *dash );
+ void SetStipple(const wxBitmap& stipple);
+
+ wxColour GetColour() const;
+ wxPenCap GetCap() const;
+ wxPenJoin GetJoin() const;
+ wxPenStyle GetStyle() const;
+ int GetWidth() const;
+ int GetDashes(wxDash **ptr) const;
+ int GetDashCount() const;
+ wxDash* GetDash() const;
+ wxBitmap *GetStipple() const;
+
+#if FUTURE_WXWIN_COMPATIBILITY_3_0
+ wxDEPRECATED_FUTURE( void SetStyle(int style) )
+ { SetStyle((wxPenStyle)style); }
+#endif
+
+protected:
+ virtual wxGDIRefData *CreateGDIRefData() const;
+ virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
+
+ DECLARE_DYNAMIC_CLASS(wxPen)
+};
+
+#endif // _WX_GTK_PEN_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/popupwin.h
+// Purpose:
+// Author: Robert Roebling
+// Created:
+// Copyright: (c) 2001 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_POPUPWIN_H_
+#define _WX_GTK_POPUPWIN_H_
+
+//-----------------------------------------------------------------------------
+// wxPopUpWindow
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPopupWindow: public wxPopupWindowBase
+{
+public:
+ wxPopupWindow() { }
+ virtual ~wxPopupWindow();
+
+ wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE)
+ { (void)Create(parent, flags); }
+ bool Create(wxWindow *parent, int flags = wxBORDER_NONE);
+
+ virtual bool Show(bool show = true);
+
+ virtual void SetFocus();
+
+ // implementation
+ // --------------
+
+ // GTK time when connecting to button_press signal
+ wxUint32 m_time;
+
+protected:
+ virtual void DoSetSize(int x, int y,
+ int width, int height,
+ int sizeFlags = wxSIZE_AUTO);
+
+ virtual void DoMoveWindow(int x, int y, int width, int height);
+
+#ifdef __WXUNIVERSAL__
+ DECLARE_EVENT_TABLE()
+#endif
+ DECLARE_DYNAMIC_CLASS(wxPopupWindow)
+};
+
+#endif // _WX_GTK_POPUPWIN_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/print.h
+// Author: Anthony Bretaudeau
+// Purpose: GTK printing support
+// Created: 2007-08-25
+// Copyright: (c) Anthony Bretaudeau
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_PRINT_H_
+#define _WX_GTK_PRINT_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_GTKPRINT
+
+#include "wx/print.h"
+#include "wx/printdlg.h"
+#include "wx/prntbase.h"
+#include "wx/dc.h"
+
+typedef struct _GtkPrintOperation GtkPrintOperation;
+typedef struct _GtkPrintContext GtkPrintContext;
+typedef struct _GtkPrintSettings GtkPrintSettings;
+typedef struct _GtkPageSetup GtkPageSetup;
+
+typedef struct _cairo cairo_t;
+
+//----------------------------------------------------------------------------
+// wxGtkPrintFactory
+//----------------------------------------------------------------------------
+
+class wxGtkPrintFactory: public wxPrintFactory
+{
+public:
+ virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data );
+
+ virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
+ wxPrintout *printout = NULL,
+ wxPrintDialogData *data = NULL );
+ virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
+ wxPrintout *printout,
+ wxPrintData *data );
+
+ virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
+ wxPrintDialogData *data = NULL );
+ virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
+ wxPrintData *data );
+
+ virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent,
+ wxPageSetupDialogData * data = NULL );
+
+ virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data );
+
+ virtual bool HasPrintSetupDialog();
+ virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data );
+ virtual bool HasOwnPrintToFile();
+ virtual bool HasPrinterLine();
+ virtual wxString CreatePrinterLine();
+ virtual bool HasStatusLine();
+ virtual wxString CreateStatusLine();
+
+ virtual wxPrintNativeDataBase *CreatePrintNativeData();
+};
+
+//----------------------------------------------------------------------------
+// wxGtkPrintDialog
+//----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxGtkPrintDialog: public wxPrintDialogBase
+{
+public:
+ wxGtkPrintDialog( wxWindow *parent,
+ wxPrintDialogData* data = NULL );
+ wxGtkPrintDialog( wxWindow *parent, wxPrintData* data);
+ virtual ~wxGtkPrintDialog();
+
+ wxPrintData& GetPrintData()
+ { return m_printDialogData.GetPrintData(); }
+ wxPrintDialogData& GetPrintDialogData()
+ { return m_printDialogData; }
+
+ wxDC *GetPrintDC() { return m_dc; }
+ void SetPrintDC(wxDC * printDC) { m_dc = printDC; }
+
+ virtual int ShowModal();
+
+ virtual bool Validate() { return true; }
+ virtual bool TransferDataToWindow() { return true; }
+ virtual bool TransferDataFromWindow() { return true; }
+
+ void SetShowDialog(bool show) { m_showDialog = show; }
+ bool GetShowDialog() { return m_showDialog; }
+
+protected:
+ // Implement some base class methods to do nothing to avoid asserts and
+ // GTK warnings, since this is not a real wxDialog.
+ virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
+ int WXUNUSED(width), int WXUNUSED(height),
+ int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {}
+ virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y),
+ int WXUNUSED(width), int WXUNUSED(height)) {}
+
+private:
+ wxPrintDialogData m_printDialogData;
+ wxWindow *m_parent;
+ bool m_showDialog;
+ wxDC *m_dc;
+
+ DECLARE_DYNAMIC_CLASS(wxGtkPrintDialog)
+};
+
+//----------------------------------------------------------------------------
+// wxGtkPageSetupDialog
+//----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxGtkPageSetupDialog: public wxPageSetupDialogBase
+{
+public:
+ wxGtkPageSetupDialog( wxWindow *parent,
+ wxPageSetupDialogData* data = NULL );
+ virtual ~wxGtkPageSetupDialog();
+
+ virtual wxPageSetupDialogData& GetPageSetupDialogData() { return m_pageDialogData; }
+
+ virtual int ShowModal();
+
+ virtual bool Validate() { return true; }
+ virtual bool TransferDataToWindow() { return true; }
+ virtual bool TransferDataFromWindow() { return true; }
+
+protected:
+ // Implement some base class methods to do nothing to avoid asserts and
+ // GTK warnings, since this is not a real wxDialog.
+ virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
+ int WXUNUSED(width), int WXUNUSED(height),
+ int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {}
+ virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y),
+ int WXUNUSED(width), int WXUNUSED(height)) {}
+
+private:
+ wxPageSetupDialogData m_pageDialogData;
+ wxWindow *m_parent;
+
+ DECLARE_DYNAMIC_CLASS(wxGtkPageSetupDialog)
+};
+
+//----------------------------------------------------------------------------
+// wxGtkPrinter
+//----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxGtkPrinter : public wxPrinterBase
+{
+public:
+ wxGtkPrinter(wxPrintDialogData *data = NULL);
+ virtual ~wxGtkPrinter();
+
+ virtual bool Print(wxWindow *parent,
+ wxPrintout *printout,
+ bool prompt = true);
+ virtual wxDC* PrintDialog(wxWindow *parent);
+ virtual bool Setup(wxWindow *parent);
+
+ GtkPrintContext *GetPrintContext() { return m_gpc; }
+ void SetPrintContext(GtkPrintContext *context) {m_gpc = context;}
+ void BeginPrint(wxPrintout *printout, GtkPrintOperation *operation, GtkPrintContext *context);
+ void DrawPage(wxPrintout *printout, GtkPrintOperation *operation, GtkPrintContext *context, int page_nr);
+
+private:
+ GtkPrintContext *m_gpc;
+ wxDC *m_dc;
+
+ DECLARE_DYNAMIC_CLASS(wxGtkPrinter)
+ wxDECLARE_NO_COPY_CLASS(wxGtkPrinter);
+};
+
+//----------------------------------------------------------------------------
+// wxGtkPrintNativeData
+//----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxGtkPrintNativeData : public wxPrintNativeDataBase
+{
+public:
+ wxGtkPrintNativeData();
+ virtual ~wxGtkPrintNativeData();
+
+ virtual bool TransferTo( wxPrintData &data );
+ virtual bool TransferFrom( const wxPrintData &data );
+
+ virtual bool Ok() const { return IsOk(); }
+ virtual bool IsOk() const { return true; }
+
+ GtkPrintSettings* GetPrintConfig() { return m_config; }
+ void SetPrintConfig( GtkPrintSettings * config );
+
+ GtkPrintOperation* GetPrintJob() { return m_job; }
+ void SetPrintJob(GtkPrintOperation *job) { m_job = job; }
+
+ GtkPrintContext *GetPrintContext() { return m_context; }
+ void SetPrintContext(GtkPrintContext *context) {m_context = context; }
+
+
+ GtkPageSetup* GetPageSetupFromSettings(GtkPrintSettings* settings);
+ void SetPageSetupToSettings(GtkPrintSettings* settings, GtkPageSetup* page_setup);
+
+private:
+ // NB: m_config is created and owned by us, but the other objects are not
+ // and their accessors don't change their ref count.
+ GtkPrintSettings *m_config;
+ GtkPrintOperation *m_job;
+ GtkPrintContext *m_context;
+
+ DECLARE_DYNAMIC_CLASS(wxGtkPrintNativeData)
+};
+
+//-----------------------------------------------------------------------------
+// wxGtkPrinterDC
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxGtkPrinterDCImpl : public wxDCImpl
+{
+public:
+ wxGtkPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data );
+ virtual ~wxGtkPrinterDCImpl();
+
+ bool Ok() const { return IsOk(); }
+ bool IsOk() const;
+
+ virtual void* GetCairoContext() const;
+ virtual void* GetHandle() const;
+
+ bool CanDrawBitmap() const { return true; }
+ void Clear();
+ void SetFont( const wxFont& font );
+ void SetPen( const wxPen& pen );
+ void SetBrush( const wxBrush& brush );
+ void SetLogicalFunction( wxRasterOperationMode function );
+ void SetBackground( const wxBrush& brush );
+ void DestroyClippingRegion();
+ bool StartDoc(const wxString& message);
+ void EndDoc();
+ void StartPage();
+ void EndPage();
+ wxCoord GetCharHeight() const;
+ wxCoord GetCharWidth() const;
+ bool CanGetTextExtent() const { return true; }
+ wxSize GetPPI() const;
+ virtual int GetDepth() const { return 24; }
+ void SetBackgroundMode(int mode);
+ void SetPalette(const wxPalette& WXUNUSED(palette)) { }
+ void SetResolution(int ppi);
+
+ // overridden for wxPrinterDC Impl
+ virtual int GetResolution() const;
+ virtual wxRect GetPaperRect() const;
+
+protected:
+ bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col,
+ wxFloodFillStyle style=wxFLOOD_SURFACE );
+ void DoGradientFillConcentric(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, const wxPoint& circleCenter);
+ void DoGradientFillLinear(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, wxDirection nDirection = wxEAST);
+ bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const;
+ void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
+ void DoCrossHair(wxCoord x, wxCoord y);
+ void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc);
+ void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea);
+ void DoDrawPoint(wxCoord x, wxCoord y);
+ void DoDrawLines(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
+ void DoDrawPolygon(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE);
+ void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE);
+ void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
+ void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0);
+ void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
+#if wxUSE_SPLINES
+ void DoDrawSpline(const wxPointList *points);
+#endif
+ bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
+ wxDC *source, wxCoord xsrc, wxCoord ysrc,
+ wxRasterOperationMode rop = wxCOPY, bool useMask = false,
+ wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
+ void DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y );
+ void DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false );
+ void DoDrawText(const wxString& text, wxCoord x, wxCoord y );
+ void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
+ void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
+ void DoSetDeviceClippingRegion( const wxRegion &WXUNUSED(clip) )
+ {
+ wxFAIL_MSG( "not implemented" );
+ }
+ void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
+ wxCoord *descent = NULL,
+ wxCoord *externalLeading = NULL,
+ const wxFont *theFont = NULL ) const;
+ void DoGetSize(int* width, int* height) const;
+ void DoGetSizeMM(int *width, int *height) const;
+
+ wxPrintData& GetPrintData() { return m_printData; }
+ void SetPrintData(const wxPrintData& data);
+
+private:
+ wxPrintData m_printData;
+ PangoContext *m_context;
+ PangoLayout *m_layout;
+ PangoFontDescription *m_fontdesc;
+ cairo_t *m_cairo;
+
+ unsigned char m_currentRed;
+ unsigned char m_currentGreen;
+ unsigned char m_currentBlue;
+ unsigned char m_currentAlpha;
+
+ GtkPrintContext *m_gpc;
+ int m_resolution;
+ double m_PS2DEV;
+ double m_DEV2PS;
+
+ DECLARE_DYNAMIC_CLASS(wxGtkPrinterDCImpl)
+ wxDECLARE_NO_COPY_CLASS(wxGtkPrinterDCImpl);
+};
+
+// ----------------------------------------------------------------------------
+// wxGtkPrintPreview: programmer creates an object of this class to preview a
+// wxPrintout.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxGtkPrintPreview : public wxPrintPreviewBase
+{
+public:
+ wxGtkPrintPreview(wxPrintout *printout,
+ wxPrintout *printoutForPrinting = NULL,
+ wxPrintDialogData *data = NULL);
+ wxGtkPrintPreview(wxPrintout *printout,
+ wxPrintout *printoutForPrinting,
+ wxPrintData *data);
+
+ virtual ~wxGtkPrintPreview();
+
+ virtual bool Print(bool interactive);
+ virtual void DetermineScaling();
+
+private:
+ void Init(wxPrintout *printout,
+ wxPrintout *printoutForPrinting,
+ wxPrintData *data);
+
+ // resolution to use in DPI
+ int m_resolution;
+
+ DECLARE_CLASS(wxGtkPrintPreview)
+};
+
+#endif // wxUSE_GTKPRINT
+
+#endif // _WX_GTK_PRINT_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/radiobox.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_RADIOBOX_H_
+#define _WX_GTK_RADIOBOX_H_
+
+#include "wx/bitmap.h"
+
+class WXDLLIMPEXP_FWD_CORE wxGTKRadioButtonInfo;
+
+#include "wx/list.h"
+
+WX_DECLARE_EXPORTED_LIST(wxGTKRadioButtonInfo, wxRadioBoxButtonsInfoList);
+
+
+//-----------------------------------------------------------------------------
+// wxRadioBox
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxRadioBox : public wxControl,
+ public wxRadioBoxBase
+{
+public:
+ // ctors and dtor
+ wxRadioBox() { }
+ wxRadioBox(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0,
+ const wxString choices[] = (const wxString *) NULL,
+ int majorDim = 0,
+ long style = wxRA_SPECIFY_COLS,
+ const wxValidator& val = wxDefaultValidator,
+ const wxString& name = wxRadioBoxNameStr)
+ {
+ Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name );
+ }
+
+ wxRadioBox(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ int majorDim = 0,
+ long style = wxRA_SPECIFY_COLS,
+ const wxValidator& val = wxDefaultValidator,
+ const wxString& name = wxRadioBoxNameStr)
+ {
+ Create( parent, id, title, pos, size, choices, majorDim, style, val, name );
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0,
+ const wxString choices[] = (const wxString *) NULL,
+ int majorDim = 0,
+ long style = wxRA_SPECIFY_COLS,
+ const wxValidator& val = wxDefaultValidator,
+ const wxString& name = wxRadioBoxNameStr);
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ int majorDim = 0,
+ long style = wxRA_SPECIFY_COLS,
+ const wxValidator& val = wxDefaultValidator,
+ const wxString& name = wxRadioBoxNameStr);
+
+ virtual ~wxRadioBox();
+
+
+ // implement wxItemContainerImmutable methods
+ virtual unsigned int GetCount() const;
+
+ virtual wxString GetString(unsigned int n) const;
+ virtual void SetString(unsigned int n, const wxString& s);
+
+ virtual void SetSelection(int n);
+ virtual int GetSelection() const;
+
+
+ // implement wxRadioBoxBase methods
+ virtual bool Show(unsigned int n, bool show = true);
+ virtual bool Enable(unsigned int n, bool enable = true);
+
+ virtual bool IsItemEnabled(unsigned int n) const;
+ virtual bool IsItemShown(unsigned int n) const;
+
+
+ // override some base class methods to operate on radiobox itself too
+ virtual bool Show( bool show = true );
+ virtual bool Enable( bool enable = true );
+
+ virtual void SetLabel( const wxString& label );
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ virtual int GetItemFromPoint( const wxPoint& pt ) const;
+#if wxUSE_HELP
+ // override virtual wxWindow::GetHelpTextAtPoint to use common platform independent
+ // wxRadioBoxBase::DoGetHelpTextAtPoint from the platform independent
+ // base class-interface wxRadioBoxBase.
+ virtual wxString GetHelpTextAtPoint(const wxPoint & pt, wxHelpEvent::Origin origin) const
+ {
+ return wxRadioBoxBase::DoGetHelpTextAtPoint( this, pt, origin );
+ }
+#endif // wxUSE_HELP
+
+ // implementation
+ // --------------
+
+ void GtkDisableEvents();
+ void GtkEnableEvents();
+#if wxUSE_TOOLTIPS
+ virtual void GTKApplyToolTip(const char* tip);
+#endif // wxUSE_TOOLTIPS
+
+ wxRadioBoxButtonsInfoList m_buttonsInfo;
+
+protected:
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+#if wxUSE_TOOLTIPS
+ virtual void DoSetItemToolTip(unsigned int n, wxToolTip *tooltip);
+#endif
+
+ virtual void DoApplyWidgetStyle(GtkRcStyle *style);
+ virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+
+ virtual bool GTKNeedsToFilterSameWindowFocus() const { return true; }
+
+ virtual bool GTKWidgetNeedsMnemonic() const;
+ virtual void GTKWidgetDoSetMnemonic(GtkWidget* w);
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxRadioBox)
+};
+
+#endif // _WX_GTK_RADIOBOX_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/radiobut.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_RADIOBUT_H_
+#define _WX_GTK_RADIOBUT_H_
+
+//-----------------------------------------------------------------------------
+// wxRadioButton
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxRadioButton: public wxControl
+{
+public:
+ wxRadioButton() { }
+ wxRadioButton( wxWindow *parent,
+ wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxRadioButtonNameStr )
+ {
+ Create( parent, id, label, pos, size, style, validator, name );
+ }
+
+ bool Create( wxWindow *parent,
+ wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxRadioButtonNameStr );
+
+ virtual void SetLabel(const wxString& label);
+ virtual void SetValue(bool val);
+ virtual bool GetValue() const;
+ virtual bool Enable( bool enable = true );
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+protected:
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ virtual void DoApplyWidgetStyle(GtkRcStyle *style);
+ virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+
+private:
+ typedef wxControl base_type;
+
+ DECLARE_DYNAMIC_CLASS(wxRadioButton)
+};
+
+#endif // _WX_GTK_RADIOBUT_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/region.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_REGION_H_
+#define _WX_GTK_REGION_H_
+
+#ifdef __WXGTK3__
+typedef struct _cairo_region cairo_region_t;
+#endif
+
+// ----------------------------------------------------------------------------
+// wxRegion
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxRegion : public wxRegionBase
+{
+public:
+ wxRegion() { }
+
+ wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
+ {
+ InitRect(x, y, w, h);
+ }
+
+ wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight )
+ {
+ InitRect(topLeft.x, topLeft.y,
+ bottomRight.x - topLeft.x, bottomRight.y - topLeft.y);
+ }
+
+ wxRegion( const wxRect& rect )
+ {
+ InitRect(rect.x, rect.y, rect.width, rect.height);
+ }
+
+ wxRegion( size_t n, const wxPoint *points,
+ wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
+
+#if wxUSE_IMAGE
+ wxRegion( const wxBitmap& bmp)
+ {
+ Union(bmp);
+ }
+ wxRegion( const wxBitmap& bmp,
+ const wxColour& transColour, int tolerance = 0)
+ {
+ Union(bmp, transColour, tolerance);
+ }
+#endif // wxUSE_IMAGE
+
+ virtual ~wxRegion();
+
+ // wxRegionBase methods
+ virtual void Clear();
+ virtual bool IsEmpty() const;
+
+#ifdef __WXGTK3__
+ cairo_region_t* GetRegion() const;
+#else
+ wxRegion(const GdkRegion* region);
+ GdkRegion *GetRegion() const;
+#endif
+
+protected:
+ virtual wxGDIRefData *CreateGDIRefData() const;
+ virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
+
+ // wxRegionBase pure virtuals
+ virtual bool DoIsEqual(const wxRegion& region) const;
+ virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const;
+ virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const;
+ virtual wxRegionContain DoContainsRect(const wxRect& rect) const;
+
+ virtual bool DoOffset(wxCoord x, wxCoord y);
+ virtual bool DoUnionWithRect(const wxRect& rect);
+ virtual bool DoUnionWithRegion(const wxRegion& region);
+ virtual bool DoIntersect(const wxRegion& region);
+ virtual bool DoSubtract(const wxRegion& region);
+ virtual bool DoXor(const wxRegion& region);
+
+ // common part of ctors for a rectangle region
+ void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxRegion)
+};
+
+// ----------------------------------------------------------------------------
+// wxRegionIterator: decomposes a region into rectangles
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxRegionIterator: public wxObject
+{
+public:
+ wxRegionIterator();
+ wxRegionIterator(const wxRegion& region);
+ wxRegionIterator(const wxRegionIterator& ri) : wxObject(ri) { Init(); *this = ri; }
+ ~wxRegionIterator();
+
+ wxRegionIterator& operator=(const wxRegionIterator& ri);
+
+ void Reset() { m_current = 0u; }
+ void Reset(const wxRegion& region);
+
+ bool HaveRects() const;
+ operator bool () const { return HaveRects(); }
+
+ wxRegionIterator& operator ++ ();
+ wxRegionIterator operator ++ (int);
+
+ wxCoord GetX() const;
+ wxCoord GetY() const;
+ wxCoord GetW() const;
+ wxCoord GetWidth() const { return GetW(); }
+ wxCoord GetH() const;
+ wxCoord GetHeight() const { return GetH(); }
+ wxRect GetRect() const;
+
+private:
+ void Init();
+ void CreateRects( const wxRegion& r );
+
+ wxRegion m_region;
+ wxRect *m_rects;
+ int m_numRects;
+ int m_current;
+
+ DECLARE_DYNAMIC_CLASS(wxRegionIterator)
+};
+
+
+#endif
+ // _WX_GTK_REGION_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/scrolbar.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_SCROLLBAR_H_
+#define _WX_GTK_SCROLLBAR_H_
+
+//-----------------------------------------------------------------------------
+// wxScrollBar
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxScrollBar: public wxScrollBarBase
+{
+public:
+ wxScrollBar();
+ inline wxScrollBar( wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSB_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxScrollBarNameStr )
+ {
+ Create( parent, id, pos, size, style, validator, name );
+ }
+ bool Create( wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSB_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxScrollBarNameStr );
+ virtual ~wxScrollBar();
+ int GetThumbPosition() const;
+ int GetThumbSize() const;
+ int GetPageSize() const;
+ int GetRange() const;
+ virtual void SetThumbPosition( int viewStart );
+ virtual void SetScrollbar( int position, int thumbSize, int range, int pageSize,
+ bool refresh = true );
+
+ void SetThumbSize(int thumbSize);
+ void SetPageSize( int pageLength );
+ void SetRange(int range);
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ DECLARE_DYNAMIC_CLASS(wxScrollBar)
+};
+
+#endif // _WX_GTK_SCROLLBAR_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/scrolwin.h
+// Purpose: wxScrolledWindow class
+// Author: Robert Roebling
+// Modified by: Vadim Zeitlin (2005-10-10): wxScrolledWindow is now common
+// Created: 01/02/97
+// Copyright: (c) Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_SCROLLWIN_H_
+#define _WX_GTK_SCROLLWIN_H_
+
+// ----------------------------------------------------------------------------
+// wxScrolledWindow
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxScrollHelper : public wxScrollHelperBase
+{
+ typedef wxScrollHelperBase base_type;
+public:
+ // default ctor doesn't do anything
+ wxScrollHelper(wxWindow *win) : wxScrollHelperBase(win) { }
+
+ // implement the base class methods
+ virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
+ int noUnitsX, int noUnitsY,
+ int xPos = 0, int yPos = 0,
+ bool noRefresh = false);
+ virtual void AdjustScrollbars();
+
+ virtual bool IsScrollbarShown(int orient) const;
+
+protected:
+ virtual void DoScroll(int x, int y);
+ virtual void DoShowScrollbars(wxScrollbarVisibility horz,
+ wxScrollbarVisibility vert);
+
+private:
+ // this does (each) half of AdjustScrollbars() work
+ void DoAdjustScrollbar(GtkRange* range,
+ int pixelsPerLine,
+ int winSize,
+ int virtSize,
+ int *pos,
+ int *lines,
+ int *linesPerPage);
+
+ void DoAdjustHScrollbar(int winSize, int virtSize)
+ {
+ DoAdjustScrollbar
+ (
+ m_win->m_scrollBar[wxWindow::ScrollDir_Horz],
+ m_xScrollPixelsPerLine, winSize, virtSize,
+ &m_xScrollPosition, &m_xScrollLines, &m_xScrollLinesPerPage
+ );
+ }
+
+ void DoAdjustVScrollbar(int winSize, int virtSize)
+ {
+ DoAdjustScrollbar
+ (
+ m_win->m_scrollBar[wxWindow::ScrollDir_Vert],
+ m_yScrollPixelsPerLine, winSize, virtSize,
+ &m_yScrollPosition, &m_yScrollLines, &m_yScrollLinesPerPage
+ );
+ }
+
+ // and this does the same for Scroll()
+ void DoScrollOneDir(int orient,
+ int pos,
+ int pixelsPerLine,
+ int *posOld);
+
+ wxDECLARE_NO_COPY_CLASS(wxScrollHelper);
+};
+
+#endif // _WX_GTK_SCROLLWIN_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/slider.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_SLIDER_H_
+#define _WX_GTK_SLIDER_H_
+
+// ----------------------------------------------------------------------------
+// wxSlider
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSlider : public wxSliderBase
+{
+public:
+ wxSlider();
+ wxSlider(wxWindow *parent,
+ wxWindowID id,
+ int value, int minValue, int maxValue,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSL_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxSliderNameStr)
+ {
+ Create( parent, id, value, minValue, maxValue,
+ pos, size, style, validator, name );
+ }
+ ~wxSlider();
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ int value, int minValue, int maxValue,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSL_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxSliderNameStr);
+
+ // implement the base class pure virtuals
+ virtual int GetValue() const;
+ virtual void SetValue(int value);
+
+ virtual void SetRange(int minValue, int maxValue);
+ virtual int GetMin() const;
+ virtual int GetMax() const;
+
+ virtual void SetLineSize(int lineSize);
+ virtual void SetPageSize(int pageSize);
+ virtual int GetLineSize() const;
+ virtual int GetPageSize() const;
+
+ virtual void SetThumbLength(int lenPixels);
+ virtual int GetThumbLength() const;
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ // implementation
+ void GTKDisableEvents();
+ void GTKEnableEvents();
+ bool GTKEventsDisabled() const;
+
+ double m_pos;
+ int m_scrollEventType;
+ bool m_needThumbRelease;
+ GtkWidget *m_scale;
+
+protected:
+ GtkWidget *m_minLabel,*m_maxLabel;
+ bool m_blockScrollEvent;
+
+ virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+
+ // set the slider value unconditionally
+ void GTKSetValue(int value);
+
+ DECLARE_DYNAMIC_CLASS(wxSlider)
+};
+
+#endif // _WX_GTK_SLIDER_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/spinbutt.h
+// Purpose: wxSpinButton class
+// Author: Robert Roebling
+// Modified by:
+// Copyright: (c) Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_SPINBUTT_H_
+#define _WX_GTK_SPINBUTT_H_
+
+//-----------------------------------------------------------------------------
+// wxSpinButton
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSpinButton : public wxSpinButtonBase
+{
+public:
+ wxSpinButton();
+ wxSpinButton(wxWindow *parent,
+ wxWindowID id = -1,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_VERTICAL,
+ const wxString& name = wxSPIN_BUTTON_NAME)
+ {
+ Create(parent, id, pos, size, style, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id = -1,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_VERTICAL,
+ const wxString& name = wxSPIN_BUTTON_NAME);
+
+ virtual int GetValue() const;
+ virtual void SetValue( int value );
+ virtual void SetRange( int minVal, int maxVal );
+ virtual int GetMin() const;
+ virtual int GetMax() const;
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ virtual bool Enable( bool enable = true );
+
+ // implementation
+ int m_pos;
+
+protected:
+ void GtkDisableEvents() const;
+ void GtkEnableEvents() const;
+
+ virtual wxSize DoGetBestSize() const;
+ virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+
+private:
+ typedef wxSpinButtonBase base_type;
+
+ DECLARE_DYNAMIC_CLASS(wxSpinButton)
+};
+
+#endif // _WX_GTK_SPINBUTT_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/spinctrl.h
+// Purpose: wxSpinCtrl class
+// Author: Robert Roebling
+// Modified by:
+// Copyright: (c) Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_SPINCTRL_H_
+#define _WX_GTK_SPINCTRL_H_
+
+//-----------------------------------------------------------------------------
+// wxSpinCtrlGTKBase - Base class for GTK versions of the wxSpinCtrl[Double]
+//
+// This class manages a double valued GTK spinctrl through the DoGet/SetXXX
+// functions that are made public as Get/SetXXX functions for int or double
+// for the wxSpinCtrl and wxSpinCtrlDouble classes respectively to avoid
+// function ambiguity.
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSpinCtrlGTKBase : public wxSpinCtrlBase
+{
+public:
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ double min, double max, double initial,
+ double inc,
+ const wxString& name);
+
+ // wxSpinCtrl(Double) methods call DoXXX functions of the same name
+
+ // accessors
+ // T GetValue() const
+ // T GetMin() const
+ // T GetMax() const
+ // T GetIncrement() const
+ virtual bool GetSnapToTicks() const;
+
+ // operations
+ virtual void SetValue(const wxString& value);
+ // void SetValue(T val)
+ // void SetRange(T minVal, T maxVal)
+ // void SetIncrement(T inc)
+ void SetSnapToTicks( bool snap_to_ticks );
+
+ // Select text in the textctrl
+ void SetSelection(long from, long to);
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ // implementation
+ void OnChar( wxKeyEvent &event );
+
+protected:
+ double DoGetValue() const;
+ double DoGetMin() const;
+ double DoGetMax() const;
+ double DoGetIncrement() const;
+
+ void DoSetValue(double val);
+ void DoSetValue(const wxString& strValue);
+ void DoSetRange(double min_val, double max_val);
+ void DoSetIncrement(double inc);
+
+ void GtkDisableEvents() const;
+ void GtkEnableEvents() const;
+
+ virtual wxSize DoGetBestSize() const;
+ virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const;
+ virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+
+ // Widgets that use the style->base colour for the BG colour should
+ // override this and return true.
+ virtual bool UseGTKStyleBase() const { return true; }
+
+ friend class wxSpinCtrlEventDisabler;
+
+ DECLARE_EVENT_TABLE()
+};
+
+//-----------------------------------------------------------------------------
+// wxSpinCtrl - An integer valued spin control
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSpinCtrl : public wxSpinCtrlGTKBase
+{
+public:
+ wxSpinCtrl() { Init(); }
+ wxSpinCtrl(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
+ int min = 0, int max = 100, int initial = 0,
+ const wxString& name = wxS("wxSpinCtrl"))
+ {
+ Init();
+
+ Create(parent, id, value, pos, size, style, min, max, initial, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
+ int min = 0, int max = 100, int initial = 0,
+ const wxString& name = wxS("wxSpinCtrl"))
+ {
+ return wxSpinCtrlGTKBase::Create(parent, id, value, pos, size,
+ style, min, max, initial, 1, name);
+ }
+
+ // accessors
+ int GetValue() const { return int(DoGetValue()); }
+ int GetMin() const { return int(DoGetMin()); }
+ int GetMax() const { return int(DoGetMax()); }
+ int GetIncrement() const { return int(DoGetIncrement()); }
+
+ // operations
+ void SetValue(const wxString& value) { wxSpinCtrlGTKBase::SetValue(value); } // visibility problem w/ gcc
+ void SetValue( int value ) { DoSetValue(value); }
+ void SetRange( int minVal, int maxVal ) { DoSetRange(minVal, maxVal); }
+ void SetIncrement(int inc) { DoSetIncrement(inc); }
+
+ virtual int GetBase() const { return m_base; }
+ virtual bool SetBase(int base);
+
+private:
+ // Common part of all ctors.
+ void Init()
+ {
+ m_base = 10;
+ }
+
+ int m_base;
+
+ DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
+};
+
+//-----------------------------------------------------------------------------
+// wxSpinCtrlDouble - a double valued spin control
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSpinCtrlDouble : public wxSpinCtrlGTKBase
+{
+public:
+ wxSpinCtrlDouble() {}
+ wxSpinCtrlDouble(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
+ double min = 0, double max = 100, double initial = 0,
+ double inc = 1,
+ const wxString& name = wxS("wxSpinCtrlDouble"))
+ {
+ Create(parent, id, value, pos, size, style,
+ min, max, initial, inc, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT,
+ double min = 0, double max = 100, double initial = 0,
+ double inc = 1,
+ const wxString& name = wxS("wxSpinCtrlDouble"))
+ {
+ return wxSpinCtrlGTKBase::Create(parent, id, value, pos, size,
+ style, min, max, initial, inc, name);
+ }
+
+ // accessors
+ double GetValue() const { return DoGetValue(); }
+ double GetMin() const { return DoGetMin(); }
+ double GetMax() const { return DoGetMax(); }
+ double GetIncrement() const { return DoGetIncrement(); }
+ unsigned GetDigits() const;
+
+ // operations
+ void SetValue(const wxString& value) { wxSpinCtrlGTKBase::SetValue(value); } // visibility problem w/ gcc
+ void SetValue(double value) { DoSetValue(value); }
+ void SetRange(double minVal, double maxVal) { DoSetRange(minVal, maxVal); }
+ void SetIncrement(double inc) { DoSetIncrement(inc); }
+ void SetDigits(unsigned digits);
+
+ virtual int GetBase() const { return 10; }
+ virtual bool SetBase(int WXUNUSED(base)) { return false; }
+
+ DECLARE_DYNAMIC_CLASS(wxSpinCtrlDouble)
+};
+
+#endif // _WX_GTK_SPINCTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/statbmp.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __GTKSTATICBITMAPH__
+#define __GTKSTATICBITMAPH__
+
+#include "wx/icon.h"
+
+//-----------------------------------------------------------------------------
+// wxStaticBitmap
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxStaticBitmap : public wxStaticBitmapBase
+{
+public:
+ wxStaticBitmap();
+ wxStaticBitmap( wxWindow *parent,
+ wxWindowID id,
+ const wxBitmap& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxStaticBitmapNameStr );
+ bool Create( wxWindow *parent,
+ wxWindowID id,
+ const wxBitmap& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxStaticBitmapNameStr);
+
+ virtual void SetIcon(const wxIcon& icon) { SetBitmap( icon ); }
+ virtual void SetBitmap( const wxBitmap& bitmap );
+ virtual wxBitmap GetBitmap() const { return m_bitmap; }
+
+ // for compatibility with wxMSW
+ wxIcon GetIcon() const
+ {
+ // don't use wxDynamicCast, icons and bitmaps are really the same thing
+ // in wxGTK
+ return (const wxIcon &)m_bitmap;
+ }
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+private:
+ wxBitmap m_bitmap;
+
+ DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
+};
+
+#endif // __GTKSTATICBITMAPH__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/statbox.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTKSTATICBOX_H_
+#define _WX_GTKSTATICBOX_H_
+
+//-----------------------------------------------------------------------------
+// wxStaticBox
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxStaticBox : public wxStaticBoxBase
+{
+public:
+ wxStaticBox();
+ wxStaticBox( wxWindow *parent,
+ wxWindowID id,
+ const wxString &label,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ long style = 0,
+ const wxString &name = wxStaticBoxNameStr );
+ bool Create( wxWindow *parent,
+ wxWindowID id,
+ const wxString &label,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ long style = 0,
+ const wxString &name = wxStaticBoxNameStr );
+
+ virtual void SetLabel( const wxString &label );
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ // implementation
+
+ virtual bool GTKIsTransparentForMouse() const { return true; }
+
+ virtual void GetBordersForSizer(int *borderTop, int *borderOther) const;
+
+ virtual void AddChild( wxWindowBase *child );
+
+protected:
+ virtual bool GTKWidgetNeedsMnemonic() const;
+ virtual void GTKWidgetDoSetMnemonic(GtkWidget* w);
+
+ void DoApplyWidgetStyle(GtkRcStyle *style);
+
+ DECLARE_DYNAMIC_CLASS(wxStaticBox)
+};
+
+#endif // _WX_GTKSTATICBOX_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/statline.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __GTKSTATICLINEH__
+#define __GTKSTATICLINEH__
+
+#include "wx/defs.h"
+
+#if wxUSE_STATLINE
+
+// ----------------------------------------------------------------------------
+// wxStaticLine
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxStaticLine : public wxStaticLineBase
+{
+public:
+ wxStaticLine();
+ wxStaticLine(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxLI_HORIZONTAL,
+ const wxString &name = wxStaticLineNameStr);
+ bool Create(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxLI_HORIZONTAL,
+ const wxString &name = wxStaticLineNameStr);
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxStaticLine)
+};
+
+#endif // wxUSE_STATLINE
+
+#endif // __GTKSTATICLINEH__
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/stattext.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_STATTEXT_H_
+#define _WX_GTK_STATTEXT_H_
+
+//-----------------------------------------------------------------------------
+// wxStaticText
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxStaticText : public wxStaticTextBase
+{
+public:
+ wxStaticText();
+ wxStaticText(wxWindow *parent,
+ wxWindowID id,
+ const wxString &label,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ long style = 0,
+ const wxString &name = wxStaticTextNameStr );
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString &label,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ long style = 0,
+ const wxString &name = wxStaticTextNameStr );
+
+ void SetLabel( const wxString &label );
+
+ bool SetFont( const wxFont &font );
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ // implementation
+ // --------------
+
+protected:
+ virtual bool GTKWidgetNeedsMnemonic() const;
+ virtual void GTKWidgetDoSetMnemonic(GtkWidget* w);
+
+ virtual wxSize DoGetBestSize() const;
+
+ virtual wxString DoGetLabel() const;
+ virtual void DoSetLabel(const wxString& str);
+#if wxUSE_MARKUP
+ virtual bool DoSetLabelMarkup(const wxString& markup);
+#endif // wxUSE_MARKUP
+
+private:
+ // Common part of SetLabel() and DoSetLabelMarkup().
+ typedef void (wxStaticText::*GTKLabelSetter)(GtkLabel *, const wxString&);
+
+ void GTKDoSetLabel(GTKLabelSetter setter, const wxString& label);
+
+
+ DECLARE_DYNAMIC_CLASS(wxStaticText)
+};
+
+#endif
+ // _WX_GTK_STATTEXT_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/taskbar.h
+// Purpose: wxTaskBarIcon class for GTK2
+// Author: Paul Cornett
+// Created: 2009-02-08
+// Copyright: (c) 2009 Paul Cornett
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_TASKBARICON_H_
+#define _WX_GTK_TASKBARICON_H_
+
+class WXDLLIMPEXP_ADV wxTaskBarIcon: public wxTaskBarIconBase
+{
+public:
+ wxTaskBarIcon(wxTaskBarIconType iconType = wxTBI_DEFAULT_TYPE);
+ ~wxTaskBarIcon();
+ virtual bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxString());
+ virtual bool RemoveIcon();
+ virtual bool PopupMenu(wxMenu* menu);
+ bool IsOk() const { return true; }
+ bool IsIconInstalled() const;
+
+ class Private;
+
+private:
+ Private* m_priv;
+
+ DECLARE_DYNAMIC_CLASS(wxTaskBarIcon)
+ DECLARE_NO_COPY_CLASS(wxTaskBarIcon)
+};
+
+#endif // _WX_GTK_TASKBARICON_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/textctrl.h
+// Purpose:
+// Author: Robert Roebling
+// Created: 01/02/97
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_TEXTCTRL_H_
+#define _WX_GTK_TEXTCTRL_H_
+
+typedef struct _GtkTextMark GtkTextMark;
+
+//-----------------------------------------------------------------------------
+// wxTextCtrl
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxTextCtrl: public wxTextCtrlBase
+{
+public:
+ wxTextCtrl() { Init(); }
+ wxTextCtrl(wxWindow *parent,
+ wxWindowID id,
+ const wxString &value = wxEmptyString,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString &name = wxTextCtrlNameStr);
+
+ virtual ~wxTextCtrl();
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString &value = wxEmptyString,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString &name = wxTextCtrlNameStr);
+
+ // implement base class pure virtuals
+ // ----------------------------------
+
+ virtual void WriteText(const wxString& text);
+ virtual wxString GetValue() const;
+ virtual bool IsEmpty() const;
+
+ virtual int GetLineLength(long lineNo) const;
+ virtual wxString GetLineText(long lineNo) const;
+ virtual int GetNumberOfLines() const;
+
+ virtual bool IsModified() const;
+ virtual bool IsEditable() const;
+
+ virtual void GetSelection(long* from, long* to) const;
+
+ virtual void Remove(long from, long to);
+
+ virtual void MarkDirty();
+ virtual void DiscardEdits();
+
+ virtual bool SetStyle(long start, long end, const wxTextAttr& style);
+ virtual bool GetStyle(long position, wxTextAttr& style);
+
+ // translate between the position (which is just an index in the text ctrl
+ // considering all its contents as a single strings) and (x, y) coordinates
+ // which represent column and line.
+ virtual long XYToPosition(long x, long y) const;
+ virtual bool PositionToXY(long pos, long *x, long *y) const;
+
+ virtual void ShowPosition(long pos);
+
+ virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const;
+ virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
+ wxTextCoord *col,
+ wxTextCoord *row) const
+ {
+ return wxTextCtrlBase::HitTest(pt, col, row);
+ }
+
+ // Clipboard operations
+ virtual void Copy();
+ virtual void Cut();
+ virtual void Paste();
+
+ // Insertion point
+ virtual void SetInsertionPoint(long pos);
+ virtual long GetInsertionPoint() const;
+ virtual wxTextPos GetLastPosition() const;
+
+ virtual void SetSelection(long from, long to);
+ virtual void SetEditable(bool editable);
+
+ // Overridden wxWindow methods
+ virtual void SetWindowStyleFlag( long style );
+ virtual bool Enable( bool enable = true );
+
+ // Implementation from now on
+ void OnDropFiles( wxDropFilesEvent &event );
+ void OnChar( wxKeyEvent &event );
+
+ void OnCut(wxCommandEvent& event);
+ void OnCopy(wxCommandEvent& event);
+ void OnPaste(wxCommandEvent& event);
+ void OnUndo(wxCommandEvent& event);
+ void OnRedo(wxCommandEvent& event);
+
+ void OnUpdateCut(wxUpdateUIEvent& event);
+ void OnUpdateCopy(wxUpdateUIEvent& event);
+ void OnUpdatePaste(wxUpdateUIEvent& event);
+ void OnUpdateUndo(wxUpdateUIEvent& event);
+ void OnUpdateRedo(wxUpdateUIEvent& event);
+
+ bool SetFont(const wxFont& font);
+ bool SetForegroundColour(const wxColour& colour);
+ bool SetBackgroundColour(const wxColour& colour);
+
+ GtkWidget* GetConnectWidget();
+
+ void SetUpdateFont(bool WXUNUSED(update)) { }
+
+ // implementation only from now on
+
+ // tell the control to ignore next text changed signal
+ void IgnoreNextTextUpdate(int n = 1) { m_countUpdatesToIgnore = n; }
+
+ // should we ignore the changed signal? always resets the flag
+ bool IgnoreTextUpdate();
+
+ // call this to indicate that the control is about to be changed
+ // programmatically and so m_modified flag shouldn't be set
+ void DontMarkDirtyOnNextChange() { m_dontMarkDirty = true; }
+
+ // should we mark the control as dirty? always resets the flag
+ bool MarkDirtyOnChange();
+
+ // always let GTK have mouse release events for multiline controls
+ virtual bool GTKProcessEvent(wxEvent& event) const;
+
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+protected:
+ // overridden wxWindow virtual methods
+ virtual wxSize DoGetBestSize() const;
+ virtual void DoApplyWidgetStyle(GtkRcStyle *style);
+ virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+
+ virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const;
+
+ virtual void DoFreeze();
+ virtual void DoThaw();
+
+ // Widgets that use the style->base colour for the BG colour should
+ // override this and return true.
+ virtual bool UseGTKStyleBase() const { return true; }
+
+ virtual void DoSetValue(const wxString &value, int flags = 0);
+
+ // Override this to use either GtkEntry or GtkTextView IME depending on the
+ // kind of control we are.
+ virtual int GTKIMFilterKeypress(GdkEventKey* event) const;
+
+ virtual wxPoint DoPositionToCoords(long pos) const;
+
+ // wrappers hiding the differences between functions doing the same thing
+ // for GtkTextView and GtkEntry (all of them use current window style to
+ // set the given characteristic)
+ void GTKSetEditable();
+ void GTKSetVisibility();
+ void GTKSetActivatesDefault();
+ void GTKSetWrapMode();
+ void GTKSetJustification();
+
+private:
+ void Init();
+
+ // overridden wxTextEntry virtual methods
+ virtual GtkEditable *GetEditable() const;
+ virtual GtkEntry *GetEntry() const;
+ virtual void EnableTextChangedEvents(bool enable);
+
+ // change the font for everything in this control
+ void ChangeFontGlobally();
+
+ // get the encoding which is used in this control: this looks at our font
+ // and default style but not the current style (i.e. the style for the
+ // current position); returns wxFONTENCODING_SYSTEM if we have no specific
+ // encoding
+ wxFontEncoding GetTextEncoding() const;
+
+ // returns either m_text or m_buffer depending on whether the control is
+ // single- or multi-line; convenient for the GTK+ functions which work with
+ // both
+ void *GetTextObject() const
+ {
+ return IsMultiLine() ? static_cast<void *>(m_buffer)
+ : static_cast<void *>(m_text);
+ }
+
+
+ // the widget used for single line controls
+ GtkWidget *m_text;
+
+ bool m_modified:1;
+ bool m_dontMarkDirty:1;
+
+ int m_countUpdatesToIgnore;
+
+ // Our text buffer. Convenient, and holds the buffer while using
+ // a dummy one when frozen
+ GtkTextBuffer *m_buffer;
+
+ GtkTextMark* m_showPositionOnThaw;
+ GSList* m_anonymousMarkList;
+
+ // For wxTE_AUTO_URL
+ void OnUrlMouseEvent(wxMouseEvent&);
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxTextCtrl)
+};
+
+#endif // _WX_GTK_TEXTCTRL_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/textentry.h
+// Purpose: wxGTK-specific wxTextEntry implementation
+// Author: Vadim Zeitlin
+// Created: 2007-09-24
+// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_TEXTENTRY_H_
+#define _WX_GTK_TEXTENTRY_H_
+
+typedef struct _GdkEventKey GdkEventKey;
+typedef struct _GtkEditable GtkEditable;
+typedef struct _GtkEntry GtkEntry;
+
+// ----------------------------------------------------------------------------
+// wxTextEntry: roughly corresponds to GtkEditable
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase
+{
+public:
+ wxTextEntry() { }
+
+ // implement wxTextEntryBase pure virtual methods
+ virtual void WriteText(const wxString& text);
+ virtual void Remove(long from, long to);
+
+ virtual void Copy();
+ virtual void Cut();
+ virtual void Paste();
+
+ virtual void Undo();
+ virtual void Redo();
+ virtual bool CanUndo() const;
+ virtual bool CanRedo() const;
+
+ virtual void SetInsertionPoint(long pos);
+ virtual long GetInsertionPoint() const;
+ virtual long GetLastPosition() const;
+
+ virtual void SetSelection(long from, long to);
+ virtual void GetSelection(long *from, long *to) const;
+
+ virtual bool IsEditable() const;
+ virtual void SetEditable(bool editable);
+
+ virtual void SetMaxLength(unsigned long len);
+
+ // implementation only from now on
+ void SendMaxLenEvent();
+ bool GTKEntryOnInsertText(const char* text);
+
+protected:
+ // This method must be called from the derived class Create() to connect
+ // the handlers for the clipboard (cut/copy/paste) events.
+ void GTKConnectClipboardSignals(GtkWidget* entry);
+
+ // And this one to connect "insert-text" signal.
+ void GTKConnectInsertTextSignal(GtkEntry* entry);
+
+
+ virtual void DoSetValue(const wxString& value, int flags);
+ virtual wxString DoGetValue() const;
+
+ // margins functions
+ virtual bool DoSetMargins(const wxPoint& pt);
+ virtual wxPoint DoGetMargins() const;
+
+ virtual bool DoAutoCompleteStrings(const wxArrayString& choices);
+
+ // Override the base class method to use GtkEntry IM context.
+ virtual int GTKIMFilterKeypress(GdkEventKey* event) const;
+
+private:
+ // implement this to return the associated GtkEntry or another widget
+ // implementing GtkEditable
+ virtual GtkEditable *GetEditable() const = 0;
+
+ // implement this to return the associated GtkEntry
+ virtual GtkEntry *GetEntry() const = 0;
+};
+
+#endif // _WX_GTK_TEXTENTRY_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/tglbtn.h
+// Purpose: Declaration of the wxToggleButton class, which implements a
+// toggle button under wxGTK.
+// Author: John Norris, minor changes by Axel Schlueter
+// Modified by:
+// Created: 08.02.01
+// Copyright: (c) 2000 Johnny C. Norris II
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_TOGGLEBUTTON_H_
+#define _WX_GTK_TOGGLEBUTTON_H_
+
+#include "wx/bitmap.h"
+
+//-----------------------------------------------------------------------------
+// wxToggleButton
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxToggleButton: public wxToggleButtonBase
+{
+public:
+ // construction/destruction
+ wxToggleButton() {}
+ wxToggleButton(wxWindow *parent,
+ wxWindowID id,
+ const wxString& 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 wxString& 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
+ void SetLabel(const wxString& label);
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+protected:
+ void GTKDisableEvents();
+ void GTKEnableEvents();
+
+ virtual wxSize DoGetBestSize() const;
+ virtual void DoApplyWidgetStyle(GtkRcStyle *style);
+
+#if wxUSE_MARKUP
+ virtual bool DoSetLabelMarkup(const wxString& markup);
+#endif // wxUSE_MARKUP
+
+private:
+ typedef wxToggleButtonBase base_type;
+
+ // Return the GtkLabel used by this toggle button.
+ GtkLabel *GTKGetLabel() const;
+
+ DECLARE_DYNAMIC_CLASS(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:
+ typedef wxToggleButtonBase base_type;
+
+ DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton)
+};
+
+#endif // _WX_GTK_TOGGLEBUTTON_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/toolbar.h
+// Purpose: GTK toolbar
+// Author: Robert Roebling
+// Copyright: (c) Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_TOOLBAR_H_
+#define _WX_GTK_TOOLBAR_H_
+
+#if wxUSE_TOOLBAR
+
+typedef struct _GtkTooltips GtkTooltips;
+
+// ----------------------------------------------------------------------------
+// wxToolBar
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase
+{
+public:
+ // construction/destruction
+ wxToolBar() { Init(); }
+ wxToolBar( wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxTB_HORIZONTAL,
+ const wxString& name = wxToolBarNameStr )
+ {
+ Init();
+
+ Create(parent, id, pos, size, style, name);
+ }
+
+ bool Create( wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxTB_HORIZONTAL,
+ const wxString& name = wxToolBarNameStr );
+
+ virtual ~wxToolBar();
+
+ virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
+
+ virtual void SetToolShortHelp(int id, const wxString& helpString);
+
+ virtual void SetWindowStyleFlag( long style );
+
+ virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap);
+ virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap);
+
+ virtual bool Realize();
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ virtual wxToolBarToolBase *CreateTool(int id,
+ const wxString& label,
+ const wxBitmap& bitmap1,
+ const wxBitmap& bitmap2 = wxNullBitmap,
+ wxItemKind kind = wxITEM_NORMAL,
+ wxObject *clientData = NULL,
+ const wxString& shortHelpString = wxEmptyString,
+ const wxString& longHelpString = wxEmptyString);
+ virtual wxToolBarToolBase *CreateTool(wxControl *control,
+ const wxString& label);
+
+ // implementation from now on
+ // --------------------------
+
+protected:
+ // choose the default border for this window
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_DEFAULT; }
+
+ virtual wxSize DoGetBestSize() const;
+ virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+
+ // implement base class pure virtuals
+ virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
+ virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
+
+ virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
+ virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
+ virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
+
+private:
+ void Init();
+ void GtkSetStyle();
+ GSList* GetRadioGroup(size_t pos);
+ virtual void AddChildGTK(wxWindowGTK* child);
+
+ GtkToolbar* m_toolbar;
+ GtkTooltips* m_tooltips;
+
+ DECLARE_DYNAMIC_CLASS(wxToolBar)
+};
+
+#endif // wxUSE_TOOLBAR
+
+#endif
+ // _WX_GTK_TOOLBAR_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/tooltip.h
+// Purpose: wxToolTip class
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTKTOOLTIP_H_
+#define _WX_GTKTOOLTIP_H_
+
+#include "wx/string.h"
+#include "wx/object.h"
+
+//-----------------------------------------------------------------------------
+// forward declarations
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxWindow;
+
+//-----------------------------------------------------------------------------
+// wxToolTip
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxToolTip : public wxObject
+{
+public:
+ wxToolTip( const wxString &tip );
+
+ // globally change the tooltip parameters
+ static void Enable( bool flag );
+ static void SetDelay( long msecs );
+ // set the delay after which the tooltip disappears or how long the tooltip remains visible
+ static void SetAutoPop(long msecs);
+ // set the delay between subsequent tooltips to appear
+ static void SetReshow(long msecs);
+
+ // get/set the tooltip text
+ void SetTip( const wxString &tip );
+ wxString GetTip() const { return m_text; }
+
+ wxWindow *GetWindow() const { return m_window; }
+
+ // Implementation
+ void GTKSetWindow(wxWindow* win);
+ static void GTKApply(GtkWidget* widget, const char* tip);
+
+private:
+ wxString m_text;
+ wxWindow *m_window;
+
+ DECLARE_ABSTRACT_CLASS(wxToolTip)
+};
+
+#endif // _WX_GTKTOOLTIP_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/toplevel.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling, Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_TOPLEVEL_H_
+#define _WX_GTK_TOPLEVEL_H_
+
+//-----------------------------------------------------------------------------
+// wxTopLevelWindowGTK
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxTopLevelWindowGTK : public wxTopLevelWindowBase
+{
+ typedef wxTopLevelWindowBase base_type;
+public:
+ // construction
+ wxTopLevelWindowGTK() { Init(); }
+ wxTopLevelWindowGTK(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr)
+ {
+ Init();
+
+ Create(parent, id, title, pos, size, style, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr);
+
+ virtual ~wxTopLevelWindowGTK();
+
+ // implement base class pure virtuals
+ virtual void Maximize(bool maximize = true);
+ virtual bool IsMaximized() const;
+ virtual void Iconize(bool iconize = true);
+ virtual bool IsIconized() const;
+ virtual void SetIcons(const wxIconBundle& icons);
+ virtual void Restore();
+
+ virtual bool EnableCloseButton(bool enable = true);
+
+ virtual void ShowWithoutActivating();
+ virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
+ virtual bool IsFullScreen() const { return m_fsIsShowing; }
+
+ virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO);
+
+ virtual void SetWindowStyleFlag( long style );
+
+ virtual bool Show(bool show = true);
+
+ virtual void Raise();
+
+ virtual bool IsActive();
+
+ virtual void SetTitle( const wxString &title );
+ virtual wxString GetTitle() const { return m_title; }
+
+ virtual void SetLabel(const wxString& label) { SetTitle( label ); }
+ virtual wxString GetLabel() const { return GetTitle(); }
+
+
+ virtual bool SetTransparent(wxByte alpha);
+ virtual bool CanSetTransparent();
+
+ // Experimental, to allow help windows to be
+ // viewable from within modal dialogs
+ virtual void AddGrab();
+ virtual void RemoveGrab();
+ virtual bool IsGrabbed() const { return m_grabbed; }
+
+
+ virtual void Refresh( bool eraseBackground = true,
+ const wxRect *rect = (const wxRect *) NULL );
+
+ // implementation from now on
+ // --------------------------
+
+ // GTK callbacks
+ virtual void OnInternalIdle();
+
+ virtual void GTKHandleRealized();
+
+ void GTKConfigureEvent(int x, int y);
+
+ // do *not* call this to iconize the frame, this is a private function!
+ void SetIconizeState(bool iconic);
+
+ GtkWidget *m_mainWidget;
+
+ bool m_fsIsShowing; /* full screen */
+ int m_fsSaveGdkFunc, m_fsSaveGdkDecor;
+ wxRect m_fsSaveFrame;
+
+ // m_windowStyle translated to GDK's terms
+ int m_gdkFunc,
+ m_gdkDecor;
+
+ // size of WM decorations
+ struct DecorSize
+ {
+ int left, right, top, bottom;
+ };
+ DecorSize m_decorSize;
+
+ // private gtk_timeout_add result for mimicing wxUSER_ATTENTION_INFO and
+ // wxUSER_ATTENTION_ERROR difference, -2 for no hint, -1 for ERROR hint, rest for GtkTimeout handle.
+ int m_urgency_hint;
+ // timer for detecting WM with broken _NET_REQUEST_FRAME_EXTENTS handling
+ unsigned m_netFrameExtentsTimerId;
+
+ // return the size of the window without WM decorations
+ void GTKDoGetSize(int *width, int *height) const;
+
+ void GTKUpdateDecorSize(const DecorSize& decorSize);
+
+protected:
+ // give hints to the Window Manager for how the size
+ // of the TLW can be changed by dragging
+ virtual void DoSetSizeHints( int minW, int minH,
+ int maxW, int maxH,
+ int incW, int incH);
+ // move the window to the specified location and resize it
+ virtual void DoMoveWindow(int x, int y, int width, int height);
+
+ // take into account WM decorations here
+ virtual void DoSetSize(int x, int y,
+ int width, int height,
+ int sizeFlags = wxSIZE_AUTO);
+
+ virtual void DoSetClientSize(int width, int height);
+ virtual void DoGetClientSize(int *width, int *height) const;
+
+ // string shown in the title bar
+ wxString m_title;
+
+ bool m_deferShow;
+
+private:
+ void Init();
+ DecorSize& GetCachedDecorSize();
+
+ // size hint increments
+ int m_incWidth, m_incHeight;
+
+ // is the frame currently iconized?
+ bool m_isIconized;
+
+ // is the frame currently grabbed explicitly by the application?
+ bool m_grabbed;
+
+ bool m_updateDecorSize;
+ bool m_deferShowAllowed;
+};
+
+#endif // _WX_GTK_TOPLEVEL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: include/gtk/wx/webview.h
+// Purpose: GTK webkit backend for web view component
+// Author: Robert Roebling, Marianne Gagnon
+// Copyright: (c) 2010 Marianne Gagnon, 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_WEBKITCTRL_H_
+#define _WX_GTK_WEBKITCTRL_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__)
+
+#include "wx/sharedptr.h"
+#include "wx/webview.h"
+
+typedef struct _WebKitWebView WebKitWebView;
+
+//-----------------------------------------------------------------------------
+// wxWebViewWebKit
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_WEBVIEW wxWebViewWebKit : public wxWebView
+{
+public:
+ wxWebViewWebKit();
+
+ wxWebViewWebKit(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& url = wxWebViewDefaultURLStr,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0,
+ const wxString& name = wxWebViewNameStr)
+ {
+ Create(parent, id, url, pos, size, style, name);
+ }
+
+ virtual bool Create(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& url = wxWebViewDefaultURLStr,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0,
+ const wxString& name = wxWebViewNameStr);
+
+ virtual ~wxWebViewWebKit();
+
+ virtual bool Enable( bool enable = true );
+
+ // implementation
+ // --------------
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ virtual void Stop();
+ virtual void LoadURL(const wxString& url);
+ virtual void GoBack();
+ virtual void GoForward();
+ virtual void Reload(wxWebViewReloadFlags flags = wxWEBVIEW_RELOAD_DEFAULT);
+ virtual bool CanGoBack() const;
+ virtual bool CanGoForward() const;
+ virtual void ClearHistory();
+ virtual void EnableContextMenu(bool enable = true);
+ virtual void EnableHistory(bool enable = true);
+ virtual wxVector<wxSharedPtr<wxWebViewHistoryItem> > GetBackwardHistory();
+ virtual wxVector<wxSharedPtr<wxWebViewHistoryItem> > GetForwardHistory();
+ virtual void LoadHistoryItem(wxSharedPtr<wxWebViewHistoryItem> item);
+ virtual wxString GetCurrentURL() const;
+ virtual wxString GetCurrentTitle() const;
+ virtual wxString GetPageSource() const;
+ virtual wxString GetPageText() const;
+ virtual void Print();
+ virtual bool IsBusy() const;
+
+ void SetZoomType(wxWebViewZoomType);
+ wxWebViewZoomType GetZoomType() const;
+ bool CanSetZoomType(wxWebViewZoomType) const;
+ virtual wxWebViewZoom GetZoom() const;
+ virtual void SetZoom(wxWebViewZoom);
+
+ //Clipboard functions
+ virtual bool CanCut() const;
+ virtual bool CanCopy() const;
+ virtual bool CanPaste() const;
+ virtual void Cut();
+ virtual void Copy();
+ virtual void Paste();
+
+ //Undo / redo functionality
+ virtual bool CanUndo() const;
+ virtual bool CanRedo() const;
+ virtual void Undo();
+ virtual void Redo();
+
+ //Find function
+ virtual long Find(const wxString& text, int flags = wxWEBVIEW_FIND_DEFAULT);
+
+ //Editing functions
+ virtual void SetEditable(bool enable = true);
+ virtual bool IsEditable() const;
+
+ //Selection
+ virtual void DeleteSelection();
+ virtual bool HasSelection() const;
+ virtual void SelectAll();
+ virtual wxString GetSelectedText() const;
+ virtual wxString GetSelectedSource() const;
+ virtual void ClearSelection();
+
+ virtual void RunScript(const wxString& javascript);
+
+ //Virtual Filesystem Support
+ virtual void RegisterHandler(wxSharedPtr<wxWebViewHandler> handler);
+ virtual wxVector<wxSharedPtr<wxWebViewHandler> > GetHandlers() { return m_handlerList; }
+
+ virtual void* GetNativeBackend() const { return m_web_view; }
+
+ /** TODO: check if this can be made private
+ * The native control has a getter to check for busy state, but except in
+ * very recent versions of webkit this getter doesn't say everything we need
+ * (namely it seems to stay indefinitely busy when loading is cancelled by
+ * user)
+ */
+ bool m_busy;
+
+ wxString m_vfsurl;
+
+ //We use this flag to stop recursion when we load a page from the navigation
+ //callback, mainly when loading a VFS page
+ bool m_guard;
+ //This flag is use to indicate when a navigation event is the result of a
+ //create-web-view signal and so we need to send a new window event
+ bool m_creating;
+
+protected:
+ virtual void DoSetPage(const wxString& html, const wxString& baseUrl);
+
+ virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+
+private:
+
+ void ZoomIn();
+ void ZoomOut();
+ void SetWebkitZoom(float level);
+ float GetWebkitZoom() const;
+
+ //Find helper function
+ void FindClear();
+
+ // focus event handler: calls GTKUpdateBitmap()
+ void GTKOnFocus(wxFocusEvent& event);
+
+ WebKitWebView *m_web_view;
+ int m_historyLimit;
+
+ wxVector<wxSharedPtr<wxWebViewHandler> > m_handlerList;
+
+ //variables used for Find()
+ int m_findFlags;
+ wxString m_findText;
+ int m_findPosition;
+ int m_findCount;
+
+ wxDECLARE_DYNAMIC_CLASS(wxWebViewWebKit);
+};
+
+class WXDLLIMPEXP_WEBVIEW wxWebViewFactoryWebKit : public wxWebViewFactory
+{
+public:
+ virtual wxWebView* Create() { return new wxWebViewWebKit; }
+ virtual wxWebView* Create(wxWindow* parent,
+ wxWindowID id,
+ const wxString& url = wxWebViewDefaultURLStr,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxWebViewNameStr)
+ { return new wxWebViewWebKit(parent, id, url, pos, size, style, name); }
+};
+
+
+#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__)
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: include/wx/gtk/webviewhistoryitem.h
+// Purpose: wxWebViewHistoryItem header for GTK
+// Author: Steven Lamerton
+// Copyright: (c) 2011 Steven Lamerton
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_WEBVIEWHISTORYITEM_H_
+#define _WX_GTK_WEBVIEWHISTORYITEM_H_
+
+#include "wx/setup.h"
+
+#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__)
+
+class WXDLLIMPEXP_WEBVIEW wxWebViewHistoryItem
+{
+public:
+ wxWebViewHistoryItem(const wxString& url, const wxString& title) :
+ m_url(url), m_title(title) {}
+ wxString GetUrl() { return m_url; }
+ wxString GetTitle() { return m_title; }
+
+ friend class wxWebViewWebKit;
+
+private:
+ wxString m_url, m_title;
+ void* m_histItem;
+};
+
+#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__)
+
+#endif // _WX_GTK_WEBVIEWHISTORYITEM_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/window.h
+// Purpose:
+// Author: Robert Roebling
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_WINDOW_H_
+#define _WX_GTK_WINDOW_H_
+
+#include "wx/dynarray.h"
+
+#ifdef __WXGTK3__
+ typedef struct _cairo cairo_t;
+ typedef struct _GtkStyleProvider GtkStyleProvider;
+ #define WXUNUSED_IN_GTK3(x)
+#else
+ #define WXUNUSED_IN_GTK3(x) x
+#endif
+
+typedef struct _GdkEventKey GdkEventKey;
+typedef struct _GtkIMContext GtkIMContext;
+
+WX_DEFINE_EXPORTED_ARRAY_PTR(GdkWindow *, wxArrayGdkWindows);
+
+extern "C"
+{
+
+typedef void (*wxGTKCallback)();
+
+}
+
+//-----------------------------------------------------------------------------
+// wxWindowGTK
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxWindowGTK : public wxWindowBase
+{
+public:
+ // creating the window
+ // -------------------
+ wxWindowGTK();
+ wxWindowGTK(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxPanelNameStr);
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxPanelNameStr);
+ virtual ~wxWindowGTK();
+
+ // implement base class (pure) virtual methods
+ // -------------------------------------------
+
+ virtual void Raise();
+ virtual void Lower();
+
+ virtual bool Show( bool show = true );
+
+ virtual bool IsRetained() const;
+
+ virtual void SetFocus();
+
+ // hint from wx to native GTK+ tab traversal code
+ virtual void SetCanFocus(bool canFocus);
+
+ virtual bool Reparent( wxWindowBase *newParent );
+
+ virtual void WarpPointer(int x, int y);
+
+ virtual void Refresh( bool eraseBackground = true,
+ const wxRect *rect = (const wxRect *) NULL );
+ virtual void Update();
+ virtual void ClearBackground();
+
+ virtual bool SetBackgroundColour( const wxColour &colour );
+ virtual bool SetForegroundColour( const wxColour &colour );
+ virtual bool SetCursor( const wxCursor &cursor );
+ virtual bool SetFont( const wxFont &font );
+
+ virtual bool SetBackgroundStyle(wxBackgroundStyle style) ;
+ virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const;
+
+ virtual int GetCharHeight() const;
+ virtual int GetCharWidth() const;
+
+ virtual void SetScrollbar( int orient, int pos, int thumbVisible,
+ int range, bool refresh = true );
+ virtual void SetScrollPos( int orient, int pos, bool refresh = true );
+ virtual int GetScrollPos( int orient ) const;
+ virtual int GetScrollThumb( int orient ) const;
+ virtual int GetScrollRange( int orient ) const;
+ virtual void ScrollWindow( int dx, int dy,
+ const wxRect* rect = NULL );
+ virtual bool ScrollLines(int lines);
+ virtual bool ScrollPages(int pages);
+
+#if wxUSE_DRAG_AND_DROP
+ virtual void SetDropTarget( wxDropTarget *dropTarget );
+#endif // wxUSE_DRAG_AND_DROP
+
+ virtual void AddChild( wxWindowBase *child );
+ virtual void RemoveChild( wxWindowBase *child );
+
+ virtual void SetLayoutDirection(wxLayoutDirection dir);
+ virtual wxLayoutDirection GetLayoutDirection() const;
+ virtual wxCoord AdjustForLayoutDirection(wxCoord x,
+ wxCoord width,
+ wxCoord widthTotal) const;
+
+ virtual bool DoIsExposed( int x, int y ) const;
+ virtual bool DoIsExposed( int x, int y, int w, int h ) const;
+
+ // currently wxGTK2-only
+ void SetDoubleBuffered(bool on);
+ virtual bool IsDoubleBuffered() const;
+
+ // SetLabel(), which does nothing in wxWindow
+ virtual void SetLabel(const wxString& label) { m_gtkLabel = label; }
+ virtual wxString GetLabel() const { return m_gtkLabel; }
+
+ // implementation
+ // --------------
+
+ virtual WXWidget GetHandle() const { return m_widget; }
+
+ // many important things are done here, this function must be called
+ // regularly
+ virtual void OnInternalIdle();
+
+ // For compatibility across platforms (not in event table)
+ void OnIdle(wxIdleEvent& WXUNUSED(event)) {}
+
+ // Used by all window classes in the widget creation process.
+ bool PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size );
+ void PostCreation();
+
+ // Internal addition of child windows
+ void DoAddChild(wxWindowGTK *child);
+
+ // This method sends wxPaintEvents to the window.
+ // It is also responsible for background erase events.
+#ifdef __WXGTK3__
+ void GTKSendPaintEvents(cairo_t* cr);
+#else
+ void GTKSendPaintEvents(const GdkRegion* region);
+#endif
+
+ // The methods below are required because many native widgets
+ // are composed of several subwidgets and setting a style for
+ // the widget means setting it for all subwidgets as well.
+ // also, it is not clear which native widget is the top
+ // widget where (most of) the input goes. even tooltips have
+ // to be applied to all subwidgets.
+ virtual GtkWidget* GetConnectWidget();
+ void ConnectWidget( GtkWidget *widget );
+
+ // Called from several event handlers, if it returns true or false, the
+ // same value should be immediately returned by the handler without doing
+ // anything else. If it returns -1, the handler should continue as usual
+ int GTKCallbackCommonPrologue(struct _GdkEventAny *event) const;
+
+ // Simplified form of GTKCallbackCommonPrologue() which can be used from
+ // GTK callbacks without return value to check if the event should be
+ // ignored: if this returns true, the event shouldn't be handled
+ bool GTKShouldIgnoreEvent() const;
+
+
+ // override this if some events should never be consumed by wxWidgets but
+ // but have to be left for the native control
+ //
+ // base version just calls HandleWindowEvent()
+ virtual bool GTKProcessEvent(wxEvent& event) const;
+
+ // Map GTK widget direction of the given widget to/from wxLayoutDirection
+ static wxLayoutDirection GTKGetLayout(GtkWidget *widget);
+ static void GTKSetLayout(GtkWidget *widget, wxLayoutDirection dir);
+
+ // This is called when capture is taken from the window. It will
+ // fire off capture lost events.
+ void GTKReleaseMouseAndNotify();
+
+ GdkWindow* GTKGetDrawingWindow() const;
+
+ bool GTKHandleFocusIn();
+ bool GTKHandleFocusOut();
+ void GTKHandleFocusOutNoDeferring();
+ static void GTKHandleDeferredFocusOut();
+
+ // Called when m_widget becomes realized. Derived classes must call the
+ // base class method if they override it.
+ virtual void GTKHandleRealized();
+ void GTKHandleUnrealize();
+
+protected:
+ // for controls composed of multiple GTK widgets, return true to eliminate
+ // spurious focus events if the focus changes between GTK+ children within
+ // the same wxWindow
+ virtual bool GTKNeedsToFilterSameWindowFocus() const { return false; }
+
+ // Override GTKWidgetNeedsMnemonic and return true if your
+ // needs to set its mnemonic widget, such as for a
+ // GtkLabel for wxStaticText, then do the actual
+ // setting of the widget inside GTKWidgetDoSetMnemonic
+ virtual bool GTKWidgetNeedsMnemonic() const;
+ virtual void GTKWidgetDoSetMnemonic(GtkWidget* w);
+
+ // Get the GdkWindows making part of this window: usually there will be
+ // only one of them in which case it should be returned directly by this
+ // function. If there is more than one GdkWindow (can be the case for
+ // composite widgets), return NULL and fill in the provided array
+ //
+ // This is not pure virtual for backwards compatibility but almost
+ // certainly must be overridden in any wxControl-derived class!
+ virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+
+ // Check if the given window makes part of this widget
+ bool GTKIsOwnWindow(GdkWindow *window) const;
+
+public:
+ // Returns the default context which usually is anti-aliased
+ PangoContext *GTKGetPangoDefaultContext();
+
+#if wxUSE_TOOLTIPS
+ // applies tooltip to the widget (tip must be UTF-8 encoded)
+ virtual void GTKApplyToolTip(const char* tip);
+#endif // wxUSE_TOOLTIPS
+
+ // Called when a window should delay showing itself
+ // until idle time used in Reparent().
+ void GTKShowOnIdle() { m_showOnIdle = true; }
+
+ // This is called from the various OnInternalIdle methods
+ bool GTKShowFromOnIdle();
+
+ // is this window transparent for the mouse events (as wxStaticBox is)?
+ virtual bool GTKIsTransparentForMouse() const { return false; }
+
+ // Common scroll event handling code for wxWindow and wxScrollBar
+ wxEventType GTKGetScrollEventType(GtkRange* range);
+
+ // position and size of the window
+ int m_x, m_y;
+ int m_width, m_height;
+ int m_clientWidth, m_clientHeight;
+ // Whether the client size variables above are known to be correct
+ // (because they have been validated by a size-allocate) and should
+ // be used to report client size
+ bool m_useCachedClientSize;
+
+ // see the docs in src/gtk/window.cpp
+ GtkWidget *m_widget; // mostly the widget seen by the rest of GTK
+ GtkWidget *m_wxwindow; // mostly the client area as per wxWidgets
+
+ // label for use with GetLabelSetLabel
+ wxString m_gtkLabel;
+
+ // return true if the window is of a standard (i.e. not wxWidgets') class
+ bool IsOfStandardClass() const { return m_wxwindow == NULL; }
+
+ // this widget will be queried for GTK's focus events
+ GtkWidget *m_focusWidget;
+
+ void GTKDisableFocusOutEvent();
+ void GTKEnableFocusOutEvent();
+
+
+ // Input method support
+
+ // The IM context used for generic, i.e. non-native, windows.
+ //
+ // It might be a good idea to avoid allocating it unless key events from
+ // this window are really needed but currently we do it unconditionally.
+ //
+ // For native widgets (i.e. those for which IsOfStandardClass() returns
+ // true) it is NULL.
+ GtkIMContext* m_imContext;
+
+ // Pointer to the event being currently processed by the IME or NULL if not
+ // inside key handling.
+ GdkEventKey* m_imKeyEvent;
+
+ // This method generalizes gtk_im_context_filter_keypress(): for the
+ // generic windows it does just that but it's overridden by the classes
+ // wrapping native widgets that use IM themselves and so provide specific
+ // methods for accessing it such gtk_entry_im_context_filter_keypress().
+ virtual int GTKIMFilterKeypress(GdkEventKey* event) const;
+
+ // This method must be called from the derived classes "insert-text" signal
+ // handlers to check if the text is not being inserted by the IM and, if
+ // this is the case, generate appropriate wxEVT_CHAR events for it.
+ //
+ // Returns true if we did generate and process events corresponding to this
+ // text or false if we didn't handle it.
+ bool GTKOnInsertText(const char* text);
+
+ // This is just a helper of GTKOnInsertText() which is also used by GTK+
+ // "commit" signal handler.
+ bool GTKDoInsertTextFromIM(const char* text);
+
+
+ // indices for the arrays below
+ enum ScrollDir { ScrollDir_Horz, ScrollDir_Vert, ScrollDir_Max };
+
+ // horizontal/vertical scroll bar
+ GtkRange* m_scrollBar[ScrollDir_Max];
+
+ // horizontal/vertical scroll position
+ double m_scrollPos[ScrollDir_Max];
+
+ // return the scroll direction index corresponding to the given orientation
+ // (which is wxVERTICAL or wxHORIZONTAL)
+ static ScrollDir ScrollDirFromOrient(int orient)
+ {
+ return orient == wxVERTICAL ? ScrollDir_Vert : ScrollDir_Horz;
+ }
+
+ // return the orientation for the given scrolling direction
+ static int OrientFromScrollDir(ScrollDir dir)
+ {
+ return dir == ScrollDir_Horz ? wxHORIZONTAL : wxVERTICAL;
+ }
+
+ // find the direction of the given scrollbar (must be one of ours)
+ ScrollDir ScrollDirFromRange(GtkRange *range) const;
+
+ // set the current cursor for all GdkWindows making part of this widget
+ // (see GTKGetWindow)
+ void GTKUpdateCursor(bool update_self = true, bool recurse = true);
+
+ // extra (wxGTK-specific) flags
+ bool m_noExpose:1; // wxGLCanvas has its own redrawing
+ bool m_nativeSizeEvent:1; // wxGLCanvas sends wxSizeEvent upon "alloc_size"
+ bool m_isScrolling:1; // dragging scrollbar thumb?
+ bool m_clipPaintRegion:1; // true after ScrollWindow()
+ wxRegion m_nativeUpdateRegion; // not transformed for RTL
+ bool m_dirtyTabOrder:1; // tab order changed, GTK focus
+ // chain needs update
+ bool m_mouseButtonDown:1;
+
+ bool m_showOnIdle:1; // postpone showing the window until idle
+
+protected:
+ // implement the base class pure virtuals
+ virtual void DoGetTextExtent(const wxString& string,
+ int *x, int *y,
+ int *descent = NULL,
+ int *externalLeading = NULL,
+ const wxFont *font = NULL) const;
+ virtual void DoClientToScreen( int *x, int *y ) const;
+ virtual void DoScreenToClient( int *x, int *y ) const;
+ virtual void DoGetPosition( int *x, int *y ) const;
+ virtual void DoGetSize( int *width, int *height ) const;
+ virtual void DoGetClientSize( int *width, int *height ) const;
+ virtual void DoSetSize(int x, int y,
+ int width, int height,
+ int sizeFlags = wxSIZE_AUTO);
+ virtual void DoSetClientSize(int width, int height);
+ virtual wxSize DoGetBorderSize() const;
+ virtual void DoMoveWindow(int x, int y, int width, int height);
+ virtual void DoEnable(bool enable);
+
+#if wxUSE_MENUS_NATIVE
+ virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
+#endif // wxUSE_MENUS_NATIVE
+
+ virtual void DoCaptureMouse();
+ virtual void DoReleaseMouse();
+
+ virtual void DoFreeze();
+ virtual void DoThaw();
+
+ void GTKFreezeWidget(GtkWidget *w);
+ void GTKThawWidget(GtkWidget *w);
+ void GTKDisconnect(void* instance);
+
+#if wxUSE_TOOLTIPS
+ virtual void DoSetToolTip( wxToolTip *tip );
+#endif // wxUSE_TOOLTIPS
+
+ // Create a GtkScrolledWindow containing the given widget (usually
+ // m_wxwindow but not necessarily) and assigns it to m_widget. Also shows
+ // the widget passed to it.
+ //
+ // Can be only called if we have either wxHSCROLL or wxVSCROLL in our
+ // style.
+ void GTKCreateScrolledWindowWith(GtkWidget* view);
+
+ virtual void DoMoveInTabOrder(wxWindow *win, WindowOrder move);
+ virtual bool DoNavigateIn(int flags);
+
+
+ // Copies m_children tab order to GTK focus chain:
+ void RealizeTabOrder();
+
+#ifndef __WXGTK3__
+ // Called by ApplyWidgetStyle (which is called by SetFont() and
+ // SetXXXColour etc to apply style changed to native widgets) to create
+ // modified GTK style with non-standard attributes.
+ GtkRcStyle* GTKCreateWidgetStyle();
+#endif
+
+ void GTKApplyWidgetStyle(bool forceStyle = false);
+
+ // helper function to ease native widgets wrapping, called by
+ // ApplyWidgetStyle -- override this, not ApplyWidgetStyle
+ virtual void DoApplyWidgetStyle(GtkRcStyle *style);
+
+ void GTKApplyStyle(GtkWidget* widget, GtkRcStyle* style);
+
+ // sets the border of a given GtkScrolledWindow from a wx style
+ static void GTKScrolledWindowSetBorder(GtkWidget* w, int style);
+
+ // Connect the given function to the specified signal on m_widget.
+ //
+ // This is just a wrapper for g_signal_connect() and returns the handler id
+ // just as it does.
+ unsigned long GTKConnectWidget(const char *signal, wxGTKCallback callback);
+
+ void ConstrainSize();
+
+private:
+ void Init();
+
+ // return true if this window must have a non-NULL parent, false if it can
+ // be created without parent (normally only top level windows but in wxGTK
+ // there is also the exception of wxMenuBar)
+ virtual bool GTKNeedsParent() const { return !IsTopLevel(); }
+
+ enum ScrollUnit { ScrollUnit_Line, ScrollUnit_Page, ScrollUnit_Max };
+
+ // common part of ScrollLines() and ScrollPages() and could be used, in the
+ // future, for horizontal scrolling as well
+ //
+ // return true if we scrolled, false otherwise (on error or simply if we
+ // are already at the end)
+ bool DoScrollByUnits(ScrollDir dir, ScrollUnit unit, int units);
+ virtual void AddChildGTK(wxWindowGTK* child);
+
+#ifdef __WXGTK3__
+ // paint context is stashed here so wxPaintDC can use it
+ cairo_t* m_paintContext;
+ // style provider for "background-image"
+ GtkStyleProvider* m_styleProvider;
+
+public:
+ cairo_t* GTKPaintContext() const
+ {
+ return m_paintContext;
+ }
+#endif
+
+ DECLARE_DYNAMIC_CLASS(wxWindowGTK)
+ wxDECLARE_NO_COPY_CLASS(wxWindowGTK);
+};
+
+#endif // _WX_GTK_WINDOW_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/hash.h
+// Purpose: wxHashTable class
+// Author: Julian Smart
+// Modified by: VZ at 25.02.00: type safe hashes with WX_DECLARE_HASH()
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HASH_H__
+#define _WX_HASH_H__
+
+#include "wx/defs.h"
+#include "wx/string.h"
+
+#if !wxUSE_STD_CONTAINERS
+ #include "wx/object.h"
+#else
+ class WXDLLIMPEXP_FWD_BASE wxObject;
+#endif
+
+// the default size of the hash
+#define wxHASH_SIZE_DEFAULT (1000)
+
+/*
+ * A hash table is an array of user-definable size with lists
+ * of data items hanging off the array positions. Usually there'll
+ * be a hit, so no search is required; otherwise we'll have to run down
+ * the list to find the desired item.
+*/
+
+union wxHashKeyValue
+{
+ long integer;
+ wxString *string;
+};
+
+// for some compilers (AIX xlC), defining it as friend inside the class is not
+// enough, so provide a real forward declaration
+class WXDLLIMPEXP_FWD_BASE wxHashTableBase;
+
+class WXDLLIMPEXP_BASE wxHashTableBase_Node
+{
+ friend class WXDLLIMPEXP_FWD_BASE wxHashTableBase;
+ typedef class WXDLLIMPEXP_FWD_BASE wxHashTableBase_Node _Node;
+public:
+ wxHashTableBase_Node( long key, void* value,
+ wxHashTableBase* table );
+ wxHashTableBase_Node( const wxString& key, void* value,
+ wxHashTableBase* table );
+ ~wxHashTableBase_Node();
+
+ long GetKeyInteger() const { return m_key.integer; }
+ const wxString& GetKeyString() const { return *m_key.string; }
+
+ void* GetData() const { return m_value; }
+ void SetData( void* data ) { m_value = data; }
+
+protected:
+ _Node* GetNext() const { return m_next; }
+
+protected:
+ // next node in the chain
+ wxHashTableBase_Node* m_next;
+
+ // key
+ wxHashKeyValue m_key;
+
+ // value
+ void* m_value;
+
+ // pointer to the hash containing the node, used to remove the
+ // node from the hash when the user deletes the node iterating
+ // through it
+ // TODO: move it to wxHashTable_Node (only wxHashTable supports
+ // iteration)
+ wxHashTableBase* m_hashPtr;
+};
+
+class WXDLLIMPEXP_BASE wxHashTableBase
+#if !wxUSE_STD_CONTAINERS
+ : public wxObject
+#endif
+{
+ friend class WXDLLIMPEXP_FWD_BASE wxHashTableBase_Node;
+public:
+ typedef wxHashTableBase_Node Node;
+
+ wxHashTableBase();
+ virtual ~wxHashTableBase() { }
+
+ void Create( wxKeyType keyType = wxKEY_INTEGER,
+ size_t size = wxHASH_SIZE_DEFAULT );
+ void Clear();
+ void Destroy();
+
+ size_t GetSize() const { return m_size; }
+ size_t GetCount() const { return m_count; }
+
+ void DeleteContents( bool flag ) { m_deleteContents = flag; }
+
+ static long MakeKey(const wxString& string);
+
+protected:
+ void DoPut( long key, long hash, void* data );
+ void DoPut( const wxString& key, long hash, void* data );
+ void* DoGet( long key, long hash ) const;
+ void* DoGet( const wxString& key, long hash ) const;
+ void* DoDelete( long key, long hash );
+ void* DoDelete( const wxString& key, long hash );
+
+private:
+ // Remove the node from the hash, *only called from
+ // ~wxHashTable*_Node destructor
+ void DoRemoveNode( wxHashTableBase_Node* node );
+
+ // destroys data contained in the node if appropriate:
+ // deletes the key if it is a string and destrys
+ // the value if m_deleteContents is true
+ void DoDestroyNode( wxHashTableBase_Node* node );
+
+ // inserts a node in the table (at the end of the chain)
+ void DoInsertNode( size_t bucket, wxHashTableBase_Node* node );
+
+ // removes a node from the table (fiven a pointer to the previous
+ // but does not delete it (only deletes its contents)
+ void DoUnlinkNode( size_t bucket, wxHashTableBase_Node* node,
+ wxHashTableBase_Node* prev );
+
+ // unconditionally deletes node value (invoking the
+ // correct destructor)
+ virtual void DoDeleteContents( wxHashTableBase_Node* node ) = 0;
+
+protected:
+ // number of buckets
+ size_t m_size;
+
+ // number of nodes (key/value pairs)
+ size_t m_count;
+
+ // table
+ Node** m_table;
+
+ // key typ (INTEGER/STRING)
+ wxKeyType m_keyType;
+
+ // delete contents when hash is cleared
+ bool m_deleteContents;
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxHashTableBase);
+};
+
+// ----------------------------------------------------------------------------
+// for compatibility only
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxHashTable_Node : public wxHashTableBase_Node
+{
+ friend class WXDLLIMPEXP_FWD_BASE wxHashTable;
+public:
+ wxHashTable_Node( long key, void* value,
+ wxHashTableBase* table )
+ : wxHashTableBase_Node( key, value, table ) { }
+ wxHashTable_Node( const wxString& key, void* value,
+ wxHashTableBase* table )
+ : wxHashTableBase_Node( key, value, table ) { }
+
+ wxObject* GetData() const
+ { return (wxObject*)wxHashTableBase_Node::GetData(); }
+ void SetData( wxObject* data )
+ { wxHashTableBase_Node::SetData( data ); }
+
+ wxHashTable_Node* GetNext() const
+ { return (wxHashTable_Node*)wxHashTableBase_Node::GetNext(); }
+};
+
+// should inherit protectedly, but it is public for compatibility in
+// order to publicly inherit from wxObject
+class WXDLLIMPEXP_BASE wxHashTable : public wxHashTableBase
+{
+ typedef wxHashTableBase hash;
+public:
+ typedef wxHashTable_Node Node;
+ typedef wxHashTable_Node* compatibility_iterator;
+public:
+ wxHashTable( wxKeyType keyType = wxKEY_INTEGER,
+ size_t size = wxHASH_SIZE_DEFAULT )
+ : wxHashTableBase() { Create( keyType, size ); BeginFind(); }
+ wxHashTable( const wxHashTable& table );
+
+ virtual ~wxHashTable() { Destroy(); }
+
+ const wxHashTable& operator=( const wxHashTable& );
+
+ // key and value are the same
+ void Put(long value, wxObject *object)
+ { DoPut( value, value, object ); }
+ void Put(long lhash, long value, wxObject *object)
+ { DoPut( value, lhash, object ); }
+ void Put(const wxString& value, wxObject *object)
+ { DoPut( value, MakeKey( value ), object ); }
+ void Put(long lhash, const wxString& value, wxObject *object)
+ { DoPut( value, lhash, object ); }
+
+ // key and value are the same
+ wxObject *Get(long value) const
+ { return (wxObject*)DoGet( value, value ); }
+ wxObject *Get(long lhash, long value) const
+ { return (wxObject*)DoGet( value, lhash ); }
+ wxObject *Get(const wxString& value) const
+ { return (wxObject*)DoGet( value, MakeKey( value ) ); }
+ wxObject *Get(long lhash, const wxString& value) const
+ { return (wxObject*)DoGet( value, lhash ); }
+
+ // Deletes entry and returns data if found
+ wxObject *Delete(long key)
+ { return (wxObject*)DoDelete( key, key ); }
+ wxObject *Delete(long lhash, long key)
+ { return (wxObject*)DoDelete( key, lhash ); }
+ wxObject *Delete(const wxString& key)
+ { return (wxObject*)DoDelete( key, MakeKey( key ) ); }
+ wxObject *Delete(long lhash, const wxString& key)
+ { return (wxObject*)DoDelete( key, lhash ); }
+
+ // Way of iterating through whole hash table (e.g. to delete everything)
+ // Not necessary, of course, if you're only storing pointers to
+ // objects maintained separately
+ void BeginFind() { m_curr = NULL; m_currBucket = 0; }
+ Node* Next();
+
+ void Clear() { wxHashTableBase::Clear(); }
+
+ size_t GetCount() const { return wxHashTableBase::GetCount(); }
+protected:
+ // copy helper
+ void DoCopy( const wxHashTable& copy );
+
+ // searches the next node starting from bucket bucketStart and sets
+ // m_curr to it and m_currBucket to its bucket
+ void GetNextNode( size_t bucketStart );
+private:
+ virtual void DoDeleteContents( wxHashTableBase_Node* node );
+
+ // current node
+ Node* m_curr;
+
+ // bucket the current node belongs to
+ size_t m_currBucket;
+};
+
+// defines a new type safe hash table which stores the elements of type eltype
+// in lists of class listclass
+#define _WX_DECLARE_HASH(eltype, dummy, hashclass, classexp) \
+ classexp hashclass : public wxHashTableBase \
+ { \
+ public: \
+ hashclass(wxKeyType keyType = wxKEY_INTEGER, \
+ size_t size = wxHASH_SIZE_DEFAULT) \
+ : wxHashTableBase() { Create(keyType, size); } \
+ \
+ virtual ~hashclass() { Destroy(); } \
+ \
+ void Put(long key, eltype *data) { DoPut(key, key, (void*)data); } \
+ void Put(long lhash, long key, eltype *data) \
+ { DoPut(key, lhash, (void*)data); } \
+ eltype *Get(long key) const { return (eltype*)DoGet(key, key); } \
+ eltype *Get(long lhash, long key) const \
+ { return (eltype*)DoGet(key, lhash); } \
+ eltype *Delete(long key) { return (eltype*)DoDelete(key, key); } \
+ eltype *Delete(long lhash, long key) \
+ { return (eltype*)DoDelete(key, lhash); } \
+ private: \
+ virtual void DoDeleteContents( wxHashTableBase_Node* node ) \
+ { delete (eltype*)node->GetData(); } \
+ \
+ DECLARE_NO_COPY_CLASS(hashclass) \
+ }
+
+
+// this macro is to be used in the user code
+#define WX_DECLARE_HASH(el, list, hash) \
+ _WX_DECLARE_HASH(el, list, hash, class)
+
+// and this one does exactly the same thing but should be used inside the
+// library
+#define WX_DECLARE_EXPORTED_HASH(el, list, hash) \
+ _WX_DECLARE_HASH(el, list, hash, class WXDLLIMPEXP_CORE)
+
+#define WX_DECLARE_USER_EXPORTED_HASH(el, list, hash, usergoo) \
+ _WX_DECLARE_HASH(el, list, hash, class usergoo)
+
+// delete all hash elements
+//
+// NB: the class declaration of the hash elements must be visible from the
+// place where you use this macro, otherwise the proper destructor may not
+// be called (a decent compiler should give a warning about it, but don't
+// count on it)!
+#define WX_CLEAR_HASH_TABLE(hash) \
+ { \
+ (hash).BeginFind(); \
+ wxHashTable::compatibility_iterator it = (hash).Next(); \
+ while( it ) \
+ { \
+ delete it->GetData(); \
+ it = (hash).Next(); \
+ } \
+ (hash).Clear(); \
+ }
+
+#endif // _WX_HASH_H__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/hashmap.h
+// Purpose: wxHashMap class
+// Author: Mattia Barbon
+// Modified by:
+// Created: 29/01/2002
+// Copyright: (c) Mattia Barbon
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HASHMAP_H_
+#define _WX_HASHMAP_H_
+
+#include "wx/string.h"
+#include "wx/wxcrt.h"
+
+// In wxUSE_STD_CONTAINERS build we prefer to use the standard hash map class
+// but it can be either in non-standard hash_map header (old g++ and some other
+// STL implementations) or in C++0x standard unordered_map which can in turn be
+// available either in std::tr1 or std namespace itself
+//
+// To summarize: if std::unordered_map is available use it, otherwise use tr1
+// and finally fall back to non-standard hash_map
+
+#if (defined(HAVE_EXT_HASH_MAP) || defined(HAVE_HASH_MAP)) \
+ && (defined(HAVE_GNU_CXX_HASH_MAP) || defined(HAVE_STD_HASH_MAP))
+ #define HAVE_STL_HASH_MAP
+#endif
+
+#if wxUSE_STD_CONTAINERS && \
+ (defined(HAVE_STD_UNORDERED_MAP) || defined(HAVE_TR1_UNORDERED_MAP))
+
+#if defined(HAVE_STD_UNORDERED_MAP)
+ #include <unordered_map>
+ #define WX_HASH_MAP_NAMESPACE std
+#elif defined(HAVE_TR1_UNORDERED_MAP)
+ #include <tr1/unordered_map>
+ #define WX_HASH_MAP_NAMESPACE std::tr1
+#endif
+
+#define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \
+ typedef WX_HASH_MAP_NAMESPACE::unordered_map< KEY_T, VALUE_T, HASH_T, KEY_EQ_T > CLASSNAME
+
+#elif wxUSE_STD_CONTAINERS && defined(HAVE_STL_HASH_MAP)
+
+#if defined(HAVE_EXT_HASH_MAP)
+ #include <ext/hash_map>
+#elif defined(HAVE_HASH_MAP)
+ #include <hash_map>
+#endif
+
+#if defined(HAVE_GNU_CXX_HASH_MAP)
+ #define WX_HASH_MAP_NAMESPACE __gnu_cxx
+#elif defined(HAVE_STD_HASH_MAP)
+ #define WX_HASH_MAP_NAMESPACE std
+#endif
+
+#define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \
+ typedef WX_HASH_MAP_NAMESPACE::hash_map< KEY_T, VALUE_T, HASH_T, KEY_EQ_T > CLASSNAME
+
+#else // !wxUSE_STD_CONTAINERS || no std::{hash,unordered}_map class available
+
+#define wxNEEDS_WX_HASH_MAP
+
+#ifdef __WXWINCE__
+typedef int ptrdiff_t;
+#else
+#include <stddef.h> // for ptrdiff_t
+#endif
+
+// private
+struct WXDLLIMPEXP_BASE _wxHashTable_NodeBase
+{
+ _wxHashTable_NodeBase() : m_next(NULL) {}
+
+ _wxHashTable_NodeBase* m_next;
+
+// Cannot do this:
+// wxDECLARE_NO_COPY_CLASS(_wxHashTable_NodeBase);
+// without rewriting the macros, which require a public copy constructor.
+};
+
+// private
+class WXDLLIMPEXP_BASE _wxHashTableBase2
+{
+public:
+ typedef void (*NodeDtor)(_wxHashTable_NodeBase*);
+ typedef unsigned long (*BucketFromNode)(_wxHashTableBase2*,_wxHashTable_NodeBase*);
+ typedef _wxHashTable_NodeBase* (*ProcessNode)(_wxHashTable_NodeBase*);
+protected:
+ static _wxHashTable_NodeBase* DummyProcessNode(_wxHashTable_NodeBase* node);
+ static void DeleteNodes( size_t buckets, _wxHashTable_NodeBase** table,
+ NodeDtor dtor );
+ static _wxHashTable_NodeBase* GetFirstNode( size_t buckets,
+ _wxHashTable_NodeBase** table )
+ {
+ for( size_t i = 0; i < buckets; ++i )
+ if( table[i] )
+ return table[i];
+ return NULL;
+ }
+
+ // as static const unsigned prime_count = 31 but works with all compilers
+ enum { prime_count = 31 };
+ static const unsigned long ms_primes[prime_count];
+
+ // returns the first prime in ms_primes greater than n
+ static unsigned long GetNextPrime( unsigned long n );
+
+ // returns the first prime in ms_primes smaller than n
+ // ( or ms_primes[0] if n is very small )
+ static unsigned long GetPreviousPrime( unsigned long n );
+
+ static void CopyHashTable( _wxHashTable_NodeBase** srcTable,
+ size_t srcBuckets, _wxHashTableBase2* dst,
+ _wxHashTable_NodeBase** dstTable,
+ BucketFromNode func, ProcessNode proc );
+
+ static void** AllocTable( size_t sz )
+ {
+ return (void **)calloc(sz, sizeof(void*));
+ }
+ static void FreeTable(void *table)
+ {
+ free(table);
+ }
+};
+
+#define _WX_DECLARE_HASHTABLE( VALUE_T, KEY_T, HASH_T, KEY_EX_T, KEY_EQ_T,\
+ PTROPERATOR, CLASSNAME, CLASSEXP, \
+ SHOULD_GROW, SHOULD_SHRINK ) \
+CLASSEXP CLASSNAME : protected _wxHashTableBase2 \
+{ \
+public: \
+ typedef KEY_T key_type; \
+ typedef VALUE_T value_type; \
+ typedef HASH_T hasher; \
+ typedef KEY_EQ_T key_equal; \
+ \
+ typedef size_t size_type; \
+ typedef ptrdiff_t difference_type; \
+ typedef value_type* pointer; \
+ typedef const value_type* const_pointer; \
+ typedef value_type& reference; \
+ typedef const value_type& const_reference; \
+ /* should these be protected? */ \
+ typedef const KEY_T const_key_type; \
+ typedef const VALUE_T const_mapped_type; \
+public: \
+ typedef KEY_EX_T key_extractor; \
+ typedef CLASSNAME Self; \
+protected: \
+ _wxHashTable_NodeBase** m_table; \
+ size_t m_tableBuckets; \
+ size_t m_items; \
+ hasher m_hasher; \
+ key_equal m_equals; \
+ key_extractor m_getKey; \
+public: \
+ struct Node:public _wxHashTable_NodeBase \
+ { \
+ public: \
+ Node( const value_type& value ) \
+ : m_value( value ) {} \
+ Node* next() { return static_cast<Node*>(m_next); } \
+ \
+ value_type m_value; \
+ }; \
+ \
+protected: \
+ static void DeleteNode( _wxHashTable_NodeBase* node ) \
+ { \
+ delete static_cast<Node*>(node); \
+ } \
+public: \
+ /* */ \
+ /* forward iterator */ \
+ /* */ \
+ CLASSEXP Iterator \
+ { \
+ public: \
+ Node* m_node; \
+ Self* m_ht; \
+ \
+ Iterator() : m_node(NULL), m_ht(NULL) {} \
+ Iterator( Node* node, const Self* ht ) \
+ : m_node(node), m_ht(const_cast<Self*>(ht)) {} \
+ bool operator ==( const Iterator& it ) const \
+ { return m_node == it.m_node; } \
+ bool operator !=( const Iterator& it ) const \
+ { return m_node != it.m_node; } \
+ protected: \
+ Node* GetNextNode() \
+ { \
+ size_type bucket = GetBucketForNode(m_ht,m_node); \
+ for( size_type i = bucket + 1; i < m_ht->m_tableBuckets; ++i ) \
+ { \
+ if( m_ht->m_table[i] ) \
+ return static_cast<Node*>(m_ht->m_table[i]); \
+ } \
+ return NULL; \
+ } \
+ \
+ void PlusPlus() \
+ { \
+ Node* next = m_node->next(); \
+ m_node = next ? next : GetNextNode(); \
+ } \
+ }; \
+ friend class Iterator; \
+ \
+public: \
+ CLASSEXP iterator : public Iterator \
+ { \
+ public: \
+ iterator() : Iterator() {} \
+ iterator( Node* node, Self* ht ) : Iterator( node, ht ) {} \
+ iterator& operator++() { PlusPlus(); return *this; } \
+ iterator operator++(int) { iterator it=*this;PlusPlus();return it; } \
+ reference operator *() const { return m_node->m_value; } \
+ PTROPERATOR(pointer) \
+ }; \
+ \
+ CLASSEXP const_iterator : public Iterator \
+ { \
+ public: \
+ const_iterator() : Iterator() {} \
+ const_iterator(iterator i) : Iterator(i) {} \
+ const_iterator( Node* node, const Self* ht ) \
+ : Iterator(node, const_cast<Self*>(ht)) {} \
+ const_iterator& operator++() { PlusPlus();return *this; } \
+ const_iterator operator++(int) { const_iterator it=*this;PlusPlus();return it; } \
+ const_reference operator *() const { return m_node->m_value; } \
+ PTROPERATOR(const_pointer) \
+ }; \
+ \
+ CLASSNAME( size_type sz = 10, const hasher& hfun = hasher(), \
+ const key_equal& k_eq = key_equal(), \
+ const key_extractor& k_ex = key_extractor() ) \
+ : m_tableBuckets( GetNextPrime( (unsigned long) sz ) ), \
+ m_items( 0 ), \
+ m_hasher( hfun ), \
+ m_equals( k_eq ), \
+ m_getKey( k_ex ) \
+ { \
+ m_table = (_wxHashTable_NodeBase**)AllocTable(m_tableBuckets); \
+ } \
+ \
+ CLASSNAME( const Self& ht ) \
+ : m_table(NULL), \
+ m_tableBuckets( 0 ), \
+ m_items( ht.m_items ), \
+ m_hasher( ht.m_hasher ), \
+ m_equals( ht.m_equals ), \
+ m_getKey( ht.m_getKey ) \
+ { \
+ HashCopy( ht ); \
+ } \
+ \
+ const Self& operator=( const Self& ht ) \
+ { \
+ if (&ht != this) \
+ { \
+ clear(); \
+ m_hasher = ht.m_hasher; \
+ m_equals = ht.m_equals; \
+ m_getKey = ht.m_getKey; \
+ m_items = ht.m_items; \
+ HashCopy( ht ); \
+ } \
+ return *this; \
+ } \
+ \
+ ~CLASSNAME() \
+ { \
+ clear(); \
+ \
+ FreeTable(m_table); \
+ } \
+ \
+ hasher hash_funct() { return m_hasher; } \
+ key_equal key_eq() { return m_equals; } \
+ \
+ /* removes all elements from the hash table, but does not */ \
+ /* shrink it ( perhaps it should ) */ \
+ void clear() \
+ { \
+ DeleteNodes(m_tableBuckets, m_table, DeleteNode); \
+ m_items = 0; \
+ } \
+ \
+ size_type size() const { return m_items; } \
+ size_type max_size() const { return size_type(-1); } \
+ bool empty() const { return size() == 0; } \
+ \
+ const_iterator end() const { return const_iterator(NULL, this); } \
+ iterator end() { return iterator(NULL, this); } \
+ const_iterator begin() const \
+ { return const_iterator(static_cast<Node*>(GetFirstNode(m_tableBuckets, m_table)), this); } \
+ iterator begin() \
+ { return iterator(static_cast<Node*>(GetFirstNode(m_tableBuckets, m_table)), this); } \
+ \
+ size_type erase( const const_key_type& key ) \
+ { \
+ _wxHashTable_NodeBase** node = GetNodePtr(key); \
+ \
+ if( !node ) \
+ return 0; \
+ \
+ --m_items; \
+ _wxHashTable_NodeBase* temp = (*node)->m_next; \
+ delete static_cast<Node*>(*node); \
+ (*node) = temp; \
+ if( SHOULD_SHRINK( m_tableBuckets, m_items ) ) \
+ ResizeTable( GetPreviousPrime( (unsigned long) m_tableBuckets ) - 1 ); \
+ return 1; \
+ } \
+ \
+protected: \
+ static size_type GetBucketForNode( Self* ht, Node* node ) \
+ { \
+ return ht->m_hasher( ht->m_getKey( node->m_value ) ) \
+ % ht->m_tableBuckets; \
+ } \
+ static Node* CopyNode( Node* node ) { return new Node( *node ); } \
+ \
+ Node* GetOrCreateNode( const value_type& value, bool& created ) \
+ { \
+ const const_key_type& key = m_getKey( value ); \
+ size_t bucket = m_hasher( key ) % m_tableBuckets; \
+ Node* node = static_cast<Node*>(m_table[bucket]); \
+ \
+ while( node ) \
+ { \
+ if( m_equals( m_getKey( node->m_value ), key ) ) \
+ { \
+ created = false; \
+ return node; \
+ } \
+ node = node->next(); \
+ } \
+ created = true; \
+ return CreateNode( value, bucket); \
+ }\
+ Node * CreateNode( const value_type& value, size_t bucket ) \
+ {\
+ Node* node = new Node( value ); \
+ node->m_next = m_table[bucket]; \
+ m_table[bucket] = node; \
+ \
+ /* must be after the node is inserted */ \
+ ++m_items; \
+ if( SHOULD_GROW( m_tableBuckets, m_items ) ) \
+ ResizeTable( m_tableBuckets ); \
+ \
+ return node; \
+ } \
+ void CreateNode( const value_type& value ) \
+ {\
+ CreateNode(value, m_hasher( m_getKey(value) ) % m_tableBuckets ); \
+ }\
+ \
+ /* returns NULL if not found */ \
+ _wxHashTable_NodeBase** GetNodePtr(const const_key_type& key) const \
+ { \
+ size_t bucket = m_hasher( key ) % m_tableBuckets; \
+ _wxHashTable_NodeBase** node = &m_table[bucket]; \
+ \
+ while( *node ) \
+ { \
+ if (m_equals(m_getKey(static_cast<Node*>(*node)->m_value), key)) \
+ return node; \
+ node = &(*node)->m_next; \
+ } \
+ \
+ return NULL; \
+ } \
+ \
+ /* returns NULL if not found */ \
+ /* expressing it in terms of GetNodePtr is 5-8% slower :-( */ \
+ Node* GetNode( const const_key_type& key ) const \
+ { \
+ size_t bucket = m_hasher( key ) % m_tableBuckets; \
+ Node* node = static_cast<Node*>(m_table[bucket]); \
+ \
+ while( node ) \
+ { \
+ if( m_equals( m_getKey( node->m_value ), key ) ) \
+ return node; \
+ node = node->next(); \
+ } \
+ \
+ return NULL; \
+ } \
+ \
+ void ResizeTable( size_t newSize ) \
+ { \
+ newSize = GetNextPrime( (unsigned long)newSize ); \
+ _wxHashTable_NodeBase** srcTable = m_table; \
+ size_t srcBuckets = m_tableBuckets; \
+ m_table = (_wxHashTable_NodeBase**)AllocTable( newSize ); \
+ m_tableBuckets = newSize; \
+ \
+ CopyHashTable( srcTable, srcBuckets, \
+ this, m_table, \
+ (BucketFromNode)GetBucketForNode,\
+ (ProcessNode)&DummyProcessNode ); \
+ FreeTable(srcTable); \
+ } \
+ \
+ /* this must be called _after_ m_table has been cleaned */ \
+ void HashCopy( const Self& ht ) \
+ { \
+ ResizeTable( ht.size() ); \
+ CopyHashTable( ht.m_table, ht.m_tableBuckets, \
+ (_wxHashTableBase2*)this, \
+ m_table, \
+ (BucketFromNode)GetBucketForNode, \
+ (ProcessNode)CopyNode ); \
+ } \
+};
+
+// defines an STL-like pair class CLASSNAME storing two fields: first of type
+// KEY_T and second of type VALUE_T
+#define _WX_DECLARE_PAIR( KEY_T, VALUE_T, CLASSNAME, CLASSEXP ) \
+CLASSEXP CLASSNAME \
+{ \
+public: \
+ typedef KEY_T first_type; \
+ typedef VALUE_T second_type; \
+ typedef KEY_T t1; \
+ typedef VALUE_T t2; \
+ typedef const KEY_T const_t1; \
+ typedef const VALUE_T const_t2; \
+ \
+ CLASSNAME(const const_t1& f, const const_t2& s) \
+ : first(const_cast<t1&>(f)), second(const_cast<t2&>(s)) {} \
+ \
+ t1 first; \
+ t2 second; \
+};
+
+// defines the class CLASSNAME returning the key part (of type KEY_T) from a
+// pair of type PAIR_T
+#define _WX_DECLARE_HASH_MAP_KEY_EX( KEY_T, PAIR_T, CLASSNAME, CLASSEXP ) \
+CLASSEXP CLASSNAME \
+{ \
+ typedef KEY_T key_type; \
+ typedef PAIR_T pair_type; \
+ typedef const key_type const_key_type; \
+ typedef const pair_type const_pair_type; \
+ typedef const_key_type& const_key_reference; \
+ typedef const_pair_type& const_pair_reference; \
+public: \
+ CLASSNAME() { } \
+ const_key_reference operator()( const_pair_reference pair ) const { return pair.first; }\
+ \
+ /* the dummy assignment operator is needed to suppress compiler */ \
+ /* warnings from hash table class' operator=(): gcc complains about */ \
+ /* "statement with no effect" without it */ \
+ CLASSNAME& operator=(const CLASSNAME&) { return *this; } \
+};
+
+// grow/shrink predicates
+inline bool never_grow( size_t, size_t ) { return false; }
+inline bool never_shrink( size_t, size_t ) { return false; }
+inline bool grow_lf70( size_t buckets, size_t items )
+{
+ return float(items)/float(buckets) >= 0.85f;
+}
+
+#endif // various hash map implementations
+
+// ----------------------------------------------------------------------------
+// hashing and comparison functors
+// ----------------------------------------------------------------------------
+
+// NB: implementation detail: all of these classes must have dummy assignment
+// operators to suppress warnings about "statement with no effect" from gcc
+// in the hash table class assignment operator (where they're assigned)
+
+#ifndef wxNEEDS_WX_HASH_MAP
+
+// integer types
+struct WXDLLIMPEXP_BASE wxIntegerHash
+{
+private:
+ WX_HASH_MAP_NAMESPACE::hash<long> longHash;
+ WX_HASH_MAP_NAMESPACE::hash<unsigned long> ulongHash;
+ WX_HASH_MAP_NAMESPACE::hash<int> intHash;
+ WX_HASH_MAP_NAMESPACE::hash<unsigned int> uintHash;
+ WX_HASH_MAP_NAMESPACE::hash<short> shortHash;
+ WX_HASH_MAP_NAMESPACE::hash<unsigned short> ushortHash;
+
+#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
+ // hash<wxLongLong_t> ought to work but doesn't on some compilers
+ #if (!defined SIZEOF_LONG_LONG && SIZEOF_LONG == 4) \
+ || (defined SIZEOF_LONG_LONG && SIZEOF_LONG_LONG == SIZEOF_LONG * 2)
+ size_t longlongHash( wxLongLong_t x ) const
+ {
+ return longHash( wx_truncate_cast(long, x) ) ^
+ longHash( wx_truncate_cast(long, x >> (sizeof(long) * 8)) );
+ }
+ #elif defined SIZEOF_LONG_LONG && SIZEOF_LONG_LONG == SIZEOF_LONG
+ WX_HASH_MAP_NAMESPACE::hash<long> longlongHash;
+ #else
+ WX_HASH_MAP_NAMESPACE::hash<wxLongLong_t> longlongHash;
+ #endif
+#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
+
+public:
+ wxIntegerHash() { }
+ size_t operator()( long x ) const { return longHash( x ); }
+ size_t operator()( unsigned long x ) const { return ulongHash( x ); }
+ size_t operator()( int x ) const { return intHash( x ); }
+ size_t operator()( unsigned int x ) const { return uintHash( x ); }
+ size_t operator()( short x ) const { return shortHash( x ); }
+ size_t operator()( unsigned short x ) const { return ushortHash( x ); }
+#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
+ size_t operator()( wxLongLong_t x ) const { return longlongHash(x); }
+ size_t operator()( wxULongLong_t x ) const { return longlongHash(x); }
+#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
+
+ wxIntegerHash& operator=(const wxIntegerHash&) { return *this; }
+};
+
+#else // wxNEEDS_WX_HASH_MAP
+
+// integer types
+struct WXDLLIMPEXP_BASE wxIntegerHash
+{
+ wxIntegerHash() { }
+ unsigned long operator()( long x ) const { return (unsigned long)x; }
+ unsigned long operator()( unsigned long x ) const { return x; }
+ unsigned long operator()( int x ) const { return (unsigned long)x; }
+ unsigned long operator()( unsigned int x ) const { return x; }
+ unsigned long operator()( short x ) const { return (unsigned long)x; }
+ unsigned long operator()( unsigned short x ) const { return x; }
+#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
+ wxULongLong_t operator()( wxLongLong_t x ) const { return static_cast<wxULongLong_t>(x); }
+ wxULongLong_t operator()( wxULongLong_t x ) const { return x; }
+#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
+
+ wxIntegerHash& operator=(const wxIntegerHash&) { return *this; }
+};
+
+#endif // !wxNEEDS_WX_HASH_MAP/wxNEEDS_WX_HASH_MAP
+
+struct WXDLLIMPEXP_BASE wxIntegerEqual
+{
+ wxIntegerEqual() { }
+ bool operator()( long a, long b ) const { return a == b; }
+ bool operator()( unsigned long a, unsigned long b ) const { return a == b; }
+ bool operator()( int a, int b ) const { return a == b; }
+ bool operator()( unsigned int a, unsigned int b ) const { return a == b; }
+ bool operator()( short a, short b ) const { return a == b; }
+ bool operator()( unsigned short a, unsigned short b ) const { return a == b; }
+#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
+ bool operator()( wxLongLong_t a, wxLongLong_t b ) const { return a == b; }
+ bool operator()( wxULongLong_t a, wxULongLong_t b ) const { return a == b; }
+#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
+
+ wxIntegerEqual& operator=(const wxIntegerEqual&) { return *this; }
+};
+
+// pointers
+struct WXDLLIMPEXP_BASE wxPointerHash
+{
+ wxPointerHash() { }
+
+#ifdef wxNEEDS_WX_HASH_MAP
+ wxUIntPtr operator()( const void* k ) const { return wxPtrToUInt(k); }
+#else
+ size_t operator()( const void* k ) const { return (size_t)k; }
+#endif
+
+ wxPointerHash& operator=(const wxPointerHash&) { return *this; }
+};
+
+struct WXDLLIMPEXP_BASE wxPointerEqual
+{
+ wxPointerEqual() { }
+ bool operator()( const void* a, const void* b ) const { return a == b; }
+
+ wxPointerEqual& operator=(const wxPointerEqual&) { return *this; }
+};
+
+// wxString, char*, wchar_t*
+struct WXDLLIMPEXP_BASE wxStringHash
+{
+ wxStringHash() {}
+ unsigned long operator()( const wxString& x ) const
+ { return stringHash( x.wx_str() ); }
+ unsigned long operator()( const wchar_t* x ) const
+ { return stringHash( x ); }
+ unsigned long operator()( const char* x ) const
+ { return stringHash( x ); }
+
+#if WXWIN_COMPATIBILITY_2_8
+ static unsigned long wxCharStringHash( const wxChar* x )
+ { return stringHash(x); }
+ #if wxUSE_UNICODE
+ static unsigned long charStringHash( const char* x )
+ { return stringHash(x); }
+ #endif
+#endif // WXWIN_COMPATIBILITY_2_8
+
+ static unsigned long stringHash( const wchar_t* );
+ static unsigned long stringHash( const char* );
+
+ wxStringHash& operator=(const wxStringHash&) { return *this; }
+};
+
+struct WXDLLIMPEXP_BASE wxStringEqual
+{
+ wxStringEqual() {}
+ bool operator()( const wxString& a, const wxString& b ) const
+ { return a == b; }
+ bool operator()( const wxChar* a, const wxChar* b ) const
+ { return wxStrcmp( a, b ) == 0; }
+#if wxUSE_UNICODE
+ bool operator()( const char* a, const char* b ) const
+ { return strcmp( a, b ) == 0; }
+#endif // wxUSE_UNICODE
+
+ wxStringEqual& operator=(const wxStringEqual&) { return *this; }
+};
+
+#ifdef wxNEEDS_WX_HASH_MAP
+
+#define wxPTROP_NORMAL(pointer) \
+ pointer operator ->() const { return &(m_node->m_value); }
+#define wxPTROP_NOP(pointer)
+
+#define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \
+_WX_DECLARE_PAIR( KEY_T, VALUE_T, CLASSNAME##_wxImplementation_Pair, CLASSEXP ) \
+_WX_DECLARE_HASH_MAP_KEY_EX( KEY_T, CLASSNAME##_wxImplementation_Pair, CLASSNAME##_wxImplementation_KeyEx, CLASSEXP ) \
+_WX_DECLARE_HASHTABLE( CLASSNAME##_wxImplementation_Pair, KEY_T, HASH_T, \
+ CLASSNAME##_wxImplementation_KeyEx, KEY_EQ_T, wxPTROP_NORMAL, \
+ CLASSNAME##_wxImplementation_HashTable, CLASSEXP, grow_lf70, never_shrink ) \
+CLASSEXP CLASSNAME:public CLASSNAME##_wxImplementation_HashTable \
+{ \
+public: \
+ typedef VALUE_T mapped_type; \
+ _WX_DECLARE_PAIR( iterator, bool, Insert_Result, CLASSEXP ) \
+ \
+ wxEXPLICIT CLASSNAME( size_type hint = 100, hasher hf = hasher(), \
+ key_equal eq = key_equal() ) \
+ : CLASSNAME##_wxImplementation_HashTable( hint, hf, eq, \
+ CLASSNAME##_wxImplementation_KeyEx() ) {} \
+ \
+ mapped_type& operator[]( const const_key_type& key ) \
+ { \
+ bool created; \
+ return GetOrCreateNode( \
+ CLASSNAME##_wxImplementation_Pair( key, mapped_type() ), \
+ created)->m_value.second; \
+ } \
+ \
+ const_iterator find( const const_key_type& key ) const \
+ { \
+ return const_iterator( GetNode( key ), this ); \
+ } \
+ \
+ iterator find( const const_key_type& key ) \
+ { \
+ return iterator( GetNode( key ), this ); \
+ } \
+ \
+ Insert_Result insert( const value_type& v ) \
+ { \
+ bool created; \
+ Node *node = GetOrCreateNode( \
+ CLASSNAME##_wxImplementation_Pair( v.first, v.second ), \
+ created); \
+ return Insert_Result(iterator(node, this), created); \
+ } \
+ \
+ size_type erase( const key_type& k ) \
+ { return CLASSNAME##_wxImplementation_HashTable::erase( k ); } \
+ void erase( const iterator& it ) { erase( (*it).first ); } \
+ \
+ /* count() == 0 | 1 */ \
+ size_type count( const const_key_type& key ) \
+ { \
+ return GetNode( key ) ? 1u : 0u; \
+ } \
+}
+
+#endif // wxNEEDS_WX_HASH_MAP
+
+// these macros are to be used in the user code
+#define WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME) \
+ _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, class )
+
+#define WX_DECLARE_STRING_HASH_MAP( VALUE_T, CLASSNAME ) \
+ _WX_DECLARE_HASH_MAP( wxString, VALUE_T, wxStringHash, wxStringEqual, \
+ CLASSNAME, class )
+
+#define WX_DECLARE_VOIDPTR_HASH_MAP( VALUE_T, CLASSNAME ) \
+ _WX_DECLARE_HASH_MAP( void*, VALUE_T, wxPointerHash, wxPointerEqual, \
+ CLASSNAME, class )
+
+// and these do exactly the same thing but should be used inside the
+// library
+#define WX_DECLARE_HASH_MAP_WITH_DECL( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \
+ _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL )
+
+#define WX_DECLARE_EXPORTED_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME) \
+ WX_DECLARE_HASH_MAP_WITH_DECL( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, \
+ CLASSNAME, class WXDLLIMPEXP_CORE )
+
+#define WX_DECLARE_STRING_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, DECL ) \
+ _WX_DECLARE_HASH_MAP( wxString, VALUE_T, wxStringHash, wxStringEqual, \
+ CLASSNAME, DECL )
+
+#define WX_DECLARE_EXPORTED_STRING_HASH_MAP( VALUE_T, CLASSNAME ) \
+ WX_DECLARE_STRING_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, \
+ class WXDLLIMPEXP_CORE )
+
+#define WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, DECL ) \
+ _WX_DECLARE_HASH_MAP( void*, VALUE_T, wxPointerHash, wxPointerEqual, \
+ CLASSNAME, DECL )
+
+#define WX_DECLARE_EXPORTED_VOIDPTR_HASH_MAP( VALUE_T, CLASSNAME ) \
+ WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, \
+ class WXDLLIMPEXP_CORE )
+
+// delete all hash elements
+//
+// NB: the class declaration of the hash elements must be visible from the
+// place where you use this macro, otherwise the proper destructor may not
+// be called (a decent compiler should give a warning about it, but don't
+// count on it)!
+#define WX_CLEAR_HASH_MAP(type, hashmap) \
+ { \
+ type::iterator it, en; \
+ for( it = (hashmap).begin(), en = (hashmap).end(); it != en; ++it ) \
+ delete it->second; \
+ (hashmap).clear(); \
+ }
+
+//---------------------------------------------------------------------------
+// Declarations of common hashmap classes
+
+WX_DECLARE_HASH_MAP_WITH_DECL( long, long, wxIntegerHash, wxIntegerEqual,
+ wxLongToLongHashMap, class WXDLLIMPEXP_BASE );
+
+WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxString, wxStringToStringHashMap,
+ class WXDLLIMPEXP_BASE );
+
+WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxUIntPtr, wxStringToNumHashMap,
+ class WXDLLIMPEXP_BASE );
+
+
+#endif // _WX_HASHMAP_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/hashset.h
+// Purpose: wxHashSet class
+// Author: Mattia Barbon
+// Modified by:
+// Created: 11/08/2003
+// Copyright: (c) Mattia Barbon
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HASHSET_H_
+#define _WX_HASHSET_H_
+
+#include "wx/hashmap.h"
+
+// see comment in wx/hashmap.h which also applies to different standard hash
+// set classes
+
+#if wxUSE_STD_CONTAINERS && \
+ (defined(HAVE_STD_UNORDERED_SET) || defined(HAVE_TR1_UNORDERED_SET))
+
+#if defined(HAVE_STD_UNORDERED_SET)
+ #include <unordered_set>
+ #define WX_HASH_SET_BASE_TEMPLATE std::unordered_set
+#elif defined(HAVE_TR1_UNORDERED_SET)
+ #include <tr1/unordered_set>
+ #define WX_HASH_SET_BASE_TEMPLATE std::tr1::unordered_set
+#else
+ #error Update this code: unordered_set is available, but I do not know where.
+#endif
+
+#elif wxUSE_STD_CONTAINERS && defined(HAVE_STL_HASH_MAP)
+
+#if defined(HAVE_EXT_HASH_MAP)
+ #include <ext/hash_set>
+#elif defined(HAVE_HASH_MAP)
+ #include <hash_set>
+#endif
+
+#define WX_HASH_SET_BASE_TEMPLATE WX_HASH_MAP_NAMESPACE::hash_set
+
+#endif // different hash_set/unordered_set possibilities
+
+#ifdef WX_HASH_SET_BASE_TEMPLATE
+
+// we need to define the class declared by _WX_DECLARE_HASH_SET as a class and
+// not a typedef to allow forward declaring it
+#define _WX_DECLARE_HASH_SET_IMPL( KEY_T, HASH_T, KEY_EQ_T, PTROP, CLASSNAME, CLASSEXP ) \
+CLASSEXP CLASSNAME \
+ : public WX_HASH_SET_BASE_TEMPLATE< KEY_T, HASH_T, KEY_EQ_T > \
+{ \
+public: \
+ explicit CLASSNAME(size_type n = 3, \
+ const hasher& h = hasher(), \
+ const key_equal& ke = key_equal(), \
+ const allocator_type& a = allocator_type()) \
+ : WX_HASH_SET_BASE_TEMPLATE< KEY_T, HASH_T, KEY_EQ_T >(n, h, ke, a) \
+ {} \
+ template <class InputIterator> \
+ CLASSNAME(InputIterator f, InputIterator l, \
+ const hasher& h = hasher(), \
+ const key_equal& ke = key_equal(), \
+ const allocator_type& a = allocator_type()) \
+ : WX_HASH_SET_BASE_TEMPLATE< KEY_T, HASH_T, KEY_EQ_T >(f, l, h, ke, a)\
+ {} \
+ CLASSNAME(const WX_HASH_SET_BASE_TEMPLATE< KEY_T, HASH_T, KEY_EQ_T >& s) \
+ : WX_HASH_SET_BASE_TEMPLATE< KEY_T, HASH_T, KEY_EQ_T >(s) \
+ {} \
+}
+
+// In some standard library implementations (in particular, the libstdc++ that
+// ships with g++ 4.7), std::unordered_set inherits privately from its hasher
+// and comparator template arguments for purposes of empty base optimization.
+// As a result, in the declaration of a class deriving from std::unordered_set
+// the names of the hasher and comparator classes are interpreted as naming
+// the base class which is inaccessible.
+// The workaround is to prefix the class names with 'struct'; however, don't
+// do this on MSVC because it causes a warning there if the class was
+// declared as a 'class' rather than a 'struct' (and MSVC's std::unordered_set
+// implementation does not suffer from the access problem).
+#ifdef _MSC_VER
+#define WX_MAYBE_PREFIX_WITH_STRUCT(STRUCTNAME) STRUCTNAME
+#else
+#define WX_MAYBE_PREFIX_WITH_STRUCT(STRUCTNAME) struct STRUCTNAME
+#endif
+
+#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, PTROP, CLASSNAME, CLASSEXP ) \
+ _WX_DECLARE_HASH_SET_IMPL( \
+ KEY_T, \
+ WX_MAYBE_PREFIX_WITH_STRUCT(HASH_T), \
+ WX_MAYBE_PREFIX_WITH_STRUCT(KEY_EQ_T), \
+ PTROP, \
+ CLASSNAME, \
+ CLASSEXP)
+
+#else // no appropriate STL class, use our own implementation
+
+// this is a complex way of defining an easily inlineable identity function...
+#define _WX_DECLARE_HASH_SET_KEY_EX( KEY_T, CLASSNAME, CLASSEXP ) \
+CLASSEXP CLASSNAME \
+{ \
+ typedef KEY_T key_type; \
+ typedef const key_type const_key_type; \
+ typedef const_key_type& const_key_reference; \
+public: \
+ CLASSNAME() { } \
+ const_key_reference operator()( const_key_reference key ) const \
+ { return key; } \
+ \
+ /* the dummy assignment operator is needed to suppress compiler */ \
+ /* warnings from hash table class' operator=(): gcc complains about */ \
+ /* "statement with no effect" without it */ \
+ CLASSNAME& operator=(const CLASSNAME&) { return *this; } \
+};
+
+#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, PTROP, CLASSNAME, CLASSEXP )\
+_WX_DECLARE_HASH_SET_KEY_EX( KEY_T, CLASSNAME##_wxImplementation_KeyEx, CLASSEXP ) \
+_WX_DECLARE_HASHTABLE( KEY_T, KEY_T, HASH_T, \
+ CLASSNAME##_wxImplementation_KeyEx, KEY_EQ_T, PTROP, \
+ CLASSNAME##_wxImplementation_HashTable, CLASSEXP, grow_lf70, never_shrink ) \
+CLASSEXP CLASSNAME:public CLASSNAME##_wxImplementation_HashTable \
+{ \
+public: \
+ _WX_DECLARE_PAIR( iterator, bool, Insert_Result, CLASSEXP ) \
+ \
+ wxEXPLICIT CLASSNAME( size_type hint = 100, hasher hf = hasher(), \
+ key_equal eq = key_equal() ) \
+ : CLASSNAME##_wxImplementation_HashTable( hint, hf, eq, \
+ CLASSNAME##_wxImplementation_KeyEx() ) {} \
+ \
+ Insert_Result insert( const key_type& key ) \
+ { \
+ bool created; \
+ Node *node = GetOrCreateNode( key, created ); \
+ return Insert_Result( iterator( node, this ), created ); \
+ } \
+ \
+ const_iterator find( const const_key_type& key ) const \
+ { \
+ return const_iterator( GetNode( key ), this ); \
+ } \
+ \
+ iterator find( const const_key_type& key ) \
+ { \
+ return iterator( GetNode( key ), this ); \
+ } \
+ \
+ size_type erase( const key_type& k ) \
+ { return CLASSNAME##_wxImplementation_HashTable::erase( k ); } \
+ void erase( const iterator& it ) { erase( *it ); } \
+ void erase( const const_iterator& it ) { erase( *it ); } \
+ \
+ /* count() == 0 | 1 */ \
+ size_type count( const const_key_type& key ) const \
+ { return GetNode( key ) ? 1 : 0; } \
+}
+
+#endif // STL/wx implementations
+
+
+// these macros are to be used in the user code
+#define WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \
+ _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NORMAL, CLASSNAME, class )
+
+// and these do exactly the same thing but should be used inside the
+// library
+#define WX_DECLARE_HASH_SET_WITH_DECL( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \
+ _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NORMAL, CLASSNAME, DECL )
+
+#define WX_DECLARE_EXPORTED_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \
+ WX_DECLARE_HASH_SET_WITH_DECL( KEY_T, HASH_T, KEY_EQ_T, \
+ CLASSNAME, class WXDLLIMPEXP_CORE )
+
+// Finally these versions allow to define hash sets of non-objects (including
+// pointers, hence the confusing but wxArray-compatible name) without
+// operator->() which can't be used for them. This is mostly used inside the
+// library itself to avoid warnings when using such hash sets with some less
+// common compilers (notably Sun CC).
+#define WX_DECLARE_HASH_SET_PTR( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \
+ _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NOP, CLASSNAME, class )
+#define WX_DECLARE_HASH_SET_WITH_DECL_PTR( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \
+ _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NOP, CLASSNAME, DECL )
+
+// delete all hash elements
+//
+// NB: the class declaration of the hash elements must be visible from the
+// place where you use this macro, otherwise the proper destructor may not
+// be called (a decent compiler should give a warning about it, but don't
+// count on it)!
+#define WX_CLEAR_HASH_SET(type, hashset) \
+ { \
+ type::iterator it, en; \
+ for( it = (hashset).begin(), en = (hashset).end(); it != en; ++it ) \
+ delete *it; \
+ (hashset).clear(); \
+ }
+
+#endif // _WX_HASHSET_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/headercol.h
+// Purpose: declaration of wxHeaderColumn class
+// Author: Vadim Zeitlin
+// Created: 2008-12-02
+// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HEADERCOL_H_
+#define _WX_HEADERCOL_H_
+
+#include "wx/bitmap.h"
+
+#if wxUSE_HEADERCTRL
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+enum
+{
+ // special value for column width meaning unspecified/default
+ wxCOL_WIDTH_DEFAULT = -1,
+
+ // size the column automatically to fit all values
+ wxCOL_WIDTH_AUTOSIZE = -2
+};
+
+// bit masks for the various column attributes
+enum
+{
+ // column can be resized (included in default flags)
+ wxCOL_RESIZABLE = 1,
+
+ // column can be clicked to toggle the sort order by its contents
+ wxCOL_SORTABLE = 2,
+
+ // column can be dragged to change its order (included in default)
+ wxCOL_REORDERABLE = 4,
+
+ // column is not shown at all
+ wxCOL_HIDDEN = 8,
+
+ // default flags for wxHeaderColumn ctor
+ wxCOL_DEFAULT_FLAGS = wxCOL_RESIZABLE | wxCOL_REORDERABLE
+};
+
+// ----------------------------------------------------------------------------
+// wxHeaderColumn: interface for a column in a header of controls such as
+// wxListCtrl, wxDataViewCtrl or wxGrid
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxHeaderColumn
+{
+public:
+ // ctors and dtor
+ // --------------
+
+ /*
+ Derived classes must provide ctors with the following signatures
+ (notice that they shouldn't be explicit to allow passing strings/bitmaps
+ directly to methods such wxHeaderCtrl::AppendColumn()):
+ wxHeaderColumn(const wxString& title,
+ int width = wxCOL_WIDTH_DEFAULT,
+ wxAlignment align = wxALIGN_NOT,
+ int flags = wxCOL_DEFAULT_FLAGS);
+ wxHeaderColumn(const wxBitmap &bitmap,
+ int width = wxDVC_DEFAULT_WIDTH,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxCOL_DEFAULT_FLAGS);
+ */
+
+ // virtual dtor for the base class to avoid gcc warnings even though we
+ // don't normally delete the objects of this class via a pointer to
+ // wxHeaderColumn so it's not necessary, strictly speaking
+ virtual ~wxHeaderColumn() { }
+
+ // getters for various attributes
+ // ------------------------------
+
+ // notice that wxHeaderColumn only provides getters as this is all the
+ // wxHeaderCtrl needs, various derived class must also provide some way to
+ // change these attributes but this can be done either at the column level
+ // (in which case they should inherit from wxSettableHeaderColumn) or via
+ // the methods of the main control in which case you don't need setters in
+ // the column class at all
+
+ // title is the string shown for this column
+ virtual wxString GetTitle() const = 0;
+
+ // bitmap shown (instead of text) in the column header
+ virtual wxBitmap GetBitmap() const = 0; \
+
+ // width of the column in pixels, can be set to wxCOL_WIDTH_DEFAULT meaning
+ // unspecified/default
+ virtual int GetWidth() const = 0;
+
+ // minimal width can be set for resizable columns to forbid resizing them
+ // below the specified size (set to 0 to remove)
+ virtual int GetMinWidth() const = 0;
+
+ // alignment of the text: wxALIGN_CENTRE, wxALIGN_LEFT or wxALIGN_RIGHT
+ virtual wxAlignment GetAlignment() const = 0;
+
+
+ // flags manipulations:
+ // --------------------
+
+ // notice that while we make GetFlags() pure virtual here and implement the
+ // individual flags access in terms of it, for some derived classes it is
+ // more natural to implement access to each flag individually, in which
+ // case they can use our GetFromIndividualFlags() helper below to implement
+ // GetFlags()
+
+ // retrieve all column flags at once: combination of wxCOL_XXX values above
+ virtual int GetFlags() const = 0;
+
+ bool HasFlag(int flag) const { return (GetFlags() & flag) != 0; }
+
+
+ // wxCOL_RESIZABLE
+ virtual bool IsResizeable() const
+ { return HasFlag(wxCOL_RESIZABLE); }
+
+ // wxCOL_SORTABLE
+ virtual bool IsSortable() const
+ { return HasFlag(wxCOL_SORTABLE); }
+
+ // wxCOL_REORDERABLE
+ virtual bool IsReorderable() const
+ { return HasFlag(wxCOL_REORDERABLE); }
+
+ // wxCOL_HIDDEN
+ virtual bool IsHidden() const
+ { return HasFlag(wxCOL_HIDDEN); }
+ bool IsShown() const
+ { return !IsHidden(); }
+
+
+ // sorting
+ // -------
+
+ // return true if the column is the one currently used for sorting
+ virtual bool IsSortKey() const = 0;
+
+ // for sortable columns indicate whether we should sort in ascending or
+ // descending order (this should only be taken into account if IsSortKey())
+ virtual bool IsSortOrderAscending() const = 0;
+
+protected:
+ // helper for the class overriding IsXXX()
+ int GetFromIndividualFlags() const;
+};
+
+// ----------------------------------------------------------------------------
+// wxSettableHeaderColumn: column which allows to change its fields too
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSettableHeaderColumn : public wxHeaderColumn
+{
+public:
+ virtual void SetTitle(const wxString& title) = 0;
+ virtual void SetBitmap(const wxBitmap& bitmap) = 0;
+ virtual void SetWidth(int width) = 0;
+ virtual void SetMinWidth(int minWidth) = 0;
+ virtual void SetAlignment(wxAlignment align) = 0;
+
+ // see comment for wxHeaderColumn::GetFlags() about the relationship
+ // between SetFlags() and Set{Sortable,Reorderable,...}
+
+ // change, set, clear, toggle or test for any individual flag
+ virtual void SetFlags(int flags) = 0;
+ void ChangeFlag(int flag, bool set);
+ void SetFlag(int flag);
+ void ClearFlag(int flag);
+ void ToggleFlag(int flag);
+
+ virtual void SetResizeable(bool resizable)
+ { ChangeFlag(wxCOL_RESIZABLE, resizable); }
+ virtual void SetSortable(bool sortable)
+ { ChangeFlag(wxCOL_SORTABLE, sortable); }
+ virtual void SetReorderable(bool reorderable)
+ { ChangeFlag(wxCOL_REORDERABLE, reorderable); }
+ virtual void SetHidden(bool hidden)
+ { ChangeFlag(wxCOL_HIDDEN, hidden); }
+
+ // This function can be called to indicate that this column is not used for
+ // sorting any more. Under some platforms it's not necessary to do anything
+ // in this case as just setting another column as a sort key takes care of
+ // everything but under MSW we currently need to call this explicitly to
+ // reset the sort indicator displayed on the column.
+ virtual void UnsetAsSortKey() { }
+
+ virtual void SetSortOrder(bool ascending) = 0;
+ void ToggleSortOrder() { SetSortOrder(!IsSortOrderAscending()); }
+
+protected:
+ // helper for the class overriding individual SetXXX() methods instead of
+ // overriding SetFlags()
+ void SetIndividualFlags(int flags);
+};
+
+// ----------------------------------------------------------------------------
+// wxHeaderColumnSimple: trivial generic implementation of wxHeaderColumn
+// ----------------------------------------------------------------------------
+
+class wxHeaderColumnSimple : public wxSettableHeaderColumn
+{
+public:
+ // ctors and dtor
+ wxHeaderColumnSimple(const wxString& title,
+ int width = wxCOL_WIDTH_DEFAULT,
+ wxAlignment align = wxALIGN_NOT,
+ int flags = wxCOL_DEFAULT_FLAGS)
+ : m_title(title),
+ m_width(width),
+ m_align(align),
+ m_flags(flags)
+ {
+ Init();
+ }
+
+ wxHeaderColumnSimple(const wxBitmap& bitmap,
+ int width = wxCOL_WIDTH_DEFAULT,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxCOL_DEFAULT_FLAGS)
+ : m_bitmap(bitmap),
+ m_width(width),
+ m_align(align),
+ m_flags(flags)
+ {
+ Init();
+ }
+
+ // implement base class pure virtuals
+ virtual void SetTitle(const wxString& title) { m_title = title; }
+ virtual wxString GetTitle() const { return m_title; }
+
+ virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
+ wxBitmap GetBitmap() const { return m_bitmap; }
+
+ virtual void SetWidth(int width) { m_width = width; }
+ virtual int GetWidth() const { return m_width; }
+
+ virtual void SetMinWidth(int minWidth) { m_minWidth = minWidth; }
+ virtual int GetMinWidth() const { return m_minWidth; }
+
+ virtual void SetAlignment(wxAlignment align) { m_align = align; }
+ virtual wxAlignment GetAlignment() const { return m_align; }
+
+ virtual void SetFlags(int flags) { m_flags = flags; }
+ virtual int GetFlags() const { return m_flags; }
+
+ virtual bool IsSortKey() const { return m_sort; }
+ virtual void UnsetAsSortKey() { m_sort = false; }
+
+ virtual void SetSortOrder(bool ascending)
+ {
+ m_sort = true;
+ m_sortAscending = ascending;
+ }
+
+ virtual bool IsSortOrderAscending() const { return m_sortAscending; }
+
+private:
+ // common part of all ctors
+ void Init()
+ {
+ m_minWidth = 0;
+ m_sort = false;
+ m_sortAscending = true;
+ }
+
+ wxString m_title;
+ wxBitmap m_bitmap;
+ int m_width,
+ m_minWidth;
+ wxAlignment m_align;
+ int m_flags;
+ bool m_sort,
+ m_sortAscending;
+};
+
+#endif // wxUSE_HEADERCTRL
+
+#endif // _WX_HEADERCOL_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/headerctrl.h
+// Purpose: wxHeaderCtrlBase class: interface of wxHeaderCtrl
+// Author: Vadim Zeitlin
+// Created: 2008-12-01
+// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HEADERCTRL_H_
+#define _WX_HEADERCTRL_H_
+
+#include "wx/control.h"
+
+#if wxUSE_HEADERCTRL
+
+#include "wx/dynarray.h"
+#include "wx/vector.h"
+
+#include "wx/headercol.h"
+
+// notice that the classes in this header are defined in the core library even
+// although currently they're only used by wxGrid which is in wxAdv because we
+// plan to use it in wxListCtrl which is in core too in the future
+class WXDLLIMPEXP_FWD_CORE wxHeaderCtrlEvent;
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+enum
+{
+ // allow column drag and drop
+ wxHD_ALLOW_REORDER = 0x0001,
+
+ // allow hiding (and showing back) the columns using the menu shown by
+ // right clicking the header
+ wxHD_ALLOW_HIDE = 0x0002,
+
+ // style used by default when creating the control
+ wxHD_DEFAULT_STYLE = wxHD_ALLOW_REORDER
+};
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxHeaderCtrlNameStr[];
+
+// ----------------------------------------------------------------------------
+// wxHeaderCtrlBase defines the interface of a header control
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxHeaderCtrlBase : public wxControl
+{
+public:
+ /*
+ Derived classes must provide default ctor as well as a ctor and
+ Create() function with the following signatures:
+
+ wxHeaderCtrl(wxWindow *parent,
+ wxWindowID winid = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxHD_DEFAULT_STYLE,
+ const wxString& name = wxHeaderCtrlNameStr);
+
+ bool Create(wxWindow *parent,
+ wxWindowID winid = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxHD_DEFAULT_STYLE,
+ const wxString& name = wxHeaderCtrlNameStr);
+ */
+
+ // column-related methods
+ // ----------------------
+
+ // set the number of columns in the control
+ //
+ // this also calls UpdateColumn() for all columns
+ void SetColumnCount(unsigned int count);
+
+ // return the number of columns in the control as set by SetColumnCount()
+ unsigned int GetColumnCount() const { return DoGetCount(); }
+
+ // return whether the control has any columns
+ bool IsEmpty() const { return DoGetCount() == 0; }
+
+ // update the column with the given index
+ void UpdateColumn(unsigned int idx)
+ {
+ wxCHECK_RET( idx < GetColumnCount(), "invalid column index" );
+
+ DoUpdate(idx);
+ }
+
+
+ // columns order
+ // -------------
+
+ // set the columns order: the array defines the column index which appears
+ // the given position, it must have GetColumnCount() elements and contain
+ // all indices exactly once
+ void SetColumnsOrder(const wxArrayInt& order);
+ wxArrayInt GetColumnsOrder() const;
+
+ // get the index of the column at the given display position
+ unsigned int GetColumnAt(unsigned int pos) const;
+
+ // get the position at which this column is currently displayed
+ unsigned int GetColumnPos(unsigned int idx) const;
+
+ // reset the columns order to the natural one
+ void ResetColumnsOrder();
+
+ // helper function used by the generic version of this control and also
+ // wxGrid: reshuffles the array of column indices indexed by positions
+ // (i.e. using the same convention as for SetColumnsOrder()) so that the
+ // column with the given index is found at the specified position
+ static void MoveColumnInOrderArray(wxArrayInt& order,
+ unsigned int idx,
+ unsigned int pos);
+
+
+ // UI helpers
+ // ----------
+
+#if wxUSE_MENUS
+ // show the popup menu containing all columns with check marks for the ones
+ // which are currently shown and return true if something was done using it
+ // (in this case UpdateColumnVisibility() will have been called) or false
+ // if the menu was cancelled
+ //
+ // this is called from the default right click handler for the controls
+ // with wxHD_ALLOW_HIDE style
+ bool ShowColumnsMenu(const wxPoint& pt, const wxString& title = wxString());
+
+ // append the entries for all our columns to the given menu, with the
+ // currently visible columns being checked
+ //
+ // this is used by ShowColumnsMenu() but can also be used if you use your
+ // own custom columns menu but nevertheless want to show all the columns in
+ // it
+ //
+ // the ids of the items corresponding to the columns are consecutive and
+ // start from idColumnsBase
+ void AddColumnsItems(wxMenu& menu, int idColumnsBase = 0);
+#endif // wxUSE_MENUS
+
+ // show the columns customization dialog and return true if something was
+ // changed using it (in which case UpdateColumnVisibility() and/or
+ // UpdateColumnsOrder() will have been called)
+ //
+ // this is called by the control itself from ShowColumnsMenu() (which in
+ // turn is only called by the control if wxHD_ALLOW_HIDE style was
+ // specified) and if the control has wxHD_ALLOW_REORDER style as well
+ bool ShowCustomizeDialog();
+
+ // compute column title width
+ int GetColumnTitleWidth(const wxHeaderColumn& col);
+
+ // implementation only from now on
+ // -------------------------------
+
+ // the user doesn't need to TAB to this control
+ virtual bool AcceptsFocusFromKeyboard() const { return false; }
+
+ // this method is only overridden in order to synchronize the control with
+ // the main window when it is scrolled, the derived class must implement
+ // DoScrollHorz()
+ virtual void ScrollWindow(int dx, int dy, const wxRect *rect = NULL);
+
+protected:
+ // this method must be implemented by the derived classes to return the
+ // information for the given column
+ virtual const wxHeaderColumn& GetColumn(unsigned int idx) const = 0;
+
+ // this method is called from the default EVT_HEADER_SEPARATOR_DCLICK
+ // handler to update the fitting column width of the given column, it
+ // should return true if the width was really updated
+ virtual bool UpdateColumnWidthToFit(unsigned int WXUNUSED(idx),
+ int WXUNUSED(widthTitle))
+ {
+ return false;
+ }
+
+ // this method is called from ShowColumnsMenu() and must be overridden to
+ // update the internal column visibility (there is no need to call
+ // UpdateColumn() from here, this will be done internally)
+ virtual void UpdateColumnVisibility(unsigned int WXUNUSED(idx),
+ bool WXUNUSED(show))
+ {
+ wxFAIL_MSG( "must be overridden if called" );
+ }
+
+ // this method is called from ShowCustomizeDialog() to reorder all columns
+ // at once and should be implemented for controls using wxHD_ALLOW_REORDER
+ // style (there is no need to call SetColumnsOrder() from here, this is
+ // done by the control itself)
+ virtual void UpdateColumnsOrder(const wxArrayInt& WXUNUSED(order))
+ {
+ wxFAIL_MSG( "must be overridden if called" );
+ }
+
+ // this method can be overridden in the derived classes to do something
+ // (e.g. update/resize some internal data structures) before the number of
+ // columns in the control changes
+ virtual void OnColumnCountChanging(unsigned int WXUNUSED(count)) { }
+
+
+ // helper function for the derived classes: update the array of column
+ // indices after the number of columns changed
+ void DoResizeColumnIndices(wxArrayInt& colIndices, unsigned int count);
+
+protected:
+ // this window doesn't look nice with the border so don't use it by default
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+private:
+ // methods implementing our public API and defined in platform-specific
+ // implementations
+ virtual void DoSetCount(unsigned int count) = 0;
+ virtual unsigned int DoGetCount() const = 0;
+ virtual void DoUpdate(unsigned int idx) = 0;
+
+ virtual void DoScrollHorz(int dx) = 0;
+
+ virtual void DoSetColumnsOrder(const wxArrayInt& order) = 0;
+ virtual wxArrayInt DoGetColumnsOrder() const = 0;
+
+
+ // event handlers
+ void OnSeparatorDClick(wxHeaderCtrlEvent& event);
+#if wxUSE_MENUS
+ void OnRClick(wxHeaderCtrlEvent& event);
+#endif // wxUSE_MENUS
+
+ DECLARE_EVENT_TABLE()
+};
+
+// ----------------------------------------------------------------------------
+// wxHeaderCtrl: port-specific header control implementation, notice that this
+// is still an ABC which is meant to be used as part of another
+// control, see wxHeaderCtrlSimple for a standalone version
+// ----------------------------------------------------------------------------
+
+#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
+ #include "wx/msw/headerctrl.h"
+#else
+ #define wxHAS_GENERIC_HEADERCTRL
+ #include "wx/generic/headerctrlg.h"
+#endif // platform
+
+// ----------------------------------------------------------------------------
+// wxHeaderCtrlSimple: concrete header control which can be used standalone
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxHeaderCtrlSimple : public wxHeaderCtrl
+{
+public:
+ // control creation
+ // ----------------
+
+ wxHeaderCtrlSimple() { Init(); }
+ wxHeaderCtrlSimple(wxWindow *parent,
+ wxWindowID winid = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxHD_DEFAULT_STYLE,
+ const wxString& name = wxHeaderCtrlNameStr)
+ {
+ Init();
+
+ Create(parent, winid, pos, size, style, name);
+ }
+
+ // managing the columns
+ // --------------------
+
+ // insert the column at the given position, using GetColumnCount() as
+ // position appends it at the end
+ void InsertColumn(const wxHeaderColumnSimple& col, unsigned int idx)
+ {
+ wxCHECK_RET( idx <= GetColumnCount(), "invalid column index" );
+
+ DoInsert(col, idx);
+ }
+
+ // append the column to the end of the control
+ void AppendColumn(const wxHeaderColumnSimple& col)
+ {
+ DoInsert(col, GetColumnCount());
+ }
+
+ // delete the column at the given index
+ void DeleteColumn(unsigned int idx)
+ {
+ wxCHECK_RET( idx < GetColumnCount(), "invalid column index" );
+
+ DoDelete(idx);
+ }
+
+ // delete all the existing columns
+ void DeleteAllColumns();
+
+
+ // modifying columns
+ // -----------------
+
+ // show or hide the column, notice that even when a column is hidden we
+ // still account for it when using indices
+ void ShowColumn(unsigned int idx, bool show = true)
+ {
+ wxCHECK_RET( idx < GetColumnCount(), "invalid column index" );
+
+ DoShowColumn(idx, show);
+ }
+
+ void HideColumn(unsigned int idx)
+ {
+ ShowColumn(idx, false);
+ }
+
+ // indicate that the column is used for sorting
+ void ShowSortIndicator(unsigned int idx, bool ascending = true)
+ {
+ wxCHECK_RET( idx < GetColumnCount(), "invalid column index" );
+
+ DoShowSortIndicator(idx, ascending);
+ }
+
+ // remove the sort indicator completely
+ void RemoveSortIndicator();
+
+protected:
+ // implement/override base class methods
+ virtual const wxHeaderColumn& GetColumn(unsigned int idx) const;
+ virtual bool UpdateColumnWidthToFit(unsigned int idx, int widthTitle);
+
+ // and define another one to be overridden in the derived classes: it
+ // should return the best width for the given column contents or -1 if not
+ // implemented, we use it to implement UpdateColumnWidthToFit()
+ virtual int GetBestFittingWidth(unsigned int WXUNUSED(idx)) const
+ {
+ return -1;
+ }
+
+private:
+ // functions implementing our public API
+ void DoInsert(const wxHeaderColumnSimple& col, unsigned int idx);
+ void DoDelete(unsigned int idx);
+ void DoShowColumn(unsigned int idx, bool show);
+ void DoShowSortIndicator(unsigned int idx, bool ascending);
+
+ // common part of all ctors
+ void Init();
+
+ // bring the column count in sync with the number of columns we store
+ void UpdateColumnCount()
+ {
+ SetColumnCount(static_cast<int>(m_cols.size()));
+ }
+
+
+ // all our current columns
+ typedef wxVector<wxHeaderColumnSimple> Columns;
+ Columns m_cols;
+
+ // the column currently used for sorting or -1 if none
+ unsigned int m_sortKey;
+
+
+ wxDECLARE_NO_COPY_CLASS(wxHeaderCtrlSimple);
+};
+
+// ----------------------------------------------------------------------------
+// wxHeaderCtrl events
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxHeaderCtrlEvent : public wxNotifyEvent
+{
+public:
+ wxHeaderCtrlEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
+ : wxNotifyEvent(commandType, winid),
+ m_col(-1),
+ m_width(0),
+ m_order(static_cast<unsigned int>(-1))
+ {
+ }
+
+ wxHeaderCtrlEvent(const wxHeaderCtrlEvent& event)
+ : wxNotifyEvent(event),
+ m_col(event.m_col),
+ m_width(event.m_width),
+ m_order(event.m_order)
+ {
+ }
+
+ // the column which this event pertains to: valid for all header events
+ int GetColumn() const { return m_col; }
+ void SetColumn(int col) { m_col = col; }
+
+ // the width of the column: valid for column resizing/dragging events only
+ int GetWidth() const { return m_width; }
+ void SetWidth(int width) { m_width = width; }
+
+ // the new position of the column: for end reorder events only
+ unsigned int GetNewOrder() const { return m_order; }
+ void SetNewOrder(unsigned int order) { m_order = order; }
+
+ virtual wxEvent *Clone() const { return new wxHeaderCtrlEvent(*this); }
+
+protected:
+ // the column affected by the event
+ int m_col;
+
+ // the current width for the dragging events
+ int m_width;
+
+ // the new column position for end reorder event
+ unsigned int m_order;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHeaderCtrlEvent)
+};
+
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_CLICK, wxHeaderCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_RIGHT_CLICK, wxHeaderCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_MIDDLE_CLICK, wxHeaderCtrlEvent );
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_DCLICK, wxHeaderCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_RIGHT_DCLICK, wxHeaderCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_MIDDLE_DCLICK, wxHeaderCtrlEvent );
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_SEPARATOR_DCLICK, wxHeaderCtrlEvent );
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_BEGIN_RESIZE, wxHeaderCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_RESIZING, wxHeaderCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_END_RESIZE, wxHeaderCtrlEvent );
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_BEGIN_REORDER, wxHeaderCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_END_REORDER, wxHeaderCtrlEvent );
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_DRAGGING_CANCELLED, wxHeaderCtrlEvent );
+
+typedef void (wxEvtHandler::*wxHeaderCtrlEventFunction)(wxHeaderCtrlEvent&);
+
+#define wxHeaderCtrlEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxHeaderCtrlEventFunction, func)
+
+#define wx__DECLARE_HEADER_EVT(evt, id, fn) \
+ wx__DECLARE_EVT1(wxEVT_HEADER_ ## evt, id, wxHeaderCtrlEventHandler(fn))
+
+#define EVT_HEADER_CLICK(id, fn) wx__DECLARE_HEADER_EVT(CLICK, id, fn)
+#define EVT_HEADER_RIGHT_CLICK(id, fn) wx__DECLARE_HEADER_EVT(RIGHT_CLICK, id, fn)
+#define EVT_HEADER_MIDDLE_CLICK(id, fn) wx__DECLARE_HEADER_EVT(MIDDLE_CLICK, id, fn)
+
+#define EVT_HEADER_DCLICK(id, fn) wx__DECLARE_HEADER_EVT(DCLICK, id, fn)
+#define EVT_HEADER_RIGHT_DCLICK(id, fn) wx__DECLARE_HEADER_EVT(RIGHT_DCLICK, id, fn)
+#define EVT_HEADER_MIDDLE_DCLICK(id, fn) wx__DECLARE_HEADER_EVT(MIDDLE_DCLICK, id, fn)
+
+#define EVT_HEADER_SEPARATOR_DCLICK(id, fn) wx__DECLARE_HEADER_EVT(SEPARATOR_DCLICK, id, fn)
+
+#define EVT_HEADER_BEGIN_RESIZE(id, fn) wx__DECLARE_HEADER_EVT(BEGIN_RESIZE, id, fn)
+#define EVT_HEADER_RESIZING(id, fn) wx__DECLARE_HEADER_EVT(RESIZING, id, fn)
+#define EVT_HEADER_END_RESIZE(id, fn) wx__DECLARE_HEADER_EVT(END_RESIZE, id, fn)
+
+#define EVT_HEADER_BEGIN_REORDER(id, fn) wx__DECLARE_HEADER_EVT(BEGIN_REORDER, id, fn)
+#define EVT_HEADER_END_REORDER(id, fn) wx__DECLARE_HEADER_EVT(END_REORDER, id, fn)
+
+#define EVT_HEADER_DRAGGING_CANCELLED(id, fn) wx__DECLARE_HEADER_EVT(DRAGGING_CANCELLED, id, fn)
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_HEADER_CLICK wxEVT_HEADER_CLICK
+#define wxEVT_COMMAND_HEADER_RIGHT_CLICK wxEVT_HEADER_RIGHT_CLICK
+#define wxEVT_COMMAND_HEADER_MIDDLE_CLICK wxEVT_HEADER_MIDDLE_CLICK
+#define wxEVT_COMMAND_HEADER_DCLICK wxEVT_HEADER_DCLICK
+#define wxEVT_COMMAND_HEADER_RIGHT_DCLICK wxEVT_HEADER_RIGHT_DCLICK
+#define wxEVT_COMMAND_HEADER_MIDDLE_DCLICK wxEVT_HEADER_MIDDLE_DCLICK
+#define wxEVT_COMMAND_HEADER_SEPARATOR_DCLICK wxEVT_HEADER_SEPARATOR_DCLICK
+#define wxEVT_COMMAND_HEADER_BEGIN_RESIZE wxEVT_HEADER_BEGIN_RESIZE
+#define wxEVT_COMMAND_HEADER_RESIZING wxEVT_HEADER_RESIZING
+#define wxEVT_COMMAND_HEADER_END_RESIZE wxEVT_HEADER_END_RESIZE
+#define wxEVT_COMMAND_HEADER_BEGIN_REORDER wxEVT_HEADER_BEGIN_REORDER
+#define wxEVT_COMMAND_HEADER_END_REORDER wxEVT_HEADER_END_REORDER
+#define wxEVT_COMMAND_HEADER_DRAGGING_CANCELLED wxEVT_HEADER_DRAGGING_CANCELLED
+
+#endif // wxUSE_HEADERCTRL
+
+#endif // _WX_HEADERCTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/help.h
+// Purpose: wxHelpController base header
+// Author: wxWidgets Team
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HELP_H_BASE_
+#define _WX_HELP_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_HELP
+
+#include "wx/helpbase.h"
+
+#ifdef __WXWINCE__
+ #include "wx/msw/wince/helpwce.h"
+
+ #define wxHelpController wxWinceHelpController
+#elif defined(__WXMSW__)
+ #include "wx/msw/helpchm.h"
+
+ #define wxHelpController wxCHMHelpController
+#else // !MSW
+
+#if wxUSE_WXHTML_HELP
+ #include "wx/html/helpctrl.h"
+ #define wxHelpController wxHtmlHelpController
+#else
+ #include "wx/generic/helpext.h"
+ #define wxHelpController wxExtHelpController
+#endif
+
+#endif // MSW/!MSW
+
+#endif // wxUSE_HELP
+
+#endif
+ // _WX_HELP_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/helpbase.h
+// Purpose: Help system base classes
+// Author: Julian Smart
+// Modified by:
+// Created: 04/01/98
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HELPBASEH__
+#define _WX_HELPBASEH__
+
+#include "wx/defs.h"
+
+#if wxUSE_HELP
+
+#include "wx/object.h"
+#include "wx/string.h"
+#include "wx/gdicmn.h"
+#include "wx/frame.h"
+
+// Flags for SetViewer
+#define wxHELP_NETSCAPE 1
+
+// Search modes:
+enum wxHelpSearchMode
+{
+ wxHELP_SEARCH_INDEX,
+ wxHELP_SEARCH_ALL
+};
+
+// Defines the API for help controllers
+class WXDLLIMPEXP_CORE wxHelpControllerBase: public wxObject
+{
+public:
+ inline wxHelpControllerBase(wxWindow* parentWindow = NULL) { m_parentWindow = parentWindow; }
+ inline ~wxHelpControllerBase() {}
+
+ // Must call this to set the filename and server name.
+ // server is only required when implementing TCP/IP-based
+ // help controllers.
+ virtual bool Initialize(const wxString& WXUNUSED(file), int WXUNUSED(server) ) { return false; }
+ virtual bool Initialize(const wxString& WXUNUSED(file)) { return false; }
+
+ // Set viewer: only relevant to some kinds of controller
+ virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {}
+
+ // If file is "", reloads file given in Initialize
+ virtual bool LoadFile(const wxString& file = wxEmptyString) = 0;
+
+ // Displays the contents
+ virtual bool DisplayContents(void) = 0;
+
+ // Display the given section
+ virtual bool DisplaySection(int sectionNo) = 0;
+
+ // Display the section using a context id
+ virtual bool DisplayContextPopup(int WXUNUSED(contextId)) { return false; }
+
+ // Display the text in a popup, if possible
+ virtual bool DisplayTextPopup(const wxString& WXUNUSED(text), const wxPoint& WXUNUSED(pos)) { return false; }
+
+ // By default, uses KeywordSection to display a topic. Implementations
+ // may override this for more specific behaviour.
+ virtual bool DisplaySection(const wxString& section) { return KeywordSearch(section); }
+ virtual bool DisplayBlock(long blockNo) = 0;
+ virtual bool KeywordSearch(const wxString& k,
+ wxHelpSearchMode mode = wxHELP_SEARCH_ALL) = 0;
+ /// Allows one to override the default settings for the help frame.
+ virtual void SetFrameParameters(const wxString& WXUNUSED(title),
+ const wxSize& WXUNUSED(size),
+ const wxPoint& WXUNUSED(pos) = wxDefaultPosition,
+ bool WXUNUSED(newFrameEachTime) = false)
+ {
+ // does nothing by default
+ }
+ /// Obtains the latest settings used by the help frame and the help
+ /// frame.
+ virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL,
+ wxPoint *WXUNUSED(pos) = NULL,
+ bool *WXUNUSED(newFrameEachTime) = NULL)
+ {
+ return NULL; // does nothing by default
+ }
+
+ virtual bool Quit() = 0;
+ virtual void OnQuit() {}
+
+ /// Set the window that can optionally be used for the help window's parent.
+ virtual void SetParentWindow(wxWindow* win) { m_parentWindow = win; }
+
+ /// Get the window that can optionally be used for the help window's parent.
+ virtual wxWindow* GetParentWindow() const { return m_parentWindow; }
+
+protected:
+ wxWindow* m_parentWindow;
+private:
+ DECLARE_CLASS(wxHelpControllerBase)
+};
+
+#endif // wxUSE_HELP
+
+#endif
+// _WX_HELPBASEH__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/helphtml.h
+// Purpose: Includes wx/html/helpctrl.h, for wxHtmlHelpController.
+// Author: Julian Smart
+// Modified by:
+// Created: 2003-05-24
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __WX_HELPHTML_H_
+#define __WX_HELPHTML_H_
+
+#if wxUSE_WXHTML_HELP
+#include "wx/html/helpctrl.h"
+#endif
+
+#endif // __WX_HELPHTML_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/helpwin.h
+// Purpose: Includes Windows or OS/2 help
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HELPWIN_H_BASE_
+#define _WX_HELPWIN_H_BASE_
+
+#if defined(__WXMSW__)
+#include "wx/msw/helpwin.h"
+#elif defined(__WXPM__)
+#include "wx/os2/helpwin.h"
+#endif
+
+#endif
+ // _WX_HELPWIN_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/html/forcelnk.h
+// Purpose: macros which force the linker to link apparently unused code
+// Author: Vaclav Slavik
+// Copyright: (c) Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+/*
+
+DESCRPITON:
+
+mod_*.cpp files contain handlers for tags. These files are modules - they contain
+one wxTagModule class and it's OnInit() method is called from wxApp's init method.
+The module is called even if you only link it into the executable, so everything
+seems wonderful.
+
+The problem is that we have these modules in LIBRARY and mod_*.cpp files contain
+no method nor class which is known out of the module. So the linker won't
+link these .o/.obj files into executable because it detected that it is not used
+by the program.
+
+To workaround this I introduced set of macros FORCE_LINK_ME and FORCE_LINK. These
+macros are generic and are not limited to mod_*.cpp files. You may find them quite
+useful somewhere else...
+
+How to use them:
+let's suppose you want to always link file foo.cpp and that you have module
+always.cpp that is certainly always linked (e.g. the one with main() function
+or htmlwin.cpp in wxHtml library).
+
+Place FORCE_LINK_ME(foo) somewhere in foo.cpp and FORCE_LINK(foo) somewhere
+in always.cpp
+See mod_*.cpp and htmlwin.cpp for example :-)
+
+*/
+
+
+#ifndef _WX_FORCELNK_H_
+#define _WX_FORCELNK_H_
+
+#include "wx/link.h"
+
+// compatibility defines
+#define FORCE_LINK wxFORCE_LINK_MODULE
+#define FORCE_LINK_ME wxFORCE_LINK_THIS_MODULE
+
+#define FORCE_WXHTML_MODULES() \
+ FORCE_LINK(m_layout) \
+ FORCE_LINK(m_fonts) \
+ FORCE_LINK(m_image) \
+ FORCE_LINK(m_list) \
+ FORCE_LINK(m_dflist) \
+ FORCE_LINK(m_pre) \
+ FORCE_LINK(m_hline) \
+ FORCE_LINK(m_links) \
+ FORCE_LINK(m_tables) \
+ FORCE_LINK(m_span) \
+ FORCE_LINK(m_style)
+
+
+#endif // _WX_FORCELNK_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/html/helpctrl.h
+// Purpose: wxHtmlHelpController
+// Notes: Based on htmlhelp.cpp, implementing a monolithic
+// HTML Help controller class, by Vaclav Slavik
+// Author: Harm van der Heijden and Vaclav Slavik
+// Copyright: (c) Harm van der Heijden and Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HELPCTRL_H_
+#define _WX_HELPCTRL_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_WXHTML_HELP
+
+#include "wx/helpbase.h"
+#include "wx/html/helpfrm.h"
+
+#define wxID_HTML_HELPFRAME (wxID_HIGHEST + 1)
+
+// This style indicates that the window is
+// embedded in the application and must not be
+// destroyed by the help controller.
+#define wxHF_EMBEDDED 0x00008000
+
+// Create a dialog for the help window.
+#define wxHF_DIALOG 0x00010000
+
+// Create a frame for the help window.
+#define wxHF_FRAME 0x00020000
+
+// Make the dialog modal when displaying help.
+#define wxHF_MODAL 0x00040000
+
+class WXDLLIMPEXP_FWD_HTML wxHtmlHelpDialog;
+class WXDLLIMPEXP_FWD_HTML wxHtmlHelpWindow;
+class WXDLLIMPEXP_FWD_HTML wxHtmlHelpFrame;
+class WXDLLIMPEXP_FWD_HTML wxHtmlHelpDialog;
+
+class WXDLLIMPEXP_HTML wxHtmlHelpController : public wxHelpControllerBase // wxEvtHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxHtmlHelpController)
+
+public:
+ wxHtmlHelpController(int style = wxHF_DEFAULT_STYLE, wxWindow* parentWindow = NULL);
+ wxHtmlHelpController(wxWindow* parentWindow, int style = wxHF_DEFAULT_STYLE);
+
+ virtual ~wxHtmlHelpController();
+
+ void SetShouldPreventAppExit(bool enable);
+
+ void SetTitleFormat(const wxString& format);
+ void SetTempDir(const wxString& path) { m_helpData.SetTempDir(path); }
+ bool AddBook(const wxString& book_url, bool show_wait_msg = false);
+ bool AddBook(const wxFileName& book_file, bool show_wait_msg = false);
+
+ bool Display(const wxString& x);
+ bool Display(int id);
+ bool DisplayContents();
+ bool DisplayIndex();
+ bool KeywordSearch(const wxString& keyword,
+ wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
+
+ wxHtmlHelpWindow* GetHelpWindow() { return m_helpWindow; }
+ void SetHelpWindow(wxHtmlHelpWindow* helpWindow);
+
+ wxHtmlHelpFrame* GetFrame() { return m_helpFrame; }
+ wxHtmlHelpDialog* GetDialog() { return m_helpDialog; }
+
+#if wxUSE_CONFIG
+ void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString);
+
+ // Assigns config object to the Ctrl. This config is then
+ // used in subsequent calls to Read/WriteCustomization of both help
+ // Ctrl and it's wxHtmlWindow
+ virtual void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
+ virtual void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
+#endif // wxUSE_CONFIG
+
+ //// Backward compatibility with wxHelpController API
+
+ virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize(file); }
+ virtual bool Initialize(const wxString& file);
+ virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {}
+ virtual bool LoadFile(const wxString& file = wxT(""));
+ virtual bool DisplaySection(int sectionNo);
+ virtual bool DisplaySection(const wxString& section) { return Display(section); }
+ virtual bool DisplayBlock(long blockNo) { return DisplaySection(blockNo); }
+ virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos);
+
+ virtual void SetFrameParameters(const wxString& titleFormat,
+ const wxSize& size,
+ const wxPoint& pos = wxDefaultPosition,
+ bool newFrameEachTime = false);
+ /// Obtains the latest settings used by the help frame and the help
+ /// frame.
+ virtual wxFrame *GetFrameParameters(wxSize *size = NULL,
+ wxPoint *pos = NULL,
+ bool *newFrameEachTime = NULL);
+
+ // Get direct access to help data:
+ wxHtmlHelpData *GetHelpData() { return &m_helpData; }
+
+ virtual bool Quit() ;
+ virtual void OnQuit() {}
+
+ void OnCloseFrame(wxCloseEvent& evt);
+
+ // Make the help controller's frame 'modal' if
+ // needed
+ void MakeModalIfNeeded();
+
+ // Find the top-most parent window
+ wxWindow* FindTopLevelWindow();
+
+protected:
+ void Init(int style);
+
+ virtual wxWindow* CreateHelpWindow();
+ virtual wxHtmlHelpFrame* CreateHelpFrame(wxHtmlHelpData *data);
+ virtual wxHtmlHelpDialog* CreateHelpDialog(wxHtmlHelpData *data);
+ virtual void DestroyHelpWindow();
+
+ wxHtmlHelpData m_helpData;
+ wxHtmlHelpWindow* m_helpWindow;
+#if wxUSE_CONFIG
+ wxConfigBase * m_Config;
+ wxString m_ConfigRoot;
+#endif // wxUSE_CONFIG
+ wxString m_titleFormat;
+ int m_FrameStyle;
+ wxHtmlHelpFrame* m_helpFrame;
+ wxHtmlHelpDialog* m_helpDialog;
+
+ bool m_shouldPreventAppExit;
+
+ wxDECLARE_NO_COPY_CLASS(wxHtmlHelpController);
+};
+
+/*
+ * wxHtmlModalHelp
+ * A convenience class particularly for use on wxMac,
+ * where you can only show modal dialogs from a modal
+ * dialog.
+ *
+ * Use like this:
+ *
+ * wxHtmlModalHelp help(parent, filename, topic);
+ *
+ * If topic is empty, the help contents is displayed.
+ */
+
+class WXDLLIMPEXP_HTML wxHtmlModalHelp
+{
+public:
+ wxHtmlModalHelp(wxWindow* parent, const wxString& helpFile, const wxString& topic = wxEmptyString,
+ int style = wxHF_DEFAULT_STYLE | wxHF_DIALOG | wxHF_MODAL);
+};
+
+#endif // wxUSE_WXHTML_HELP
+
+#endif // _WX_HELPCTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/html/helpdata.h
+// Purpose: wxHtmlHelpData
+// Notes: Based on htmlhelp.cpp, implementing a monolithic
+// HTML Help controller class, by Vaclav Slavik
+// Author: Harm van der Heijden and Vaclav Slavik
+// Copyright: (c) Harm van der Heijden and Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HELPDATA_H_
+#define _WX_HELPDATA_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_HTML
+
+#include "wx/object.h"
+#include "wx/string.h"
+#include "wx/filesys.h"
+#include "wx/dynarray.h"
+#include "wx/font.h"
+
+class WXDLLIMPEXP_FWD_HTML wxHtmlHelpData;
+
+//--------------------------------------------------------------------------------
+// helper classes & structs
+//--------------------------------------------------------------------------------
+
+class WXDLLIMPEXP_HTML wxHtmlBookRecord
+{
+public:
+ wxHtmlBookRecord(const wxString& bookfile, const wxString& basepath,
+ const wxString& title, const wxString& start)
+ {
+ m_BookFile = bookfile;
+ m_BasePath = basepath;
+ m_Title = title;
+ m_Start = start;
+ // for debugging, give the contents index obvious default values
+ m_ContentsStart = m_ContentsEnd = -1;
+ }
+ wxString GetBookFile() const { return m_BookFile; }
+ wxString GetTitle() const { return m_Title; }
+ wxString GetStart() const { return m_Start; }
+ wxString GetBasePath() const { return m_BasePath; }
+ /* SetContentsRange: store in the bookrecord where in the index/contents lists the
+ * book's records are stored. This to facilitate searching in a specific book.
+ * This code will have to be revised when loading/removing books becomes dynamic.
+ * (as opposed to appending only)
+ * Note that storing index range is pointless, because the index is alphab. sorted. */
+ void SetContentsRange(int start, int end) { m_ContentsStart = start; m_ContentsEnd = end; }
+ int GetContentsStart() const { return m_ContentsStart; }
+ int GetContentsEnd() const { return m_ContentsEnd; }
+
+ void SetTitle(const wxString& title) { m_Title = title; }
+ void SetBasePath(const wxString& path) { m_BasePath = path; }
+ void SetStart(const wxString& start) { m_Start = start; }
+
+ // returns full filename of page (which is part of the book),
+ // i.e. with book's basePath prepended. If page is already absolute
+ // path, basePath is _not_ prepended.
+ wxString GetFullPath(const wxString &page) const;
+
+protected:
+ wxString m_BookFile;
+ wxString m_BasePath;
+ wxString m_Title;
+ wxString m_Start;
+ int m_ContentsStart;
+ int m_ContentsEnd;
+};
+
+
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxHtmlBookRecord, wxHtmlBookRecArray,
+ WXDLLIMPEXP_HTML);
+
+struct WXDLLIMPEXP_HTML wxHtmlHelpDataItem
+{
+ wxHtmlHelpDataItem() : level(0), parent(NULL), id(wxID_ANY), book(NULL) {}
+
+ int level;
+ wxHtmlHelpDataItem *parent;
+ int id;
+ wxString name;
+ wxString page;
+ wxHtmlBookRecord *book;
+
+ // returns full filename of m_Page, i.e. with book's basePath prepended
+ wxString GetFullPath() const { return book->GetFullPath(page); }
+
+ // returns item indented with spaces if it has level>1:
+ wxString GetIndentedName() const;
+};
+
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxHtmlHelpDataItem, wxHtmlHelpDataItems,
+ WXDLLIMPEXP_HTML);
+
+
+//------------------------------------------------------------------------------
+// wxHtmlSearchEngine
+// This class takes input streams and scans them for occurrence
+// of keyword(s)
+//------------------------------------------------------------------------------
+
+class WXDLLIMPEXP_HTML wxHtmlSearchEngine : public wxObject
+{
+public:
+ wxHtmlSearchEngine() : wxObject() {}
+ virtual ~wxHtmlSearchEngine() {}
+
+ // Sets the keyword we will be searching for
+ virtual void LookFor(const wxString& keyword, bool case_sensitive, bool whole_words_only);
+
+ // Scans the stream for the keyword.
+ // Returns true if the stream contains keyword, fALSE otherwise
+ virtual bool Scan(const wxFSFile& file);
+
+private:
+ wxString m_Keyword;
+ bool m_CaseSensitive;
+ bool m_WholeWords;
+
+ wxDECLARE_NO_COPY_CLASS(wxHtmlSearchEngine);
+};
+
+
+// State information of a search action. I'd have preferred to make this a
+// nested class inside wxHtmlHelpData, but that's against coding standards :-(
+// Never construct this class yourself, obtain a copy from
+// wxHtmlHelpData::PrepareKeywordSearch(const wxString& key)
+class WXDLLIMPEXP_HTML wxHtmlSearchStatus
+{
+public:
+ // constructor; supply wxHtmlHelpData ptr, the keyword and (optionally) the
+ // title of the book to search. By default, all books are searched.
+ wxHtmlSearchStatus(wxHtmlHelpData* base, const wxString& keyword,
+ bool case_sensitive, bool whole_words_only,
+ const wxString& book = wxEmptyString);
+ bool Search(); // do the next iteration
+ bool IsActive() { return m_Active; }
+ int GetCurIndex() { return m_CurIndex; }
+ int GetMaxIndex() { return m_MaxIndex; }
+ const wxString& GetName() { return m_Name; }
+
+ const wxHtmlHelpDataItem *GetCurItem() const { return m_CurItem; }
+
+private:
+ wxHtmlHelpData* m_Data;
+ wxHtmlSearchEngine m_Engine;
+ wxString m_Keyword, m_Name;
+ wxString m_LastPage;
+ wxHtmlHelpDataItem* m_CurItem;
+ bool m_Active; // search is not finished
+ int m_CurIndex; // where we are now
+ int m_MaxIndex; // number of files we search
+ // For progress bar: 100*curindex/maxindex = % complete
+
+ wxDECLARE_NO_COPY_CLASS(wxHtmlSearchStatus);
+};
+
+class WXDLLIMPEXP_HTML wxHtmlHelpData : public wxObject
+{
+ DECLARE_DYNAMIC_CLASS(wxHtmlHelpData)
+ friend class wxHtmlSearchStatus;
+
+public:
+ wxHtmlHelpData();
+ virtual ~wxHtmlHelpData();
+
+ // Sets directory where temporary files are stored.
+ // These temp files are index & contents file in binary (much faster to read)
+ // form. These files are NOT deleted on program's exit.
+ void SetTempDir(const wxString& path);
+
+ // Adds new book. 'book' is location of .htb file (stands for "html book").
+ // See documentation for details on its format.
+ // Returns success.
+ bool AddBook(const wxString& book);
+ bool AddBookParam(const wxFSFile& bookfile,
+ wxFontEncoding encoding,
+ const wxString& title, const wxString& contfile,
+ const wxString& indexfile = wxEmptyString,
+ const wxString& deftopic = wxEmptyString,
+ const wxString& path = wxEmptyString);
+
+ // Some accessing stuff:
+
+ // returns URL of page on basis of (file)name
+ wxString FindPageByName(const wxString& page);
+ // returns URL of page on basis of MS id
+ wxString FindPageById(int id);
+
+ const wxHtmlBookRecArray& GetBookRecArray() const { return m_bookRecords; }
+
+ const wxHtmlHelpDataItems& GetContentsArray() const { return m_contents; }
+ const wxHtmlHelpDataItems& GetIndexArray() const { return m_index; }
+
+protected:
+ wxString m_tempPath;
+
+ // each book has one record in this array:
+ wxHtmlBookRecArray m_bookRecords;
+
+ wxHtmlHelpDataItems m_contents; // list of all available books and pages
+ wxHtmlHelpDataItems m_index; // list of index itesm
+
+protected:
+ // Imports .hhp files (MS HTML Help Workshop)
+ bool LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys,
+ const wxString& indexfile, const wxString& contentsfile);
+ // Reads binary book
+ bool LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f);
+ // Writes binary book
+ bool SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f);
+
+ wxDECLARE_NO_COPY_CLASS(wxHtmlHelpData);
+};
+
+#endif
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/html/helpdlg.h
+// Purpose: wxHtmlHelpDialog
+// Notes: Based on htmlhelp.cpp, implementing a monolithic
+// HTML Help controller class, by Vaclav Slavik
+// Author: Harm van der Heijden, Vaclav Slavik, Julian Smart
+// Copyright: (c) Harm van der Heijden, Vaclav Slavik, Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HELPDLG_H_
+#define _WX_HELPDLG_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_WXHTML_HELP
+
+#include "wx/html/helpdata.h"
+#include "wx/window.h"
+#include "wx/dialog.h"
+#include "wx/frame.h"
+#include "wx/config.h"
+#include "wx/splitter.h"
+#include "wx/notebook.h"
+#include "wx/listbox.h"
+#include "wx/choice.h"
+#include "wx/combobox.h"
+#include "wx/checkbox.h"
+#include "wx/stattext.h"
+#include "wx/html/htmlwin.h"
+#include "wx/html/helpwnd.h"
+#include "wx/html/htmprint.h"
+
+class WXDLLIMPEXP_FWD_HTML wxHtmlHelpController;
+class WXDLLIMPEXP_FWD_HTML wxHtmlHelpWindow;
+
+class WXDLLIMPEXP_HTML wxHtmlHelpDialog : public wxDialog
+{
+ DECLARE_DYNAMIC_CLASS(wxHtmlHelpDialog)
+
+public:
+ wxHtmlHelpDialog(wxHtmlHelpData* data = NULL) { Init(data); }
+ wxHtmlHelpDialog(wxWindow* parent, wxWindowID wxWindowID,
+ const wxString& title = wxEmptyString,
+ int style = wxHF_DEFAULT_STYLE, wxHtmlHelpData* data = NULL);
+ virtual ~wxHtmlHelpDialog();
+
+ bool Create(wxWindow* parent, wxWindowID id, const wxString& title = wxEmptyString,
+ int style = wxHF_DEFAULT_STYLE);
+
+ /// Returns the data associated with this dialog.
+ wxHtmlHelpData* GetData() { return m_Data; }
+
+ /// Returns the controller that created this dialog.
+ wxHtmlHelpController* GetController() const { return m_helpController; }
+
+ /// Sets the controller associated with this dialog.
+ void SetController(wxHtmlHelpController* controller) { m_helpController = controller; }
+
+ /// Returns the help window.
+ wxHtmlHelpWindow* GetHelpWindow() const { return m_HtmlHelpWin; }
+
+ // Sets format of title of the frame. Must contain exactly one "%s"
+ // (for title of displayed HTML page)
+ void SetTitleFormat(const wxString& format);
+
+ // Override to add custom buttons to the toolbar
+ virtual void AddToolbarButtons(wxToolBar* WXUNUSED(toolBar), int WXUNUSED(style)) {}
+
+protected:
+ void Init(wxHtmlHelpData* data = NULL);
+
+ void OnCloseWindow(wxCloseEvent& event);
+
+protected:
+ // Temporary pointer to pass to window
+ wxHtmlHelpData* m_Data;
+ wxString m_TitleFormat; // title of the help frame
+ wxHtmlHelpWindow *m_HtmlHelpWin;
+ wxHtmlHelpController* m_helpController;
+
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxHtmlHelpDialog);
+};
+
+#endif
+ // wxUSE_WXHTML_HELP
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/html/helpfrm.h
+// Purpose: wxHtmlHelpFrame
+// Notes: Based on htmlhelp.cpp, implementing a monolithic
+// HTML Help controller class, by Vaclav Slavik
+// Author: Harm van der Heijden and Vaclav Slavik
+// Copyright: (c) Harm van der Heijden and Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HELPFRM_H_
+#define _WX_HELPFRM_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_WXHTML_HELP
+
+#include "wx/helpbase.h"
+#include "wx/html/helpdata.h"
+#include "wx/window.h"
+#include "wx/frame.h"
+#include "wx/config.h"
+#include "wx/splitter.h"
+#include "wx/notebook.h"
+#include "wx/listbox.h"
+#include "wx/choice.h"
+#include "wx/combobox.h"
+#include "wx/checkbox.h"
+#include "wx/stattext.h"
+#include "wx/html/htmlwin.h"
+#include "wx/html/helpwnd.h"
+#include "wx/html/htmprint.h"
+
+class WXDLLIMPEXP_FWD_CORE wxButton;
+class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
+class WXDLLIMPEXP_FWD_CORE wxTreeEvent;
+class WXDLLIMPEXP_FWD_CORE wxTreeCtrl;
+
+
+// style flags for the Help Frame
+#define wxHF_TOOLBAR 0x0001
+#define wxHF_CONTENTS 0x0002
+#define wxHF_INDEX 0x0004
+#define wxHF_SEARCH 0x0008
+#define wxHF_BOOKMARKS 0x0010
+#define wxHF_OPEN_FILES 0x0020
+#define wxHF_PRINT 0x0040
+#define wxHF_FLAT_TOOLBAR 0x0080
+#define wxHF_MERGE_BOOKS 0x0100
+#define wxHF_ICONS_BOOK 0x0200
+#define wxHF_ICONS_BOOK_CHAPTER 0x0400
+#define wxHF_ICONS_FOLDER 0x0000 // this is 0 since it is default
+#define wxHF_DEFAULT_STYLE (wxHF_TOOLBAR | wxHF_CONTENTS | \
+ wxHF_INDEX | wxHF_SEARCH | \
+ wxHF_BOOKMARKS | wxHF_PRINT)
+//compatibility:
+#define wxHF_OPENFILES wxHF_OPEN_FILES
+#define wxHF_FLATTOOLBAR wxHF_FLAT_TOOLBAR
+#define wxHF_DEFAULTSTYLE wxHF_DEFAULT_STYLE
+
+struct wxHtmlHelpMergedIndexItem;
+class wxHtmlHelpMergedIndex;
+
+class WXDLLIMPEXP_FWD_CORE wxHelpControllerBase;
+class WXDLLIMPEXP_FWD_HTML wxHtmlHelpController;
+class WXDLLIMPEXP_FWD_HTML wxHtmlHelpWindow;
+
+class WXDLLIMPEXP_HTML wxHtmlHelpFrame : public wxFrame
+{
+ DECLARE_DYNAMIC_CLASS(wxHtmlHelpFrame)
+
+public:
+ wxHtmlHelpFrame(wxHtmlHelpData* data = NULL) { Init(data); }
+ wxHtmlHelpFrame(wxWindow* parent, wxWindowID wxWindowID,
+ const wxString& title = wxEmptyString,
+ int style = wxHF_DEFAULT_STYLE, wxHtmlHelpData* data = NULL
+#if wxUSE_CONFIG
+ , wxConfigBase *config=NULL, const wxString& rootpath = wxEmptyString
+#endif // wxUSE_CONFIG
+ );
+ bool Create(wxWindow* parent, wxWindowID id, const wxString& title = wxEmptyString,
+ int style = wxHF_DEFAULT_STYLE
+#if wxUSE_CONFIG
+ , wxConfigBase *config=NULL, const wxString& rootpath = wxEmptyString
+#endif // wxUSE_CONFIG
+ );
+ virtual ~wxHtmlHelpFrame();
+
+ /// Returns the data associated with the window.
+ wxHtmlHelpData* GetData() { return m_Data; }
+
+ /// Returns the help controller associated with the window.
+ wxHtmlHelpController* GetController() const { return m_helpController; }
+
+ /// Sets the help controller associated with the window.
+ void SetController(wxHtmlHelpController* controller);
+
+ /// Returns the help window.
+ wxHtmlHelpWindow* GetHelpWindow() const { return m_HtmlHelpWin; }
+
+ // Sets format of title of the frame. Must contain exactly one "%s"
+ // (for title of displayed HTML page)
+ void SetTitleFormat(const wxString& format);
+
+#if wxUSE_CONFIG
+ // For compatibility
+ void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString);
+#endif // wxUSE_CONFIG
+
+ // Make the help controller's frame 'modal' if
+ // needed
+ void AddGrabIfNeeded();
+
+ // Override to add custom buttons to the toolbar
+ virtual void AddToolbarButtons(wxToolBar* WXUNUSED(toolBar), int WXUNUSED(style)) {}
+
+ void SetShouldPreventAppExit(bool enable);
+
+ // we don't want to prevent the app from closing just because a help window
+ // remains opened
+ virtual bool ShouldPreventAppExit() const { return m_shouldPreventAppExit; }
+
+protected:
+ void Init(wxHtmlHelpData* data = NULL);
+
+ void OnCloseWindow(wxCloseEvent& event);
+ void OnActivate(wxActivateEvent& event);
+
+#ifdef __WXMAC__
+ void OnClose(wxCommandEvent& event);
+ void OnAbout(wxCommandEvent& event);
+#endif
+
+ // Images:
+ enum {
+ IMG_Book = 0,
+ IMG_Folder,
+ IMG_Page
+ };
+
+protected:
+ wxHtmlHelpData* m_Data;
+ bool m_DataCreated; // m_Data created by frame, or supplied?
+ wxString m_TitleFormat; // title of the help frame
+ wxHtmlHelpWindow *m_HtmlHelpWin;
+ wxHtmlHelpController* m_helpController;
+ bool m_shouldPreventAppExit;
+
+private:
+
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxHtmlHelpFrame);
+};
+
+#endif // wxUSE_WXHTML_HELP
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/html/helpwnd.h
+// Purpose: wxHtmlHelpWindow
+// Notes: Based on htmlhelp.cpp, implementing a monolithic
+// HTML Help controller class, by Vaclav Slavik
+// Author: Harm van der Heijden and Vaclav Slavik
+// Copyright: (c) Harm van der Heijden and Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HELPWND_H_
+#define _WX_HELPWND_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_WXHTML_HELP
+
+#include "wx/helpbase.h"
+#include "wx/html/helpdata.h"
+#include "wx/window.h"
+#include "wx/frame.h"
+#include "wx/config.h"
+#include "wx/splitter.h"
+#include "wx/notebook.h"
+#include "wx/listbox.h"
+#include "wx/choice.h"
+#include "wx/combobox.h"
+#include "wx/checkbox.h"
+#include "wx/stattext.h"
+#include "wx/hash.h"
+#include "wx/html/htmlwin.h"
+#include "wx/html/htmprint.h"
+
+class WXDLLIMPEXP_FWD_CORE wxButton;
+class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
+class WXDLLIMPEXP_FWD_CORE wxTreeEvent;
+class WXDLLIMPEXP_FWD_CORE wxTreeCtrl;
+
+// style flags for the Help Frame
+#define wxHF_TOOLBAR 0x0001
+#define wxHF_CONTENTS 0x0002
+#define wxHF_INDEX 0x0004
+#define wxHF_SEARCH 0x0008
+#define wxHF_BOOKMARKS 0x0010
+#define wxHF_OPEN_FILES 0x0020
+#define wxHF_PRINT 0x0040
+#define wxHF_FLAT_TOOLBAR 0x0080
+#define wxHF_MERGE_BOOKS 0x0100
+#define wxHF_ICONS_BOOK 0x0200
+#define wxHF_ICONS_BOOK_CHAPTER 0x0400
+#define wxHF_ICONS_FOLDER 0x0000 // this is 0 since it is default
+#define wxHF_DEFAULT_STYLE (wxHF_TOOLBAR | wxHF_CONTENTS | \
+ wxHF_INDEX | wxHF_SEARCH | \
+ wxHF_BOOKMARKS | wxHF_PRINT)
+//compatibility:
+#define wxHF_OPENFILES wxHF_OPEN_FILES
+#define wxHF_FLATTOOLBAR wxHF_FLAT_TOOLBAR
+#define wxHF_DEFAULTSTYLE wxHF_DEFAULT_STYLE
+
+struct wxHtmlHelpFrameCfg
+{
+ int x, y, w, h;
+ long sashpos;
+ bool navig_on;
+};
+
+struct wxHtmlHelpMergedIndexItem;
+class wxHtmlHelpMergedIndex;
+
+class WXDLLIMPEXP_FWD_CORE wxHelpControllerBase;
+class WXDLLIMPEXP_FWD_HTML wxHtmlHelpController;
+
+/*!
+ * Help window
+ */
+
+class WXDLLIMPEXP_HTML wxHtmlHelpWindow : public wxWindow
+{
+ DECLARE_DYNAMIC_CLASS(wxHtmlHelpWindow)
+
+public:
+ wxHtmlHelpWindow(wxHtmlHelpData* data = NULL) { Init(data); }
+ wxHtmlHelpWindow(wxWindow* parent, wxWindowID wxWindowID,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int style = wxTAB_TRAVERSAL|wxNO_BORDER,
+ int helpStyle = wxHF_DEFAULT_STYLE,
+ wxHtmlHelpData* data = NULL);
+ bool Create(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int style = wxTAB_TRAVERSAL|wxNO_BORDER,
+ int helpStyle = wxHF_DEFAULT_STYLE);
+ virtual ~wxHtmlHelpWindow();
+
+ wxHtmlHelpData* GetData() { return m_Data; }
+ wxHtmlHelpController* GetController() const { return m_helpController; }
+ void SetController(wxHtmlHelpController* controller);
+
+ // Displays page x. If not found it will offect the user a choice of
+ // searching books.
+ // Looking for the page runs in these steps:
+ // 1. try to locate file named x (if x is for example "doc/howto.htm")
+ // 2. try to open starting page of book x
+ // 3. try to find x in contents (if x is for example "How To ...")
+ // 4. try to find x in index (if x is for example "How To ...")
+ bool Display(const wxString& x);
+
+ // Alternative version that works with numeric ID.
+ // (uses extension to MS format, <param name="ID" value=id>, see docs)
+ bool Display(const int id);
+
+ // Displays help window and focuses contents.
+ bool DisplayContents();
+
+ // Displays help window and focuses index.
+ bool DisplayIndex();
+
+ // Searches for keyword. Returns true and display page if found, return
+ // false otherwise
+ // Syntax of keyword is Altavista-like:
+ // * words are separated by spaces
+ // (but "\"hello world\"" is only one world "hello world")
+ // * word may be pretended by + or -
+ // (+ : page must contain the word ; - : page can't contain the word)
+ // * if there is no + or - before the word, + is default
+ bool KeywordSearch(const wxString& keyword,
+ wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
+
+#if wxUSE_CONFIG
+ void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString)
+ {
+ m_Config = config;
+ m_ConfigRoot = rootpath;
+ ReadCustomization(config, rootpath);
+ }
+
+ // Saves custom settings into cfg config. it will use the path 'path'
+ // if given, otherwise it will save info into currently selected path.
+ // saved values : things set by SetFonts, SetBorders.
+ void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
+ void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
+#endif // wxUSE_CONFIG
+
+ // call this to let wxHtmlHelpWindow know page changed
+ void NotifyPageChanged();
+
+ // Refreshes Contents and Index tabs
+ void RefreshLists();
+
+ // Gets the HTML window
+ wxHtmlWindow* GetHtmlWindow() const { return m_HtmlWin; }
+
+ // Gets the splitter window
+ wxSplitterWindow* GetSplitterWindow() const { return m_Splitter; }
+
+ // Gets the toolbar
+ wxToolBar* GetToolBar() const { return m_toolBar; }
+
+ // Gets the configuration data
+ wxHtmlHelpFrameCfg& GetCfgData() { return m_Cfg; }
+
+ // Gets the tree control
+ wxTreeCtrl *GetTreeCtrl() const { return m_ContentsBox; }
+
+protected:
+ void Init(wxHtmlHelpData* data = NULL);
+
+ // Adds items to m_Contents tree control
+ void CreateContents();
+
+ // Adds items to m_IndexList
+ void CreateIndex();
+
+ // Add books to search choice panel
+ void CreateSearch();
+
+ // Updates "merged index" structure that combines indexes of all books
+ // into better searchable structure
+ void UpdateMergedIndex();
+
+ // Add custom buttons to toolbar
+ virtual void AddToolbarButtons(wxToolBar *toolBar, int style);
+
+ // Displays options dialog (fonts etc.)
+ virtual void OptionsDialog();
+
+ void OnToolbar(wxCommandEvent& event);
+ void OnContentsSel(wxTreeEvent& event);
+ void OnIndexSel(wxCommandEvent& event);
+ void OnIndexFind(wxCommandEvent& event);
+ void OnIndexAll(wxCommandEvent& event);
+ void OnSearchSel(wxCommandEvent& event);
+ void OnSearch(wxCommandEvent& event);
+ void OnBookmarksSel(wxCommandEvent& event);
+ void OnSize(wxSizeEvent& event);
+
+ // Images:
+ enum {
+ IMG_Book = 0,
+ IMG_Folder,
+ IMG_Page
+ };
+
+protected:
+ wxHtmlHelpData* m_Data;
+ bool m_DataCreated; // m_Data created by frame, or supplied?
+ wxString m_TitleFormat; // title of the help frame
+ // below are various pointers to GUI components
+ wxHtmlWindow *m_HtmlWin;
+ wxSplitterWindow *m_Splitter;
+ wxPanel *m_NavigPan;
+ wxNotebook *m_NavigNotebook;
+ wxTreeCtrl *m_ContentsBox;
+ wxTextCtrl *m_IndexText;
+ wxButton *m_IndexButton;
+ wxButton *m_IndexButtonAll;
+ wxListBox *m_IndexList;
+ wxTextCtrl *m_SearchText;
+ wxButton *m_SearchButton;
+ wxListBox *m_SearchList;
+ wxChoice *m_SearchChoice;
+ wxStaticText *m_IndexCountInfo;
+ wxCheckBox *m_SearchCaseSensitive;
+ wxCheckBox *m_SearchWholeWords;
+ wxToolBar* m_toolBar;
+
+ wxComboBox *m_Bookmarks;
+ wxArrayString m_BookmarksNames, m_BookmarksPages;
+
+ wxHtmlHelpFrameCfg m_Cfg;
+
+#if wxUSE_CONFIG
+ wxConfigBase *m_Config;
+ wxString m_ConfigRoot;
+#endif // wxUSE_CONFIG
+
+ // pagenumbers of controls in notebook (usually 0,1,2)
+ int m_ContentsPage;
+ int m_IndexPage;
+ int m_SearchPage;
+
+ // lists of available fonts (used in options dialog)
+ wxArrayString *m_NormalFonts, *m_FixedFonts;
+ int m_FontSize; // 0,1,2 = small,medium,big
+ wxString m_NormalFace, m_FixedFace;
+
+ bool m_UpdateContents;
+
+#if wxUSE_PRINTING_ARCHITECTURE
+ wxHtmlEasyPrinting *m_Printer;
+#endif
+ wxHashTable *m_PagesHash;
+ wxHtmlHelpController* m_helpController;
+
+ int m_hfStyle;
+
+private:
+ void DoIndexFind();
+ void DoIndexAll();
+ void DisplayIndexItem(const wxHtmlHelpMergedIndexItem *it);
+ wxHtmlHelpMergedIndex *m_mergedIndex;
+
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxHtmlHelpWindow);
+};
+
+/*!
+ * Command IDs
+ */
+
+enum
+{
+ //wxID_HTML_HELPFRAME = wxID_HIGHEST + 1,
+ wxID_HTML_PANEL = wxID_HIGHEST + 10,
+ wxID_HTML_BACK,
+ wxID_HTML_FORWARD,
+ wxID_HTML_UPNODE,
+ wxID_HTML_UP,
+ wxID_HTML_DOWN,
+ wxID_HTML_PRINT,
+ wxID_HTML_OPENFILE,
+ wxID_HTML_OPTIONS,
+ wxID_HTML_BOOKMARKSLIST,
+ wxID_HTML_BOOKMARKSADD,
+ wxID_HTML_BOOKMARKSREMOVE,
+ wxID_HTML_TREECTRL,
+ wxID_HTML_INDEXPAGE,
+ wxID_HTML_INDEXLIST,
+ wxID_HTML_INDEXTEXT,
+ wxID_HTML_INDEXBUTTON,
+ wxID_HTML_INDEXBUTTONALL,
+ wxID_HTML_NOTEBOOK,
+ wxID_HTML_SEARCHPAGE,
+ wxID_HTML_SEARCHTEXT,
+ wxID_HTML_SEARCHLIST,
+ wxID_HTML_SEARCHBUTTON,
+ wxID_HTML_SEARCHCHOICE,
+ wxID_HTML_COUNTINFO
+};
+
+#endif // wxUSE_WXHTML_HELP
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/html/htmlcell.h
+// Purpose: wxHtmlCell class is used by wxHtmlWindow/wxHtmlWinParser
+// as a basic visual element of HTML page
+// Author: Vaclav Slavik
+// Copyright: (c) 1999-2003 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HTMLCELL_H_
+#define _WX_HTMLCELL_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_HTML
+
+#include "wx/html/htmltag.h"
+#include "wx/html/htmldefs.h"
+#include "wx/window.h"
+
+
+class WXDLLIMPEXP_FWD_HTML wxHtmlWindowInterface;
+class WXDLLIMPEXP_FWD_HTML wxHtmlLinkInfo;
+class WXDLLIMPEXP_FWD_HTML wxHtmlCell;
+class WXDLLIMPEXP_FWD_HTML wxHtmlContainerCell;
+
+
+// wxHtmlSelection is data holder with information about text selection.
+// Selection is defined by two positions (beginning and end of the selection)
+// and two leaf(!) cells at these positions.
+class WXDLLIMPEXP_HTML wxHtmlSelection
+{
+public:
+ wxHtmlSelection()
+ : m_fromPos(wxDefaultPosition), m_toPos(wxDefaultPosition),
+ m_fromCharacterPos(-1), m_toCharacterPos(-1),
+ m_fromCell(NULL), m_toCell(NULL) {}
+
+ // this version is used for the user selection defined with the mouse
+ void Set(const wxPoint& fromPos, const wxHtmlCell *fromCell,
+ const wxPoint& toPos, const wxHtmlCell *toCell);
+ void Set(const wxHtmlCell *fromCell, const wxHtmlCell *toCell);
+
+ const wxHtmlCell *GetFromCell() const { return m_fromCell; }
+ const wxHtmlCell *GetToCell() const { return m_toCell; }
+
+ // these values are in absolute coordinates:
+ const wxPoint& GetFromPos() const { return m_fromPos; }
+ const wxPoint& GetToPos() const { return m_toPos; }
+
+ // these are From/ToCell's private data
+ void ClearFromToCharacterPos() { m_toCharacterPos = m_fromCharacterPos = -1; }
+ bool AreFromToCharacterPosSet() const { return m_toCharacterPos != -1 && m_fromCharacterPos != -1; }
+
+ void SetFromCharacterPos (wxCoord pos) { m_fromCharacterPos = pos; }
+ void SetToCharacterPos (wxCoord pos) { m_toCharacterPos = pos; }
+ wxCoord GetFromCharacterPos () const { return m_fromCharacterPos; }
+ wxCoord GetToCharacterPos () const { return m_toCharacterPos; }
+
+ bool IsEmpty() const
+ { return m_fromPos == wxDefaultPosition &&
+ m_toPos == wxDefaultPosition; }
+
+private:
+ wxPoint m_fromPos, m_toPos;
+ wxCoord m_fromCharacterPos, m_toCharacterPos;
+ const wxHtmlCell *m_fromCell, *m_toCell;
+};
+
+
+
+enum wxHtmlSelectionState
+{
+ wxHTML_SEL_OUT, // currently rendered cell is outside the selection
+ wxHTML_SEL_IN, // ... is inside selection
+ wxHTML_SEL_CHANGING // ... is the cell on which selection state changes
+};
+
+// Selection state is passed to wxHtmlCell::Draw so that it can render itself
+// differently e.g. when inside text selection or outside it.
+class WXDLLIMPEXP_HTML wxHtmlRenderingState
+{
+public:
+ wxHtmlRenderingState() : m_selState(wxHTML_SEL_OUT) {}
+
+ void SetSelectionState(wxHtmlSelectionState s) { m_selState = s; }
+ wxHtmlSelectionState GetSelectionState() const { return m_selState; }
+
+ void SetFgColour(const wxColour& c) { m_fgColour = c; }
+ const wxColour& GetFgColour() const { return m_fgColour; }
+ void SetBgColour(const wxColour& c) { m_bgColour = c; }
+ const wxColour& GetBgColour() const { return m_bgColour; }
+ void SetBgMode(int m) { m_bgMode = m; }
+ int GetBgMode() const { return m_bgMode; }
+
+private:
+ wxHtmlSelectionState m_selState;
+ wxColour m_fgColour, m_bgColour;
+ int m_bgMode;
+};
+
+
+// HTML rendering customization. This class is used when rendering wxHtmlCells
+// as a callback:
+class WXDLLIMPEXP_HTML wxHtmlRenderingStyle
+{
+public:
+ virtual ~wxHtmlRenderingStyle() {}
+ virtual wxColour GetSelectedTextColour(const wxColour& clr) = 0;
+ virtual wxColour GetSelectedTextBgColour(const wxColour& clr) = 0;
+};
+
+// Standard style:
+class WXDLLIMPEXP_HTML wxDefaultHtmlRenderingStyle : public wxHtmlRenderingStyle
+{
+public:
+ virtual wxColour GetSelectedTextColour(const wxColour& clr);
+ virtual wxColour GetSelectedTextBgColour(const wxColour& clr);
+};
+
+
+// Information given to cells when drawing them. Contains rendering state,
+// selection information and rendering style object that can be used to
+// customize the output.
+class WXDLLIMPEXP_HTML wxHtmlRenderingInfo
+{
+public:
+ wxHtmlRenderingInfo() : m_selection(NULL), m_style(NULL) {}
+
+ void SetSelection(wxHtmlSelection *s) { m_selection = s; }
+ wxHtmlSelection *GetSelection() const { return m_selection; }
+
+ void SetStyle(wxHtmlRenderingStyle *style) { m_style = style; }
+ wxHtmlRenderingStyle& GetStyle() { return *m_style; }
+
+ wxHtmlRenderingState& GetState() { return m_state; }
+
+protected:
+ wxHtmlSelection *m_selection;
+ wxHtmlRenderingStyle *m_style;
+ wxHtmlRenderingState m_state;
+};
+
+
+// Flags for wxHtmlCell::FindCellByPos
+enum
+{
+ wxHTML_FIND_EXACT = 1,
+ wxHTML_FIND_NEAREST_BEFORE = 2,
+ wxHTML_FIND_NEAREST_AFTER = 4
+};
+
+
+// Superscript/subscript/normal script mode of a cell
+enum wxHtmlScriptMode
+{
+ wxHTML_SCRIPT_NORMAL,
+ wxHTML_SCRIPT_SUB,
+ wxHTML_SCRIPT_SUP
+};
+
+
+// ---------------------------------------------------------------------------
+// wxHtmlCell
+// Internal data structure. It represents fragments of parsed
+// HTML page - a word, picture, table, horizontal line and so
+// on. It is used by wxHtmlWindow to represent HTML page in
+// memory.
+// ---------------------------------------------------------------------------
+
+
+class WXDLLIMPEXP_HTML wxHtmlCell : public wxObject
+{
+public:
+ wxHtmlCell();
+ virtual ~wxHtmlCell();
+
+ void SetParent(wxHtmlContainerCell *p) {m_Parent = p;}
+ wxHtmlContainerCell *GetParent() const {return m_Parent;}
+
+ int GetPosX() const {return m_PosX;}
+ int GetPosY() const {return m_PosY;}
+ int GetWidth() const {return m_Width;}
+
+ // Returns the maximum possible length of the cell.
+ // Call Layout at least once before using GetMaxTotalWidth()
+ virtual int GetMaxTotalWidth() const { return m_Width; }
+
+ int GetHeight() const {return m_Height;}
+ int GetDescent() const {return m_Descent;}
+
+ void SetScriptMode(wxHtmlScriptMode mode, long previousBase);
+ wxHtmlScriptMode GetScriptMode() const { return m_ScriptMode; }
+ long GetScriptBaseline() { return m_ScriptBaseline; }
+
+ // Formatting cells are not visible on the screen, they only alter
+ // renderer's state.
+ bool IsFormattingCell() const { return m_Width == 0 && m_Height == 0; }
+
+ const wxString& GetId() const { return m_id; }
+ void SetId(const wxString& id) { m_id = id; }
+
+ // returns the link associated with this cell. The position is position
+ // within the cell so it varies from 0 to m_Width, from 0 to m_Height
+ virtual wxHtmlLinkInfo* GetLink(int WXUNUSED(x) = 0,
+ int WXUNUSED(y) = 0) const
+ { return m_Link; }
+
+ // Returns cursor to be used when mouse is over the cell, can be
+ // overridden by the derived classes to use a different cursor whenever the
+ // mouse is over this cell.
+ virtual wxCursor GetMouseCursor(wxHtmlWindowInterface *window) const;
+
+ // Returns cursor to be used when mouse is over the given point, can be
+ // overridden if the cursor should change depending on where exactly inside
+ // the cell the mouse is.
+ virtual wxCursor GetMouseCursorAt(wxHtmlWindowInterface *window,
+ const wxPoint& relPos) const;
+
+#if WXWIN_COMPATIBILITY_2_6
+ // this was replaced by GetMouseCursor, don't use in new code!
+ virtual wxCursor GetCursor() const;
+#endif
+
+ // return next cell among parent's cells
+ wxHtmlCell *GetNext() const {return m_Next;}
+ // returns first child cell (if there are any, i.e. if this is container):
+ virtual wxHtmlCell* GetFirstChild() const { return NULL; }
+
+ // members writing methods
+ virtual void SetPos(int x, int y) {m_PosX = x, m_PosY = y;}
+ void SetLink(const wxHtmlLinkInfo& link);
+ void SetNext(wxHtmlCell *cell) {m_Next = cell;}
+
+ // 1. adjust cell's width according to the fact that maximal possible width
+ // is w. (this has sense when working with horizontal lines, tables
+ // etc.)
+ // 2. prepare layout (=fill-in m_PosX, m_PosY (and sometime m_Height)
+ // members) = place items to fit window, according to the width w
+ virtual void Layout(int w);
+
+ // renders the cell
+ virtual void Draw(wxDC& WXUNUSED(dc),
+ int WXUNUSED(x), int WXUNUSED(y),
+ int WXUNUSED(view_y1), int WXUNUSED(view_y2),
+ wxHtmlRenderingInfo& WXUNUSED(info)) {}
+
+ // proceed drawing actions in case the cell is not visible (scrolled out of
+ // screen). This is needed to change fonts, colors and so on.
+ virtual void DrawInvisible(wxDC& WXUNUSED(dc),
+ int WXUNUSED(x), int WXUNUSED(y),
+ wxHtmlRenderingInfo& WXUNUSED(info)) {}
+
+ // This method returns pointer to the FIRST cell for that
+ // the condition
+ // is true. It first checks if the condition is true for this
+ // cell and then calls m_Next->Find(). (Note: it checks
+ // all subcells if the cell is container)
+ // Condition is unique condition identifier (see htmldefs.h)
+ // (user-defined condition IDs should start from 10000)
+ // and param is optional parameter
+ // Example : m_Cell->Find(wxHTML_COND_ISANCHOR, "news");
+ // returns pointer to anchor news
+ virtual const wxHtmlCell* Find(int condition, const void* param) const;
+
+
+ // This function is called when mouse button is clicked over the cell.
+ // Returns true if a link is clicked, false otherwise.
+ //
+ // 'window' is pointer to wxHtmlWindowInterface of the window which
+ // generated the event.
+ // HINT: if this handling is not enough for you you should use
+ // wxHtmlWidgetCell
+ virtual bool ProcessMouseClick(wxHtmlWindowInterface *window,
+ const wxPoint& pos,
+ const wxMouseEvent& event);
+
+#if WXWIN_COMPATIBILITY_2_6
+ // this was replaced by ProcessMouseClick, don't use in new code!
+ virtual void OnMouseClick(wxWindow *window,
+ int x, int y, const wxMouseEvent& event);
+#endif
+
+ // This method used to adjust pagebreak position. The parameter is variable
+ // that contains y-coordinate of page break (= horizontal line that should
+ // not be crossed by words, images etc.). If this cell cannot be divided
+ // into two pieces (each one on another page) then it moves the pagebreak
+ // few pixels up.
+ //
+ // Returned value : true if pagebreak was modified, false otherwise
+ // Usage : while (container->AdjustPagebreak(&p)) {}
+ virtual bool AdjustPagebreak(int *pagebreak,
+ const wxArrayInt& known_pagebreaks,
+ int pageHeight) const;
+
+ // Sets cell's behaviour on pagebreaks (see AdjustPagebreak). Default
+ // is true - the cell can be split on two pages
+ // If there is no way to fit a cell in the current page size, the cell
+ // is always split, ignoring this setting.
+ void SetCanLiveOnPagebreak(bool can) { m_CanLiveOnPagebreak = can; }
+
+ // Can the line be broken before this cell?
+ virtual bool IsLinebreakAllowed() const
+ { return !IsFormattingCell(); }
+
+ // Returns true for simple == terminal cells, i.e. not composite ones.
+ // This if for internal usage only and may disappear in future versions!
+ virtual bool IsTerminalCell() const { return true; }
+
+ // Find a cell inside this cell positioned at the given coordinates
+ // (relative to this's positions). Returns NULL if no such cell exists.
+ // The flag can be used to specify whether to look for terminal or
+ // nonterminal cells or both. In either case, returned cell is deepest
+ // cell in cells tree that contains [x,y].
+ virtual wxHtmlCell *FindCellByPos(wxCoord x, wxCoord y,
+ unsigned flags = wxHTML_FIND_EXACT) const;
+
+ // Returns absolute position of the cell on HTML canvas.
+ // If rootCell is provided, then it's considered to be the root of the
+ // hierarchy and the returned value is relative to it.
+ wxPoint GetAbsPos(wxHtmlCell *rootCell = NULL) const;
+
+ // Returns root cell of the hierarchy (i.e. grand-grand-...-parent that
+ // doesn't have a parent itself)
+ wxHtmlCell *GetRootCell() const;
+
+ // Returns first (last) terminal cell inside this cell. It may return NULL,
+ // but it is rare -- only if there are no terminals in the tree.
+ virtual wxHtmlCell *GetFirstTerminal() const
+ { return wxConstCast(this, wxHtmlCell); }
+ virtual wxHtmlCell *GetLastTerminal() const
+ { return wxConstCast(this, wxHtmlCell); }
+
+ // Returns cell's depth, i.e. how far under the root cell it is
+ // (if it is the root, depth is 0)
+ unsigned GetDepth() const;
+
+ // Returns true if the cell appears before 'cell' in natural order of
+ // cells (= as they are read). If cell A is (grand)parent of cell B,
+ // then both A.IsBefore(B) and B.IsBefore(A) always return true.
+ bool IsBefore(wxHtmlCell *cell) const;
+
+ // Converts the cell into text representation. If sel != NULL then
+ // only part of the cell inside the selection is converted.
+ virtual wxString ConvertToText(wxHtmlSelection *WXUNUSED(sel)) const
+ { return wxEmptyString; }
+
+protected:
+ // pointer to the next cell
+ wxHtmlCell *m_Next;
+ // pointer to parent cell
+ wxHtmlContainerCell *m_Parent;
+
+ // dimensions of fragment (m_Descent is used to position text & images)
+ int m_Width, m_Height, m_Descent;
+ // position where the fragment is drawn:
+ int m_PosX, m_PosY;
+
+ // superscript/subscript/normal:
+ wxHtmlScriptMode m_ScriptMode;
+ long m_ScriptBaseline;
+
+ // destination address if this fragment is hypertext link, NULL otherwise
+ wxHtmlLinkInfo *m_Link;
+ // true if this cell can be placed on pagebreak, false otherwise
+ bool m_CanLiveOnPagebreak;
+ // unique identifier of the cell, generated from "id" property of tags
+ wxString m_id;
+
+ DECLARE_ABSTRACT_CLASS(wxHtmlCell)
+ wxDECLARE_NO_COPY_CLASS(wxHtmlCell);
+};
+
+
+
+
+// ----------------------------------------------------------------------------
+// Inherited cells:
+// ----------------------------------------------------------------------------
+
+
+// ----------------------------------------------------------------------------
+// wxHtmlWordCell
+// Single word in input stream.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_HTML wxHtmlWordCell : public wxHtmlCell
+{
+public:
+ wxHtmlWordCell(const wxString& word, const wxDC& dc);
+ void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
+ wxHtmlRenderingInfo& info);
+ virtual wxCursor GetMouseCursor(wxHtmlWindowInterface *window) const;
+ virtual wxString ConvertToText(wxHtmlSelection *sel) const;
+ bool IsLinebreakAllowed() const { return m_allowLinebreak; }
+
+ void SetPreviousWord(wxHtmlWordCell *cell);
+
+protected:
+ virtual wxString GetAllAsText() const
+ { return m_Word; }
+ virtual wxString GetPartAsText(int begin, int end) const
+ { return m_Word.Mid(begin, end - begin); }
+
+ void SetSelectionPrivPos(const wxDC& dc, wxHtmlSelection *s) const;
+ void Split(const wxDC& dc,
+ const wxPoint& selFrom, const wxPoint& selTo,
+ unsigned& pos1, unsigned& pos2) const;
+
+ wxString m_Word;
+ bool m_allowLinebreak;
+
+ DECLARE_ABSTRACT_CLASS(wxHtmlWordCell)
+ wxDECLARE_NO_COPY_CLASS(wxHtmlWordCell);
+};
+
+
+// wxHtmlWordCell specialization for storing text fragments with embedded
+// '\t's; these differ from normal words in that the displayed text is
+// different from the text copied to clipboard
+class WXDLLIMPEXP_HTML wxHtmlWordWithTabsCell : public wxHtmlWordCell
+{
+public:
+ wxHtmlWordWithTabsCell(const wxString& word,
+ const wxString& wordOrig,
+ size_t linepos,
+ const wxDC& dc)
+ : wxHtmlWordCell(word, dc),
+ m_wordOrig(wordOrig),
+ m_linepos(linepos)
+ {}
+
+protected:
+ virtual wxString GetAllAsText() const;
+ virtual wxString GetPartAsText(int begin, int end) const;
+
+ wxString m_wordOrig;
+ size_t m_linepos;
+};
+
+
+// Container contains other cells, thus forming tree structure of rendering
+// elements. Basic code of layout algorithm is contained in this class.
+class WXDLLIMPEXP_HTML wxHtmlContainerCell : public wxHtmlCell
+{
+public:
+ wxHtmlContainerCell(wxHtmlContainerCell *parent);
+ virtual ~wxHtmlContainerCell();
+
+ virtual void Layout(int w);
+ virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
+ wxHtmlRenderingInfo& info);
+ virtual void DrawInvisible(wxDC& dc, int x, int y,
+ wxHtmlRenderingInfo& info);
+
+ virtual bool AdjustPagebreak(int *pagebreak,
+ const wxArrayInt& known_pagebreaks,
+ int pageHeight) const;
+
+ // insert cell at the end of m_Cells list
+ void InsertCell(wxHtmlCell *cell);
+
+ // sets horizontal/vertical alignment
+ void SetAlignHor(int al) {m_AlignHor = al; m_LastLayout = -1;}
+ int GetAlignHor() const {return m_AlignHor;}
+ void SetAlignVer(int al) {m_AlignVer = al; m_LastLayout = -1;}
+ int GetAlignVer() const {return m_AlignVer;}
+
+ // sets left-border indentation. units is one of wxHTML_UNITS_* constants
+ // what is combination of wxHTML_INDENT_*
+ void SetIndent(int i, int what, int units = wxHTML_UNITS_PIXELS);
+ // returns the indentation. ind is one of wxHTML_INDENT_* constants
+ int GetIndent(int ind) const;
+ // returns type of value returned by GetIndent(ind)
+ int GetIndentUnits(int ind) const;
+
+ // sets alignment info based on given tag's params
+ void SetAlign(const wxHtmlTag& tag);
+ // sets floating width adjustment
+ // (examples : 32 percent of parent container,
+ // -15 pixels percent (this means 100 % - 15 pixels)
+ void SetWidthFloat(int w, int units) {m_WidthFloat = w; m_WidthFloatUnits = units; m_LastLayout = -1;}
+ void SetWidthFloat(const wxHtmlTag& tag, double pixel_scale = 1.0);
+ // sets minimal height of this container.
+ void SetMinHeight(int h, int align = wxHTML_ALIGN_TOP) {m_MinHeight = h; m_MinHeightAlign = align; m_LastLayout = -1;}
+
+ void SetBackgroundColour(const wxColour& clr) {m_BkColour = clr;}
+ // returns background colour (of wxNullColour if none set), so that widgets can
+ // adapt to it:
+ wxColour GetBackgroundColour();
+ void SetBorder(const wxColour& clr1, const wxColour& clr2, int border = 1) {m_Border = border; m_BorderColour1 = clr1, m_BorderColour2 = clr2;}
+ virtual wxHtmlLinkInfo* GetLink(int x = 0, int y = 0) const;
+ virtual const wxHtmlCell* Find(int condition, const void* param) const;
+
+#if WXWIN_COMPATIBILITY_2_6
+ // this was replaced by ProcessMouseClick, don't use in new code!
+ virtual void OnMouseClick(wxWindow *window,
+ int x, int y, const wxMouseEvent& event);
+#endif
+ virtual bool ProcessMouseClick(wxHtmlWindowInterface *window,
+ const wxPoint& pos,
+ const wxMouseEvent& event);
+
+ virtual wxHtmlCell* GetFirstChild() const { return m_Cells; }
+
+ // returns last child cell:
+ wxHtmlCell* GetLastChild() const { return m_LastCell; }
+
+ // see comment in wxHtmlCell about this method
+ virtual bool IsTerminalCell() const { return false; }
+
+ virtual wxHtmlCell *FindCellByPos(wxCoord x, wxCoord y,
+ unsigned flags = wxHTML_FIND_EXACT) const;
+
+ virtual wxHtmlCell *GetFirstTerminal() const;
+ virtual wxHtmlCell *GetLastTerminal() const;
+
+
+ // Removes indentation on top or bottom of the container (i.e. above or
+ // below first/last terminal cell). For internal use only.
+ virtual void RemoveExtraSpacing(bool top, bool bottom);
+
+ // Returns the maximum possible length of the container.
+ // Call Layout at least once before using GetMaxTotalWidth()
+ virtual int GetMaxTotalWidth() const { return m_MaxTotalWidth; }
+
+protected:
+ void UpdateRenderingStatePre(wxHtmlRenderingInfo& info,
+ wxHtmlCell *cell) const;
+ void UpdateRenderingStatePost(wxHtmlRenderingInfo& info,
+ wxHtmlCell *cell) const;
+
+protected:
+ int m_IndentLeft, m_IndentRight, m_IndentTop, m_IndentBottom;
+ // indentation of subcells. There is always m_Indent pixels
+ // big space between given border of the container and the subcells
+ // it m_Indent < 0 it is in PERCENTS, otherwise it is in pixels
+ int m_MinHeight, m_MinHeightAlign;
+ // minimal height.
+ wxHtmlCell *m_Cells, *m_LastCell;
+ // internal cells, m_Cells points to the first of them, m_LastCell to the last one.
+ // (LastCell is needed only to speed-up InsertCell)
+ int m_AlignHor, m_AlignVer;
+ // alignment horizontal and vertical (left, center, right)
+ int m_WidthFloat, m_WidthFloatUnits;
+ // width float is used in adjustWidth
+ wxColour m_BkColour;
+ // background color of this container
+ int m_Border;
+ // border size. Draw only if m_Border > 0
+ wxColour m_BorderColour1, m_BorderColour2;
+ // borders color of this container
+ int m_LastLayout;
+ // if != -1 then call to Layout may be no-op
+ // if previous call to Layout has same argument
+ int m_MaxTotalWidth;
+ // Maximum possible length if ignoring line wrap
+
+
+ DECLARE_ABSTRACT_CLASS(wxHtmlContainerCell)
+ wxDECLARE_NO_COPY_CLASS(wxHtmlContainerCell);
+};
+
+
+
+// ---------------------------------------------------------------------------
+// wxHtmlColourCell
+// Color changer.
+// ---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_HTML wxHtmlColourCell : public wxHtmlCell
+{
+public:
+ wxHtmlColourCell(const wxColour& clr, int flags = wxHTML_CLR_FOREGROUND) : wxHtmlCell() {m_Colour = clr; m_Flags = flags;}
+ virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
+ wxHtmlRenderingInfo& info);
+ virtual void DrawInvisible(wxDC& dc, int x, int y,
+ wxHtmlRenderingInfo& info);
+
+protected:
+ wxColour m_Colour;
+ unsigned m_Flags;
+
+ DECLARE_ABSTRACT_CLASS(wxHtmlColourCell)
+ wxDECLARE_NO_COPY_CLASS(wxHtmlColourCell);
+};
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlFontCell
+// Sets actual font used for text rendering
+//--------------------------------------------------------------------------------
+
+class WXDLLIMPEXP_HTML wxHtmlFontCell : public wxHtmlCell
+{
+public:
+ wxHtmlFontCell(wxFont *font) : wxHtmlCell() { m_Font = (*font); }
+ virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
+ wxHtmlRenderingInfo& info);
+ virtual void DrawInvisible(wxDC& dc, int x, int y,
+ wxHtmlRenderingInfo& info);
+
+protected:
+ wxFont m_Font;
+
+ DECLARE_ABSTRACT_CLASS(wxHtmlFontCell)
+ wxDECLARE_NO_COPY_CLASS(wxHtmlFontCell);
+};
+
+
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlwidgetCell
+// This cell is connected with wxWindow object
+// You can use it to insert windows into HTML page
+// (buttons, input boxes etc.)
+//--------------------------------------------------------------------------------
+
+class WXDLLIMPEXP_HTML wxHtmlWidgetCell : public wxHtmlCell
+{
+public:
+ // !!! wnd must have correct parent!
+ // if w != 0 then the m_Wnd has 'floating' width - it adjust
+ // it's width according to parent container's width
+ // (w is percent of parent's width)
+ wxHtmlWidgetCell(wxWindow *wnd, int w = 0);
+ virtual ~wxHtmlWidgetCell() { m_Wnd->Destroy(); }
+ virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
+ wxHtmlRenderingInfo& info);
+ virtual void DrawInvisible(wxDC& dc, int x, int y,
+ wxHtmlRenderingInfo& info);
+ virtual void Layout(int w);
+
+protected:
+ wxWindow* m_Wnd;
+ int m_WidthFloat;
+ // width float is used in adjustWidth (it is in percents)
+
+ DECLARE_ABSTRACT_CLASS(wxHtmlWidgetCell)
+ wxDECLARE_NO_COPY_CLASS(wxHtmlWidgetCell);
+};
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlLinkInfo
+// Internal data structure. It represents hypertext link
+//--------------------------------------------------------------------------------
+
+class WXDLLIMPEXP_HTML wxHtmlLinkInfo : public wxObject
+{
+public:
+ wxHtmlLinkInfo() : wxObject()
+ { m_Href = m_Target = wxEmptyString; m_Event = NULL, m_Cell = NULL; }
+ wxHtmlLinkInfo(const wxString& href, const wxString& target = wxEmptyString) : wxObject()
+ { m_Href = href; m_Target = target; m_Event = NULL, m_Cell = NULL; }
+ wxHtmlLinkInfo(const wxHtmlLinkInfo& l) : wxObject()
+ { m_Href = l.m_Href, m_Target = l.m_Target, m_Event = l.m_Event;
+ m_Cell = l.m_Cell; }
+ wxHtmlLinkInfo& operator=(const wxHtmlLinkInfo& l)
+ { m_Href = l.m_Href, m_Target = l.m_Target, m_Event = l.m_Event;
+ m_Cell = l.m_Cell; return *this; }
+
+ void SetEvent(const wxMouseEvent *e) { m_Event = e; }
+ void SetHtmlCell(const wxHtmlCell *e) { m_Cell = e; }
+
+ wxString GetHref() const { return m_Href; }
+ wxString GetTarget() const { return m_Target; }
+ const wxMouseEvent* GetEvent() const { return m_Event; }
+ const wxHtmlCell* GetHtmlCell() const { return m_Cell; }
+
+private:
+ wxString m_Href, m_Target;
+ const wxMouseEvent *m_Event;
+ const wxHtmlCell *m_Cell;
+};
+
+
+
+// ----------------------------------------------------------------------------
+// wxHtmlTerminalCellsInterator
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_HTML wxHtmlTerminalCellsInterator
+{
+public:
+ wxHtmlTerminalCellsInterator(const wxHtmlCell *from, const wxHtmlCell *to)
+ : m_to(to), m_pos(from) {}
+
+ operator bool() const { return m_pos != NULL; }
+ const wxHtmlCell* operator++();
+ const wxHtmlCell* operator->() const { return m_pos; }
+ const wxHtmlCell* operator*() const { return m_pos; }
+
+private:
+ const wxHtmlCell *m_to, *m_pos;
+};
+
+
+
+#endif // wxUSE_HTML
+
+#endif // _WX_HTMLCELL_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/html/htmldefs.h
+// Purpose: constants for wxhtml library
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef _WX_HTMLDEFS_H_
+#define _WX_HTMLDEFS_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_HTML
+
+//--------------------------------------------------------------------------------
+// ALIGNMENTS
+// Describes alignment of text etc. in containers
+//--------------------------------------------------------------------------------
+
+#define wxHTML_ALIGN_LEFT 0x0000
+#define wxHTML_ALIGN_RIGHT 0x0002
+#define wxHTML_ALIGN_JUSTIFY 0x0010
+
+#define wxHTML_ALIGN_TOP 0x0004
+#define wxHTML_ALIGN_BOTTOM 0x0008
+
+#define wxHTML_ALIGN_CENTER 0x0001
+
+
+
+//--------------------------------------------------------------------------------
+// COLOR MODES
+// Used by wxHtmlColourCell to determine clr of what is changing
+//--------------------------------------------------------------------------------
+
+#define wxHTML_CLR_FOREGROUND 0x0001
+#define wxHTML_CLR_BACKGROUND 0x0002
+#define wxHTML_CLR_TRANSPARENT_BACKGROUND 0x0004
+
+
+
+//--------------------------------------------------------------------------------
+// UNITS
+// Used to specify units
+//--------------------------------------------------------------------------------
+
+#define wxHTML_UNITS_PIXELS 0x0001
+#define wxHTML_UNITS_PERCENT 0x0002
+
+
+
+//--------------------------------------------------------------------------------
+// INDENTS
+// Used to specify indetation relatives
+//--------------------------------------------------------------------------------
+
+#define wxHTML_INDENT_LEFT 0x0010
+#define wxHTML_INDENT_RIGHT 0x0020
+#define wxHTML_INDENT_TOP 0x0040
+#define wxHTML_INDENT_BOTTOM 0x0080
+
+#define wxHTML_INDENT_HORIZONTAL (wxHTML_INDENT_LEFT | wxHTML_INDENT_RIGHT)
+#define wxHTML_INDENT_VERTICAL (wxHTML_INDENT_TOP | wxHTML_INDENT_BOTTOM)
+#define wxHTML_INDENT_ALL (wxHTML_INDENT_VERTICAL | wxHTML_INDENT_HORIZONTAL)
+
+
+
+
+//--------------------------------------------------------------------------------
+// FIND CONDITIONS
+// Identifiers of wxHtmlCell's Find() conditions
+//--------------------------------------------------------------------------------
+
+#define wxHTML_COND_ISANCHOR 1
+ // Finds the anchor of 'param' name (pointer to wxString).
+
+#define wxHTML_COND_ISIMAGEMAP 2
+ // Finds imagemap of 'param' name (pointer to wxString).
+ // (used exclusively by m_image.cpp)
+
+#define wxHTML_COND_USER 10000
+ // User-defined conditions should start from this number
+
+
+//--------------------------------------------------------------------------------
+// INTERNALS
+// wxHTML internal constants
+//--------------------------------------------------------------------------------
+
+ /* size of one scroll step of wxHtmlWindow in pixels */
+#define wxHTML_SCROLL_STEP 16
+
+ /* size of temporary buffer used during parsing */
+#define wxHTML_BUFLEN 1024
+
+#endif // wxUSE_HTML
+
+#endif // _WX_HTMLDEFS_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/html/htmlfilt.h
+// Purpose: filters
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HTMLFILT_H_
+#define _WX_HTMLFILT_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_HTML
+
+#include "wx/filesys.h"
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlFilter
+// This class is input filter. It can "translate" files
+// in non-HTML format to HTML format
+// interface to access certain
+// kinds of files (HTPP, FTP, local, tar.gz etc..)
+//--------------------------------------------------------------------------------
+
+class WXDLLIMPEXP_HTML wxHtmlFilter : public wxObject
+{
+ DECLARE_ABSTRACT_CLASS(wxHtmlFilter)
+
+public:
+ wxHtmlFilter() : wxObject() {}
+ virtual ~wxHtmlFilter() {}
+
+ // returns true if this filter is able to open&read given file
+ virtual bool CanRead(const wxFSFile& file) const = 0;
+
+ // Reads given file and returns HTML document.
+ // Returns empty string if opening failed
+ virtual wxString ReadFile(const wxFSFile& file) const = 0;
+};
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlFilterPlainText
+// This filter is used as default filter if no other can
+// be used (= uknown type of file). It is used by
+// wxHtmlWindow itself.
+//--------------------------------------------------------------------------------
+
+
+class WXDLLIMPEXP_HTML wxHtmlFilterPlainText : public wxHtmlFilter
+{
+ DECLARE_DYNAMIC_CLASS(wxHtmlFilterPlainText)
+
+public:
+ virtual bool CanRead(const wxFSFile& file) const;
+ virtual wxString ReadFile(const wxFSFile& file) const;
+};
+
+//--------------------------------------------------------------------------------
+// wxHtmlFilterHTML
+// filter for text/html
+//--------------------------------------------------------------------------------
+
+class wxHtmlFilterHTML : public wxHtmlFilter
+{
+ DECLARE_DYNAMIC_CLASS(wxHtmlFilterHTML)
+
+ public:
+ virtual bool CanRead(const wxFSFile& file) const;
+ virtual wxString ReadFile(const wxFSFile& file) const;
+};
+
+
+
+#endif // wxUSE_HTML
+
+#endif // _WX_HTMLFILT_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/html/htmlpars.h
+// Purpose: wxHtmlParser class (generic parser)
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HTMLPARS_H_
+#define _WX_HTMLPARS_H_
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#include "wx/html/htmltag.h"
+#include "wx/filesys.h"
+#include "wx/hashmap.h"
+#include "wx/hashset.h"
+#include "wx/vector.h"
+#include "wx/fontenc.h"
+
+class WXDLLIMPEXP_FWD_BASE wxMBConv;
+class WXDLLIMPEXP_FWD_HTML wxHtmlParser;
+class WXDLLIMPEXP_FWD_HTML wxHtmlTagHandler;
+class WXDLLIMPEXP_FWD_HTML wxHtmlEntitiesParser;
+
+class wxHtmlTextPieces;
+class wxHtmlParserState;
+
+WX_DECLARE_HASH_SET_WITH_DECL_PTR(wxHtmlTagHandler*,
+ wxPointerHash, wxPointerEqual,
+ wxHtmlTagHandlersSet,
+ class WXDLLIMPEXP_HTML);
+WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxHtmlTagHandler*,
+ wxHtmlTagHandlersHash,
+ class WXDLLIMPEXP_HTML);
+
+
+enum wxHtmlURLType
+{
+ wxHTML_URL_PAGE,
+ wxHTML_URL_IMAGE,
+ wxHTML_URL_OTHER
+};
+
+// This class handles generic parsing of HTML document : it scans
+// the document and divides it into blocks of tags (where one block
+// consists of starting and ending tag and of text between these
+// 2 tags.
+class WXDLLIMPEXP_HTML wxHtmlParser : public wxObject
+{
+ DECLARE_ABSTRACT_CLASS(wxHtmlParser)
+
+public:
+ wxHtmlParser();
+ virtual ~wxHtmlParser();
+
+ // Sets the class which will be used for opening files
+ void SetFS(wxFileSystem *fs) { m_FS = fs; }
+
+ wxFileSystem* GetFS() const { return m_FS; }
+
+ // Opens file if the parser is allowed to open given URL (may be forbidden
+ // for security reasons)
+ virtual wxFSFile *OpenURL(wxHtmlURLType type, const wxString& url) const;
+
+ // You can simply call this method when you need parsed output.
+ // This method does these things:
+ // 1. call InitParser(source);
+ // 2. call DoParsing();
+ // 3. call GetProduct(); (its return value is then returned)
+ // 4. call DoneParser();
+ wxObject* Parse(const wxString& source);
+
+ // Sets the source. This must be called before running Parse() method.
+ virtual void InitParser(const wxString& source);
+ // This must be called after Parse().
+ virtual void DoneParser();
+
+ // May be called during parsing to immediately return from Parse().
+ virtual void StopParsing() { m_stopParsing = true; }
+
+ // Parses the m_Source from begin_pos to end_pos-1.
+ // (in noparams version it parses whole m_Source)
+ void DoParsing(const wxString::const_iterator& begin_pos,
+ const wxString::const_iterator& end_pos);
+ void DoParsing();
+
+ // Returns pointer to the tag at parser's current position
+ wxHtmlTag *GetCurrentTag() const { return m_CurTag; }
+
+ // Returns product of parsing
+ // Returned value is result of parsing of the part. The type of this result
+ // depends on internal representation in derived parser
+ // (see wxHtmlWinParser for details).
+ virtual wxObject* GetProduct() = 0;
+
+ // adds handler to the list & hash table of handlers.
+ virtual void AddTagHandler(wxHtmlTagHandler *handler);
+
+ // Forces the handler to handle additional tags (not returned by GetSupportedTags).
+ // The handler should already be in use by this parser.
+ // Example: you want to parse following pseudo-html structure:
+ // <myitems>
+ // <it name="one" value="1">
+ // <it name="two" value="2">
+ // </myitems>
+ // <it> This last it has different meaning, we don't want it to be parsed by myitems handler!
+ // handler can handle only 'myitems' (e.g. its GetSupportedTags returns "MYITEMS")
+ // you can call PushTagHandler(handler, "IT") when you find <myitems>
+ // and call PopTagHandler() when you find </myitems>
+ void PushTagHandler(wxHtmlTagHandler *handler, const wxString& tags);
+
+ // Restores state before last call to PushTagHandler
+ void PopTagHandler();
+
+ const wxString* GetSource() {return m_Source;}
+ void SetSource(const wxString& src);
+
+ // Sets HTML source and remembers current parser's state so that it can
+ // later be restored. This is useful for on-line modifications of
+ // HTML source (for example, <pre> handler replaces spaces with
+ // and newlines with <br>)
+ virtual void SetSourceAndSaveState(const wxString& src);
+ // Restores parser's state from stack or returns false if the stack is
+ // empty
+ virtual bool RestoreState();
+
+ // Returns HTML source inside the element (i.e. between the starting
+ // and ending tag)
+ wxString GetInnerSource(const wxHtmlTag& tag);
+
+ // Parses HTML string 'markup' and extracts charset info from <meta> tag
+ // if present. Returns empty string if the tag is missing.
+ // For wxHTML's internal use.
+ static wxString ExtractCharsetInformation(const wxString& markup);
+
+ // Returns entity parser object, used to substitute HTML &entities;
+ wxHtmlEntitiesParser *GetEntitiesParser() const { return m_entitiesParser; }
+
+ // Returns true if the tag starting at the given position is a comment tag
+ //
+ // p should point to '<' character and is modified to point to the closing
+ // '>' of the end comment tag if this is indeed a comment
+ static bool
+ SkipCommentTag(wxString::const_iterator& p, wxString::const_iterator end);
+
+protected:
+ // DOM structure
+ void CreateDOMTree();
+ void DestroyDOMTree();
+ void CreateDOMSubTree(wxHtmlTag *cur,
+ const wxString::const_iterator& begin_pos,
+ const wxString::const_iterator& end_pos,
+ wxHtmlTagsCache *cache);
+
+ // Adds text to the output.
+ // This is called from Parse() and must be overridden in derived classes.
+ // txt is not guaranteed to be only one word. It is largest continuous part
+ // of text (= not broken by tags)
+ virtual void AddText(const wxString& txt) = 0;
+
+ // Adds tag and proceeds it. Parse() may (and usually is) called from this method.
+ // This is called from Parse() and may be overridden.
+ // Default behaviour is that it looks for proper handler in m_Handlers. The tag is
+ // ignored if no hander is found.
+ // Derived class is *responsible* for filling in m_Handlers table.
+ virtual void AddTag(const wxHtmlTag& tag);
+
+protected:
+ // DOM tree:
+ wxHtmlTag *m_CurTag;
+ wxHtmlTag *m_Tags;
+ wxHtmlTextPieces *m_TextPieces;
+ size_t m_CurTextPiece;
+
+ const wxString *m_Source;
+
+ wxHtmlParserState *m_SavedStates;
+
+ // handlers that handle particular tags. The table is accessed by
+ // key = tag's name.
+ // This attribute MUST be filled by derived class otherwise it would
+ // be empty and no tags would be recognized
+ // (see wxHtmlWinParser for details about filling it)
+ // m_HandlersHash is for random access based on knowledge of tag name (BR, P, etc.)
+ // it may (and often does) contain more references to one object
+ // m_HandlersList is list of all handlers and it is guaranteed to contain
+ // only one reference to each handler instance.
+ wxHtmlTagHandlersSet m_HandlersSet;
+ wxHtmlTagHandlersHash m_HandlersHash;
+
+ wxDECLARE_NO_COPY_CLASS(wxHtmlParser);
+
+ // class for opening files (file system)
+ wxFileSystem *m_FS;
+ // handlers stack used by PushTagHandler and PopTagHandler
+ wxVector<wxHtmlTagHandlersHash*> m_HandlersStack;
+
+ // entity parse
+ wxHtmlEntitiesParser *m_entitiesParser;
+
+ // flag indicating that the parser should stop
+ bool m_stopParsing;
+};
+
+
+
+// This class (and derived classes) cooperates with wxHtmlParser.
+// Each recognized tag is passed to handler which is capable
+// of handling it. Each tag is handled in 3 steps:
+// 1. Handler will modifies state of parser
+// (using its public methods)
+// 2. Parser parses source between starting and ending tag
+// 3. Handler restores original state of the parser
+class WXDLLIMPEXP_HTML wxHtmlTagHandler : public wxObject
+{
+ DECLARE_ABSTRACT_CLASS(wxHtmlTagHandler)
+
+public:
+ wxHtmlTagHandler() : wxObject () { m_Parser = NULL; }
+
+ // Sets the parser.
+ // NOTE : each _instance_ of handler is guaranteed to be called
+ // only by one parser. This means you don't have to care about
+ // reentrancy.
+ virtual void SetParser(wxHtmlParser *parser)
+ { m_Parser = parser; }
+
+ // Get the parser associated with this tag handler.
+ wxHtmlParser* GetParser() const { return m_Parser; }
+
+ // Returns list of supported tags. The list is in uppercase and
+ // tags are delimited by ','.
+ // Example : "I,B,FONT,P"
+ // is capable of handling italic, bold, font and paragraph tags
+ virtual wxString GetSupportedTags() = 0;
+
+ // This is hadling core method. It does all the Steps 1-3.
+ // To process step 2, you can call ParseInner()
+ // returned value : true if it called ParseInner(),
+ // false etherwise
+ virtual bool HandleTag(const wxHtmlTag& tag) = 0;
+
+protected:
+ // parses input between beginning and ending tag.
+ // m_Parser must be set.
+ void ParseInner(const wxHtmlTag& tag)
+ { m_Parser->DoParsing(tag.GetBeginIter(), tag.GetEndIter1()); }
+
+ // Parses given source as if it was tag's inner code (see
+ // wxHtmlParser::GetInnerSource). Unlike ParseInner(), this method lets
+ // you specify the source code to parse. This is useful when you need to
+ // modify the inner text before parsing.
+ void ParseInnerSource(const wxString& source);
+
+ wxHtmlParser *m_Parser;
+
+ wxDECLARE_NO_COPY_CLASS(wxHtmlTagHandler);
+};
+
+
+// This class is used to parse HTML entities in strings. It can handle
+// both named entities and &#xxxx entries where xxxx is Unicode code.
+class WXDLLIMPEXP_HTML wxHtmlEntitiesParser : public wxObject
+{
+ DECLARE_DYNAMIC_CLASS(wxHtmlEntitiesParser)
+
+public:
+ wxHtmlEntitiesParser();
+ virtual ~wxHtmlEntitiesParser();
+
+ // Sets encoding of output string.
+ // Has no effect if wxUSE_UNICODE==1
+#if wxUSE_UNICODE
+ void SetEncoding(wxFontEncoding WXUNUSED(encoding)) {}
+#else
+ void SetEncoding(wxFontEncoding encoding);
+#endif
+
+ // Parses entities in input and replaces them with respective characters
+ // (with respect to output encoding)
+ wxString Parse(const wxString& input) const;
+
+ // Returns character for given entity or 0 if the enity is unknown
+ wxChar GetEntityChar(const wxString& entity) const;
+
+ // Returns character that represents given Unicode code
+#if wxUSE_UNICODE
+ wxChar GetCharForCode(unsigned code) const { return (wxChar)code; }
+#else
+ wxChar GetCharForCode(unsigned code) const;
+#endif
+
+protected:
+#if !wxUSE_UNICODE
+ wxMBConv *m_conv;
+ wxFontEncoding m_encoding;
+#endif
+
+ wxDECLARE_NO_COPY_CLASS(wxHtmlEntitiesParser);
+};
+
+
+#endif
+
+#endif // _WX_HTMLPARS_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/html/htmlprep.h
+// Purpose: HTML processor
+// Author: Vaclav Slavik
+// Copyright: (c) 2001 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HTMLPREP_H_
+#define _WX_HTMLPREP_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_HTML
+
+#include "wx/string.h"
+
+// Priority of preprocessor in the chain. The higher, the earlier it is used
+enum
+{
+ wxHTML_PRIORITY_DONTCARE = 128, // if the order doesn't matter, use this
+ // priority
+ wxHTML_PRIORITY_SYSTEM = 256 // >=256 is only for wxHTML's internals
+};
+
+// Classes derived from this class serve as simple text processors for
+// wxHtmlWindow. wxHtmlWindow runs HTML markup through all registered
+// processors before displaying it, thus allowing for on-the-fly
+// modifications of the markup.
+
+class WXDLLIMPEXP_HTML wxHtmlProcessor : public wxObject
+{
+ DECLARE_ABSTRACT_CLASS(wxHtmlProcessor)
+
+public:
+ wxHtmlProcessor() : wxObject(), m_enabled(true) {}
+ virtual ~wxHtmlProcessor() {}
+
+ // Process input text and return processed result
+ virtual wxString Process(const wxString& text) const = 0;
+
+ // Return priority value of this processor. The higher, the sooner
+ // is the processor applied to the text.
+ virtual int GetPriority() const { return wxHTML_PRIORITY_DONTCARE; }
+
+ // Enable/disable the processor. wxHtmlWindow won't use a disabled
+ // processor even if it is in its processors queue.
+ virtual void Enable(bool enable = true) { m_enabled = enable; }
+ bool IsEnabled() const { return m_enabled; }
+
+protected:
+ bool m_enabled;
+};
+
+#endif // wxUSE_HTML
+
+#endif // _WX_HTMLPROC_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/html/htmltag.h
+// Purpose: wxHtmlTag class (represents single tag)
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HTMLTAG_H_
+#define _WX_HTMLTAG_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_HTML
+
+#include "wx/object.h"
+#include "wx/arrstr.h"
+
+class WXDLLIMPEXP_FWD_CORE wxColour;
+class WXDLLIMPEXP_FWD_HTML wxHtmlEntitiesParser;
+
+//-----------------------------------------------------------------------------
+// wxHtmlTagsCache
+// - internal wxHTML class, do not use!
+//-----------------------------------------------------------------------------
+
+class wxHtmlTagsCacheData;
+
+class WXDLLIMPEXP_HTML wxHtmlTagsCache
+{
+private:
+ wxHtmlTagsCacheData *m_Cache;
+ int m_CachePos;
+
+ wxHtmlTagsCacheData& Cache() { return *m_Cache; }
+
+public:
+ wxHtmlTagsCache() {m_Cache = NULL;}
+ wxHtmlTagsCache(const wxString& source);
+ virtual ~wxHtmlTagsCache();
+
+ // Finds parameters for tag starting at at and fills the variables
+ void QueryTag(const wxString::const_iterator& at,
+ const wxString::const_iterator& inputEnd,
+ wxString::const_iterator *end1,
+ wxString::const_iterator *end2,
+ bool *hasEnding);
+
+ wxDECLARE_NO_COPY_CLASS(wxHtmlTagsCache);
+};
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlTag
+// This represents single tag. It is used as internal structure
+// by wxHtmlParser.
+//--------------------------------------------------------------------------------
+
+class WXDLLIMPEXP_HTML wxHtmlTag
+{
+protected:
+ // constructs wxHtmlTag object based on HTML tag.
+ // The tag begins (with '<' character) at position pos in source
+ // end_pos is position where parsing ends (usually end of document)
+ wxHtmlTag(wxHtmlTag *parent,
+ const wxString *source,
+ const wxString::const_iterator& pos,
+ const wxString::const_iterator& end_pos,
+ wxHtmlTagsCache *cache,
+ wxHtmlEntitiesParser *entParser);
+ friend class wxHtmlParser;
+public:
+ ~wxHtmlTag();
+
+ wxHtmlTag *GetParent() const {return m_Parent;}
+ wxHtmlTag *GetFirstSibling() const;
+ wxHtmlTag *GetLastSibling() const;
+ wxHtmlTag *GetChildren() const { return m_FirstChild; }
+ wxHtmlTag *GetPreviousSibling() const { return m_Prev; }
+ wxHtmlTag *GetNextSibling() const {return m_Next; }
+ // Return next tag, as if tree had been flattened
+ wxHtmlTag *GetNextTag() const;
+
+ // Returns tag's name in uppercase.
+ inline wxString GetName() const {return m_Name;}
+
+ // Returns true if the tag has given parameter. Parameter
+ // should always be in uppercase.
+ // Example : <IMG SRC="test.jpg"> HasParam("SRC") returns true
+ bool HasParam(const wxString& par) const;
+
+ // Returns value of the param. Value is in uppercase unless it is
+ // enclosed with "
+ // Example : <P align=right> GetParam("ALIGN") returns (RIGHT)
+ // <P IMG SRC="WhaT.jpg"> GetParam("SRC") returns (WhaT.jpg)
+ // (or ("WhaT.jpg") if with_quotes == true)
+ wxString GetParam(const wxString& par, bool with_quotes = false) const;
+
+ // Return true if the string could be parsed as an HTML colour and false
+ // otherwise.
+ static bool ParseAsColour(const wxString& str, wxColour *clr);
+
+ // Convenience functions:
+ bool GetParamAsString(const wxString& par, wxString *str) const;
+ bool GetParamAsColour(const wxString& par, wxColour *clr) const;
+ bool GetParamAsInt(const wxString& par, int *clr) const;
+ bool GetParamAsIntOrPercent(const wxString& param,
+ int* value, bool& isPercent) const;
+
+ // Scans param like scanf() functions family does.
+ // Example : ScanParam("COLOR", "\"#%X\"", &clr);
+ // This is always with with_quotes=false
+ // Returns number of scanned values
+ // (like sscanf() does)
+ // NOTE: unlike scanf family, this function only accepts
+ // *one* parameter !
+ int ScanParam(const wxString& par, const char *format, void *param) const;
+ int ScanParam(const wxString& par, const wchar_t *format, void *param) const;
+
+ // Returns string containing all params.
+ wxString GetAllParams() const;
+
+ // return true if there is matching ending tag
+ inline bool HasEnding() const {return m_hasEnding;}
+
+ // returns beginning position of _internal_ block of text as iterator
+ // into parser's source string (see wxHtmlParser::GetSource())
+ // See explanation (returned value is marked with *):
+ // bla bla bla <MYTAG>* bla bla intenal text</MYTAG> bla bla
+ wxString::const_iterator GetBeginIter() const
+ { return m_Begin; }
+ // returns ending position of _internal_ block of text as iterator
+ // into parser's source string (see wxHtmlParser::GetSource()):
+ // bla bla bla <MYTAG> bla bla intenal text*</MYTAG> bla bla
+ wxString::const_iterator GetEndIter1() const { return m_End1; }
+ // returns end position 2 as iterator
+ // into parser's source string (see wxHtmlParser::GetSource()):
+ // bla bla bla <MYTAG> bla bla internal text</MYTAG>* bla bla
+ wxString::const_iterator GetEndIter2() const { return m_End2; }
+
+#if WXWIN_COMPATIBILITY_2_8
+ // use GetBeginIter(), GetEndIter1() and GetEndIter2() instead
+ wxDEPRECATED( inline int GetBeginPos() const );
+ wxDEPRECATED( inline int GetEndPos1() const );
+ wxDEPRECATED( inline int GetEndPos2() const );
+#endif // WXWIN_COMPATIBILITY_2_8
+
+private:
+ wxString m_Name;
+ bool m_hasEnding;
+ wxString::const_iterator m_Begin, m_End1, m_End2;
+ wxArrayString m_ParamNames, m_ParamValues;
+#if WXWIN_COMPATIBILITY_2_8
+ wxString::const_iterator m_sourceStart;
+#endif
+
+ // DOM tree relations:
+ wxHtmlTag *m_Next;
+ wxHtmlTag *m_Prev;
+ wxHtmlTag *m_FirstChild, *m_LastChild;
+ wxHtmlTag *m_Parent;
+
+ wxDECLARE_NO_COPY_CLASS(wxHtmlTag);
+};
+
+
+#if WXWIN_COMPATIBILITY_2_8
+inline int wxHtmlTag::GetBeginPos() const { return int(m_Begin - m_sourceStart); }
+inline int wxHtmlTag::GetEndPos1() const { return int(m_End1 - m_sourceStart); }
+inline int wxHtmlTag::GetEndPos2() const { return int(m_End2 - m_sourceStart); }
+#endif // WXWIN_COMPATIBILITY_2_8
+
+
+
+
+#endif // wxUSE_HTML
+
+#endif // _WX_HTMLTAG_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/html/htmlwin.h
+// Purpose: wxHtmlWindow class for parsing & displaying HTML
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HTMLWIN_H_
+#define _WX_HTMLWIN_H_
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#include "wx/window.h"
+#include "wx/scrolwin.h"
+#include "wx/config.h"
+#include "wx/stopwatch.h"
+#include "wx/html/winpars.h"
+#include "wx/html/htmlcell.h"
+#include "wx/filesys.h"
+#include "wx/html/htmlfilt.h"
+#include "wx/filename.h"
+#include "wx/bitmap.h"
+
+class wxHtmlProcessor;
+class wxHtmlWinModule;
+class wxHtmlHistoryArray;
+class wxHtmlProcessorList;
+class WXDLLIMPEXP_FWD_HTML wxHtmlWinAutoScrollTimer;
+class WXDLLIMPEXP_FWD_HTML wxHtmlCellEvent;
+class WXDLLIMPEXP_FWD_HTML wxHtmlLinkEvent;
+class WXDLLIMPEXP_FWD_CORE wxStatusBar;
+
+// wxHtmlWindow flags:
+#define wxHW_SCROLLBAR_NEVER 0x0002
+#define wxHW_SCROLLBAR_AUTO 0x0004
+#define wxHW_NO_SELECTION 0x0008
+
+#define wxHW_DEFAULT_STYLE wxHW_SCROLLBAR_AUTO
+
+/// Enum for wxHtmlWindow::OnOpeningURL and wxHtmlWindowInterface::OnOpeningURL
+enum wxHtmlOpeningStatus
+{
+ /// Open the requested URL
+ wxHTML_OPEN,
+ /// Do not open the URL
+ wxHTML_BLOCK,
+ /// Redirect to another URL (returned from OnOpeningURL)
+ wxHTML_REDIRECT
+};
+
+/**
+ Abstract interface to a HTML rendering window (such as wxHtmlWindow or
+ wxHtmlListBox) that is passed to wxHtmlWinParser. It encapsulates all
+ communication from the parser to the window.
+ */
+class WXDLLIMPEXP_HTML wxHtmlWindowInterface
+{
+public:
+ /// Ctor
+ wxHtmlWindowInterface() {}
+ virtual ~wxHtmlWindowInterface() {}
+
+ /**
+ Called by the parser to set window's title to given text.
+ */
+ virtual void SetHTMLWindowTitle(const wxString& title) = 0;
+
+ /**
+ Called when a link is clicked.
+
+ @param link information about the clicked link
+ */
+ virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link) = 0;
+
+ /**
+ Called when the parser needs to open another URL (e.g. an image).
+
+ @param type Type of the URL request (e.g. image)
+ @param url URL the parser wants to open
+ @param redirect If the return value is wxHTML_REDIRECT, then the
+ URL to redirect to will be stored in this variable
+ (the pointer must never be NULL)
+
+ @return indicator of how to treat the request
+ */
+ virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type,
+ const wxString& url,
+ wxString *redirect) const = 0;
+
+ /**
+ Converts coordinates @a pos relative to given @a cell to
+ physical coordinates in the window.
+ */
+ virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell,
+ const wxPoint& pos) const = 0;
+
+ /// Returns the window used for rendering (may be NULL).
+ virtual wxWindow* GetHTMLWindow() = 0;
+
+ /// Returns background colour to use by default.
+ virtual wxColour GetHTMLBackgroundColour() const = 0;
+
+ /// Sets window's background to colour @a clr.
+ virtual void SetHTMLBackgroundColour(const wxColour& clr) = 0;
+
+ /// Sets window's background to given bitmap.
+ virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg) = 0;
+
+ /// Sets status bar text.
+ virtual void SetHTMLStatusText(const wxString& text) = 0;
+
+ /// Type of mouse cursor
+ enum HTMLCursor
+ {
+ /// Standard mouse cursor (typically an arrow)
+ HTMLCursor_Default,
+ /// Cursor shown over links
+ HTMLCursor_Link,
+ /// Cursor shown over selectable text
+ HTMLCursor_Text
+ };
+
+ /**
+ Returns mouse cursor of given @a type.
+ */
+ virtual wxCursor GetHTMLCursor(HTMLCursor type) const = 0;
+};
+
+/**
+ Helper class that implements part of mouse handling for wxHtmlWindow and
+ wxHtmlListBox. Cursor changes and clicking on links are handled, text
+ selection is not.
+ */
+class WXDLLIMPEXP_HTML wxHtmlWindowMouseHelper
+{
+protected:
+ /**
+ Ctor.
+
+ @param iface Interface to the owner window.
+ */
+ wxHtmlWindowMouseHelper(wxHtmlWindowInterface *iface);
+
+ /**
+ Virtual dtor.
+
+ It is not really needed in this case but at leats it prevents gcc from
+ complaining about its absence.
+ */
+ virtual ~wxHtmlWindowMouseHelper() { }
+
+ /// Returns true if the mouse moved since the last call to HandleIdle
+ bool DidMouseMove() const { return m_tmpMouseMoved; }
+
+ /// Call this from EVT_MOTION event handler
+ void HandleMouseMoved();
+
+ /**
+ Call this from EVT_LEFT_UP handler (or, alternatively, EVT_LEFT_DOWN).
+
+ @param rootCell HTML cell inside which the click occured. This doesn't
+ have to be the leaf cell, it can be e.g. toplevel
+ container, but the mouse must be inside the container's
+ area, otherwise the event would be ignored.
+ @param pos Mouse position in coordinates relative to @a cell
+ @param event The event that triggered the call
+ */
+ bool HandleMouseClick(wxHtmlCell *rootCell,
+ const wxPoint& pos, const wxMouseEvent& event);
+
+ /**
+ Call this from OnInternalIdle of the HTML displaying window. Handles
+ mouse movements and must be used together with HandleMouseMoved.
+
+ @param rootCell HTML cell inside which the click occured. This doesn't
+ have to be the leaf cell, it can be e.g. toplevel
+ container, but the mouse must be inside the container's
+ area, otherwise the event would be ignored.
+ @param pos Current mouse position in coordinates relative to
+ @a cell
+ */
+ void HandleIdle(wxHtmlCell *rootCell, const wxPoint& pos);
+
+ /**
+ Called by HandleIdle when the mouse hovers over a cell. Default
+ behaviour is to do nothing.
+
+ @param cell the cell the mouse is over
+ @param x, y coordinates of mouse relative to the cell
+ */
+ virtual void OnCellMouseHover(wxHtmlCell *cell, wxCoord x, wxCoord y);
+
+ /**
+ Called by HandleMouseClick when the user clicks on a cell.
+ Default behaviour is to call wxHtmlWindowInterface::OnLinkClicked()
+ if this cell corresponds to a hypertext link.
+
+ @param cell the cell the mouse is over
+ @param x, y coordinates of mouse relative to the cell
+ @param event The event that triggered the call
+
+
+ @return true if a link was clicked, false otherwise.
+ */
+ virtual bool OnCellClicked(wxHtmlCell *cell,
+ wxCoord x, wxCoord y,
+ const wxMouseEvent& event);
+
+protected:
+ // this flag indicates if the mouse moved (used by HandleIdle)
+ bool m_tmpMouseMoved;
+ // contains last link name
+ wxHtmlLinkInfo *m_tmpLastLink;
+ // contains the last (terminal) cell which contained the mouse
+ wxHtmlCell *m_tmpLastCell;
+
+private:
+ wxHtmlWindowInterface *m_interface;
+};
+
+// ----------------------------------------------------------------------------
+// wxHtmlWindow
+// (This is probably the only class you will directly use.)
+// Purpose of this class is to display HTML page (either local
+// file or downloaded via HTTP protocol) in a window. Width of
+// window is constant - given in constructor - virtual height
+// is changed dynamically depending on page size. Once the
+// window is created you can set its content by calling
+// SetPage(text) or LoadPage(filename).
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_HTML wxHtmlWindow : public wxScrolledWindow,
+ public wxHtmlWindowInterface,
+ public wxHtmlWindowMouseHelper
+{
+ DECLARE_DYNAMIC_CLASS(wxHtmlWindow)
+ friend class wxHtmlWinModule;
+
+public:
+ wxHtmlWindow() : wxHtmlWindowMouseHelper(this) { Init(); }
+ wxHtmlWindow(wxWindow *parent, wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxHW_DEFAULT_STYLE,
+ const wxString& name = wxT("htmlWindow"))
+ : wxHtmlWindowMouseHelper(this)
+ {
+ Init();
+ Create(parent, id, pos, size, style, name);
+ }
+ virtual ~wxHtmlWindow();
+
+ bool Create(wxWindow *parent, wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxHW_SCROLLBAR_AUTO,
+ const wxString& name = wxT("htmlWindow"));
+
+ // Set HTML page and display it. !! source is HTML document itself,
+ // it is NOT address/filename of HTML document. If you want to
+ // specify document location, use LoadPage() istead
+ // Return value : false if an error occurred, true otherwise
+ virtual bool SetPage(const wxString& source);
+
+ // Append to current page
+ bool AppendToPage(const wxString& source);
+
+ // Load HTML page from given location. Location can be either
+ // a) /usr/wxGTK2/docs/html/wx.htm
+ // b) http://www.somewhere.uk/document.htm
+ // c) ftp://ftp.somesite.cz/pub/something.htm
+ // In case there is no prefix (http:,ftp:), the method
+ // will try to find it itself (1. local file, then http or ftp)
+ // After the page is loaded, the method calls SetPage() to display it.
+ // Note : you can also use path relative to previously loaded page
+ // Return value : same as SetPage
+ virtual bool LoadPage(const wxString& location);
+
+ // Loads HTML page from file
+ bool LoadFile(const wxFileName& filename);
+
+ // Returns full location of opened page
+ wxString GetOpenedPage() const {return m_OpenedPage;}
+ // Returns anchor within opened page
+ wxString GetOpenedAnchor() const {return m_OpenedAnchor;}
+ // Returns <TITLE> of opened page or empty string otherwise
+ wxString GetOpenedPageTitle() const {return m_OpenedPageTitle;}
+
+ // Sets frame in which page title will be displayed. Format is format of
+ // frame title, e.g. "HtmlHelp : %s". It must contain exactly one %s
+ void SetRelatedFrame(wxFrame* frame, const wxString& format);
+ wxFrame* GetRelatedFrame() const {return m_RelatedFrame;}
+
+#if wxUSE_STATUSBAR
+ // After(!) calling SetRelatedFrame, this sets statusbar slot where messages
+ // will be displayed. Default is -1 = no messages.
+ void SetRelatedStatusBar(int index);
+ void SetRelatedStatusBar(wxStatusBar*, int index = 0);
+#endif // wxUSE_STATUSBAR
+
+ // Sets fonts to be used when displaying HTML page.
+ void SetFonts(const wxString& normal_face, const wxString& fixed_face,
+ const int *sizes = NULL);
+
+ // Sets font sizes to be relative to the given size or the system
+ // default size; use either specified or default font
+ void SetStandardFonts(int size = -1,
+ const wxString& normal_face = wxEmptyString,
+ const wxString& fixed_face = wxEmptyString);
+
+ // Sets space between text and window borders.
+ void SetBorders(int b) {m_Borders = b;}
+
+ // Sets the bitmap to use for background (currnetly it will be tiled,
+ // when/if we have CSS support we could add other possibilities...)
+ void SetBackgroundImage(const wxBitmap& bmpBg) { m_bmpBg = bmpBg; }
+
+#if wxUSE_CONFIG
+ // Saves custom settings into cfg config. it will use the path 'path'
+ // if given, otherwise it will save info into currently selected path.
+ // saved values : things set by SetFonts, SetBorders.
+ virtual void ReadCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
+ // ...
+ virtual void WriteCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
+#endif // wxUSE_CONFIG
+
+ // Goes to previous/next page (in browsing history)
+ // Returns true if successful, false otherwise
+ bool HistoryBack();
+ bool HistoryForward();
+ bool HistoryCanBack();
+ bool HistoryCanForward();
+ // Resets history
+ void HistoryClear();
+
+ // Returns pointer to conteiners/cells structure.
+ // It should be used ONLY when printing
+ wxHtmlContainerCell* GetInternalRepresentation() const {return m_Cell;}
+
+ // Adds input filter
+ static void AddFilter(wxHtmlFilter *filter);
+
+ // Returns a pointer to the parser.
+ wxHtmlWinParser *GetParser() const { return m_Parser; }
+
+ // Adds HTML processor to this instance of wxHtmlWindow:
+ void AddProcessor(wxHtmlProcessor *processor);
+ // Adds HTML processor to wxHtmlWindow class as whole:
+ static void AddGlobalProcessor(wxHtmlProcessor *processor);
+
+
+ // -- Callbacks --
+
+ // Sets the title of the window
+ // (depending on the information passed to SetRelatedFrame() method)
+ virtual void OnSetTitle(const wxString& title);
+
+ // Called when user clicked on hypertext link. Default behaviour is to
+ // call LoadPage(loc)
+ virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
+
+ // Called when wxHtmlWindow wants to fetch data from an URL (e.g. when
+ // loading a page or loading an image). The data are downloaded if and only if
+ // OnOpeningURL returns true. If OnOpeningURL returns wxHTML_REDIRECT,
+ // it must set *redirect to the new URL
+ virtual wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType WXUNUSED(type),
+ const wxString& WXUNUSED(url),
+ wxString *WXUNUSED(redirect)) const
+ { return wxHTML_OPEN; }
+
+#if wxUSE_CLIPBOARD
+ // Helper functions to select parts of page:
+ void SelectWord(const wxPoint& pos);
+ void SelectLine(const wxPoint& pos);
+ void SelectAll();
+
+ // Convert selection to text:
+ wxString SelectionToText() { return DoSelectionToText(m_selection); }
+
+ // Converts current page to text:
+ wxString ToText();
+#endif // wxUSE_CLIPBOARD
+
+ virtual void OnInternalIdle();
+
+ /// Returns standard HTML cursor as used by wxHtmlWindow
+ static wxCursor GetDefaultHTMLCursor(HTMLCursor type);
+
+protected:
+ void Init();
+
+ // Scrolls to anchor of this name. (Anchor is #news
+ // or #features etc. it is part of address sometimes:
+ // http://www.ms.mff.cuni.cz/~vsla8348/wxhtml/index.html#news)
+ // Return value : true if anchor exists, false otherwise
+ bool ScrollToAnchor(const wxString& anchor);
+
+ // Prepares layout (= fill m_PosX, m_PosY for fragments) based on
+ // actual size of window. This method also setup scrollbars
+ void CreateLayout();
+
+ void OnPaint(wxPaintEvent& event);
+ void OnEraseBackground(wxEraseEvent& event);
+ void OnSize(wxSizeEvent& event);
+ void OnMouseMove(wxMouseEvent& event);
+ void OnMouseDown(wxMouseEvent& event);
+ void OnMouseUp(wxMouseEvent& event);
+#if wxUSE_CLIPBOARD
+ void OnKeyUp(wxKeyEvent& event);
+ void OnDoubleClick(wxMouseEvent& event);
+ void OnCopy(wxCommandEvent& event);
+ void OnClipboardEvent(wxClipboardTextEvent& event);
+ void OnMouseEnter(wxMouseEvent& event);
+ void OnMouseLeave(wxMouseEvent& event);
+ void OnMouseCaptureLost(wxMouseCaptureLostEvent& event);
+#endif // wxUSE_CLIPBOARD
+
+ // Returns new filter (will be stored into m_DefaultFilter variable)
+ virtual wxHtmlFilter *GetDefaultFilter() {return new wxHtmlFilterPlainText;}
+
+ // cleans static variables
+ static void CleanUpStatics();
+
+ // Returns true if text selection is enabled (wxClipboard must be available
+ // and wxHW_NO_SELECTION not used)
+ bool IsSelectionEnabled() const;
+
+ enum ClipboardType
+ {
+ Primary,
+ Secondary
+ };
+
+ // Copies selection to clipboard if the clipboard support is available
+ //
+ // returns true if anything was copied to clipboard, false otherwise
+ bool CopySelection(ClipboardType t = Secondary);
+
+#if wxUSE_CLIPBOARD
+ // Automatic scrolling during selection:
+ void StopAutoScrolling();
+#endif // wxUSE_CLIPBOARD
+
+ wxString DoSelectionToText(wxHtmlSelection *sel);
+
+public:
+ // wxHtmlWindowInterface methods:
+ virtual void SetHTMLWindowTitle(const wxString& title);
+ virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link);
+ virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type,
+ const wxString& url,
+ wxString *redirect) const;
+ virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell,
+ const wxPoint& pos) const;
+ virtual wxWindow* GetHTMLWindow();
+ virtual wxColour GetHTMLBackgroundColour() const;
+ virtual void SetHTMLBackgroundColour(const wxColour& clr);
+ virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg);
+ virtual void SetHTMLStatusText(const wxString& text);
+ virtual wxCursor GetHTMLCursor(HTMLCursor type) const;
+
+ // implementation of SetPage()
+ bool DoSetPage(const wxString& source);
+
+protected:
+ // This is pointer to the first cell in parsed data. (Note: the first cell
+ // is usually top one = all other cells are sub-cells of this one)
+ wxHtmlContainerCell *m_Cell;
+ // parser which is used to parse HTML input.
+ // Each wxHtmlWindow has its own parser because sharing one global
+ // parser would be problematic (because of reentrancy)
+ wxHtmlWinParser *m_Parser;
+ // contains name of actually opened page or empty string if no page opened
+ wxString m_OpenedPage;
+ // contains name of current anchor within m_OpenedPage
+ wxString m_OpenedAnchor;
+ // contains title of actually opened page or empty string if no <TITLE> tag
+ wxString m_OpenedPageTitle;
+ // class for opening files (file system)
+ wxFileSystem* m_FS;
+
+ // frame in which page title should be displayed & number of its statusbar
+ // reserved for usage with this html window
+ wxFrame *m_RelatedFrame;
+#if wxUSE_STATUSBAR
+ int m_RelatedStatusBarIndex;
+ wxStatusBar* m_RelatedStatusBar;
+#endif // wxUSE_STATUSBAR
+ wxString m_TitleFormat;
+
+ // borders (free space between text and window borders)
+ // defaults to 10 pixels.
+ int m_Borders;
+
+ // current text selection or NULL
+ wxHtmlSelection *m_selection;
+
+ // true if the user is dragging mouse to select text
+ bool m_makingSelection;
+
+#if wxUSE_CLIPBOARD
+ // time of the last doubleclick event, used to detect tripleclicks
+ // (tripleclicks are used to select whole line):
+ wxMilliClock_t m_lastDoubleClick;
+
+ // helper class to automatically scroll the window if the user is selecting
+ // text and the mouse leaves wxHtmlWindow:
+ wxHtmlWinAutoScrollTimer *m_timerAutoScroll;
+#endif // wxUSE_CLIPBOARD
+
+private:
+ // erase the window background using m_bmpBg or just solid colour if we
+ // don't have any background image
+ void DoEraseBackground(wxDC& dc);
+
+ // window content for double buffered rendering, may be invalid until it is
+ // really initialized in OnPaint()
+ wxBitmap m_backBuffer;
+
+ // background image, may be invalid
+ wxBitmap m_bmpBg;
+
+ // variables used when user is selecting text
+ wxPoint m_tmpSelFromPos;
+ wxHtmlCell *m_tmpSelFromCell;
+
+ // if >0 contents of the window is not redrawn
+ // (in order to avoid ugly blinking)
+ int m_tmpCanDrawLocks;
+
+ // list of HTML filters
+ static wxList m_Filters;
+ // this filter is used when no filter is able to read some file
+ static wxHtmlFilter *m_DefaultFilter;
+
+ // html processors array:
+ wxHtmlProcessorList *m_Processors;
+ static wxHtmlProcessorList *m_GlobalProcessors;
+
+ // browser history
+ wxHtmlHistoryArray *m_History;
+ int m_HistoryPos;
+ // if this FLAG is false, items are not added to history
+ bool m_HistoryOn;
+
+ // Flag used to communicate between OnPaint() and OnEraseBackground(), see
+ // the comments near its use.
+ bool m_isBgReallyErased;
+
+ // standard mouse cursors
+ static wxCursor *ms_cursorLink;
+ static wxCursor *ms_cursorText;
+
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxHtmlWindow);
+};
+
+class WXDLLIMPEXP_FWD_HTML wxHtmlCellEvent;
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_HTML, wxEVT_HTML_CELL_CLICKED, wxHtmlCellEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_HTML, wxEVT_HTML_CELL_HOVER, wxHtmlCellEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_HTML, wxEVT_HTML_LINK_CLICKED, wxHtmlLinkEvent );
+
+
+/*!
+ * Html cell window event
+ */
+
+class WXDLLIMPEXP_HTML wxHtmlCellEvent : public wxCommandEvent
+{
+public:
+ wxHtmlCellEvent() {}
+ wxHtmlCellEvent(wxEventType commandType, int id,
+ wxHtmlCell *cell, const wxPoint &pt,
+ const wxMouseEvent &ev)
+ : wxCommandEvent(commandType, id)
+ {
+ m_cell = cell;
+ m_pt = pt;
+ m_mouseEvent = ev;
+ m_bLinkWasClicked = false;
+ }
+
+ wxHtmlCell* GetCell() const { return m_cell; }
+ wxPoint GetPoint() const { return m_pt; }
+ wxMouseEvent GetMouseEvent() const { return m_mouseEvent; }
+
+ void SetLinkClicked(bool linkclicked) { m_bLinkWasClicked=linkclicked; }
+ bool GetLinkClicked() const { return m_bLinkWasClicked; }
+
+ // default copy ctor, assignment operator and dtor are ok
+ virtual wxEvent *Clone() const { return new wxHtmlCellEvent(*this); }
+
+private:
+ wxHtmlCell *m_cell;
+ wxMouseEvent m_mouseEvent;
+ wxPoint m_pt;
+
+ bool m_bLinkWasClicked;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHtmlCellEvent)
+};
+
+
+
+/*!
+ * Html link event
+ */
+
+class WXDLLIMPEXP_HTML wxHtmlLinkEvent : public wxCommandEvent
+{
+public:
+ wxHtmlLinkEvent() {}
+ wxHtmlLinkEvent(int id, const wxHtmlLinkInfo &linkinfo)
+ : wxCommandEvent(wxEVT_HTML_LINK_CLICKED, id)
+ {
+ m_linkInfo = linkinfo;
+ }
+
+ const wxHtmlLinkInfo &GetLinkInfo() const { return m_linkInfo; }
+
+ // default copy ctor, assignment operator and dtor are ok
+ virtual wxEvent *Clone() const { return new wxHtmlLinkEvent(*this); }
+
+private:
+ wxHtmlLinkInfo m_linkInfo;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHtmlLinkEvent)
+};
+
+
+typedef void (wxEvtHandler::*wxHtmlCellEventFunction)(wxHtmlCellEvent&);
+typedef void (wxEvtHandler::*wxHtmlLinkEventFunction)(wxHtmlLinkEvent&);
+
+#define wxHtmlCellEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxHtmlCellEventFunction, func)
+#define wxHtmlLinkEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxHtmlLinkEventFunction, func)
+
+#define EVT_HTML_CELL_CLICKED(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_HTML_CELL_CLICKED, id, wxHtmlCellEventHandler(fn))
+#define EVT_HTML_CELL_HOVER(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_HTML_CELL_HOVER, id, wxHtmlCellEventHandler(fn))
+#define EVT_HTML_LINK_CLICKED(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_HTML_LINK_CLICKED, id, wxHtmlLinkEventHandler(fn))
+
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_HTML_CELL_CLICKED wxEVT_HTML_CELL_CLICKED
+#define wxEVT_COMMAND_HTML_CELL_HOVER wxEVT_HTML_CELL_HOVER
+#define wxEVT_COMMAND_HTML_LINK_CLICKED wxEVT_HTML_LINK_CLICKED
+
+#endif // wxUSE_HTML
+
+#endif // _WX_HTMLWIN_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/html/htmprint.h
+// Purpose: html printing classes
+// Author: Vaclav Slavik
+// Created: 25/09/99
+// Copyright: (c) Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HTMPRINT_H_
+#define _WX_HTMPRINT_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_HTML & wxUSE_PRINTING_ARCHITECTURE
+
+#include "wx/html/htmlcell.h"
+#include "wx/html/winpars.h"
+#include "wx/html/htmlfilt.h"
+
+#include "wx/print.h"
+#include "wx/printdlg.h"
+
+#include <limits.h> // INT_MAX
+
+//--------------------------------------------------------------------------------
+// wxHtmlDCRenderer
+// This class is capable of rendering HTML into specified
+// portion of DC
+//--------------------------------------------------------------------------------
+
+class WXDLLIMPEXP_HTML wxHtmlDCRenderer : public wxObject
+{
+public:
+ wxHtmlDCRenderer();
+ virtual ~wxHtmlDCRenderer();
+
+ // Following 3 methods *must* be called before any call to Render:
+
+ // Assign DC to this render
+ void SetDC(wxDC *dc, double pixel_scale = 1.0)
+ { SetDC(dc, pixel_scale, pixel_scale); }
+ void SetDC(wxDC *dc, double pixel_scale, double font_scale);
+
+ // Sets size of output rectangle, in pixels. Note that you *can't* change
+ // width of the rectangle between calls to Render! (You can freely change height.)
+ void SetSize(int width, int height);
+
+ // Sets the text to be displayed.
+ // Basepath is base directory (html string would be stored there if it was in
+ // file). It is used to determine path for loading images, for example.
+ // isdir is false if basepath is filename, true if it is directory name
+ // (see wxFileSystem for detailed explanation)
+ void SetHtmlText(const wxString& html, const wxString& basepath = wxEmptyString, bool isdir = true);
+
+ // Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
+ void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = NULL);
+
+ // Sets font sizes to be relative to the given size or the system
+ // default size; use either specified or default font
+ void SetStandardFonts(int size = -1,
+ const wxString& normal_face = wxEmptyString,
+ const wxString& fixed_face = wxEmptyString);
+
+ // [x,y] is position of upper-left corner of printing rectangle (see SetSize)
+ // from is y-coordinate of the very first visible cell
+ // to is y-coordinate of the next following page break, if any
+ // Returned value is y coordinate of first cell than didn't fit onto page.
+ // Use this value as 'from' in next call to Render in order to print multiple pages
+ // document
+ // If dont_render is TRUE then nothing is rendered into DC and it only counts
+ // pixels and return y coord of the next page
+ //
+ // known_pagebreaks and number_of_pages are used only when counting pages;
+ // otherwise, their default values should be used. Their purpose is to
+ // support pagebreaks using a subset of CSS2's <DIV>. The <DIV> handler
+ // needs to know what pagebreaks have already been set so that it doesn't
+ // set the same pagebreak twice.
+ //
+ // CAUTION! Render() changes DC's user scale and does NOT restore it!
+ int Render(int x, int y, wxArrayInt& known_pagebreaks, int from = 0,
+ int dont_render = false, int to = INT_MAX);
+
+ // returns total width of the html document
+ int GetTotalWidth() const;
+
+ // returns total height of the html document
+ // (compare Render's return value with this)
+ int GetTotalHeight() const;
+
+private:
+ wxDC *m_DC;
+ wxHtmlWinParser *m_Parser;
+ wxFileSystem *m_FS;
+ wxHtmlContainerCell *m_Cells;
+ int m_MaxWidth, m_Width, m_Height;
+
+ wxDECLARE_NO_COPY_CLASS(wxHtmlDCRenderer);
+};
+
+
+
+
+
+enum {
+ wxPAGE_ODD,
+ wxPAGE_EVEN,
+ wxPAGE_ALL
+};
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlPrintout
+// This class is derived from standard wxWidgets printout class
+// and is used to print HTML documents.
+//--------------------------------------------------------------------------------
+
+
+class WXDLLIMPEXP_HTML wxHtmlPrintout : public wxPrintout
+{
+public:
+ wxHtmlPrintout(const wxString& title = wxT("Printout"));
+ virtual ~wxHtmlPrintout();
+
+ void SetHtmlText(const wxString& html, const wxString &basepath = wxEmptyString, bool isdir = true);
+ // prepares the class for printing this html document.
+ // Must be called before using the class, in fact just after constructor
+ //
+ // basepath is base directory (html string would be stored there if it was in
+ // file). It is used to determine path for loading images, for example.
+ // isdir is false if basepath is filename, true if it is directory name
+ // (see wxFileSystem for detailed explanation)
+
+ void SetHtmlFile(const wxString &htmlfile);
+ // same as SetHtmlText except that it takes regular file as the parameter
+
+ void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
+ void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
+ // sets header/footer for the document. The argument is interpreted as HTML document.
+ // You can use macros in it:
+ // @PAGENUM@ is replaced by page number
+ // @PAGESCNT@ is replaced by total number of pages
+ //
+ // pg is one of wxPAGE_ODD, wxPAGE_EVEN and wx_PAGE_ALL constants.
+ // You can set different header/footer for odd and even pages
+
+ // Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
+ void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = NULL);
+
+ // Sets font sizes to be relative to the given size or the system
+ // default size; use either specified or default font
+ void SetStandardFonts(int size = -1,
+ const wxString& normal_face = wxEmptyString,
+ const wxString& fixed_face = wxEmptyString);
+
+ void SetMargins(float top = 25.2, float bottom = 25.2, float left = 25.2, float right = 25.2,
+ float spaces = 5);
+ // sets margins in milimeters. Defaults to 1 inch for margins and 0.5cm for space
+ // between text and header and/or footer
+
+ // wxPrintout stuff:
+ bool OnPrintPage(int page);
+ bool HasPage(int page);
+ void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo);
+ bool OnBeginDocument(int startPage, int endPage);
+ void OnPreparePrinting();
+
+ // Adds input filter
+ static void AddFilter(wxHtmlFilter *filter);
+
+ // Cleanup
+ static void CleanUpStatics();
+
+private:
+ // this function is called by the base class OnPreparePrinting()
+ // implementation and by default checks whether the document fits into
+ // pageArea horizontally and warns the user if it does not and, if we're
+ // going to print and not just to preview the document, giving him the
+ // possibility to cancel printing
+ //
+ // you may override it to either suppress this check if truncation of the
+ // HTML being printed is acceptable or, on the contrary, add more checks to
+ // it, e.g. for the fit in the vertical direction if the document should
+ // always appear on a single page
+ //
+ // return true if printing should go ahead or false to cancel it (the
+ // return value is ignored when previewing)
+ virtual bool CheckFit(const wxSize& pageArea, const wxSize& docArea) const;
+
+ void RenderPage(wxDC *dc, int page);
+ // renders one page into dc
+ wxString TranslateHeader(const wxString& instr, int page);
+ // substitute @PAGENUM@ and @PAGESCNT@ by real values
+ void CountPages();
+ // counts pages and fills m_NumPages and m_PageBreaks
+
+
+private:
+ int m_NumPages;
+ wxArrayInt m_PageBreaks;
+
+ wxString m_Document, m_BasePath;
+ bool m_BasePathIsDir;
+ wxString m_Headers[2], m_Footers[2];
+
+ int m_HeaderHeight, m_FooterHeight;
+ wxHtmlDCRenderer *m_Renderer, *m_RendererHdr;
+ float m_MarginTop, m_MarginBottom, m_MarginLeft, m_MarginRight, m_MarginSpace;
+
+ // list of HTML filters
+ static wxList m_Filters;
+
+ wxDECLARE_NO_COPY_CLASS(wxHtmlPrintout);
+};
+
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlEasyPrinting
+// This class provides very simple interface to printing
+// architecture. It allows you to print HTML documents only
+// with very few commands.
+//
+// Note : do not create this class on stack only.
+// You should create an instance on app startup and
+// use this instance for all printing. Why? The class
+// stores page&printer settings in it.
+//--------------------------------------------------------------------------------
+
+class WXDLLIMPEXP_HTML wxHtmlEasyPrinting : public wxObject
+{
+public:
+ wxHtmlEasyPrinting(const wxString& name = wxT("Printing"), wxWindow *parentWindow = NULL);
+ virtual ~wxHtmlEasyPrinting();
+
+ bool PreviewFile(const wxString &htmlfile);
+ bool PreviewText(const wxString &htmltext, const wxString& basepath = wxEmptyString);
+ // Preview file / html-text for printing
+ // (and offers printing)
+ // basepath is base directory for opening subsequent files (e.g. from <img> tag)
+
+ bool PrintFile(const wxString &htmlfile);
+ bool PrintText(const wxString &htmltext, const wxString& basepath = wxEmptyString);
+ // Print file / html-text w/o preview
+
+ void PageSetup();
+ // pop up printer or page setup dialog
+
+ void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
+ void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
+ // sets header/footer for the document. The argument is interpreted as HTML document.
+ // You can use macros in it:
+ // @PAGENUM@ is replaced by page number
+ // @PAGESCNT@ is replaced by total number of pages
+ //
+ // pg is one of wxPAGE_ODD, wxPAGE_EVEN and wx_PAGE_ALL constants.
+ // You can set different header/footer for odd and even pages
+
+ void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = 0);
+ // Sets fonts to be used when displaying HTML page. (if size null then default sizes used)
+
+ // Sets font sizes to be relative to the given size or the system
+ // default size; use either specified or default font
+ void SetStandardFonts(int size = -1,
+ const wxString& normal_face = wxEmptyString,
+ const wxString& fixed_face = wxEmptyString);
+
+ wxPrintData *GetPrintData();
+ wxPageSetupDialogData *GetPageSetupData() {return m_PageSetupData;}
+ // return page setting data objects.
+ // (You can set their parameters.)
+
+ wxWindow* GetParentWindow() const { return m_ParentWindow; }
+ // get the parent window
+ void SetParentWindow(wxWindow* window) { m_ParentWindow = window; }
+ // set the parent window
+
+ const wxString& GetName() const { return m_Name; }
+ // get the printout name
+ void SetName(const wxString& name) { m_Name = name; }
+ // set the printout name
+
+protected:
+ virtual wxHtmlPrintout *CreatePrintout();
+ virtual bool DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *printout2);
+ virtual bool DoPrint(wxHtmlPrintout *printout);
+
+private:
+ wxPrintData *m_PrintData;
+ wxPageSetupDialogData *m_PageSetupData;
+ wxString m_Name;
+ int m_FontsSizesArr[7];
+ int *m_FontsSizes;
+ wxString m_FontFaceFixed, m_FontFaceNormal;
+
+ enum FontMode
+ {
+ FontMode_Explicit,
+ FontMode_Standard
+ };
+ FontMode m_fontMode;
+
+ wxString m_Headers[2], m_Footers[2];
+ wxWindow *m_ParentWindow;
+
+ wxDECLARE_NO_COPY_CLASS(wxHtmlEasyPrinting);
+};
+
+
+
+
+#endif // wxUSE_HTML & wxUSE_PRINTING_ARCHITECTURE
+
+#endif // _WX_HTMPRINT_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/html/m_templ.h
+// Purpose: Modules template file
+// Author: Vaclav Slavik
+// Copyright: (c) Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+/*
+
+DESCRIPTION:
+This is set of macros for easier writing of tag handlers. How to use it?
+See mod_fonts.cpp for example...
+
+Attention! This is quite strange C++ bastard. Before using it,
+I STRONGLY recommend reading and understanding these macros!!
+
+*/
+
+
+#ifndef _WX_M_TEMPL_H_
+#define _WX_M_TEMPL_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_HTML
+
+#include "wx/html/winpars.h"
+
+#define TAG_HANDLER_BEGIN(name,tags) \
+ class wxHTML_Handler_##name : public wxHtmlWinTagHandler \
+ { \
+ public: \
+ wxString GetSupportedTags() {return wxT(tags);}
+
+
+
+#define TAG_HANDLER_VARS \
+ private:
+
+#define TAG_HANDLER_CONSTR(name) \
+ public: \
+ wxHTML_Handler_##name () : wxHtmlWinTagHandler()
+
+
+#define TAG_HANDLER_PROC(varib) \
+ public: \
+ bool HandleTag(const wxHtmlTag& varib)
+
+
+
+#define TAG_HANDLER_END(name) \
+ };
+
+
+
+
+#define TAGS_MODULE_BEGIN(name) \
+ class wxHTML_Module##name : public wxHtmlTagsModule \
+ { \
+ DECLARE_DYNAMIC_CLASS(wxHTML_Module##name ) \
+ public: \
+ void FillHandlersTable(wxHtmlWinParser *parser) \
+ {
+
+
+
+
+#define TAGS_MODULE_ADD(handler) \
+ parser->AddTagHandler(new wxHTML_Handler_##handler);
+
+
+
+
+#define TAGS_MODULE_END(name) \
+ } \
+ }; \
+ IMPLEMENT_DYNAMIC_CLASS(wxHTML_Module##name , wxHtmlTagsModule)
+
+
+
+#endif
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/html/styleparams.h
+// Purpose: wxHtml helper code for extracting style parameters
+// Author: Nigel Paton
+// Copyright: wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HTML_STYLEPARAMS_H_
+#define _WX_HTML_STYLEPARAMS_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_HTML
+
+#include "wx/arrstr.h"
+
+class WXDLLIMPEXP_FWD_HTML wxHtmlTag;
+
+// This is a private class used by wxHTML to parse "style" attributes of HTML
+// elements. Currently both parsing and support for the parsed values is pretty
+// trivial.
+class WXDLLIMPEXP_HTML wxHtmlStyleParams
+{
+public:
+ // Construct a style parameters object corresponding to the style attribute
+ // of the given HTML tag.
+ wxHtmlStyleParams(const wxHtmlTag& tag);
+
+ // Check whether the named parameter is present or not.
+ bool HasParam(const wxString& par) const
+ {
+ return m_names.Index(par, false /* ignore case */) != wxNOT_FOUND;
+ }
+
+ // Get the value of the named parameter, return empty string if none.
+ wxString GetParam(const wxString& par) const
+ {
+ int index = m_names.Index(par, false);
+ return index == wxNOT_FOUND ? wxString() : m_values[index];
+ }
+
+private:
+ // Arrays if names and values of the parameters
+ wxArrayString
+ m_names,
+ m_values;
+};
+
+#endif // wxUSE_HTML
+
+#endif // _WX_HTML_STYLEPARAMS_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/html/winpars.h
+// Purpose: wxHtmlWinParser class (parser to be used with wxHtmlWindow)
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WINPARS_H_
+#define _WX_WINPARS_H_
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#include "wx/module.h"
+#include "wx/font.h"
+#include "wx/html/htmlpars.h"
+#include "wx/html/htmlcell.h"
+#include "wx/encconv.h"
+
+class WXDLLIMPEXP_FWD_HTML wxHtmlWindow;
+class WXDLLIMPEXP_FWD_HTML wxHtmlWindowInterface;
+class WXDLLIMPEXP_FWD_HTML wxHtmlWinParser;
+class WXDLLIMPEXP_FWD_HTML wxHtmlWinTagHandler;
+class WXDLLIMPEXP_FWD_HTML wxHtmlTagsModule;
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlWinParser
+// This class is derived from wxHtmlParser and its mail goal
+// is to parse HTML input so that it can be displayed in
+// wxHtmlWindow. It uses special wxHtmlWinTagHandler.
+//--------------------------------------------------------------------------------
+
+class WXDLLIMPEXP_HTML wxHtmlWinParser : public wxHtmlParser
+{
+ DECLARE_ABSTRACT_CLASS(wxHtmlWinParser)
+ friend class wxHtmlWindow;
+
+public:
+ wxHtmlWinParser(wxHtmlWindowInterface *wndIface = NULL);
+
+ virtual ~wxHtmlWinParser();
+
+ virtual void InitParser(const wxString& source);
+ virtual void DoneParser();
+ virtual wxObject* GetProduct();
+
+ virtual wxFSFile *OpenURL(wxHtmlURLType type, const wxString& url) const;
+
+ // Set's the DC used for parsing. If SetDC() is not called,
+ // parsing won't proceed
+ virtual void SetDC(wxDC *dc, double pixel_scale = 1.0)
+ { SetDC(dc, pixel_scale, pixel_scale); }
+ void SetDC(wxDC *dc, double pixel_scale, double font_scale);
+
+ wxDC *GetDC() {return m_DC;}
+ double GetPixelScale() {return m_PixelScale;}
+ int GetCharHeight() const {return m_CharHeight;}
+ int GetCharWidth() const {return m_CharWidth;}
+
+ // NOTE : these functions do _not_ return _actual_
+ // height/width. They return h/w of default font
+ // for this DC. If you want actual values, call
+ // GetDC()->GetChar...()
+
+ // returns interface to the rendering window
+ wxHtmlWindowInterface *GetWindowInterface() {return m_windowInterface;}
+#if WXWIN_COMPATIBILITY_2_6
+ // deprecated, use GetWindowInterface()->GetHTMLWindow() instead
+ wxDEPRECATED( wxHtmlWindow *GetWindow() );
+#endif
+
+ // Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
+ void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = NULL);
+
+ // Sets font sizes to be relative to the given size or the system
+ // default size; use either specified or default font
+ void SetStandardFonts(int size = -1,
+ const wxString& normal_face = wxEmptyString,
+ const wxString& fixed_face = wxEmptyString);
+
+ // Adds tags module. see wxHtmlTagsModule for details.
+ static void AddModule(wxHtmlTagsModule *module);
+
+ static void RemoveModule(wxHtmlTagsModule *module);
+
+ // parsing-related methods. These methods are called by tag handlers:
+
+ // Returns pointer to actual container. Common use in tag handler is :
+ // m_WParser->GetContainer()->InsertCell(new ...);
+ wxHtmlContainerCell *GetContainer() const {return m_Container;}
+
+ // opens new container. This container is sub-container of opened
+ // container. Sets GetContainer to newly created container
+ // and returns it.
+ wxHtmlContainerCell *OpenContainer();
+
+ // works like OpenContainer except that new container is not created
+ // but c is used. You can use this to directly set actual container
+ wxHtmlContainerCell *SetContainer(wxHtmlContainerCell *c);
+
+ // closes the container and sets actual Container to upper-level
+ // container
+ wxHtmlContainerCell *CloseContainer();
+
+ int GetFontSize() const {return m_FontSize;}
+ void SetFontSize(int s);
+ // Try to map a font size in points to the HTML 1-7 font size range.
+ void SetFontPointSize(int pt);
+ int GetFontBold() const {return m_FontBold;}
+ void SetFontBold(int x) {m_FontBold = x;}
+ int GetFontItalic() const {return m_FontItalic;}
+ void SetFontItalic(int x) {m_FontItalic = x;}
+ int GetFontUnderlined() const {return m_FontUnderlined;}
+ void SetFontUnderlined(int x) {m_FontUnderlined = x;}
+ int GetFontFixed() const {return m_FontFixed;}
+ void SetFontFixed(int x) {m_FontFixed = x;}
+ wxString GetFontFace() const {return GetFontFixed() ? m_FontFaceFixed : m_FontFaceNormal;}
+ void SetFontFace(const wxString& face);
+
+ int GetAlign() const {return m_Align;}
+ void SetAlign(int a) {m_Align = a;}
+
+ wxHtmlScriptMode GetScriptMode() const { return m_ScriptMode; }
+ void SetScriptMode(wxHtmlScriptMode mode) { m_ScriptMode = mode; }
+ long GetScriptBaseline() const { return m_ScriptBaseline; }
+ void SetScriptBaseline(long base) { m_ScriptBaseline = base; }
+
+ const wxColour& GetLinkColor() const { return m_LinkColor; }
+ void SetLinkColor(const wxColour& clr) { m_LinkColor = clr; }
+ const wxColour& GetActualColor() const { return m_ActualColor; }
+ void SetActualColor(const wxColour& clr) { m_ActualColor = clr ;}
+ const wxColour& GetActualBackgroundColor() const { return m_ActualBackgroundColor; }
+ void SetActualBackgroundColor(const wxColour& clr) { m_ActualBackgroundColor = clr;}
+ int GetActualBackgroundMode() const { return m_ActualBackgroundMode; }
+ void SetActualBackgroundMode(int mode) { m_ActualBackgroundMode = mode;}
+ const wxHtmlLinkInfo& GetLink() const { return m_Link; }
+ void SetLink(const wxHtmlLinkInfo& link);
+
+ // applies current parser state (link, sub/supscript, ...) to given cell
+ void ApplyStateToCell(wxHtmlCell *cell);
+
+ // Needs to be called after inserting a cell that interrupts the flow of
+ // the text like e.g. <img> and tells us to not consider any of the
+ // following space as being part of the same space run as before.
+ void StopCollapsingSpaces() { m_tmpLastWasSpace = false; }
+
+#if !wxUSE_UNICODE
+ void SetInputEncoding(wxFontEncoding enc);
+ wxFontEncoding GetInputEncoding() const { return m_InputEnc; }
+ wxFontEncoding GetOutputEncoding() const { return m_OutputEnc; }
+ wxEncodingConverter *GetEncodingConverter() const { return m_EncConv; }
+#endif
+
+ // creates font depending on m_Font* members.
+ virtual wxFont* CreateCurrentFont();
+
+ enum WhitespaceMode
+ {
+ Whitespace_Normal, // normal mode, collapse whitespace
+ Whitespace_Pre // inside <pre>, keep whitespace as-is
+ };
+
+ // change the current whitespace handling mode
+ void SetWhitespaceMode(WhitespaceMode mode) { m_whitespaceMode = mode; }
+ WhitespaceMode GetWhitespaceMode() const { return m_whitespaceMode; }
+
+protected:
+ virtual void AddText(const wxString& txt);
+
+private:
+ void FlushWordBuf(wxChar *temp, int& len);
+ void AddWord(wxHtmlWordCell *word);
+ void AddWord(const wxString& word)
+ { AddWord(new wxHtmlWordCell(word, *(GetDC()))); }
+ void AddPreBlock(const wxString& text);
+
+ bool m_tmpLastWasSpace;
+ wxChar *m_tmpStrBuf;
+ size_t m_tmpStrBufSize;
+ // temporary variables used by AddText
+ wxHtmlWindowInterface *m_windowInterface;
+ // window we're parsing for
+ double m_PixelScale, m_FontScale;
+ wxDC *m_DC;
+ // Device Context we're parsing for
+ static wxList m_Modules;
+ // list of tags modules (see wxHtmlTagsModule for details)
+ // This list is used to initialize m_Handlers member.
+
+ wxHtmlContainerCell *m_Container;
+ // current container. See Open/CloseContainer for details.
+
+ int m_FontBold, m_FontItalic, m_FontUnderlined, m_FontFixed; // this is not true,false but 1,0, we need it for indexing
+ int m_FontSize; // From 1 (smallest) to 7, default is 3.
+ wxColour m_LinkColor;
+ wxColour m_ActualColor;
+ wxColour m_ActualBackgroundColor;
+ int m_ActualBackgroundMode;
+ // basic font parameters.
+ wxHtmlLinkInfo m_Link;
+ // actual hypertext link or empty string
+ bool m_UseLink;
+ // true if m_Link is not empty
+ int m_CharHeight, m_CharWidth;
+ // average height of normal-sized text
+ int m_Align;
+ // actual alignment
+ wxHtmlScriptMode m_ScriptMode;
+ // current script mode (sub/sup/normal)
+ long m_ScriptBaseline;
+ // current sub/supscript base
+
+ wxFont* m_FontsTable[2][2][2][2][7];
+ wxString m_FontsFacesTable[2][2][2][2][7];
+#if !wxUSE_UNICODE
+ wxFontEncoding m_FontsEncTable[2][2][2][2][7];
+#endif
+ // table of loaded fonts. 1st four indexes are 0 or 1, depending on on/off
+ // state of these flags (from left to right):
+ // [bold][italic][underlined][fixed_size]
+ // last index is font size : from 0 to 6 (remapped from html sizes 1 to 7)
+ // Note : this table covers all possible combinations of fonts, but not
+ // all of them are used, so many items in table are usually NULL.
+ int m_FontsSizes[7];
+ wxString m_FontFaceFixed, m_FontFaceNormal;
+ // html font sizes and faces of fixed and proportional fonts
+
+#if !wxUSE_UNICODE
+ wxChar m_nbsp;
+ wxFontEncoding m_InputEnc, m_OutputEnc;
+ // I/O font encodings
+ wxEncodingConverter *m_EncConv;
+#endif
+
+ // current whitespace handling mode
+ WhitespaceMode m_whitespaceMode;
+
+ wxHtmlWordCell *m_lastWordCell;
+
+ // current position on line, in num. of characters; used to properly
+ // expand TABs; only updated while inside <pre>
+ int m_posColumn;
+
+ wxDECLARE_NO_COPY_CLASS(wxHtmlWinParser);
+};
+
+
+
+
+
+
+//-----------------------------------------------------------------------------
+// wxHtmlWinTagHandler
+// This is basicly wxHtmlTagHandler except
+// it is extended with protected member m_Parser pointing to
+// the wxHtmlWinParser object
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_HTML wxHtmlStyleParams;
+
+class WXDLLIMPEXP_HTML wxHtmlWinTagHandler : public wxHtmlTagHandler
+{
+ DECLARE_ABSTRACT_CLASS(wxHtmlWinTagHandler)
+
+public:
+ wxHtmlWinTagHandler() : wxHtmlTagHandler() {}
+
+ virtual void SetParser(wxHtmlParser *parser) {wxHtmlTagHandler::SetParser(parser); m_WParser = (wxHtmlWinParser*) parser;}
+
+protected:
+ wxHtmlWinParser *m_WParser; // same as m_Parser, but overcasted
+
+ void ApplyStyle(const wxHtmlStyleParams &styleParams);
+
+ wxDECLARE_NO_COPY_CLASS(wxHtmlWinTagHandler);
+};
+
+
+
+
+
+
+//----------------------------------------------------------------------------
+// wxHtmlTagsModule
+// This is basic of dynamic tag handlers binding.
+// The class provides methods for filling parser's handlers
+// hash table.
+// (See documentation for details)
+//----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_HTML wxHtmlTagsModule : public wxModule
+{
+ DECLARE_DYNAMIC_CLASS(wxHtmlTagsModule)
+
+public:
+ wxHtmlTagsModule() : wxModule() {}
+
+ virtual bool OnInit();
+ virtual void OnExit();
+
+ // This is called by wxHtmlWinParser.
+ // The method must simply call parser->AddTagHandler(new
+ // <handler_class_name>); for each handler
+ virtual void FillHandlersTable(wxHtmlWinParser * WXUNUSED(parser)) { }
+};
+
+
+#endif
+
+#endif // _WX_WINPARS_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/htmllbox.h
+// Purpose: wxHtmlListBox is a listbox whose items are wxHtmlCells
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 31.05.03
+// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HTMLLBOX_H_
+#define _WX_HTMLLBOX_H_
+
+#include "wx/vlbox.h" // base class
+#include "wx/html/htmlwin.h"
+#include "wx/ctrlsub.h"
+
+#if wxUSE_FILESYSTEM
+ #include "wx/filesys.h"
+#endif // wxUSE_FILESYSTEM
+
+class WXDLLIMPEXP_FWD_HTML wxHtmlCell;
+class WXDLLIMPEXP_FWD_HTML wxHtmlWinParser;
+class WXDLLIMPEXP_FWD_HTML wxHtmlListBoxCache;
+class WXDLLIMPEXP_FWD_HTML wxHtmlListBoxStyle;
+
+extern WXDLLIMPEXP_DATA_HTML(const char) wxHtmlListBoxNameStr[];
+extern WXDLLIMPEXP_DATA_HTML(const char) wxSimpleHtmlListBoxNameStr[];
+
+// ----------------------------------------------------------------------------
+// wxHtmlListBox
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_HTML wxHtmlListBox : public wxVListBox,
+ public wxHtmlWindowInterface,
+ public wxHtmlWindowMouseHelper
+{
+ DECLARE_ABSTRACT_CLASS(wxHtmlListBox)
+public:
+ // constructors and such
+ // ---------------------
+
+ // default constructor, you must call Create() later
+ wxHtmlListBox();
+
+ // normal constructor which calls Create() internally
+ wxHtmlListBox(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxHtmlListBoxNameStr);
+
+ // really creates the control and sets the initial number of items in it
+ // (which may be changed later with SetItemCount())
+ //
+ // the only special style which may be specified here is wxLB_MULTIPLE
+ //
+ // returns true on success or false if the control couldn't be created
+ bool Create(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxHtmlListBoxNameStr);
+
+ // destructor cleans up whatever resources we use
+ virtual ~wxHtmlListBox();
+
+ // override some base class virtuals
+ virtual void RefreshRow(size_t line);
+ virtual void RefreshRows(size_t from, size_t to);
+ virtual void RefreshAll();
+ virtual void SetItemCount(size_t count);
+
+#if wxUSE_FILESYSTEM
+ // retrieve the file system used by the wxHtmlWinParser: if you use
+ // relative paths in your HTML, you should use its ChangePathTo() method
+ wxFileSystem& GetFileSystem() { return m_filesystem; }
+ const wxFileSystem& GetFileSystem() const { return m_filesystem; }
+#endif // wxUSE_FILESYSTEM
+
+ virtual void OnInternalIdle();
+
+protected:
+ // this method must be implemented in the derived class and should return
+ // the body (i.e. without <html>) of the HTML for the given item
+ virtual wxString OnGetItem(size_t n) const = 0;
+
+ // this function may be overridden to decorate HTML returned by OnGetItem()
+ virtual wxString OnGetItemMarkup(size_t n) const;
+
+
+ // this method allows to customize the selection appearance: it may be used
+ // to specify the colour of the text which normally has the given colour
+ // colFg when it is inside the selection
+ //
+ // by default, the original colour is not used at all and all text has the
+ // same (default for this system) colour inside selection
+ virtual wxColour GetSelectedTextColour(const wxColour& colFg) const;
+
+ // this is the same as GetSelectedTextColour() but allows to customize the
+ // background colour -- this is even more rarely used as you can change it
+ // globally using SetSelectionBackground()
+ virtual wxColour GetSelectedTextBgColour(const wxColour& colBg) const;
+
+
+ // we implement both of these functions in terms of OnGetItem(), they are
+ // not supposed to be overridden by our descendants
+ virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const;
+ virtual wxCoord OnMeasureItem(size_t n) const;
+
+ // override this one to draw custom background for selected items correctly
+ virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const;
+
+ // this method may be overridden to handle clicking on a link in the
+ // listbox (by default, clicks on links are simply ignored)
+ virtual void OnLinkClicked(size_t n, const wxHtmlLinkInfo& link);
+
+ // event handlers
+ void OnSize(wxSizeEvent& event);
+ void OnMouseMove(wxMouseEvent& event);
+ void OnLeftDown(wxMouseEvent& event);
+
+
+ // common part of all ctors
+ void Init();
+
+ // ensure that the given item is cached
+ void CacheItem(size_t n) const;
+
+private:
+ // wxHtmlWindowInterface methods:
+ virtual void SetHTMLWindowTitle(const wxString& title);
+ virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link);
+ virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type,
+ const wxString& url,
+ wxString *redirect) const;
+ virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell,
+ const wxPoint& pos) const;
+ virtual wxWindow* GetHTMLWindow();
+ virtual wxColour GetHTMLBackgroundColour() const;
+ virtual void SetHTMLBackgroundColour(const wxColour& clr);
+ virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg);
+ virtual void SetHTMLStatusText(const wxString& text);
+ virtual wxCursor GetHTMLCursor(HTMLCursor type) const;
+
+ // returns index of item that contains given HTML cell
+ size_t GetItemForCell(const wxHtmlCell *cell) const;
+
+ // return physical coordinates of root wxHtmlCell of n-th item
+ wxPoint GetRootCellCoords(size_t n) const;
+
+ // Converts physical coordinates stored in @a pos into coordinates
+ // relative to the root cell of the item under mouse cursor, if any. If no
+ // cell is found under the cursor, returns false. Otherwise stores the new
+ // coordinates back into @a pos and pointer to the cell under cursor into
+ // @a cell and returns true.
+ bool PhysicalCoordsToCell(wxPoint& pos, wxHtmlCell*& cell) const;
+
+ // The opposite of PhysicalCoordsToCell: converts coordinates relative to
+ // given cell to physical coordinates in the window
+ wxPoint CellCoordsToPhysical(const wxPoint& pos, wxHtmlCell *cell) const;
+
+private:
+ // this class caches the pre-parsed HTML to speed up display
+ wxHtmlListBoxCache *m_cache;
+
+ // HTML parser we use
+ wxHtmlWinParser *m_htmlParser;
+
+#if wxUSE_FILESYSTEM
+ // file system used by m_htmlParser
+ wxFileSystem m_filesystem;
+#endif // wxUSE_FILESYSTEM
+
+ // rendering style for the parser which allows us to customize our colours
+ wxHtmlListBoxStyle *m_htmlRendStyle;
+
+
+ // it calls our GetSelectedTextColour() and GetSelectedTextBgColour()
+ friend class wxHtmlListBoxStyle;
+ friend class wxHtmlListBoxWinInterface;
+
+
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxHtmlListBox);
+};
+
+
+// ----------------------------------------------------------------------------
+// wxSimpleHtmlListBox
+// ----------------------------------------------------------------------------
+
+#define wxHLB_DEFAULT_STYLE wxBORDER_SUNKEN
+#define wxHLB_MULTIPLE wxLB_MULTIPLE
+
+class WXDLLIMPEXP_HTML wxSimpleHtmlListBox :
+ public wxWindowWithItems<wxHtmlListBox, wxItemContainer>
+{
+ DECLARE_ABSTRACT_CLASS(wxSimpleHtmlListBox)
+public:
+ // wxListbox-compatible constructors
+ // ---------------------------------
+
+ wxSimpleHtmlListBox() { }
+
+ wxSimpleHtmlListBox(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0, const wxString choices[] = NULL,
+ long style = wxHLB_DEFAULT_STYLE,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxSimpleHtmlListBoxNameStr)
+ {
+ Create(parent, id, pos, size, n, choices, style, validator, name);
+ }
+
+ wxSimpleHtmlListBox(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ long style = wxHLB_DEFAULT_STYLE,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxSimpleHtmlListBoxNameStr)
+ {
+ Create(parent, id, pos, size, choices, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0, const wxString choices[] = NULL,
+ long style = wxHLB_DEFAULT_STYLE,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxSimpleHtmlListBoxNameStr);
+ bool Create(wxWindow *parent, wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ long style = wxHLB_DEFAULT_STYLE,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxSimpleHtmlListBoxNameStr);
+
+ virtual ~wxSimpleHtmlListBox();
+
+ // these must be overloaded otherwise the compiler will complain
+ // about wxItemContainerImmutable::[G|S]etSelection being pure virtuals...
+ void SetSelection(int n)
+ { wxVListBox::SetSelection(n); }
+ int GetSelection() const
+ { return wxVListBox::GetSelection(); }
+
+
+ // accessing strings
+ // -----------------
+
+ virtual unsigned int GetCount() const
+ { return m_items.GetCount(); }
+
+ virtual wxString GetString(unsigned int n) const;
+
+ // override default unoptimized wxItemContainer::GetStrings() function
+ wxArrayString GetStrings() const
+ { return m_items; }
+
+ virtual void SetString(unsigned int n, const wxString& s);
+
+ // resolve ambiguity between wxItemContainer and wxVListBox versions
+ void Clear();
+
+protected:
+ virtual int DoInsertItems(const wxArrayStringsAdapter & items,
+ unsigned int pos,
+ void **clientData, wxClientDataType type);
+
+ virtual void DoSetItemClientData(unsigned int n, void *clientData)
+ { m_HTMLclientData[n] = clientData; }
+
+ virtual void *DoGetItemClientData(unsigned int n) const
+ { return m_HTMLclientData[n]; }
+
+ // wxItemContainer methods
+ virtual void DoClear();
+ virtual void DoDeleteOneItem(unsigned int n);
+
+ // calls wxHtmlListBox::SetItemCount() and RefreshAll()
+ void UpdateCount();
+
+ // override these functions just to change their visibility: users of
+ // wxSimpleHtmlListBox shouldn't be allowed to call them directly!
+ virtual void SetItemCount(size_t count)
+ { wxHtmlListBox::SetItemCount(count); }
+ virtual void SetRowCount(size_t count)
+ { wxHtmlListBox::SetRowCount(count); }
+
+ virtual wxString OnGetItem(size_t n) const
+ { return m_items[n]; }
+
+ virtual void InitEvent(wxCommandEvent& event, int n)
+ {
+ // we're not a virtual control and we can include the string
+ // of the item which was clicked:
+ event.SetString(m_items[n]);
+ wxVListBox::InitEvent(event, n);
+ }
+
+ wxArrayString m_items;
+ wxArrayPtrVoid m_HTMLclientData;
+
+ // Note: For the benefit of old compilers (like gcc-2.8) this should
+ // not be named m_clientdata as that clashes with the name of an
+ // anonymous struct member in wxEvtHandler, which we derive from.
+
+ wxDECLARE_NO_COPY_CLASS(wxSimpleHtmlListBox);
+};
+
+#endif // _WX_HTMLLBOX_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/hyperlink.h
+// Purpose: Hyperlink control
+// Author: David Norris <danorris@gmail.com>, Otto Wyss
+// Modified by: Ryan Norton, Francesco Montorsi
+// Created: 04/02/2005
+// Copyright: (c) 2005 David Norris
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HYPERLINK_H_
+#define _WX_HYPERLINK_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_HYPERLINKCTRL
+
+#include "wx/control.h"
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+#define wxHL_CONTEXTMENU 0x0001
+#define wxHL_ALIGN_LEFT 0x0002
+#define wxHL_ALIGN_RIGHT 0x0004
+#define wxHL_ALIGN_CENTRE 0x0008
+#define wxHL_DEFAULT_STYLE (wxHL_CONTEXTMENU|wxNO_BORDER|wxHL_ALIGN_CENTRE)
+
+extern WXDLLIMPEXP_DATA_ADV(const char) wxHyperlinkCtrlNameStr[];
+
+
+// ----------------------------------------------------------------------------
+// wxHyperlinkCtrl
+// ----------------------------------------------------------------------------
+
+// A static text control that emulates a hyperlink. The link is displayed
+// in an appropriate text style, derived from the control's normal font.
+// When the mouse rolls over the link, the cursor changes to a hand and the
+// link's color changes to the active color.
+//
+// Clicking on the link does not launch a web browser; instead, a
+// HyperlinkEvent is fired. The event propagates upward until it is caught,
+// just like a wxCommandEvent.
+//
+// Use the EVT_HYPERLINK() to catch link events.
+class WXDLLIMPEXP_ADV wxHyperlinkCtrlBase : public wxControl
+{
+public:
+
+ // get/set
+ virtual wxColour GetHoverColour() const = 0;
+ virtual void SetHoverColour(const wxColour &colour) = 0;
+
+ virtual wxColour GetNormalColour() const = 0;
+ virtual void SetNormalColour(const wxColour &colour) = 0;
+
+ virtual wxColour GetVisitedColour() const = 0;
+ virtual void SetVisitedColour(const wxColour &colour) = 0;
+
+ virtual wxString GetURL() const = 0;
+ virtual void SetURL (const wxString &url) = 0;
+
+ virtual void SetVisited(bool visited = true) = 0;
+ virtual bool GetVisited() const = 0;
+
+ // NOTE: also wxWindow::Set/GetLabel, wxWindow::Set/GetBackgroundColour,
+ // wxWindow::Get/SetFont, wxWindow::Get/SetCursor are important !
+
+ virtual bool HasTransparentBackground() { return true; }
+
+protected:
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ // checks for validity some of the ctor/Create() function parameters
+ void CheckParams(const wxString& label, const wxString& url, long style);
+
+public:
+ // not part of the public API but needs to be public as used by
+ // GTK+ callbacks:
+ void SendEvent();
+};
+
+// ----------------------------------------------------------------------------
+// wxHyperlinkEvent
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_ADV wxHyperlinkEvent;
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_HYPERLINK, wxHyperlinkEvent );
+
+//
+// An event fired when the user clicks on the label in a hyperlink control.
+// See HyperlinkControl for details.
+//
+class WXDLLIMPEXP_ADV wxHyperlinkEvent : public wxCommandEvent
+{
+public:
+ wxHyperlinkEvent() {}
+ wxHyperlinkEvent(wxObject *generator, wxWindowID id, const wxString& url)
+ : wxCommandEvent(wxEVT_HYPERLINK, id),
+ m_url(url)
+ {
+ SetEventObject(generator);
+ }
+
+ // Returns the URL associated with the hyperlink control
+ // that the user clicked on.
+ wxString GetURL() const { return m_url; }
+ void SetURL(const wxString &url) { m_url=url; }
+
+ // default copy ctor, assignment operator and dtor are ok
+ virtual wxEvent *Clone() const { return new wxHyperlinkEvent(*this); }
+
+private:
+
+ // URL associated with the hyperlink control that the used clicked on.
+ wxString m_url;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHyperlinkEvent)
+};
+
+
+// ----------------------------------------------------------------------------
+// event types and macros
+// ----------------------------------------------------------------------------
+
+typedef void (wxEvtHandler::*wxHyperlinkEventFunction)(wxHyperlinkEvent&);
+
+#define wxHyperlinkEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxHyperlinkEventFunction, func)
+
+#define EVT_HYPERLINK(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_HYPERLINK, id, wxHyperlinkEventHandler(fn))
+
+
+#if defined(__WXGTK210__) && !defined(__WXUNIVERSAL__)
+ #include "wx/gtk/hyperlink.h"
+// Note that the native control is only available in Unicode version under MSW.
+#elif defined(__WXMSW__) && wxUSE_UNICODE && !defined(__WXUNIVERSAL__)
+ #include "wx/msw/hyperlink.h"
+#else
+ #include "wx/generic/hyperlink.h"
+
+ class WXDLLIMPEXP_ADV wxHyperlinkCtrl : public wxGenericHyperlinkCtrl
+ {
+ public:
+ wxHyperlinkCtrl() { }
+
+ wxHyperlinkCtrl(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label,
+ const wxString& url,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxHL_DEFAULT_STYLE,
+ const wxString& name = wxHyperlinkCtrlNameStr)
+ : wxGenericHyperlinkCtrl(parent, id, label, url, pos, size,
+ style, name)
+ {
+ }
+
+ private:
+ wxDECLARE_DYNAMIC_CLASS_NO_COPY( wxHyperlinkCtrl );
+ };
+#endif
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_HYPERLINK wxEVT_HYPERLINK
+
+#endif // wxUSE_HYPERLINKCTRL
+
+#endif // _WX_HYPERLINK_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/icon.h
+// Purpose: wxIcon base header
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_ICON_H_BASE_
+#define _WX_ICON_H_BASE_
+
+#include "wx/iconloc.h"
+
+
+// a more readable way to tell
+#define wxICON_SCREEN_DEPTH (-1)
+
+
+// the wxICON_DEFAULT_TYPE (the wxIcon equivalent of wxBITMAP_DEFAULT_TYPE)
+// constant defines the default argument value for wxIcon ctor and wxIcon::LoadFile()
+// functions.
+
+#if defined(__WXMSW__)
+ #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_ICO_RESOURCE
+ #include "wx/msw/icon.h"
+#elif defined(__WXMOTIF__)
+ #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_XPM
+ #include "wx/motif/icon.h"
+#elif defined(__WXGTK20__)
+ #ifdef __WINDOWS__
+ #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_ICO_RESOURCE
+ #else
+ #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_XPM
+ #endif
+ #include "wx/generic/icon.h"
+#elif defined(__WXGTK__)
+ #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_XPM
+ #include "wx/generic/icon.h"
+#elif defined(__WXX11__)
+ #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_XPM
+ #include "wx/generic/icon.h"
+#elif defined(__WXDFB__)
+ #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_XPM
+ #include "wx/generic/icon.h"
+#elif defined(__WXMAC__)
+#if wxOSX_USE_COCOA_OR_CARBON
+ #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_ICON_RESOURCE
+ #include "wx/osx/icon.h"
+#else
+ #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_PNG_RESOURCE
+ #include "wx/generic/icon.h"
+#endif
+#elif defined(__WXCOCOA__)
+ #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_ICON_RESOURCE
+ #include "wx/cocoa/icon.h"
+#elif defined(__WXPM__)
+ #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_ICO_RESOURCE
+ #include "wx/os2/icon.h"
+#endif
+
+//-----------------------------------------------------------------------------
+// wxVariant support
+//-----------------------------------------------------------------------------
+
+#if wxUSE_VARIANT
+#include "wx/variant.h"
+DECLARE_VARIANT_OBJECT_EXPORTED(wxIcon,WXDLLIMPEXP_CORE)
+#endif
+
+
+#endif
+ // _WX_ICON_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/iconbndl.h
+// Purpose: wxIconBundle
+// Author: Mattia barbon
+// Modified by:
+// Created: 23.03.02
+// Copyright: (c) Mattia Barbon
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_ICONBNDL_H_
+#define _WX_ICONBNDL_H_
+
+#include "wx/gdiobj.h"
+#include "wx/gdicmn.h" // for wxSize
+#include "wx/icon.h"
+
+#include "wx/dynarray.h"
+
+class WXDLLIMPEXP_FWD_BASE wxInputStream;
+
+WX_DECLARE_EXPORTED_OBJARRAY(wxIcon, wxIconArray);
+
+// this class can't load bitmaps of type wxBITMAP_TYPE_ICO_RESOURCE,
+// if you need them, you have to load them manually and call
+// wxIconCollection::AddIcon
+class WXDLLIMPEXP_CORE wxIconBundle : public wxGDIObject
+{
+public:
+ // Flags that determine what happens if GetIcon() doesn't find the icon of
+ // exactly the requested size.
+ enum
+ {
+ // Return invalid icon if exact size is not found.
+ FALLBACK_NONE = 0,
+
+ // Return the icon of the system icon size if exact size is not found.
+ // May be combined with other non-NONE enum elements to determine what
+ // happens if the system icon size is not found neither.
+ FALLBACK_SYSTEM = 1,
+
+ // Return the icon of closest larger size or, if there is no icon of
+ // larger size in the bundle, the closest icon of smaller size.
+ FALLBACK_NEAREST_LARGER = 2
+ };
+
+ // default constructor
+ wxIconBundle();
+
+ // initializes the bundle with the icon(s) found in the file
+#if wxUSE_STREAMS && wxUSE_IMAGE
+#if wxUSE_FFILE || wxUSE_FILE
+ wxIconBundle(const wxString& file, wxBitmapType type = wxBITMAP_TYPE_ANY);
+#endif // wxUSE_FFILE || wxUSE_FILE
+ wxIconBundle(wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY);
+#endif // wxUSE_STREAMS && wxUSE_IMAGE
+
+ // initializes the bundle with a single icon
+ wxIconBundle(const wxIcon& icon);
+
+ // default copy ctor and assignment operator are OK
+
+ // adds all the icons contained in the file to the collection,
+ // if the collection already contains icons with the same
+ // width and height, they are replaced
+#if wxUSE_STREAMS && wxUSE_IMAGE
+#if wxUSE_FFILE || wxUSE_FILE
+ void AddIcon(const wxString& file, wxBitmapType type = wxBITMAP_TYPE_ANY);
+#endif // wxUSE_FFILE || wxUSE_FILE
+ void AddIcon(wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY);
+#endif // wxUSE_STREAMS && wxUSE_IMAGE
+
+ // adds the icon to the collection, if the collection already
+ // contains an icon with the same width and height, it is
+ // replaced
+ void AddIcon(const wxIcon& icon);
+
+ // returns the icon with the given size; if no such icon exists,
+ // behavior is specified by the flags.
+ wxIcon GetIcon(const wxSize& size, int flags = FALLBACK_SYSTEM) const;
+
+ // equivalent to GetIcon(wxSize(size, size))
+ wxIcon GetIcon(wxCoord size = wxDefaultCoord,
+ int flags = FALLBACK_SYSTEM) const
+ { return GetIcon(wxSize(size, size), flags); }
+
+ // returns the icon exactly of the specified size or wxNullIcon if no icon
+ // of exactly given size are available
+ wxIcon GetIconOfExactSize(const wxSize& size) const;
+ wxIcon GetIconOfExactSize(wxCoord size) const
+ { return GetIconOfExactSize(wxSize(size, size)); }
+
+ // enumerate all icons in the bundle: don't use these functions if ti can
+ // be avoided, using GetIcon() directly is better
+
+ // return the number of available icons
+ size_t GetIconCount() const;
+
+ // return the icon at index (must be < GetIconCount())
+ wxIcon GetIconByIndex(size_t n) const;
+
+ // check if we have any icons at all
+ bool IsEmpty() const { return GetIconCount() == 0; }
+
+#if WXWIN_COMPATIBILITY_2_8
+#if wxUSE_STREAMS && wxUSE_IMAGE && (wxUSE_FFILE || wxUSE_FILE)
+ wxDEPRECATED( void AddIcon(const wxString& file, long type)
+ {
+ AddIcon(file, (wxBitmapType)type);
+ }
+ )
+
+ wxDEPRECATED_CONSTRUCTOR( wxIconBundle (const wxString& file, long type)
+ {
+ AddIcon(file, (wxBitmapType)type);
+ }
+ )
+#endif // wxUSE_STREAMS && wxUSE_IMAGE && (wxUSE_FFILE || wxUSE_FILE)
+#endif // WXWIN_COMPATIBILITY_2_8
+
+protected:
+ virtual wxGDIRefData *CreateGDIRefData() const;
+ virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
+
+private:
+ // delete all icons
+ void DeleteIcons();
+
+ DECLARE_DYNAMIC_CLASS(wxIconBundle)
+};
+
+#endif // _WX_ICONBNDL_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/iconloc.h
+// Purpose: declaration of wxIconLocation class
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 21.06.2003
+// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_ICONLOC_H_
+#define _WX_ICONLOC_H_
+
+#include "wx/string.h"
+
+// ----------------------------------------------------------------------------
+// wxIconLocation: describes the location of an icon
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxIconLocationBase
+{
+public:
+ // ctor takes the name of the file where the icon is
+ wxEXPLICIT wxIconLocationBase(const wxString& filename = wxEmptyString)
+ : m_filename(filename) { }
+
+ // default copy ctor, assignment operator and dtor are ok
+
+
+ // returns true if this object is valid/initialized
+ bool IsOk() const { return !m_filename.empty(); }
+
+ // set/get the icon file name
+ void SetFileName(const wxString& filename) { m_filename = filename; }
+ const wxString& GetFileName() const { return m_filename; }
+
+private:
+ wxString m_filename;
+};
+
+// under Windows the same file may contain several icons so we also store the
+// index of the icon
+#if defined(__WINDOWS__)
+
+class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase
+{
+public:
+ // ctor takes the name of the file where the icon is and the icons index in
+ // the file
+ wxEXPLICIT wxIconLocation(const wxString& file = wxEmptyString, int num = 0);
+
+ // set/get the icon index
+ void SetIndex(int num) { m_index = num; }
+ int GetIndex() const { return m_index; }
+
+private:
+ int m_index;
+};
+
+inline
+wxIconLocation::wxIconLocation(const wxString& file, int num)
+ : wxIconLocationBase(file)
+{
+ SetIndex(num);
+}
+
+#else // !__WINDOWS__
+
+// must be a class because we forward declare it as class
+class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase
+{
+public:
+ wxEXPLICIT wxIconLocation(const wxString& filename = wxEmptyString)
+ : wxIconLocationBase(filename) { }
+};
+
+#endif // platform
+
+#endif // _WX_ICONLOC_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/imagbmp.h
+// Purpose: wxImage BMP, ICO, CUR and ANI handlers
+// Author: Robert Roebling, Chris Elliott
+// Copyright: (c) Robert Roebling, Chris Elliott
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_IMAGBMP_H_
+#define _WX_IMAGBMP_H_
+
+#include "wx/image.h"
+
+// defines for saving the BMP file in different formats, Bits Per Pixel
+// USE: wximage.SetOption( wxIMAGE_OPTION_BMP_FORMAT, wxBMP_xBPP );
+#define wxIMAGE_OPTION_BMP_FORMAT wxString(wxT("wxBMP_FORMAT"))
+
+// These two options are filled in upon reading CUR file and can (should) be
+// specified when saving a CUR file - they define the hotspot of the cursor:
+#define wxIMAGE_OPTION_CUR_HOTSPOT_X wxT("HotSpotX")
+#define wxIMAGE_OPTION_CUR_HOTSPOT_Y wxT("HotSpotY")
+
+
+enum
+{
+ wxBMP_24BPP = 24, // default, do not need to set
+ //wxBMP_16BPP = 16, // wxQuantize can only do 236 colors?
+ wxBMP_8BPP = 8, // 8bpp, quantized colors
+ wxBMP_8BPP_GREY = 9, // 8bpp, rgb averaged to greys
+ wxBMP_8BPP_GRAY = wxBMP_8BPP_GREY,
+ wxBMP_8BPP_RED = 10, // 8bpp, red used as greyscale
+ wxBMP_8BPP_PALETTE = 11, // 8bpp, use the wxImage's palette
+ wxBMP_4BPP = 4, // 4bpp, quantized colors
+ wxBMP_1BPP = 1, // 1bpp, quantized "colors"
+ wxBMP_1BPP_BW = 2 // 1bpp, black & white from red
+};
+
+// ----------------------------------------------------------------------------
+// wxBMPHandler
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxBMPHandler : public wxImageHandler
+{
+public:
+ wxBMPHandler()
+ {
+ m_name = wxT("Windows bitmap file");
+ m_extension = wxT("bmp");
+ m_type = wxBITMAP_TYPE_BMP;
+ m_mime = wxT("image/x-bmp");
+ }
+
+#if wxUSE_STREAMS
+ virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
+ virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
+
+protected:
+ virtual bool DoCanRead( wxInputStream& stream );
+ bool SaveDib(wxImage *image, wxOutputStream& stream, bool verbose,
+ bool IsBmp, bool IsMask);
+ bool DoLoadDib(wxImage *image, int width, int height, int bpp, int ncolors,
+ int comp, wxFileOffset bmpOffset, wxInputStream& stream,
+ bool verbose, bool IsBmp, bool hasPalette);
+ bool LoadDib(wxImage *image, wxInputStream& stream, bool verbose, bool IsBmp);
+#endif // wxUSE_STREAMS
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxBMPHandler)
+};
+
+#if wxUSE_ICO_CUR
+// ----------------------------------------------------------------------------
+// wxICOHandler
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxICOHandler : public wxBMPHandler
+{
+public:
+ wxICOHandler()
+ {
+ m_name = wxT("Windows icon file");
+ m_extension = wxT("ico");
+ m_type = wxBITMAP_TYPE_ICO;
+ m_mime = wxT("image/x-ico");
+ }
+
+#if wxUSE_STREAMS
+ virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
+ virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
+ virtual bool DoLoadFile( wxImage *image, wxInputStream& stream, bool verbose, int index );
+
+protected:
+ virtual int DoGetImageCount( wxInputStream& stream );
+ virtual bool DoCanRead( wxInputStream& stream );
+#endif // wxUSE_STREAMS
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxICOHandler)
+};
+
+
+// ----------------------------------------------------------------------------
+// wxCURHandler
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxCURHandler : public wxICOHandler
+{
+public:
+ wxCURHandler()
+ {
+ m_name = wxT("Windows cursor file");
+ m_extension = wxT("cur");
+ m_type = wxBITMAP_TYPE_CUR;
+ m_mime = wxT("image/x-cur");
+ }
+
+ // VS: This handler's meat is implemented inside wxICOHandler (the two
+ // formats are almost identical), but we hide this fact at
+ // the API level, since it is a mere implementation detail.
+
+protected:
+#if wxUSE_STREAMS
+ virtual bool DoCanRead( wxInputStream& stream );
+#endif // wxUSE_STREAMS
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxCURHandler)
+};
+// ----------------------------------------------------------------------------
+// wxANIHandler
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxANIHandler : public wxCURHandler
+{
+public:
+ wxANIHandler()
+ {
+ m_name = wxT("Windows animated cursor file");
+ m_extension = wxT("ani");
+ m_type = wxBITMAP_TYPE_ANI;
+ m_mime = wxT("image/x-ani");
+ }
+
+
+#if wxUSE_STREAMS
+ virtual bool SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool WXUNUSED(verbose=true) ){return false ;}
+ virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
+
+protected:
+ virtual int DoGetImageCount( wxInputStream& stream );
+ virtual bool DoCanRead( wxInputStream& stream );
+#endif // wxUSE_STREAMS
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxANIHandler)
+};
+
+#endif // wxUSE_ICO_CUR
+#endif // _WX_IMAGBMP_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/image.h
+// Purpose: wxImage class
+// Author: Robert Roebling
+// Copyright: (c) Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_IMAGE_H_
+#define _WX_IMAGE_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_IMAGE
+
+#include "wx/object.h"
+#include "wx/string.h"
+#include "wx/gdicmn.h"
+#include "wx/hashmap.h"
+#include "wx/arrstr.h"
+
+#if wxUSE_STREAMS
+# include "wx/stream.h"
+#endif
+
+// on some systems (Unixware 7.x) index is defined as a macro in the headers
+// which breaks the compilation below
+#undef index
+
+#define wxIMAGE_OPTION_QUALITY wxString(wxS("quality"))
+#define wxIMAGE_OPTION_FILENAME wxString(wxS("FileName"))
+
+#define wxIMAGE_OPTION_RESOLUTION wxString(wxS("Resolution"))
+#define wxIMAGE_OPTION_RESOLUTIONX wxString(wxS("ResolutionX"))
+#define wxIMAGE_OPTION_RESOLUTIONY wxString(wxS("ResolutionY"))
+
+#define wxIMAGE_OPTION_RESOLUTIONUNIT wxString(wxS("ResolutionUnit"))
+
+#define wxIMAGE_OPTION_MAX_WIDTH wxString(wxS("MaxWidth"))
+#define wxIMAGE_OPTION_MAX_HEIGHT wxString(wxS("MaxHeight"))
+
+#define wxIMAGE_OPTION_ORIGINAL_WIDTH wxString(wxS("OriginalWidth"))
+#define wxIMAGE_OPTION_ORIGINAL_HEIGHT wxString(wxS("OriginalHeight"))
+
+// constants used with wxIMAGE_OPTION_RESOLUTIONUNIT
+//
+// NB: don't change these values, they correspond to libjpeg constants
+enum wxImageResolution
+{
+ // Resolution not specified
+ wxIMAGE_RESOLUTION_NONE = 0,
+
+ // Resolution specified in inches
+ wxIMAGE_RESOLUTION_INCHES = 1,
+
+ // Resolution specified in centimeters
+ wxIMAGE_RESOLUTION_CM = 2
+};
+
+// Constants for wxImage::Scale() for determining the level of quality
+enum wxImageResizeQuality
+{
+ // different image resizing algorithms used by Scale() and Rescale()
+ wxIMAGE_QUALITY_NEAREST = 0,
+ wxIMAGE_QUALITY_BILINEAR = 1,
+ wxIMAGE_QUALITY_BICUBIC = 2,
+ wxIMAGE_QUALITY_BOX_AVERAGE = 3,
+
+ // default quality is low (but fast)
+ wxIMAGE_QUALITY_NORMAL = wxIMAGE_QUALITY_NEAREST,
+
+ // highest (but best) quality
+ wxIMAGE_QUALITY_HIGH = 4
+};
+
+// alpha channel values: fully transparent, default threshold separating
+// transparent pixels from opaque for a few functions dealing with alpha and
+// fully opaque
+const unsigned char wxIMAGE_ALPHA_TRANSPARENT = 0;
+const unsigned char wxIMAGE_ALPHA_THRESHOLD = 0x80;
+const unsigned char wxIMAGE_ALPHA_OPAQUE = 0xff;
+
+//-----------------------------------------------------------------------------
+// classes
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxImageHandler;
+class WXDLLIMPEXP_FWD_CORE wxImage;
+class WXDLLIMPEXP_FWD_CORE wxPalette;
+
+//-----------------------------------------------------------------------------
+// wxVariant support
+//-----------------------------------------------------------------------------
+
+#if wxUSE_VARIANT
+#include "wx/variant.h"
+DECLARE_VARIANT_OBJECT_EXPORTED(wxImage,WXDLLIMPEXP_CORE)
+#endif
+
+//-----------------------------------------------------------------------------
+// wxImageHandler
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxImageHandler: public wxObject
+{
+public:
+ wxImageHandler()
+ : m_name(wxEmptyString), m_extension(wxEmptyString), m_mime(), m_type(wxBITMAP_TYPE_INVALID)
+ { }
+
+#if wxUSE_STREAMS
+ // NOTE: LoadFile and SaveFile are not pure virtuals to allow derived classes
+ // to implement only one of the two
+ virtual bool LoadFile( wxImage *WXUNUSED(image), wxInputStream& WXUNUSED(stream),
+ bool WXUNUSED(verbose)=true, int WXUNUSED(index)=-1 )
+ { return false; }
+ virtual bool SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream),
+ bool WXUNUSED(verbose)=true )
+ { return false; }
+
+ int GetImageCount( wxInputStream& stream );
+ // save the stream position, call DoGetImageCount() and restore the position
+
+ bool CanRead( wxInputStream& stream ) { return CallDoCanRead(stream); }
+ bool CanRead( const wxString& name );
+#endif // wxUSE_STREAMS
+
+ void SetName(const wxString& name) { m_name = name; }
+ void SetExtension(const wxString& ext) { m_extension = ext; }
+ void SetAltExtensions(const wxArrayString& exts) { m_altExtensions = exts; }
+ void SetType(wxBitmapType type) { m_type = type; }
+ void SetMimeType(const wxString& type) { m_mime = type; }
+ const wxString& GetName() const { return m_name; }
+ const wxString& GetExtension() const { return m_extension; }
+ const wxArrayString& GetAltExtensions() const { return m_altExtensions; }
+ wxBitmapType GetType() const { return m_type; }
+ const wxString& GetMimeType() const { return m_mime; }
+
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED(
+ void SetType(long type) { SetType((wxBitmapType)type); }
+ )
+#endif // WXWIN_COMPATIBILITY_2_8
+
+protected:
+#if wxUSE_STREAMS
+ // NOTE: this function is allowed to change the current stream position
+ // since GetImageCount() will take care of restoring it later
+ virtual int DoGetImageCount( wxInputStream& WXUNUSED(stream) )
+ { return 1; } // default return value is 1 image
+
+ // NOTE: this function is allowed to change the current stream position
+ // since CallDoCanRead() will take care of restoring it later
+ virtual bool DoCanRead( wxInputStream& stream ) = 0;
+
+ // save the stream position, call DoCanRead() and restore the position
+ bool CallDoCanRead(wxInputStream& stream);
+#endif // wxUSE_STREAMS
+
+ // helper for the derived classes SaveFile() implementations: returns the
+ // values of x- and y-resolution options specified as the image options if
+ // any
+ static wxImageResolution
+ GetResolutionFromOptions(const wxImage& image, int *x, int *y);
+
+
+ wxString m_name;
+ wxString m_extension;
+ wxArrayString m_altExtensions;
+ wxString m_mime;
+ wxBitmapType m_type;
+
+private:
+ DECLARE_CLASS(wxImageHandler)
+};
+
+//-----------------------------------------------------------------------------
+// wxImageHistogram
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxImageHistogramEntry
+{
+public:
+ wxImageHistogramEntry() { index = value = 0; }
+ unsigned long index;
+ unsigned long value;
+};
+
+WX_DECLARE_EXPORTED_HASH_MAP(unsigned long, wxImageHistogramEntry,
+ wxIntegerHash, wxIntegerEqual,
+ wxImageHistogramBase);
+
+class WXDLLIMPEXP_CORE wxImageHistogram : public wxImageHistogramBase
+{
+public:
+ wxImageHistogram() : wxImageHistogramBase(256) { }
+
+ // get the key in the histogram for the given RGB values
+ static unsigned long MakeKey(unsigned char r,
+ unsigned char g,
+ unsigned char b)
+ {
+ return (r << 16) | (g << 8) | b;
+ }
+
+ // find first colour that is not used in the image and has higher
+ // RGB values than RGB(startR, startG, startB)
+ //
+ // returns true and puts this colour in r, g, b (each of which may be NULL)
+ // on success or returns false if there are no more free colours
+ bool FindFirstUnusedColour(unsigned char *r,
+ unsigned char *g,
+ unsigned char *b,
+ unsigned char startR = 1,
+ unsigned char startG = 0,
+ unsigned char startB = 0 ) const;
+};
+
+//-----------------------------------------------------------------------------
+// wxImage
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxImage: public wxObject
+{
+public:
+ // red, green and blue are 8 bit unsigned integers in the range of 0..255
+ // We use the identifier RGBValue instead of RGB, since RGB is #defined
+ class RGBValue
+ {
+ public:
+ RGBValue(unsigned char r=0, unsigned char g=0, unsigned char b=0)
+ : red(r), green(g), blue(b) {}
+ unsigned char red;
+ unsigned char green;
+ unsigned char blue;
+ };
+
+ // hue, saturation and value are doubles in the range 0.0..1.0
+ class HSVValue
+ {
+ public:
+ HSVValue(double h=0.0, double s=0.0, double v=0.0)
+ : hue(h), saturation(s), value(v) {}
+ double hue;
+ double saturation;
+ double value;
+ };
+
+ wxImage() {}
+ wxImage( int width, int height, bool clear = true )
+ { Create( width, height, clear ); }
+ wxImage( int width, int height, unsigned char* data, bool static_data = false )
+ { Create( width, height, data, static_data ); }
+ wxImage( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false )
+ { Create( width, height, data, alpha, static_data ); }
+
+ // ctor variants using wxSize:
+ wxImage( const wxSize& sz, bool clear = true )
+ { Create( sz, clear ); }
+ wxImage( const wxSize& sz, unsigned char* data, bool static_data = false )
+ { Create( sz, data, static_data ); }
+ wxImage( const wxSize& sz, unsigned char* data, unsigned char* alpha, bool static_data = false )
+ { Create( sz, data, alpha, static_data ); }
+
+ wxImage( const wxString& name, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1 )
+ { LoadFile( name, type, index ); }
+ wxImage( const wxString& name, const wxString& mimetype, int index = -1 )
+ { LoadFile( name, mimetype, index ); }
+ wxImage( const char* const* xpmData )
+ { Create(xpmData); }
+
+#if wxUSE_STREAMS
+ wxImage( wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1 )
+ { LoadFile( stream, type, index ); }
+ wxImage( wxInputStream& stream, const wxString& mimetype, int index = -1 )
+ { LoadFile( stream, mimetype, index ); }
+#endif // wxUSE_STREAMS
+
+ bool Create( const char* const* xpmData );
+#ifdef __BORLANDC__
+ // needed for Borland 5.5
+ wxImage( char** xpmData ) { Create(const_cast<const char* const*>(xpmData)); }
+ bool Create( char** xpmData ) { return Create(const_cast<const char* const*>(xpmData)); }
+#endif
+
+ bool Create( int width, int height, bool clear = true );
+ bool Create( int width, int height, unsigned char* data, bool static_data = false );
+ bool Create( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false );
+
+ // Create() variants using wxSize:
+ bool Create( const wxSize& sz, bool clear = true )
+ { return Create(sz.GetWidth(), sz.GetHeight(), clear); }
+ bool Create( const wxSize& sz, unsigned char* data, bool static_data = false )
+ { return Create(sz.GetWidth(), sz.GetHeight(), data, static_data); }
+ bool Create( const wxSize& sz, unsigned char* data, unsigned char* alpha, bool static_data = false )
+ { return Create(sz.GetWidth(), sz.GetHeight(), data, alpha, static_data); }
+
+ void Destroy();
+
+ // initialize the image data with zeroes
+ void Clear(unsigned char value = 0);
+
+ // creates an identical copy of the image (the = operator
+ // just raises the ref count)
+ wxImage Copy() const;
+
+ // return the new image with size width*height
+ wxImage GetSubImage( const wxRect& rect) const;
+
+ // Paste the image or part of this image into an image of the given size at the pos
+ // any newly exposed areas will be filled with the rgb colour
+ // by default if r = g = b = -1 then fill with this image's mask colour or find and
+ // set a suitable mask colour
+ wxImage Size( const wxSize& size, const wxPoint& pos,
+ int r = -1, int g = -1, int b = -1 ) const;
+
+ // pastes image into this instance and takes care of
+ // the mask colour and out of bounds problems
+ void Paste( const wxImage &image, int x, int y );
+
+ // return the new image with size width*height
+ wxImage Scale( int width, int height,
+ wxImageResizeQuality quality = wxIMAGE_QUALITY_NORMAL ) const;
+
+ // box averager and bicubic filters for up/down sampling
+ wxImage ResampleNearest(int width, int height) const;
+ wxImage ResampleBox(int width, int height) const;
+ wxImage ResampleBilinear(int width, int height) const;
+ wxImage ResampleBicubic(int width, int height) const;
+
+ // blur the image according to the specified pixel radius
+ wxImage Blur(int radius) const;
+ wxImage BlurHorizontal(int radius) const;
+ wxImage BlurVertical(int radius) const;
+
+ wxImage ShrinkBy( int xFactor , int yFactor ) const ;
+
+ // rescales the image in place
+ wxImage& Rescale( int width, int height,
+ wxImageResizeQuality quality = wxIMAGE_QUALITY_NORMAL )
+ { return *this = Scale(width, height, quality); }
+
+ // resizes the image in place
+ wxImage& Resize( const wxSize& size, const wxPoint& pos,
+ int r = -1, int g = -1, int b = -1 ) { return *this = Size(size, pos, r, g, b); }
+
+ // Rotates the image about the given point, 'angle' radians.
+ // Returns the rotated image, leaving this image intact.
+ wxImage Rotate(double angle, const wxPoint & centre_of_rotation,
+ bool interpolating = true, wxPoint * offset_after_rotation = NULL) const;
+
+ wxImage Rotate90( bool clockwise = true ) const;
+ wxImage Rotate180() const;
+ wxImage Mirror( bool horizontally = true ) const;
+
+ // replace one colour with another
+ void Replace( unsigned char r1, unsigned char g1, unsigned char b1,
+ unsigned char r2, unsigned char g2, unsigned char b2 );
+
+ // Convert to greyscale image. Uses the luminance component (Y) of the image.
+ // The luma value (YUV) is calculated using (R * weight_r) + (G * weight_g) + (B * weight_b), defaults to ITU-T BT.601
+ wxImage ConvertToGreyscale(double weight_r, double weight_g, double weight_b) const;
+ wxImage ConvertToGreyscale(void) const;
+
+ // convert to monochrome image (<r,g,b> will be replaced by white,
+ // everything else by black)
+ wxImage ConvertToMono( unsigned char r, unsigned char g, unsigned char b ) const;
+
+ // Convert to disabled (dimmed) image.
+ wxImage ConvertToDisabled(unsigned char brightness = 255) const;
+
+ // these routines are slow but safe
+ void SetRGB( int x, int y, unsigned char r, unsigned char g, unsigned char b );
+ void SetRGB( const wxRect& rect, unsigned char r, unsigned char g, unsigned char b );
+ unsigned char GetRed( int x, int y ) const;
+ unsigned char GetGreen( int x, int y ) const;
+ unsigned char GetBlue( int x, int y ) const;
+
+ void SetAlpha(int x, int y, unsigned char alpha);
+ unsigned char GetAlpha(int x, int y) const;
+
+ // find first colour that is not used in the image and has higher
+ // RGB values than <startR,startG,startB>
+ bool FindFirstUnusedColour( unsigned char *r, unsigned char *g, unsigned char *b,
+ unsigned char startR = 1, unsigned char startG = 0,
+ unsigned char startB = 0 ) const;
+ // Set image's mask to the area of 'mask' that has <r,g,b> colour
+ bool SetMaskFromImage(const wxImage & mask,
+ unsigned char mr, unsigned char mg, unsigned char mb);
+
+ // converts image's alpha channel to mask (choosing mask colour
+ // automatically or using the specified colour for the mask), if it has
+ // any, does nothing otherwise:
+ bool ConvertAlphaToMask(unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD);
+ bool ConvertAlphaToMask(unsigned char mr, unsigned char mg, unsigned char mb,
+ unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD);
+
+
+ // This method converts an image where the original alpha
+ // information is only available as a shades of a colour
+ // (actually shades of grey) typically when you draw anti-
+ // aliased text into a bitmap. The DC drawinf routines
+ // draw grey values on the black background although they
+ // actually mean to draw white with differnt alpha values.
+ // This method reverses it, assuming a black (!) background
+ // and white text (actually only the red channel is read).
+ // The method will then fill up the whole image with the
+ // colour given.
+ bool ConvertColourToAlpha( unsigned char r, unsigned char g, unsigned char b );
+
+ static bool CanRead( const wxString& name );
+ static int GetImageCount( const wxString& name, wxBitmapType type = wxBITMAP_TYPE_ANY );
+ virtual bool LoadFile( const wxString& name, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1 );
+ virtual bool LoadFile( const wxString& name, const wxString& mimetype, int index = -1 );
+
+#if wxUSE_STREAMS
+ static bool CanRead( wxInputStream& stream );
+ static int GetImageCount( wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY );
+ virtual bool LoadFile( wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1 );
+ virtual bool LoadFile( wxInputStream& stream, const wxString& mimetype, int index = -1 );
+#endif
+
+ virtual bool SaveFile( const wxString& name ) const;
+ virtual bool SaveFile( const wxString& name, wxBitmapType type ) const;
+ virtual bool SaveFile( const wxString& name, const wxString& mimetype ) const;
+
+#if wxUSE_STREAMS
+ virtual bool SaveFile( wxOutputStream& stream, wxBitmapType type ) const;
+ virtual bool SaveFile( wxOutputStream& stream, const wxString& mimetype ) const;
+#endif
+
+ bool Ok() const { return IsOk(); }
+ bool IsOk() const;
+ int GetWidth() const;
+ int GetHeight() const;
+
+ wxSize GetSize() const
+ { return wxSize(GetWidth(), GetHeight()); }
+
+ // Gets the type of image found by LoadFile or specified with SaveFile
+ wxBitmapType GetType() const;
+
+ // Set the image type, this is normally only called if the image is being
+ // created from data in the given format but not using LoadFile() (e.g.
+ // wxGIFDecoder uses this)
+ void SetType(wxBitmapType type);
+
+ // these functions provide fastest access to wxImage data but should be
+ // used carefully as no checks are done
+ unsigned char *GetData() const;
+ void SetData( unsigned char *data, bool static_data=false );
+ void SetData( unsigned char *data, int new_width, int new_height, bool static_data=false );
+
+ unsigned char *GetAlpha() const; // may return NULL!
+ bool HasAlpha() const { return GetAlpha() != NULL; }
+ void SetAlpha(unsigned char *alpha = NULL, bool static_data=false);
+ void InitAlpha();
+ void ClearAlpha();
+
+ // return true if this pixel is masked or has alpha less than specified
+ // threshold
+ bool IsTransparent(int x, int y,
+ unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD) const;
+
+ // Mask functions
+ void SetMaskColour( unsigned char r, unsigned char g, unsigned char b );
+ // Get the current mask colour or find a suitable colour
+ // returns true if using current mask colour
+ bool GetOrFindMaskColour( unsigned char *r, unsigned char *g, unsigned char *b ) const;
+ unsigned char GetMaskRed() const;
+ unsigned char GetMaskGreen() const;
+ unsigned char GetMaskBlue() const;
+ void SetMask( bool mask = true );
+ bool HasMask() const;
+
+#if wxUSE_PALETTE
+ // Palette functions
+ bool HasPalette() const;
+ const wxPalette& GetPalette() const;
+ void SetPalette(const wxPalette& palette);
+#endif // wxUSE_PALETTE
+
+ // Option functions (arbitrary name/value mapping)
+ void SetOption(const wxString& name, const wxString& value);
+ void SetOption(const wxString& name, int value);
+ wxString GetOption(const wxString& name) const;
+ int GetOptionInt(const wxString& name) const;
+ bool HasOption(const wxString& name) const;
+
+ unsigned long CountColours( unsigned long stopafter = (unsigned long) -1 ) const;
+
+ // Computes the histogram of the image and fills a hash table, indexed
+ // with integer keys built as 0xRRGGBB, containing wxImageHistogramEntry
+ // objects. Each of them contains an 'index' (useful to build a palette
+ // with the image colours) and a 'value', which is the number of pixels
+ // in the image with that colour.
+ // Returned value: # of entries in the histogram
+ unsigned long ComputeHistogram( wxImageHistogram &h ) const;
+
+ // Rotates the hue of each pixel of the image. angle is a double in the range
+ // -1.0..1.0 where -1.0 is -360 degrees and 1.0 is 360 degrees
+ void RotateHue(double angle);
+
+ static wxList& GetHandlers() { return sm_handlers; }
+ static void AddHandler( wxImageHandler *handler );
+ static void InsertHandler( wxImageHandler *handler );
+ static bool RemoveHandler( const wxString& name );
+ static wxImageHandler *FindHandler( const wxString& name );
+ static wxImageHandler *FindHandler( const wxString& extension, wxBitmapType imageType );
+ static wxImageHandler *FindHandler( wxBitmapType imageType );
+
+ static wxImageHandler *FindHandlerMime( const wxString& mimetype );
+
+ static wxString GetImageExtWildcard();
+
+ static void CleanUpHandlers();
+ static void InitStandardHandlers();
+
+ static HSVValue RGBtoHSV(const RGBValue& rgb);
+ static RGBValue HSVtoRGB(const HSVValue& hsv);
+
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED_CONSTRUCTOR(
+ wxImage(const wxString& name, long type, int index = -1)
+ {
+ LoadFile(name, (wxBitmapType)type, index);
+ }
+ )
+
+#if wxUSE_STREAMS
+ wxDEPRECATED_CONSTRUCTOR(
+ wxImage(wxInputStream& stream, long type, int index = -1)
+ {
+ LoadFile(stream, (wxBitmapType)type, index);
+ }
+ )
+
+ wxDEPRECATED(
+ bool LoadFile(wxInputStream& stream, long type, int index = -1)
+ {
+ return LoadFile(stream, (wxBitmapType)type, index);
+ }
+ )
+
+ wxDEPRECATED(
+ bool SaveFile(wxOutputStream& stream, long type) const
+ {
+ return SaveFile(stream, (wxBitmapType)type);
+ }
+ )
+#endif // wxUSE_STREAMS
+
+ wxDEPRECATED(
+ bool LoadFile(const wxString& name, long type, int index = -1)
+ {
+ return LoadFile(name, (wxBitmapType)type, index);
+ }
+ )
+
+ wxDEPRECATED(
+ bool SaveFile(const wxString& name, long type) const
+ {
+ return SaveFile(name, (wxBitmapType)type);
+ }
+ )
+
+ static wxDEPRECATED(
+ wxImageHandler *FindHandler(const wxString& ext, long type)
+ {
+ return FindHandler(ext, (wxBitmapType)type);
+ }
+ )
+
+ static wxDEPRECATED(
+ wxImageHandler *FindHandler(long imageType)
+ {
+ return FindHandler((wxBitmapType)imageType);
+ }
+ )
+#endif // WXWIN_COMPATIBILITY_2_8
+
+protected:
+ static wxList sm_handlers;
+
+ // return the index of the point with the given coordinates or -1 if the
+ // image is invalid of the coordinates are out of range
+ //
+ // note that index must be multiplied by 3 when using it with RGB array
+ long XYToIndex(int x, int y) const;
+
+ virtual wxObjectRefData* CreateRefData() const;
+ virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const;
+
+private:
+ friend class WXDLLIMPEXP_FWD_CORE wxImageHandler;
+
+ // Possible values for MakeEmptyClone() flags.
+ enum
+ {
+ // Create an image with the same orientation as this one. This is the
+ // default and only exists for symmetry with SwapOrientation.
+ Clone_SameOrientation = 0,
+
+ // Create an image with the same height as this image width and the
+ // same width as this image height.
+ Clone_SwapOrientation = 1
+ };
+
+ // Returns a new blank image with the same dimensions (or with width and
+ // height swapped if Clone_SwapOrientation flag is given), alpha, and mask
+ // as this image itself. This is used by several functions creating
+ // modified versions of this image.
+ wxImage MakeEmptyClone(int flags = Clone_SameOrientation) const;
+
+#if wxUSE_STREAMS
+ // read the image from the specified stream updating image type if
+ // successful
+ bool DoLoad(wxImageHandler& handler, wxInputStream& stream, int index);
+
+ // write the image to the specified stream and also update the image type
+ // if successful
+ bool DoSave(wxImageHandler& handler, wxOutputStream& stream) const;
+#endif // wxUSE_STREAMS
+
+ DECLARE_DYNAMIC_CLASS(wxImage)
+};
+
+
+extern void WXDLLIMPEXP_CORE wxInitAllImageHandlers();
+
+extern WXDLLIMPEXP_DATA_CORE(wxImage) wxNullImage;
+
+//-----------------------------------------------------------------------------
+// wxImage handlers
+//-----------------------------------------------------------------------------
+
+#include "wx/imagbmp.h"
+#include "wx/imagpng.h"
+#include "wx/imaggif.h"
+#include "wx/imagpcx.h"
+#include "wx/imagjpeg.h"
+#include "wx/imagtga.h"
+#include "wx/imagtiff.h"
+#include "wx/imagpnm.h"
+#include "wx/imagxpm.h"
+#include "wx/imagiff.h"
+
+#endif // wxUSE_IMAGE
+
+#endif
+ // _WX_IMAGE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/imaggif.h
+// Purpose: wxImage GIF handler
+// Author: Vaclav Slavik, Guillermo Rodriguez Garcia, Gershon Elber, Troels K
+// Copyright: (c) 1999-2011 Vaclav Slavik, Guillermo Rodriguez Garcia, Gershon Elber, Troels K
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_IMAGGIF_H_
+#define _WX_IMAGGIF_H_
+
+#include "wx/image.h"
+
+
+//-----------------------------------------------------------------------------
+// wxGIFHandler
+//-----------------------------------------------------------------------------
+
+#if wxUSE_GIF
+
+#define wxIMAGE_OPTION_GIF_COMMENT wxT("GifComment")
+
+struct wxRGB;
+struct GifHashTableType;
+class WXDLLIMPEXP_FWD_CORE wxImageArray; // anidecod.h
+
+class WXDLLIMPEXP_CORE wxGIFHandler : public wxImageHandler
+{
+public:
+ inline wxGIFHandler()
+ {
+ m_name = wxT("GIF file");
+ m_extension = wxT("gif");
+ m_type = wxBITMAP_TYPE_GIF;
+ m_mime = wxT("image/gif");
+ m_hashTable = NULL;
+ }
+
+#if wxUSE_STREAMS
+ virtual bool LoadFile(wxImage *image, wxInputStream& stream,
+ bool verbose = true, int index = -1);
+ virtual bool SaveFile(wxImage *image, wxOutputStream& stream,
+ bool verbose=true);
+
+ // Save animated gif
+ bool SaveAnimation(const wxImageArray& images, wxOutputStream *stream,
+ bool verbose = true, int delayMilliSecs = 1000);
+
+protected:
+ virtual int DoGetImageCount(wxInputStream& stream);
+ virtual bool DoCanRead(wxInputStream& stream);
+
+ bool DoSaveFile(const wxImage&, wxOutputStream *, bool verbose,
+ bool first, int delayMilliSecs, bool loop,
+ const wxRGB *pal, int palCount,
+ int mask_index);
+#endif // wxUSE_STREAMS
+protected:
+
+ // Declarations for saving
+
+ unsigned long m_crntShiftDWord; /* For bytes decomposition into codes. */
+ int m_pixelCount;
+ struct GifHashTableType *m_hashTable;
+ wxInt16
+ m_EOFCode, /* The EOF LZ code. */
+ m_clearCode, /* The CLEAR LZ code. */
+ m_runningCode, /* The next code algorithm can generate. */
+ m_runningBits, /* The number of bits required to represent RunningCode. */
+ m_maxCode1, /* 1 bigger than max. possible code, in RunningBits bits. */
+ m_crntCode, /* Current algorithm code. */
+ m_crntShiftState; /* Number of bits in CrntShiftDWord. */
+ wxUint8 m_LZBuf[256]; /* Compressed input is buffered here. */
+
+ bool InitHashTable();
+ void ClearHashTable();
+ void InsertHashTable(unsigned long key, int code);
+ int ExistsHashTable(unsigned long key);
+
+#if wxUSE_STREAMS
+ bool CompressOutput(wxOutputStream *, int code);
+ bool SetupCompress(wxOutputStream *, int bpp);
+ bool CompressLine(wxOutputStream *, const wxUint8 *line, int lineLen);
+#endif
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxGIFHandler)
+};
+
+#endif // wxUSE_GIF
+
+#endif // _WX_IMAGGIF_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/imagiff.h
+// Purpose: wxImage handler for Amiga IFF images
+// Author: Steffen Gutmann
+// Copyright: (c) Steffen Gutmann, 2002
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_IMAGE_IFF_H_
+#define _WX_IMAGE_IFF_H_
+
+#include "wx/image.h"
+
+//-----------------------------------------------------------------------------
+// wxIFFHandler
+//-----------------------------------------------------------------------------
+
+#if wxUSE_IMAGE && wxUSE_IFF
+
+class WXDLLIMPEXP_CORE wxIFFHandler : public wxImageHandler
+{
+public:
+ wxIFFHandler()
+ {
+ m_name = wxT("IFF file");
+ m_extension = wxT("iff");
+ m_type = wxBITMAP_TYPE_IFF;
+ m_mime = wxT("image/x-iff");
+ }
+
+#if wxUSE_STREAMS
+ virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1);
+ virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true);
+protected:
+ virtual bool DoCanRead(wxInputStream& stream);
+#endif
+
+ DECLARE_DYNAMIC_CLASS(wxIFFHandler)
+};
+
+#endif // wxUSE_IMAGE && wxUSE_IFF
+
+#endif // _WX_IMAGE_IFF_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/imagjpeg.h
+// Purpose: wxImage JPEG handler
+// Author: Vaclav Slavik
+// Copyright: (c) Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_IMAGJPEG_H_
+#define _WX_IMAGJPEG_H_
+
+#include "wx/defs.h"
+
+//-----------------------------------------------------------------------------
+// wxJPEGHandler
+//-----------------------------------------------------------------------------
+
+#if wxUSE_LIBJPEG
+
+#include "wx/image.h"
+#include "wx/versioninfo.h"
+
+class WXDLLIMPEXP_CORE wxJPEGHandler: public wxImageHandler
+{
+public:
+ inline wxJPEGHandler()
+ {
+ m_name = wxT("JPEG file");
+ m_extension = wxT("jpg");
+ m_altExtensions.Add(wxT("jpeg"));
+ m_altExtensions.Add(wxT("jpe"));
+ m_type = wxBITMAP_TYPE_JPEG;
+ m_mime = wxT("image/jpeg");
+ }
+
+ static wxVersionInfo GetLibraryVersionInfo();
+
+#if wxUSE_STREAMS
+ virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
+ virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
+protected:
+ virtual bool DoCanRead( wxInputStream& stream );
+#endif
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxJPEGHandler)
+};
+
+#endif // wxUSE_LIBJPEG
+
+#endif // _WX_IMAGJPEG_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/imaglist.h
+// Purpose: wxImageList base header
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_IMAGLIST_H_BASE_
+#define _WX_IMAGLIST_H_BASE_
+
+#include "wx/defs.h"
+
+/*
+ * wxImageList is used for wxListCtrl, wxTreeCtrl. These controls refer to
+ * images for their items by an index into an image list.
+ * A wxImageList is capable of creating images with optional masks from
+ * a variety of sources - a single bitmap plus a colour to indicate the mask,
+ * two bitmaps, or an icon.
+ *
+ * Image lists can also create and draw images used for drag and drop functionality.
+ * This is not yet implemented in wxImageList. We need to discuss a generic API
+ * for doing drag and drop and see whether it ties in with the Win95 view of it.
+ * See below for candidate functions and an explanation of how they might be
+ * used.
+ */
+
+// Flag values for Set/GetImageList
+enum
+{
+ wxIMAGE_LIST_NORMAL, // Normal icons
+ wxIMAGE_LIST_SMALL, // Small icons
+ wxIMAGE_LIST_STATE // State icons: unimplemented (see WIN32 documentation)
+};
+
+// Flags for Draw
+#define wxIMAGELIST_DRAW_NORMAL 0x0001
+#define wxIMAGELIST_DRAW_TRANSPARENT 0x0002
+#define wxIMAGELIST_DRAW_SELECTED 0x0004
+#define wxIMAGELIST_DRAW_FOCUSED 0x0008
+
+#if defined(__WXMSW__) || defined(__WXMAC__)
+ #define wxHAS_NATIVE_IMAGELIST
+#endif
+
+#if !defined(wxHAS_NATIVE_IMAGELIST)
+ #include "wx/generic/imaglist.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/imaglist.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/imaglist.h"
+#endif
+
+#endif // _WX_IMAGLIST_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/imagpcx.h
+// Purpose: wxImage PCX handler
+// Author: Guillermo Rodriguez Garcia <guille@iies.es>
+// Copyright: (c) 1999 Guillermo Rodriguez Garcia
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_IMAGPCX_H_
+#define _WX_IMAGPCX_H_
+
+#include "wx/image.h"
+
+
+//-----------------------------------------------------------------------------
+// wxPCXHandler
+//-----------------------------------------------------------------------------
+
+#if wxUSE_PCX
+class WXDLLIMPEXP_CORE wxPCXHandler : public wxImageHandler
+{
+public:
+ inline wxPCXHandler()
+ {
+ m_name = wxT("PCX file");
+ m_extension = wxT("pcx");
+ m_type = wxBITMAP_TYPE_PCX;
+ m_mime = wxT("image/pcx");
+ }
+
+#if wxUSE_STREAMS
+ virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
+ virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
+protected:
+ virtual bool DoCanRead( wxInputStream& stream );
+#endif // wxUSE_STREAMS
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPCXHandler)
+};
+#endif // wxUSE_PCX
+
+
+#endif
+ // _WX_IMAGPCX_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/imagpng.h
+// Purpose: wxImage PNG handler
+// Author: Robert Roebling
+// Copyright: (c) Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_IMAGPNG_H_
+#define _WX_IMAGPNG_H_
+
+#include "wx/defs.h"
+
+//-----------------------------------------------------------------------------
+// wxPNGHandler
+//-----------------------------------------------------------------------------
+
+#if wxUSE_LIBPNG
+
+#include "wx/image.h"
+#include "wx/versioninfo.h"
+
+#define wxIMAGE_OPTION_PNG_FORMAT wxT("PngFormat")
+#define wxIMAGE_OPTION_PNG_BITDEPTH wxT("PngBitDepth")
+#define wxIMAGE_OPTION_PNG_FILTER wxT("PngF")
+#define wxIMAGE_OPTION_PNG_COMPRESSION_LEVEL wxT("PngZL")
+#define wxIMAGE_OPTION_PNG_COMPRESSION_MEM_LEVEL wxT("PngZM")
+#define wxIMAGE_OPTION_PNG_COMPRESSION_STRATEGY wxT("PngZS")
+#define wxIMAGE_OPTION_PNG_COMPRESSION_BUFFER_SIZE wxT("PngZB")
+
+enum
+{
+ wxPNG_TYPE_COLOUR = 0,
+ wxPNG_TYPE_GREY = 2,
+ wxPNG_TYPE_GREY_RED = 3,
+ wxPNG_TYPE_PALETTE = 4
+};
+
+class WXDLLIMPEXP_CORE wxPNGHandler: public wxImageHandler
+{
+public:
+ inline wxPNGHandler()
+ {
+ m_name = wxT("PNG file");
+ m_extension = wxT("png");
+ m_type = wxBITMAP_TYPE_PNG;
+ m_mime = wxT("image/png");
+ }
+
+ static wxVersionInfo GetLibraryVersionInfo();
+
+#if wxUSE_STREAMS
+ virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
+ virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
+protected:
+ virtual bool DoCanRead( wxInputStream& stream );
+#endif
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPNGHandler)
+};
+
+#endif
+ // wxUSE_LIBPNG
+
+#endif
+ // _WX_IMAGPNG_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/imagpnm.h
+// Purpose: wxImage PNM handler
+// Author: Sylvain Bougnoux
+// Copyright: (c) Sylvain Bougnoux
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_IMAGPNM_H_
+#define _WX_IMAGPNM_H_
+
+#include "wx/image.h"
+
+//-----------------------------------------------------------------------------
+// wxPNMHandler
+//-----------------------------------------------------------------------------
+
+#if wxUSE_PNM
+class WXDLLIMPEXP_CORE wxPNMHandler : public wxImageHandler
+{
+public:
+ inline wxPNMHandler()
+ {
+ m_name = wxT("PNM file");
+ m_extension = wxT("pnm");
+ m_altExtensions.Add(wxT("ppm"));
+ m_altExtensions.Add(wxT("pgm"));
+ m_altExtensions.Add(wxT("pbm"));
+ m_type = wxBITMAP_TYPE_PNM;
+ m_mime = wxT("image/pnm");
+ }
+
+#if wxUSE_STREAMS
+ virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
+ virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
+protected:
+ virtual bool DoCanRead( wxInputStream& stream );
+#endif
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPNMHandler)
+};
+#endif
+
+
+#endif
+ // _WX_IMAGPNM_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/imagtga.h
+// Purpose: wxImage TGA handler
+// Author: Seth Jackson
+// Copyright: (c) 2005 Seth Jackson
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_IMAGTGA_H_
+#define _WX_IMAGTGA_H_
+
+#include "wx/image.h"
+
+//-----------------------------------------------------------------------------
+// wxTGAHandler
+//-----------------------------------------------------------------------------
+
+#if wxUSE_TGA
+
+class WXDLLIMPEXP_CORE wxTGAHandler : public wxImageHandler
+{
+public:
+ wxTGAHandler()
+ {
+ m_name = wxT("TGA file");
+ m_extension = wxT("tga");
+ m_altExtensions.Add(wxT("tpic"));
+ m_type = wxBITMAP_TYPE_TGA;
+ m_mime = wxT("image/tga");
+ }
+
+#if wxUSE_STREAMS
+ virtual bool LoadFile(wxImage* image, wxInputStream& stream,
+ bool verbose = true, int index = -1);
+ virtual bool SaveFile(wxImage* image, wxOutputStream& stream,
+ bool verbose = true);
+protected:
+ virtual bool DoCanRead(wxInputStream& stream);
+#endif // wxUSE_STREAMS
+
+ DECLARE_DYNAMIC_CLASS(wxTGAHandler)
+};
+
+#endif // wxUSE_TGA
+
+#endif // _WX_IMAGTGA_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/imagtiff.h
+// Purpose: wxImage TIFF handler
+// Author: Robert Roebling
+// Copyright: (c) Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_IMAGTIFF_H_
+#define _WX_IMAGTIFF_H_
+
+#include "wx/defs.h"
+
+//-----------------------------------------------------------------------------
+// wxTIFFHandler
+//-----------------------------------------------------------------------------
+
+#if wxUSE_LIBTIFF
+
+#include "wx/image.h"
+#include "wx/versioninfo.h"
+
+// defines for wxImage::SetOption
+#define wxIMAGE_OPTION_TIFF_BITSPERSAMPLE wxString(wxT("BitsPerSample"))
+#define wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL wxString(wxT("SamplesPerPixel"))
+#define wxIMAGE_OPTION_TIFF_COMPRESSION wxString(wxT("Compression"))
+#define wxIMAGE_OPTION_TIFF_PHOTOMETRIC wxString(wxT("Photometric"))
+#define wxIMAGE_OPTION_TIFF_IMAGEDESCRIPTOR wxString(wxT("ImageDescriptor"))
+
+// for backwards compatibility
+#define wxIMAGE_OPTION_BITSPERSAMPLE wxIMAGE_OPTION_TIFF_BITSPERSAMPLE
+#define wxIMAGE_OPTION_SAMPLESPERPIXEL wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL
+#define wxIMAGE_OPTION_COMPRESSION wxIMAGE_OPTION_TIFF_COMPRESSION
+#define wxIMAGE_OPTION_IMAGEDESCRIPTOR wxIMAGE_OPTION_TIFF_IMAGEDESCRIPTOR
+
+class WXDLLIMPEXP_CORE wxTIFFHandler: public wxImageHandler
+{
+public:
+ wxTIFFHandler();
+
+ static wxVersionInfo GetLibraryVersionInfo();
+
+#if wxUSE_STREAMS
+ virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
+ virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
+
+protected:
+ virtual int DoGetImageCount( wxInputStream& stream );
+ virtual bool DoCanRead( wxInputStream& stream );
+#endif
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxTIFFHandler)
+};
+
+#endif // wxUSE_LIBTIFF
+
+#endif // _WX_IMAGTIFF_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/imagxpm.h
+// Purpose: wxImage XPM handler
+// Author: Vaclav Slavik
+// Copyright: (c) 2001 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_IMAGXPM_H_
+#define _WX_IMAGXPM_H_
+
+#include "wx/image.h"
+
+#if wxUSE_XPM
+
+//-----------------------------------------------------------------------------
+// wxXPMHandler
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxXPMHandler : public wxImageHandler
+{
+public:
+ inline wxXPMHandler()
+ {
+ m_name = wxT("XPM file");
+ m_extension = wxT("xpm");
+ m_type = wxBITMAP_TYPE_XPM;
+ m_mime = wxT("image/xpm");
+ }
+
+#if wxUSE_STREAMS
+ virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
+ virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
+protected:
+ virtual bool DoCanRead( wxInputStream& stream );
+#endif
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxXPMHandler)
+};
+
+#endif // wxUSE_XPM
+
+#endif // _WX_IMAGXPM_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/infobar.h
+// Purpose: declaration of wxInfoBarBase defining common API of wxInfoBar
+// Author: Vadim Zeitlin
+// Created: 2009-07-28
+// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_INFOBAR_H_
+#define _WX_INFOBAR_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_INFOBAR
+
+#include "wx/control.h"
+
+// ----------------------------------------------------------------------------
+// wxInfoBar shows non-critical but important information to the user
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxInfoBarBase : public wxControl
+{
+public:
+ // real ctors are provided by the derived classes, just notice that unlike
+ // most of the other windows, info bar is created hidden and must be
+ // explicitly shown when it is needed (this is done because it is supposed
+ // to be shown only intermittently and hiding it after creating it from the
+ // user code would result in flicker)
+ wxInfoBarBase() { }
+
+
+ // show the info bar with the given message and optionally an icon
+ virtual void ShowMessage(const wxString& msg,
+ int flags = wxICON_INFORMATION) = 0;
+
+ // hide the info bar
+ virtual void Dismiss() = 0;
+
+ // add an extra button to the bar, near the message (replacing the default
+ // close button which is only shown if no extra buttons are used)
+ virtual void AddButton(wxWindowID btnid,
+ const wxString& label = wxString()) = 0;
+
+ // remove a button previously added by AddButton()
+ virtual void RemoveButton(wxWindowID btnid) = 0;
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxInfoBarBase);
+};
+
+// currently only GTK+ has a native implementation
+#if defined(__WXGTK218__) && !defined(__WXUNIVERSAL__)
+ #include "wx/gtk/infobar.h"
+ #define wxHAS_NATIVE_INFOBAR
+#endif // wxGTK2
+
+// if the generic version is the only one we have, use it
+#ifndef wxHAS_NATIVE_INFOBAR
+ #include "wx/generic/infobar.h"
+ #define wxInfoBar wxInfoBarGeneric
+#endif
+
+#endif // wxUSE_INFOBAR
+
+#endif // _WX_INFOBAR_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/init.h
+// Purpose: wxWidgets initialization and finalization functions
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 29.06.2003
+// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_INIT_H_
+#define _WX_INIT_H_
+
+#include "wx/defs.h"
+#include "wx/chartype.h"
+
+// ----------------------------------------------------------------------------
+// wxEntry helper functions which allow to have more fine grained control
+// ----------------------------------------------------------------------------
+
+// do common initialization, return true if ok (in this case wxEntryCleanup
+// must be called later), otherwise the program can't use wxWidgets at all
+//
+// this function also creates wxTheApp as a side effect, if IMPLEMENT_APP
+// hadn't been used a dummy default application object is created
+//
+// note that the parameters may be modified, this is why we pass them by
+// reference!
+extern bool WXDLLIMPEXP_BASE wxEntryStart(int& argc, wxChar **argv);
+
+// free the resources allocated by the library in wxEntryStart() and shut it
+// down (wxEntryStart() may be called again afterwards if necessary)
+extern void WXDLLIMPEXP_BASE wxEntryCleanup();
+
+
+// ----------------------------------------------------------------------------
+// wxEntry: this function initializes the library, runs the main event loop
+// and cleans it up
+// ----------------------------------------------------------------------------
+
+// note that other, platform-specific, overloads of wxEntry may exist as well
+// but this one always exists under all platforms
+//
+// returns the program exit code
+extern int WXDLLIMPEXP_BASE wxEntry(int& argc, wxChar **argv);
+
+// we overload wxEntry[Start]() to take "char **" pointers too
+#if wxUSE_UNICODE
+
+extern bool WXDLLIMPEXP_BASE wxEntryStart(int& argc, char **argv);
+extern int WXDLLIMPEXP_BASE wxEntry(int& argc, char **argv);
+
+#endif// wxUSE_UNICODE
+
+// Under Windows we define additional wxEntry() overloads with signature
+// compatible with WinMain() and not the traditional main().
+#if wxUSE_GUI && defined(__WINDOWS__)
+ #include "wx/msw/init.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// Using the library without (explicit) application object: you may avoid using
+// wxDECLARE_APP and wxIMPLEMENT_APP macros and call the functions below instead at
+// the program startup and termination
+// ----------------------------------------------------------------------------
+
+// initialize the library (may be called as many times as needed, but each
+// call to wxInitialize() must be matched by wxUninitialize())
+extern bool WXDLLIMPEXP_BASE wxInitialize();
+extern bool WXDLLIMPEXP_BASE wxInitialize(int argc, wxChar **argv);
+#if wxUSE_UNICODE
+extern bool WXDLLIMPEXP_BASE wxInitialize(int argc, char **argv);
+#endif
+
+// clean up -- the library can't be used any more after the last call to
+// wxUninitialize()
+extern void WXDLLIMPEXP_BASE wxUninitialize();
+
+// create an object of this class on stack to initialize/cleanup the library
+// automatically
+class WXDLLIMPEXP_BASE wxInitializer
+{
+public:
+ // initialize the library
+ wxInitializer()
+ {
+ m_ok = wxInitialize();
+ }
+
+ wxInitializer(int argc, wxChar **argv)
+ {
+ m_ok = wxInitialize(argc, argv);
+ }
+
+#if wxUSE_UNICODE
+ wxInitializer(int argc, char **argv)
+ {
+ m_ok = wxInitialize(argc, argv);
+ }
+#endif // wxUSE_UNICODE
+
+ // has the initialization been successful? (explicit test)
+ bool IsOk() const { return m_ok; }
+
+ // has the initialization been successful? (implicit test)
+ operator bool() const { return m_ok; }
+
+ // dtor only does clean up if we initialized the library properly
+ ~wxInitializer() { if ( m_ok ) wxUninitialize(); }
+
+private:
+ bool m_ok;
+};
+
+#endif // _WX_INIT_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/intl.h
+// Purpose: Internationalization and localisation for wxWidgets
+// Author: Vadim Zeitlin
+// Modified by: Michael N. Filippov <michael@idisys.iae.nsk.su>
+// (2003/09/30 - plural forms support)
+// Created: 29/01/98
+// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_INTL_H_
+#define _WX_INTL_H_
+
+#include "wx/defs.h"
+#include "wx/string.h"
+#include "wx/translation.h"
+
+// Make wxLayoutDirection enum available without need for wxUSE_INTL so wxWindow, wxApp
+// and other classes are not distrubed by wxUSE_INTL
+
+enum wxLayoutDirection
+{
+ wxLayout_Default,
+ wxLayout_LeftToRight,
+ wxLayout_RightToLeft
+};
+
+#if wxUSE_INTL
+
+#include "wx/fontenc.h"
+#include "wx/language.h"
+
+// ============================================================================
+// global decls
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// macros
+// ----------------------------------------------------------------------------
+
+// ----------------------------------------------------------------------------
+// forward decls
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_BASE wxLocale;
+class WXDLLIMPEXP_FWD_BASE wxLanguageInfoArray;
+
+// ============================================================================
+// locale support
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxLanguageInfo: encapsulates wxLanguage to OS native lang.desc.
+// translation information
+// ----------------------------------------------------------------------------
+
+struct WXDLLIMPEXP_BASE wxLanguageInfo
+{
+ int Language; // wxLanguage id
+ wxString CanonicalName; // Canonical name, e.g. fr_FR
+#ifdef __WINDOWS__
+ wxUint32 WinLang, // Win32 language identifiers
+ WinSublang;
+#endif // __WINDOWS__
+ wxString Description; // human-readable name of the language
+ wxLayoutDirection LayoutDirection;
+
+#ifdef __WINDOWS__
+ // return the LCID corresponding to this language
+ wxUint32 GetLCID() const;
+#endif // __WINDOWS__
+
+ // return the locale name corresponding to this language usable with
+ // setlocale() on the current system
+ wxString GetLocaleName() const;
+};
+
+// for Unix systems GetLocaleName() is trivial so implement it inline here, for
+// MSW it's implemented in intl.cpp
+#ifndef __WINDOWS__
+inline wxString wxLanguageInfo::GetLocaleName() const { return CanonicalName; }
+#endif // !__WINDOWS__
+
+
+// ----------------------------------------------------------------------------
+// wxLocaleCategory: the category of locale settings
+// ----------------------------------------------------------------------------
+
+enum wxLocaleCategory
+{
+ // (any) numbers
+ wxLOCALE_CAT_NUMBER,
+
+ // date/time
+ wxLOCALE_CAT_DATE,
+
+ // monetary value
+ wxLOCALE_CAT_MONEY,
+
+ // default category for wxLocaleInfo values which only apply to a single
+ // category (e.g. wxLOCALE_SHORT_DATE_FMT)
+ wxLOCALE_CAT_DEFAULT,
+
+ wxLOCALE_CAT_MAX
+};
+
+// ----------------------------------------------------------------------------
+// wxLocaleInfo: the items understood by wxLocale::GetInfo()
+// ----------------------------------------------------------------------------
+
+enum wxLocaleInfo
+{
+ // the thousands separator (for wxLOCALE_CAT_NUMBER or MONEY)
+ wxLOCALE_THOUSANDS_SEP,
+
+ // the character used as decimal point (for wxLOCALE_CAT_NUMBER or MONEY)
+ wxLOCALE_DECIMAL_POINT,
+
+ // the stftime()-formats used for short/long date and time representations
+ // (under some platforms short and long date formats are the same)
+ //
+ // NB: these elements should appear in this order, code in GetInfo() relies
+ // on it
+ wxLOCALE_SHORT_DATE_FMT,
+ wxLOCALE_LONG_DATE_FMT,
+ wxLOCALE_DATE_TIME_FMT,
+ wxLOCALE_TIME_FMT
+
+};
+
+// ----------------------------------------------------------------------------
+// wxLocale: encapsulates all language dependent settings, including current
+// message catalogs, date, time and currency formats (TODO) &c
+// ----------------------------------------------------------------------------
+
+enum wxLocaleInitFlags
+{
+ wxLOCALE_DONT_LOAD_DEFAULT = 0x0000, // don't load wxwin.mo
+ wxLOCALE_LOAD_DEFAULT = 0x0001 // load wxwin.mo?
+#if WXWIN_COMPATIBILITY_2_8
+ ,wxLOCALE_CONV_ENCODING = 0x0002 // no longer used, simply remove
+ // it from the existing code
+#endif
+};
+
+class WXDLLIMPEXP_BASE wxLocale
+{
+public:
+ // ctor & dtor
+ // -----------
+
+ // call Init() if you use this ctor
+ wxLocale() { DoCommonInit(); }
+
+ // the ctor has a side effect of changing current locale
+ wxLocale(const wxString& name, // name (for messages)
+ const wxString& shortName = wxEmptyString, // dir prefix (for msg files)
+ const wxString& locale = wxEmptyString, // locale (for setlocale)
+ bool bLoadDefault = true // preload wxstd.mo?
+#if WXWIN_COMPATIBILITY_2_8
+ ,bool bConvertEncoding = true // convert Win<->Unix if necessary?
+#endif
+ )
+ {
+ DoCommonInit();
+
+#if WXWIN_COMPATIBILITY_2_8
+ Init(name, shortName, locale, bLoadDefault, bConvertEncoding);
+#else
+ Init(name, shortName, locale, bLoadDefault);
+#endif
+ }
+
+ wxLocale(int language, // wxLanguage id or custom language
+ int flags = wxLOCALE_LOAD_DEFAULT)
+ {
+ DoCommonInit();
+
+ Init(language, flags);
+ }
+
+ // the same as a function (returns true on success)
+ bool Init(const wxString& name,
+ const wxString& shortName = wxEmptyString,
+ const wxString& locale = wxEmptyString,
+ bool bLoadDefault = true
+#if WXWIN_COMPATIBILITY_2_8
+ ,bool bConvertEncoding = true
+#endif
+ );
+
+ // same as second ctor (returns true on success)
+ bool Init(int language = wxLANGUAGE_DEFAULT,
+ int flags = wxLOCALE_LOAD_DEFAULT);
+
+ // restores old locale
+ virtual ~wxLocale();
+
+ // Try to get user's (or OS's) preferred language setting.
+ // Return wxLANGUAGE_UNKNOWN if language-guessing algorithm failed
+ static int GetSystemLanguage();
+
+ // get the encoding used by default for text on this system, returns
+ // wxFONTENCODING_SYSTEM if it couldn't be determined
+ static wxFontEncoding GetSystemEncoding();
+
+ // get the string describing the system encoding, return empty string if
+ // couldn't be determined
+ static wxString GetSystemEncodingName();
+
+ // get the values of the given locale-dependent datum: the current locale
+ // is used, the US default value is returned if everything else fails
+ static wxString GetInfo(wxLocaleInfo index,
+ wxLocaleCategory cat = wxLOCALE_CAT_DEFAULT);
+
+ // return true if the locale was set successfully
+ bool IsOk() const { return m_pszOldLocale != NULL; }
+
+ // returns locale name
+ const wxString& GetLocale() const { return m_strLocale; }
+
+ // return current locale wxLanguage value
+ int GetLanguage() const { return m_language; }
+
+ // return locale name to be passed to setlocale()
+ wxString GetSysName() const;
+
+ // return 'canonical' name, i.e. in the form of xx[_YY], where xx is
+ // language code according to ISO 639 and YY is country name
+ // as specified by ISO 3166.
+ wxString GetCanonicalName() const { return m_strShort; }
+
+ // add a prefix to the catalog lookup path: the message catalog files will be
+ // looked up under prefix/<lang>/LC_MESSAGES, prefix/LC_MESSAGES and prefix
+ // (in this order).
+ //
+ // This only applies to subsequent invocations of AddCatalog()!
+ static void AddCatalogLookupPathPrefix(const wxString& prefix)
+ { wxFileTranslationsLoader::AddCatalogLookupPathPrefix(prefix); }
+
+ // add a catalog: it's searched for in standard places (current directory
+ // first, system one after), but the you may prepend additional directories to
+ // the search path with AddCatalogLookupPathPrefix().
+ //
+ // The loaded catalog will be used for message lookup by GetString().
+ //
+ // Returns 'true' if it was successfully loaded
+ bool AddCatalog(const wxString& domain);
+ bool AddCatalog(const wxString& domain, wxLanguage msgIdLanguage);
+ bool AddCatalog(const wxString& domain,
+ wxLanguage msgIdLanguage, const wxString& msgIdCharset);
+
+ // check if the given locale is provided by OS and C run time
+ static bool IsAvailable(int lang);
+
+ // check if the given catalog is loaded
+ bool IsLoaded(const wxString& domain) const;
+
+ // Retrieve the language info struct for the given language
+ //
+ // Returns NULL if no info found, pointer must *not* be deleted by caller
+ static const wxLanguageInfo *GetLanguageInfo(int lang);
+
+ // Returns language name in English or empty string if the language
+ // is not in database
+ static wxString GetLanguageName(int lang);
+
+ // Returns ISO code ("canonical name") of language or empty string if the
+ // language is not in database
+ static wxString GetLanguageCanonicalName(int lang);
+
+ // Find the language for the given locale string which may be either a
+ // canonical ISO 2 letter language code ("xx"), a language code followed by
+ // the country code ("xx_XX") or a Windows full language name ("Xxxxx...")
+ //
+ // Returns NULL if no info found, pointer must *not* be deleted by caller
+ static const wxLanguageInfo *FindLanguageInfo(const wxString& locale);
+
+ // Add custom language to the list of known languages.
+ // Notes: 1) wxLanguageInfo contains platform-specific data
+ // 2) must be called before Init to have effect
+ static void AddLanguage(const wxLanguageInfo& info);
+
+ // retrieve the translation for a string in all loaded domains unless
+ // the szDomain parameter is specified (and then only this domain is
+ // searched)
+ // n - additional parameter for PluralFormsParser
+ //
+ // return original string if translation is not available
+ // (in this case an error message is generated the first time
+ // a string is not found; use wxLogNull to suppress it)
+ //
+ // domains are searched in the last to first order, i.e. catalogs
+ // added later override those added before.
+ const wxString& GetString(const wxString& origString,
+ const wxString& domain = wxEmptyString) const
+ {
+ return wxGetTranslation(origString, domain);
+ }
+ // plural form version of the same:
+ const wxString& GetString(const wxString& origString,
+ const wxString& origString2,
+ unsigned n,
+ const wxString& domain = wxEmptyString) const
+ {
+ return wxGetTranslation(origString, origString2, n, domain);
+ }
+
+ // Returns the current short name for the locale
+ const wxString& GetName() const { return m_strShort; }
+
+ // return the contents of .po file header
+ wxString GetHeaderValue(const wxString& header,
+ const wxString& domain = wxEmptyString) const;
+
+ // These two methods are for internal use only. First one creates
+ // ms_languagesDB if it doesn't already exist, second one destroys
+ // it.
+ static void CreateLanguagesDB();
+ static void DestroyLanguagesDB();
+
+private:
+ bool DoInit(const wxString& name,
+ const wxString& shortName,
+ const wxString& locale);
+
+ // copy default table of languages from global static array to
+ // m_langugagesInfo, called by InitLanguagesDB
+ static void InitLanguagesDB();
+
+ // initialize the member fields to default values
+ void DoCommonInit();
+
+ wxString m_strLocale, // this locale name
+ m_strShort; // short name for the locale
+ int m_language; // this locale wxLanguage value
+
+ const char *m_pszOldLocale; // previous locale from setlocale()
+ wxLocale *m_pOldLocale; // previous wxLocale
+
+ bool m_initialized;
+
+ wxTranslations m_translations;
+
+ static wxLanguageInfoArray *ms_languagesDB;
+
+ wxDECLARE_NO_COPY_CLASS(wxLocale);
+};
+
+// ----------------------------------------------------------------------------
+// global functions
+// ----------------------------------------------------------------------------
+
+// get the current locale object (note that it may be NULL!)
+extern WXDLLIMPEXP_BASE wxLocale* wxGetLocale();
+
+#endif // wxUSE_INTL
+
+#endif // _WX_INTL_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/iosfwrap.h
+// Purpose: includes the correct stream-related forward declarations
+// Author: Jan van Dijk <jan@etpmod.phys.tue.nl>
+// Modified by:
+// Created: 18.12.2002
+// Copyright: wxWidgets team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#if wxUSE_STD_IOSTREAM
+
+#if wxUSE_IOSTREAMH
+ // There is no pre-ANSI iosfwd header so we include the full declarations.
+# include <iostream.h>
+#else
+# include <iosfwd>
+#endif
+
+#ifdef __WINDOWS__
+# include "wx/msw/winundef.h"
+#endif
+
+#endif // wxUSE_STD_IOSTREAM
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/ioswrap.h
+// Purpose: includes the correct iostream headers for current compiler
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 03.02.99
+// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#if wxUSE_STD_IOSTREAM
+
+#include "wx/beforestd.h"
+
+#if wxUSE_IOSTREAMH
+# include <iostream.h>
+#else
+# include <iostream>
+#endif
+
+#include "wx/afterstd.h"
+
+#ifdef __WINDOWS__
+# include "wx/msw/winundef.h"
+#endif
+
+#endif
+ // wxUSE_STD_IOSTREAM
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/ipc.h
+// Purpose: wrapper around different wxIPC classes implementations
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 15.04.02
+// Copyright: (c) 2002 Vadim Zeitlin
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_IPC_H_
+#define _WX_IPC_H_
+
+// Set wxUSE_DDE_FOR_IPC to 1 to use DDE for IPC under Windows. If it is set to
+// 0, or if the platform is not Windows, use TCP/IP for IPC implementation
+
+#if !defined(wxUSE_DDE_FOR_IPC)
+ #ifdef __WINDOWS__
+ #define wxUSE_DDE_FOR_IPC 1
+ #else
+ #define wxUSE_DDE_FOR_IPC 0
+ #endif
+#endif // !defined(wxUSE_DDE_FOR_IPC)
+
+#if !defined(__WINDOWS__)
+ #undef wxUSE_DDE_FOR_IPC
+ #define wxUSE_DDE_FOR_IPC 0
+#endif
+
+#if wxUSE_DDE_FOR_IPC
+ #define wxConnection wxDDEConnection
+ #define wxServer wxDDEServer
+ #define wxClient wxDDEClient
+
+ #include "wx/dde.h"
+#else // !wxUSE_DDE_FOR_IPC
+ #define wxConnection wxTCPConnection
+ #define wxServer wxTCPServer
+ #define wxClient wxTCPClient
+
+ #include "wx/sckipc.h"
+#endif // wxUSE_DDE_FOR_IPC/!wxUSE_DDE_FOR_IPC
+
+#endif // _WX_IPC_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/ipcbase.h
+// Purpose: Base classes for IPC
+// Author: Julian Smart
+// Modified by:
+// Created: 4/1/98
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_IPCBASEH__
+#define _WX_IPCBASEH__
+
+#include "wx/defs.h"
+#include "wx/object.h"
+#include "wx/string.h"
+
+enum wxIPCFormat
+{
+ wxIPC_INVALID = 0,
+ wxIPC_TEXT = 1, /* CF_TEXT */
+ wxIPC_BITMAP = 2, /* CF_BITMAP */
+ wxIPC_METAFILE = 3, /* CF_METAFILEPICT */
+ wxIPC_SYLK = 4,
+ wxIPC_DIF = 5,
+ wxIPC_TIFF = 6,
+ wxIPC_OEMTEXT = 7, /* CF_OEMTEXT */
+ wxIPC_DIB = 8, /* CF_DIB */
+ wxIPC_PALETTE = 9,
+ wxIPC_PENDATA = 10,
+ wxIPC_RIFF = 11,
+ wxIPC_WAVE = 12,
+ wxIPC_UTF16TEXT = 13, /* CF_UNICODE */
+ wxIPC_ENHMETAFILE = 14,
+ wxIPC_FILENAME = 15, /* CF_HDROP */
+ wxIPC_LOCALE = 16,
+ wxIPC_UTF8TEXT = 17,
+ wxIPC_UTF32TEXT = 18,
+#if SIZEOF_WCHAR_T == 2
+ wxIPC_UNICODETEXT = wxIPC_UTF16TEXT,
+#elif SIZEOF_WCHAR_T == 4
+ wxIPC_UNICODETEXT = wxIPC_UTF32TEXT,
+#else
+# error "Unknown wchar_t size"
+#endif
+ wxIPC_PRIVATE = 20
+};
+
+class WXDLLIMPEXP_FWD_BASE wxServerBase;
+class WXDLLIMPEXP_FWD_BASE wxClientBase;
+
+class WXDLLIMPEXP_BASE wxConnectionBase: public wxObject
+{
+public:
+ wxConnectionBase(void *buffer, size_t size); // use external buffer
+ wxConnectionBase(); // use internal, adaptive buffer
+ wxConnectionBase(const wxConnectionBase& copy);
+ virtual ~wxConnectionBase();
+
+ void SetConnected( bool c ) { m_connected = c; }
+ bool GetConnected() { return m_connected; }
+
+ // Calls that CLIENT can make
+ bool Execute(const void *data, size_t size, wxIPCFormat fmt = wxIPC_PRIVATE)
+ { return DoExecute(data, size, fmt); }
+ bool Execute(const char *s, size_t size = wxNO_LEN)
+ { return DoExecute(s, size == wxNO_LEN ? strlen(s) + 1
+ : size, wxIPC_TEXT); }
+ bool Execute(const wchar_t *ws, size_t size = wxNO_LEN)
+ { return DoExecute(ws, size == wxNO_LEN ? (wcslen(ws) + 1)*sizeof(wchar_t)
+ : size, wxIPC_UNICODETEXT); }
+ bool Execute(const wxString& s)
+ {
+ const wxScopedCharBuffer buf = s.utf8_str();
+ return DoExecute(buf, strlen(buf) + 1, wxIPC_UTF8TEXT);
+ }
+ bool Execute(const wxCStrData& cs)
+ { return Execute(cs.AsString()); }
+
+ virtual const void *Request(const wxString& item,
+ size_t *size = NULL,
+ wxIPCFormat format = wxIPC_TEXT) = 0;
+
+ bool Poke(const wxString& item, const void *data, size_t size,
+ wxIPCFormat fmt = wxIPC_PRIVATE)
+ { return DoPoke(item, data, size, fmt); }
+ bool Poke(const wxString& item, const char *s, size_t size = wxNO_LEN)
+ { return DoPoke(item, s, size == wxNO_LEN ? strlen(s) + 1
+ : size, wxIPC_TEXT); }
+ bool Poke(const wxString& item, const wchar_t *ws, size_t size = wxNO_LEN)
+ { return DoPoke(item, ws,
+ size == wxNO_LEN ? (wcslen(ws) + 1)*sizeof(wchar_t)
+ : size, wxIPC_UNICODETEXT); }
+ bool Poke(const wxString& item, const wxString s)
+ {
+ const wxScopedCharBuffer buf = s.utf8_str();
+ return DoPoke(item, buf, strlen(buf) + 1, wxIPC_UTF8TEXT);
+ }
+ bool Poke(const wxString& item, const wxCStrData& cs)
+ { return Poke(item, cs.AsString()); }
+
+ virtual bool StartAdvise(const wxString& item) = 0;
+ virtual bool StopAdvise(const wxString& item) = 0;
+
+ // Calls that SERVER can make
+ bool Advise(const wxString& item, const void *data, size_t size,
+ wxIPCFormat fmt = wxIPC_PRIVATE)
+ { return DoAdvise(item, data, size, fmt); }
+ bool Advise(const wxString& item, const char *s, size_t size = wxNO_LEN)
+ { return DoAdvise(item, s, size == wxNO_LEN ? strlen(s) + 1
+ : size, wxIPC_TEXT); }
+ bool Advise(const wxString& item, const wchar_t *ws, size_t size = wxNO_LEN)
+ { return DoAdvise(item, ws,
+ size == wxNO_LEN ? (wcslen(ws) + 1)*sizeof(wchar_t)
+ : size, wxIPC_UNICODETEXT); }
+ bool Advise(const wxString& item, const wxString s)
+ {
+ const wxScopedCharBuffer buf = s.utf8_str();
+ return DoAdvise(item, buf, strlen(buf) + 1, wxIPC_UTF8TEXT);
+ }
+ bool Advise(const wxString& item, const wxCStrData& cs)
+ { return Advise(item, cs.AsString()); }
+
+ // Calls that both can make
+ virtual bool Disconnect() = 0;
+
+
+ // Callbacks to SERVER - override at will
+ virtual bool OnExec(const wxString& WXUNUSED(topic),
+ const wxString& WXUNUSED(data))
+ {
+ wxFAIL_MSG( "This method shouldn't be called, if it is, it probably "
+ "means that you didn't update your old code overriding "
+ "OnExecute() to use the new parameter types (\"const void *\" "
+ "instead of \"wxChar *\" and \"size_t\" instead of \"int\"), "
+ "you must do it or your code wouldn't be executed at all!" );
+ return false;
+ }
+
+ // deprecated function kept for backwards compatibility: usually you will
+ // want to override OnExec() above instead which receives its data in a more
+ // convenient format
+ virtual bool OnExecute(const wxString& topic,
+ const void *data,
+ size_t size,
+ wxIPCFormat format)
+ { return OnExec(topic, GetTextFromData(data, size, format)); }
+
+ virtual const void *OnRequest(const wxString& WXUNUSED(topic),
+ const wxString& WXUNUSED(item),
+ size_t *size,
+ wxIPCFormat WXUNUSED(format))
+ { *size = 0; return NULL; }
+
+ virtual bool OnPoke(const wxString& WXUNUSED(topic),
+ const wxString& WXUNUSED(item),
+ const void *WXUNUSED(data),
+ size_t WXUNUSED(size),
+ wxIPCFormat WXUNUSED(format))
+ { return false; }
+
+ virtual bool OnStartAdvise(const wxString& WXUNUSED(topic),
+ const wxString& WXUNUSED(item))
+ { return false; }
+
+ virtual bool OnStopAdvise(const wxString& WXUNUSED(topic),
+ const wxString& WXUNUSED(item))
+ { return false; }
+
+ // Callbacks to CLIENT - override at will
+ virtual bool OnAdvise(const wxString& WXUNUSED(topic),
+ const wxString& WXUNUSED(item),
+ const void *WXUNUSED(data),
+ size_t WXUNUSED(size),
+ wxIPCFormat WXUNUSED(format))
+ { return false; }
+
+ // Callbacks to BOTH
+ virtual bool OnDisconnect() { delete this; return true; }
+
+
+ // return true if this is one of the formats used for textual data
+ // transmission
+ static bool IsTextFormat(wxIPCFormat format)
+ {
+ return format == wxIPC_TEXT ||
+ format == wxIPC_UTF8TEXT ||
+ format == wxIPC_UTF16TEXT ||
+ format == wxIPC_UTF32TEXT;
+ }
+
+ // converts from the data and format into a wxString automatically
+ //
+ // this function accepts data in all of wxIPC_TEXT, wxIPC_UNICODETEXT, and
+ // wxIPC_UTF8TEXT formats but asserts if the format is anything else (i.e.
+ // such that IsTextFormat(format) doesn't return true)
+ //
+ // notice that the size parameter here contains the total size of the data,
+ // including the terminating '\0' or L'\0'
+ static
+ wxString GetTextFromData(const void *data, size_t size, wxIPCFormat format);
+
+
+ // return a buffer at least this size, reallocating buffer if needed
+ // returns NULL if using an inadequate user buffer which can't be resized
+ void *GetBufferAtLeast(size_t bytes);
+
+protected:
+ virtual bool DoExecute(const void *data, size_t size, wxIPCFormat format) = 0;
+ virtual bool DoPoke(const wxString& item, const void *data, size_t size,
+ wxIPCFormat format) = 0;
+ virtual bool DoAdvise(const wxString& item, const void *data, size_t size,
+ wxIPCFormat format) = 0;
+
+
+private:
+ char *m_buffer;
+ size_t m_buffersize;
+ bool m_deletebufferwhendone;
+
+protected:
+ bool m_connected;
+
+ wxDECLARE_NO_ASSIGN_CLASS(wxConnectionBase);
+ DECLARE_CLASS(wxConnectionBase)
+};
+
+
+class WXDLLIMPEXP_BASE wxServerBase : public wxObject
+{
+public:
+ wxServerBase() { }
+ virtual ~wxServerBase() { }
+
+ // Returns false on error (e.g. port number is already in use)
+ virtual bool Create(const wxString& serverName) = 0;
+
+ // Callbacks to SERVER - override at will
+ virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) = 0;
+
+ DECLARE_CLASS(wxServerBase)
+};
+
+class WXDLLIMPEXP_BASE wxClientBase : public wxObject
+{
+public:
+ wxClientBase() { }
+ virtual ~wxClientBase() { }
+
+ virtual bool ValidHost(const wxString& host) = 0;
+
+ // Call this to make a connection. Returns NULL if cannot.
+ virtual wxConnectionBase *MakeConnection(const wxString& host,
+ const wxString& server,
+ const wxString& topic) = 0;
+
+ // Callbacks to CLIENT - override at will
+ virtual wxConnectionBase *OnMakeConnection() = 0;
+
+ DECLARE_CLASS(wxClientBase)
+};
+
+#endif // _WX_IPCBASEH__
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/itemid.h
+// Purpose: wxItemId class declaration.
+// Author: Vadim Zeitlin
+// Created: 2011-08-17
+// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_ITEMID_H_
+#define _WX_ITEMID_H_
+
+// ----------------------------------------------------------------------------
+// wxItemId: an opaque item identifier used with wx{Tree,TreeList,DataView}Ctrl.
+// ----------------------------------------------------------------------------
+
+// The template argument T is typically a pointer to some opaque type. While
+// wxTreeItemId and wxDataViewItem use a pointer to void, this is dangerous and
+// not recommended for the new item id classes.
+template <typename T>
+class wxItemId
+{
+public:
+ typedef T Type;
+
+ // This ctor is implicit which is fine for non-void* types, but if you use
+ // this class with void* you're strongly advised to make the derived class
+ // ctor explicit as implicitly converting from any pointer is simply too
+ // dangerous.
+ wxItemId(Type item = NULL) : m_pItem(item) { }
+
+ // Default copy ctor, assignment operator and dtor are ok.
+
+ bool IsOk() const { return m_pItem != NULL; }
+ Type GetID() const { return m_pItem; }
+ operator const Type() const { return m_pItem; }
+
+ // This is used for implementation purposes only.
+ Type operator->() const { return m_pItem; }
+
+ void Unset() { m_pItem = NULL; }
+
+ // This field is public *only* for compatibility with the old wxTreeItemId
+ // implementation and must not be used in any new code.
+//private:
+ Type m_pItem;
+};
+
+template <typename T>
+bool operator==(const wxItemId<T>& left, const wxItemId<T>& right)
+{
+ return left.GetID() == right.GetID();
+}
+
+template <typename T>
+bool operator!=(const wxItemId<T>& left, const wxItemId<T>& right)
+{
+ return !(left == right);
+}
+
+#endif // _WX_ITEMID_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/joystick.h
+// Purpose: wxJoystick base header
+// Author: wxWidgets Team
+// Modified by:
+// Created:
+// Copyright: (c) wxWidgets Team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_JOYSTICK_H_BASE_
+#define _WX_JOYSTICK_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_JOYSTICK
+
+#if defined(__WINDOWS__)
+#include "wx/msw/joystick.h"
+#elif defined(__WXMOTIF__)
+#include "wx/unix/joystick.h"
+#elif defined(__WXGTK__)
+#include "wx/unix/joystick.h"
+#elif defined(__WXX11__)
+#include "wx/unix/joystick.h"
+#elif defined(__DARWIN__)
+#include "wx/osx/core/joystick.h"
+#elif defined(__WXMAC__)
+#include "wx/osx/joystick.h"
+#elif defined(__WXPM__)
+#include "wx/os2/joystick.h"
+#endif
+
+#endif // wxUSE_JOYSTICK
+
+#endif
+ // _WX_JOYSTICK_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/kbdstate.h
+// Purpose: Declaration of wxKeyboardState class
+// Author: Vadim Zeitlin
+// Created: 2008-09-19
+// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_KBDSTATE_H_
+#define _WX_KBDSTATE_H_
+
+#include "wx/defs.h"
+
+// ----------------------------------------------------------------------------
+// wxKeyboardState stores the state of the keyboard modifier keys
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxKeyboardState
+{
+public:
+ wxKeyboardState(bool controlDown = false,
+ bool shiftDown = false,
+ bool altDown = false,
+ bool metaDown = false)
+ : m_controlDown(controlDown),
+ m_shiftDown(shiftDown),
+ m_altDown(altDown),
+ m_metaDown(metaDown)
+#ifdef __WXOSX__
+ ,m_rawControlDown(false)
+#endif
+ {
+ }
+
+ // default copy ctor, assignment operator and dtor are ok
+
+
+ // accessors for the various modifier keys
+ // ---------------------------------------
+
+ // should be used check if the key event has exactly the given modifiers:
+ // "GetModifiers() = wxMOD_CONTROL" is easier to write than "ControlDown()
+ // && !MetaDown() && !AltDown() && !ShiftDown()"
+ int GetModifiers() const
+ {
+ return (m_controlDown ? wxMOD_CONTROL : 0) |
+ (m_shiftDown ? wxMOD_SHIFT : 0) |
+ (m_metaDown ? wxMOD_META : 0) |
+#ifdef __WXOSX__
+ (m_rawControlDown ? wxMOD_RAW_CONTROL : 0) |
+#endif
+ (m_altDown ? wxMOD_ALT : 0);
+ }
+
+ // returns true if any modifiers at all are pressed
+ bool HasAnyModifiers() const { return GetModifiers() != wxMOD_NONE; }
+
+ // returns true if any modifiers changing the usual key interpretation are
+ // pressed, notably excluding Shift
+ bool HasModifiers() const
+ {
+ return ControlDown() || RawControlDown() || AltDown();
+ }
+
+ // accessors for individual modifier keys
+ bool ControlDown() const { return m_controlDown; }
+ bool RawControlDown() const
+ {
+#ifdef __WXOSX__
+ return m_rawControlDown;
+#else
+ return m_controlDown;
+#endif
+ }
+ bool ShiftDown() const { return m_shiftDown; }
+ bool MetaDown() const { return m_metaDown; }
+ bool AltDown() const { return m_altDown; }
+
+ // "Cmd" is a pseudo key which is Control for PC and Unix platforms but
+ // Apple ("Command") key under Macs: it makes often sense to use it instead
+ // of, say, ControlDown() because Cmd key is used for the same thing under
+ // Mac as Ctrl elsewhere (but Ctrl still exists, just not used for this
+ // purpose under Mac)
+ bool CmdDown() const
+ {
+ return ControlDown();
+ }
+
+ // these functions are mostly used by wxWidgets itself
+ // ---------------------------------------------------
+
+ void SetControlDown(bool down) { m_controlDown = down; }
+ void SetRawControlDown(bool down)
+ {
+#ifdef __WXOSX__
+ m_rawControlDown = down;
+#else
+ m_controlDown = down;
+#endif
+ }
+ void SetShiftDown(bool down) { m_shiftDown = down; }
+ void SetAltDown(bool down) { m_altDown = down; }
+ void SetMetaDown(bool down) { m_metaDown = down; }
+
+
+ // for backwards compatibility with the existing code accessing these
+ // members of wxKeyEvent directly, these variables are public, however you
+ // should not use them in any new code, please use the accessors instead
+public:
+ bool m_controlDown : 1;
+ bool m_shiftDown : 1;
+ bool m_altDown : 1;
+ bool m_metaDown : 1;
+#ifdef __WXOSX__
+ bool m_rawControlDown : 1;
+#endif
+};
+
+#endif // _WX_KBDSTATE_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/language.h
+// Purpose: wxLanguage enum
+// Author: Vadim Zeitlin
+// Created: 2010-04-23
+// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// WARNING: Parts of this file are generated. See misc/languages/README for
+// details.
+
+#ifndef _WX_LANGUAGE_H_
+#define _WX_LANGUAGE_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_INTL
+
+// ----------------------------------------------------------------------------
+// wxLanguage: defines all supported languages
+// ----------------------------------------------------------------------------
+
+// --- --- --- generated code begins here --- --- ---
+
+/**
+ The languages supported by wxLocale.
+
+ This enum is generated by misc/languages/genlang.py
+ When making changes, please put them into misc/languages/langtabl.txt
+*/
+enum wxLanguage
+{
+ /// User's default/preffered language as got from OS.
+ wxLANGUAGE_DEFAULT,
+
+ /// Unknown language, returned if wxLocale::GetSystemLanguage fails.
+ wxLANGUAGE_UNKNOWN,
+
+ wxLANGUAGE_ABKHAZIAN,
+ wxLANGUAGE_AFAR,
+ wxLANGUAGE_AFRIKAANS,
+ wxLANGUAGE_ALBANIAN,
+ wxLANGUAGE_AMHARIC,
+ wxLANGUAGE_ARABIC,
+ wxLANGUAGE_ARABIC_ALGERIA,
+ wxLANGUAGE_ARABIC_BAHRAIN,
+ wxLANGUAGE_ARABIC_EGYPT,
+ wxLANGUAGE_ARABIC_IRAQ,
+ wxLANGUAGE_ARABIC_JORDAN,
+ wxLANGUAGE_ARABIC_KUWAIT,
+ wxLANGUAGE_ARABIC_LEBANON,
+ wxLANGUAGE_ARABIC_LIBYA,
+ wxLANGUAGE_ARABIC_MOROCCO,
+ wxLANGUAGE_ARABIC_OMAN,
+ wxLANGUAGE_ARABIC_QATAR,
+ wxLANGUAGE_ARABIC_SAUDI_ARABIA,
+ wxLANGUAGE_ARABIC_SUDAN,
+ wxLANGUAGE_ARABIC_SYRIA,
+ wxLANGUAGE_ARABIC_TUNISIA,
+ wxLANGUAGE_ARABIC_UAE,
+ wxLANGUAGE_ARABIC_YEMEN,
+ wxLANGUAGE_ARMENIAN,
+ wxLANGUAGE_ASSAMESE,
+ wxLANGUAGE_ASTURIAN,
+ wxLANGUAGE_AYMARA,
+ wxLANGUAGE_AZERI,
+ wxLANGUAGE_AZERI_CYRILLIC,
+ wxLANGUAGE_AZERI_LATIN,
+ wxLANGUAGE_BASHKIR,
+ wxLANGUAGE_BASQUE,
+ wxLANGUAGE_BELARUSIAN,
+ wxLANGUAGE_BENGALI,
+ wxLANGUAGE_BHUTANI,
+ wxLANGUAGE_BIHARI,
+ wxLANGUAGE_BISLAMA,
+ wxLANGUAGE_BOSNIAN,
+ wxLANGUAGE_BRETON,
+ wxLANGUAGE_BULGARIAN,
+ wxLANGUAGE_BURMESE,
+ wxLANGUAGE_CAMBODIAN,
+ wxLANGUAGE_CATALAN,
+ wxLANGUAGE_CHINESE,
+ wxLANGUAGE_CHINESE_SIMPLIFIED,
+ wxLANGUAGE_CHINESE_TRADITIONAL,
+ wxLANGUAGE_CHINESE_HONGKONG,
+ wxLANGUAGE_CHINESE_MACAU,
+ wxLANGUAGE_CHINESE_SINGAPORE,
+ wxLANGUAGE_CHINESE_TAIWAN,
+ wxLANGUAGE_CORSICAN,
+ wxLANGUAGE_CROATIAN,
+ wxLANGUAGE_CZECH,
+ wxLANGUAGE_DANISH,
+ wxLANGUAGE_DUTCH,
+ wxLANGUAGE_DUTCH_BELGIAN,
+ wxLANGUAGE_ENGLISH,
+ wxLANGUAGE_ENGLISH_UK,
+ wxLANGUAGE_ENGLISH_US,
+ wxLANGUAGE_ENGLISH_AUSTRALIA,
+ wxLANGUAGE_ENGLISH_BELIZE,
+ wxLANGUAGE_ENGLISH_BOTSWANA,
+ wxLANGUAGE_ENGLISH_CANADA,
+ wxLANGUAGE_ENGLISH_CARIBBEAN,
+ wxLANGUAGE_ENGLISH_DENMARK,
+ wxLANGUAGE_ENGLISH_EIRE,
+ wxLANGUAGE_ENGLISH_JAMAICA,
+ wxLANGUAGE_ENGLISH_NEW_ZEALAND,
+ wxLANGUAGE_ENGLISH_PHILIPPINES,
+ wxLANGUAGE_ENGLISH_SOUTH_AFRICA,
+ wxLANGUAGE_ENGLISH_TRINIDAD,
+ wxLANGUAGE_ENGLISH_ZIMBABWE,
+ wxLANGUAGE_ESPERANTO,
+ wxLANGUAGE_ESTONIAN,
+ wxLANGUAGE_FAEROESE,
+ wxLANGUAGE_FARSI,
+ wxLANGUAGE_FIJI,
+ wxLANGUAGE_FINNISH,
+ wxLANGUAGE_FRENCH,
+ wxLANGUAGE_FRENCH_BELGIAN,
+ wxLANGUAGE_FRENCH_CANADIAN,
+ wxLANGUAGE_FRENCH_LUXEMBOURG,
+ wxLANGUAGE_FRENCH_MONACO,
+ wxLANGUAGE_FRENCH_SWISS,
+ wxLANGUAGE_FRISIAN,
+ wxLANGUAGE_GALICIAN,
+ wxLANGUAGE_GEORGIAN,
+ wxLANGUAGE_GERMAN,
+ wxLANGUAGE_GERMAN_AUSTRIAN,
+ wxLANGUAGE_GERMAN_BELGIUM,
+ wxLANGUAGE_GERMAN_LIECHTENSTEIN,
+ wxLANGUAGE_GERMAN_LUXEMBOURG,
+ wxLANGUAGE_GERMAN_SWISS,
+ wxLANGUAGE_GREEK,
+ wxLANGUAGE_GREENLANDIC,
+ wxLANGUAGE_GUARANI,
+ wxLANGUAGE_GUJARATI,
+ wxLANGUAGE_HAUSA,
+ wxLANGUAGE_HEBREW,
+ wxLANGUAGE_HINDI,
+ wxLANGUAGE_HUNGARIAN,
+ wxLANGUAGE_ICELANDIC,
+ wxLANGUAGE_INDONESIAN,
+ wxLANGUAGE_INTERLINGUA,
+ wxLANGUAGE_INTERLINGUE,
+ wxLANGUAGE_INUKTITUT,
+ wxLANGUAGE_INUPIAK,
+ wxLANGUAGE_IRISH,
+ wxLANGUAGE_ITALIAN,
+ wxLANGUAGE_ITALIAN_SWISS,
+ wxLANGUAGE_JAPANESE,
+ wxLANGUAGE_JAVANESE,
+ wxLANGUAGE_KANNADA,
+ wxLANGUAGE_KASHMIRI,
+ wxLANGUAGE_KASHMIRI_INDIA,
+ wxLANGUAGE_KAZAKH,
+ wxLANGUAGE_KERNEWEK,
+ wxLANGUAGE_KINYARWANDA,
+ wxLANGUAGE_KIRGHIZ,
+ wxLANGUAGE_KIRUNDI,
+ wxLANGUAGE_KONKANI,
+ wxLANGUAGE_KOREAN,
+ wxLANGUAGE_KURDISH,
+ wxLANGUAGE_LAOTHIAN,
+ wxLANGUAGE_LATIN,
+ wxLANGUAGE_LATVIAN,
+ wxLANGUAGE_LINGALA,
+ wxLANGUAGE_LITHUANIAN,
+ wxLANGUAGE_MACEDONIAN,
+ wxLANGUAGE_MALAGASY,
+ wxLANGUAGE_MALAY,
+ wxLANGUAGE_MALAYALAM,
+ wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM,
+ wxLANGUAGE_MALAY_MALAYSIA,
+ wxLANGUAGE_MALTESE,
+ wxLANGUAGE_MANIPURI,
+ wxLANGUAGE_MAORI,
+ wxLANGUAGE_MARATHI,
+ wxLANGUAGE_MOLDAVIAN,
+ wxLANGUAGE_MONGOLIAN,
+ wxLANGUAGE_NAURU,
+ wxLANGUAGE_NEPALI,
+ wxLANGUAGE_NEPALI_INDIA,
+ wxLANGUAGE_NORWEGIAN_BOKMAL,
+ wxLANGUAGE_NORWEGIAN_NYNORSK,
+ wxLANGUAGE_OCCITAN,
+ wxLANGUAGE_ORIYA,
+ wxLANGUAGE_OROMO,
+ wxLANGUAGE_PASHTO,
+ wxLANGUAGE_POLISH,
+ wxLANGUAGE_PORTUGUESE,
+ wxLANGUAGE_PORTUGUESE_BRAZILIAN,
+ wxLANGUAGE_PUNJABI,
+ wxLANGUAGE_QUECHUA,
+ wxLANGUAGE_RHAETO_ROMANCE,
+ wxLANGUAGE_ROMANIAN,
+ wxLANGUAGE_RUSSIAN,
+ wxLANGUAGE_RUSSIAN_UKRAINE,
+ wxLANGUAGE_SAMI,
+ wxLANGUAGE_SAMOAN,
+ wxLANGUAGE_SANGHO,
+ wxLANGUAGE_SANSKRIT,
+ wxLANGUAGE_SCOTS_GAELIC,
+ wxLANGUAGE_SERBIAN,
+ wxLANGUAGE_SERBIAN_CYRILLIC,
+ wxLANGUAGE_SERBIAN_LATIN,
+ wxLANGUAGE_SERBO_CROATIAN,
+ wxLANGUAGE_SESOTHO,
+ wxLANGUAGE_SETSWANA,
+ wxLANGUAGE_SHONA,
+ wxLANGUAGE_SINDHI,
+ wxLANGUAGE_SINHALESE,
+ wxLANGUAGE_SISWATI,
+ wxLANGUAGE_SLOVAK,
+ wxLANGUAGE_SLOVENIAN,
+ wxLANGUAGE_SOMALI,
+ wxLANGUAGE_SPANISH,
+ wxLANGUAGE_SPANISH_ARGENTINA,
+ wxLANGUAGE_SPANISH_BOLIVIA,
+ wxLANGUAGE_SPANISH_CHILE,
+ wxLANGUAGE_SPANISH_COLOMBIA,
+ wxLANGUAGE_SPANISH_COSTA_RICA,
+ wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC,
+ wxLANGUAGE_SPANISH_ECUADOR,
+ wxLANGUAGE_SPANISH_EL_SALVADOR,
+ wxLANGUAGE_SPANISH_GUATEMALA,
+ wxLANGUAGE_SPANISH_HONDURAS,
+ wxLANGUAGE_SPANISH_MEXICAN,
+ wxLANGUAGE_SPANISH_MODERN,
+ wxLANGUAGE_SPANISH_NICARAGUA,
+ wxLANGUAGE_SPANISH_PANAMA,
+ wxLANGUAGE_SPANISH_PARAGUAY,
+ wxLANGUAGE_SPANISH_PERU,
+ wxLANGUAGE_SPANISH_PUERTO_RICO,
+ wxLANGUAGE_SPANISH_URUGUAY,
+ wxLANGUAGE_SPANISH_US,
+ wxLANGUAGE_SPANISH_VENEZUELA,
+ wxLANGUAGE_SUNDANESE,
+ wxLANGUAGE_SWAHILI,
+ wxLANGUAGE_SWEDISH,
+ wxLANGUAGE_SWEDISH_FINLAND,
+ wxLANGUAGE_TAGALOG,
+ wxLANGUAGE_TAJIK,
+ wxLANGUAGE_TAMIL,
+ wxLANGUAGE_TATAR,
+ wxLANGUAGE_TELUGU,
+ wxLANGUAGE_THAI,
+ wxLANGUAGE_TIBETAN,
+ wxLANGUAGE_TIGRINYA,
+ wxLANGUAGE_TONGA,
+ wxLANGUAGE_TSONGA,
+ wxLANGUAGE_TURKISH,
+ wxLANGUAGE_TURKMEN,
+ wxLANGUAGE_TWI,
+ wxLANGUAGE_UIGHUR,
+ wxLANGUAGE_UKRAINIAN,
+ wxLANGUAGE_URDU,
+ wxLANGUAGE_URDU_INDIA,
+ wxLANGUAGE_URDU_PAKISTAN,
+ wxLANGUAGE_UZBEK,
+ wxLANGUAGE_UZBEK_CYRILLIC,
+ wxLANGUAGE_UZBEK_LATIN,
+ wxLANGUAGE_VALENCIAN,
+ wxLANGUAGE_VIETNAMESE,
+ wxLANGUAGE_VOLAPUK,
+ wxLANGUAGE_WELSH,
+ wxLANGUAGE_WOLOF,
+ wxLANGUAGE_XHOSA,
+ wxLANGUAGE_YIDDISH,
+ wxLANGUAGE_YORUBA,
+ wxLANGUAGE_ZHUANG,
+ wxLANGUAGE_ZULU,
+
+ /// For custom, user-defined languages.
+ wxLANGUAGE_USER_DEFINED
+};
+
+// --- --- --- generated code ends here --- --- ---
+
+#endif // wxUSE_INTL
+
+#endif // _WX_LANGUAGE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/layout.h
+// Purpose: OBSOLETE layout constraint classes, use sizers instead
+// Author: Julian Smart
+// Modified by:
+// Created: 29/01/98
+// Copyright: (c) 1998 Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_LAYOUT_H_
+#define _WX_LAYOUT_H_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/object.h"
+
+// X stupidly defines these in X.h
+#ifdef Above
+ #undef Above
+#endif
+#ifdef Below
+ #undef Below
+#endif
+
+#if wxUSE_CONSTRAINTS
+
+// ----------------------------------------------------------------------------
+// forward declrations
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxWindowBase;
+class WXDLLIMPEXP_FWD_CORE wxLayoutConstraints;
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+#define wxLAYOUT_DEFAULT_MARGIN 0
+
+enum wxEdge
+{
+ wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
+ wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY
+};
+
+enum wxRelationship
+{
+ wxUnconstrained = 0,
+ wxAsIs,
+ wxPercentOf,
+ wxAbove,
+ wxBelow,
+ wxLeftOf,
+ wxRightOf,
+ wxSameAs,
+ wxAbsolute
+};
+
+// ----------------------------------------------------------------------------
+// wxIndividualLayoutConstraint: a constraint on window position
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxIndividualLayoutConstraint : public wxObject
+{
+public:
+ wxIndividualLayoutConstraint();
+
+ // note that default copy ctor and assignment operators are ok
+
+ virtual ~wxIndividualLayoutConstraint(){}
+
+ void Set(wxRelationship rel, wxWindowBase *otherW, wxEdge otherE, int val = 0, int marg = wxLAYOUT_DEFAULT_MARGIN);
+
+ //
+ // Sibling relationships
+ //
+ void LeftOf(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN);
+ void RightOf(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN);
+ void Above(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN);
+ void Below(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN);
+
+ //
+ // 'Same edge' alignment
+ //
+ void SameAs(wxWindowBase *otherW, wxEdge edge, int marg = wxLAYOUT_DEFAULT_MARGIN);
+
+ // The edge is a percentage of the other window's edge
+ void PercentOf(wxWindowBase *otherW, wxEdge wh, int per);
+
+ //
+ // Edge has absolute value
+ //
+ void Absolute(int val);
+
+ //
+ // Dimension is unconstrained
+ //
+ void Unconstrained() { relationship = wxUnconstrained; }
+
+ //
+ // Dimension is 'as is' (use current size settings)
+ //
+ void AsIs() { relationship = wxAsIs; }
+
+ //
+ // Accessors
+ //
+ wxWindowBase *GetOtherWindow() { return otherWin; }
+ wxEdge GetMyEdge() const { return myEdge; }
+ void SetEdge(wxEdge which) { myEdge = which; }
+ void SetValue(int v) { value = v; }
+ int GetMargin() { return margin; }
+ void SetMargin(int m) { margin = m; }
+ int GetValue() const { return value; }
+ int GetPercent() const { return percent; }
+ int GetOtherEdge() const { return otherEdge; }
+ bool GetDone() const { return done; }
+ void SetDone(bool d) { done = d; }
+ wxRelationship GetRelationship() { return relationship; }
+ void SetRelationship(wxRelationship r) { relationship = r; }
+
+ // Reset constraint if it mentions otherWin
+ bool ResetIfWin(wxWindowBase *otherW);
+
+ // Try to satisfy constraint
+ bool SatisfyConstraint(wxLayoutConstraints *constraints, wxWindowBase *win);
+
+ // Get the value of this edge or dimension, or if this
+ // is not determinable, -1.
+ int GetEdge(wxEdge which, wxWindowBase *thisWin, wxWindowBase *other) const;
+
+protected:
+ // To be allowed to modify the internal variables
+ friend class wxIndividualLayoutConstraint_Serialize;
+
+ // 'This' window is the parent or sibling of otherWin
+ wxWindowBase *otherWin;
+
+ wxEdge myEdge;
+ wxRelationship relationship;
+ int margin;
+ int value;
+ int percent;
+ wxEdge otherEdge;
+ bool done;
+
+ DECLARE_DYNAMIC_CLASS(wxIndividualLayoutConstraint)
+};
+
+// ----------------------------------------------------------------------------
+// wxLayoutConstraints: the complete set of constraints for a window
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxLayoutConstraints : public wxObject
+{
+public:
+ // Edge constraints
+ wxIndividualLayoutConstraint left;
+ wxIndividualLayoutConstraint top;
+ wxIndividualLayoutConstraint right;
+ wxIndividualLayoutConstraint bottom;
+ // Size constraints
+ wxIndividualLayoutConstraint width;
+ wxIndividualLayoutConstraint height;
+ // Centre constraints
+ wxIndividualLayoutConstraint centreX;
+ wxIndividualLayoutConstraint centreY;
+
+ wxLayoutConstraints();
+
+ // note that default copy ctor and assignment operators are ok
+
+ virtual ~wxLayoutConstraints(){}
+
+ bool SatisfyConstraints(wxWindowBase *win, int *noChanges);
+ bool AreSatisfied() const
+ {
+ return left.GetDone() && top.GetDone() &&
+ width.GetDone() && height.GetDone();
+ }
+
+ DECLARE_DYNAMIC_CLASS(wxLayoutConstraints)
+};
+
+#endif // wxUSE_CONSTRAINTS
+
+#endif // _WX_LAYOUT_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/laywin.h
+// Purpose: wxSashLayoutWindow base header
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_LAYWIN_H_BASE_
+#define _WX_LAYWIN_H_BASE_
+
+#include "wx/generic/laywin.h"
+
+#endif
+ // _WX_LAYWIN_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/link.h
+// Purpose: macros to force linking modules which might otherwise be
+// discarded by the linker
+// Author: Vaclav Slavik
+// Copyright: (c) Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_LINK_H_
+#define _WX_LINK_H_
+
+// This must be part of the module you want to force:
+#define wxFORCE_LINK_THIS_MODULE(module_name) \
+ extern void _wx_link_dummy_func_##module_name (); \
+ void _wx_link_dummy_func_##module_name () { }
+
+
+// And this must be somewhere where it certainly will be linked:
+#define wxFORCE_LINK_MODULE(module_name) \
+ extern void _wx_link_dummy_func_##module_name (); \
+ static struct wxForceLink##module_name \
+ { \
+ wxForceLink##module_name() \
+ { \
+ _wx_link_dummy_func_##module_name (); \
+ } \
+ } _wx_link_dummy_var_##module_name;
+
+
+#endif // _WX_LINK_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/list.h
+// Purpose: wxList, wxStringList classes
+// Author: Julian Smart
+// Modified by: VZ at 16/11/98: WX_DECLARE_LIST() and typesafe lists added
+// Created: 29/01/98
+// Copyright: (c) 1998 Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+/*
+ All this is quite ugly but serves two purposes:
+ 1. Be almost 100% compatible with old, untyped, wxList class
+ 2. Ensure compile-time type checking for the linked lists
+
+ The idea is to have one base class (wxListBase) working with "void *" data,
+ but to hide these untyped functions - i.e. make them protected, so they
+ can only be used from derived classes which have inline member functions
+ working with right types. This achieves the 2nd goal. As for the first one,
+ we provide a special derivation of wxListBase called wxList which looks just
+ like the old class.
+*/
+
+#ifndef _WX_LIST_H_
+#define _WX_LIST_H_
+
+// -----------------------------------------------------------------------------
+// headers
+// -----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+#include "wx/object.h"
+#include "wx/string.h"
+#include "wx/vector.h"
+
+#if wxUSE_STD_CONTAINERS
+ #include "wx/beforestd.h"
+ #include <algorithm>
+ #include <iterator>
+ #include <list>
+ #include "wx/afterstd.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// types
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_BASE wxObjectListNode;
+typedef wxObjectListNode wxNode;
+
+#if wxUSE_STD_CONTAINERS
+
+#define wxLIST_COMPATIBILITY
+
+#define WX_DECLARE_LIST_3(elT, dummy1, liT, dummy2, decl) \
+ WX_DECLARE_LIST_WITH_DECL(elT, liT, decl)
+#define WX_DECLARE_LIST_PTR_3(elT, dummy1, liT, dummy2, decl) \
+ WX_DECLARE_LIST_3(elT, dummy1, liT, dummy2, decl)
+
+#define WX_DECLARE_LIST_2(elT, liT, dummy, decl) \
+ WX_DECLARE_LIST_WITH_DECL(elT, liT, decl)
+#define WX_DECLARE_LIST_PTR_2(elT, liT, dummy, decl) \
+ WX_DECLARE_LIST_2(elT, liT, dummy, decl) \
+
+#define WX_DECLARE_LIST_WITH_DECL(elT, liT, decl) \
+ WX_DECLARE_LIST_XO(elT*, liT, decl)
+
+#if !defined(__VISUALC__) || __VISUALC__ >= 1300 // == !VC6
+
+template<class T>
+class wxList_SortFunction
+{
+public:
+ wxList_SortFunction(wxSortCompareFunction f) : m_f(f) { }
+ bool operator()(const T& i1, const T& i2)
+ { return m_f((T*)&i1, (T*)&i2) < 0; }
+private:
+ wxSortCompareFunction m_f;
+};
+
+#define WX_LIST_SORTFUNCTION( elT, f ) wxList_SortFunction<elT>(f)
+#define WX_LIST_VC6_WORKAROUND(elT, liT, decl)
+
+#else // if defined( __VISUALC__ ) && __VISUALC__ < 1300 // == VC6
+
+#define WX_LIST_SORTFUNCTION( elT, f ) std::greater<elT>( f )
+#define WX_LIST_VC6_WORKAROUND(elT, liT, decl) \
+ decl liT; \
+ \
+ /* Workaround for broken VC6 STL incorrectly requires a std::greater<> */ \
+ /* to be passed into std::list::sort() */ \
+ template <> \
+ struct std::greater<elT> \
+ { \
+ private: \
+ wxSortCompareFunction m_CompFunc; \
+ public: \
+ greater( wxSortCompareFunction compfunc = NULL ) \
+ : m_CompFunc( compfunc ) {} \
+ bool operator()(const elT X, const elT Y) const \
+ { \
+ return m_CompFunc ? \
+ ( m_CompFunc( wxListCastElementToVoidPtr(X), \
+ wxListCastElementToVoidPtr(Y) ) < 0 ) : \
+ ( X > Y ); \
+ } \
+ };
+
+// helper for std::greater<elT> above:
+template<typename T>
+inline const void *wxListCastElementToVoidPtr(const T* ptr) { return ptr; }
+inline const void *wxListCastElementToVoidPtr(const wxString& str)
+ { return (const char*)str; }
+
+#endif // VC6/!VC6
+
+/*
+ Note 1: the outer helper class _WX_LIST_HELPER_##liT below is a workaround
+ for mingw 3.2.3 compiler bug that prevents a static function of liT class
+ from being exported into dll. A minimal code snippet reproducing the bug:
+
+ struct WXDLLIMPEXP_CORE Foo
+ {
+ static void Bar();
+ struct SomeInnerClass
+ {
+ friend class Foo; // comment this out to make it link
+ };
+ ~Foo()
+ {
+ Bar();
+ }
+ };
+
+ The program does not link under mingw_gcc 3.2.3 producing undefined
+ reference to Foo::Bar() function
+
+
+ Note 2: the EmptyList is needed to allow having a NULL pointer-like
+ invalid iterator. We used to use just an uninitialized iterator object
+ instead but this fails with some debug/checked versions of STL, notably the
+ glibc version activated with _GLIBCXX_DEBUG, so we need to have a separate
+ invalid iterator.
+ */
+
+// the real wxList-class declaration
+#define WX_DECLARE_LIST_XO(elT, liT, decl) \
+ decl _WX_LIST_HELPER_##liT \
+ { \
+ typedef elT _WX_LIST_ITEM_TYPE_##liT; \
+ typedef std::list<elT> BaseListType; \
+ public: \
+ static BaseListType EmptyList; \
+ static void DeleteFunction( _WX_LIST_ITEM_TYPE_##liT X ); \
+ }; \
+ \
+ WX_LIST_VC6_WORKAROUND(elT, liT, decl) \
+ class liT : public std::list<elT> \
+ { \
+ private: \
+ typedef std::list<elT> BaseListType; \
+ \
+ bool m_destroy; \
+ \
+ public: \
+ class compatibility_iterator \
+ { \
+ private: \
+ /* Workaround for broken VC6 nested class name resolution */ \
+ typedef std::list<elT>::iterator iterator; \
+ friend class liT; \
+ \
+ iterator m_iter; \
+ liT * m_list; \
+ \
+ public: \
+ compatibility_iterator() \
+ : m_iter(_WX_LIST_HELPER_##liT::EmptyList.end()), m_list( NULL ) {} \
+ compatibility_iterator( liT* li, iterator i ) \
+ : m_iter( i ), m_list( li ) {} \
+ compatibility_iterator( const liT* li, iterator i ) \
+ : m_iter( i ), m_list( const_cast< liT* >( li ) ) {} \
+ \
+ compatibility_iterator* operator->() { return this; } \
+ const compatibility_iterator* operator->() const { return this; } \
+ \
+ bool operator==(const compatibility_iterator& i) const \
+ { \
+ wxASSERT_MSG( m_list && i.m_list, \
+ wxT("comparing invalid iterators is illegal") ); \
+ return (m_list == i.m_list) && (m_iter == i.m_iter); \
+ } \
+ bool operator!=(const compatibility_iterator& i) const \
+ { return !( operator==( i ) ); } \
+ operator bool() const \
+ { return m_list ? m_iter != m_list->end() : false; } \
+ bool operator !() const \
+ { return !( operator bool() ); } \
+ \
+ elT GetData() const \
+ { return *m_iter; } \
+ void SetData( elT e ) \
+ { *m_iter = e; } \
+ \
+ compatibility_iterator GetNext() const \
+ { \
+ iterator i = m_iter; \
+ return compatibility_iterator( m_list, ++i ); \
+ } \
+ compatibility_iterator GetPrevious() const \
+ { \
+ if ( m_iter == m_list->begin() ) \
+ return compatibility_iterator(); \
+ \
+ iterator i = m_iter; \
+ return compatibility_iterator( m_list, --i ); \
+ } \
+ int IndexOf() const \
+ { \
+ return *this ? (int)std::distance( m_list->begin(), m_iter ) \
+ : wxNOT_FOUND; \
+ } \
+ }; \
+ public: \
+ liT() : m_destroy( false ) {} \
+ \
+ compatibility_iterator Find( const elT e ) const \
+ { \
+ liT* _this = const_cast< liT* >( this ); \
+ return compatibility_iterator( _this, \
+ std::find( _this->begin(), _this->end(), e ) ); \
+ } \
+ \
+ bool IsEmpty() const \
+ { return empty(); } \
+ size_t GetCount() const \
+ { return size(); } \
+ int Number() const \
+ { return static_cast< int >( GetCount() ); } \
+ \
+ compatibility_iterator Item( size_t idx ) const \
+ { \
+ iterator i = const_cast< liT* >(this)->begin(); \
+ std::advance( i, idx ); \
+ return compatibility_iterator( this, i ); \
+ } \
+ elT operator[](size_t idx) const \
+ { \
+ return Item(idx).GetData(); \
+ } \
+ \
+ compatibility_iterator GetFirst() const \
+ { \
+ return compatibility_iterator( this, \
+ const_cast< liT* >(this)->begin() ); \
+ } \
+ compatibility_iterator GetLast() const \
+ { \
+ iterator i = const_cast< liT* >(this)->end(); \
+ return compatibility_iterator( this, !empty() ? --i : i ); \
+ } \
+ bool Member( elT e ) const \
+ { return Find( e ); } \
+ compatibility_iterator Nth( int n ) const \
+ { return Item( n ); } \
+ int IndexOf( elT e ) const \
+ { return Find( e ).IndexOf(); } \
+ \
+ compatibility_iterator Append( elT e ) \
+ { \
+ push_back( e ); \
+ return GetLast(); \
+ } \
+ compatibility_iterator Insert( elT e ) \
+ { \
+ push_front( e ); \
+ return compatibility_iterator( this, begin() ); \
+ } \
+ compatibility_iterator Insert(const compatibility_iterator & i, elT e)\
+ { \
+ return compatibility_iterator( this, insert( i.m_iter, e ) ); \
+ } \
+ compatibility_iterator Insert( size_t idx, elT e ) \
+ { \
+ return compatibility_iterator( this, \
+ insert( Item( idx ).m_iter, e ) ); \
+ } \
+ \
+ void DeleteContents( bool destroy ) \
+ { m_destroy = destroy; } \
+ bool GetDeleteContents() const \
+ { return m_destroy; } \
+ void Erase( const compatibility_iterator& i ) \
+ { \
+ if ( m_destroy ) \
+ _WX_LIST_HELPER_##liT::DeleteFunction( i->GetData() ); \
+ erase( i.m_iter ); \
+ } \
+ bool DeleteNode( const compatibility_iterator& i ) \
+ { \
+ if( i ) \
+ { \
+ Erase( i ); \
+ return true; \
+ } \
+ return false; \
+ } \
+ bool DeleteObject( elT e ) \
+ { \
+ return DeleteNode( Find( e ) ); \
+ } \
+ void Clear() \
+ { \
+ if ( m_destroy ) \
+ std::for_each( begin(), end(), \
+ _WX_LIST_HELPER_##liT::DeleteFunction ); \
+ clear(); \
+ } \
+ /* Workaround for broken VC6 std::list::sort() see above */ \
+ void Sort( wxSortCompareFunction compfunc ) \
+ { sort( WX_LIST_SORTFUNCTION( elT, compfunc ) ); } \
+ ~liT() { Clear(); } \
+ \
+ /* It needs access to our EmptyList */ \
+ friend class compatibility_iterator; \
+ }
+
+#define WX_DECLARE_LIST(elementtype, listname) \
+ WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class)
+#define WX_DECLARE_LIST_PTR(elementtype, listname) \
+ WX_DECLARE_LIST(elementtype, listname)
+
+#define WX_DECLARE_EXPORTED_LIST(elementtype, listname) \
+ WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class WXDLLIMPEXP_CORE)
+#define WX_DECLARE_EXPORTED_LIST_PTR(elementtype, listname) \
+ WX_DECLARE_EXPORTED_LIST(elementtype, listname)
+
+#define WX_DECLARE_USER_EXPORTED_LIST(elementtype, listname, usergoo) \
+ WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class usergoo)
+#define WX_DECLARE_USER_EXPORTED_LIST_PTR(elementtype, listname, usergoo) \
+ WX_DECLARE_USER_EXPORTED_LIST(elementtype, listname, usergoo)
+
+// this macro must be inserted in your program after
+// #include "wx/listimpl.cpp"
+#define WX_DEFINE_LIST(name) "don't forget to include listimpl.cpp!"
+
+#define WX_DEFINE_EXPORTED_LIST(name) WX_DEFINE_LIST(name)
+#define WX_DEFINE_USER_EXPORTED_LIST(name) WX_DEFINE_LIST(name)
+
+#else // if !wxUSE_STD_CONTAINERS
+
+
+// undef it to get rid of old, deprecated functions
+#define wxLIST_COMPATIBILITY
+
+// -----------------------------------------------------------------------------
+// key stuff: a list may be optionally keyed on integer or string key
+// -----------------------------------------------------------------------------
+
+union wxListKeyValue
+{
+ long integer;
+ wxString *string;
+};
+
+// a struct which may contain both types of keys
+//
+// implementation note: on one hand, this class allows to have only one function
+// for any keyed operation instead of 2 almost equivalent. OTOH, it's needed to
+// resolve ambiguity which we would otherwise have with wxStringList::Find() and
+// wxList::Find(const char *).
+class WXDLLIMPEXP_BASE wxListKey
+{
+public:
+ // implicit ctors
+ wxListKey() : m_keyType(wxKEY_NONE)
+ { }
+ wxListKey(long i) : m_keyType(wxKEY_INTEGER)
+ { m_key.integer = i; }
+ wxListKey(const wxString& s) : m_keyType(wxKEY_STRING)
+ { m_key.string = new wxString(s); }
+ wxListKey(const char *s) : m_keyType(wxKEY_STRING)
+ { m_key.string = new wxString(s); }
+ wxListKey(const wchar_t *s) : m_keyType(wxKEY_STRING)
+ { m_key.string = new wxString(s); }
+
+ // accessors
+ wxKeyType GetKeyType() const { return m_keyType; }
+ const wxString GetString() const
+ { wxASSERT( m_keyType == wxKEY_STRING ); return *m_key.string; }
+ long GetNumber() const
+ { wxASSERT( m_keyType == wxKEY_INTEGER ); return m_key.integer; }
+
+ // comparison
+ // Note: implementation moved to list.cpp to prevent BC++ inline
+ // expansion warning.
+ bool operator==(wxListKeyValue value) const ;
+
+ // dtor
+ ~wxListKey()
+ {
+ if ( m_keyType == wxKEY_STRING )
+ delete m_key.string;
+ }
+
+private:
+ wxKeyType m_keyType;
+ wxListKeyValue m_key;
+};
+
+// -----------------------------------------------------------------------------
+// wxNodeBase class is a (base for) node in a double linked list
+// -----------------------------------------------------------------------------
+
+extern WXDLLIMPEXP_DATA_BASE(wxListKey) wxDefaultListKey;
+
+class WXDLLIMPEXP_FWD_BASE wxListBase;
+
+class WXDLLIMPEXP_BASE wxNodeBase
+{
+friend class wxListBase;
+public:
+ // ctor
+ wxNodeBase(wxListBase *list = NULL,
+ wxNodeBase *previous = NULL,
+ wxNodeBase *next = NULL,
+ void *data = NULL,
+ const wxListKey& key = wxDefaultListKey);
+
+ virtual ~wxNodeBase();
+
+ // FIXME no check is done that the list is really keyed on strings
+ wxString GetKeyString() const { return *m_key.string; }
+ long GetKeyInteger() const { return m_key.integer; }
+
+ // Necessary for some existing code
+ void SetKeyString(const wxString& s) { m_key.string = new wxString(s); }
+ void SetKeyInteger(long i) { m_key.integer = i; }
+
+#ifdef wxLIST_COMPATIBILITY
+ // compatibility methods, use Get* instead.
+ wxDEPRECATED( wxNode *Next() const );
+ wxDEPRECATED( wxNode *Previous() const );
+ wxDEPRECATED( wxObject *Data() const );
+#endif // wxLIST_COMPATIBILITY
+
+protected:
+ // all these are going to be "overloaded" in the derived classes
+ wxNodeBase *GetNext() const { return m_next; }
+ wxNodeBase *GetPrevious() const { return m_previous; }
+
+ void *GetData() const { return m_data; }
+ void SetData(void *data) { m_data = data; }
+
+ // get 0-based index of this node within the list or wxNOT_FOUND
+ int IndexOf() const;
+
+ virtual void DeleteData() { }
+public:
+ // for wxList::iterator
+ void** GetDataPtr() const { return &(const_cast<wxNodeBase*>(this)->m_data); }
+private:
+ // optional key stuff
+ wxListKeyValue m_key;
+
+ void *m_data; // user data
+ wxNodeBase *m_next, // next and previous nodes in the list
+ *m_previous;
+
+ wxListBase *m_list; // list we belong to
+
+ wxDECLARE_NO_COPY_CLASS(wxNodeBase);
+};
+
+// -----------------------------------------------------------------------------
+// a double-linked list class
+// -----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_BASE wxList;
+
+class WXDLLIMPEXP_BASE wxListBase
+{
+friend class wxNodeBase; // should be able to call DetachNode()
+friend class wxHashTableBase; // should be able to call untyped Find()
+
+public:
+ // default ctor & dtor
+ wxListBase(wxKeyType keyType = wxKEY_NONE)
+ { Init(keyType); }
+ virtual ~wxListBase();
+
+ // accessors
+ // count of items in the list
+ size_t GetCount() const { return m_count; }
+
+ // return true if this list is empty
+ bool IsEmpty() const { return m_count == 0; }
+
+ // operations
+
+ // delete all nodes
+ void Clear();
+
+ // instruct it to destroy user data when deleting nodes
+ void DeleteContents(bool destroy) { m_destroy = destroy; }
+
+ // query if to delete
+ bool GetDeleteContents() const
+ { return m_destroy; }
+
+ // get the keytype
+ wxKeyType GetKeyType() const
+ { return m_keyType; }
+
+ // set the keytype (required by the serial code)
+ void SetKeyType(wxKeyType keyType)
+ { wxASSERT( m_count==0 ); m_keyType = keyType; }
+
+#ifdef wxLIST_COMPATIBILITY
+ // compatibility methods from old wxList
+ wxDEPRECATED( int Number() const ); // use GetCount instead.
+ wxDEPRECATED( wxNode *First() const ); // use GetFirst
+ wxDEPRECATED( wxNode *Last() const ); // use GetLast
+ wxDEPRECATED( wxNode *Nth(size_t n) const ); // use Item
+
+ // kludge for typesafe list migration in core classes.
+ wxDEPRECATED( operator wxList&() const );
+#endif // wxLIST_COMPATIBILITY
+
+protected:
+
+ // all methods here are "overloaded" in derived classes to provide compile
+ // time type checking
+
+ // create a node for the list of this type
+ virtual wxNodeBase *CreateNode(wxNodeBase *prev, wxNodeBase *next,
+ void *data,
+ const wxListKey& key = wxDefaultListKey) = 0;
+
+
+ // ctors
+ // from an array
+ wxListBase(size_t count, void *elements[]);
+ // from a sequence of objects
+ wxListBase(void *object, ... /* terminate with NULL */);
+
+protected:
+ void Assign(const wxListBase& list)
+ { Clear(); DoCopy(list); }
+
+ // get list head/tail
+ wxNodeBase *GetFirst() const { return m_nodeFirst; }
+ wxNodeBase *GetLast() const { return m_nodeLast; }
+
+ // by (0-based) index
+ wxNodeBase *Item(size_t index) const;
+
+ // get the list item's data
+ void *operator[](size_t n) const
+ {
+ wxNodeBase *node = Item(n);
+
+ return node ? node->GetData() : NULL;
+ }
+
+ // operations
+ // append to end of list
+ wxNodeBase *Prepend(void *object)
+ { return (wxNodeBase *)wxListBase::Insert(object); }
+ // append to beginning of list
+ wxNodeBase *Append(void *object);
+ // insert a new item at the beginning of the list
+ wxNodeBase *Insert(void *object)
+ { return Insert(static_cast<wxNodeBase *>(NULL), object); }
+ // insert a new item at the given position
+ wxNodeBase *Insert(size_t pos, void *object)
+ { return pos == GetCount() ? Append(object)
+ : Insert(Item(pos), object); }
+ // insert before given node or at front of list if prev == NULL
+ wxNodeBase *Insert(wxNodeBase *prev, void *object);
+
+ // keyed append
+ wxNodeBase *Append(long key, void *object);
+ wxNodeBase *Append(const wxString& key, void *object);
+
+ // removes node from the list but doesn't delete it (returns pointer
+ // to the node or NULL if it wasn't found in the list)
+ wxNodeBase *DetachNode(wxNodeBase *node);
+ // delete element from list, returns false if node not found
+ bool DeleteNode(wxNodeBase *node);
+ // finds object pointer and deletes node (and object if DeleteContents
+ // is on), returns false if object not found
+ bool DeleteObject(void *object);
+
+ // search (all return NULL if item not found)
+ // by data
+ wxNodeBase *Find(const void *object) const;
+
+ // by key
+ wxNodeBase *Find(const wxListKey& key) const;
+
+ // get 0-based index of object or wxNOT_FOUND
+ int IndexOf( void *object ) const;
+
+ // this function allows the sorting of arbitrary lists by giving
+ // a function to compare two list elements. The list is sorted in place.
+ void Sort(const wxSortCompareFunction compfunc);
+
+ // functions for iterating over the list
+ void *FirstThat(wxListIterateFunction func);
+ void ForEach(wxListIterateFunction func);
+ void *LastThat(wxListIterateFunction func);
+
+ // for STL interface, "last" points to one after the last node
+ // of the controlled sequence (NULL for the end of the list)
+ void Reverse();
+ void DeleteNodes(wxNodeBase* first, wxNodeBase* last);
+private:
+
+ // common part of all ctors
+ void Init(wxKeyType keyType = wxKEY_NONE);
+
+ // helpers
+ // common part of copy ctor and assignment operator
+ void DoCopy(const wxListBase& list);
+ // common part of all Append()s
+ wxNodeBase *AppendCommon(wxNodeBase *node);
+ // free node's data and node itself
+ void DoDeleteNode(wxNodeBase *node);
+
+ size_t m_count; // number of elements in the list
+ bool m_destroy; // destroy user data when deleting list items?
+ wxNodeBase *m_nodeFirst, // pointers to the head and tail of the list
+ *m_nodeLast;
+
+ wxKeyType m_keyType; // type of our keys (may be wxKEY_NONE)
+};
+
+// -----------------------------------------------------------------------------
+// macros for definition of "template" list type
+// -----------------------------------------------------------------------------
+
+// and now some heavy magic...
+
+// declare a list type named 'name' and containing elements of type 'T *'
+// (as a by product of macro expansion you also get wx##name##Node
+// wxNode-derived type)
+//
+// implementation details:
+// 1. We define _WX_LIST_ITEM_TYPE_##name typedef to save in it the item type
+// for the list of given type - this allows us to pass only the list name
+// to WX_DEFINE_LIST() even if it needs both the name and the type
+//
+// 2. We redefine all non-type-safe wxList functions with type-safe versions
+// which don't take any space (everything is inline), but bring compile
+// time error checking.
+//
+// 3. The macro which is usually used (WX_DECLARE_LIST) is defined in terms of
+// a more generic WX_DECLARE_LIST_2 macro which, in turn, uses the most
+// generic WX_DECLARE_LIST_3 one. The last macro adds a sometimes
+// interesting capability to store polymorphic objects in the list and is
+// particularly useful with, for example, "wxWindow *" list where the
+// wxWindowBase pointers are put into the list, but wxWindow pointers are
+// retrieved from it.
+//
+// 4. final hack is that WX_DECLARE_LIST_3 is defined in terms of
+// WX_DECLARE_LIST_4 to allow defining classes without operator->() as
+// it results in compiler warnings when this operator doesn't make sense
+// (i.e. stored elements are not pointers)
+
+// common part of WX_DECLARE_LIST_3 and WX_DECLARE_LIST_PTR_3
+#define WX_DECLARE_LIST_4(T, Tbase, name, nodetype, classexp, ptrop) \
+ typedef int (*wxSortFuncFor_##name)(const T **, const T **); \
+ \
+ classexp nodetype : public wxNodeBase \
+ { \
+ public: \
+ nodetype(wxListBase *list = NULL, \
+ nodetype *previous = NULL, \
+ nodetype *next = NULL, \
+ T *data = NULL, \
+ const wxListKey& key = wxDefaultListKey) \
+ : wxNodeBase(list, previous, next, data, key) { } \
+ \
+ nodetype *GetNext() const \
+ { return (nodetype *)wxNodeBase::GetNext(); } \
+ nodetype *GetPrevious() const \
+ { return (nodetype *)wxNodeBase::GetPrevious(); } \
+ \
+ T *GetData() const \
+ { return (T *)wxNodeBase::GetData(); } \
+ void SetData(T *data) \
+ { wxNodeBase::SetData(data); } \
+ \
+ protected: \
+ virtual void DeleteData(); \
+ \
+ DECLARE_NO_COPY_CLASS(nodetype) \
+ }; \
+ \
+ classexp name : public wxListBase \
+ { \
+ public: \
+ typedef nodetype Node; \
+ classexp compatibility_iterator \
+ { \
+ public: \
+ compatibility_iterator(Node *ptr = NULL) : m_ptr(ptr) { } \
+ \
+ Node *operator->() const { return m_ptr; } \
+ operator Node *() const { return m_ptr; } \
+ \
+ private: \
+ Node *m_ptr; \
+ }; \
+ \
+ name(wxKeyType keyType = wxKEY_NONE) : wxListBase(keyType) \
+ { } \
+ name(const name& list) : wxListBase(list.GetKeyType()) \
+ { Assign(list); } \
+ name(size_t count, T *elements[]) \
+ : wxListBase(count, (void **)elements) { } \
+ \
+ name& operator=(const name& list) \
+ { if (&list != this) Assign(list); return *this; } \
+ \
+ nodetype *GetFirst() const \
+ { return (nodetype *)wxListBase::GetFirst(); } \
+ nodetype *GetLast() const \
+ { return (nodetype *)wxListBase::GetLast(); } \
+ \
+ nodetype *Item(size_t index) const \
+ { return (nodetype *)wxListBase::Item(index); } \
+ \
+ T *operator[](size_t index) const \
+ { \
+ nodetype *node = Item(index); \
+ return node ? (T*)(node->GetData()) : NULL; \
+ } \
+ \
+ nodetype *Append(Tbase *object) \
+ { return (nodetype *)wxListBase::Append(object); } \
+ nodetype *Insert(Tbase *object) \
+ { return (nodetype *)Insert(static_cast<nodetype *>(NULL), \
+ object); } \
+ nodetype *Insert(size_t pos, Tbase *object) \
+ { return (nodetype *)wxListBase::Insert(pos, object); } \
+ nodetype *Insert(nodetype *prev, Tbase *object) \
+ { return (nodetype *)wxListBase::Insert(prev, object); } \
+ \
+ nodetype *Append(long key, void *object) \
+ { return (nodetype *)wxListBase::Append(key, object); } \
+ nodetype *Append(const wxChar *key, void *object) \
+ { return (nodetype *)wxListBase::Append(key, object); } \
+ \
+ nodetype *DetachNode(nodetype *node) \
+ { return (nodetype *)wxListBase::DetachNode(node); } \
+ bool DeleteNode(nodetype *node) \
+ { return wxListBase::DeleteNode(node); } \
+ bool DeleteObject(Tbase *object) \
+ { return wxListBase::DeleteObject(object); } \
+ void Erase(nodetype *it) \
+ { DeleteNode(it); } \
+ \
+ nodetype *Find(const Tbase *object) const \
+ { return (nodetype *)wxListBase::Find(object); } \
+ \
+ virtual nodetype *Find(const wxListKey& key) const \
+ { return (nodetype *)wxListBase::Find(key); } \
+ \
+ bool Member(const Tbase *object) const \
+ { return Find(object) != NULL; } \
+ \
+ int IndexOf(Tbase *object) const \
+ { return wxListBase::IndexOf(object); } \
+ \
+ void Sort(wxSortCompareFunction func) \
+ { wxListBase::Sort(func); } \
+ void Sort(wxSortFuncFor_##name func) \
+ { Sort((wxSortCompareFunction)func); } \
+ \
+ protected: \
+ virtual wxNodeBase *CreateNode(wxNodeBase *prev, wxNodeBase *next, \
+ void *data, \
+ const wxListKey& key = wxDefaultListKey) \
+ { \
+ return new nodetype(this, \
+ (nodetype *)prev, (nodetype *)next, \
+ (T *)data, key); \
+ } \
+ /* STL interface */ \
+ public: \
+ typedef size_t size_type; \
+ typedef int difference_type; \
+ typedef T* value_type; \
+ typedef Tbase* base_value_type; \
+ typedef value_type& reference; \
+ typedef const value_type& const_reference; \
+ typedef base_value_type& base_reference; \
+ typedef const base_value_type& const_base_reference; \
+ \
+ classexp iterator \
+ { \
+ typedef name list; \
+ public: \
+ typedef nodetype Node; \
+ typedef iterator itor; \
+ typedef T* value_type; \
+ typedef value_type* ptr_type; \
+ typedef value_type& reference; \
+ \
+ Node* m_node; \
+ Node* m_init; \
+ public: \
+ typedef reference reference_type; \
+ typedef ptr_type pointer_type; \
+ \
+ iterator(Node* node, Node* init) : m_node(node), m_init(init) {}\
+ iterator() : m_node(NULL), m_init(NULL) { } \
+ reference_type operator*() const \
+ { return *(pointer_type)m_node->GetDataPtr(); } \
+ ptrop \
+ itor& operator++() \
+ { \
+ wxASSERT_MSG( m_node, wxT("uninitialized iterator") ); \
+ m_node = m_node->GetNext(); \
+ return *this; \
+ } \
+ const itor operator++(int) \
+ { \
+ itor tmp = *this; \
+ wxASSERT_MSG( m_node, wxT("uninitialized iterator") ); \
+ m_node = m_node->GetNext(); \
+ return tmp; \
+ } \
+ itor& operator--() \
+ { \
+ m_node = m_node ? m_node->GetPrevious() : m_init; \
+ return *this; \
+ } \
+ const itor operator--(int) \
+ { \
+ itor tmp = *this; \
+ m_node = m_node ? m_node->GetPrevious() : m_init; \
+ return tmp; \
+ } \
+ bool operator!=(const itor& it) const \
+ { return it.m_node != m_node; } \
+ bool operator==(const itor& it) const \
+ { return it.m_node == m_node; } \
+ }; \
+ classexp const_iterator \
+ { \
+ typedef name list; \
+ public: \
+ typedef nodetype Node; \
+ typedef T* value_type; \
+ typedef const value_type& const_reference; \
+ typedef const_iterator itor; \
+ typedef value_type* ptr_type; \
+ \
+ Node* m_node; \
+ Node* m_init; \
+ public: \
+ typedef const_reference reference_type; \
+ typedef const ptr_type pointer_type; \
+ \
+ const_iterator(Node* node, Node* init) \
+ : m_node(node), m_init(init) { } \
+ const_iterator() : m_node(NULL), m_init(NULL) { } \
+ const_iterator(const iterator& it) \
+ : m_node(it.m_node), m_init(it.m_init) { } \
+ reference_type operator*() const \
+ { return *(pointer_type)m_node->GetDataPtr(); } \
+ ptrop \
+ itor& operator++() \
+ { \
+ wxASSERT_MSG( m_node, wxT("uninitialized iterator") ); \
+ m_node = m_node->GetNext(); \
+ return *this; \
+ } \
+ const itor operator++(int) \
+ { \
+ itor tmp = *this; \
+ wxASSERT_MSG( m_node, wxT("uninitialized iterator") ); \
+ m_node = m_node->GetNext(); \
+ return tmp; \
+ } \
+ itor& operator--() \
+ { \
+ m_node = m_node ? m_node->GetPrevious() : m_init; \
+ return *this; \
+ } \
+ const itor operator--(int) \
+ { \
+ itor tmp = *this; \
+ m_node = m_node ? m_node->GetPrevious() : m_init; \
+ return tmp; \
+ } \
+ bool operator!=(const itor& it) const \
+ { return it.m_node != m_node; } \
+ bool operator==(const itor& it) const \
+ { return it.m_node == m_node; } \
+ }; \
+ classexp reverse_iterator \
+ { \
+ typedef name list; \
+ public: \
+ typedef nodetype Node; \
+ typedef T* value_type; \
+ typedef reverse_iterator itor; \
+ typedef value_type* ptr_type; \
+ typedef value_type& reference; \
+ \
+ Node* m_node; \
+ Node* m_init; \
+ public: \
+ typedef reference reference_type; \
+ typedef ptr_type pointer_type; \
+ \
+ reverse_iterator(Node* node, Node* init) \
+ : m_node(node), m_init(init) { } \
+ reverse_iterator() : m_node(NULL), m_init(NULL) { } \
+ reference_type operator*() const \
+ { return *(pointer_type)m_node->GetDataPtr(); } \
+ ptrop \
+ itor& operator++() \
+ { m_node = m_node->GetPrevious(); return *this; } \
+ const itor operator++(int) \
+ { itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; }\
+ itor& operator--() \
+ { m_node = m_node ? m_node->GetNext() : m_init; return *this; } \
+ const itor operator--(int) \
+ { \
+ itor tmp = *this; \
+ m_node = m_node ? m_node->GetNext() : m_init; \
+ return tmp; \
+ } \
+ bool operator!=(const itor& it) const \
+ { return it.m_node != m_node; } \
+ bool operator==(const itor& it) const \
+ { return it.m_node == m_node; } \
+ }; \
+ classexp const_reverse_iterator \
+ { \
+ typedef name list; \
+ public: \
+ typedef nodetype Node; \
+ typedef T* value_type; \
+ typedef const_reverse_iterator itor; \
+ typedef value_type* ptr_type; \
+ typedef const value_type& const_reference; \
+ \
+ Node* m_node; \
+ Node* m_init; \
+ public: \
+ typedef const_reference reference_type; \
+ typedef const ptr_type pointer_type; \
+ \
+ const_reverse_iterator(Node* node, Node* init) \
+ : m_node(node), m_init(init) { } \
+ const_reverse_iterator() : m_node(NULL), m_init(NULL) { } \
+ const_reverse_iterator(const reverse_iterator& it) \
+ : m_node(it.m_node), m_init(it.m_init) { } \
+ reference_type operator*() const \
+ { return *(pointer_type)m_node->GetDataPtr(); } \
+ ptrop \
+ itor& operator++() \
+ { m_node = m_node->GetPrevious(); return *this; } \
+ const itor operator++(int) \
+ { itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; }\
+ itor& operator--() \
+ { m_node = m_node ? m_node->GetNext() : m_init; return *this;}\
+ const itor operator--(int) \
+ { \
+ itor tmp = *this; \
+ m_node = m_node ? m_node->GetNext() : m_init; \
+ return tmp; \
+ } \
+ bool operator!=(const itor& it) const \
+ { return it.m_node != m_node; } \
+ bool operator==(const itor& it) const \
+ { return it.m_node == m_node; } \
+ }; \
+ \
+ wxEXPLICIT name(size_type n, const_reference v = value_type()) \
+ { assign(n, v); } \
+ name(const const_iterator& first, const const_iterator& last) \
+ { assign(first, last); } \
+ iterator begin() { return iterator(GetFirst(), GetLast()); } \
+ const_iterator begin() const \
+ { return const_iterator(GetFirst(), GetLast()); } \
+ iterator end() { return iterator(NULL, GetLast()); } \
+ const_iterator end() const { return const_iterator(NULL, GetLast()); }\
+ reverse_iterator rbegin() \
+ { return reverse_iterator(GetLast(), GetFirst()); } \
+ const_reverse_iterator rbegin() const \
+ { return const_reverse_iterator(GetLast(), GetFirst()); } \
+ reverse_iterator rend() { return reverse_iterator(NULL, GetFirst()); }\
+ const_reverse_iterator rend() const \
+ { return const_reverse_iterator(NULL, GetFirst()); } \
+ void resize(size_type n, value_type v = value_type()) \
+ { \
+ while (n < size()) \
+ pop_back(); \
+ while (n > size()) \
+ push_back(v); \
+ } \
+ size_type size() const { return GetCount(); } \
+ size_type max_size() const { return INT_MAX; } \
+ bool empty() const { return IsEmpty(); } \
+ reference front() { return *begin(); } \
+ const_reference front() const { return *begin(); } \
+ reference back() { iterator tmp = end(); return *--tmp; } \
+ const_reference back() const { const_iterator tmp = end(); return *--tmp; }\
+ void push_front(const_reference v = value_type()) \
+ { Insert(GetFirst(), (const_base_reference)v); } \
+ void pop_front() { DeleteNode(GetFirst()); } \
+ void push_back(const_reference v = value_type()) \
+ { Append((const_base_reference)v); } \
+ void pop_back() { DeleteNode(GetLast()); } \
+ void assign(const_iterator first, const const_iterator& last) \
+ { \
+ clear(); \
+ for(; first != last; ++first) \
+ Append((const_base_reference)*first); \
+ } \
+ void assign(size_type n, const_reference v = value_type()) \
+ { \
+ clear(); \
+ for(size_type i = 0; i < n; ++i) \
+ Append((const_base_reference)v); \
+ } \
+ iterator insert(const iterator& it, const_reference v) \
+ { \
+ if ( it == end() ) \
+ { \
+ Append((const_base_reference)v); \
+ /* \
+ note that this is the new end(), the old one was \
+ invalidated by the Append() call, and this is why we \
+ can't use the same code as in the normal case below \
+ */ \
+ iterator itins(end()); \
+ return --itins; \
+ } \
+ else \
+ { \
+ Insert(it.m_node, (const_base_reference)v); \
+ iterator itins(it); \
+ return --itins; \
+ } \
+ } \
+ void insert(const iterator& it, size_type n, const_reference v) \
+ { \
+ for(size_type i = 0; i < n; ++i) \
+ insert(it, v); \
+ } \
+ void insert(const iterator& it, \
+ const_iterator first, const const_iterator& last) \
+ { \
+ for(; first != last; ++first) \
+ insert(it, *first); \
+ } \
+ iterator erase(const iterator& it) \
+ { \
+ iterator next = iterator(it.m_node->GetNext(), GetLast()); \
+ DeleteNode(it.m_node); return next; \
+ } \
+ iterator erase(const iterator& first, const iterator& last) \
+ { \
+ iterator next = last; \
+ if ( next != end() ) \
+ ++next; \
+ DeleteNodes(first.m_node, last.m_node); \
+ return next; \
+ } \
+ void clear() { Clear(); } \
+ void splice(const iterator& it, name& l, const iterator& first, const iterator& last)\
+ { insert(it, first, last); l.erase(first, last); } \
+ void splice(const iterator& it, name& l) \
+ { splice(it, l, l.begin(), l.end() ); } \
+ void splice(const iterator& it, name& l, const iterator& first) \
+ { \
+ if ( it != first ) \
+ { \
+ insert(it, *first); \
+ l.erase(first); \
+ } \
+ } \
+ void remove(const_reference v) \
+ { DeleteObject((const_base_reference)v); } \
+ void reverse() \
+ { Reverse(); } \
+ /* void swap(name& l) \
+ { \
+ { size_t t = m_count; m_count = l.m_count; l.m_count = t; } \
+ { bool t = m_destroy; m_destroy = l.m_destroy; l.m_destroy = t; }\
+ { wxNodeBase* t = m_nodeFirst; m_nodeFirst = l.m_nodeFirst; l.m_nodeFirst = t; }\
+ { wxNodeBase* t = m_nodeLast; m_nodeLast = l.m_nodeLast; l.m_nodeLast = t; }\
+ { wxKeyType t = m_keyType; m_keyType = l.m_keyType; l.m_keyType = t; }\
+ } */ \
+ }
+
+#define WX_LIST_PTROP \
+ pointer_type operator->() const \
+ { return (pointer_type)m_node->GetDataPtr(); }
+#define WX_LIST_PTROP_NONE
+
+#define WX_DECLARE_LIST_3(T, Tbase, name, nodetype, classexp) \
+ WX_DECLARE_LIST_4(T, Tbase, name, nodetype, classexp, WX_LIST_PTROP_NONE)
+#define WX_DECLARE_LIST_PTR_3(T, Tbase, name, nodetype, classexp) \
+ WX_DECLARE_LIST_4(T, Tbase, name, nodetype, classexp, WX_LIST_PTROP)
+
+#define WX_DECLARE_LIST_2(elementtype, listname, nodename, classexp) \
+ WX_DECLARE_LIST_3(elementtype, elementtype, listname, nodename, classexp)
+#define WX_DECLARE_LIST_PTR_2(elementtype, listname, nodename, classexp) \
+ WX_DECLARE_LIST_PTR_3(elementtype, elementtype, listname, nodename, classexp)
+
+#define WX_DECLARE_LIST(elementtype, listname) \
+ typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \
+ WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, class)
+#define WX_DECLARE_LIST_PTR(elementtype, listname) \
+ typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \
+ WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class)
+
+#define WX_DECLARE_LIST_WITH_DECL(elementtype, listname, decl) \
+ typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \
+ WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, decl)
+
+#define WX_DECLARE_EXPORTED_LIST(elementtype, listname) \
+ WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class WXDLLIMPEXP_CORE)
+
+#define WX_DECLARE_EXPORTED_LIST_PTR(elementtype, listname) \
+ typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \
+ WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class WXDLLIMPEXP_CORE)
+
+#define WX_DECLARE_USER_EXPORTED_LIST(elementtype, listname, usergoo) \
+ typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \
+ WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, class usergoo)
+#define WX_DECLARE_USER_EXPORTED_LIST_PTR(elementtype, listname, usergoo) \
+ typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \
+ WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class usergoo)
+
+// this macro must be inserted in your program after
+// #include "wx/listimpl.cpp"
+#define WX_DEFINE_LIST(name) "don't forget to include listimpl.cpp!"
+
+#define WX_DEFINE_EXPORTED_LIST(name) WX_DEFINE_LIST(name)
+#define WX_DEFINE_USER_EXPORTED_LIST(name) WX_DEFINE_LIST(name)
+
+#endif // !wxUSE_STD_CONTAINERS
+
+// ============================================================================
+// now we can define classes 100% compatible with the old ones
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// commonly used list classes
+// ----------------------------------------------------------------------------
+
+#if defined(wxLIST_COMPATIBILITY)
+
+// inline compatibility functions
+
+#if !wxUSE_STD_CONTAINERS
+
+// ----------------------------------------------------------------------------
+// wxNodeBase deprecated methods
+// ----------------------------------------------------------------------------
+
+inline wxNode *wxNodeBase::Next() const { return (wxNode *)GetNext(); }
+inline wxNode *wxNodeBase::Previous() const { return (wxNode *)GetPrevious(); }
+inline wxObject *wxNodeBase::Data() const { return (wxObject *)GetData(); }
+
+// ----------------------------------------------------------------------------
+// wxListBase deprecated methods
+// ----------------------------------------------------------------------------
+
+inline int wxListBase::Number() const { return (int)GetCount(); }
+inline wxNode *wxListBase::First() const { return (wxNode *)GetFirst(); }
+inline wxNode *wxListBase::Last() const { return (wxNode *)GetLast(); }
+inline wxNode *wxListBase::Nth(size_t n) const { return (wxNode *)Item(n); }
+inline wxListBase::operator wxList&() const { return *(wxList*)this; }
+
+#endif
+
+// define this to make a lot of noise about use of the old wxList classes.
+//#define wxWARN_COMPAT_LIST_USE
+
+// ----------------------------------------------------------------------------
+// wxList compatibility class: in fact, it's a list of wxObjects
+// ----------------------------------------------------------------------------
+
+WX_DECLARE_LIST_2(wxObject, wxObjectList, wxObjectListNode,
+ class WXDLLIMPEXP_BASE);
+
+class WXDLLIMPEXP_BASE wxList : public wxObjectList
+{
+public:
+#if defined(wxWARN_COMPAT_LIST_USE) && !wxUSE_STD_CONTAINERS
+ wxList() { }
+ wxDEPRECATED( wxList(int key_type) );
+#elif !wxUSE_STD_CONTAINERS
+ wxList(int key_type = wxKEY_NONE);
+#endif
+
+ // this destructor is required for Darwin
+ ~wxList() { }
+
+#if !wxUSE_STD_CONTAINERS
+ wxList& operator=(const wxList& list)
+ { if (&list != this) Assign(list); return *this; }
+
+ // compatibility methods
+ void Sort(wxSortCompareFunction compfunc) { wxListBase::Sort(compfunc); }
+#endif // !wxUSE_STD_CONTAINERS
+
+#ifndef __VISUALC6__
+ template<typename T>
+ wxVector<T> AsVector() const
+ {
+ wxVector<T> vector(size());
+ size_t i = 0;
+
+ for ( const_iterator it = begin(); it != end(); ++it )
+ {
+ vector[i++] = static_cast<T>(*it);
+ }
+
+ return vector;
+ }
+#endif // !__VISUALC6__
+
+};
+
+#if !wxUSE_STD_CONTAINERS
+
+// -----------------------------------------------------------------------------
+// wxStringList class for compatibility with the old code
+// -----------------------------------------------------------------------------
+WX_DECLARE_LIST_2(wxChar, wxStringListBase, wxStringListNode, class WXDLLIMPEXP_BASE);
+
+class WXDLLIMPEXP_BASE wxStringList : public wxStringListBase
+{
+public:
+ // ctors and such
+ // default
+#ifdef wxWARN_COMPAT_LIST_USE
+ wxStringList();
+ wxDEPRECATED( wxStringList(const wxChar *first ...) ); // FIXME-UTF8
+#else
+ wxStringList();
+ wxStringList(const wxChar *first ...); // FIXME-UTF8
+#endif
+
+ // copying the string list: the strings are copied, too (extremely
+ // inefficient!)
+ wxStringList(const wxStringList& other) : wxStringListBase() { DeleteContents(true); DoCopy(other); }
+ wxStringList& operator=(const wxStringList& other)
+ {
+ if (&other != this)
+ {
+ Clear();
+ DoCopy(other);
+ }
+ return *this;
+ }
+
+ // operations
+ // makes a copy of the string
+ wxNode *Add(const wxChar *s);
+
+ // Append to beginning of list
+ wxNode *Prepend(const wxChar *s);
+
+ bool Delete(const wxChar *s);
+
+ wxChar **ListToArray(bool new_copies = false) const;
+ bool Member(const wxChar *s) const;
+
+ // alphabetic sort
+ void Sort();
+
+private:
+ void DoCopy(const wxStringList&); // common part of copy ctor and operator=
+};
+
+#else // if wxUSE_STD_CONTAINERS
+
+WX_DECLARE_LIST_XO(wxString, wxStringListBase, class WXDLLIMPEXP_BASE);
+
+class WXDLLIMPEXP_BASE wxStringList : public wxStringListBase
+{
+public:
+ compatibility_iterator Append(wxChar* s)
+ { wxString tmp = s; delete[] s; return wxStringListBase::Append(tmp); }
+ compatibility_iterator Insert(wxChar* s)
+ { wxString tmp = s; delete[] s; return wxStringListBase::Insert(tmp); }
+ compatibility_iterator Insert(size_t pos, wxChar* s)
+ {
+ wxString tmp = s;
+ delete[] s;
+ return wxStringListBase::Insert(pos, tmp);
+ }
+ compatibility_iterator Add(const wxChar* s)
+ { push_back(s); return GetLast(); }
+ compatibility_iterator Prepend(const wxChar* s)
+ { push_front(s); return GetFirst(); }
+};
+
+#endif // wxUSE_STD_CONTAINERS
+
+#endif // wxLIST_COMPATIBILITY
+
+// delete all list elements
+//
+// NB: the class declaration of the list elements must be visible from the
+// place where you use this macro, otherwise the proper destructor may not
+// be called (a decent compiler should give a warning about it, but don't
+// count on it)!
+#define WX_CLEAR_LIST(type, list) \
+ { \
+ type::iterator it, en; \
+ for( it = (list).begin(), en = (list).end(); it != en; ++it ) \
+ delete *it; \
+ (list).clear(); \
+ }
+
+// append all element of one list to another one
+#define WX_APPEND_LIST(list, other) \
+ { \
+ wxList::compatibility_iterator node = other->GetFirst(); \
+ while ( node ) \
+ { \
+ (list)->push_back(node->GetData()); \
+ node = node->GetNext(); \
+ } \
+ }
+
+#endif // _WX_LISTH__
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/listbase.h
+// Purpose: wxListCtrl class
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 04.12.99
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_LISTBASE_H_BASE_
+#define _WX_LISTBASE_H_BASE_
+
+#include "wx/colour.h"
+#include "wx/font.h"
+#include "wx/gdicmn.h"
+#include "wx/event.h"
+#include "wx/control.h"
+
+class WXDLLIMPEXP_FWD_CORE wxImageList;
+
+// ----------------------------------------------------------------------------
+// types
+// ----------------------------------------------------------------------------
+
+// type of compare function for wxListCtrl sort operation
+typedef
+int (wxCALLBACK *wxListCtrlCompare)(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData);
+
+// ----------------------------------------------------------------------------
+// wxListCtrl constants
+// ----------------------------------------------------------------------------
+
+// style flags
+#define wxLC_VRULES 0x0001
+#define wxLC_HRULES 0x0002
+
+#define wxLC_ICON 0x0004
+#define wxLC_SMALL_ICON 0x0008
+#define wxLC_LIST 0x0010
+#define wxLC_REPORT 0x0020
+
+#define wxLC_ALIGN_TOP 0x0040
+#define wxLC_ALIGN_LEFT 0x0080
+#define wxLC_AUTOARRANGE 0x0100
+#define wxLC_VIRTUAL 0x0200
+#define wxLC_EDIT_LABELS 0x0400
+#define wxLC_NO_HEADER 0x0800
+#define wxLC_NO_SORT_HEADER 0x1000
+#define wxLC_SINGLE_SEL 0x2000
+#define wxLC_SORT_ASCENDING 0x4000
+#define wxLC_SORT_DESCENDING 0x8000
+
+#define wxLC_MASK_TYPE (wxLC_ICON | wxLC_SMALL_ICON | wxLC_LIST | wxLC_REPORT)
+#define wxLC_MASK_ALIGN (wxLC_ALIGN_TOP | wxLC_ALIGN_LEFT)
+#define wxLC_MASK_SORT (wxLC_SORT_ASCENDING | wxLC_SORT_DESCENDING)
+
+// for compatibility only
+#define wxLC_USER_TEXT wxLC_VIRTUAL
+
+// Omitted because
+// (a) too much detail
+// (b) not enough style flags
+// (c) not implemented anyhow in the generic version
+//
+// #define wxLC_NO_SCROLL
+// #define wxLC_NO_LABEL_WRAP
+// #define wxLC_OWNERDRAW_FIXED
+// #define wxLC_SHOW_SEL_ALWAYS
+
+// Mask flags to tell app/GUI what fields of wxListItem are valid
+#define wxLIST_MASK_STATE 0x0001
+#define wxLIST_MASK_TEXT 0x0002
+#define wxLIST_MASK_IMAGE 0x0004
+#define wxLIST_MASK_DATA 0x0008
+#define wxLIST_SET_ITEM 0x0010
+#define wxLIST_MASK_WIDTH 0x0020
+#define wxLIST_MASK_FORMAT 0x0040
+
+// State flags for indicating the state of an item
+#define wxLIST_STATE_DONTCARE 0x0000
+#define wxLIST_STATE_DROPHILITED 0x0001 // MSW only
+#define wxLIST_STATE_FOCUSED 0x0002
+#define wxLIST_STATE_SELECTED 0x0004
+#define wxLIST_STATE_CUT 0x0008 // MSW only
+#define wxLIST_STATE_DISABLED 0x0010 // OS2 only
+#define wxLIST_STATE_FILTERED 0x0020 // OS2 only
+#define wxLIST_STATE_INUSE 0x0040 // OS2 only
+#define wxLIST_STATE_PICKED 0x0080 // OS2 only
+#define wxLIST_STATE_SOURCE 0x0100 // OS2 only
+
+// Hit test flags, used in HitTest
+#define wxLIST_HITTEST_ABOVE 0x0001 // Above the client area.
+#define wxLIST_HITTEST_BELOW 0x0002 // Below the client area.
+#define wxLIST_HITTEST_NOWHERE 0x0004 // In the client area but below the last item.
+#define wxLIST_HITTEST_ONITEMICON 0x0020 // On the bitmap associated with an item.
+#define wxLIST_HITTEST_ONITEMLABEL 0x0080 // On the label (string) associated with an item.
+#define wxLIST_HITTEST_ONITEMRIGHT 0x0100 // In the area to the right of an item.
+#define wxLIST_HITTEST_ONITEMSTATEICON 0x0200 // On the state icon for a tree view item that is in a user-defined state.
+#define wxLIST_HITTEST_TOLEFT 0x0400 // To the left of the client area.
+#define wxLIST_HITTEST_TORIGHT 0x0800 // To the right of the client area.
+
+#define wxLIST_HITTEST_ONITEM (wxLIST_HITTEST_ONITEMICON | wxLIST_HITTEST_ONITEMLABEL | wxLIST_HITTEST_ONITEMSTATEICON)
+
+// GetSubItemRect constants
+#define wxLIST_GETSUBITEMRECT_WHOLEITEM -1l
+
+// Flags for GetNextItem (MSW only except wxLIST_NEXT_ALL)
+enum
+{
+ wxLIST_NEXT_ABOVE, // Searches for an item above the specified item
+ wxLIST_NEXT_ALL, // Searches for subsequent item by index
+ wxLIST_NEXT_BELOW, // Searches for an item below the specified item
+ wxLIST_NEXT_LEFT, // Searches for an item to the left of the specified item
+ wxLIST_NEXT_RIGHT // Searches for an item to the right of the specified item
+};
+
+// Alignment flags for Arrange (MSW only except wxLIST_ALIGN_LEFT)
+enum
+{
+ wxLIST_ALIGN_DEFAULT,
+ wxLIST_ALIGN_LEFT,
+ wxLIST_ALIGN_TOP,
+ wxLIST_ALIGN_SNAP_TO_GRID
+};
+
+// Column format (MSW only except wxLIST_FORMAT_LEFT)
+enum wxListColumnFormat
+{
+ wxLIST_FORMAT_LEFT,
+ wxLIST_FORMAT_RIGHT,
+ wxLIST_FORMAT_CENTRE,
+ wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE
+};
+
+// Autosize values for SetColumnWidth
+enum
+{
+ wxLIST_AUTOSIZE = -1,
+ wxLIST_AUTOSIZE_USEHEADER = -2 // partly supported by generic version
+};
+
+// Flag values for GetItemRect
+enum
+{
+ wxLIST_RECT_BOUNDS,
+ wxLIST_RECT_ICON,
+ wxLIST_RECT_LABEL
+};
+
+// Flag values for FindItem (MSW only)
+enum
+{
+ wxLIST_FIND_UP,
+ wxLIST_FIND_DOWN,
+ wxLIST_FIND_LEFT,
+ wxLIST_FIND_RIGHT
+};
+
+// ----------------------------------------------------------------------------
+// wxListItemAttr: a structure containing the visual attributes of an item
+// ----------------------------------------------------------------------------
+
+// TODO: this should be renamed to wxItemAttr or something general like this
+// and used as base class for wxTextAttr which duplicates this class
+// entirely currently
+class WXDLLIMPEXP_CORE wxListItemAttr
+{
+public:
+ // ctors
+ wxListItemAttr() { }
+ wxListItemAttr(const wxColour& colText,
+ const wxColour& colBack,
+ const wxFont& font)
+ : m_colText(colText), m_colBack(colBack), m_font(font)
+ {
+ }
+
+ // default copy ctor, assignment operator and dtor are ok
+
+
+ // setters
+ void SetTextColour(const wxColour& colText) { m_colText = colText; }
+ void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; }
+ void SetFont(const wxFont& font) { m_font = font; }
+
+ // accessors
+ bool HasTextColour() const { return m_colText.IsOk(); }
+ bool HasBackgroundColour() const { return m_colBack.IsOk(); }
+ bool HasFont() const { return m_font.IsOk(); }
+
+ const wxColour& GetTextColour() const { return m_colText; }
+ const wxColour& GetBackgroundColour() const { return m_colBack; }
+ const wxFont& GetFont() const { return m_font; }
+
+
+ // this is almost like assignment operator except it doesn't overwrite the
+ // fields unset in the source attribute
+ void AssignFrom(const wxListItemAttr& source)
+ {
+ if ( source.HasTextColour() )
+ SetTextColour(source.GetTextColour());
+ if ( source.HasBackgroundColour() )
+ SetBackgroundColour(source.GetBackgroundColour());
+ if ( source.HasFont() )
+ SetFont(source.GetFont());
+ }
+
+private:
+ wxColour m_colText,
+ m_colBack;
+ wxFont m_font;
+};
+
+// ----------------------------------------------------------------------------
+// wxListItem: the item or column info, used to exchange data with wxListCtrl
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxListItem : public wxObject
+{
+public:
+ wxListItem() { Init(); m_attr = NULL; }
+ wxListItem(const wxListItem& item)
+ : wxObject(),
+ m_mask(item.m_mask),
+ m_itemId(item.m_itemId),
+ m_col(item.m_col),
+ m_state(item.m_state),
+ m_stateMask(item.m_stateMask),
+ m_text(item.m_text),
+ m_image(item.m_image),
+ m_data(item.m_data),
+ m_format(item.m_format),
+ m_width(item.m_width),
+ m_attr(NULL)
+ {
+ // copy list item attributes
+ if ( item.HasAttributes() )
+ m_attr = new wxListItemAttr(*item.GetAttributes());
+ }
+
+ wxListItem& operator=(const wxListItem& item)
+ {
+ if ( &item != this )
+ {
+ m_mask = item.m_mask;
+ m_itemId = item.m_itemId;
+ m_col = item.m_col;
+ m_state = item.m_state;
+ m_stateMask = item.m_stateMask;
+ m_text = item.m_text;
+ m_image = item.m_image;
+ m_data = item.m_data;
+ m_format = item.m_format;
+ m_width = item.m_width;
+ m_attr = item.m_attr ? new wxListItemAttr(*item.m_attr) : NULL;
+ }
+
+ return *this;
+ }
+
+ virtual ~wxListItem() { delete m_attr; }
+
+ // resetting
+ void Clear() { Init(); m_text.clear(); ClearAttributes(); }
+ void ClearAttributes() { if ( m_attr ) { delete m_attr; m_attr = NULL; } }
+
+ // setters
+ void SetMask(long mask)
+ { m_mask = mask; }
+ void SetId(long id)
+ { m_itemId = id; }
+ void SetColumn(int col)
+ { m_col = col; }
+ void SetState(long state)
+ { m_mask |= wxLIST_MASK_STATE; m_state = state; m_stateMask |= state; }
+ void SetStateMask(long stateMask)
+ { m_stateMask = stateMask; }
+ void SetText(const wxString& text)
+ { m_mask |= wxLIST_MASK_TEXT; m_text = text; }
+ void SetImage(int image)
+ { m_mask |= wxLIST_MASK_IMAGE; m_image = image; }
+ void SetData(long data)
+ { m_mask |= wxLIST_MASK_DATA; m_data = data; }
+ void SetData(void *data)
+ { m_mask |= wxLIST_MASK_DATA; m_data = wxPtrToUInt(data); }
+
+ void SetWidth(int width)
+ { m_mask |= wxLIST_MASK_WIDTH; m_width = width; }
+ void SetAlign(wxListColumnFormat align)
+ { m_mask |= wxLIST_MASK_FORMAT; m_format = align; }
+
+ void SetTextColour(const wxColour& colText)
+ { Attributes().SetTextColour(colText); }
+ void SetBackgroundColour(const wxColour& colBack)
+ { Attributes().SetBackgroundColour(colBack); }
+ void SetFont(const wxFont& font)
+ { Attributes().SetFont(font); }
+
+ // accessors
+ long GetMask() const { return m_mask; }
+ long GetId() const { return m_itemId; }
+ int GetColumn() const { return m_col; }
+ long GetState() const { return m_state & m_stateMask; }
+ const wxString& GetText() const { return m_text; }
+ int GetImage() const { return m_image; }
+ wxUIntPtr GetData() const { return m_data; }
+
+ int GetWidth() const { return m_width; }
+ wxListColumnFormat GetAlign() const { return (wxListColumnFormat)m_format; }
+
+ wxListItemAttr *GetAttributes() const { return m_attr; }
+ bool HasAttributes() const { return m_attr != NULL; }
+
+ wxColour GetTextColour() const
+ { return HasAttributes() ? m_attr->GetTextColour() : wxNullColour; }
+ wxColour GetBackgroundColour() const
+ { return HasAttributes() ? m_attr->GetBackgroundColour()
+ : wxNullColour; }
+ wxFont GetFont() const
+ { return HasAttributes() ? m_attr->GetFont() : wxNullFont; }
+
+ // this conversion is necessary to make old code using GetItem() to
+ // compile
+ operator long() const { return m_itemId; }
+
+ // these members are public for compatibility
+
+ long m_mask; // Indicates what fields are valid
+ long m_itemId; // The zero-based item position
+ int m_col; // Zero-based column, if in report mode
+ long m_state; // The state of the item
+ long m_stateMask;// Which flags of m_state are valid (uses same flags)
+ wxString m_text; // The label/header text
+ int m_image; // The zero-based index into an image list
+ wxUIntPtr m_data; // App-defined data
+
+ // For columns only
+ int m_format; // left, right, centre
+ int m_width; // width of column
+
+#ifdef __WXPM__
+ int m_miniImage; // handle to the mini image for OS/2
+#endif
+
+protected:
+ // creates m_attr if we don't have it yet
+ wxListItemAttr& Attributes()
+ {
+ if ( !m_attr )
+ m_attr = new wxListItemAttr;
+
+ return *m_attr;
+ }
+
+ void Init()
+ {
+ m_mask = 0;
+ m_itemId = -1;
+ m_col = 0;
+ m_state = 0;
+ m_stateMask = 0;
+ m_image = -1;
+ m_data = 0;
+
+ m_format = wxLIST_FORMAT_CENTRE;
+ m_width = 0;
+ }
+
+ wxListItemAttr *m_attr; // optional pointer to the items style
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxListItem)
+};
+
+// ----------------------------------------------------------------------------
+// wxListCtrlBase: the base class for the main control itself.
+// ----------------------------------------------------------------------------
+
+// Unlike other base classes, this class doesn't currently define the API of
+// the real control class but is just used for implementation convenience. We
+// should define the public class functions as pure virtual here in the future
+// however.
+class WXDLLIMPEXP_CORE wxListCtrlBase : public wxControl
+{
+public:
+ wxListCtrlBase() { }
+
+ // Image list methods.
+ // -------------------
+
+ // Associate the given (possibly NULL to indicate that no images will be
+ // used) image list with the control. The ownership of the image list
+ // passes to the control, i.e. it will be deleted when the control itself
+ // is destroyed.
+ //
+ // The value of "which" must be one of wxIMAGE_LIST_{NORMAL,SMALL,STATE}.
+ virtual void AssignImageList(wxImageList* imageList, int which) = 0;
+
+ // Same as AssignImageList() but the control does not delete the image list
+ // so it can be shared among several controls.
+ virtual void SetImageList(wxImageList* imageList, int which) = 0;
+
+ // Return the currently used image list, may be NULL.
+ virtual wxImageList* GetImageList(int which) const = 0;
+
+
+ // Column-related methods.
+ // -----------------------
+
+ // All these methods can only be used in report view mode.
+
+ // Appends a new column.
+ //
+ // Returns the index of the newly inserted column or -1 on error.
+ long AppendColumn(const wxString& heading,
+ wxListColumnFormat format = wxLIST_FORMAT_LEFT,
+ int width = -1);
+
+ // Add a new column to the control at the position "col".
+ //
+ // Returns the index of the newly inserted column or -1 on error.
+ long InsertColumn(long col, const wxListItem& info);
+ long InsertColumn(long col,
+ const wxString& heading,
+ int format = wxLIST_FORMAT_LEFT,
+ int width = wxLIST_AUTOSIZE);
+
+ // Delete the given or all columns.
+ virtual bool DeleteColumn(int col) = 0;
+ virtual bool DeleteAllColumns() = 0;
+
+ // Return the current number of columns.
+ virtual int GetColumnCount() const = 0;
+
+ // Get or update information about the given column. Set item mask to
+ // indicate the fields to retrieve or change.
+ //
+ // Returns false on error, e.g. if the column index is invalid.
+ virtual bool GetColumn(int col, wxListItem& item) const = 0;
+ virtual bool SetColumn(int col, const wxListItem& item) = 0;
+
+ // Convenient wrappers for the above methods which get or update just the
+ // column width.
+ virtual int GetColumnWidth(int col) const = 0;
+ virtual bool SetColumnWidth(int col, int width) = 0;
+
+ // return the attribute for the item (may return NULL if none)
+ virtual wxListItemAttr *OnGetItemAttr(long item) const;
+
+ // Other miscellaneous accessors.
+ // ------------------------------
+
+ // Convenient functions for testing the list control mode:
+ bool InReportView() const { return HasFlag(wxLC_REPORT); }
+ bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); }
+
+ // Enable or disable beep when incremental match doesn't find any item.
+ // Only implemented in the generic version currently.
+ virtual void EnableBellOnNoMatch(bool WXUNUSED(on) = true) { }
+
+ void EnableAlternateRowColours(bool enable = true);
+ void SetAlternateRowColour(const wxColour& colour);
+
+protected:
+ // Real implementations methods to which our public forwards.
+ virtual long DoInsertColumn(long col, const wxListItem& info) = 0;
+
+ // Overridden methods of the base class.
+ virtual wxSize DoGetBestClientSize() const;
+
+private:
+ // user defined color to draw row lines, may be invalid
+ wxListItemAttr m_alternateRowColour;
+};
+
+// ----------------------------------------------------------------------------
+// wxListEvent - the event class for the wxListCtrl notifications
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxListEvent : public wxNotifyEvent
+{
+public:
+ wxListEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
+ : wxNotifyEvent(commandType, winid)
+ , m_code(-1)
+ , m_oldItemIndex(-1)
+ , m_itemIndex(-1)
+ , m_col(-1)
+ , m_pointDrag()
+ , m_item()
+ , m_editCancelled(false)
+ { }
+
+ wxListEvent(const wxListEvent& event)
+ : wxNotifyEvent(event)
+ , m_code(event.m_code)
+ , m_oldItemIndex(event.m_oldItemIndex)
+ , m_itemIndex(event.m_itemIndex)
+ , m_col(event.m_col)
+ , m_pointDrag(event.m_pointDrag)
+ , m_item(event.m_item)
+ , m_editCancelled(event.m_editCancelled)
+ { }
+
+ int GetKeyCode() const { return m_code; }
+ long GetIndex() const { return m_itemIndex; }
+ int GetColumn() const { return m_col; }
+ wxPoint GetPoint() const { return m_pointDrag; }
+ const wxString& GetLabel() const { return m_item.m_text; }
+ const wxString& GetText() const { return m_item.m_text; }
+ int GetImage() const { return m_item.m_image; }
+ wxUIntPtr GetData() const { return m_item.m_data; }
+ long GetMask() const { return m_item.m_mask; }
+ const wxListItem& GetItem() const { return m_item; }
+
+ // for wxEVT_LIST_CACHE_HINT only
+ long GetCacheFrom() const { return m_oldItemIndex; }
+ long GetCacheTo() const { return m_itemIndex; }
+
+ // was label editing canceled? (for wxEVT_LIST_END_LABEL_EDIT only)
+ bool IsEditCancelled() const { return m_editCancelled; }
+ void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; }
+
+ virtual wxEvent *Clone() const { return new wxListEvent(*this); }
+
+//protected: -- not for backwards compatibility
+ int m_code;
+ long m_oldItemIndex; // only for wxEVT_LIST_CACHE_HINT
+ long m_itemIndex;
+ int m_col;
+ wxPoint m_pointDrag;
+
+ wxListItem m_item;
+
+protected:
+ bool m_editCancelled;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxListEvent)
+};
+
+// ----------------------------------------------------------------------------
+// wxListCtrl event macros
+// ----------------------------------------------------------------------------
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_BEGIN_DRAG, wxListEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_BEGIN_RDRAG, wxListEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_BEGIN_LABEL_EDIT, wxListEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_END_LABEL_EDIT, wxListEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_DELETE_ITEM, wxListEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_DELETE_ALL_ITEMS, wxListEvent );
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_SELECTED, wxListEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_DESELECTED, wxListEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_KEY_DOWN, wxListEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_INSERT_ITEM, wxListEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_COL_CLICK, wxListEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_RIGHT_CLICK, wxListEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_MIDDLE_CLICK, wxListEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_ACTIVATED, wxListEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_CACHE_HINT, wxListEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_COL_RIGHT_CLICK, wxListEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_COL_BEGIN_DRAG, wxListEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_COL_DRAGGING, wxListEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_COL_END_DRAG, wxListEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_FOCUSED, wxListEvent );
+
+typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&);
+
+#define wxListEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxListEventFunction, func)
+
+#define wx__DECLARE_LISTEVT(evt, id, fn) \
+ wx__DECLARE_EVT1(wxEVT_LIST_ ## evt, id, wxListEventHandler(fn))
+
+#define EVT_LIST_BEGIN_DRAG(id, fn) wx__DECLARE_LISTEVT(BEGIN_DRAG, id, fn)
+#define EVT_LIST_BEGIN_RDRAG(id, fn) wx__DECLARE_LISTEVT(BEGIN_RDRAG, id, fn)
+#define EVT_LIST_BEGIN_LABEL_EDIT(id, fn) wx__DECLARE_LISTEVT(BEGIN_LABEL_EDIT, id, fn)
+#define EVT_LIST_END_LABEL_EDIT(id, fn) wx__DECLARE_LISTEVT(END_LABEL_EDIT, id, fn)
+#define EVT_LIST_DELETE_ITEM(id, fn) wx__DECLARE_LISTEVT(DELETE_ITEM, id, fn)
+#define EVT_LIST_DELETE_ALL_ITEMS(id, fn) wx__DECLARE_LISTEVT(DELETE_ALL_ITEMS, id, fn)
+#define EVT_LIST_KEY_DOWN(id, fn) wx__DECLARE_LISTEVT(KEY_DOWN, id, fn)
+#define EVT_LIST_INSERT_ITEM(id, fn) wx__DECLARE_LISTEVT(INSERT_ITEM, id, fn)
+
+#define EVT_LIST_COL_CLICK(id, fn) wx__DECLARE_LISTEVT(COL_CLICK, id, fn)
+#define EVT_LIST_COL_RIGHT_CLICK(id, fn) wx__DECLARE_LISTEVT(COL_RIGHT_CLICK, id, fn)
+#define EVT_LIST_COL_BEGIN_DRAG(id, fn) wx__DECLARE_LISTEVT(COL_BEGIN_DRAG, id, fn)
+#define EVT_LIST_COL_DRAGGING(id, fn) wx__DECLARE_LISTEVT(COL_DRAGGING, id, fn)
+#define EVT_LIST_COL_END_DRAG(id, fn) wx__DECLARE_LISTEVT(COL_END_DRAG, id, fn)
+
+#define EVT_LIST_ITEM_SELECTED(id, fn) wx__DECLARE_LISTEVT(ITEM_SELECTED, id, fn)
+#define EVT_LIST_ITEM_DESELECTED(id, fn) wx__DECLARE_LISTEVT(ITEM_DESELECTED, id, fn)
+#define EVT_LIST_ITEM_RIGHT_CLICK(id, fn) wx__DECLARE_LISTEVT(ITEM_RIGHT_CLICK, id, fn)
+#define EVT_LIST_ITEM_MIDDLE_CLICK(id, fn) wx__DECLARE_LISTEVT(ITEM_MIDDLE_CLICK, id, fn)
+#define EVT_LIST_ITEM_ACTIVATED(id, fn) wx__DECLARE_LISTEVT(ITEM_ACTIVATED, id, fn)
+#define EVT_LIST_ITEM_FOCUSED(id, fn) wx__DECLARE_LISTEVT(ITEM_FOCUSED, id, fn)
+
+#define EVT_LIST_CACHE_HINT(id, fn) wx__DECLARE_LISTEVT(CACHE_HINT, id, fn)
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_LIST_BEGIN_DRAG wxEVT_LIST_BEGIN_DRAG
+#define wxEVT_COMMAND_LIST_BEGIN_RDRAG wxEVT_LIST_BEGIN_RDRAG
+#define wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT wxEVT_LIST_BEGIN_LABEL_EDIT
+#define wxEVT_COMMAND_LIST_END_LABEL_EDIT wxEVT_LIST_END_LABEL_EDIT
+#define wxEVT_COMMAND_LIST_DELETE_ITEM wxEVT_LIST_DELETE_ITEM
+#define wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS wxEVT_LIST_DELETE_ALL_ITEMS
+#define wxEVT_COMMAND_LIST_ITEM_SELECTED wxEVT_LIST_ITEM_SELECTED
+#define wxEVT_COMMAND_LIST_ITEM_DESELECTED wxEVT_LIST_ITEM_DESELECTED
+#define wxEVT_COMMAND_LIST_KEY_DOWN wxEVT_LIST_KEY_DOWN
+#define wxEVT_COMMAND_LIST_INSERT_ITEM wxEVT_LIST_INSERT_ITEM
+#define wxEVT_COMMAND_LIST_COL_CLICK wxEVT_LIST_COL_CLICK
+#define wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK wxEVT_LIST_ITEM_RIGHT_CLICK
+#define wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK wxEVT_LIST_ITEM_MIDDLE_CLICK
+#define wxEVT_COMMAND_LIST_ITEM_ACTIVATED wxEVT_LIST_ITEM_ACTIVATED
+#define wxEVT_COMMAND_LIST_CACHE_HINT wxEVT_LIST_CACHE_HINT
+#define wxEVT_COMMAND_LIST_COL_RIGHT_CLICK wxEVT_LIST_COL_RIGHT_CLICK
+#define wxEVT_COMMAND_LIST_COL_BEGIN_DRAG wxEVT_LIST_COL_BEGIN_DRAG
+#define wxEVT_COMMAND_LIST_COL_DRAGGING wxEVT_LIST_COL_DRAGGING
+#define wxEVT_COMMAND_LIST_COL_END_DRAG wxEVT_LIST_COL_END_DRAG
+#define wxEVT_COMMAND_LIST_ITEM_FOCUSED wxEVT_LIST_ITEM_FOCUSED
+
+
+#endif
+ // _WX_LISTCTRL_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/listbook.h
+// Purpose: wxListbook: wxListCtrl and wxNotebook combination
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 19.08.03
+// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_LISTBOOK_H_
+#define _WX_LISTBOOK_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_LISTBOOK
+
+#include "wx/bookctrl.h"
+#include "wx/containr.h"
+
+class WXDLLIMPEXP_FWD_CORE wxListView;
+class WXDLLIMPEXP_FWD_CORE wxListEvent;
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LISTBOOK_PAGE_CHANGED, wxBookCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LISTBOOK_PAGE_CHANGING, wxBookCtrlEvent );
+
+// wxListbook flags
+#define wxLB_DEFAULT wxBK_DEFAULT
+#define wxLB_TOP wxBK_TOP
+#define wxLB_BOTTOM wxBK_BOTTOM
+#define wxLB_LEFT wxBK_LEFT
+#define wxLB_RIGHT wxBK_RIGHT
+#define wxLB_ALIGN_MASK wxBK_ALIGN_MASK
+
+// ----------------------------------------------------------------------------
+// wxListbook
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxListbook : public wxNavigationEnabled<wxBookCtrlBase>
+{
+public:
+ wxListbook() { }
+
+ wxListbook(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxEmptyString)
+ {
+ (void)Create(parent, id, pos, size, style, name);
+ }
+
+ // quasi ctor
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxEmptyString);
+
+
+ // overridden base class methods
+ virtual bool SetPageText(size_t n, const wxString& strText);
+ virtual wxString GetPageText(size_t n) const;
+ virtual int GetPageImage(size_t n) const;
+ virtual bool SetPageImage(size_t n, int imageId);
+ virtual bool InsertPage(size_t n,
+ wxWindow *page,
+ const wxString& text,
+ bool bSelect = false,
+ int imageId = NO_IMAGE);
+ virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); }
+ virtual int ChangeSelection(size_t n) { return DoSetSelection(n); }
+ virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
+ virtual void SetImageList(wxImageList *imageList);
+
+ virtual bool DeleteAllPages();
+
+ wxListView* GetListView() const { return (wxListView*)m_bookctrl; }
+
+protected:
+ virtual wxWindow *DoRemovePage(size_t page);
+
+ void UpdateSelectedPage(size_t newsel);
+
+ wxBookCtrlEvent* CreatePageChangingEvent() const;
+ void MakeChangedEvent(wxBookCtrlEvent &event);
+
+ // Get the correct wxListCtrl flags to use depending on our own flags.
+ long GetListCtrlFlags() const;
+
+ // event handlers
+ void OnListSelected(wxListEvent& event);
+ void OnSize(wxSizeEvent& event);
+
+private:
+ // this should be called when we need to be relaid out
+ void UpdateSize();
+
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxListbook)
+};
+
+// ----------------------------------------------------------------------------
+// listbook event class and related stuff
+// ----------------------------------------------------------------------------
+
+// wxListbookEvent is obsolete and defined for compatibility only (notice that
+// we use #define and not typedef to also keep compatibility with the existing
+// code which forward declares it)
+#define wxListbookEvent wxBookCtrlEvent
+typedef wxBookCtrlEventFunction wxListbookEventFunction;
+#define wxListbookEventHandler(func) wxBookCtrlEventHandler(func)
+
+#define EVT_LISTBOOK_PAGE_CHANGED(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_LISTBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn))
+
+#define EVT_LISTBOOK_PAGE_CHANGING(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_LISTBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn))
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED wxEVT_LISTBOOK_PAGE_CHANGED
+#define wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING wxEVT_LISTBOOK_PAGE_CHANGING
+
+#endif // wxUSE_LISTBOOK
+
+#endif // _WX_LISTBOOK_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/listbox.h
+// Purpose: wxListBox class interface
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 22.10.99
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_LISTBOX_H_BASE_
+#define _WX_LISTBOX_H_BASE_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_LISTBOX
+
+#include "wx/ctrlsub.h" // base class
+
+// forward declarations are enough here
+class WXDLLIMPEXP_FWD_BASE wxArrayInt;
+class WXDLLIMPEXP_FWD_BASE wxArrayString;
+
+// ----------------------------------------------------------------------------
+// global data
+// ----------------------------------------------------------------------------
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxListBoxNameStr[];
+
+// ----------------------------------------------------------------------------
+// wxListBox interface is defined by the class wxListBoxBase
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxListBoxBase : public wxControlWithItems
+{
+public:
+ wxListBoxBase() { }
+ virtual ~wxListBoxBase();
+
+ void InsertItems(unsigned int nItems, const wxString *items, unsigned int pos)
+ { Insert(nItems, items, pos); }
+ void InsertItems(const wxArrayString& items, unsigned int pos)
+ { Insert(items, pos); }
+
+ // multiple selection logic
+ virtual bool IsSelected(int n) const = 0;
+ virtual void SetSelection(int n);
+ void SetSelection(int n, bool select) { DoSetSelection(n, select); }
+ void Deselect(int n) { DoSetSelection(n, false); }
+ void DeselectAll(int itemToLeaveSelected = -1);
+
+ virtual bool SetStringSelection(const wxString& s, bool select);
+ virtual bool SetStringSelection(const wxString& s)
+ {
+ return SetStringSelection(s, true);
+ }
+
+ // works for single as well as multiple selection listboxes (unlike
+ // GetSelection which only works for listboxes with single selection)
+ virtual int GetSelections(wxArrayInt& aSelections) const = 0;
+
+ // set the specified item at the first visible item or scroll to max
+ // range.
+ void SetFirstItem(int n) { DoSetFirstItem(n); }
+ void SetFirstItem(const wxString& s);
+
+ // ensures that the given item is visible scrolling the listbox if
+ // necessary
+ virtual void EnsureVisible(int n);
+
+ // a combination of Append() and EnsureVisible(): appends the item to the
+ // listbox and ensures that it is visible i.e. not scrolled out of view
+ void AppendAndEnsureVisible(const wxString& s);
+
+ // return true if the listbox allows multiple selection
+ bool HasMultipleSelection() const
+ {
+ return (m_windowStyle & wxLB_MULTIPLE) ||
+ (m_windowStyle & wxLB_EXTENDED);
+ }
+
+ // override wxItemContainer::IsSorted
+ virtual bool IsSorted() const { return HasFlag( wxLB_SORT ); }
+
+ // emulate selecting or deselecting the item event.GetInt() (depending on
+ // event.GetExtraLong())
+ void Command(wxCommandEvent& event);
+
+ // return the index of the item at this position or wxNOT_FOUND
+ int HitTest(const wxPoint& point) const { return DoListHitTest(point); }
+ int HitTest(int x, int y) const { return DoListHitTest(wxPoint(x, y)); }
+
+
+protected:
+ virtual void DoSetFirstItem(int n) = 0;
+
+ virtual void DoSetSelection(int n, bool select) = 0;
+
+ // there is already wxWindow::DoHitTest() so call this one differently
+ virtual int DoListHitTest(const wxPoint& WXUNUSED(point)) const
+ { return wxNOT_FOUND; }
+
+ // Helper for the code generating events in single selection mode: updates
+ // m_oldSelections and return true if the selection really changed.
+ // Otherwise just returns false.
+ bool DoChangeSingleSelection(int item);
+
+ // Helper for generating events in multiple and extended mode: compare the
+ // current selections with the previously recorded ones (in
+ // m_oldSelections) and send the appropriate event if they differ,
+ // otherwise just return false.
+ bool CalcAndSendEvent();
+
+ // Send a listbox (de)selection or double click event.
+ //
+ // Returns true if the event was processed.
+ bool SendEvent(wxEventType evtType, int item, bool selected);
+
+ // Array storing the indices of all selected items that we already notified
+ // the user code about for multi selection list boxes.
+ //
+ // For single selection list boxes, we reuse this array to store the single
+ // currently selected item, this is used by DoChangeSingleSelection().
+ //
+ // TODO-OPT: wxSelectionStore would be more efficient for big list boxes.
+ wxArrayInt m_oldSelections;
+
+ // Update m_oldSelections with currently selected items (does nothing in
+ // single selection mode on platforms other than MSW).
+ void UpdateOldSelections();
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxListBoxBase);
+};
+
+// ----------------------------------------------------------------------------
+// include the platform-specific class declaration
+// ----------------------------------------------------------------------------
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/listbox.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/listbox.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/listbox.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/listbox.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/listbox.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/listbox.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/listbox.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/listbox.h"
+#endif
+
+#endif // wxUSE_LISTBOX
+
+#endif
+ // _WX_LISTBOX_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/listctrl.h
+// Purpose: wxListCtrl class
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 04.12.99
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_LISTCTRL_H_BASE_
+#define _WX_LISTCTRL_H_BASE_
+
+#include "wx/defs.h" // headers should include this before first wxUSE_XXX check
+
+#if wxUSE_LISTCTRL
+
+#include "wx/listbase.h"
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxListCtrlNameStr[];
+
+// ----------------------------------------------------------------------------
+// include the wxListCtrl class declaration
+// ----------------------------------------------------------------------------
+
+#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
+ #include "wx/msw/listctrl.h"
+#elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON
+ #include "wx/osx/listctrl.h"
+#else
+ #include "wx/generic/listctrl.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// wxListView: a class which provides a better API for list control
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxListView : public wxListCtrl
+{
+public:
+ wxListView() { }
+ wxListView( wxWindow *parent,
+ wxWindowID winid = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxLC_REPORT,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString &name = wxListCtrlNameStr)
+ {
+ Create(parent, winid, pos, size, style, validator, name);
+ }
+
+ // focus/selection stuff
+ // ---------------------
+
+ // [de]select an item
+ void Select(long n, bool on = true)
+ {
+ SetItemState(n, on ? wxLIST_STATE_SELECTED : 0, wxLIST_STATE_SELECTED);
+ }
+
+ // focus and show the given item
+ void Focus(long index)
+ {
+ SetItemState(index, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED);
+ EnsureVisible(index);
+ }
+
+ // get the currently focused item or -1 if none
+ long GetFocusedItem() const
+ {
+ return GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED);
+ }
+
+ // get first and subsequent selected items, return -1 when no more
+ long GetNextSelected(long item) const
+ { return GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); }
+ long GetFirstSelected() const
+ { return GetNextSelected(-1); }
+
+ // return true if the item is selected
+ bool IsSelected(long index) const
+ { return GetItemState(index, wxLIST_STATE_SELECTED) != 0; }
+
+ // columns
+ // -------
+
+ void SetColumnImage(int col, int image)
+ {
+ wxListItem item;
+ item.SetMask(wxLIST_MASK_IMAGE);
+ item.SetImage(image);
+ SetColumn(col, item);
+ }
+
+ void ClearColumnImage(int col) { SetColumnImage(col, -1); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxListView)
+};
+
+#endif // wxUSE_LISTCTRL
+
+#endif
+ // _WX_LISTCTRL_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/listimpl.cpp
+// Purpose: second-part of macro based implementation of template lists
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 16/11/98
+// Copyright: (c) 1998 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#if wxUSE_STD_CONTAINERS
+
+#undef WX_DEFINE_LIST
+#define WX_DEFINE_LIST(name) \
+ void _WX_LIST_HELPER_##name::DeleteFunction( _WX_LIST_ITEM_TYPE_##name X )\
+ { \
+ delete X; \
+ } \
+ _WX_LIST_HELPER_##name::BaseListType _WX_LIST_HELPER_##name::EmptyList;
+
+#else // !wxUSE_STD_CONTAINERS
+ #undef WX_DEFINE_LIST_2
+ #define WX_DEFINE_LIST_2(T, name) \
+ void wx##name##Node::DeleteData() \
+ { \
+ delete (T *)GetData(); \
+ }
+
+ // redefine the macro so that now it will generate the class implementation
+ // old value would provoke a compile-time error if this file is not included
+ #undef WX_DEFINE_LIST
+ #define WX_DEFINE_LIST(name) WX_DEFINE_LIST_2(_WX_LIST_ITEM_TYPE_##name, name)
+
+#endif // wxUSE_STD_CONTAINERS/!wxUSE_STD_CONTAINERS
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/log.h
+// Purpose: Assorted wxLogXXX functions, and wxLog (sink for logs)
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 29/01/98
+// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_LOG_H_
+#define _WX_LOG_H_
+
+#include "wx/defs.h"
+#include "wx/cpp.h"
+
+// ----------------------------------------------------------------------------
+// types
+// ----------------------------------------------------------------------------
+
+// NB: this is needed even if wxUSE_LOG == 0
+typedef unsigned long wxLogLevel;
+
+// the trace masks have been superseded by symbolic trace constants, they're
+// for compatibility only and will be removed soon - do NOT use them
+#if WXWIN_COMPATIBILITY_2_8
+ #define wxTraceMemAlloc 0x0001 // trace memory allocation (new/delete)
+ #define wxTraceMessages 0x0002 // trace window messages/X callbacks
+ #define wxTraceResAlloc 0x0004 // trace GDI resource allocation
+ #define wxTraceRefCount 0x0008 // trace various ref counting operations
+
+ #ifdef __WINDOWS__
+ #define wxTraceOleCalls 0x0100 // OLE interface calls
+ #endif
+
+ typedef unsigned long wxTraceMask;
+#endif // WXWIN_COMPATIBILITY_2_8
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/string.h"
+#include "wx/strvararg.h"
+
+// ----------------------------------------------------------------------------
+// forward declarations
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_BASE wxObject;
+
+#if wxUSE_GUI
+ class WXDLLIMPEXP_FWD_CORE wxFrame;
+#endif // wxUSE_GUI
+
+#if wxUSE_LOG
+
+#include "wx/arrstr.h"
+
+#ifndef __WXWINCE__
+ #include <time.h> // for time_t
+#endif
+
+#include "wx/dynarray.h"
+#include "wx/hashmap.h"
+
+#if wxUSE_THREADS
+ #include "wx/thread.h"
+#endif // wxUSE_THREADS
+
+// wxUSE_LOG_DEBUG enables the debug log messages
+#ifndef wxUSE_LOG_DEBUG
+ #if wxDEBUG_LEVEL
+ #define wxUSE_LOG_DEBUG 1
+ #else // !wxDEBUG_LEVEL
+ #define wxUSE_LOG_DEBUG 0
+ #endif
+#endif
+
+// wxUSE_LOG_TRACE enables the trace messages, they are disabled by default
+#ifndef wxUSE_LOG_TRACE
+ #if wxDEBUG_LEVEL
+ #define wxUSE_LOG_TRACE 1
+ #else // !wxDEBUG_LEVEL
+ #define wxUSE_LOG_TRACE 0
+ #endif
+#endif // wxUSE_LOG_TRACE
+
+// wxLOG_COMPONENT identifies the component which generated the log record and
+// can be #define'd to a user-defined value when compiling the user code to use
+// component-based filtering (see wxLog::SetComponentLevel())
+#ifndef wxLOG_COMPONENT
+ // this is a variable and not a macro in order to allow the user code to
+ // just #define wxLOG_COMPONENT without #undef'ining it first
+ extern WXDLLIMPEXP_DATA_BASE(const char *) wxLOG_COMPONENT;
+
+ #ifdef WXBUILDING
+ #define wxLOG_COMPONENT "wx"
+ #endif
+#endif
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// different standard log levels (you may also define your own)
+enum wxLogLevelValues
+{
+ wxLOG_FatalError, // program can't continue, abort immediately
+ wxLOG_Error, // a serious error, user must be informed about it
+ wxLOG_Warning, // user is normally informed about it but may be ignored
+ wxLOG_Message, // normal message (i.e. normal output of a non GUI app)
+ wxLOG_Status, // informational: might go to the status line of GUI app
+ wxLOG_Info, // informational message (a.k.a. 'Verbose')
+ wxLOG_Debug, // never shown to the user, disabled in release mode
+ wxLOG_Trace, // trace messages are also only enabled in debug mode
+ wxLOG_Progress, // used for progress indicator (not yet)
+ wxLOG_User = 100, // user defined levels start here
+ wxLOG_Max = 10000
+};
+
+// symbolic trace masks - wxLogTrace("foo", "some trace message...") will be
+// discarded unless the string "foo" has been added to the list of allowed
+// ones with AddTraceMask()
+
+#define wxTRACE_MemAlloc wxT("memalloc") // trace memory allocation (new/delete)
+#define wxTRACE_Messages wxT("messages") // trace window messages/X callbacks
+#define wxTRACE_ResAlloc wxT("resalloc") // trace GDI resource allocation
+#define wxTRACE_RefCount wxT("refcount") // trace various ref counting operations
+
+#ifdef __WINDOWS__
+ #define wxTRACE_OleCalls wxT("ole") // OLE interface calls
+#endif
+
+#include "wx/iosfwrap.h"
+
+// ----------------------------------------------------------------------------
+// information about a log record, i.e. unit of log output
+// ----------------------------------------------------------------------------
+
+class wxLogRecordInfo
+{
+public:
+ // default ctor creates an uninitialized object
+ wxLogRecordInfo()
+ {
+ memset(this, 0, sizeof(*this));
+ }
+
+ // normal ctor, used by wxLogger specifies the location of the log
+ // statement; its time stamp and thread id are set up here
+ wxLogRecordInfo(const char *filename_,
+ int line_,
+ const char *func_,
+ const char *component_)
+ {
+ filename = filename_;
+ func = func_;
+ line = line_;
+ component = component_;
+
+ timestamp = time(NULL);
+
+#if wxUSE_THREADS
+ threadId = wxThread::GetCurrentId();
+#endif // wxUSE_THREADS
+
+ m_data = NULL;
+ }
+
+ // we need to define copy ctor and assignment operator because of m_data
+ wxLogRecordInfo(const wxLogRecordInfo& other)
+ {
+ Copy(other);
+ }
+
+ wxLogRecordInfo& operator=(const wxLogRecordInfo& other)
+ {
+ if ( &other != this )
+ {
+ delete m_data;
+ Copy(other);
+ }
+
+ return *this;
+ }
+
+ // dtor is non-virtual, this class is not meant to be derived from
+ ~wxLogRecordInfo()
+ {
+ delete m_data;
+ }
+
+
+ // the file name and line number of the file where the log record was
+ // generated, if available or NULL and 0 otherwise
+ const char *filename;
+ int line;
+
+ // the name of the function where the log record was generated (may be NULL
+ // if the compiler doesn't support __FUNCTION__)
+ const char *func;
+
+ // the name of the component which generated this message, may be NULL if
+ // not set (i.e. wxLOG_COMPONENT not defined)
+ const char *component;
+
+ // time of record generation
+ time_t timestamp;
+
+#if wxUSE_THREADS
+ // id of the thread which logged this record
+ wxThreadIdType threadId;
+#endif // wxUSE_THREADS
+
+
+ // store an arbitrary value in this record context
+ //
+ // wxWidgets always uses keys starting with "wx.", e.g. "wx.sys_error"
+ void StoreValue(const wxString& key, wxUIntPtr val)
+ {
+ if ( !m_data )
+ m_data = new ExtraData;
+
+ m_data->numValues[key] = val;
+ }
+
+ void StoreValue(const wxString& key, const wxString& val)
+ {
+ if ( !m_data )
+ m_data = new ExtraData;
+
+ m_data->strValues[key] = val;
+ }
+
+
+ // these functions retrieve the value of either numeric or string key,
+ // return false if not found
+ bool GetNumValue(const wxString& key, wxUIntPtr *val) const
+ {
+ if ( !m_data )
+ return false;
+
+ wxStringToNumHashMap::const_iterator it = m_data->numValues.find(key);
+ if ( it == m_data->numValues.end() )
+ return false;
+
+ *val = it->second;
+
+ return true;
+ }
+
+ bool GetStrValue(const wxString& key, wxString *val) const
+ {
+ if ( !m_data )
+ return false;
+
+ wxStringToStringHashMap::const_iterator it = m_data->strValues.find(key);
+ if ( it == m_data->strValues.end() )
+ return false;
+
+ *val = it->second;
+
+ return true;
+ }
+
+private:
+ void Copy(const wxLogRecordInfo& other)
+ {
+ memcpy(this, &other, sizeof(*this));
+ if ( other.m_data )
+ m_data = new ExtraData(*other.m_data);
+ }
+
+ // extra data associated with the log record: this is completely optional
+ // and can be used to pass information from the log function to the log
+ // sink (e.g. wxLogSysError() uses this to pass the error code)
+ struct ExtraData
+ {
+ wxStringToNumHashMap numValues;
+ wxStringToStringHashMap strValues;
+ };
+
+ // NULL if not used
+ ExtraData *m_data;
+};
+
+#define wxLOG_KEY_TRACE_MASK "wx.trace_mask"
+
+// ----------------------------------------------------------------------------
+// log record: a unit of log output
+// ----------------------------------------------------------------------------
+
+struct wxLogRecord
+{
+ wxLogRecord(wxLogLevel level_,
+ const wxString& msg_,
+ const wxLogRecordInfo& info_)
+ : level(level_),
+ msg(msg_),
+ info(info_)
+ {
+ }
+
+ wxLogLevel level;
+ wxString msg;
+ wxLogRecordInfo info;
+};
+
+// ----------------------------------------------------------------------------
+// Derive from this class to customize format of log messages.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxLogFormatter
+{
+public:
+ // Default constructor.
+ wxLogFormatter() { }
+
+ // Trivial but virtual destructor for the base class.
+ virtual ~wxLogFormatter() { }
+
+
+ // Override this method to implement custom formatting of the given log
+ // record. The default implementation simply prepends a level-dependent
+ // prefix to the message and optionally adds a time stamp.
+ virtual wxString Format(wxLogLevel level,
+ const wxString& msg,
+ const wxLogRecordInfo& info) const;
+
+protected:
+ // Override this method to change just the time stamp formatting. It is
+ // called by default Format() implementation.
+ virtual wxString FormatTime(time_t t) const;
+};
+
+
+// ----------------------------------------------------------------------------
+// derive from this class to redirect (or suppress, or ...) log messages
+// normally, only a single instance of this class exists but it's not enforced
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxLog
+{
+public:
+ // ctor
+ wxLog() : m_formatter(new wxLogFormatter) { }
+
+ // make dtor virtual for all derived classes
+ virtual ~wxLog();
+
+
+ // log messages selection
+ // ----------------------
+
+ // these functions allow to completely disable all log messages or disable
+ // log messages at level less important than specified for the current
+ // thread
+
+ // is logging enabled at all now?
+ static bool IsEnabled()
+ {
+#if wxUSE_THREADS
+ if ( !wxThread::IsMain() )
+ return IsThreadLoggingEnabled();
+#endif // wxUSE_THREADS
+
+ return ms_doLog;
+ }
+
+ // change the flag state, return the previous one
+ static bool EnableLogging(bool enable = true)
+ {
+#if wxUSE_THREADS
+ if ( !wxThread::IsMain() )
+ return EnableThreadLogging(enable);
+#endif // wxUSE_THREADS
+
+ bool doLogOld = ms_doLog;
+ ms_doLog = enable;
+ return doLogOld;
+ }
+
+ // return the current global log level
+ static wxLogLevel GetLogLevel() { return ms_logLevel; }
+
+ // set global log level: messages with level > logLevel will not be logged
+ static void SetLogLevel(wxLogLevel logLevel) { ms_logLevel = logLevel; }
+
+ // set the log level for the given component
+ static void SetComponentLevel(const wxString& component, wxLogLevel level);
+
+ // return the effective log level for this component, falling back to
+ // parent component and to the default global log level if necessary
+ //
+ // NB: component argument is passed by value and not const reference in an
+ // attempt to encourage compiler to avoid an extra copy: as we modify
+ // the component internally, we'd create one anyhow and like this it
+ // can be avoided if the string is a temporary anyhow
+ static wxLogLevel GetComponentLevel(wxString component);
+
+
+ // is logging of messages from this component enabled at this level?
+ //
+ // usually always called with wxLOG_COMPONENT as second argument
+ static bool IsLevelEnabled(wxLogLevel level, wxString component)
+ {
+ return IsEnabled() && level <= GetComponentLevel(component);
+ }
+
+
+ // enable/disable messages at wxLOG_Verbose level (only relevant if the
+ // current log level is greater or equal to it)
+ //
+ // notice that verbose mode can be activated by the standard command-line
+ // '--verbose' option
+ static void SetVerbose(bool bVerbose = true) { ms_bVerbose = bVerbose; }
+
+ // check if verbose messages are enabled
+ static bool GetVerbose() { return ms_bVerbose; }
+
+
+ // message buffering
+ // -----------------
+
+ // flush shows all messages if they're not logged immediately (FILE
+ // and iostream logs don't need it, but wxLogGui does to avoid showing
+ // 17 modal dialogs one after another)
+ virtual void Flush();
+
+ // flush the active target if any and also output any pending messages from
+ // background threads
+ static void FlushActive();
+
+ // only one sink is active at each moment get current log target, will call
+ // wxAppTraits::CreateLogTarget() to create one if none exists
+ static wxLog *GetActiveTarget();
+
+ // change log target, logger may be NULL
+ static wxLog *SetActiveTarget(wxLog *logger);
+
+#if wxUSE_THREADS
+ // change log target for the current thread only, shouldn't be called from
+ // the main thread as it doesn't use thread-specific log target
+ static wxLog *SetThreadActiveTarget(wxLog *logger);
+#endif // wxUSE_THREADS
+
+ // suspend the message flushing of the main target until the next call
+ // to Resume() - this is mainly for internal use (to prevent wxYield()
+ // from flashing the messages)
+ static void Suspend() { ms_suspendCount++; }
+
+ // must be called for each Suspend()!
+ static void Resume() { ms_suspendCount--; }
+
+ // should GetActiveTarget() try to create a new log object if the
+ // current is NULL?
+ static void DontCreateOnDemand();
+
+ // Make GetActiveTarget() create a new log object again.
+ static void DoCreateOnDemand();
+
+ // log the count of repeating messages instead of logging the messages
+ // multiple times
+ static void SetRepetitionCounting(bool bRepetCounting = true)
+ { ms_bRepetCounting = bRepetCounting; }
+
+ // gets duplicate counting status
+ static bool GetRepetitionCounting() { return ms_bRepetCounting; }
+
+ // add string trace mask
+ static void AddTraceMask(const wxString& str);
+
+ // add string trace mask
+ static void RemoveTraceMask(const wxString& str);
+
+ // remove all string trace masks
+ static void ClearTraceMasks();
+
+ // get string trace masks: note that this is MT-unsafe if other threads can
+ // call AddTraceMask() concurrently
+ static const wxArrayString& GetTraceMasks();
+
+ // is this trace mask in the list?
+ static bool IsAllowedTraceMask(const wxString& mask);
+
+
+ // log formatting
+ // -----------------
+
+ // Change wxLogFormatter object used by wxLog to format the log messages.
+ //
+ // wxLog takes ownership of the pointer passed in but the caller is
+ // responsible for deleting the returned pointer.
+ wxLogFormatter* SetFormatter(wxLogFormatter* formatter);
+
+
+ // All the time stamp related functions below only work when the default
+ // wxLogFormatter is being used. Defining a custom formatter overrides them
+ // as it could use its own time stamp format or format messages without
+ // using time stamp at all.
+
+
+ // sets the time stamp string format: this is used as strftime() format
+ // string for the log targets which add time stamps to the messages; set
+ // it to empty string to disable time stamping completely.
+ static void SetTimestamp(const wxString& ts) { ms_timestamp = ts; }
+
+ // disable time stamping of log messages
+ static void DisableTimestamp() { SetTimestamp(wxEmptyString); }
+
+
+ // get the current timestamp format string (maybe empty)
+ static const wxString& GetTimestamp() { return ms_timestamp; }
+
+
+
+ // helpers: all functions in this section are mostly for internal use only,
+ // don't call them from your code even if they are not formally deprecated
+
+ // put the time stamp into the string if ms_timestamp is not empty (don't
+ // change it otherwise); the first overload uses the current time.
+ static void TimeStamp(wxString *str);
+ static void TimeStamp(wxString *str, time_t t);
+
+ // these methods should only be called from derived classes DoLogRecord(),
+ // DoLogTextAtLevel() and DoLogText() implementations respectively and
+ // shouldn't be called directly, use logging functions instead
+ void LogRecord(wxLogLevel level,
+ const wxString& msg,
+ const wxLogRecordInfo& info)
+ {
+ DoLogRecord(level, msg, info);
+ }
+
+ void LogTextAtLevel(wxLogLevel level, const wxString& msg)
+ {
+ DoLogTextAtLevel(level, msg);
+ }
+
+ void LogText(const wxString& msg)
+ {
+ DoLogText(msg);
+ }
+
+ // this is a helper used by wxLogXXX() functions, don't call it directly
+ // and see DoLog() for function to overload in the derived classes
+ static void OnLog(wxLogLevel level,
+ const wxString& msg,
+ const wxLogRecordInfo& info);
+
+ // version called when no information about the location of the log record
+ // generation is available (but the time stamp is), it mainly exists for
+ // backwards compatibility, don't use it in new code
+ static void OnLog(wxLogLevel level, const wxString& msg, time_t t);
+
+ // a helper calling the above overload with current time
+ static void OnLog(wxLogLevel level, const wxString& msg)
+ {
+ OnLog(level, msg, time(NULL));
+ }
+
+
+ // this method exists for backwards compatibility only, don't use
+ bool HasPendingMessages() const { return true; }
+
+#if WXWIN_COMPATIBILITY_2_6
+ // this function doesn't do anything any more, don't call it
+ static wxDEPRECATED_INLINE(
+ wxChar *SetLogBuffer(wxChar *, size_t = 0), return NULL;
+ );
+#endif // WXWIN_COMPATIBILITY_2_6
+
+ // don't use integer masks any more, use string trace masks instead
+#if WXWIN_COMPATIBILITY_2_8
+ static wxDEPRECATED_INLINE( void SetTraceMask(wxTraceMask ulMask),
+ ms_ulTraceMask = ulMask; )
+
+ // this one can't be marked deprecated as it's used in our own wxLogger
+ // below but it still is deprecated and shouldn't be used
+ static wxTraceMask GetTraceMask() { return ms_ulTraceMask; }
+#endif // WXWIN_COMPATIBILITY_2_8
+
+protected:
+ // the logging functions that can be overridden: DoLogRecord() is called
+ // for every "record", i.e. a unit of log output, to be logged and by
+ // default formats the message and passes it to DoLogTextAtLevel() which in
+ // turn passes it to DoLogText() by default
+
+ // override this method if you want to change message formatting or do
+ // dynamic filtering
+ virtual void DoLogRecord(wxLogLevel level,
+ const wxString& msg,
+ const wxLogRecordInfo& info);
+
+ // override this method to redirect output to different channels depending
+ // on its level only; if even the level doesn't matter, override
+ // DoLogText() instead
+ virtual void DoLogTextAtLevel(wxLogLevel level, const wxString& msg);
+
+ // this function is not pure virtual as it might not be needed if you do
+ // the logging in overridden DoLogRecord() or DoLogTextAtLevel() directly
+ // but if you do not override them in your derived class you must override
+ // this one as the default implementation of it simply asserts
+ virtual void DoLogText(const wxString& msg);
+
+
+ // the rest of the functions are for backwards compatibility only, don't
+ // use them in new code; if you're updating your existing code you need to
+ // switch to overriding DoLogRecord/Text() above (although as long as these
+ // functions exist, log classes using them will continue to work)
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED_BUT_USED_INTERNALLY(
+ virtual void DoLog(wxLogLevel level, const char *szString, time_t t)
+ );
+
+ wxDEPRECATED_BUT_USED_INTERNALLY(
+ virtual void DoLog(wxLogLevel level, const wchar_t *wzString, time_t t)
+ );
+
+ // these shouldn't be used by new code
+ wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(
+ virtual void DoLogString(const char *WXUNUSED(szString),
+ time_t WXUNUSED(t)),
+ wxEMPTY_PARAMETER_VALUE
+ )
+
+ wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(
+ virtual void DoLogString(const wchar_t *WXUNUSED(wzString),
+ time_t WXUNUSED(t)),
+ wxEMPTY_PARAMETER_VALUE
+ )
+#endif // WXWIN_COMPATIBILITY_2_8
+
+
+ // log a message indicating the number of times the previous message was
+ // repeated if previous repetition counter is strictly positive, does
+ // nothing otherwise; return the old value of repetition counter
+ unsigned LogLastRepeatIfNeeded();
+
+private:
+#if wxUSE_THREADS
+ // called from FlushActive() to really log any buffered messages logged
+ // from the other threads
+ void FlushThreadMessages();
+
+ // these functions are called for non-main thread only by IsEnabled() and
+ // EnableLogging() respectively
+ static bool IsThreadLoggingEnabled();
+ static bool EnableThreadLogging(bool enable = true);
+#endif // wxUSE_THREADS
+
+ // get the active log target for the main thread, auto-creating it if
+ // necessary
+ //
+ // this is called from GetActiveTarget() and OnLog() when they're called
+ // from the main thread
+ static wxLog *GetMainThreadActiveTarget();
+
+ // called from OnLog() if it's called from the main thread or if we have a
+ // (presumably MT-safe) thread-specific logger and by FlushThreadMessages()
+ // when it plays back the buffered messages logged from the other threads
+ void CallDoLogNow(wxLogLevel level,
+ const wxString& msg,
+ const wxLogRecordInfo& info);
+
+
+ // variables
+ // ----------------
+
+ wxLogFormatter *m_formatter; // We own this pointer.
+
+
+ // static variables
+ // ----------------
+
+ // if true, don't log the same message multiple times, only log it once
+ // with the number of times it was repeated
+ static bool ms_bRepetCounting;
+
+ static wxLog *ms_pLogger; // currently active log sink
+ static bool ms_doLog; // false => all logging disabled
+ static bool ms_bAutoCreate; // create new log targets on demand?
+ static bool ms_bVerbose; // false => ignore LogInfo messages
+
+ static wxLogLevel ms_logLevel; // limit logging to levels <= ms_logLevel
+
+ static size_t ms_suspendCount; // if positive, logs are not flushed
+
+ // format string for strftime(), if empty, time stamping log messages is
+ // disabled
+ static wxString ms_timestamp;
+
+#if WXWIN_COMPATIBILITY_2_8
+ static wxTraceMask ms_ulTraceMask; // controls wxLogTrace behaviour
+#endif // WXWIN_COMPATIBILITY_2_8
+};
+
+// ----------------------------------------------------------------------------
+// "trivial" derivations of wxLog
+// ----------------------------------------------------------------------------
+
+// log everything except for the debug/trace messages (which are passed to
+// wxMessageOutputDebug) to a buffer
+class WXDLLIMPEXP_BASE wxLogBuffer : public wxLog
+{
+public:
+ wxLogBuffer() { }
+
+ // get the string contents with all messages logged
+ const wxString& GetBuffer() const { return m_str; }
+
+ // show the buffer contents to the user in the best possible way (this uses
+ // wxMessageOutputMessageBox) and clear it
+ virtual void Flush();
+
+protected:
+ virtual void DoLogTextAtLevel(wxLogLevel level, const wxString& msg);
+
+private:
+ wxString m_str;
+
+ wxDECLARE_NO_COPY_CLASS(wxLogBuffer);
+};
+
+
+// log everything to a "FILE *", stderr by default
+class WXDLLIMPEXP_BASE wxLogStderr : public wxLog
+{
+public:
+ // redirect log output to a FILE
+ wxLogStderr(FILE *fp = NULL);
+
+protected:
+ // implement sink function
+ virtual void DoLogText(const wxString& msg);
+
+ FILE *m_fp;
+
+ wxDECLARE_NO_COPY_CLASS(wxLogStderr);
+};
+
+#if wxUSE_STD_IOSTREAM
+
+// log everything to an "ostream", cerr by default
+class WXDLLIMPEXP_BASE wxLogStream : public wxLog
+{
+public:
+ // redirect log output to an ostream
+ wxLogStream(wxSTD ostream *ostr = (wxSTD ostream *) NULL);
+
+protected:
+ // implement sink function
+ virtual void DoLogText(const wxString& msg);
+
+ // using ptr here to avoid including <iostream.h> from this file
+ wxSTD ostream *m_ostr;
+};
+
+#endif // wxUSE_STD_IOSTREAM
+
+// ----------------------------------------------------------------------------
+// /dev/null log target: suppress logging until this object goes out of scope
+// ----------------------------------------------------------------------------
+
+// example of usage:
+/*
+ void Foo()
+ {
+ wxFile file;
+
+ // wxFile.Open() normally complains if file can't be opened, we don't
+ // want it
+ wxLogNull logNo;
+
+ if ( !file.Open("bar") )
+ ... process error ourselves ...
+
+ // ~wxLogNull called, old log sink restored
+ }
+ */
+class WXDLLIMPEXP_BASE wxLogNull
+{
+public:
+ wxLogNull() : m_flagOld(wxLog::EnableLogging(false)) { }
+ ~wxLogNull() { (void)wxLog::EnableLogging(m_flagOld); }
+
+private:
+ bool m_flagOld; // the previous value of the wxLog::ms_doLog
+};
+
+// ----------------------------------------------------------------------------
+// chaining log target: installs itself as a log target and passes all
+// messages to the real log target given to it in the ctor but also forwards
+// them to the previously active one
+//
+// note that you don't have to call SetActiveTarget() with this class, it
+// does it itself in its ctor
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxLogChain : public wxLog
+{
+public:
+ wxLogChain(wxLog *logger);
+ virtual ~wxLogChain();
+
+ // change the new log target
+ void SetLog(wxLog *logger);
+
+ // this can be used to temporarily disable (and then reenable) passing
+ // messages to the old logger (by default we do pass them)
+ void PassMessages(bool bDoPass) { m_bPassMessages = bDoPass; }
+
+ // are we passing the messages to the previous log target?
+ bool IsPassingMessages() const { return m_bPassMessages; }
+
+ // return the previous log target (may be NULL)
+ wxLog *GetOldLog() const { return m_logOld; }
+
+ // override base class version to flush the old logger as well
+ virtual void Flush();
+
+ // call to avoid destroying the old log target
+ void DetachOldLog() { m_logOld = NULL; }
+
+protected:
+ // pass the record to the old logger if needed
+ virtual void DoLogRecord(wxLogLevel level,
+ const wxString& msg,
+ const wxLogRecordInfo& info);
+
+private:
+ // the current log target
+ wxLog *m_logNew;
+
+ // the previous log target
+ wxLog *m_logOld;
+
+ // do we pass the messages to the old logger?
+ bool m_bPassMessages;
+
+ wxDECLARE_NO_COPY_CLASS(wxLogChain);
+};
+
+// a chain log target which uses itself as the new logger
+
+#define wxLogPassThrough wxLogInterposer
+
+class WXDLLIMPEXP_BASE wxLogInterposer : public wxLogChain
+{
+public:
+ wxLogInterposer();
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxLogInterposer);
+};
+
+// a temporary interposer which doesn't destroy the old log target
+// (calls DetachOldLog)
+
+class WXDLLIMPEXP_BASE wxLogInterposerTemp : public wxLogChain
+{
+public:
+ wxLogInterposerTemp();
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxLogInterposerTemp);
+};
+
+#if wxUSE_GUI
+ // include GUI log targets:
+ #include "wx/generic/logg.h"
+#endif // wxUSE_GUI
+
+// ----------------------------------------------------------------------------
+// wxLogger
+// ----------------------------------------------------------------------------
+
+// wxLogger is a helper class used by wxLogXXX() functions implementation,
+// don't use it directly as it's experimental and subject to change (OTOH it
+// might become public in the future if it's deemed to be useful enough)
+
+// contains information about the context from which a log message originates
+// and provides Log() vararg method which forwards to wxLog::OnLog() and passes
+// this context to it
+class wxLogger
+{
+public:
+ // ctor takes the basic information about the log record
+ wxLogger(wxLogLevel level,
+ const char *filename,
+ int line,
+ const char *func,
+ const char *component)
+ : m_level(level),
+ m_info(filename, line, func, component)
+ {
+ }
+
+ // store extra data in our log record and return this object itself (so
+ // that further calls to its functions could be chained)
+ template <typename T>
+ wxLogger& Store(const wxString& key, T val)
+ {
+ m_info.StoreValue(key, val);
+ return *this;
+ }
+
+ // hack for "overloaded" wxLogXXX() functions: calling this method
+ // indicates that we may have an extra first argument preceding the format
+ // string and that if we do have it, we should store it in m_info using the
+ // given key (while by default 0 value will be used)
+ wxLogger& MaybeStore(const wxString& key, wxUIntPtr value = 0)
+ {
+ wxASSERT_MSG( m_optKey.empty(), "can only have one optional value" );
+ m_optKey = key;
+
+ m_info.StoreValue(key, value);
+ return *this;
+ }
+
+
+ // non-vararg function used by wxVLogXXX():
+
+ // log the message at the level specified in the ctor if this log message
+ // is enabled
+ void LogV(const wxString& format, va_list argptr)
+ {
+ // remember that fatal errors can't be disabled
+ if ( m_level == wxLOG_FatalError ||
+ wxLog::IsLevelEnabled(m_level, m_info.component) )
+ DoCallOnLog(format, argptr);
+ }
+
+ // overloads used by functions with optional leading arguments (whose
+ // values are stored in the key passed to MaybeStore())
+ void LogV(long num, const wxString& format, va_list argptr)
+ {
+ Store(m_optKey, num);
+
+ LogV(format, argptr);
+ }
+
+ void LogV(void *ptr, const wxString& format, va_list argptr)
+ {
+ Store(m_optKey, wxPtrToUInt(ptr));
+
+ LogV(format, argptr);
+ }
+
+ void LogVTrace(const wxString& mask, const wxString& format, va_list argptr)
+ {
+ if ( !wxLog::IsAllowedTraceMask(mask) )
+ return;
+
+ Store(wxLOG_KEY_TRACE_MASK, mask);
+
+ LogV(format, argptr);
+ }
+
+
+ // vararg functions used by wxLogXXX():
+
+ // will log the message at the level specified in the ctor
+ //
+ // notice that this function supposes that the caller already checked that
+ // the level was enabled and does no checks itself
+ WX_DEFINE_VARARG_FUNC_VOID
+ (
+ Log,
+ 1, (const wxFormatString&),
+ DoLog, DoLogUtf8
+ )
+
+ // same as Log() but with an extra numeric or pointer parameters: this is
+ // used to pass an optional value by storing it in m_info under the name
+ // passed to MaybeStore() and is required to support "overloaded" versions
+ // of wxLogStatus() and wxLogSysError()
+ WX_DEFINE_VARARG_FUNC_VOID
+ (
+ Log,
+ 2, (long, const wxFormatString&),
+ DoLogWithNum, DoLogWithNumUtf8
+ )
+
+ // unfortunately we can't use "void *" here as we get overload ambiguities
+ // with Log(wxFormatString, ...) when the first argument is a "char *" or
+ // "wchar_t *" then -- so we only allow passing wxObject here, which is
+ // ugly but fine in practice as this overload is only used by wxLogStatus()
+ // whose first argument is a wxFrame
+ WX_DEFINE_VARARG_FUNC_VOID
+ (
+ Log,
+ 2, (wxObject *, const wxFormatString&),
+ DoLogWithPtr, DoLogWithPtrUtf8
+ )
+
+ // log the message at the level specified as its first argument
+ //
+ // as the macros don't have access to the level argument in this case, this
+ // function does check that the level is enabled itself
+ WX_DEFINE_VARARG_FUNC_VOID
+ (
+ LogAtLevel,
+ 2, (wxLogLevel, const wxFormatString&),
+ DoLogAtLevel, DoLogAtLevelUtf8
+ )
+
+ // special versions for wxLogTrace() which is passed either string or
+ // integer mask as first argument determining whether the message should be
+ // logged or not
+ WX_DEFINE_VARARG_FUNC_VOID
+ (
+ LogTrace,
+ 2, (const wxString&, const wxFormatString&),
+ DoLogTrace, DoLogTraceUtf8
+ )
+
+#if WXWIN_COMPATIBILITY_2_8
+ WX_DEFINE_VARARG_FUNC_VOID
+ (
+ LogTrace,
+ 2, (wxTraceMask, const wxFormatString&),
+ DoLogTraceMask, DoLogTraceMaskUtf8
+ )
+#endif // WXWIN_COMPATIBILITY_2_8
+
+#ifdef __WATCOMC__
+ // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 1, (const wxString&),
+ (wxFormatString(f1)))
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 1, (const wxCStrData&),
+ (wxFormatString(f1)))
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 1, (const char*),
+ (wxFormatString(f1)))
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 1, (const wchar_t*),
+ (wxFormatString(f1)))
+
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 2, (long, const wxString&),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 2, (long, const wxCStrData&),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 2, (long, const char *),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 2, (long, const wchar_t *),
+ (f1, wxFormatString(f2)))
+
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 2, (wxObject *, const wxString&),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 2, (wxObject *, const wxCStrData&),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 2, (wxObject *, const char *),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 2, (wxObject *, const wchar_t *),
+ (f1, wxFormatString(f2)))
+
+ WX_VARARG_WATCOM_WORKAROUND(void, LogAtLevel,
+ 2, (wxLogLevel, const wxString&),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, LogAtLevel,
+ 2, (wxLogLevel, const wxCStrData&),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, LogAtLevel,
+ 2, (wxLogLevel, const char *),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, LogAtLevel,
+ 2, (wxLogLevel, const wchar_t *),
+ (f1, wxFormatString(f2)))
+
+ WX_VARARG_WATCOM_WORKAROUND(void, LogTrace,
+ 2, (const wxString&, const wxString&),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, LogTrace,
+ 2, (const wxString&, const wxCStrData&),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, LogTrace,
+ 2, (const wxString&, const char *),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, LogTrace,
+ 2, (const wxString&, const wchar_t *),
+ (f1, wxFormatString(f2)))
+
+#if WXWIN_COMPATIBILITY_2_8
+ WX_VARARG_WATCOM_WORKAROUND(void, LogTrace,
+ 2, (wxTraceMask, wxTraceMask),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, LogTrace,
+ 2, (wxTraceMask, const wxCStrData&),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, LogTrace,
+ 2, (wxTraceMask, const char *),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, LogTrace,
+ 2, (wxTraceMask, const wchar_t *),
+ (f1, wxFormatString(f2)))
+#endif // WXWIN_COMPATIBILITY_2_8
+#endif // __WATCOMC__
+
+private:
+#if !wxUSE_UTF8_LOCALE_ONLY
+ void DoLog(const wxChar *format, ...)
+ {
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(format, argptr);
+ va_end(argptr);
+ }
+
+ void DoLogWithNum(long num, const wxChar *format, ...)
+ {
+ Store(m_optKey, num);
+
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(format, argptr);
+ va_end(argptr);
+ }
+
+ void DoLogWithPtr(void *ptr, const wxChar *format, ...)
+ {
+ Store(m_optKey, wxPtrToUInt(ptr));
+
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(format, argptr);
+ va_end(argptr);
+ }
+
+ void DoLogAtLevel(wxLogLevel level, const wxChar *format, ...)
+ {
+ if ( !wxLog::IsLevelEnabled(level, m_info.component) )
+ return;
+
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(level, format, argptr);
+ va_end(argptr);
+ }
+
+ void DoLogTrace(const wxString& mask, const wxChar *format, ...)
+ {
+ if ( !wxLog::IsAllowedTraceMask(mask) )
+ return;
+
+ Store(wxLOG_KEY_TRACE_MASK, mask);
+
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(format, argptr);
+ va_end(argptr);
+ }
+
+#if WXWIN_COMPATIBILITY_2_8
+ void DoLogTraceMask(wxTraceMask mask, const wxChar *format, ...)
+ {
+ if ( (wxLog::GetTraceMask() & mask) != mask )
+ return;
+
+ Store(wxLOG_KEY_TRACE_MASK, mask);
+
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(format, argptr);
+ va_end(argptr);
+ }
+#endif // WXWIN_COMPATIBILITY_2_8
+#endif // !wxUSE_UTF8_LOCALE_ONLY
+
+#if wxUSE_UNICODE_UTF8
+ void DoLogUtf8(const char *format, ...)
+ {
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(format, argptr);
+ va_end(argptr);
+ }
+
+ void DoLogWithNumUtf8(long num, const char *format, ...)
+ {
+ Store(m_optKey, num);
+
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(format, argptr);
+ va_end(argptr);
+ }
+
+ void DoLogWithPtrUtf8(void *ptr, const char *format, ...)
+ {
+ Store(m_optKey, wxPtrToUInt(ptr));
+
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(format, argptr);
+ va_end(argptr);
+ }
+
+ void DoLogAtLevelUtf8(wxLogLevel level, const char *format, ...)
+ {
+ if ( !wxLog::IsLevelEnabled(level, m_info.component) )
+ return;
+
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(level, format, argptr);
+ va_end(argptr);
+ }
+
+ void DoLogTraceUtf8(const wxString& mask, const char *format, ...)
+ {
+ if ( !wxLog::IsAllowedTraceMask(mask) )
+ return;
+
+ Store(wxLOG_KEY_TRACE_MASK, mask);
+
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(format, argptr);
+ va_end(argptr);
+ }
+
+#if WXWIN_COMPATIBILITY_2_8
+ void DoLogTraceMaskUtf8(wxTraceMask mask, const char *format, ...)
+ {
+ if ( (wxLog::GetTraceMask() & mask) != mask )
+ return;
+
+ Store(wxLOG_KEY_TRACE_MASK, mask);
+
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(format, argptr);
+ va_end(argptr);
+ }
+#endif // WXWIN_COMPATIBILITY_2_8
+#endif // wxUSE_UNICODE_UTF8
+
+ void DoCallOnLog(wxLogLevel level, const wxString& format, va_list argptr)
+ {
+ wxLog::OnLog(level, wxString::FormatV(format, argptr), m_info);
+ }
+
+ void DoCallOnLog(const wxString& format, va_list argptr)
+ {
+ DoCallOnLog(m_level, format, argptr);
+ }
+
+
+ const wxLogLevel m_level;
+ wxLogRecordInfo m_info;
+
+ wxString m_optKey;
+
+ wxDECLARE_NO_COPY_CLASS(wxLogger);
+};
+
+// ============================================================================
+// global functions
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// get error code/error message from system in a portable way
+// ----------------------------------------------------------------------------
+
+// return the last system error code
+WXDLLIMPEXP_BASE unsigned long wxSysErrorCode();
+
+// return the error message for given (or last if 0) error code
+WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0);
+
+// ----------------------------------------------------------------------------
+// define wxLog<level>() functions which can be used by application instead of
+// stdio, iostream &c for log messages for easy redirection
+// ----------------------------------------------------------------------------
+
+/*
+ The code below is unreadable because it (unfortunately unavoidably)
+ contains a lot of macro magic but all it does is to define wxLogXXX() such
+ that you can call them as vararg functions to log a message at the
+ corresponding level.
+
+ More precisely, it defines:
+
+ - wxLog{FatalError,Error,Warning,Message,Verbose,Debug}() functions
+ taking the format string and additional vararg arguments if needed.
+ - wxLogGeneric(wxLogLevel level, const wxString& format, ...) which
+ takes the log level explicitly.
+ - wxLogSysError(const wxString& format, ...) and wxLogSysError(long
+ err, const wxString& format, ...) which log a wxLOG_Error severity
+ message with the error message corresponding to the system error code
+ err or the last error.
+ - wxLogStatus(const wxString& format, ...) which logs the message into
+ the status bar of the main application window and its overload
+ wxLogStatus(wxFrame *frame, const wxString& format, ...) which logs it
+ into the status bar of the specified frame.
+ - wxLogTrace(Mask mask, const wxString& format, ...) which only logs
+ the message is the specified mask is enabled. This comes in two kinds:
+ Mask can be a wxString or a long. Both are deprecated.
+
+ In addition, wxVLogXXX() versions of all the functions above are also
+ defined. They take a va_list argument instead of "...".
+ */
+
+// creates wxLogger object for the current location
+#define wxMAKE_LOGGER(level) \
+ wxLogger(wxLOG_##level, __FILE__, __LINE__, __WXFUNCTION__, wxLOG_COMPONENT)
+
+// this macro generates the expression which logs whatever follows it in
+// parentheses at the level specified as argument
+#define wxDO_LOG(level) wxMAKE_LOGGER(level).Log
+
+// this is the non-vararg equivalent
+#define wxDO_LOGV(level, format, argptr) \
+ wxMAKE_LOGGER(level).LogV(format, argptr)
+
+// this macro declares wxLog<level>() macro which logs whatever follows it if
+// logging at specified level is enabled (notice that if it is false, the
+// following arguments are not even evaluated which is good as it avoids
+// unnecessary overhead)
+//
+// Note: the strange (because executing at most once) for() loop because we
+// must arrange for wxDO_LOG() to be at the end of the macro and using a
+// more natural "if (IsLevelEnabled()) wxDO_LOG()" would result in wrong
+// behaviour for the following code ("else" would bind to the wrong "if"):
+//
+// if ( cond )
+// wxLogError("!!!");
+// else
+// ...
+//
+// See also #11829 for the problems with other simpler approaches,
+// notably the need for two macros due to buggy __LINE__ in MSVC.
+//
+// Note 2: Unfortunately we can't use the same solution for all compilers
+// because the loop-based one results in problems with MSVC6 due to its
+// wrong (pre-C++98) rules for the scope of the variables declared
+// inside the loop, as this prevents us from using wxLogXXX() in switch
+// statement clauses ("initialization of loopvar skipped by case"). So
+// for now, i.e. while we still support VC6, use the previous solution
+// for it (FIXME-VC6).
+#ifdef __VISUALC6__
+#define wxDO_LOG_IF_ENABLED(level) \
+ if ( !wxLog::IsLevelEnabled(wxLOG_##level, wxLOG_COMPONENT) ) \
+ {} \
+ else \
+ wxDO_LOG(level)
+#else
+#define wxDO_LOG_IF_ENABLED_HELPER(level, loopvar) \
+ for ( bool loopvar = false; \
+ !loopvar && wxLog::IsLevelEnabled(wxLOG_##level, wxLOG_COMPONENT); \
+ loopvar = true ) \
+ wxDO_LOG(level)
+
+#define wxDO_LOG_IF_ENABLED(level) \
+ wxDO_LOG_IF_ENABLED_HELPER(level, wxMAKE_UNIQUE_NAME(wxlogcheck))
+#endif
+
+// wxLogFatalError() is special as it can't be disabled
+#define wxLogFatalError wxDO_LOG(FatalError)
+#define wxVLogFatalError(format, argptr) wxDO_LOGV(FatalError, format, argptr)
+
+#define wxLogError wxDO_LOG_IF_ENABLED(Error)
+#define wxVLogError(format, argptr) wxDO_LOGV(Error, format, argptr)
+
+#define wxLogWarning wxDO_LOG_IF_ENABLED(Warning)
+#define wxVLogWarning(format, argptr) wxDO_LOGV(Warning, format, argptr)
+
+#define wxLogMessage wxDO_LOG_IF_ENABLED(Message)
+#define wxVLogMessage(format, argptr) wxDO_LOGV(Message, format, argptr)
+
+// this one is special as it only logs if we're in verbose mode
+#define wxLogVerbose \
+ if ( !(wxLog::IsLevelEnabled(wxLOG_Info, wxLOG_COMPONENT) && \
+ wxLog::GetVerbose()) ) \
+ {} \
+ else \
+ wxDO_LOG(Info)
+#define wxVLogVerbose(format, argptr) \
+ if ( !(wxLog::IsLevelEnabled(wxLOG_Info, wxLOG_COMPONENT) && \
+ wxLog::GetVerbose()) ) \
+ {} \
+ else \
+ wxDO_LOGV(Info, format, argptr)
+
+// deprecated synonyms for wxLogVerbose() and wxVLogVerbose()
+#define wxLogInfo wxLogVerbose
+#define wxVLogInfo wxVLogVerbose
+
+
+// another special case: the level is passed as first argument of the function
+// and so is not available to the macro
+//
+// notice that because of this, arguments of wxLogGeneric() are currently
+// always evaluated, unlike for the other log functions
+#define wxLogGeneric wxMAKE_LOGGER(Max).LogAtLevel
+#define wxVLogGeneric(level, format, argptr) \
+ if ( !wxLog::IsLevelEnabled(wxLOG_##level, wxLOG_COMPONENT) ) \
+ {} \
+ else \
+ wxDO_LOGV(level, format, argptr)
+
+
+// wxLogSysError() needs to stash the error code value in the log record info
+// so it needs special handling too; additional complications arise because the
+// error code may or not be present as the first argument
+//
+// notice that we unfortunately can't avoid the call to wxSysErrorCode() even
+// though it may be unneeded if an explicit error code is passed to us because
+// the message might not be logged immediately (e.g. it could be queued for
+// logging from the main thread later) and so we can't to wait until it is
+// logged to determine whether we have last error or not as it will be too late
+// and it will have changed already by then (in fact it even changes when
+// wxString::Format() is called because of vsnprintf() inside it so it can
+// change even much sooner)
+#define wxLOG_KEY_SYS_ERROR_CODE "wx.sys_error"
+
+#define wxLogSysError \
+ if ( !wxLog::IsLevelEnabled(wxLOG_Error, wxLOG_COMPONENT) ) \
+ {} \
+ else \
+ wxMAKE_LOGGER(Error).MaybeStore(wxLOG_KEY_SYS_ERROR_CODE, \
+ wxSysErrorCode()).Log
+
+// unfortunately we can't have overloaded macros so we can't define versions
+// both with and without error code argument and have to rely on LogV()
+// overloads in wxLogger to select between them
+#define wxVLogSysError \
+ wxMAKE_LOGGER(Error).MaybeStore(wxLOG_KEY_SYS_ERROR_CODE, \
+ wxSysErrorCode()).LogV
+
+#if wxUSE_GUI
+ // wxLogStatus() is similar to wxLogSysError() as it allows to optionally
+ // specify the frame to which the message should go
+ #define wxLOG_KEY_FRAME "wx.frame"
+
+ #define wxLogStatus \
+ if ( !wxLog::IsLevelEnabled(wxLOG_Status, wxLOG_COMPONENT) ) \
+ {} \
+ else \
+ wxMAKE_LOGGER(Status).MaybeStore(wxLOG_KEY_FRAME).Log
+
+ #define wxVLogStatus \
+ wxMAKE_LOGGER(Status).MaybeStore(wxLOG_KEY_FRAME).LogV
+#endif // wxUSE_GUI
+
+
+#else // !wxUSE_LOG
+
+#undef wxUSE_LOG_DEBUG
+#define wxUSE_LOG_DEBUG 0
+
+#undef wxUSE_LOG_TRACE
+#define wxUSE_LOG_TRACE 0
+
+#if defined(__WATCOMC__) || defined(__MINGW32__)
+ // Mingw has similar problem with wxLogSysError:
+ #define WX_WATCOM_OR_MINGW_ONLY_CODE( x ) x
+#else
+ #define WX_WATCOM_OR_MINGW_ONLY_CODE( x )
+#endif
+
+// define macros for defining log functions which do nothing at all
+//
+// WX_WATCOM_ONLY_CODE is needed to work around
+// http://bugzilla.openwatcom.org/show_bug.cgi?id=351
+#define wxDEFINE_EMPTY_LOG_FUNCTION(level) \
+ WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 1, (const wxFormatString&)) \
+ WX_WATCOM_ONLY_CODE( \
+ WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 1, (const char*)) \
+ WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 1, (const wchar_t*)) \
+ WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 1, (const wxCStrData&)) \
+ ) \
+ inline void wxVLog##level(const wxFormatString& WXUNUSED(format), \
+ va_list WXUNUSED(argptr)) { } \
+
+#define wxDEFINE_EMPTY_LOG_FUNCTION2(level, argclass) \
+ WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const wxFormatString&)) \
+ WX_WATCOM_OR_MINGW_ONLY_CODE( \
+ WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const char*)) \
+ WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const wchar_t*)) \
+ WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const wxCStrData&)) \
+ ) \
+ inline void wxVLog##level(argclass WXUNUSED(arg), \
+ const wxFormatString& WXUNUSED(format), \
+ va_list WXUNUSED(argptr)) {}
+
+wxDEFINE_EMPTY_LOG_FUNCTION(FatalError);
+wxDEFINE_EMPTY_LOG_FUNCTION(Error);
+wxDEFINE_EMPTY_LOG_FUNCTION(SysError);
+wxDEFINE_EMPTY_LOG_FUNCTION2(SysError, long);
+wxDEFINE_EMPTY_LOG_FUNCTION(Warning);
+wxDEFINE_EMPTY_LOG_FUNCTION(Message);
+wxDEFINE_EMPTY_LOG_FUNCTION(Info);
+wxDEFINE_EMPTY_LOG_FUNCTION(Verbose);
+
+wxDEFINE_EMPTY_LOG_FUNCTION2(Generic, wxLogLevel);
+
+#if wxUSE_GUI
+ wxDEFINE_EMPTY_LOG_FUNCTION(Status);
+ wxDEFINE_EMPTY_LOG_FUNCTION2(Status, wxFrame *);
+#endif // wxUSE_GUI
+
+// Empty Class to fake wxLogNull
+class WXDLLIMPEXP_BASE wxLogNull
+{
+public:
+ wxLogNull() { }
+};
+
+// Dummy macros to replace some functions.
+#define wxSysErrorCode() (unsigned long)0
+#define wxSysErrorMsg( X ) (const wxChar*)NULL
+
+// Fake symbolic trace masks... for those that are used frequently
+#define wxTRACE_OleCalls wxEmptyString // OLE interface calls
+
+#endif // wxUSE_LOG/!wxUSE_LOG
+
+
+// debug functions can be completely disabled in optimized builds
+
+// if these log functions are disabled, we prefer to define them as (empty)
+// variadic macros as this completely removes them and their argument
+// evaluation from the object code but if this is not supported by compiler we
+// use empty inline functions instead (defining them as nothing would result in
+// compiler warnings)
+//
+// note that making wxVLogDebug/Trace() themselves (empty inline) functions is
+// a bad idea as some compilers are stupid enough to not inline even empty
+// functions if their parameters are complicated enough, but by defining them
+// as an empty inline function we ensure that even dumbest compilers optimise
+// them away
+#ifdef __BORLANDC__
+ // but Borland gives "W8019: Code has no effect" for wxLogNop() so we need
+ // to define it differently for it to avoid these warnings (same problem as
+ // with wxUnusedVar())
+ #define wxLogNop() { }
+#else
+ inline void wxLogNop() { }
+#endif
+
+#if wxUSE_LOG_DEBUG
+ #define wxLogDebug wxDO_LOG_IF_ENABLED(Debug)
+ #define wxVLogDebug(format, argptr) wxDO_LOGV(Debug, format, argptr)
+#else // !wxUSE_LOG_DEBUG
+ #define wxVLogDebug(fmt, valist) wxLogNop()
+
+ #ifdef HAVE_VARIADIC_MACROS
+ #define wxLogDebug(fmt, ...) wxLogNop()
+ #else // !HAVE_VARIADIC_MACROS
+ WX_DEFINE_VARARG_FUNC_NOP(wxLogDebug, 1, (const wxFormatString&))
+ #endif
+#endif // wxUSE_LOG_DEBUG/!wxUSE_LOG_DEBUG
+
+#if wxUSE_LOG_TRACE
+ #define wxLogTrace \
+ if ( !wxLog::IsLevelEnabled(wxLOG_Trace, wxLOG_COMPONENT) ) \
+ {} \
+ else \
+ wxMAKE_LOGGER(Trace).LogTrace
+ #define wxVLogTrace \
+ if ( !wxLog::IsLevelEnabled(wxLOG_Trace, wxLOG_COMPONENT) ) \
+ {} \
+ else \
+ wxMAKE_LOGGER(Trace).LogVTrace
+#else // !wxUSE_LOG_TRACE
+ #define wxVLogTrace(mask, fmt, valist) wxLogNop()
+
+ #ifdef HAVE_VARIADIC_MACROS
+ #define wxLogTrace(mask, fmt, ...) wxLogNop()
+ #else // !HAVE_VARIADIC_MACROS
+ #if WXWIN_COMPATIBILITY_2_8
+ WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (wxTraceMask, const wxFormatString&))
+ #endif
+ WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (const wxString&, const wxFormatString&))
+ #ifdef __WATCOMC__
+ // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
+ WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (const char*, const char*))
+ WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (const wchar_t*, const wchar_t*))
+ #endif
+ #endif // HAVE_VARIADIC_MACROS/!HAVE_VARIADIC_MACROS
+#endif // wxUSE_LOG_TRACE/!wxUSE_LOG_TRACE
+
+// wxLogFatalError helper: show the (fatal) error to the user in a safe way,
+// i.e. without using wxMessageBox() for example because it could crash
+void WXDLLIMPEXP_BASE
+wxSafeShowMessage(const wxString& title, const wxString& text);
+
+// ----------------------------------------------------------------------------
+// debug only logging functions: use them with API name and error code
+// ----------------------------------------------------------------------------
+
+#if wxUSE_LOG_DEBUG
+ // make life easier for people using VC++ IDE: clicking on the message
+ // will take us immediately to the place of the failed API
+#ifdef __VISUALC__
+ #define wxLogApiError(api, rc) \
+ wxLogDebug(wxT("%s(%d): '%s' failed with error 0x%08lx (%s)."), \
+ __FILE__, __LINE__, api, \
+ (long)rc, wxSysErrorMsg(rc))
+#else // !VC++
+ #define wxLogApiError(api, rc) \
+ wxLogDebug(wxT("In file %s at line %d: '%s' failed with ") \
+ wxT("error 0x%08lx (%s)."), \
+ __FILE__, __LINE__, api, \
+ (long)rc, wxSysErrorMsg(rc))
+#endif // VC++/!VC++
+
+ #define wxLogLastError(api) wxLogApiError(api, wxSysErrorCode())
+
+#else // !wxUSE_LOG_DEBUG
+ #define wxLogApiError(api, err) wxLogNop()
+ #define wxLogLastError(api) wxLogNop()
+#endif // wxUSE_LOG_DEBUG/!wxUSE_LOG_DEBUG
+
+// wxCocoa has additiional trace masks
+#if defined(__WXCOCOA__)
+#include "wx/cocoa/log.h"
+#endif
+
+#ifdef WX_WATCOM_ONLY_CODE
+ #undef WX_WATCOM_ONLY_CODE
+#endif
+
+// macro which disables debug logging in release builds: this is done by
+// default by wxIMPLEMENT_APP() so usually it doesn't need to be used explicitly
+#if defined(NDEBUG) && wxUSE_LOG_DEBUG
+ #define wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD() \
+ wxLog::SetLogLevel(wxLOG_Info)
+#else // !NDEBUG
+ #define wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD()
+#endif // NDEBUG/!NDEBUG
+
+#endif // _WX_LOG_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/longlong.h
+// Purpose: declaration of wxLongLong class - best implementation of a 64
+// bit integer for the current platform.
+// Author: Jeffrey C. Ollie <jeff@ollie.clive.ia.us>, Vadim Zeitlin
+// Modified by:
+// Created: 10.02.99
+// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_LONGLONG_H
+#define _WX_LONGLONG_H
+
+#include "wx/defs.h"
+
+#if wxUSE_LONGLONG
+
+#include "wx/string.h"
+
+#include <limits.h> // for LONG_MAX
+
+// define this to compile wxLongLongWx in "test" mode: the results of all
+// calculations will be compared with the real results taken from
+// wxLongLongNative -- this is extremely useful to find the bugs in
+// wxLongLongWx class!
+
+// #define wxLONGLONG_TEST_MODE
+
+#ifdef wxLONGLONG_TEST_MODE
+ #define wxUSE_LONGLONG_WX 1
+ #define wxUSE_LONGLONG_NATIVE 1
+#endif // wxLONGLONG_TEST_MODE
+
+// ----------------------------------------------------------------------------
+// decide upon which class we will use
+// ----------------------------------------------------------------------------
+
+#ifndef wxLongLong_t
+ // both warning and pragma warning are not portable, but at least an
+ // unknown pragma should never be an error -- except that, actually, some
+ // broken compilers don't like it, so we have to disable it in this case
+ // <sigh>
+ #ifdef __GNUC__
+ #warning "Your compiler does not appear to support 64 bit "\
+ "integers, using emulation class instead.\n" \
+ "Please report your compiler version to " \
+ "wx-dev@lists.wxwidgets.org!"
+ #elif !(defined(__WATCOMC__) || defined(__VISAGECPP__))
+ #pragma warning "Your compiler does not appear to support 64 bit "\
+ "integers, using emulation class instead.\n" \
+ "Please report your compiler version to " \
+ "wx-dev@lists.wxwidgets.org!"
+ #endif
+
+ #define wxUSE_LONGLONG_WX 1
+#endif // compiler
+
+// the user may predefine wxUSE_LONGLONG_NATIVE and/or wxUSE_LONGLONG_NATIVE
+// to disable automatic testing (useful for the test program which defines
+// both classes) but by default we only use one class
+#if (defined(wxUSE_LONGLONG_WX) && wxUSE_LONGLONG_WX) || !defined(wxLongLong_t)
+ // don't use both classes unless wxUSE_LONGLONG_NATIVE was explicitly set:
+ // this is useful in test programs and only there
+ #ifndef wxUSE_LONGLONG_NATIVE
+ #define wxUSE_LONGLONG_NATIVE 0
+ #endif
+
+ class WXDLLIMPEXP_FWD_BASE wxLongLongWx;
+ class WXDLLIMPEXP_FWD_BASE wxULongLongWx;
+#if defined(__VISUALC__) && !defined(__WIN32__)
+ #define wxLongLong wxLongLongWx
+ #define wxULongLong wxULongLongWx
+#else
+ typedef wxLongLongWx wxLongLong;
+ typedef wxULongLongWx wxULongLong;
+#endif
+
+#else
+ // if nothing is defined, use native implementation by default, of course
+ #ifndef wxUSE_LONGLONG_NATIVE
+ #define wxUSE_LONGLONG_NATIVE 1
+ #endif
+#endif
+
+#ifndef wxUSE_LONGLONG_WX
+ #define wxUSE_LONGLONG_WX 0
+ class WXDLLIMPEXP_FWD_BASE wxLongLongNative;
+ class WXDLLIMPEXP_FWD_BASE wxULongLongNative;
+ typedef wxLongLongNative wxLongLong;
+ typedef wxULongLongNative wxULongLong;
+#endif
+
+// NB: if both wxUSE_LONGLONG_WX and NATIVE are defined, the user code should
+// typedef wxLongLong as it wants, we don't do it
+
+// ----------------------------------------------------------------------------
+// choose the appropriate class
+// ----------------------------------------------------------------------------
+
+// we use iostream for wxLongLong output
+#include "wx/iosfwrap.h"
+
+#if wxUSE_LONGLONG_NATIVE
+
+class WXDLLIMPEXP_BASE wxLongLongNative
+{
+public:
+ // ctors
+ // default ctor initializes to 0
+ wxLongLongNative() : m_ll(0) { }
+ // from long long
+ wxLongLongNative(wxLongLong_t ll) : m_ll(ll) { }
+ // from 2 longs
+ wxLongLongNative(wxInt32 hi, wxUint32 lo)
+ {
+ // cast to wxLongLong_t first to avoid precision loss!
+ m_ll = ((wxLongLong_t) hi) << 32;
+ m_ll |= (wxLongLong_t) lo;
+ }
+#if wxUSE_LONGLONG_WX
+ wxLongLongNative(wxLongLongWx ll);
+#endif
+
+ // default copy ctor is ok
+
+ // no dtor
+
+ // assignment operators
+ // from native 64 bit integer
+#ifndef wxLongLongIsLong
+ wxLongLongNative& operator=(wxLongLong_t ll)
+ { m_ll = ll; return *this; }
+ wxLongLongNative& operator=(wxULongLong_t ll)
+ { m_ll = ll; return *this; }
+#endif // !wxLongLongNative
+ wxLongLongNative& operator=(const wxULongLongNative &ll);
+ wxLongLongNative& operator=(int l)
+ { m_ll = l; return *this; }
+ wxLongLongNative& operator=(long l)
+ { m_ll = l; return *this; }
+ wxLongLongNative& operator=(unsigned int l)
+ { m_ll = l; return *this; }
+ wxLongLongNative& operator=(unsigned long l)
+ { m_ll = l; return *this; }
+#if wxUSE_LONGLONG_WX
+ wxLongLongNative& operator=(wxLongLongWx ll);
+ wxLongLongNative& operator=(const class wxULongLongWx &ll);
+#endif
+
+
+ // from double: this one has an explicit name because otherwise we
+ // would have ambiguity with "ll = int" and also because we don't want
+ // to have implicit conversions between doubles and wxLongLongs
+ wxLongLongNative& Assign(double d)
+ { m_ll = (wxLongLong_t)d; return *this; }
+
+ // assignment operators from wxLongLongNative is ok
+
+ // accessors
+ // get high part
+ wxInt32 GetHi() const
+ { return wx_truncate_cast(wxInt32, m_ll >> 32); }
+ // get low part
+ wxUint32 GetLo() const
+ { return wx_truncate_cast(wxUint32, m_ll); }
+
+ // get absolute value
+ wxLongLongNative Abs() const { return wxLongLongNative(*this).Abs(); }
+ wxLongLongNative& Abs() { if ( m_ll < 0 ) m_ll = -m_ll; return *this; }
+
+ // convert to native long long
+ wxLongLong_t GetValue() const { return m_ll; }
+
+ // convert to long with range checking in debug mode (only!)
+ long ToLong() const
+ {
+ wxASSERT_MSG( (m_ll >= LONG_MIN) && (m_ll <= LONG_MAX),
+ wxT("wxLongLong to long conversion loss of precision") );
+
+ return wx_truncate_cast(long, m_ll);
+ }
+
+ // convert to double
+ double ToDouble() const { return wx_truncate_cast(double, m_ll); }
+
+ // don't provide implicit conversion to wxLongLong_t or we will have an
+ // ambiguity for all arithmetic operations
+ //operator wxLongLong_t() const { return m_ll; }
+
+ // operations
+ // addition
+ wxLongLongNative operator+(const wxLongLongNative& ll) const
+ { return wxLongLongNative(m_ll + ll.m_ll); }
+ wxLongLongNative& operator+=(const wxLongLongNative& ll)
+ { m_ll += ll.m_ll; return *this; }
+
+ wxLongLongNative operator+(const wxLongLong_t ll) const
+ { return wxLongLongNative(m_ll + ll); }
+ wxLongLongNative& operator+=(const wxLongLong_t ll)
+ { m_ll += ll; return *this; }
+
+ // pre increment
+ wxLongLongNative& operator++()
+ { m_ll++; return *this; }
+
+ // post increment
+ wxLongLongNative operator++(int)
+ { wxLongLongNative value(*this); m_ll++; return value; }
+
+ // negation operator
+ wxLongLongNative operator-() const
+ { return wxLongLongNative(-m_ll); }
+ wxLongLongNative& Negate() { m_ll = -m_ll; return *this; }
+
+ // subtraction
+ wxLongLongNative operator-(const wxLongLongNative& ll) const
+ { return wxLongLongNative(m_ll - ll.m_ll); }
+ wxLongLongNative& operator-=(const wxLongLongNative& ll)
+ { m_ll -= ll.m_ll; return *this; }
+
+ wxLongLongNative operator-(const wxLongLong_t ll) const
+ { return wxLongLongNative(m_ll - ll); }
+ wxLongLongNative& operator-=(const wxLongLong_t ll)
+ { m_ll -= ll; return *this; }
+
+ // pre decrement
+ wxLongLongNative& operator--()
+ { m_ll--; return *this; }
+
+ // post decrement
+ wxLongLongNative operator--(int)
+ { wxLongLongNative value(*this); m_ll--; return value; }
+
+ // shifts
+ // left shift
+ wxLongLongNative operator<<(int shift) const
+ { return wxLongLongNative(m_ll << shift); }
+ wxLongLongNative& operator<<=(int shift)
+ { m_ll <<= shift; return *this; }
+
+ // right shift
+ wxLongLongNative operator>>(int shift) const
+ { return wxLongLongNative(m_ll >> shift); }
+ wxLongLongNative& operator>>=(int shift)
+ { m_ll >>= shift; return *this; }
+
+ // bitwise operators
+ wxLongLongNative operator&(const wxLongLongNative& ll) const
+ { return wxLongLongNative(m_ll & ll.m_ll); }
+ wxLongLongNative& operator&=(const wxLongLongNative& ll)
+ { m_ll &= ll.m_ll; return *this; }
+
+ wxLongLongNative operator|(const wxLongLongNative& ll) const
+ { return wxLongLongNative(m_ll | ll.m_ll); }
+ wxLongLongNative& operator|=(const wxLongLongNative& ll)
+ { m_ll |= ll.m_ll; return *this; }
+
+ wxLongLongNative operator^(const wxLongLongNative& ll) const
+ { return wxLongLongNative(m_ll ^ ll.m_ll); }
+ wxLongLongNative& operator^=(const wxLongLongNative& ll)
+ { m_ll ^= ll.m_ll; return *this; }
+
+ // multiplication/division
+ wxLongLongNative operator*(const wxLongLongNative& ll) const
+ { return wxLongLongNative(m_ll * ll.m_ll); }
+ wxLongLongNative operator*(long l) const
+ { return wxLongLongNative(m_ll * l); }
+ wxLongLongNative& operator*=(const wxLongLongNative& ll)
+ { m_ll *= ll.m_ll; return *this; }
+ wxLongLongNative& operator*=(long l)
+ { m_ll *= l; return *this; }
+
+ wxLongLongNative operator/(const wxLongLongNative& ll) const
+ { return wxLongLongNative(m_ll / ll.m_ll); }
+ wxLongLongNative operator/(long l) const
+ { return wxLongLongNative(m_ll / l); }
+ wxLongLongNative& operator/=(const wxLongLongNative& ll)
+ { m_ll /= ll.m_ll; return *this; }
+ wxLongLongNative& operator/=(long l)
+ { m_ll /= l; return *this; }
+
+ wxLongLongNative operator%(const wxLongLongNative& ll) const
+ { return wxLongLongNative(m_ll % ll.m_ll); }
+ wxLongLongNative operator%(long l) const
+ { return wxLongLongNative(m_ll % l); }
+
+ // comparison
+ bool operator==(const wxLongLongNative& ll) const
+ { return m_ll == ll.m_ll; }
+ bool operator==(long l) const
+ { return m_ll == l; }
+ bool operator!=(const wxLongLongNative& ll) const
+ { return m_ll != ll.m_ll; }
+ bool operator!=(long l) const
+ { return m_ll != l; }
+ bool operator<(const wxLongLongNative& ll) const
+ { return m_ll < ll.m_ll; }
+ bool operator<(long l) const
+ { return m_ll < l; }
+ bool operator>(const wxLongLongNative& ll) const
+ { return m_ll > ll.m_ll; }
+ bool operator>(long l) const
+ { return m_ll > l; }
+ bool operator<=(const wxLongLongNative& ll) const
+ { return m_ll <= ll.m_ll; }
+ bool operator<=(long l) const
+ { return m_ll <= l; }
+ bool operator>=(const wxLongLongNative& ll) const
+ { return m_ll >= ll.m_ll; }
+ bool operator>=(long l) const
+ { return m_ll >= l; }
+
+ // miscellaneous
+
+ // return the string representation of this number
+ wxString ToString() const;
+
+ // conversion to byte array: returns a pointer to static buffer!
+ void *asArray() const;
+
+#if wxUSE_STD_IOSTREAM
+ // input/output
+ friend WXDLLIMPEXP_BASE
+ wxSTD ostream& operator<<(wxSTD ostream&, const wxLongLongNative&);
+#endif
+
+ friend WXDLLIMPEXP_BASE
+ wxString& operator<<(wxString&, const wxLongLongNative&);
+
+#if wxUSE_STREAMS
+ friend WXDLLIMPEXP_BASE
+ class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxLongLongNative&);
+ friend WXDLLIMPEXP_BASE
+ class wxTextInputStream& operator>>(class wxTextInputStream&, wxLongLongNative&);
+#endif
+
+private:
+ wxLongLong_t m_ll;
+};
+
+
+class WXDLLIMPEXP_BASE wxULongLongNative
+{
+public:
+ // ctors
+ // default ctor initializes to 0
+ wxULongLongNative() : m_ll(0) { }
+ // from long long
+ wxULongLongNative(wxULongLong_t ll) : m_ll(ll) { }
+ // from 2 longs
+ wxULongLongNative(wxUint32 hi, wxUint32 lo) : m_ll(0)
+ {
+ // cast to wxLongLong_t first to avoid precision loss!
+ m_ll = ((wxULongLong_t) hi) << 32;
+ m_ll |= (wxULongLong_t) lo;
+ }
+
+#if wxUSE_LONGLONG_WX
+ wxULongLongNative(const class wxULongLongWx &ll);
+#endif
+
+ // default copy ctor is ok
+
+ // no dtor
+
+ // assignment operators
+ // from native 64 bit integer
+#ifndef wxLongLongIsLong
+ wxULongLongNative& operator=(wxULongLong_t ll)
+ { m_ll = ll; return *this; }
+ wxULongLongNative& operator=(wxLongLong_t ll)
+ { m_ll = ll; return *this; }
+#endif // !wxLongLongNative
+ wxULongLongNative& operator=(int l)
+ { m_ll = l; return *this; }
+ wxULongLongNative& operator=(long l)
+ { m_ll = l; return *this; }
+ wxULongLongNative& operator=(unsigned int l)
+ { m_ll = l; return *this; }
+ wxULongLongNative& operator=(unsigned long l)
+ { m_ll = l; return *this; }
+ wxULongLongNative& operator=(const wxLongLongNative &ll)
+ { m_ll = ll.GetValue(); return *this; }
+#if wxUSE_LONGLONG_WX
+ wxULongLongNative& operator=(wxLongLongWx ll);
+ wxULongLongNative& operator=(const class wxULongLongWx &ll);
+#endif
+
+ // assignment operators from wxULongLongNative is ok
+
+ // accessors
+ // get high part
+ wxUint32 GetHi() const
+ { return wx_truncate_cast(wxUint32, m_ll >> 32); }
+ // get low part
+ wxUint32 GetLo() const
+ { return wx_truncate_cast(wxUint32, m_ll); }
+
+ // convert to native ulong long
+ wxULongLong_t GetValue() const { return m_ll; }
+
+ // convert to ulong with range checking in debug mode (only!)
+ unsigned long ToULong() const
+ {
+ wxASSERT_MSG( m_ll <= ULONG_MAX,
+ wxT("wxULongLong to long conversion loss of precision") );
+
+ return wx_truncate_cast(unsigned long, m_ll);
+ }
+
+ // convert to double
+ //
+ // For some completely obscure reasons compiling the cast below with
+ // VC6 in DLL builds only (!) results in "error C2520: conversion from
+ // unsigned __int64 to double not implemented, use signed __int64" so
+ // we must use a different version for that compiler.
+#ifdef __VISUALC6__
+ double ToDouble() const;
+#else
+ double ToDouble() const { return wx_truncate_cast(double, m_ll); }
+#endif
+
+ // operations
+ // addition
+ wxULongLongNative operator+(const wxULongLongNative& ll) const
+ { return wxULongLongNative(m_ll + ll.m_ll); }
+ wxULongLongNative& operator+=(const wxULongLongNative& ll)
+ { m_ll += ll.m_ll; return *this; }
+
+ wxULongLongNative operator+(const wxULongLong_t ll) const
+ { return wxULongLongNative(m_ll + ll); }
+ wxULongLongNative& operator+=(const wxULongLong_t ll)
+ { m_ll += ll; return *this; }
+
+ // pre increment
+ wxULongLongNative& operator++()
+ { m_ll++; return *this; }
+
+ // post increment
+ wxULongLongNative operator++(int)
+ { wxULongLongNative value(*this); m_ll++; return value; }
+
+ // subtraction
+ wxULongLongNative operator-(const wxULongLongNative& ll) const
+ { return wxULongLongNative(m_ll - ll.m_ll); }
+ wxULongLongNative& operator-=(const wxULongLongNative& ll)
+ { m_ll -= ll.m_ll; return *this; }
+
+ wxULongLongNative operator-(const wxULongLong_t ll) const
+ { return wxULongLongNative(m_ll - ll); }
+ wxULongLongNative& operator-=(const wxULongLong_t ll)
+ { m_ll -= ll; return *this; }
+
+ // pre decrement
+ wxULongLongNative& operator--()
+ { m_ll--; return *this; }
+
+ // post decrement
+ wxULongLongNative operator--(int)
+ { wxULongLongNative value(*this); m_ll--; return value; }
+
+ // shifts
+ // left shift
+ wxULongLongNative operator<<(int shift) const
+ { return wxULongLongNative(m_ll << shift); }
+ wxULongLongNative& operator<<=(int shift)
+ { m_ll <<= shift; return *this; }
+
+ // right shift
+ wxULongLongNative operator>>(int shift) const
+ { return wxULongLongNative(m_ll >> shift); }
+ wxULongLongNative& operator>>=(int shift)
+ { m_ll >>= shift; return *this; }
+
+ // bitwise operators
+ wxULongLongNative operator&(const wxULongLongNative& ll) const
+ { return wxULongLongNative(m_ll & ll.m_ll); }
+ wxULongLongNative& operator&=(const wxULongLongNative& ll)
+ { m_ll &= ll.m_ll; return *this; }
+
+ wxULongLongNative operator|(const wxULongLongNative& ll) const
+ { return wxULongLongNative(m_ll | ll.m_ll); }
+ wxULongLongNative& operator|=(const wxULongLongNative& ll)
+ { m_ll |= ll.m_ll; return *this; }
+
+ wxULongLongNative operator^(const wxULongLongNative& ll) const
+ { return wxULongLongNative(m_ll ^ ll.m_ll); }
+ wxULongLongNative& operator^=(const wxULongLongNative& ll)
+ { m_ll ^= ll.m_ll; return *this; }
+
+ // multiplication/division
+ wxULongLongNative operator*(const wxULongLongNative& ll) const
+ { return wxULongLongNative(m_ll * ll.m_ll); }
+ wxULongLongNative operator*(unsigned long l) const
+ { return wxULongLongNative(m_ll * l); }
+ wxULongLongNative& operator*=(const wxULongLongNative& ll)
+ { m_ll *= ll.m_ll; return *this; }
+ wxULongLongNative& operator*=(unsigned long l)
+ { m_ll *= l; return *this; }
+
+ wxULongLongNative operator/(const wxULongLongNative& ll) const
+ { return wxULongLongNative(m_ll / ll.m_ll); }
+ wxULongLongNative operator/(unsigned long l) const
+ { return wxULongLongNative(m_ll / l); }
+ wxULongLongNative& operator/=(const wxULongLongNative& ll)
+ { m_ll /= ll.m_ll; return *this; }
+ wxULongLongNative& operator/=(unsigned long l)
+ { m_ll /= l; return *this; }
+
+ wxULongLongNative operator%(const wxULongLongNative& ll) const
+ { return wxULongLongNative(m_ll % ll.m_ll); }
+ wxULongLongNative operator%(unsigned long l) const
+ { return wxULongLongNative(m_ll % l); }
+
+ // comparison
+ bool operator==(const wxULongLongNative& ll) const
+ { return m_ll == ll.m_ll; }
+ bool operator==(unsigned long l) const
+ { return m_ll == l; }
+ bool operator!=(const wxULongLongNative& ll) const
+ { return m_ll != ll.m_ll; }
+ bool operator!=(unsigned long l) const
+ { return m_ll != l; }
+ bool operator<(const wxULongLongNative& ll) const
+ { return m_ll < ll.m_ll; }
+ bool operator<(unsigned long l) const
+ { return m_ll < l; }
+ bool operator>(const wxULongLongNative& ll) const
+ { return m_ll > ll.m_ll; }
+ bool operator>(unsigned long l) const
+ { return m_ll > l; }
+ bool operator<=(const wxULongLongNative& ll) const
+ { return m_ll <= ll.m_ll; }
+ bool operator<=(unsigned long l) const
+ { return m_ll <= l; }
+ bool operator>=(const wxULongLongNative& ll) const
+ { return m_ll >= ll.m_ll; }
+ bool operator>=(unsigned long l) const
+ { return m_ll >= l; }
+
+ // miscellaneous
+
+ // return the string representation of this number
+ wxString ToString() const;
+
+ // conversion to byte array: returns a pointer to static buffer!
+ void *asArray() const;
+
+#if wxUSE_STD_IOSTREAM
+ // input/output
+ friend WXDLLIMPEXP_BASE
+ wxSTD ostream& operator<<(wxSTD ostream&, const wxULongLongNative&);
+#endif
+
+ friend WXDLLIMPEXP_BASE
+ wxString& operator<<(wxString&, const wxULongLongNative&);
+
+#if wxUSE_STREAMS
+ friend WXDLLIMPEXP_BASE
+ class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxULongLongNative&);
+ friend WXDLLIMPEXP_BASE
+ class wxTextInputStream& operator>>(class wxTextInputStream&, wxULongLongNative&);
+#endif
+
+private:
+ wxULongLong_t m_ll;
+};
+
+inline
+wxLongLongNative& wxLongLongNative::operator=(const wxULongLongNative &ll)
+{
+ m_ll = ll.GetValue();
+ return *this;
+}
+
+#endif // wxUSE_LONGLONG_NATIVE
+
+#if wxUSE_LONGLONG_WX
+
+class WXDLLIMPEXP_BASE wxLongLongWx
+{
+public:
+ // ctors
+ // default ctor initializes to 0
+ wxLongLongWx()
+ {
+ m_lo = m_hi = 0;
+
+#ifdef wxLONGLONG_TEST_MODE
+ m_ll = 0;
+
+ Check();
+#endif // wxLONGLONG_TEST_MODE
+ }
+ // from long
+ wxLongLongWx(long l) { *this = l; }
+ // from 2 longs
+ wxLongLongWx(long hi, unsigned long lo)
+ {
+ m_hi = hi;
+ m_lo = lo;
+
+#ifdef wxLONGLONG_TEST_MODE
+ m_ll = hi;
+ m_ll <<= 32;
+ m_ll |= lo;
+
+ Check();
+#endif // wxLONGLONG_TEST_MODE
+ }
+
+ // default copy ctor is ok in both cases
+
+ // no dtor
+
+ // assignment operators
+ // from long
+ wxLongLongWx& operator=(long l)
+ {
+ m_lo = l;
+ m_hi = (l < 0 ? -1l : 0l);
+
+#ifdef wxLONGLONG_TEST_MODE
+ m_ll = l;
+
+ Check();
+#endif // wxLONGLONG_TEST_MODE
+
+ return *this;
+ }
+ // from int
+ wxLongLongWx& operator=(int l)
+ {
+ return operator=((long)l);
+ }
+
+ wxLongLongWx& operator=(unsigned long l)
+ {
+ m_lo = l;
+ m_hi = 0;
+
+#ifdef wxLONGLONG_TEST_MODE
+ m_ll = l;
+
+ Check();
+#endif // wxLONGLONG_TEST_MODE
+
+ return *this;
+ }
+
+ wxLongLongWx& operator=(unsigned int l)
+ {
+ return operator=((unsigned long)l);
+ }
+
+ wxLongLongWx& operator=(const class wxULongLongWx &ll);
+
+ // from double
+ wxLongLongWx& Assign(double d);
+ // can't have assignment operator from 2 longs
+
+ // accessors
+ // get high part
+ long GetHi() const { return m_hi; }
+ // get low part
+ unsigned long GetLo() const { return m_lo; }
+
+ // get absolute value
+ wxLongLongWx Abs() const { return wxLongLongWx(*this).Abs(); }
+ wxLongLongWx& Abs()
+ {
+ if ( m_hi < 0 )
+ m_hi = -m_hi;
+
+#ifdef wxLONGLONG_TEST_MODE
+ if ( m_ll < 0 )
+ m_ll = -m_ll;
+
+ Check();
+#endif // wxLONGLONG_TEST_MODE
+
+ return *this;
+ }
+
+ // convert to long with range checking in debug mode (only!)
+ long ToLong() const
+ {
+ wxASSERT_MSG( (m_hi == 0l) || (m_hi == -1l),
+ wxT("wxLongLong to long conversion loss of precision") );
+
+ return (long)m_lo;
+ }
+
+ // convert to double
+ double ToDouble() const;
+
+ // operations
+ // addition
+ wxLongLongWx operator+(const wxLongLongWx& ll) const;
+ wxLongLongWx& operator+=(const wxLongLongWx& ll);
+ wxLongLongWx operator+(long l) const;
+ wxLongLongWx& operator+=(long l);
+
+ // pre increment operator
+ wxLongLongWx& operator++();
+
+ // post increment operator
+ wxLongLongWx& operator++(int) { return ++(*this); }
+
+ // negation operator
+ wxLongLongWx operator-() const;
+ wxLongLongWx& Negate();
+
+ // subraction
+ wxLongLongWx operator-(const wxLongLongWx& ll) const;
+ wxLongLongWx& operator-=(const wxLongLongWx& ll);
+
+ // pre decrement operator
+ wxLongLongWx& operator--();
+
+ // post decrement operator
+ wxLongLongWx& operator--(int) { return --(*this); }
+
+ // shifts
+ // left shift
+ wxLongLongWx operator<<(int shift) const;
+ wxLongLongWx& operator<<=(int shift);
+
+ // right shift
+ wxLongLongWx operator>>(int shift) const;
+ wxLongLongWx& operator>>=(int shift);
+
+ // bitwise operators
+ wxLongLongWx operator&(const wxLongLongWx& ll) const;
+ wxLongLongWx& operator&=(const wxLongLongWx& ll);
+ wxLongLongWx operator|(const wxLongLongWx& ll) const;
+ wxLongLongWx& operator|=(const wxLongLongWx& ll);
+ wxLongLongWx operator^(const wxLongLongWx& ll) const;
+ wxLongLongWx& operator^=(const wxLongLongWx& ll);
+ wxLongLongWx operator~() const;
+
+ // comparison
+ bool operator==(const wxLongLongWx& ll) const
+ { return m_lo == ll.m_lo && m_hi == ll.m_hi; }
+#if wxUSE_LONGLONG_NATIVE
+ bool operator==(const wxLongLongNative& ll) const
+ { return m_lo == ll.GetLo() && m_hi == ll.GetHi(); }
+#endif
+ bool operator!=(const wxLongLongWx& ll) const
+ { return !(*this == ll); }
+ bool operator<(const wxLongLongWx& ll) const;
+ bool operator>(const wxLongLongWx& ll) const;
+ bool operator<=(const wxLongLongWx& ll) const
+ { return *this < ll || *this == ll; }
+ bool operator>=(const wxLongLongWx& ll) const
+ { return *this > ll || *this == ll; }
+
+ bool operator<(long l) const { return *this < wxLongLongWx(l); }
+ bool operator>(long l) const { return *this > wxLongLongWx(l); }
+ bool operator==(long l) const
+ {
+ return l >= 0 ? (m_hi == 0 && m_lo == (unsigned long)l)
+ : (m_hi == -1 && m_lo == (unsigned long)l);
+ }
+
+ bool operator<=(long l) const { return *this < l || *this == l; }
+ bool operator>=(long l) const { return *this > l || *this == l; }
+
+ // multiplication
+ wxLongLongWx operator*(const wxLongLongWx& ll) const;
+ wxLongLongWx& operator*=(const wxLongLongWx& ll);
+
+ // division
+ wxLongLongWx operator/(const wxLongLongWx& ll) const;
+ wxLongLongWx& operator/=(const wxLongLongWx& ll);
+
+ wxLongLongWx operator%(const wxLongLongWx& ll) const;
+
+ void Divide(const wxLongLongWx& divisor,
+ wxLongLongWx& quotient,
+ wxLongLongWx& remainder) const;
+
+ // input/output
+
+ // return the string representation of this number
+ wxString ToString() const;
+
+ void *asArray() const;
+
+#if wxUSE_STD_IOSTREAM
+ friend WXDLLIMPEXP_BASE
+ wxSTD ostream& operator<<(wxSTD ostream&, const wxLongLongWx&);
+#endif // wxUSE_STD_IOSTREAM
+
+ friend WXDLLIMPEXP_BASE
+ wxString& operator<<(wxString&, const wxLongLongWx&);
+
+#if wxUSE_STREAMS
+ friend WXDLLIMPEXP_BASE
+ class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxLongLongWx&);
+ friend WXDLLIMPEXP_BASE
+ class wxTextInputStream& operator>>(class wxTextInputStream&, wxLongLongWx&);
+#endif
+
+private:
+ // long is at least 32 bits, so represent our 64bit number as 2 longs
+
+ long m_hi; // signed bit is in the high part
+ unsigned long m_lo;
+
+#ifdef wxLONGLONG_TEST_MODE
+ void Check()
+ {
+ wxASSERT( (m_ll >> 32) == m_hi && (unsigned long)m_ll == m_lo );
+ }
+
+ wxLongLong_t m_ll;
+#endif // wxLONGLONG_TEST_MODE
+};
+
+
+class WXDLLIMPEXP_BASE wxULongLongWx
+{
+public:
+ // ctors
+ // default ctor initializes to 0
+ wxULongLongWx()
+ {
+ m_lo = m_hi = 0;
+
+#ifdef wxLONGLONG_TEST_MODE
+ m_ll = 0;
+
+ Check();
+#endif // wxLONGLONG_TEST_MODE
+ }
+ // from ulong
+ wxULongLongWx(unsigned long l) { *this = l; }
+ // from 2 ulongs
+ wxULongLongWx(unsigned long hi, unsigned long lo)
+ {
+ m_hi = hi;
+ m_lo = lo;
+
+#ifdef wxLONGLONG_TEST_MODE
+ m_ll = hi;
+ m_ll <<= 32;
+ m_ll |= lo;
+
+ Check();
+#endif // wxLONGLONG_TEST_MODE
+ }
+
+ // from signed to unsigned
+ wxULongLongWx(wxLongLongWx ll)
+ {
+ wxASSERT(ll.GetHi() >= 0);
+ m_hi = (unsigned long)ll.GetHi();
+ m_lo = ll.GetLo();
+ }
+
+ // default copy ctor is ok in both cases
+
+ // no dtor
+
+ // assignment operators
+ // from long
+ wxULongLongWx& operator=(unsigned long l)
+ {
+ m_lo = l;
+ m_hi = 0;
+
+#ifdef wxLONGLONG_TEST_MODE
+ m_ll = l;
+
+ Check();
+#endif // wxLONGLONG_TEST_MODE
+
+ return *this;
+ }
+ wxULongLongWx& operator=(long l)
+ {
+ m_lo = l;
+ m_hi = (unsigned long) ((l<0) ? -1l : 0);
+
+#ifdef wxLONGLONG_TEST_MODE
+ m_ll = (wxULongLong_t) (wxLongLong_t) l;
+
+ Check();
+#endif // wxLONGLONG_TEST_MODE
+
+ return *this;
+ }
+ wxULongLongWx& operator=(const class wxLongLongWx &ll) {
+ // Should we use an assert like it was before in the constructor?
+ // wxASSERT(ll.GetHi() >= 0);
+ m_hi = (unsigned long)ll.GetHi();
+ m_lo = ll.GetLo();
+ return *this;
+ }
+
+ // can't have assignment operator from 2 longs
+
+ // accessors
+ // get high part
+ unsigned long GetHi() const { return m_hi; }
+ // get low part
+ unsigned long GetLo() const { return m_lo; }
+
+ // convert to long with range checking in debug mode (only!)
+ unsigned long ToULong() const
+ {
+ wxASSERT_MSG( m_hi == 0ul,
+ wxT("wxULongLong to long conversion loss of precision") );
+
+ return (unsigned long)m_lo;
+ }
+
+ // convert to double
+ double ToDouble() const;
+
+ // operations
+ // addition
+ wxULongLongWx operator+(const wxULongLongWx& ll) const;
+ wxULongLongWx& operator+=(const wxULongLongWx& ll);
+ wxULongLongWx operator+(unsigned long l) const;
+ wxULongLongWx& operator+=(unsigned long l);
+
+ // pre increment operator
+ wxULongLongWx& operator++();
+
+ // post increment operator
+ wxULongLongWx& operator++(int) { return ++(*this); }
+
+ // subtraction
+ wxLongLongWx operator-(const wxULongLongWx& ll) const;
+ wxULongLongWx& operator-=(const wxULongLongWx& ll);
+
+ // pre decrement operator
+ wxULongLongWx& operator--();
+
+ // post decrement operator
+ wxULongLongWx& operator--(int) { return --(*this); }
+
+ // shifts
+ // left shift
+ wxULongLongWx operator<<(int shift) const;
+ wxULongLongWx& operator<<=(int shift);
+
+ // right shift
+ wxULongLongWx operator>>(int shift) const;
+ wxULongLongWx& operator>>=(int shift);
+
+ // bitwise operators
+ wxULongLongWx operator&(const wxULongLongWx& ll) const;
+ wxULongLongWx& operator&=(const wxULongLongWx& ll);
+ wxULongLongWx operator|(const wxULongLongWx& ll) const;
+ wxULongLongWx& operator|=(const wxULongLongWx& ll);
+ wxULongLongWx operator^(const wxULongLongWx& ll) const;
+ wxULongLongWx& operator^=(const wxULongLongWx& ll);
+ wxULongLongWx operator~() const;
+
+ // comparison
+ bool operator==(const wxULongLongWx& ll) const
+ { return m_lo == ll.m_lo && m_hi == ll.m_hi; }
+ bool operator!=(const wxULongLongWx& ll) const
+ { return !(*this == ll); }
+ bool operator<(const wxULongLongWx& ll) const;
+ bool operator>(const wxULongLongWx& ll) const;
+ bool operator<=(const wxULongLongWx& ll) const
+ { return *this < ll || *this == ll; }
+ bool operator>=(const wxULongLongWx& ll) const
+ { return *this > ll || *this == ll; }
+
+ bool operator<(unsigned long l) const { return *this < wxULongLongWx(l); }
+ bool operator>(unsigned long l) const { return *this > wxULongLongWx(l); }
+ bool operator==(unsigned long l) const
+ {
+ return (m_hi == 0 && m_lo == (unsigned long)l);
+ }
+
+ bool operator<=(unsigned long l) const { return *this < l || *this == l; }
+ bool operator>=(unsigned long l) const { return *this > l || *this == l; }
+
+ // multiplication
+ wxULongLongWx operator*(const wxULongLongWx& ll) const;
+ wxULongLongWx& operator*=(const wxULongLongWx& ll);
+
+ // division
+ wxULongLongWx operator/(const wxULongLongWx& ll) const;
+ wxULongLongWx& operator/=(const wxULongLongWx& ll);
+
+ wxULongLongWx operator%(const wxULongLongWx& ll) const;
+
+ void Divide(const wxULongLongWx& divisor,
+ wxULongLongWx& quotient,
+ wxULongLongWx& remainder) const;
+
+ // input/output
+
+ // return the string representation of this number
+ wxString ToString() const;
+
+ void *asArray() const;
+
+#if wxUSE_STD_IOSTREAM
+ friend WXDLLIMPEXP_BASE
+ wxSTD ostream& operator<<(wxSTD ostream&, const wxULongLongWx&);
+#endif // wxUSE_STD_IOSTREAM
+
+ friend WXDLLIMPEXP_BASE
+ wxString& operator<<(wxString&, const wxULongLongWx&);
+
+#if wxUSE_STREAMS
+ friend WXDLLIMPEXP_BASE
+ class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxULongLongWx&);
+ friend WXDLLIMPEXP_BASE
+ class wxTextInputStream& operator>>(class wxTextInputStream&, wxULongLongWx&);
+#endif
+
+private:
+ // long is at least 32 bits, so represent our 64bit number as 2 longs
+
+ unsigned long m_hi;
+ unsigned long m_lo;
+
+#ifdef wxLONGLONG_TEST_MODE
+ void Check()
+ {
+ wxASSERT( (m_ll >> 32) == m_hi && (unsigned long)m_ll == m_lo );
+ }
+
+ wxULongLong_t m_ll;
+#endif // wxLONGLONG_TEST_MODE
+};
+
+#endif // wxUSE_LONGLONG_WX
+
+// ----------------------------------------------------------------------------
+// binary operators
+// ----------------------------------------------------------------------------
+
+inline bool operator<(long l, const wxLongLong& ll) { return ll > l; }
+inline bool operator>(long l, const wxLongLong& ll) { return ll < l; }
+inline bool operator<=(long l, const wxLongLong& ll) { return ll >= l; }
+inline bool operator>=(long l, const wxLongLong& ll) { return ll <= l; }
+inline bool operator==(long l, const wxLongLong& ll) { return ll == l; }
+inline bool operator!=(long l, const wxLongLong& ll) { return ll != l; }
+
+inline wxLongLong operator+(long l, const wxLongLong& ll) { return ll + l; }
+inline wxLongLong operator-(long l, const wxLongLong& ll)
+{
+ return wxLongLong(l) - ll;
+}
+
+inline bool operator<(unsigned long l, const wxULongLong& ull) { return ull > l; }
+inline bool operator>(unsigned long l, const wxULongLong& ull) { return ull < l; }
+inline bool operator<=(unsigned long l, const wxULongLong& ull) { return ull >= l; }
+inline bool operator>=(unsigned long l, const wxULongLong& ull) { return ull <= l; }
+inline bool operator==(unsigned long l, const wxULongLong& ull) { return ull == l; }
+inline bool operator!=(unsigned long l, const wxULongLong& ull) { return ull != l; }
+
+inline wxULongLong operator+(unsigned long l, const wxULongLong& ull) { return ull + l; }
+
+inline wxLongLong operator-(unsigned long l, const wxULongLong& ull)
+{
+ wxULongLong ret = wxULongLong(l) - ull;
+ return wxLongLong((wxInt32)ret.GetHi(),ret.GetLo());
+}
+
+#if wxUSE_LONGLONG_NATIVE && wxUSE_STREAMS
+
+WXDLLIMPEXP_BASE class wxTextOutputStream &operator<<(class wxTextOutputStream &stream, wxULongLong_t value);
+WXDLLIMPEXP_BASE class wxTextOutputStream &operator<<(class wxTextOutputStream &stream, wxLongLong_t value);
+
+WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &stream, wxULongLong_t &value);
+WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &stream, wxLongLong_t &value);
+
+#endif
+
+// ----------------------------------------------------------------------------
+// Specialize numeric_limits<> for our long long wrapper classes.
+// ----------------------------------------------------------------------------
+
+#if wxUSE_LONGLONG_NATIVE
+
+// VC6 is known to not have __int64 specializations of numeric_limits<> in its
+// <limits> anyhow so don't bother including it, especially as it results in
+// tons of warnings because the standard header itself uses obsolete template
+// specialization syntax.
+#ifndef __VISUALC6__
+
+#include <limits>
+
+namespace std
+{
+
+#ifdef __clang__
+ // libstdc++ (used by Clang) uses struct for numeric_limits; unlike gcc, clang
+ // warns about this
+ template<> struct numeric_limits<wxLongLong> : public numeric_limits<wxLongLong_t> {};
+ template<> struct numeric_limits<wxULongLong> : public numeric_limits<wxULongLong_t> {};
+#else
+ template<> class numeric_limits<wxLongLong> : public numeric_limits<wxLongLong_t> {};
+ template<> class numeric_limits<wxULongLong> : public numeric_limits<wxULongLong_t> {};
+#endif
+
+} // namespace std
+
+#endif // !VC6
+
+#endif // wxUSE_LONGLONG_NATIVE
+
+// ----------------------------------------------------------------------------
+// Specialize wxArgNormalizer to allow using wxLongLong directly with wx pseudo
+// vararg functions.
+// ----------------------------------------------------------------------------
+
+// Notice that this must be done here and not in wx/strvararg.h itself because
+// we can't include wx/longlong.h from there as this header itself includes
+// wx/string.h which includes wx/strvararg.h too, so to avoid the circular
+// dependencies we can only do it here (or add another header just for this but
+// it doesn't seem necessary).
+#include "wx/strvararg.h"
+
+template<>
+struct WXDLLIMPEXP_BASE wxArgNormalizer<wxLongLong>
+{
+ wxArgNormalizer(wxLongLong value,
+ const wxFormatString *fmt, unsigned index)
+ : m_value(value)
+ {
+ wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_LongLongInt );
+ }
+
+ wxLongLong_t get() const { return m_value.GetValue(); }
+
+ wxLongLong m_value;
+};
+
+#endif // wxUSE_LONGLONG
+
+#endif // _WX_LONGLONG_H
--- /dev/null
+/**
+* Name: wx/math.h
+* Purpose: Declarations/definitions of common math functions
+* Author: John Labenski and others
+* Modified by:
+* Created: 02/02/03
+* Copyright: (c) John Labenski
+* Licence: wxWindows licence
+*/
+
+/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
+
+#ifndef _WX_MATH_H_
+#define _WX_MATH_H_
+
+#include "wx/defs.h"
+
+#include <math.h>
+
+#ifndef M_PI
+ #define M_PI 3.1415926535897932384626433832795
+#endif
+
+/* Scaling factors for various unit conversions: 1 inch = 2.54 cm */
+#ifndef METRIC_CONVERSION_CONSTANT
+ #define METRIC_CONVERSION_CONSTANT (1/25.4)
+#endif
+
+#ifndef mm2inches
+ #define mm2inches (METRIC_CONVERSION_CONSTANT)
+#endif
+
+#ifndef inches2mm
+ #define inches2mm (1/(mm2inches))
+#endif
+
+#ifndef mm2twips
+ #define mm2twips (METRIC_CONVERSION_CONSTANT*1440)
+#endif
+
+#ifndef twips2mm
+ #define twips2mm (1/(mm2twips))
+#endif
+
+#ifndef mm2pt
+ #define mm2pt (METRIC_CONVERSION_CONSTANT*72)
+#endif
+
+#ifndef pt2mm
+ #define pt2mm (1/(mm2pt))
+#endif
+
+
+#ifdef __cplusplus
+
+/* Any C++11 compiler should provide isfinite() */
+#if __cplusplus >= 201103
+ #include <cmath>
+ #define wxFinite(x) std::isfinite(x)
+#elif defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__)
+ #include <float.h>
+ #define wxFinite(x) _finite(x)
+#elif defined(__MINGW64_TOOLCHAIN__) || defined(__clang__)
+ /*
+ add more compilers with C99 support here: using C99 isfinite() is
+ preferable to using BSD-ish finite()
+ */
+ #if defined(_GLIBCXX_CMATH) || defined(_LIBCPP_CMATH)
+ // these <cmath> headers #undef isfinite
+ #define wxFinite(x) std::isfinite(x)
+ #else
+ #define wxFinite(x) isfinite(x)
+ #endif
+#elif ( defined(__GNUG__)||defined(__GNUWIN32__)||defined(__DJGPP__)|| \
+ defined(__SGI_CC__)||defined(__SUNCC__)||defined(__XLC__)|| \
+ defined(__HPUX__) ) && ( !defined(wxOSX_USE_IPHONE) || wxOSX_USE_IPHONE == 0 )
+#ifdef __SOLARIS__
+#include <ieeefp.h>
+#endif
+ #define wxFinite(x) finite(x)
+#else
+ #define wxFinite(x) ((x) == (x))
+#endif
+
+
+#if defined(__VISUALC__)||defined(__BORLAND__)
+ #define wxIsNaN(x) _isnan(x)
+#elif defined(__GNUG__)||defined(__GNUWIN32__)||defined(__DJGPP__)|| \
+ defined(__SGI_CC__)||defined(__SUNCC__)||defined(__XLC__)|| \
+ defined(__HPUX__)
+ #define wxIsNaN(x) isnan(x)
+#else
+ #define wxIsNaN(x) ((x) != (x))
+#endif
+
+#ifdef __INTELC__
+
+ inline bool wxIsSameDouble(double x, double y)
+ {
+ // VZ: this warning, given for operators==() and !=() is not wrong, as ==
+ // shouldn't be used with doubles, but we get too many of them and
+ // removing these operators is probably not a good idea
+ //
+ // Maybe we should always compare doubles up to some "epsilon" precision
+ #pragma warning(push)
+
+ // floating-point equality and inequality comparisons are unreliable
+ #pragma warning(disable: 1572)
+
+ return x == y;
+
+ #pragma warning(pop)
+ }
+
+#else /* !__INTELC__ */
+ wxGCC_WARNING_SUPPRESS(float-equal)
+ inline bool wxIsSameDouble(double x, double y) { return x == y; }
+ wxGCC_WARNING_RESTORE(float-equal)
+
+#endif /* __INTELC__/!__INTELC__ */
+
+inline bool wxIsNullDouble(double x) { return wxIsSameDouble(x, 0.); }
+
+inline int wxRound(double x)
+{
+ wxASSERT_MSG( x > INT_MIN - 0.5 && x < INT_MAX + 0.5,
+ wxT("argument out of supported range") );
+
+ #if defined(HAVE_ROUND)
+ return int(round(x));
+ #else
+ return (int)(x < 0 ? x - 0.5 : x + 0.5);
+ #endif
+}
+
+#endif /* __cplusplus */
+
+
+#if defined(__WINDOWS__) && !defined(__WXWINCE__)
+ #define wxMulDivInt32( a , b , c ) ::MulDiv( a , b , c )
+#else
+ #define wxMulDivInt32( a , b , c ) (wxRound((a)*(((wxDouble)b)/((wxDouble)c))))
+#endif
+
+#if wxUSE_APPLE_IEEE
+#ifdef __cplusplus
+ extern "C" {
+#endif
+ /* functions from common/extended.c */
+ WXDLLIMPEXP_BASE wxFloat64 wxConvertFromIeeeExtended(const wxInt8 *bytes);
+ WXDLLIMPEXP_BASE void wxConvertToIeeeExtended(wxFloat64 num, wxInt8 *bytes);
+
+ /* use wxConvertFromIeeeExtended() and wxConvertToIeeeExtended() instead */
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED( WXDLLIMPEXP_BASE wxFloat64 ConvertFromIeeeExtended(const wxInt8 *bytes) );
+ wxDEPRECATED( WXDLLIMPEXP_BASE void ConvertToIeeeExtended(wxFloat64 num, wxInt8 *bytes) );
+#endif
+
+#ifdef __cplusplus
+ }
+#endif
+#endif /* wxUSE_APPLE_IEEE */
+
+
+#endif /* _WX_MATH_H_ */
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/matrix.h
+// Purpose: wxTransformMatrix class. NOT YET USED
+// Author: Chris Breeze, Julian Smart
+// Modified by: Klaas Holwerda
+// Created: 01/02/97
+// Copyright: (c) Julian Smart, Chris Breeze
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_MATRIXH__
+#define _WX_MATRIXH__
+
+//! headerfiles="matrix.h wx/object.h"
+#include "wx/object.h"
+#include "wx/math.h"
+
+//! codefiles="matrix.cpp"
+
+// A simple 3x3 matrix. This may be replaced by a more general matrix
+// class some day.
+//
+// Note: this is intended to be used in wxDC at some point to replace
+// the current system of scaling/translation. It is not yet used.
+
+//:definition
+// A 3x3 matrix to do 2D transformations.
+// It can be used to map data to window coordinates,
+// and also for manipulating your own data.
+// For example drawing a picture (composed of several primitives)
+// at a certain coordinate and angle within another parent picture.
+// At all times m_isIdentity is set if the matrix itself is an Identity matrix.
+// It is used where possible to optimize calculations.
+class WXDLLIMPEXP_CORE wxTransformMatrix: public wxObject
+{
+public:
+ wxTransformMatrix(void);
+ wxTransformMatrix(const wxTransformMatrix& mat);
+
+ //get the value in the matrix at col,row
+ //rows are horizontal (second index of m_matrix member)
+ //columns are vertical (first index of m_matrix member)
+ double GetValue(int col, int row) const;
+
+ //set the value in the matrix at col,row
+ //rows are horizontal (second index of m_matrix member)
+ //columns are vertical (first index of m_matrix member)
+ void SetValue(int col, int row, double value);
+
+ void operator = (const wxTransformMatrix& mat);
+ bool operator == (const wxTransformMatrix& mat) const;
+ bool operator != (const wxTransformMatrix& mat) const;
+
+ //multiply every element by t
+ wxTransformMatrix& operator*=(const double& t);
+ //divide every element by t
+ wxTransformMatrix& operator/=(const double& t);
+ //add matrix m to this t
+ wxTransformMatrix& operator+=(const wxTransformMatrix& m);
+ //subtract matrix m from this
+ wxTransformMatrix& operator-=(const wxTransformMatrix& m);
+ //multiply matrix m with this
+ wxTransformMatrix& operator*=(const wxTransformMatrix& m);
+
+ // constant operators
+
+ //multiply every element by t and return result
+ wxTransformMatrix operator*(const double& t) const;
+ //divide this matrix by t and return result
+ wxTransformMatrix operator/(const double& t) const;
+ //add matrix m to this and return result
+ wxTransformMatrix operator+(const wxTransformMatrix& m) const;
+ //subtract matrix m from this and return result
+ wxTransformMatrix operator-(const wxTransformMatrix& m) const;
+ //multiply this by matrix m and return result
+ wxTransformMatrix operator*(const wxTransformMatrix& m) const;
+ wxTransformMatrix operator-() const;
+
+ //rows are horizontal (second index of m_matrix member)
+ //columns are vertical (first index of m_matrix member)
+ double& operator()(int col, int row);
+
+ //rows are horizontal (second index of m_matrix member)
+ //columns are vertical (first index of m_matrix member)
+ double operator()(int col, int row) const;
+
+ // Invert matrix
+ bool Invert(void);
+
+ // Make into identity matrix
+ bool Identity(void);
+
+ // Is the matrix the identity matrix?
+ // Only returns a flag, which is set whenever an operation
+ // is done.
+ inline bool IsIdentity(void) const { return m_isIdentity; }
+
+ // This does an actual check.
+ inline bool IsIdentity1(void) const ;
+
+ //Scale by scale (isotropic scaling i.e. the same in x and y):
+ //!ex:
+ //!code: | scale 0 0 |
+ //!code: matrix' = | 0 scale 0 | x matrix
+ //!code: | 0 0 scale |
+ bool Scale(double scale);
+
+ //Scale with center point and x/y scale
+ //
+ //!ex:
+ //!code: | xs 0 xc(1-xs) |
+ //!code: matrix' = | 0 ys yc(1-ys) | x matrix
+ //!code: | 0 0 1 |
+ wxTransformMatrix& Scale(const double &xs, const double &ys,const double &xc, const double &yc);
+
+ // mirror a matrix in x, y
+ //!ex:
+ //!code: | -1 0 0 |
+ //!code: matrix' = | 0 -1 0 | x matrix
+ //!code: | 0 0 1 |
+ wxTransformMatrix& Mirror(bool x=true, bool y=false);
+ // Translate by dx, dy:
+ //!ex:
+ //!code: | 1 0 dx |
+ //!code: matrix' = | 0 1 dy | x matrix
+ //!code: | 0 0 1 |
+ bool Translate(double x, double y);
+
+ // Rotate clockwise by the given number of degrees:
+ //!ex:
+ //!code: | cos sin 0 |
+ //!code: matrix' = | -sin cos 0 | x matrix
+ //!code: | 0 0 1 |
+ bool Rotate(double angle);
+
+ //Rotate counter clockwise with point of rotation
+ //
+ //!ex:
+ //!code: | cos(r) -sin(r) x(1-cos(r))+y(sin(r)|
+ //!code: matrix' = | sin(r) cos(r) y(1-cos(r))-x(sin(r)| x matrix
+ //!code: | 0 0 1 |
+ wxTransformMatrix& Rotate(const double &r, const double &x, const double &y);
+
+ // Transform X value from logical to device
+ inline double TransformX(double x) const;
+
+ // Transform Y value from logical to device
+ inline double TransformY(double y) const;
+
+ // Transform a point from logical to device coordinates
+ bool TransformPoint(double x, double y, double& tx, double& ty) const;
+
+ // Transform a point from device to logical coordinates.
+ // Example of use:
+ // wxTransformMatrix mat = dc.GetTransformation();
+ // mat.Invert();
+ // mat.InverseTransformPoint(x, y, x1, y1);
+ // OR (shorthand:)
+ // dc.LogicalToDevice(x, y, x1, y1);
+ // The latter is slightly less efficient if we're doing several
+ // conversions, since the matrix is inverted several times.
+ // N.B. 'this' matrix is the inverse at this point
+ bool InverseTransformPoint(double x, double y, double& tx, double& ty) const;
+
+ double Get_scaleX();
+ double Get_scaleY();
+ double GetRotation();
+ void SetRotation(double rotation);
+
+
+public:
+ double m_matrix[3][3];
+ bool m_isIdentity;
+};
+
+
+/*
+Chris Breeze reported, that
+some functions of wxTransformMatrix cannot work because it is not
+known if he matrix has been inverted. Be careful when using it.
+*/
+
+// Transform X value from logical to device
+// warning: this function can only be used for this purpose
+// because no rotation is involved when mapping logical to device coordinates
+// mirror and scaling for x and y will be part of the matrix
+// if you have a matrix that is rotated, eg a shape containing a matrix to place
+// it in the logical coordinate system, use TransformPoint
+inline double wxTransformMatrix::TransformX(double x) const
+{
+ //normally like this, but since no rotation is involved (only mirror and scale)
+ //we can do without Y -> m_matrix[1]{0] is -sin(rotation angle) and therefore zero
+ //(x * m_matrix[0][0] + y * m_matrix[1][0] + m_matrix[2][0]))
+ return (m_isIdentity ? x : (x * m_matrix[0][0] + m_matrix[2][0]));
+}
+
+// Transform Y value from logical to device
+// warning: this function can only be used for this purpose
+// because no rotation is involved when mapping logical to device coordinates
+// mirror and scaling for x and y will be part of the matrix
+// if you have a matrix that is rotated, eg a shape containing a matrix to place
+// it in the logical coordinate system, use TransformPoint
+inline double wxTransformMatrix::TransformY(double y) const
+{
+ //normally like this, but since no rotation is involved (only mirror and scale)
+ //we can do without X -> m_matrix[0]{1] is sin(rotation angle) and therefore zero
+ //(x * m_matrix[0][1] + y * m_matrix[1][1] + m_matrix[2][1]))
+ return (m_isIdentity ? y : (y * m_matrix[1][1] + m_matrix[2][1]));
+}
+
+
+// Is the matrix the identity matrix?
+// Each operation checks whether the result is still the identity matrix and sets a flag.
+inline bool wxTransformMatrix::IsIdentity1(void) const
+{
+ return
+ ( wxIsSameDouble(m_matrix[0][0], 1.0) &&
+ wxIsSameDouble(m_matrix[1][1], 1.0) &&
+ wxIsSameDouble(m_matrix[2][2], 1.0) &&
+ wxIsSameDouble(m_matrix[1][0], 0.0) &&
+ wxIsSameDouble(m_matrix[2][0], 0.0) &&
+ wxIsSameDouble(m_matrix[0][1], 0.0) &&
+ wxIsSameDouble(m_matrix[2][1], 0.0) &&
+ wxIsSameDouble(m_matrix[0][2], 0.0) &&
+ wxIsSameDouble(m_matrix[1][2], 0.0) );
+}
+
+// Calculates the determinant of a 2 x 2 matrix
+inline double wxCalculateDet(double a11, double a21, double a12, double a22)
+{
+ return a11 * a22 - a12 * a21;
+}
+
+#endif // _WX_MATRIXH__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/mdi.h
+// Purpose: wxMDI base header
+// Author: Julian Smart (original)
+// Vadim Zeitlin (base MDI classes refactoring)
+// Copyright: (c) 1998 Julian Smart
+// (c) 2008 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_MDI_H_BASE_
+#define _WX_MDI_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_MDI
+
+#include "wx/frame.h"
+#include "wx/menu.h"
+
+// forward declarations
+class WXDLLIMPEXP_FWD_CORE wxMDIParentFrame;
+class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
+class WXDLLIMPEXP_FWD_CORE wxMDIClientWindowBase;
+class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
+
+// ----------------------------------------------------------------------------
+// wxMDIParentFrameBase: base class for parent frame for MDI children
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxMDIParentFrameBase : public wxFrame
+{
+public:
+ wxMDIParentFrameBase()
+ {
+ m_clientWindow = NULL;
+ m_currentChild = NULL;
+#if wxUSE_MENUS
+ m_windowMenu = NULL;
+#endif // wxUSE_MENUS
+ }
+
+ /*
+ Derived classes should provide ctor and Create() with the following
+ declaration:
+
+ bool Create(wxWindow *parent,
+ wxWindowID winid,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
+ const wxString& name = wxFrameNameStr);
+ */
+
+#if wxUSE_MENUS
+ virtual ~wxMDIParentFrameBase()
+ {
+ delete m_windowMenu;
+ }
+#endif // wxUSE_MENUS
+
+ // accessors
+ // ---------
+
+ // Get or change the active MDI child window
+ virtual wxMDIChildFrame *GetActiveChild() const
+ { return m_currentChild; }
+ virtual void SetActiveChild(wxMDIChildFrame *child)
+ { m_currentChild = child; }
+
+
+ // Get the client window
+ wxMDIClientWindowBase *GetClientWindow() const { return m_clientWindow; }
+
+
+ // MDI windows menu functions
+ // --------------------------
+
+#if wxUSE_MENUS
+ // return the pointer to the current window menu or NULL if we don't have
+ // because of wxFRAME_NO_WINDOW_MENU style
+ wxMenu* GetWindowMenu() const { return m_windowMenu; }
+
+ // use the given menu instead of the default window menu
+ //
+ // menu can be NULL to disable the window menu completely
+ virtual void SetWindowMenu(wxMenu *menu)
+ {
+ if ( menu != m_windowMenu )
+ {
+ delete m_windowMenu;
+ m_windowMenu = menu;
+ }
+ }
+#endif // wxUSE_MENUS
+
+
+ // standard MDI window management functions
+ // ----------------------------------------
+
+ virtual void Cascade() { }
+ virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL) { }
+ virtual void ArrangeIcons() { }
+ virtual void ActivateNext() = 0;
+ virtual void ActivatePrevious() = 0;
+
+ /*
+ Derived classes must provide the following function:
+
+ static bool IsTDI();
+ */
+
+ // Create the client window class (don't Create() the window here, just
+ // return a new object of a wxMDIClientWindow-derived class)
+ //
+ // Notice that if you override this method you should use the default
+ // constructor and Create() and not the constructor creating the window
+ // when creating the frame or your overridden version is not going to be
+ // called (as the call to a virtual function from ctor will be dispatched
+ // to this class version)
+ virtual wxMDIClientWindow *OnCreateClient();
+
+protected:
+ // Override to pass menu/toolbar events to the active child first.
+ virtual bool TryBefore(wxEvent& event);
+
+
+ // This is wxMDIClientWindow for all the native implementations but not for
+ // the generic MDI version which has its own wxGenericMDIClientWindow and
+ // so we store it as just a base class pointer because we don't need its
+ // exact type anyhow
+ wxMDIClientWindowBase *m_clientWindow;
+ wxMDIChildFrame *m_currentChild;
+
+#if wxUSE_MENUS
+ // the current window menu or NULL if we are not using it
+ wxMenu *m_windowMenu;
+#endif // wxUSE_MENUS
+};
+
+// ----------------------------------------------------------------------------
+// wxMDIChildFrameBase: child frame managed by wxMDIParentFrame
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxMDIChildFrameBase : public wxFrame
+{
+public:
+ wxMDIChildFrameBase() { m_mdiParent = NULL; }
+
+ /*
+ Derived classes should provide Create() with the following signature:
+
+ bool Create(wxMDIParentFrame *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr);
+
+ And setting m_mdiParent to parent parameter.
+ */
+
+ // MDI children specific methods
+ virtual void Activate() = 0;
+
+ // Return the MDI parent frame: notice that it may not be the same as
+ // GetParent() (our parent may be the client window or even its subwindow
+ // in some implementations)
+ wxMDIParentFrame *GetMDIParent() const { return m_mdiParent; }
+
+ // Synonym for GetMDIParent(), was used in some other ports
+ wxMDIParentFrame *GetMDIParentFrame() const { return GetMDIParent(); }
+
+
+ // in most ports MDI children frames are not really top-level, the only
+ // exception are the Mac ports in which MDI children are just normal top
+ // level windows too
+ virtual bool IsTopLevel() const { return false; }
+
+ // In all ports keyboard navigation must stop at MDI child frame level and
+ // can't cross its boundary. Indicate this by overriding this function to
+ // return true.
+ virtual bool IsTopNavigationDomain() const { return true; }
+
+ // Raising any frame is supposed to show it but wxFrame Raise()
+ // implementation doesn't work for MDI child frames in most forms so
+ // forward this to Activate() which serves the same purpose by default.
+ virtual void Raise() { Activate(); }
+
+protected:
+ wxMDIParentFrame *m_mdiParent;
+};
+
+// ----------------------------------------------------------------------------
+// wxTDIChildFrame: child frame used by TDI implementations
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxTDIChildFrame : public wxMDIChildFrameBase
+{
+public:
+ // override wxFrame methods for this non top-level window
+
+#if wxUSE_STATUSBAR
+ // no status bars
+ //
+ // TODO: MDI children should have their own status bars, why not?
+ virtual wxStatusBar* CreateStatusBar(int WXUNUSED(number) = 1,
+ long WXUNUSED(style) = 1,
+ wxWindowID WXUNUSED(id) = 1,
+ const wxString& WXUNUSED(name)
+ = wxEmptyString)
+ { return NULL; }
+
+ virtual wxStatusBar *GetStatusBar() const
+ { return NULL; }
+ virtual void SetStatusText(const wxString &WXUNUSED(text),
+ int WXUNUSED(number)=0)
+ { }
+ virtual void SetStatusWidths(int WXUNUSED(n),
+ const int WXUNUSED(widths)[])
+ { }
+#endif // wxUSE_STATUSBAR
+
+#if wxUSE_TOOLBAR
+ // no toolbar
+ //
+ // TODO: again, it should be possible to have tool bars
+ virtual wxToolBar *CreateToolBar(long WXUNUSED(style),
+ wxWindowID WXUNUSED(id),
+ const wxString& WXUNUSED(name))
+ { return NULL; }
+ virtual wxToolBar *GetToolBar() const { return NULL; }
+#endif // wxUSE_TOOLBAR
+
+ // no icon
+ virtual void SetIcons(const wxIconBundle& WXUNUSED(icons)) { }
+
+ // title is used as the tab label
+ virtual wxString GetTitle() const { return m_title; }
+ virtual void SetTitle(const wxString& title) = 0;
+
+ // no maximize etc
+ virtual void Maximize(bool WXUNUSED(maximize) = true) { }
+ virtual bool IsMaximized() const { return true; }
+ virtual bool IsAlwaysMaximized() const { return true; }
+ virtual void Iconize(bool WXUNUSED(iconize) = true) { }
+ virtual bool IsIconized() const { return false; }
+ virtual void Restore() { }
+
+ virtual bool ShowFullScreen(bool WXUNUSED(show),
+ long WXUNUSED(style)) { return false; }
+ virtual bool IsFullScreen() const { return false; }
+
+
+ // we need to override these functions to ensure that a child window is
+ // created even though we derive from wxFrame -- basically we make it
+ // behave as just a wxWindow by short-circuiting wxTLW changes to the base
+ // class behaviour
+
+ virtual void AddChild(wxWindowBase *child) { wxWindow::AddChild(child); }
+
+ virtual bool Destroy() { return wxWindow::Destroy(); }
+
+ // extra platform-specific hacks
+#ifdef __WXMSW__
+ virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const
+ {
+ return wxWindow::MSWGetStyle(flags, exstyle);
+ }
+
+ virtual WXHWND MSWGetParent() const
+ {
+ return wxWindow::MSWGetParent();
+ }
+
+ WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
+ {
+ return wxWindow::MSWWindowProc(message, wParam, lParam);
+ }
+#endif // __WXMSW__
+
+protected:
+ virtual void DoGetSize(int *width, int *height) const
+ {
+ wxWindow::DoGetSize(width, height);
+ }
+
+ virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags)
+ {
+ wxWindow::DoSetSize(x, y, width, height, sizeFlags);
+ }
+
+ virtual void DoGetClientSize(int *width, int *height) const
+ {
+ wxWindow::DoGetClientSize(width, height);
+ }
+
+ virtual void DoSetClientSize(int width, int height)
+ {
+ wxWindow::DoSetClientSize(width, height);
+ }
+
+ // no size hints
+ virtual void DoSetSizeHints(int WXUNUSED(minW), int WXUNUSED(minH),
+ int WXUNUSED(maxW), int WXUNUSED(maxH),
+ int WXUNUSED(incW), int WXUNUSED(incH)) { }
+
+ wxString m_title;
+};
+
+// ----------------------------------------------------------------------------
+// wxMDIClientWindowBase: child of parent frame, parent of children frames
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxMDIClientWindowBase : public wxWindow
+{
+public:
+ /*
+ The derived class must provide the default ctor only (CreateClient()
+ will be called later).
+ */
+
+ // Can be overridden in the derived classes but the base class version must
+ // be usually called first to really create the client window.
+ virtual bool CreateClient(wxMDIParentFrame *parent,
+ long style = wxVSCROLL | wxHSCROLL) = 0;
+};
+
+// ----------------------------------------------------------------------------
+// Include the port-specific implementation of the base classes defined above
+// ----------------------------------------------------------------------------
+
+// wxUSE_GENERIC_MDI_AS_NATIVE may be predefined to force the generic MDI
+// implementation use even on the platforms which usually don't use it
+//
+// notice that generic MDI can still be used without this, but you would need
+// to explicitly use wxGenericMDIXXX classes in your code (and currently also
+// add src/generic/mdig.cpp to your build as it's not compiled in if generic
+// MDI is not used by default -- but this may change later...)
+#ifndef wxUSE_GENERIC_MDI_AS_NATIVE
+ // wxUniv always uses the generic MDI implementation and so do the ports
+ // without native version (although wxCocoa seems to have one -- but it's
+ // probably not functional?)
+ #if defined(__WXCOCOA__) || \
+ defined(__WXMOTIF__) || \
+ defined(__WXPM__) || \
+ defined(__WXUNIVERSAL__)
+ #define wxUSE_GENERIC_MDI_AS_NATIVE 1
+ #else
+ #define wxUSE_GENERIC_MDI_AS_NATIVE 0
+ #endif
+#endif // wxUSE_GENERIC_MDI_AS_NATIVE
+
+#if wxUSE_GENERIC_MDI_AS_NATIVE
+ #include "wx/generic/mdig.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/mdi.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/mdi.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/mdi.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/mdi.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/mdi.h"
+#endif
+
+inline wxMDIClientWindow *wxMDIParentFrameBase::OnCreateClient()
+{
+ return new wxMDIClientWindow;
+}
+
+inline bool wxMDIParentFrameBase::TryBefore(wxEvent& event)
+{
+ // Menu (and toolbar) events should be sent to the active child frame
+ // first, if any.
+ if ( event.GetEventType() == wxEVT_MENU ||
+ event.GetEventType() == wxEVT_UPDATE_UI )
+ {
+ wxMDIChildFrame * const child = GetActiveChild();
+ if ( child )
+ {
+ // However avoid sending the event back to the child if it's
+ // currently being propagated to us from it.
+ wxWindow* const
+ from = static_cast<wxWindow*>(event.GetPropagatedFrom());
+ if ( !from || !from->IsDescendant(child) )
+ {
+ if ( child->ProcessWindowEventLocally(event) )
+ return true;
+ }
+ }
+ }
+
+ return wxFrame::TryBefore(event);
+}
+
+#endif // wxUSE_MDI
+
+#endif // _WX_MDI_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/mediactrl.h
+// Purpose: wxMediaCtrl class
+// Author: Ryan Norton <wxprojects@comcast.net>
+// Modified by:
+// Created: 11/07/04
+// Copyright: (c) Ryan Norton
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// Definitions
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// Header guard
+// ----------------------------------------------------------------------------
+#ifndef _WX_MEDIACTRL_H_
+#define _WX_MEDIACTRL_H_
+
+// ----------------------------------------------------------------------------
+// Pre-compiled header stuff
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+// ----------------------------------------------------------------------------
+// Compilation guard
+// ----------------------------------------------------------------------------
+
+#if wxUSE_MEDIACTRL
+
+// ----------------------------------------------------------------------------
+// Includes
+// ----------------------------------------------------------------------------
+
+#include "wx/control.h"
+#include "wx/uri.h"
+
+// ============================================================================
+// Declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+//
+// Enumerations
+//
+// ----------------------------------------------------------------------------
+
+enum wxMediaState
+{
+ wxMEDIASTATE_STOPPED,
+ wxMEDIASTATE_PAUSED,
+ wxMEDIASTATE_PLAYING
+};
+
+enum wxMediaCtrlPlayerControls
+{
+ wxMEDIACTRLPLAYERCONTROLS_NONE = 0,
+ //Step controls like fastforward, step one frame etc.
+ wxMEDIACTRLPLAYERCONTROLS_STEP = 1 << 0,
+ //Volume controls like the speaker icon, volume slider, etc.
+ wxMEDIACTRLPLAYERCONTROLS_VOLUME = 1 << 1,
+ wxMEDIACTRLPLAYERCONTROLS_DEFAULT =
+ wxMEDIACTRLPLAYERCONTROLS_STEP |
+ wxMEDIACTRLPLAYERCONTROLS_VOLUME
+};
+
+#define wxMEDIABACKEND_DIRECTSHOW wxT("wxAMMediaBackend")
+#define wxMEDIABACKEND_MCI wxT("wxMCIMediaBackend")
+#define wxMEDIABACKEND_QUICKTIME wxT("wxQTMediaBackend")
+#define wxMEDIABACKEND_GSTREAMER wxT("wxGStreamerMediaBackend")
+#define wxMEDIABACKEND_REALPLAYER wxT("wxRealPlayerMediaBackend")
+#define wxMEDIABACKEND_WMP10 wxT("wxWMP10MediaBackend")
+
+// ----------------------------------------------------------------------------
+//
+// wxMediaEvent
+//
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_MEDIA wxMediaEvent : public wxNotifyEvent
+{
+public:
+ // ------------------------------------------------------------------------
+ // wxMediaEvent Constructor
+ //
+ // Normal constructor, much the same as wxNotifyEvent
+ // ------------------------------------------------------------------------
+ wxMediaEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
+ : wxNotifyEvent(commandType, winid)
+ { }
+
+ // ------------------------------------------------------------------------
+ // wxMediaEvent Copy Constructor
+ //
+ // Normal copy constructor, much the same as wxNotifyEvent
+ // ------------------------------------------------------------------------
+ wxMediaEvent(const wxMediaEvent &clone)
+ : wxNotifyEvent(clone)
+ { }
+
+ // ------------------------------------------------------------------------
+ // wxMediaEvent::Clone
+ //
+ // Allocates a copy of this object.
+ // Required for wxEvtHandler::AddPendingEvent
+ // ------------------------------------------------------------------------
+ virtual wxEvent *Clone() const
+ { return new wxMediaEvent(*this); }
+
+
+ // Put this class on wxWidget's RTTI table
+ DECLARE_DYNAMIC_CLASS(wxMediaEvent)
+};
+
+// ----------------------------------------------------------------------------
+//
+// wxMediaCtrl
+//
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_MEDIA wxMediaCtrl : public wxControl
+{
+public:
+ wxMediaCtrl() : m_imp(NULL), m_bLoaded(false)
+ { }
+
+ wxMediaCtrl(wxWindow* parent, wxWindowID winid,
+ const wxString& fileName = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& szBackend = wxEmptyString,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxT("mediaCtrl"))
+ : m_imp(NULL), m_bLoaded(false)
+ { Create(parent, winid, fileName, pos, size, style,
+ szBackend, validator, name); }
+
+ wxMediaCtrl(wxWindow* parent, wxWindowID winid,
+ const wxURI& location,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& szBackend = wxEmptyString,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxT("mediaCtrl"))
+ : m_imp(NULL), m_bLoaded(false)
+ { Create(parent, winid, location, pos, size, style,
+ szBackend, validator, name); }
+
+ virtual ~wxMediaCtrl();
+
+ bool Create(wxWindow* parent, wxWindowID winid,
+ const wxString& fileName = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& szBackend = wxEmptyString,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxT("mediaCtrl"));
+
+ bool Create(wxWindow* parent, wxWindowID winid,
+ const wxURI& location,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& szBackend = wxEmptyString,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxT("mediaCtrl"));
+
+ bool DoCreate(const wxClassInfo* instance,
+ wxWindow* parent, wxWindowID winid,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxT("mediaCtrl"));
+
+ bool Play();
+ bool Pause();
+ bool Stop();
+
+ bool Load(const wxString& fileName);
+
+ wxMediaState GetState();
+
+ wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart);
+ wxFileOffset Tell(); //FIXME: This should be const
+ wxFileOffset Length(); //FIXME: This should be const
+
+ double GetPlaybackRate(); //All but MCI & GStreamer
+ bool SetPlaybackRate(double dRate); //All but MCI & GStreamer
+
+ bool Load(const wxURI& location);
+ bool Load(const wxURI& location, const wxURI& proxy);
+
+ wxFileOffset GetDownloadProgress(); // DirectShow only
+ wxFileOffset GetDownloadTotal(); // DirectShow only
+
+ double GetVolume();
+ bool SetVolume(double dVolume);
+
+ bool ShowPlayerControls(
+ wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT);
+
+ //helpers for the wxPython people
+ bool LoadURI(const wxString& fileName)
+ { return Load(wxURI(fileName)); }
+ bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy)
+ { return Load(wxURI(fileName), wxURI(proxy)); }
+
+protected:
+ static const wxClassInfo* NextBackend(wxClassInfo::const_iterator* it);
+
+ void OnMediaFinished(wxMediaEvent& evt);
+ virtual void DoMoveWindow(int x, int y, int w, int h);
+ wxSize DoGetBestSize() const;
+
+ //FIXME: This is nasty... find a better way to work around
+ //inheritance issues
+#if defined(__WXOSX_CARBON__)
+ virtual void MacVisibilityChanged();
+#endif
+#if defined(__WXOSX_CARBON__) || defined(__WXCOCOA__)
+ friend class wxQTMediaBackend;
+#endif
+ class wxMediaBackend* m_imp;
+ bool m_bLoaded;
+
+ DECLARE_DYNAMIC_CLASS(wxMediaCtrl)
+};
+
+// ----------------------------------------------------------------------------
+//
+// wxMediaBackend
+//
+// Derive from this and use standard wxWidgets RTTI
+// (DECLARE_DYNAMIC_CLASS and IMPLEMENT_CLASS) to make a backend
+// for wxMediaCtrl. Backends are searched alphabetically -
+// the one with the earliest letter is tried first.
+//
+// Note that this is currently not API or ABI compatible -
+// so statically link or make the client compile on-site.
+//
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_MEDIA wxMediaBackend : public wxObject
+{
+public:
+ wxMediaBackend()
+ { }
+
+ virtual ~wxMediaBackend();
+
+ virtual bool CreateControl(wxControl* WXUNUSED(ctrl),
+ wxWindow* WXUNUSED(parent),
+ wxWindowID WXUNUSED(winid),
+ const wxPoint& WXUNUSED(pos),
+ const wxSize& WXUNUSED(size),
+ long WXUNUSED(style),
+ const wxValidator& WXUNUSED(validator),
+ const wxString& WXUNUSED(name))
+ { return false; }
+
+ virtual bool Play()
+ { return false; }
+ virtual bool Pause()
+ { return false; }
+ virtual bool Stop()
+ { return false; }
+
+ virtual bool Load(const wxString& WXUNUSED(fileName))
+ { return false; }
+ virtual bool Load(const wxURI& WXUNUSED(location))
+ { return false; }
+
+ virtual bool SetPosition(wxLongLong WXUNUSED(where))
+ { return 0; }
+ virtual wxLongLong GetPosition()
+ { return 0; }
+ virtual wxLongLong GetDuration()
+ { return 0; }
+
+ virtual void Move(int WXUNUSED(x), int WXUNUSED(y),
+ int WXUNUSED(w), int WXUNUSED(h))
+ { }
+ virtual wxSize GetVideoSize() const
+ { return wxSize(0,0); }
+
+ virtual double GetPlaybackRate()
+ { return 0.0; }
+ virtual bool SetPlaybackRate(double WXUNUSED(dRate))
+ { return false; }
+
+ virtual wxMediaState GetState()
+ { return wxMEDIASTATE_STOPPED; }
+
+ virtual double GetVolume()
+ { return 0.0; }
+ virtual bool SetVolume(double WXUNUSED(dVolume))
+ { return false; }
+
+ virtual bool Load(const wxURI& WXUNUSED(location),
+ const wxURI& WXUNUSED(proxy))
+ { return false; }
+
+ virtual bool ShowPlayerControls(
+ wxMediaCtrlPlayerControls WXUNUSED(flags))
+ { return false; }
+ virtual bool IsInterfaceShown()
+ { return false; }
+
+ virtual wxLongLong GetDownloadProgress()
+ { return 0; }
+ virtual wxLongLong GetDownloadTotal()
+ { return 0; }
+
+ virtual void MacVisibilityChanged()
+ { }
+ virtual void RESERVED9() {}
+
+ DECLARE_DYNAMIC_CLASS(wxMediaBackend)
+};
+
+
+//Our events
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_FINISHED, wxMediaEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_STOP, wxMediaEvent );
+
+//Function type(s) our events need
+typedef void (wxEvtHandler::*wxMediaEventFunction)(wxMediaEvent&);
+
+#define wxMediaEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxMediaEventFunction, func)
+
+//Macro for usage with message maps
+#define EVT_MEDIA_FINISHED(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_FINISHED, winid, wxID_ANY, wxMediaEventHandler(fn), NULL ),
+#define EVT_MEDIA_STOP(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_STOP, winid, wxID_ANY, wxMediaEventHandler(fn), NULL ),
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_LOADED, wxMediaEvent );
+#define EVT_MEDIA_LOADED(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_LOADED, winid, wxID_ANY, wxMediaEventHandler(fn), NULL ),
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_STATECHANGED, wxMediaEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_PLAY, wxMediaEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_PAUSE, wxMediaEvent );
+#define EVT_MEDIA_STATECHANGED(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_STATECHANGED, winid, wxID_ANY, wxMediaEventHandler(fn), NULL ),
+#define EVT_MEDIA_PLAY(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_PLAY, winid, wxID_ANY, wxMediaEventHandler(fn), NULL ),
+#define EVT_MEDIA_PAUSE(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_PAUSE, winid, wxID_ANY, wxMediaEventHandler(fn), NULL ),
+
+// ----------------------------------------------------------------------------
+// common backend base class used by many other backends
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_MEDIA wxMediaBackendCommonBase : public wxMediaBackend
+{
+public:
+ // add a pending wxMediaEvent of the given type
+ void QueueEvent(wxEventType evtType);
+
+ // notify that the movie playback is finished
+ void QueueFinishEvent()
+ {
+ QueueEvent(wxEVT_MEDIA_STATECHANGED);
+ QueueEvent(wxEVT_MEDIA_FINISHED);
+ }
+
+ // send the stop event and return true if it hasn't been vetoed
+ bool SendStopEvent();
+
+ // Queue pause event
+ void QueuePlayEvent();
+
+ // Queue pause event
+ void QueuePauseEvent();
+
+ // Queue stop event (no veto)
+ void QueueStopEvent();
+
+protected:
+ // call this when the movie size has changed but not because it has just
+ // been loaded (in this case, call NotifyMovieLoaded() below)
+ void NotifyMovieSizeChanged();
+
+ // call this when the movie is fully loaded
+ void NotifyMovieLoaded();
+
+
+ wxMediaCtrl *m_ctrl; // parent control
+};
+
+// ----------------------------------------------------------------------------
+// End compilation guard
+// ----------------------------------------------------------------------------
+#endif // wxUSE_MEDIACTRL
+
+// ----------------------------------------------------------------------------
+// End header guard and header itself
+// ----------------------------------------------------------------------------
+#endif // _WX_MEDIACTRL_H_
+
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/memconf.h
+// Purpose: wxMemoryConfig class: a wxConfigBase implementation which only
+// stores the settings in memory (thus they are lost when the
+// program terminates)
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 22.01.00
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+/*
+ * NB: I don't see how this class may possibly be useful to the application
+ * program (as the settings are lost on program termination), but it is
+ * handy to have it inside wxWidgets. So for now let's say that this class
+ * is private and should only be used by wxWidgets itself - this might
+ * change in the future.
+ */
+
+#ifndef _WX_MEMCONF_H_
+#define _WX_MEMCONF_H_
+
+#if wxUSE_CONFIG
+
+#include "wx/fileconf.h" // the base class
+
+// ----------------------------------------------------------------------------
+// wxMemoryConfig: a config class which stores settings in non-persistent way
+// ----------------------------------------------------------------------------
+
+// notice that we inherit from wxFileConfig which already stores its data in
+// memory and just disable file reading/writing - this is probably not optimal
+// and might be changed in future as well (this class will always deriev from
+// wxConfigBase though)
+class wxMemoryConfig : public wxFileConfig
+{
+public:
+ // default (and only) ctor
+ wxMemoryConfig() : wxFileConfig(wxEmptyString, // default app name
+ wxEmptyString, // default vendor name
+ wxEmptyString, // no local config file
+ wxEmptyString, // no system config file
+ 0) // don't use any files
+ {
+ }
+
+ wxDECLARE_NO_COPY_CLASS(wxMemoryConfig);
+};
+
+#endif // wxUSE_CONFIG
+
+#endif // _WX_MEMCONF_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/memory.h
+// Purpose: Memory operations
+// Author: Arthur Seaton, Julian Smart
+// Modified by:
+// Created: 29/01/98
+// Copyright: (c) 1998 Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_MEMORY_H_
+#define _WX_MEMORY_H_
+
+#include "wx/defs.h"
+#include "wx/string.h"
+#include "wx/msgout.h"
+
+#if wxUSE_MEMORY_TRACING || wxUSE_DEBUG_CONTEXT
+
+#include <stddef.h>
+
+WXDLLIMPEXP_BASE void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, bool isVect = false);
+WXDLLIMPEXP_BASE void wxDebugFree(void * buf, bool isVect = false);
+
+//**********************************************************************************
+/*
+ The global operator new used for everything apart from getting
+ dynamic storage within this function itself.
+*/
+
+// We'll only do malloc and free for the moment: leave the interesting
+// stuff for the wxObject versions.
+
+
+#if wxUSE_GLOBAL_MEMORY_OPERATORS
+
+// Undefine temporarily (new is #defined in object.h) because we want to
+// declare some new operators.
+#ifdef new
+ #undef new
+#endif
+
+#if defined(__SUNCC__)
+ #define wxUSE_ARRAY_MEMORY_OPERATORS 0
+#elif !( defined (__VISUALC__) && (__VISUALC__ <= 1020) )
+ #define wxUSE_ARRAY_MEMORY_OPERATORS 1
+#elif defined (__SGI_CC_)
+ // only supported by -n32 compilers
+ #ifndef __EDG_ABI_COMPATIBILITY_VERSION
+ #define wxUSE_ARRAY_MEMORY_OPERATORS 0
+ #endif
+#elif !( defined (__VISUALC__) && (__VISUALC__ <= 1020) )
+ #define wxUSE_ARRAY_MEMORY_OPERATORS 1
+#else
+ // ::operator new[] is a recent C++ feature, so assume it's not supported
+ #define wxUSE_ARRAY_MEMORY_OPERATORS 0
+#endif
+
+// devik 2000-8-29: All new/delete ops are now inline because they can't
+// be marked as dllexport/dllimport. It then leads to weird bugs when
+// used on MSW as DLL
+#if defined(__WINDOWS__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE))
+inline void * operator new (size_t size, wxChar * fileName, int lineNum)
+{
+ return wxDebugAlloc(size, fileName, lineNum, false, false);
+}
+
+inline void * operator new (size_t size)
+{
+ return wxDebugAlloc(size, NULL, 0, false);
+}
+
+inline void operator delete (void * buf)
+{
+ wxDebugFree(buf, false);
+}
+
+#if wxUSE_ARRAY_MEMORY_OPERATORS
+inline void * operator new[] (size_t size)
+{
+ return wxDebugAlloc(size, NULL, 0, false, true);
+}
+
+inline void * operator new[] (size_t size, wxChar * fileName, int lineNum)
+{
+ return wxDebugAlloc(size, fileName, lineNum, false, true);
+}
+
+inline void operator delete[] (void * buf)
+{
+ wxDebugFree(buf, true);
+}
+#endif // wxUSE_ARRAY_MEMORY_OPERATORS
+
+#else
+
+void * operator new (size_t size, wxChar * fileName, int lineNum);
+
+void * operator new (size_t size);
+
+void operator delete (void * buf);
+
+#if wxUSE_ARRAY_MEMORY_OPERATORS
+void * operator new[] (size_t size);
+
+void * operator new[] (size_t size, wxChar * fileName, int lineNum);
+
+void operator delete[] (void * buf);
+#endif // wxUSE_ARRAY_MEMORY_OPERATORS
+#endif // defined(__WINDOWS__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE))
+
+// VC++ 6.0
+#if ( defined(__VISUALC__) && (__VISUALC__ >= 1200) )
+inline void operator delete(void* pData, wxChar* /* fileName */, int /* lineNum */)
+{
+ wxDebugFree(pData, false);
+}
+inline void operator delete[](void* pData, wxChar* /* fileName */, int /* lineNum */)
+{
+ wxDebugFree(pData, true);
+}
+#endif // __VISUALC__>=1200
+#endif // wxUSE_GLOBAL_MEMORY_OPERATORS
+
+//**********************************************************************************
+
+typedef unsigned int wxMarkerType;
+
+/*
+ Define the struct which will be placed at the start of all dynamically
+ allocated memory.
+*/
+
+class WXDLLIMPEXP_BASE wxMemStruct {
+
+friend class WXDLLIMPEXP_FWD_BASE wxDebugContext; // access to the m_next pointer for list traversal.
+
+public:
+public:
+ int AssertList ();
+
+ size_t RequestSize () { return m_reqSize; }
+ wxMarkerType Marker () { return m_firstMarker; }
+
+ // When an object is deleted we set the id slot to a specific value.
+ inline void SetDeleted ();
+ inline int IsDeleted ();
+
+ int Append ();
+ int Unlink ();
+
+ // Used to determine if the object is really a wxMemStruct.
+ // Not a foolproof test by any means, but better than none I hope!
+ int AssertIt ();
+
+ // Do all validation on a node.
+ int ValidateNode ();
+
+ // Check the integrity of a node and of the list, node by node.
+ int CheckBlock ();
+ int CheckAllPrevious ();
+
+ // Print a single node.
+ void PrintNode ();
+
+ // Called when the memory linking functions get an error.
+ void ErrorMsg (const char *);
+ void ErrorMsg ();
+
+ inline void *GetActualData(void) const { return m_actualData; }
+
+ void Dump(void);
+
+public:
+ // Check for underwriting. There are 2 of these checks. This one
+ // inside the struct and another right after the struct.
+ wxMarkerType m_firstMarker;
+
+ // File name and line number are from cpp.
+ wxChar* m_fileName;
+ int m_lineNum;
+
+ // The amount of memory requested by the caller.
+ size_t m_reqSize;
+
+ // Used to try to verify that we really are dealing with an object
+ // of the required class. Can be 1 of 2 values these indicating a valid
+ // wxMemStruct object, or a deleted wxMemStruct object.
+ wxMarkerType m_id;
+
+ wxMemStruct * m_prev;
+ wxMemStruct * m_next;
+
+ void * m_actualData;
+ bool m_isObject;
+};
+
+
+typedef void (wxMemStruct::*PmSFV) ();
+
+// Type of the app function that can be installed and called at wxWidgets shutdown
+// (after all other registered files with global destructors have been closed down).
+typedef void (*wxShutdownNotifyFunction)();
+
+/*
+ Debugging class. This will only have a single instance, but it's
+ a reasonable way to keep everything together and to make this
+ available for change if needed by someone else.
+ A lot of this stuff would be better off within the wxMemStruct class, but
+ it's stuff which we need to access at times when there is no wxMemStruct
+ object so we use this class instead. Think of it as a collection of
+ globals which have to do with the wxMemStruct class.
+*/
+
+class WXDLLIMPEXP_BASE wxDebugContext {
+
+protected:
+ // Used to set alignment for markers.
+ static size_t CalcAlignment ();
+
+ // Returns the amount of padding needed after something of the given
+ // size. This is so that when we cast pointers backwards and forwards
+ // the pointer value will be valid for a wxMarkerType.
+ static size_t GetPadding (const size_t size) ;
+
+ // Traverse the list.
+ static void TraverseList (PmSFV, wxMemStruct *from = NULL);
+
+ static int debugLevel;
+ static bool debugOn;
+
+ static int m_balign; // byte alignment
+ static int m_balignmask; // mask for performing byte alignment
+public:
+ // Set a checkpoint to dump only the memory from
+ // a given point
+ static wxMemStruct *checkPoint;
+
+ wxDebugContext(void);
+ ~wxDebugContext(void);
+
+ static int GetLevel(void) { return debugLevel; }
+ static void SetLevel(int level) { debugLevel = level; }
+
+ static bool GetDebugMode(void) { return debugOn; }
+ static void SetDebugMode(bool flag) { debugOn = flag; }
+
+ static void SetCheckpoint(bool all = false);
+ static wxMemStruct *GetCheckpoint(void) { return checkPoint; }
+
+ // Calculated from the request size and any padding needed
+ // before the final marker.
+ static size_t PaddedSize (const size_t reqSize);
+
+ // Calc the total amount of space we need from the system
+ // to satisfy a caller request. This includes all padding.
+ static size_t TotSize (const size_t reqSize);
+
+ // Return valid pointers to offsets within the allocated memory.
+ static char * StructPos (const char * buf);
+ static char * MidMarkerPos (const char * buf);
+ static char * CallerMemPos (const char * buf);
+ static char * EndMarkerPos (const char * buf, const size_t size);
+
+ // Given a pointer to the start of the caller requested area
+ // return a pointer to the start of the entire alloc\'d buffer.
+ static char * StartPos (const char * caller);
+
+ // Access to the list.
+ static wxMemStruct * GetHead () { return m_head; }
+ static wxMemStruct * GetTail () { return m_tail; }
+
+ // Set the list sentinals.
+ static wxMemStruct * SetHead (wxMemStruct * st) { return (m_head = st); }
+ static wxMemStruct * SetTail (wxMemStruct * st) { return (m_tail = st); }
+
+ // If this is set then every new operation checks the validity
+ // of the all previous nodes in the list.
+ static bool GetCheckPrevious () { return m_checkPrevious; }
+ static void SetCheckPrevious (bool value) { m_checkPrevious = value; }
+
+ // Checks all nodes, or all nodes if checkAll is true
+ static int Check(bool checkAll = false);
+
+ // Print out the list of wxMemStruct nodes.
+ static bool PrintList(void);
+
+ // Dump objects
+ static bool Dump(void);
+
+ // Print statistics
+ static bool PrintStatistics(bool detailed = true);
+
+ // Print out the classes in the application.
+ static bool PrintClasses(void);
+
+ // Count the number of non-wxDebugContext-related objects
+ // that are outstanding
+ static int CountObjectsLeft(bool sinceCheckpoint = false);
+
+ // This function is used to output the dump
+ static void OutputDumpLine(const wxChar *szFormat, ...);
+
+ static void SetShutdownNotifyFunction(wxShutdownNotifyFunction shutdownFn);
+
+private:
+ // Store these here to allow access to the list without
+ // needing to have a wxMemStruct object.
+ static wxMemStruct* m_head;
+ static wxMemStruct* m_tail;
+
+ // Set to false if we're not checking all previous nodes when
+ // we do a new. Set to true when we are.
+ static bool m_checkPrevious;
+
+ // Holds a pointer to an optional application function to call at shutdown.
+ static wxShutdownNotifyFunction sm_shutdownFn;
+
+ // Have to access our shutdown hook
+ friend class wxDebugContextDumpDelayCounter;
+};
+
+// Final cleanup (e.g. deleting the log object and doing memory leak checking)
+// will be delayed until all wxDebugContextDumpDelayCounter objects have been
+// destructed. Adding one wxDebugContextDumpDelayCounter per file will delay
+// memory leak checking until after destructing all global objects.
+
+class WXDLLIMPEXP_BASE wxDebugContextDumpDelayCounter
+{
+public:
+ wxDebugContextDumpDelayCounter();
+ ~wxDebugContextDumpDelayCounter();
+
+private:
+ void DoDump();
+ static int sm_count;
+};
+
+// make leak dump after all globals have been destructed
+static wxDebugContextDumpDelayCounter wxDebugContextDumpDelayCounter_File;
+#define WXDEBUG_DUMPDELAYCOUNTER \
+ static wxDebugContextDumpDelayCounter wxDebugContextDumpDelayCounter_Extra;
+
+// Output a debug message, in a system dependent fashion.
+void WXDLLIMPEXP_BASE wxTrace(const wxChar *fmt ...) WX_ATTRIBUTE_PRINTF_1;
+void WXDLLIMPEXP_BASE wxTraceLevel(int level, const wxChar *fmt ...) WX_ATTRIBUTE_PRINTF_2;
+
+#define WXTRACE wxTrace
+#define WXTRACELEVEL wxTraceLevel
+
+#else // wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
+
+#define WXDEBUG_DUMPDELAYCOUNTER
+
+// Borland C++ Builder 6 seems to have troubles with inline functions (see bug
+// 819700)
+#if 0
+ inline void wxTrace(const wxChar *WXUNUSED(fmt)) {}
+ inline void wxTraceLevel(int WXUNUSED(level), const wxChar *WXUNUSED(fmt)) {}
+#else
+ #define wxTrace(fmt)
+ #define wxTraceLevel(l, fmt)
+#endif
+
+#define WXTRACE true ? (void)0 : wxTrace
+#define WXTRACELEVEL true ? (void)0 : wxTraceLevel
+
+#endif // wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
+
+#endif // _WX_MEMORY_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/memtext.h
+// Purpose: wxMemoryText allows to use wxTextBuffer without a file
+// Created: 14.11.01
+// Author: Morten Hanssen
+// Copyright: (c) 2001 Morten Hanssen
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_MEMTEXT_H
+#define _WX_MEMTEXT_H
+
+#include "wx/defs.h"
+
+// there is no separate setting for wxMemoryText, it's smallish anyhow
+#if wxUSE_TEXTBUFFER
+
+// ----------------------------------------------------------------------------
+// wxMemoryText
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMemoryText : public wxTextBuffer
+{
+public:
+ // Constructors.
+ wxMemoryText() { }
+ wxMemoryText(const wxString& name) : wxTextBuffer(name) { }
+
+protected:
+ virtual bool OnExists() const
+ { return false; }
+
+ virtual bool OnOpen(const wxString & WXUNUSED(strBufferName),
+ wxTextBufferOpenMode WXUNUSED(OpenMode))
+ { return true; }
+
+ virtual bool OnClose()
+ { return true; }
+
+ virtual bool OnRead(const wxMBConv& WXUNUSED(conv))
+ { return true; }
+
+ virtual bool OnWrite(wxTextFileType WXUNUSED(typeNew),
+ const wxMBConv& WXUNUSED(conv) = wxMBConvUTF8())
+ { return true; }
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxMemoryText);
+};
+
+#endif // wxUSE_TEXTBUFFER
+
+#endif // _WX_MEMTEXT_H
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/menu.h
+// Purpose: wxMenu and wxMenuBar classes
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 26.10.99
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_MENU_H_BASE_
+#define _WX_MENU_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_MENUS
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/list.h" // for "template" list classes
+#include "wx/window.h" // base class for wxMenuBar
+
+// also include this one to ensure compatibility with old code which only
+// included wx/menu.h
+#include "wx/menuitem.h"
+
+class WXDLLIMPEXP_FWD_CORE wxFrame;
+class WXDLLIMPEXP_FWD_CORE wxMenu;
+class WXDLLIMPEXP_FWD_CORE wxMenuBarBase;
+class WXDLLIMPEXP_FWD_CORE wxMenuBar;
+class WXDLLIMPEXP_FWD_CORE wxMenuItem;
+
+// pseudo template list classes
+WX_DECLARE_EXPORTED_LIST(wxMenu, wxMenuList);
+WX_DECLARE_EXPORTED_LIST(wxMenuItem, wxMenuItemList);
+
+// ----------------------------------------------------------------------------
+// wxMenu
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxMenuBase : public wxEvtHandler
+{
+public:
+ // create a menu
+ static wxMenu *New(const wxString& title = wxEmptyString, long style = 0);
+
+ // ctors
+ wxMenuBase(const wxString& title, long style = 0) : m_title(title)
+ { Init(style); }
+ wxMenuBase(long style = 0)
+ { Init(style); }
+
+ // dtor deletes all the menu items we own
+ virtual ~wxMenuBase();
+
+ // menu construction
+ // -----------------
+
+ // append any kind of item (normal/check/radio/separator)
+ wxMenuItem* Append(int itemid,
+ const wxString& text = wxEmptyString,
+ const wxString& help = wxEmptyString,
+ wxItemKind kind = wxITEM_NORMAL)
+ {
+ return DoAppend(wxMenuItem::New((wxMenu *)this, itemid, text, help, kind));
+ }
+
+ // append a separator to the menu
+ wxMenuItem* AppendSeparator() { return Append(wxID_SEPARATOR); }
+
+ // append a check item
+ wxMenuItem* AppendCheckItem(int itemid,
+ const wxString& text,
+ const wxString& help = wxEmptyString)
+ {
+ return Append(itemid, text, help, wxITEM_CHECK);
+ }
+
+ // append a radio item
+ wxMenuItem* AppendRadioItem(int itemid,
+ const wxString& text,
+ const wxString& help = wxEmptyString)
+ {
+ return Append(itemid, text, help, wxITEM_RADIO);
+ }
+
+ // append a submenu
+ wxMenuItem* AppendSubMenu(wxMenu *submenu,
+ const wxString& text,
+ const wxString& help = wxEmptyString)
+ {
+ return DoAppend(wxMenuItem::New((wxMenu *)this, wxID_ANY, text, help,
+ wxITEM_NORMAL, submenu));
+ }
+
+ // the most generic form of Append() - append anything
+ wxMenuItem* Append(wxMenuItem *item) { return DoAppend(item); }
+
+ // insert a break in the menu (only works when appending the items, not
+ // inserting them)
+ virtual void Break() { }
+
+ // insert an item before given position
+ wxMenuItem* Insert(size_t pos, wxMenuItem *item);
+
+ // insert an item before given position
+ wxMenuItem* Insert(size_t pos,
+ int itemid,
+ const wxString& text = wxEmptyString,
+ const wxString& help = wxEmptyString,
+ wxItemKind kind = wxITEM_NORMAL)
+ {
+ return Insert(pos, wxMenuItem::New((wxMenu *)this, itemid, text, help, kind));
+ }
+
+ // insert a separator
+ wxMenuItem* InsertSeparator(size_t pos)
+ {
+ return Insert(pos, wxMenuItem::New((wxMenu *)this, wxID_SEPARATOR));
+ }
+
+ // insert a check item
+ wxMenuItem* InsertCheckItem(size_t pos,
+ int itemid,
+ const wxString& text,
+ const wxString& help = wxEmptyString)
+ {
+ return Insert(pos, itemid, text, help, wxITEM_CHECK);
+ }
+
+ // insert a radio item
+ wxMenuItem* InsertRadioItem(size_t pos,
+ int itemid,
+ const wxString& text,
+ const wxString& help = wxEmptyString)
+ {
+ return Insert(pos, itemid, text, help, wxITEM_RADIO);
+ }
+
+ // insert a submenu
+ wxMenuItem* Insert(size_t pos,
+ int itemid,
+ const wxString& text,
+ wxMenu *submenu,
+ const wxString& help = wxEmptyString)
+ {
+ return Insert(pos, wxMenuItem::New((wxMenu *)this, itemid, text, help,
+ wxITEM_NORMAL, submenu));
+ }
+
+ // prepend an item to the menu
+ wxMenuItem* Prepend(wxMenuItem *item)
+ {
+ return Insert(0u, item);
+ }
+
+ // prepend any item to the menu
+ wxMenuItem* Prepend(int itemid,
+ const wxString& text = wxEmptyString,
+ const wxString& help = wxEmptyString,
+ wxItemKind kind = wxITEM_NORMAL)
+ {
+ return Insert(0u, itemid, text, help, kind);
+ }
+
+ // prepend a separator
+ wxMenuItem* PrependSeparator()
+ {
+ return InsertSeparator(0u);
+ }
+
+ // prepend a check item
+ wxMenuItem* PrependCheckItem(int itemid,
+ const wxString& text,
+ const wxString& help = wxEmptyString)
+ {
+ return InsertCheckItem(0u, itemid, text, help);
+ }
+
+ // prepend a radio item
+ wxMenuItem* PrependRadioItem(int itemid,
+ const wxString& text,
+ const wxString& help = wxEmptyString)
+ {
+ return InsertRadioItem(0u, itemid, text, help);
+ }
+
+ // prepend a submenu
+ wxMenuItem* Prepend(int itemid,
+ const wxString& text,
+ wxMenu *submenu,
+ const wxString& help = wxEmptyString)
+ {
+ return Insert(0u, itemid, text, submenu, help);
+ }
+
+ // detach an item from the menu, but don't delete it so that it can be
+ // added back later (but if it's not, the caller is responsible for
+ // deleting it!)
+ wxMenuItem *Remove(int itemid) { return Remove(FindChildItem(itemid)); }
+ wxMenuItem *Remove(wxMenuItem *item);
+
+ // delete an item from the menu (submenus are not destroyed by this
+ // function, see Destroy)
+ bool Delete(int itemid) { return Delete(FindChildItem(itemid)); }
+ bool Delete(wxMenuItem *item);
+
+ // delete the item from menu and destroy it (if it's a submenu)
+ bool Destroy(int itemid) { return Destroy(FindChildItem(itemid)); }
+ bool Destroy(wxMenuItem *item);
+
+ // menu items access
+ // -----------------
+
+ // get the items
+ size_t GetMenuItemCount() const { return m_items.GetCount(); }
+
+ const wxMenuItemList& GetMenuItems() const { return m_items; }
+ wxMenuItemList& GetMenuItems() { return m_items; }
+
+ // search
+ virtual int FindItem(const wxString& item) const;
+ wxMenuItem* FindItem(int itemid, wxMenu **menu = NULL) const;
+
+ // find by position
+ wxMenuItem* FindItemByPosition(size_t position) const;
+
+ // get/set items attributes
+ void Enable(int itemid, bool enable);
+ bool IsEnabled(int itemid) const;
+
+ void Check(int itemid, bool check);
+ bool IsChecked(int itemid) const;
+
+ void SetLabel(int itemid, const wxString& label);
+ wxString GetLabel(int itemid) const;
+
+ // Returns the stripped label
+ wxString GetLabelText(int itemid) const { return wxMenuItem::GetLabelText(GetLabel(itemid)); }
+
+ virtual void SetHelpString(int itemid, const wxString& helpString);
+ virtual wxString GetHelpString(int itemid) const;
+
+ // misc accessors
+ // --------------
+
+ // the title
+ virtual void SetTitle(const wxString& title) { m_title = title; }
+ const wxString& GetTitle() const { return m_title; }
+
+ // event handler
+ void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; }
+ wxEvtHandler *GetEventHandler() const { return m_eventHandler; }
+
+ // Invoking window: this is set by wxWindow::PopupMenu() before showing a
+ // popup menu and reset after it's hidden. Notice that you probably want to
+ // use GetWindow() below instead of GetInvokingWindow() as the latter only
+ // returns non-NULL for the top level menus
+ //
+ // NB: avoid calling SetInvokingWindow() directly if possible, use
+ // wxMenuInvokingWindowSetter class below instead
+ void SetInvokingWindow(wxWindow *win);
+ wxWindow *GetInvokingWindow() const { return m_invokingWindow; }
+
+ // the window associated with this menu: this is the invoking window for
+ // popup menus or the top level window to which the menu bar is attached
+ // for menus which are part of a menu bar
+ wxWindow *GetWindow() const;
+
+ // style
+ long GetStyle() const { return m_style; }
+
+ // implementation helpers
+ // ----------------------
+
+ // Updates the UI for a menu and all submenus recursively. source is the
+ // object that has the update event handlers defined for it. If NULL, the
+ // menu or associated window will be used.
+ void UpdateUI(wxEvtHandler* source = NULL);
+
+ // get the menu bar this menu is attached to (may be NULL, always NULL for
+ // popup menus). Traverse up the menu hierarchy to find it.
+ wxMenuBar *GetMenuBar() const;
+
+ // called when the menu is attached/detached to/from a menu bar
+ virtual void Attach(wxMenuBarBase *menubar);
+ virtual void Detach();
+
+ // is the menu attached to a menu bar (or is it a popup one)?
+ bool IsAttached() const { return GetMenuBar() != NULL; }
+
+ // set/get the parent of this menu
+ void SetParent(wxMenu *parent) { m_menuParent = parent; }
+ wxMenu *GetParent() const { return m_menuParent; }
+
+ // implementation only from now on
+ // -------------------------------
+
+ // unlike FindItem(), this function doesn't recurse but only looks through
+ // our direct children and also may return the index of the found child if
+ // pos != NULL
+ wxMenuItem *FindChildItem(int itemid, size_t *pos = NULL) const;
+
+ // called to generate a wxCommandEvent, return true if it was processed,
+ // false otherwise
+ //
+ // the checked parameter may have boolean value or -1 for uncheckable items
+ bool SendEvent(int itemid, int checked = -1);
+
+ // compatibility: these functions are deprecated, use the new ones instead
+ // -----------------------------------------------------------------------
+
+ // use the versions taking wxItem_XXX now instead, they're more readable
+ // and allow adding the radio items as well
+ void Append(int itemid,
+ const wxString& text,
+ const wxString& help,
+ bool isCheckable)
+ {
+ Append(itemid, text, help, isCheckable ? wxITEM_CHECK : wxITEM_NORMAL);
+ }
+
+ // use more readable and not requiring unused itemid AppendSubMenu() instead
+ wxMenuItem* Append(int itemid,
+ const wxString& text,
+ wxMenu *submenu,
+ const wxString& help = wxEmptyString)
+ {
+ return DoAppend(wxMenuItem::New((wxMenu *)this, itemid, text, help,
+ wxITEM_NORMAL, submenu));
+ }
+
+ void Insert(size_t pos,
+ int itemid,
+ const wxString& text,
+ const wxString& help,
+ bool isCheckable)
+ {
+ Insert(pos, itemid, text, help, isCheckable ? wxITEM_CHECK : wxITEM_NORMAL);
+ }
+
+ void Prepend(int itemid,
+ const wxString& text,
+ const wxString& help,
+ bool isCheckable)
+ {
+ Insert(0u, itemid, text, help, isCheckable);
+ }
+
+ static void LockAccels(bool locked)
+ {
+ ms_locked = locked;
+ }
+
+protected:
+ // virtuals to override in derived classes
+ // ---------------------------------------
+
+ virtual wxMenuItem* DoAppend(wxMenuItem *item);
+ virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item);
+
+ virtual wxMenuItem *DoRemove(wxMenuItem *item);
+ virtual bool DoDelete(wxMenuItem *item);
+ virtual bool DoDestroy(wxMenuItem *item);
+
+ // helpers
+ // -------
+
+ // common part of all ctors
+ void Init(long style);
+
+ // associate the submenu with this menu
+ void AddSubMenu(wxMenu *submenu);
+
+ wxMenuBar *m_menuBar; // menubar we belong to or NULL
+ wxMenu *m_menuParent; // parent menu or NULL
+
+ wxString m_title; // the menu title or label
+ wxMenuItemList m_items; // the list of menu items
+
+ wxWindow *m_invokingWindow; // for popup menus
+
+ long m_style; // combination of wxMENU_XXX flags
+
+ wxEvtHandler *m_eventHandler; // a pluggable in event handler
+
+ static bool ms_locked;
+
+ wxDECLARE_NO_COPY_CLASS(wxMenuBase);
+};
+
+#if wxUSE_EXTENDED_RTTI
+
+// ----------------------------------------------------------------------------
+// XTI accessor
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxMenuInfoHelper : public wxObject
+{
+public:
+ wxMenuInfoHelper() { m_menu = NULL; }
+ virtual ~wxMenuInfoHelper() { }
+
+ bool Create( wxMenu *menu, const wxString &title )
+ {
+ m_menu = menu;
+ m_title = title;
+ return true;
+ }
+
+ wxMenu* GetMenu() const { return m_menu; }
+ wxString GetTitle() const { return m_title; }
+
+private:
+ wxMenu *m_menu;
+ wxString m_title;
+
+ DECLARE_DYNAMIC_CLASS(wxMenuInfoHelper)
+};
+
+WX_DECLARE_EXPORTED_LIST(wxMenuInfoHelper, wxMenuInfoHelperList );
+
+#endif
+
+// ----------------------------------------------------------------------------
+// wxMenuBar
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxMenuBarBase : public wxWindow
+{
+public:
+ // default ctor
+ wxMenuBarBase();
+
+ // dtor will delete all menus we own
+ virtual ~wxMenuBarBase();
+
+ // menu bar construction
+ // ---------------------
+
+ // append a menu to the end of menubar, return true if ok
+ virtual bool Append(wxMenu *menu, const wxString& title);
+
+ // insert a menu before the given position into the menubar, return true
+ // if inserted ok
+ virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title);
+
+ // menu bar items access
+ // ---------------------
+
+ // get the number of menus in the menu bar
+ size_t GetMenuCount() const { return m_menus.GetCount(); }
+
+ // get the menu at given position
+ wxMenu *GetMenu(size_t pos) const;
+
+ // replace the menu at given position with another one, returns the
+ // previous menu (which should be deleted by the caller)
+ virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title);
+
+ // delete the menu at given position from the menu bar, return the pointer
+ // to the menu (which should be deleted by the caller)
+ virtual wxMenu *Remove(size_t pos);
+
+ // enable or disable a submenu
+ virtual void EnableTop(size_t pos, bool enable) = 0;
+
+ // is the menu enabled?
+ virtual bool IsEnabledTop(size_t WXUNUSED(pos)) const { return true; }
+
+ // get or change the label of the menu at given position
+ virtual void SetMenuLabel(size_t pos, const wxString& label) = 0;
+ virtual wxString GetMenuLabel(size_t pos) const = 0;
+
+ // get the stripped label of the menu at given position
+ virtual wxString GetMenuLabelText(size_t pos) const { return wxMenuItem::GetLabelText(GetMenuLabel(pos)); }
+
+ // item search
+ // -----------
+
+ // by menu and item names, returns wxNOT_FOUND if not found or id of the
+ // found item
+ virtual int FindMenuItem(const wxString& menu, const wxString& item) const;
+
+ // find item by id (in any menu), returns NULL if not found
+ //
+ // if menu is !NULL, it will be filled with wxMenu this item belongs to
+ virtual wxMenuItem* FindItem(int itemid, wxMenu **menu = NULL) const;
+
+ // find menu by its caption, return wxNOT_FOUND on failure
+ int FindMenu(const wxString& title) const;
+
+ // item access
+ // -----------
+
+ // all these functions just use FindItem() and then call an appropriate
+ // method on it
+ //
+ // NB: under MSW, these methods can only be used after the menubar had
+ // been attached to the frame
+
+ void Enable(int itemid, bool enable);
+ void Check(int itemid, bool check);
+ bool IsChecked(int itemid) const;
+ bool IsEnabled(int itemid) const;
+ virtual bool IsEnabled() const { return wxWindow::IsEnabled(); }
+
+ void SetLabel(int itemid, const wxString &label);
+ wxString GetLabel(int itemid) const;
+
+ void SetHelpString(int itemid, const wxString& helpString);
+ wxString GetHelpString(int itemid) const;
+
+ // implementation helpers
+
+ // get the frame we are attached to (may return NULL)
+ wxFrame *GetFrame() const { return m_menuBarFrame; }
+
+ // returns true if we're attached to a frame
+ bool IsAttached() const { return GetFrame() != NULL; }
+
+ // associate the menubar with the frame
+ virtual void Attach(wxFrame *frame);
+
+ // called before deleting the menubar normally
+ virtual void Detach();
+
+ // need to override these ones to avoid virtual function hiding
+ virtual bool Enable(bool enable = true) { return wxWindow::Enable(enable); }
+ virtual void SetLabel(const wxString& s) { wxWindow::SetLabel(s); }
+ virtual wxString GetLabel() const { return wxWindow::GetLabel(); }
+
+ // don't want menu bars to accept the focus by tabbing to them
+ virtual bool AcceptsFocusFromKeyboard() const { return false; }
+
+ // update all menu item states in all menus
+ virtual void UpdateMenus();
+
+ virtual bool CanBeOutsideClientArea() const { return true; }
+
+#if wxUSE_EXTENDED_RTTI
+ // XTI helpers:
+ bool AppendMenuInfo( const wxMenuInfoHelper *info )
+ { return Append( info->GetMenu(), info->GetTitle() ); }
+ const wxMenuInfoHelperList& GetMenuInfos() const;
+#endif
+
+#if WXWIN_COMPATIBILITY_2_8
+ // get or change the label of the menu at given position
+ // Deprecated in favour of SetMenuLabel
+ wxDEPRECATED( void SetLabelTop(size_t pos, const wxString& label) );
+ // Deprecated in favour of GetMenuLabelText
+ wxDEPRECATED( wxString GetLabelTop(size_t pos) const );
+#endif
+
+protected:
+ // the list of all our menus
+ wxMenuList m_menus;
+
+#if wxUSE_EXTENDED_RTTI
+ // used by XTI
+ wxMenuInfoHelperList m_menuInfos;
+#endif
+
+ // the frame we are attached to (may be NULL)
+ wxFrame *m_menuBarFrame;
+
+ wxDECLARE_NO_COPY_CLASS(wxMenuBarBase);
+};
+
+// ----------------------------------------------------------------------------
+// include the real class declaration
+// ----------------------------------------------------------------------------
+
+#ifdef wxUSE_BASE_CLASSES_ONLY
+ #define wxMenuItem wxMenuItemBase
+#else // !wxUSE_BASE_CLASSES_ONLY
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/menu.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/menu.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/menu.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/menu.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/menu.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/menu.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/menu.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/menu.h"
+#endif
+#endif // wxUSE_BASE_CLASSES_ONLY/!wxUSE_BASE_CLASSES_ONLY
+
+// ----------------------------------------------------------------------------
+// Helper class used in the implementation only: sets the invoking window of
+// the given menu in its ctor and resets it in dtor.
+// ----------------------------------------------------------------------------
+
+class wxMenuInvokingWindowSetter
+{
+public:
+ // Ctor sets the invoking window for the given menu.
+ //
+ // The menu lifetime must be greater than that of this class.
+ wxMenuInvokingWindowSetter(wxMenu& menu, wxWindow *win)
+ : m_menu(menu)
+ {
+ menu.SetInvokingWindow(win);
+ }
+
+ // Dtor resets the invoking window.
+ ~wxMenuInvokingWindowSetter()
+ {
+ m_menu.SetInvokingWindow(NULL);
+ }
+
+private:
+ wxMenu& m_menu;
+
+ wxDECLARE_NO_COPY_CLASS(wxMenuInvokingWindowSetter);
+};
+
+#endif // wxUSE_MENUS
+
+#endif // _WX_MENU_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/menuitem.h
+// Purpose: wxMenuItem class
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 25.10.99
+// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_MENUITEM_H_BASE_
+#define _WX_MENUITEM_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_MENUS
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/object.h" // base class
+
+// ----------------------------------------------------------------------------
+// forward declarations
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxAcceleratorEntry;
+class WXDLLIMPEXP_FWD_CORE wxMenuItem;
+class WXDLLIMPEXP_FWD_CORE wxMenu;
+
+// ----------------------------------------------------------------------------
+// wxMenuItem is an item in the menu which may be either a normal item, a sub
+// menu or a separator
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxMenuItemBase : public wxObject
+{
+public:
+ // creation
+ static wxMenuItem *New(wxMenu *parentMenu = NULL,
+ int itemid = wxID_SEPARATOR,
+ const wxString& text = wxEmptyString,
+ const wxString& help = wxEmptyString,
+ wxItemKind kind = wxITEM_NORMAL,
+ wxMenu *subMenu = NULL);
+
+ // destruction: wxMenuItem will delete its submenu
+ virtual ~wxMenuItemBase();
+
+ // the menu we're in
+ wxMenu *GetMenu() const { return m_parentMenu; }
+ void SetMenu(wxMenu* menu) { m_parentMenu = menu; }
+
+ // get/set id
+ void SetId(int itemid) { m_id = itemid; }
+ int GetId() const { return m_id; }
+
+ // the item's text (or name)
+ //
+ // NB: the item's label includes the accelerators and mnemonics info (if
+ // any), i.e. it may contain '&' or '_' or "\t..." and thus is
+ // different from the item's text which only contains the text shown
+ // in the menu. This used to be called SetText.
+ virtual void SetItemLabel(const wxString& str);
+
+ // return the item label including any mnemonics and accelerators.
+ // This used to be called GetText.
+ virtual wxString GetItemLabel() const { return m_text; }
+
+ // return just the text of the item label, without any mnemonics
+ // This used to be called GetLabel.
+ virtual wxString GetItemLabelText() const { return GetLabelText(m_text); }
+
+ // return just the text part of the given label (implemented in platform-specific code)
+ // This used to be called GetLabelFromText.
+ static wxString GetLabelText(const wxString& label);
+
+ // what kind of menu item we are
+ wxItemKind GetKind() const { return m_kind; }
+ void SetKind(wxItemKind kind) { m_kind = kind; }
+ bool IsSeparator() const { return m_kind == wxITEM_SEPARATOR; }
+
+ bool IsCheck() const { return m_kind == wxITEM_CHECK; }
+ bool IsRadio() const { return m_kind == wxITEM_RADIO; }
+
+ virtual void SetCheckable(bool checkable)
+ { m_kind = checkable ? wxITEM_CHECK : wxITEM_NORMAL; }
+
+ // Notice that this doesn't quite match SetCheckable().
+ bool IsCheckable() const
+ { return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO; }
+
+ bool IsSubMenu() const { return m_subMenu != NULL; }
+ void SetSubMenu(wxMenu *menu) { m_subMenu = menu; }
+ wxMenu *GetSubMenu() const { return m_subMenu; }
+
+ // state
+ virtual void Enable(bool enable = true) { m_isEnabled = enable; }
+ virtual bool IsEnabled() const { return m_isEnabled; }
+
+ virtual void Check(bool check = true) { m_isChecked = check; }
+ virtual bool IsChecked() const { return m_isChecked; }
+ void Toggle() { Check(!m_isChecked); }
+
+ // help string (displayed in the status bar by default)
+ void SetHelp(const wxString& str);
+ const wxString& GetHelp() const { return m_help; }
+
+#if wxUSE_ACCEL
+ // extract the accelerator from the given menu string, return NULL if none
+ // found
+ static wxAcceleratorEntry *GetAccelFromString(const wxString& label);
+
+ // get our accelerator or NULL (caller must delete the pointer)
+ virtual wxAcceleratorEntry *GetAccel() const;
+
+ // set the accel for this item - this may also be done indirectly with
+ // SetText()
+ virtual void SetAccel(wxAcceleratorEntry *accel);
+#endif // wxUSE_ACCEL
+
+#if WXWIN_COMPATIBILITY_2_8
+ // compatibility only, use new functions in the new code
+ wxDEPRECATED( void SetName(const wxString& str) );
+ wxDEPRECATED( wxString GetName() const );
+
+ // Now use GetItemLabelText
+ wxDEPRECATED( wxString GetLabel() const ) ;
+
+ // Now use GetItemLabel
+ wxDEPRECATED( const wxString& GetText() const );
+
+ // Now use GetLabelText to strip the accelerators
+ static wxDEPRECATED( wxString GetLabelFromText(const wxString& text) );
+
+ // Now use SetItemLabel
+ wxDEPRECATED( virtual void SetText(const wxString& str) );
+#endif // WXWIN_COMPATIBILITY_2_8
+
+ static wxMenuItem *New(wxMenu *parentMenu,
+ int itemid,
+ const wxString& text,
+ const wxString& help,
+ bool isCheckable,
+ wxMenu *subMenu = NULL)
+ {
+ return New(parentMenu, itemid, text, help,
+ isCheckable ? wxITEM_CHECK : wxITEM_NORMAL, subMenu);
+ }
+
+protected:
+ wxWindowIDRef m_id; // numeric id of the item >= 0 or wxID_ANY or wxID_SEPARATOR
+ wxMenu *m_parentMenu, // the menu we belong to
+ *m_subMenu; // our sub menu or NULL
+ wxString m_text, // label of the item
+ m_help; // the help string for the item
+ wxItemKind m_kind; // separator/normal/check/radio item?
+ bool m_isChecked; // is checked?
+ bool m_isEnabled; // is enabled?
+
+ // this ctor is for the derived classes only, we're never created directly
+ wxMenuItemBase(wxMenu *parentMenu = NULL,
+ int itemid = wxID_SEPARATOR,
+ const wxString& text = wxEmptyString,
+ const wxString& help = wxEmptyString,
+ wxItemKind kind = wxITEM_NORMAL,
+ wxMenu *subMenu = NULL);
+
+private:
+ // and, if we have one ctor, compiler won't generate a default copy one, so
+ // declare them ourselves - but don't implement as they shouldn't be used
+ wxMenuItemBase(const wxMenuItemBase& item);
+ wxMenuItemBase& operator=(const wxMenuItemBase& item);
+};
+
+#if WXWIN_COMPATIBILITY_2_8
+inline void wxMenuItemBase::SetName(const wxString &str)
+ { SetItemLabel(str); }
+inline wxString wxMenuItemBase::GetName() const
+ { return GetItemLabel(); }
+inline wxString wxMenuItemBase::GetLabel() const
+ { return GetLabelText(m_text); }
+inline const wxString& wxMenuItemBase::GetText() const { return m_text; }
+inline void wxMenuItemBase::SetText(const wxString& text) { SetItemLabel(text); }
+#endif // WXWIN_COMPATIBILITY_2_8
+
+// ----------------------------------------------------------------------------
+// include the real class declaration
+// ----------------------------------------------------------------------------
+
+#ifdef wxUSE_BASE_CLASSES_ONLY
+ #define wxMenuItem wxMenuItemBase
+#else // !wxUSE_BASE_CLASSES_ONLY
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/menuitem.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/menuitem.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/menuitem.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/menuitem.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/menuitem.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/menuitem.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/menuitem.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/menuitem.h"
+#endif
+#endif // wxUSE_BASE_CLASSES_ONLY/!wxUSE_BASE_CLASSES_ONLY
+
+#endif // wxUSE_MENUS
+
+#endif
+ // _WX_MENUITEM_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/meta/convertible.h
+// Purpose: Test if types are convertible
+// Author: Arne Steinarson
+// Created: 2008-01-10
+// Copyright: (c) 2008 Arne Steinarson
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_META_CONVERTIBLE_H_
+#define _WX_META_CONVERTIBLE_H_
+
+//
+// Introduce an extra class to make this header compilable with g++3.2
+//
+template <class D, class B>
+struct wxConvertibleTo_SizeHelper
+{
+ static char Match(B* pb);
+ static int Match(...);
+};
+
+// Helper to decide if an object of type D is convertible to type B (the test
+// succeeds in particular when D derives from B)
+template <class D, class B>
+struct wxConvertibleTo
+{
+ enum
+ {
+ value =
+ sizeof(wxConvertibleTo_SizeHelper<D,B>::Match(static_cast<D*>(NULL)))
+ ==
+ sizeof(char)
+ };
+};
+
+#endif // _WX_META_CONVERTIBLE_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/meta/if.h
+// Purpose: declares wxIf<> metaprogramming construct
+// Author: Vaclav Slavik
+// Created: 2008-01-22
+// Copyright: (c) 2008 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_META_IF_H_
+#define _WX_META_IF_H_
+
+#include "wx/defs.h"
+
+// NB: This code is intentionally written without partial templates
+// specialization, because some older compilers (notably VC6) don't
+// support it.
+
+namespace wxPrivate
+{
+
+template <bool Cond>
+struct wxIfImpl
+
+// broken VC6 needs not just an incomplete template class declaration but a
+// "skeleton" declaration of the specialized versions below as it apparently
+// tries to look up the types in the generic template definition at some moment
+// even though it ends up by using the correct specialization in the end -- but
+// without this skeleton it doesn't recognize Result as a class at all below
+#if defined(__VISUALC__) && !wxCHECK_VISUALC_VERSION(7)
+{
+ template<typename TTrue, typename TFalse> struct Result {};
+}
+#endif // VC++ <= 6
+;
+
+// specialization for true:
+template <>
+struct wxIfImpl<true>
+{
+ template<typename TTrue, typename TFalse> struct Result
+ {
+ typedef TTrue value;
+ };
+};
+
+// specialization for false:
+template<>
+struct wxIfImpl<false>
+{
+ template<typename TTrue, typename TFalse> struct Result
+ {
+ typedef TFalse value;
+ };
+};
+
+} // namespace wxPrivate
+
+// wxIf<> template defines nested type "value" which is the same as
+// TTrue if the condition Cond (boolean compile-time constant) was met and
+// TFalse if it wasn't.
+//
+// See wxVector<T> in vector.h for usage example
+template<bool Cond, typename TTrue, typename TFalse>
+struct wxIf
+{
+ typedef typename wxPrivate::wxIfImpl<Cond>
+ ::template Result<TTrue, TFalse>::value
+ value;
+};
+
+#endif // _WX_META_IF_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/meta/implicitconversion.h
+// Purpose: Determine resulting type from implicit conversion
+// Author: Vaclav Slavik
+// Created: 2010-10-22
+// Copyright: (c) 2010 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_META_IMPLICITCONVERSION_H_
+#define _WX_META_IMPLICITCONVERSION_H_
+
+#include "wx/defs.h"
+#include "wx/meta/if.h"
+
+// C++ hierarchy of data types is:
+//
+// Long double (highest)
+// Double
+// Float
+// Unsigned long int
+// Long int
+// Unsigned int
+// Int (lowest)
+//
+// Types lower in the hierarchy are converted into ones higher up if both are
+// involved e.g. in arithmetic expressions.
+
+namespace wxPrivate
+{
+
+// Helper macro to define a constant inside a template class: it's needed
+// because MSVC6 doesn't support initializing static integer members but the
+// usual workaround of using enums instead doesn't work for Borland (at least
+// in template classes).
+#ifdef __VISUALC6__
+ #define wxDEFINE_CLASS_INT_CONST(name, value) enum { name = value }
+#else
+ #define wxDEFINE_CLASS_INT_CONST(name, value) static const int name = value
+#endif
+
+template<typename T>
+struct TypeHierarchy
+{
+ // consider unknown types (e.g. objects, pointers) to be of highest
+ // level, always convert to them if they occur
+ wxDEFINE_CLASS_INT_CONST( level, 9999 );
+};
+
+#define WX_TYPE_HIERARCHY_LEVEL(level_num, type) \
+ template<> struct TypeHierarchy<type> \
+ { \
+ wxDEFINE_CLASS_INT_CONST( level, level_num ); \
+ }
+
+WX_TYPE_HIERARCHY_LEVEL( 1, char);
+WX_TYPE_HIERARCHY_LEVEL( 2, unsigned char);
+WX_TYPE_HIERARCHY_LEVEL( 3, short);
+WX_TYPE_HIERARCHY_LEVEL( 4, unsigned short);
+WX_TYPE_HIERARCHY_LEVEL( 5, int);
+WX_TYPE_HIERARCHY_LEVEL( 6, unsigned int);
+WX_TYPE_HIERARCHY_LEVEL( 7, long);
+WX_TYPE_HIERARCHY_LEVEL( 8, unsigned long);
+#ifdef wxLongLong_t
+WX_TYPE_HIERARCHY_LEVEL( 9, wxLongLong_t);
+WX_TYPE_HIERARCHY_LEVEL(10, wxULongLong_t);
+#endif
+WX_TYPE_HIERARCHY_LEVEL(11, float);
+WX_TYPE_HIERARCHY_LEVEL(12, double);
+WX_TYPE_HIERARCHY_LEVEL(13, long double);
+
+#if wxWCHAR_T_IS_REAL_TYPE
+ #if SIZEOF_WCHAR_T == SIZEOF_SHORT
+ template<> struct TypeHierarchy<wchar_t> : public TypeHierarchy<short> {};
+ #elif SIZEOF_WCHAR_T == SIZEOF_INT
+ template<> struct TypeHierarchy<wchar_t> : public TypeHierarchy<int> {};
+ #elif SIZEOF_WCHAR_T == SIZEOF_LONG
+ template<> struct TypeHierarchy<wchar_t> : public TypeHierarchy<long> {};
+ #else
+ #error "weird wchar_t size, please update this code"
+ #endif
+#endif
+
+#undef WX_TYPE_HIERARCHY_LEVEL
+
+} // namespace wxPrivate
+
+// Helper to determine resulting type of implicit conversion in
+// an expression with two arithmetic types.
+template<typename T1, typename T2>
+struct wxImplicitConversionType
+{
+ typedef typename wxIf
+ <
+ // if T2 is "higher" type, convert to it
+ (int)(wxPrivate::TypeHierarchy<T1>::level) < (int)(wxPrivate::TypeHierarchy<T2>::level),
+ T2,
+ // otherwise use T1
+ T1
+ >::value
+ value;
+};
+
+
+template<typename T1, typename T2, typename T3>
+struct wxImplicitConversionType3 : public wxImplicitConversionType<
+ T1,
+ typename wxImplicitConversionType<T2,T3>::value>
+{
+};
+
+#endif // _WX_META_IMPLICITCONVERSION_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/meta/int2type.h
+// Purpose: Generate a unique type from a constant integer
+// Author: Arne Steinarson
+// Created: 2008-01-10
+// Copyright: (c) 2008 Arne Steinarson
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_META_INT2TYPE_H_
+#define _WX_META_INT2TYPE_H_
+
+template <int N>
+struct wxInt2Type { enum { value=N }; };
+
+#endif // _WX_META_INT2TYPE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/meta/movable.h
+// Purpose: Test if a type is movable using memmove() etc.
+// Author: Vaclav Slavik
+// Created: 2008-01-21
+// Copyright: (c) 2008 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_META_MOVABLE_H_
+#define _WX_META_MOVABLE_H_
+
+#include "wx/meta/pod.h"
+#include "wx/string.h" // for wxIsMovable<wxString> specialization
+
+// Helper to decide if an object of type T is "movable", i.e. if it can be
+// copied to another memory location using memmove() or realloc() C functions.
+// C++ only gurantees that POD types (including primitive types) are
+// movable.
+template<typename T>
+struct wxIsMovable
+{
+ wxDEFINE_TEMPLATE_BOOL_VALUE(wxIsPod<T>::value);
+};
+
+// Macro to add wxIsMovable<T> specialization for given type that marks it
+// as movable:
+#define WX_DECLARE_TYPE_MOVABLE(type) \
+ template<> struct wxIsMovable<type> \
+ { \
+ wxDEFINE_TEMPLATE_BOOL_VALUE(true); \
+ };
+
+// Our implementation of wxString is written in such way that it's safe to move
+// it around (unless position cache is used which unfortunately breaks this).
+// OTOH, we don't know anything about std::string.
+// (NB: we don't put this into string.h and choose to include wx/string.h from
+// here instead so that rarely-used wxIsMovable<T> code isn't included by
+// everything)
+#if !wxUSE_STD_STRING && !wxUSE_STRING_POS_CACHE
+WX_DECLARE_TYPE_MOVABLE(wxString)
+#endif
+
+#endif // _WX_META_MOVABLE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/meta/pod.h
+// Purpose: Test if a type is POD
+// Author: Vaclav Slavik, Jaakko Salli
+// Created: 2010-06-14
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_META_POD_H_
+#define _WX_META_POD_H_
+
+#include "wx/defs.h"
+
+//
+// TODO: Use TR1 is_pod<> implementation where available. VC9 SP1 has it
+// in tr1 namespace, VC10 has it in std namespace. GCC 4.2 has it in
+// <tr1/type_traits>, while GCC 4.3 and later have it in <type_traits>.
+//
+
+// This macro declares something called "value" inside a class declaration.
+//
+// It has to be used because VC6 doesn't handle initialization of the static
+// variables in the class declaration itself while BCC5.82 doesn't understand
+// enums (it compiles the template fine but can't use it later)
+#if defined(__VISUALC__) && !wxCHECK_VISUALC_VERSION(7)
+ #define wxDEFINE_TEMPLATE_BOOL_VALUE(val) enum { value = val }
+#else
+ #define wxDEFINE_TEMPLATE_BOOL_VALUE(val) static const bool value = val
+#endif
+
+// Helper to decide if an object of type T is POD (Plain Old Data)
+template<typename T>
+struct wxIsPod
+{
+ wxDEFINE_TEMPLATE_BOOL_VALUE(false);
+};
+
+// Macro to add wxIsPod<T> specialization for given type that marks it
+// as Plain Old Data:
+#define WX_DECLARE_TYPE_POD(type) \
+ template<> struct wxIsPod<type> \
+ { \
+ wxDEFINE_TEMPLATE_BOOL_VALUE(true); \
+ };
+
+WX_DECLARE_TYPE_POD(bool)
+WX_DECLARE_TYPE_POD(unsigned char)
+WX_DECLARE_TYPE_POD(signed char)
+WX_DECLARE_TYPE_POD(unsigned int)
+WX_DECLARE_TYPE_POD(signed int)
+WX_DECLARE_TYPE_POD(unsigned short int)
+WX_DECLARE_TYPE_POD(signed short int)
+WX_DECLARE_TYPE_POD(signed long int)
+WX_DECLARE_TYPE_POD(unsigned long int)
+WX_DECLARE_TYPE_POD(float)
+WX_DECLARE_TYPE_POD(double)
+WX_DECLARE_TYPE_POD(long double)
+#if wxWCHAR_T_IS_REAL_TYPE
+WX_DECLARE_TYPE_POD(wchar_t)
+#endif
+#ifdef wxLongLong_t
+WX_DECLARE_TYPE_POD(wxLongLong_t)
+WX_DECLARE_TYPE_POD(wxULongLong_t)
+#endif
+
+// Visual C++ 6.0 can't compile partial template specializations and as this is
+// only an optimization, we can live with pointers not being recognized as
+// POD types under VC6
+#if !defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7)
+
+// pointers are Plain Old Data:
+template<typename T>
+struct wxIsPod<T*>
+{
+ static const bool value = true;
+};
+
+template<typename T>
+struct wxIsPod<const T*>
+{
+ static const bool value = true;
+};
+
+#endif // !VC++ < 7
+
+#endif // _WX_META_POD_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/meta/removeref.h
+// Purpose: Allows to remove a reference from a type.
+// Author: Vadim Zeitlin
+// Created: 2012-10-21
+// Copyright: (c) 2012 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_META_REMOVEREF_H_
+#define _WX_META_REMOVEREF_H_
+
+// wxRemoveRef<> is similar to C++11 std::remove_reference<> but works with all
+// compilers (but, to compensate for this, doesn't work with rvalue references).
+
+// Except that it doesn't work with VC++ 6 as there doesn't seem to be any way
+// to partially specialize a template for references with it.
+#ifndef __VISUALC6__
+
+template <typename T>
+struct wxRemoveRef
+{
+ typedef T type;
+};
+
+template <typename T>
+struct wxRemoveRef<T&>
+{
+ typedef T type;
+};
+
+#define wxHAS_REMOVEREF
+
+#endif // !__VISUALC6__
+
+#endif // _WX_META_REMOVEREF_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/metafile.h
+// Purpose: wxMetaFile class declaration
+// Author: wxWidgets team
+// Modified by:
+// Created: 13.01.00
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_METAFILE_H_BASE_
+#define _WX_METAFILE_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_METAFILE
+
+// provide synonyms for all metafile classes
+#define wxMetaFile wxMetafile
+#define wxMetaFileDC wxMetafileDC
+#define wxMetaFileDataObject wxMetafileDataObject
+
+#define wxMakeMetaFilePlaceable wxMakeMetafilePlaceable
+
+#if defined(__WXMSW__)
+ #if wxUSE_ENH_METAFILE
+ #include "wx/msw/enhmeta.h"
+
+ #if wxUSE_WIN_METAFILES_ALWAYS
+ // use normal metafiles as well
+ #include "wx/msw/metafile.h"
+ #else // also map all metafile classes to enh metafile
+ typedef wxEnhMetaFile wxMetafile;
+ typedef wxEnhMetaFileDC wxMetafileDC;
+ #if wxUSE_DRAG_AND_DROP
+ typedef wxEnhMetaFileDataObject wxMetafileDataObject;
+ #endif
+
+ // this flag will be set if wxMetafile class is wxEnhMetaFile
+ #define wxMETAFILE_IS_ENH
+ #endif // wxUSE_WIN_METAFILES_ALWAYS
+ #else // !wxUSE_ENH_METAFILE
+ #include "wx/msw/metafile.h"
+ #endif
+#elif defined(__WXPM__)
+ #include "wx/os2/metafile.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/metafile.h"
+#endif
+
+#endif // wxUSE_METAFILE
+
+#endif // _WX_METAFILE_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/mimetype.h
+// Purpose: classes and functions to manage MIME types
+// Author: Vadim Zeitlin
+// Modified by:
+// Chris Elliott (biol75@york.ac.uk) 5 Dec 00: write support for Win32
+// Created: 23.09.98
+// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence (part of wxExtra library)
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_MIMETYPE_H_
+#define _WX_MIMETYPE_H_
+
+// ----------------------------------------------------------------------------
+// headers and such
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_MIMETYPE
+
+// the things we really need
+#include "wx/string.h"
+#include "wx/dynarray.h"
+#include "wx/arrstr.h"
+
+#include <stdarg.h>
+
+// fwd decls
+class WXDLLIMPEXP_FWD_BASE wxIconLocation;
+class WXDLLIMPEXP_FWD_BASE wxFileTypeImpl;
+class WXDLLIMPEXP_FWD_BASE wxMimeTypesManagerImpl;
+
+// these constants define the MIME informations source under UNIX and are used
+// by wxMimeTypesManager::Initialize()
+enum wxMailcapStyle
+{
+ wxMAILCAP_STANDARD = 1,
+ wxMAILCAP_NETSCAPE = 2,
+ wxMAILCAP_KDE = 4,
+ wxMAILCAP_GNOME = 8,
+
+ wxMAILCAP_ALL = 15
+};
+
+/*
+ TODO: would it be more convenient to have this class?
+
+class WXDLLIMPEXP_BASE wxMimeType : public wxString
+{
+public:
+ // all string ctors here
+
+ wxString GetType() const { return BeforeFirst(wxT('/')); }
+ wxString GetSubType() const { return AfterFirst(wxT('/')); }
+
+ void SetSubType(const wxString& subtype)
+ {
+ *this = GetType() + wxT('/') + subtype;
+ }
+
+ bool Matches(const wxMimeType& wildcard)
+ {
+ // implement using wxMimeTypesManager::IsOfType()
+ }
+};
+
+*/
+
+// wxMimeTypeCommands stores the verbs defined for the given MIME type with
+// their values
+class WXDLLIMPEXP_BASE wxMimeTypeCommands
+{
+public:
+ wxMimeTypeCommands() {}
+
+ wxMimeTypeCommands(const wxArrayString& verbs,
+ const wxArrayString& commands)
+ : m_verbs(verbs),
+ m_commands(commands)
+ {
+ }
+
+ // add a new verb with the command or replace the old value
+ void AddOrReplaceVerb(const wxString& verb, const wxString& cmd);
+ void Add(const wxString& s)
+ {
+ m_verbs.Add(s.BeforeFirst(wxT('=')));
+ m_commands.Add(s.AfterFirst(wxT('=')));
+ }
+
+ // access the commands
+ size_t GetCount() const { return m_verbs.GetCount(); }
+ const wxString& GetVerb(size_t n) const { return m_verbs[n]; }
+ const wxString& GetCmd(size_t n) const { return m_commands[n]; }
+
+ bool HasVerb(const wxString& verb) const
+ { return m_verbs.Index(verb) != wxNOT_FOUND; }
+
+ // returns empty string and wxNOT_FOUND in idx if no such verb
+ wxString GetCommandForVerb(const wxString& verb, size_t *idx = NULL) const;
+
+ // get a "verb=command" string
+ wxString GetVerbCmd(size_t n) const;
+
+private:
+ wxArrayString m_verbs;
+ wxArrayString m_commands;
+};
+
+// ----------------------------------------------------------------------------
+// wxFileTypeInfo: static container of information accessed via wxFileType.
+//
+// This class is used with wxMimeTypesManager::AddFallbacks() and Associate()
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxFileTypeInfo
+{
+private:
+ void DoVarArgInit(const wxString& mimeType,
+ const wxString& openCmd,
+ const wxString& printCmd,
+ const wxString& desc,
+ va_list argptr);
+
+ void VarArgInit(const wxString *mimeType,
+ const wxString *openCmd,
+ const wxString *printCmd,
+ const wxString *desc,
+ // the other parameters form a NULL terminated list of
+ // extensions
+ ...);
+
+public:
+ // NB: This is a helper to get implicit conversion of variadic ctor's
+ // fixed arguments into something that can be passed to VarArgInit().
+ // Do not use, it's used by the ctor only.
+ struct CtorString
+ {
+ CtorString(const char *str) : m_str(str) {}
+ CtorString(const wchar_t *str) : m_str(str) {}
+ CtorString(const wxString& str) : m_str(str) {}
+ CtorString(const wxCStrData& str) : m_str(str) {}
+ CtorString(const wxScopedCharBuffer& str) : m_str(str) {}
+ CtorString(const wxScopedWCharBuffer& str) : m_str(str) {}
+
+ operator const wxString*() const { return &m_str; }
+
+ wxString m_str;
+ };
+
+ // ctors
+
+ // Ctor specifying just the MIME type (which is mandatory), the other
+ // fields can be set later if needed.
+ wxFileTypeInfo(const wxString& mimeType)
+ : m_mimeType(mimeType)
+ {
+ }
+
+ // Ctor allowing to specify the values of all fields at once:
+ //
+ // wxFileTypeInfo(const wxString& mimeType,
+ // const wxString& openCmd,
+ // const wxString& printCmd,
+ // const wxString& desc,
+ // // the other parameters form a list of extensions for this
+ // // file type and should be terminated with wxNullPtr (not
+ // // just NULL!)
+ // ...);
+ WX_DEFINE_VARARG_FUNC_CTOR(wxFileTypeInfo,
+ 4, (const CtorString&,
+ const CtorString&,
+ const CtorString&,
+ const CtorString&),
+ VarArgInit, VarArgInit)
+#ifdef __WATCOMC__
+ // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
+ WX_VARARG_WATCOM_WORKAROUND_CTOR(
+ wxFileTypeInfo,
+ 4, (const wxString&,
+ const wxString&,
+ const wxString&,
+ const wxString&),
+ (CtorString(f1),
+ CtorString(f2),
+ CtorString(f3),
+ CtorString(f4)));
+ WX_VARARG_WATCOM_WORKAROUND_CTOR(
+ wxFileTypeInfo,
+ 4, (const wxCStrData&,
+ const wxCStrData&,
+ const wxCStrData&,
+ const wxCStrData&),
+ (CtorString(f1),
+ CtorString(f2),
+ CtorString(f3),
+ CtorString(f4)));
+ WX_VARARG_WATCOM_WORKAROUND_CTOR(
+ wxFileTypeInfo,
+ 4, (const char*,
+ const char*,
+ const char*,
+ const char*),
+ (CtorString(f1),
+ CtorString(f2),
+ CtorString(f3),
+ CtorString(f4)));
+ WX_VARARG_WATCOM_WORKAROUND_CTOR(
+ wxFileTypeInfo,
+ 4, (const wchar_t*,
+ const wchar_t*,
+ const wchar_t*,
+ const wchar_t*),
+ (CtorString(f1),
+ CtorString(f2),
+ CtorString(f3),
+ CtorString(f4)));
+#endif
+
+ // the array elements correspond to the parameters of the ctor above in
+ // the same order
+ wxFileTypeInfo(const wxArrayString& sArray);
+
+ // invalid item - use this to terminate the array passed to
+ // wxMimeTypesManager::AddFallbacks
+ wxFileTypeInfo() { }
+
+ // test if this object can be used
+ bool IsValid() const { return !m_mimeType.empty(); }
+
+ // setters
+ // set the open/print commands
+ void SetOpenCommand(const wxString& command) { m_openCmd = command; }
+ void SetPrintCommand(const wxString& command) { m_printCmd = command; }
+
+ // set the description
+ void SetDescription(const wxString& desc) { m_desc = desc; }
+
+ // add another extension corresponding to this file type
+ void AddExtension(const wxString& ext) { m_exts.push_back(ext); }
+
+ // set the icon info
+ void SetIcon(const wxString& iconFile, int iconIndex = 0)
+ {
+ m_iconFile = iconFile;
+ m_iconIndex = iconIndex;
+ }
+ // set the short desc
+ void SetShortDesc(const wxString& shortDesc) { m_shortDesc = shortDesc; }
+
+ // accessors
+ // get the MIME type
+ const wxString& GetMimeType() const { return m_mimeType; }
+ // get the open command
+ const wxString& GetOpenCommand() const { return m_openCmd; }
+ // get the print command
+ const wxString& GetPrintCommand() const { return m_printCmd; }
+ // get the short description (only used under Win32 so far)
+ const wxString& GetShortDesc() const { return m_shortDesc; }
+ // get the long, user visible description
+ const wxString& GetDescription() const { return m_desc; }
+ // get the array of all extensions
+ const wxArrayString& GetExtensions() const { return m_exts; }
+ size_t GetExtensionsCount() const {return m_exts.GetCount(); }
+ // get the icon info
+ const wxString& GetIconFile() const { return m_iconFile; }
+ int GetIconIndex() const { return m_iconIndex; }
+
+private:
+ wxString m_mimeType, // the MIME type in "type/subtype" form
+ m_openCmd, // command to use for opening the file (%s allowed)
+ m_printCmd, // command to use for printing the file (%s allowed)
+ m_shortDesc, // a short string used in the registry
+ m_desc; // a free form description of this file type
+
+ // icon stuff
+ wxString m_iconFile; // the file containing the icon
+ int m_iconIndex; // icon index in this file
+
+ wxArrayString m_exts; // the extensions which are mapped on this filetype
+
+
+#if 0 // TODO
+ // the additional (except "open" and "print") command names and values
+ wxArrayString m_commandNames,
+ m_commandValues;
+#endif // 0
+};
+
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxFileTypeInfo, wxArrayFileTypeInfo,
+ WXDLLIMPEXP_BASE);
+
+// ----------------------------------------------------------------------------
+// wxFileType: gives access to all information about the files of given type.
+//
+// This class holds information about a given "file type". File type is the
+// same as MIME type under Unix, but under Windows it corresponds more to an
+// extension than to MIME type (in fact, several extensions may correspond to a
+// file type). This object may be created in many different ways and depending
+// on how it was created some fields may be unknown so the return value of all
+// the accessors *must* be checked!
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxFileType
+{
+friend class WXDLLIMPEXP_FWD_BASE wxMimeTypesManagerImpl; // it has access to m_impl
+
+public:
+ // An object of this class must be passed to Get{Open|Print}Command. The
+ // default implementation is trivial and doesn't know anything at all about
+ // parameters, only filename and MIME type are used (so it's probably ok for
+ // Windows where %{param} is not used anyhow)
+ class MessageParameters
+ {
+ public:
+ // ctors
+ MessageParameters() { }
+ MessageParameters(const wxString& filename,
+ const wxString& mimetype = wxEmptyString)
+ : m_filename(filename), m_mimetype(mimetype) { }
+
+ // accessors (called by GetOpenCommand)
+ // filename
+ const wxString& GetFileName() const { return m_filename; }
+ // mime type
+ const wxString& GetMimeType() const { return m_mimetype; }
+
+ // override this function in derived class
+ virtual wxString GetParamValue(const wxString& WXUNUSED(name)) const
+ { return wxEmptyString; }
+
+ // virtual dtor as in any base class
+ virtual ~MessageParameters() { }
+
+ protected:
+ wxString m_filename, m_mimetype;
+ };
+
+ // ctor from static data
+ wxFileType(const wxFileTypeInfo& ftInfo);
+
+ // accessors: all of them return true if the corresponding information
+ // could be retrieved/found, false otherwise (and in this case all [out]
+ // parameters are unchanged)
+ // return the MIME type for this file type
+ bool GetMimeType(wxString *mimeType) const;
+ bool GetMimeTypes(wxArrayString& mimeTypes) const;
+ // fill passed in array with all extensions associated with this file
+ // type
+ bool GetExtensions(wxArrayString& extensions);
+ // get the icon corresponding to this file type and of the given size
+ bool GetIcon(wxIconLocation *iconloc) const;
+ bool GetIcon(wxIconLocation *iconloc,
+ const MessageParameters& params) const;
+ // get a brief file type description ("*.txt" => "text document")
+ bool GetDescription(wxString *desc) const;
+
+ // get the command to be used to open/print the given file.
+ // get the command to execute the file of given type
+ bool GetOpenCommand(wxString *openCmd,
+ const MessageParameters& params) const;
+ // a simpler to use version of GetOpenCommand() -- it only takes the
+ // filename and returns an empty string on failure
+ wxString GetOpenCommand(const wxString& filename) const;
+ // get the command to print the file of given type
+ bool GetPrintCommand(wxString *printCmd,
+ const MessageParameters& params) const;
+
+
+ // return the number of commands defined for this file type, 0 if none
+ size_t GetAllCommands(wxArrayString *verbs, wxArrayString *commands,
+ const wxFileType::MessageParameters& params) const;
+
+ // set an arbitrary command, ask confirmation if it already exists and
+ // overwriteprompt is true
+ bool SetCommand(const wxString& cmd, const wxString& verb,
+ bool overwriteprompt = true);
+
+ bool SetDefaultIcon(const wxString& cmd = wxEmptyString, int index = 0);
+
+
+ // remove the association for this filetype from the system MIME database:
+ // notice that it will only work if the association is defined in the user
+ // file/registry part, we will never modify the system-wide settings
+ bool Unassociate();
+
+ // operations
+ // expand a string in the format of GetOpenCommand (which may contain
+ // '%s' and '%t' format specifiers for the file name and mime type
+ // and %{param} constructions).
+ static wxString ExpandCommand(const wxString& command,
+ const MessageParameters& params);
+
+ // dtor (not virtual, shouldn't be derived from)
+ ~wxFileType();
+
+private:
+ // default ctor is private because the user code never creates us
+ wxFileType();
+
+ // no copy ctor/assignment operator
+ wxFileType(const wxFileType&);
+ wxFileType& operator=(const wxFileType&);
+
+ // the static container of wxFileType data: if it's not NULL, it means that
+ // this object is used as fallback only
+ const wxFileTypeInfo *m_info;
+
+ // the object which implements the real stuff like reading and writing
+ // to/from system MIME database
+ wxFileTypeImpl *m_impl;
+};
+
+//----------------------------------------------------------------------------
+// wxMimeTypesManagerFactory
+//----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMimeTypesManagerFactory
+{
+public:
+ wxMimeTypesManagerFactory() {}
+ virtual ~wxMimeTypesManagerFactory() {}
+
+ virtual wxMimeTypesManagerImpl *CreateMimeTypesManagerImpl();
+
+ static void Set( wxMimeTypesManagerFactory *factory );
+ static wxMimeTypesManagerFactory *Get();
+
+private:
+ static wxMimeTypesManagerFactory *m_factory;
+};
+
+// ----------------------------------------------------------------------------
+// wxMimeTypesManager: interface to system MIME database.
+//
+// This class accesses the information about all known MIME types and allows
+// the application to retrieve information (including how to handle data of
+// given type) about them.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMimeTypesManager
+{
+public:
+ // static helper functions
+ // -----------------------
+
+ // check if the given MIME type is the same as the other one: the
+ // second argument may contain wildcards ('*'), but not the first. If
+ // the types are equal or if the mimeType matches wildcard the function
+ // returns true, otherwise it returns false
+ static bool IsOfType(const wxString& mimeType, const wxString& wildcard);
+
+ // ctor
+ wxMimeTypesManager();
+
+ // NB: the following 2 functions are for Unix only and don't do anything
+ // elsewhere
+
+ // loads data from standard files according to the mailcap styles
+ // specified: this is a bitwise OR of wxMailcapStyle values
+ //
+ // use the extraDir parameter if you want to look for files in another
+ // directory
+ void Initialize(int mailcapStyle = wxMAILCAP_ALL,
+ const wxString& extraDir = wxEmptyString);
+
+ // and this function clears all the data from the manager
+ void ClearData();
+
+ // Database lookup: all functions return a pointer to wxFileType object
+ // whose methods may be used to query it for the information you're
+ // interested in. If the return value is !NULL, caller is responsible for
+ // deleting it.
+ // get file type from file extension
+ wxFileType *GetFileTypeFromExtension(const wxString& ext);
+ // get file type from MIME type (in format <category>/<format>)
+ wxFileType *GetFileTypeFromMimeType(const wxString& mimeType);
+
+ // enumerate all known MIME types
+ //
+ // returns the number of retrieved file types
+ size_t EnumAllFileTypes(wxArrayString& mimetypes);
+
+ // these functions can be used to provide default values for some of the
+ // MIME types inside the program itself
+ //
+ // The filetypes array should be terminated by either NULL entry or an
+ // invalid wxFileTypeInfo (i.e. the one created with default ctor)
+ void AddFallbacks(const wxFileTypeInfo *filetypes);
+ void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); }
+
+ // create or remove associations
+
+ // create a new association using the fields of wxFileTypeInfo (at least
+ // the MIME type and the extension should be set)
+ // if the other fields are empty, the existing values should be left alone
+ wxFileType *Associate(const wxFileTypeInfo& ftInfo);
+
+ // undo Associate()
+ bool Unassociate(wxFileType *ft) ;
+
+ // dtor (not virtual, shouldn't be derived from)
+ ~wxMimeTypesManager();
+
+private:
+ // no copy ctor/assignment operator
+ wxMimeTypesManager(const wxMimeTypesManager&);
+ wxMimeTypesManager& operator=(const wxMimeTypesManager&);
+
+ // the fallback info which is used if the information is not found in the
+ // real system database
+ wxArrayFileTypeInfo m_fallbacks;
+
+ // the object working with the system MIME database
+ wxMimeTypesManagerImpl *m_impl;
+
+ // if m_impl is NULL, create one
+ void EnsureImpl();
+
+ friend class wxMimeTypeCmnModule;
+};
+
+
+// ----------------------------------------------------------------------------
+// global variables
+// ----------------------------------------------------------------------------
+
+// the default mime manager for wxWidgets programs
+extern WXDLLIMPEXP_DATA_BASE(wxMimeTypesManager *) wxTheMimeTypesManager;
+
+#endif // wxUSE_MIMETYPE
+
+#endif
+ //_WX_MIMETYPE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/minifram.h
+// Purpose: wxMiniFrame base header
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_MINIFRAM_H_BASE_
+#define _WX_MINIFRAM_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_MINIFRAME
+
+#if defined(__WXMSW__)
+#include "wx/msw/minifram.h"
+#elif defined(__WXMOTIF__)
+#include "wx/motif/minifram.h"
+#elif defined(__WXGTK20__)
+#include "wx/gtk/minifram.h"
+#elif defined(__WXGTK__)
+#include "wx/gtk1/minifram.h"
+#elif defined(__WXX11__)
+#include "wx/x11/minifram.h"
+#elif defined(__WXMAC__)
+#include "wx/osx/minifram.h"
+#elif defined(__WXPM__)
+#include "wx/os2/minifram.h"
+#else
+// TODO: it seems that wxMiniFrame could be just defined here generically
+// instead of having all the above port-specific headers
+#include "wx/frame.h"
+typedef wxFrame wxMiniFrame;
+#endif
+
+#endif // wxUSE_MINIFRAME
+#endif // _WX_MINIFRAM_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/modalhook.h
+// Purpose: Allows to hook into showing modal dialogs.
+// Author: Vadim Zeitlin
+// Created: 2013-05-19
+// Copyright: (c) 2013 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_MODALHOOK_H_
+#define _WX_MODALHOOK_H_
+
+#include "wx/vector.h"
+
+class WXDLLIMPEXP_FWD_CORE wxDialog;
+
+// ----------------------------------------------------------------------------
+// Class allowing to be notified about any modal dialog calls.
+// ----------------------------------------------------------------------------
+
+// To be notified about entering and exiting modal dialogs and possibly to
+// replace them with something else (e.g. just return a predefined value for
+// testing), define an object of this class, override its Enter() and
+// possibly Exit() methods and call Register() on it.
+class WXDLLIMPEXP_CORE wxModalDialogHook
+{
+public:
+ // Default ctor doesn't do anything, call Register() to activate the hook.
+ wxModalDialogHook() { }
+
+ // Dtor unregisters the hook if it had been registered.
+ virtual ~wxModalDialogHook() { DoUnregister(); }
+
+ // Register this hook as being active, i.e. its Enter() and Exit() methods
+ // will be called.
+ //
+ // Notice that the order of registration matters: the last hook registered
+ // is called first, and if its Enter() returns something != wxID_NONE, the
+ // subsequent hooks are skipped.
+ void Register();
+
+ // Unregister this hook. Notice that is done automatically from the dtor.
+ void Unregister();
+
+ // Called from wxWidgets code before showing any modal dialogs and calls
+ // Enter() for every registered hook.
+ static int CallEnter(wxDialog* dialog);
+
+ // Called from wxWidgets code after dismissing the dialog and calls Exit()
+ // for every registered hook.
+ static void CallExit(wxDialog* dialog);
+
+protected:
+ // Called by wxWidgets before showing any modal dialogs, override this to
+ // be notified about this and return anything but wxID_NONE to skip showing
+ // the modal dialog entirely and just return the specified result.
+ virtual int Enter(wxDialog* dialog) = 0;
+
+ // Called by wxWidgets after dismissing the modal dialog. Notice that it
+ // won't be called if Enter() hadn't been.
+ virtual void Exit(wxDialog* WXUNUSED(dialog)) { }
+
+private:
+ // Unregister the given hook, return true if it was done or false if the
+ // hook wasn't found.
+ bool DoUnregister();
+
+ // All the hooks in reverse registration order (i.e. in call order).
+ typedef wxVector<wxModalDialogHook*> Hooks;
+ static Hooks ms_hooks;
+
+ wxDECLARE_NO_COPY_CLASS(wxModalDialogHook);
+};
+
+// Helper object used by WX_MODAL_DIALOG_HOOK below to ensure that CallExit()
+// is called on scope exit.
+class wxModalDialogHookExitGuard
+{
+public:
+ wxEXPLICIT wxModalDialogHookExitGuard(wxDialog* dialog)
+ : m_dialog(dialog)
+ {
+ }
+
+ ~wxModalDialogHookExitGuard()
+ {
+ wxModalDialogHook::CallExit(m_dialog);
+ }
+
+private:
+ wxDialog* const m_dialog;
+
+ wxDECLARE_NO_COPY_CLASS(wxModalDialogHookExitGuard);
+};
+
+// This macro needs to be used at the top of every implementation of
+// ShowModal() in order for wxModalDialogHook to work.
+#define WX_HOOK_MODAL_DIALOG() \
+ const int modalDialogHookRC = wxModalDialogHook::CallEnter(this); \
+ if ( modalDialogHookRC != wxID_NONE ) \
+ return modalDialogHookRC; \
+ wxModalDialogHookExitGuard modalDialogHookExit(this)
+
+#endif // _WX_MODALHOOK_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/module.h
+// Purpose: Modules handling
+// Author: Wolfram Gloger/adapted by Guilhem Lavaux
+// Modified by:
+// Created: 04/11/98
+// Copyright: (c) Wolfram Gloger and Guilhem Lavaux
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_MODULE_H_
+#define _WX_MODULE_H_
+
+#include "wx/object.h"
+#include "wx/list.h"
+#include "wx/arrstr.h"
+#include "wx/dynarray.h"
+
+// declare a linked list of modules
+class WXDLLIMPEXP_FWD_BASE wxModule;
+WX_DECLARE_USER_EXPORTED_LIST(wxModule, wxModuleList, WXDLLIMPEXP_BASE);
+
+// and an array of class info objects
+WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxClassInfo *, wxArrayClassInfo,
+ class WXDLLIMPEXP_BASE);
+
+
+// declaring a class derived from wxModule will automatically create an
+// instance of this class on program startup, call its OnInit() method and call
+// OnExit() on program termination (but only if OnInit() succeeded)
+class WXDLLIMPEXP_BASE wxModule : public wxObject
+{
+public:
+ wxModule() {}
+ virtual ~wxModule() {}
+
+ // if module init routine returns false the application
+ // will fail to startup
+
+ bool Init() { return OnInit(); }
+ void Exit() { OnExit(); }
+
+ // Override both of these
+
+ // called on program startup
+
+ virtual bool OnInit() = 0;
+
+ // called just before program termination, but only if OnInit()
+ // succeeded
+
+ virtual void OnExit() = 0;
+
+ static void RegisterModule(wxModule *module);
+ static void RegisterModules();
+ static bool InitializeModules();
+ static void CleanUpModules() { DoCleanUpModules(m_modules); }
+
+ // used by wxObjectLoader when unloading shared libs's
+
+ static void UnregisterModule(wxModule *module);
+
+protected:
+ static wxModuleList m_modules;
+
+ // the function to call from constructor of a deriving class add module
+ // dependency which will be initialized before the module and unloaded
+ // after that
+ void AddDependency(wxClassInfo *dep)
+ {
+ wxCHECK_RET( dep, wxT("NULL module dependency") );
+
+ m_dependencies.Add(dep);
+ }
+
+ // same as the version above except it will look up wxClassInfo by name on
+ // its own
+ void AddDependency(const char *className)
+ {
+ m_namedDependencies.Add(className);
+ }
+
+
+private:
+ // initialize module and Append it to initializedModules list recursively
+ // calling itself to satisfy module dependencies if needed
+ static bool
+ DoInitializeModule(wxModule *module, wxModuleList &initializedModules);
+
+ // cleanup the modules in the specified list (which may not contain all
+ // modules if we're called during initialization because not all modules
+ // could be initialized) and also empty m_modules itself
+ static void DoCleanUpModules(const wxModuleList& modules);
+
+ // resolve all named dependencies and add them to the normal m_dependencies
+ bool ResolveNamedDependencies();
+
+
+ // module dependencies: contains wxClassInfo pointers for all modules which
+ // must be initialized before this one
+ wxArrayClassInfo m_dependencies;
+
+ // and the named dependencies: those will be resolved during run-time and
+ // added to m_dependencies
+ wxArrayString m_namedDependencies;
+
+ // used internally while initializing/cleaning up modules
+ enum
+ {
+ State_Registered, // module registered but not initialized yet
+ State_Initializing, // we're initializing this module but not done yet
+ State_Initialized // module initialized successfully
+ } m_state;
+
+
+ DECLARE_CLASS(wxModule)
+};
+
+#endif // _WX_MODULE_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/mousemanager.h
+// Purpose: wxMouseEventsManager class declaration
+// Author: Vadim Zeitlin
+// Created: 2009-04-20
+// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_MOUSEMANAGER_H_
+#define _WX_MOUSEMANAGER_H_
+
+#include "wx/event.h"
+
+// ----------------------------------------------------------------------------
+// wxMouseEventsManager
+// ----------------------------------------------------------------------------
+
+/*
+ This class handles mouse events and synthesizes high-level notifications
+ such as clicks and drag events from low level mouse button presses and
+ mouse movement events. It is useful because handling the mouse events is
+ less obvious than might seem at a first glance: for example, clicks on an
+ object should only be generated if the mouse was both pressed and released
+ over it and not just released (so it requires storing the previous state)
+ and dragging shouldn't start before the mouse moves away far enough.
+
+ This class encapsulates all these dull details for controls containing
+ multiple items which can be identified by a positive integer index and you
+ just need to implement its pure virtual functions to use it.
+ */
+class WXDLLIMPEXP_CORE wxMouseEventsManager : public wxEvtHandler
+{
+public:
+ // a mouse event manager is always associated with a window and must be
+ // deleted by the window when it is destroyed so if it is created using the
+ // default ctor Create() must be called later
+ wxMouseEventsManager() { Init(); }
+ wxMouseEventsManager(wxWindow *win) { Init(); Create(win); }
+ bool Create(wxWindow *win);
+
+ virtual ~wxMouseEventsManager();
+
+protected:
+ // called to find the item at the given position: return wxNOT_FOUND (-1)
+ // if there is no item here
+ virtual int MouseHitTest(const wxPoint& pos) = 0;
+
+ // called when the user clicked (i.e. pressed and released mouse over the
+ // same item), should normally generate a notification about this click and
+ // return true if it was handled or false otherwise, determining whether
+ // the original mouse event is skipped or not
+ virtual bool MouseClicked(int item) = 0;
+
+ // called to start dragging the given item, should generate the appropriate
+ // BEGIN_DRAG event and return false if dragging this item was forbidden
+ virtual bool MouseDragBegin(int item, const wxPoint& pos) = 0;
+
+ // called while the item is being dragged, should normally update the
+ // feedback on screen (usually using wxOverlay)
+ virtual void MouseDragging(int item, const wxPoint& pos) = 0;
+
+ // called when the mouse is released after dragging the item
+ virtual void MouseDragEnd(int item, const wxPoint& pos) = 0;
+
+ // called when mouse capture is lost while dragging the item, should remove
+ // the visual feedback drawn by MouseDragging()
+ virtual void MouseDragCancelled(int item) = 0;
+
+
+ // you don't need to override those but you will want to do if it your
+ // control renders pressed items differently
+
+ // called when the item is becomes pressed, can be used to change its
+ // appearance
+ virtual void MouseClickBegin(int WXUNUSED(item)) { }
+
+ // called if the mouse capture was lost while the item was pressed, can be
+ // used to restore the default item appearance if it was changed in
+ // MouseClickBegin()
+ virtual void MouseClickCancelled(int WXUNUSED(item)) { }
+
+private:
+ /*
+ Here is a small diagram explaining the switches between different
+ states:
+
+
+ /---------->NORMAL<--------------- Drag end
+ / / / | event
+ / / | | ^
+ / / | | |
+ Click / N | | mouse | mouse up
+ event / | | down |
+ | / | | DRAGGING
+ | / | | ^
+ Y|/ N \ v |Y
+ +-------------+ +--------+ N +-----------+
+ |On same item?| |On item?| -----------|Begin drag?|
+ +-------------+ +--------+ / +-----------+
+ ^ | / ^
+ | | / |
+ \ mouse | / mouse moved |
+ \ up v v far enough /
+ \--------PRESSED-------------------/
+
+
+ There are also transitions from PRESSED and DRAGGING to NORMAL in case
+ the mouse capture is lost or Escape key is pressed which are not shown.
+ */
+ enum State
+ {
+ State_Normal, // initial, default state
+ State_Pressed, // mouse was pressed over an item
+ State_Dragging // the item is being dragged
+ };
+
+ // common part of both ctors
+ void Init();
+
+ // various event handlers
+ void OnCaptureLost(wxMouseCaptureLostEvent& event);
+ void OnLeftDown(wxMouseEvent& event);
+ void OnLeftUp(wxMouseEvent& event);
+ void OnMove(wxMouseEvent& event);
+
+
+ // the associated window, never NULL except between the calls to the
+ // default ctor and Create()
+ wxWindow *m_win;
+
+ // the current state
+ State m_state;
+
+ // the details of the operation currently in progress, only valid if
+ // m_state is not normal
+
+ // the item being pressed or dragged (always valid, i.e. != wxNOT_FOUND if
+ // m_state != State_Normal)
+ int m_item;
+
+ // the position of the last mouse event of interest: either mouse press in
+ // State_Pressed or last movement event in State_Dragging
+ wxPoint m_posLast;
+
+
+ DECLARE_EVENT_TABLE()
+
+ wxDECLARE_NO_COPY_CLASS(wxMouseEventsManager);
+};
+
+#endif // _WX_MOUSEMANAGER_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/mousestate.h
+// Purpose: Declaration of wxMouseState class
+// Author: Vadim Zeitlin
+// Created: 2008-09-19 (extracted from wx/utils.h)
+// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_MOUSESTATE_H_
+#define _WX_MOUSESTATE_H_
+
+#include "wx/gdicmn.h" // for wxPoint
+#include "wx/kbdstate.h"
+
+// the symbolic names for the mouse buttons
+enum wxMouseButton
+{
+ wxMOUSE_BTN_ANY = -1,
+ wxMOUSE_BTN_NONE = 0,
+ wxMOUSE_BTN_LEFT = 1,
+ wxMOUSE_BTN_MIDDLE = 2,
+ wxMOUSE_BTN_RIGHT = 3,
+ wxMOUSE_BTN_AUX1 = 4,
+ wxMOUSE_BTN_AUX2 = 5,
+ wxMOUSE_BTN_MAX
+};
+
+// ----------------------------------------------------------------------------
+// wxMouseState contains the information about mouse position, buttons and also
+// key modifiers
+// ----------------------------------------------------------------------------
+
+// wxMouseState is used to hold information about button and modifier state
+// and is what is returned from wxGetMouseState.
+class WXDLLIMPEXP_CORE wxMouseState : public wxKeyboardState
+{
+public:
+ wxMouseState()
+ : m_leftDown(false), m_middleDown(false), m_rightDown(false),
+ m_aux1Down(false), m_aux2Down(false),
+ m_x(0), m_y(0)
+ {
+ }
+
+ // default copy ctor, assignment operator and dtor are ok
+
+
+ // accessors for the mouse position
+ wxCoord GetX() const { return m_x; }
+ wxCoord GetY() const { return m_y; }
+ wxPoint GetPosition() const { return wxPoint(m_x, m_y); }
+ void GetPosition(wxCoord *x, wxCoord *y) const
+ {
+ if ( x )
+ *x = m_x;
+ if ( y )
+ *y = m_y;
+ }
+
+ // this overload is for compatibility only
+ void GetPosition(long *x, long *y) const
+ {
+ if ( x )
+ *x = m_x;
+ if ( y )
+ *y = m_y;
+ }
+
+ // accessors for the pressed buttons
+ bool LeftIsDown() const { return m_leftDown; }
+ bool MiddleIsDown() const { return m_middleDown; }
+ bool RightIsDown() const { return m_rightDown; }
+ bool Aux1IsDown() const { return m_aux1Down; }
+ bool Aux2IsDown() const { return m_aux2Down; }
+
+ bool ButtonIsDown(wxMouseButton but) const
+ {
+ switch ( but )
+ {
+ case wxMOUSE_BTN_ANY:
+ return LeftIsDown() || MiddleIsDown() || RightIsDown() ||
+ Aux1IsDown() || Aux2IsDown();
+
+ case wxMOUSE_BTN_LEFT:
+ return LeftIsDown();
+
+ case wxMOUSE_BTN_MIDDLE:
+ return MiddleIsDown();
+
+ case wxMOUSE_BTN_RIGHT:
+ return RightIsDown();
+
+ case wxMOUSE_BTN_AUX1:
+ return Aux1IsDown();
+
+ case wxMOUSE_BTN_AUX2:
+ return Aux2IsDown();
+
+ case wxMOUSE_BTN_NONE:
+ case wxMOUSE_BTN_MAX:
+ break;
+ }
+
+ wxFAIL_MSG(wxS("invalid parameter"));
+ return false;
+ }
+
+
+ // these functions are mostly used by wxWidgets itself
+ void SetX(wxCoord x) { m_x = x; }
+ void SetY(wxCoord y) { m_y = y; }
+ void SetPosition(wxPoint pos) { m_x = pos.x, m_y = pos.y; }
+
+ void SetLeftDown(bool down) { m_leftDown = down; }
+ void SetMiddleDown(bool down) { m_middleDown = down; }
+ void SetRightDown(bool down) { m_rightDown = down; }
+ void SetAux1Down(bool down) { m_aux1Down = down; }
+ void SetAux2Down(bool down) { m_aux2Down = down; }
+
+ // this mostly makes sense in the derived classes such as wxMouseEvent
+ void SetState(const wxMouseState& state) { *this = state; }
+
+ // these functions are for compatibility only, they were used in 2.8
+ // version of wxMouseState but their names are confusing as wxMouseEvent
+ // has methods with the same names which do something quite different so
+ // don't use them any more
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED_INLINE(bool LeftDown() const, return LeftIsDown(); )
+ wxDEPRECATED_INLINE(bool MiddleDown() const, return MiddleIsDown(); )
+ wxDEPRECATED_INLINE(bool RightDown() const, return RightIsDown(); )
+#endif // WXWIN_COMPATIBILITY_2_8
+
+ // for compatibility reasons these variables are public as the code using
+ // wxMouseEvent often uses them directly -- however they should not be
+ // accessed directly in this class, use the accessors above instead
+// private:
+ bool m_leftDown : 1;
+ bool m_middleDown : 1;
+ bool m_rightDown : 1;
+ bool m_aux1Down : 1;
+ bool m_aux2Down : 1;
+
+ wxCoord m_x,
+ m_y;
+};
+
+#endif // _WX_MOUSESTATE_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/msgdlg.h
+// Purpose: common header and base class for wxMessageDialog
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_MSGDLG_H_BASE_
+#define _WX_MSGDLG_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_MSGDLG
+
+#include "wx/dialog.h"
+#include "wx/stockitem.h"
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxMessageBoxCaptionStr[];
+
+// ----------------------------------------------------------------------------
+// wxMessageDialogBase: base class defining wxMessageDialog interface
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxMessageDialogBase : public wxDialog
+{
+public:
+ // helper class for SetXXXLabels() methods: it makes it possible to pass
+ // either a stock id (wxID_CLOSE) or a string ("&Close") to them
+ class ButtonLabel
+ {
+ public:
+ // ctors are not explicit, objects of this class can be implicitly
+ // constructed from either stock ids or strings
+ ButtonLabel(int stockId)
+ : m_stockId(stockId)
+ {
+ wxASSERT_MSG( wxIsStockID(stockId), "invalid stock id" );
+ }
+
+ ButtonLabel(const wxString& label)
+ : m_label(label), m_stockId(wxID_NONE)
+ {
+ }
+
+ ButtonLabel(const char *label)
+ : m_label(label), m_stockId(wxID_NONE)
+ {
+ }
+
+ ButtonLabel(const wchar_t *label)
+ : m_label(label), m_stockId(wxID_NONE)
+ {
+ }
+
+ ButtonLabel(const wxCStrData& label)
+ : m_label(label), m_stockId(wxID_NONE)
+ {
+ }
+
+ // default copy ctor and dtor are ok
+
+ // get the string label, whether it was originally specified directly
+ // or as a stock id -- this is only useful for platforms without native
+ // stock items id support
+ wxString GetAsString() const
+ {
+ return m_stockId == wxID_NONE
+ ? m_label
+ : wxGetStockLabel(m_stockId, wxSTOCK_FOR_BUTTON);
+ }
+
+ // return the stock id or wxID_NONE if this is not a stock label
+ int GetStockId() const { return m_stockId; }
+
+ private:
+ // the label if explicitly given or empty if this is a stock item
+ const wxString m_label;
+
+ // the stock item id or wxID_NONE if m_label should be used
+ const int m_stockId;
+ };
+
+ // ctors
+ wxMessageDialogBase() { m_dialogStyle = 0; }
+ wxMessageDialogBase(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ long style)
+ : m_message(message),
+ m_caption(caption)
+ {
+ m_parent = parent;
+ SetMessageDialogStyle(style);
+ }
+
+ // virtual dtor for the base class
+ virtual ~wxMessageDialogBase() { }
+
+ wxString GetCaption() const { return m_caption; }
+
+ virtual void SetMessage(const wxString& message)
+ {
+ m_message = message;
+ }
+
+ wxString GetMessage() const { return m_message; }
+
+ void SetExtendedMessage(const wxString& extendedMessage)
+ {
+ m_extendedMessage = extendedMessage;
+ }
+
+ wxString GetExtendedMessage() const { return m_extendedMessage; }
+
+ // change the dialog style flag
+ void SetMessageDialogStyle(long style)
+ {
+ wxASSERT_MSG( ((style & wxYES_NO) == wxYES_NO) || !(style & wxYES_NO),
+ "wxYES and wxNO may only be used together" );
+
+ wxASSERT_MSG( !(style & wxYES) || !(style & wxOK),
+ "wxOK and wxYES/wxNO can't be used together" );
+
+ // It is common to specify just the icon, without wxOK, in the existing
+ // code, especially one written by Windows programmers as MB_OK is 0
+ // and so they're used to omitting wxOK. Don't complain about it but
+ // just add wxOK implicitly for compatibility.
+ if ( !(style & wxYES) && !(style & wxOK) )
+ style |= wxOK;
+
+ wxASSERT_MSG( (style & wxID_OK) != wxID_OK,
+ "wxMessageBox: Did you mean wxOK (and not wxID_OK)?" );
+
+ wxASSERT_MSG( !(style & wxNO_DEFAULT) || (style & wxNO),
+ "wxNO_DEFAULT is invalid without wxNO" );
+
+ wxASSERT_MSG( !(style & wxCANCEL_DEFAULT) || (style & wxCANCEL),
+ "wxCANCEL_DEFAULT is invalid without wxCANCEL" );
+
+ wxASSERT_MSG( !(style & wxCANCEL_DEFAULT) || !(style & wxNO_DEFAULT),
+ "only one default button can be specified" );
+
+ m_dialogStyle = style;
+ }
+
+ long GetMessageDialogStyle() const { return m_dialogStyle; }
+
+ // customization of the message box buttons
+ virtual bool SetYesNoLabels(const ButtonLabel& yes,const ButtonLabel& no)
+ {
+ DoSetCustomLabel(m_yes, yes);
+ DoSetCustomLabel(m_no, no);
+ return true;
+ }
+
+ virtual bool SetYesNoCancelLabels(const ButtonLabel& yes,
+ const ButtonLabel& no,
+ const ButtonLabel& cancel)
+ {
+ DoSetCustomLabel(m_yes, yes);
+ DoSetCustomLabel(m_no, no);
+ DoSetCustomLabel(m_cancel, cancel);
+ return true;
+ }
+
+ virtual bool SetOKLabel(const ButtonLabel& ok)
+ {
+ DoSetCustomLabel(m_ok, ok);
+ return true;
+ }
+
+ virtual bool SetOKCancelLabels(const ButtonLabel& ok,
+ const ButtonLabel& cancel)
+ {
+ DoSetCustomLabel(m_ok, ok);
+ DoSetCustomLabel(m_cancel, cancel);
+ return true;
+ }
+
+ virtual bool SetHelpLabel(const ButtonLabel& help)
+ {
+ DoSetCustomLabel(m_help, help);
+ return true;
+ }
+
+ // test if any custom labels were set
+ bool HasCustomLabels() const
+ {
+ return !(m_ok.empty() && m_cancel.empty() && m_help.empty() &&
+ m_yes.empty() && m_no.empty());
+ }
+
+ // these functions return the label to be used for the button which is
+ // either a custom label explicitly set by the user or the default label,
+ // i.e. they always return a valid string
+ wxString GetYesLabel() const
+ { return m_yes.empty() ? GetDefaultYesLabel() : m_yes; }
+ wxString GetNoLabel() const
+ { return m_no.empty() ? GetDefaultNoLabel() : m_no; }
+ wxString GetOKLabel() const
+ { return m_ok.empty() ? GetDefaultOKLabel() : m_ok; }
+ wxString GetCancelLabel() const
+ { return m_cancel.empty() ? GetDefaultCancelLabel() : m_cancel; }
+ wxString GetHelpLabel() const
+ { return m_help.empty() ? GetDefaultHelpLabel() : m_help; }
+
+ // based on message dialog style, returns exactly one of: wxICON_NONE,
+ // wxICON_ERROR, wxICON_WARNING, wxICON_QUESTION, wxICON_INFORMATION,
+ // wxICON_AUTH_NEEDED
+ virtual long GetEffectiveIcon() const
+ {
+ if ( m_dialogStyle & wxICON_NONE )
+ return wxICON_NONE;
+ else if ( m_dialogStyle & wxICON_ERROR )
+ return wxICON_ERROR;
+ else if ( m_dialogStyle & wxICON_WARNING )
+ return wxICON_WARNING;
+ else if ( m_dialogStyle & wxICON_QUESTION )
+ return wxICON_QUESTION;
+ else if ( m_dialogStyle & wxICON_INFORMATION )
+ return wxICON_INFORMATION;
+ else if ( m_dialogStyle & wxYES )
+ return wxICON_QUESTION;
+ else
+ return wxICON_INFORMATION;
+ }
+
+protected:
+ // for the platforms not supporting separate main and extended messages
+ // this function should be used to combine both of them in a single string
+ wxString GetFullMessage() const
+ {
+ wxString msg = m_message;
+ if ( !m_extendedMessage.empty() )
+ msg << "\n\n" << m_extendedMessage;
+
+ return msg;
+ }
+
+ wxString m_message,
+ m_extendedMessage,
+ m_caption;
+ long m_dialogStyle;
+
+ // this function is called by our public SetXXXLabels() and should assign
+ // the value to var with possibly some transformation (e.g. Cocoa version
+ // currently uses this to remove any accelerators from the button strings
+ // while GTK+ one handles stock items specifically here)
+ virtual void DoSetCustomLabel(wxString& var, const ButtonLabel& label)
+ {
+ var = label.GetAsString();
+ }
+
+ // these functions return the custom label or empty string and should be
+ // used only in specific circumstances such as creating the buttons with
+ // these labels (in which case it makes sense to only use a custom label if
+ // it was really given and fall back on stock label otherwise), use the
+ // Get{Yes,No,OK,Cancel}Label() methods above otherwise
+ const wxString& GetCustomYesLabel() const { return m_yes; }
+ const wxString& GetCustomNoLabel() const { return m_no; }
+ const wxString& GetCustomOKLabel() const { return m_ok; }
+ const wxString& GetCustomHelpLabel() const { return m_help; }
+ const wxString& GetCustomCancelLabel() const { return m_cancel; }
+
+private:
+ // these functions may be overridden to provide different defaults for the
+ // default button labels (this is used by wxGTK)
+ virtual wxString GetDefaultYesLabel() const { return wxGetTranslation("Yes"); }
+ virtual wxString GetDefaultNoLabel() const { return wxGetTranslation("No"); }
+ virtual wxString GetDefaultOKLabel() const { return wxGetTranslation("OK"); }
+ virtual wxString GetDefaultCancelLabel() const { return wxGetTranslation("Cancel"); }
+ virtual wxString GetDefaultHelpLabel() const { return wxGetTranslation("Help"); }
+
+ // labels for the buttons, initially empty meaning that the defaults should
+ // be used, use GetYes/No/OK/CancelLabel() to access them
+ wxString m_yes,
+ m_no,
+ m_ok,
+ m_cancel,
+ m_help;
+
+ wxDECLARE_NO_COPY_CLASS(wxMessageDialogBase);
+};
+
+#include "wx/generic/msgdlgg.h"
+
+#if defined(__WX_COMPILING_MSGDLGG_CPP__) || \
+ defined(__WXUNIVERSAL__) || defined(__WXGPE__) || \
+ (defined(__WXGTK__) && !defined(__WXGTK20__))
+
+ #define wxMessageDialog wxGenericMessageDialog
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/msgdlg.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/msgdlg.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/msgdlg.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/msgdlg.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/msgdlg.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/msgdlg.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// wxMessageBox: the simplest way to use wxMessageDialog
+// ----------------------------------------------------------------------------
+
+int WXDLLIMPEXP_CORE wxMessageBox(const wxString& message,
+ const wxString& caption = wxMessageBoxCaptionStr,
+ long style = wxOK | wxCENTRE,
+ wxWindow *parent = NULL,
+ int x = wxDefaultCoord, int y = wxDefaultCoord);
+
+#endif // wxUSE_MSGDLG
+
+#endif // _WX_MSGDLG_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/msgout.h
+// Purpose: wxMessageOutput class. Shows a message to the user
+// Author: Mattia Barbon
+// Modified by:
+// Created: 17.07.02
+// Copyright: (c) Mattia Barbon
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_MSGOUT_H_
+#define _WX_MSGOUT_H_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+#include "wx/chartype.h"
+#include "wx/strvararg.h"
+
+// ----------------------------------------------------------------------------
+// wxMessageOutput is a class abstracting formatted output target, i.e.
+// something you can printf() to
+// ----------------------------------------------------------------------------
+
+// NB: VC6 has a bug that causes linker errors if you have template methods
+// in a class using __declspec(dllimport). The solution is to split such
+// class into two classes, one that contains the template methods and does
+// *not* use WXDLLIMPEXP_BASE and another class that contains the rest
+// (with DLL linkage).
+class wxMessageOutputBase
+{
+public:
+ virtual ~wxMessageOutputBase() { }
+
+ // show a message to the user
+ // void Printf(const wxString& format, ...) = 0;
+ WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const wxFormatString&),
+ DoPrintfWchar, DoPrintfUtf8)
+#ifdef __WATCOMC__
+ // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
+ WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const wxString&),
+ (wxFormatString(f1)));
+ WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const wxCStrData&),
+ (wxFormatString(f1)));
+ WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const char*),
+ (wxFormatString(f1)));
+ WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const wchar_t*),
+ (wxFormatString(f1)));
+#endif
+
+ // called by DoPrintf() to output formatted string but can also be called
+ // directly if no formatting is needed
+ virtual void Output(const wxString& str) = 0;
+
+protected:
+ // NB: this is pure virtual so that it can be implemented in dllexported
+ // wxMessagOutput class
+#if !wxUSE_UTF8_LOCALE_ONLY
+ virtual void DoPrintfWchar(const wxChar *format, ...) = 0;
+#endif
+#if wxUSE_UNICODE_UTF8
+ virtual void DoPrintfUtf8(const char *format, ...) = 0;
+#endif
+};
+
+#ifdef __VISUALC__
+ // "non dll-interface class 'wxStringPrintfMixin' used as base interface
+ // for dll-interface class 'wxString'" -- this is OK in our case
+ #pragma warning (push)
+ #pragma warning (disable:4275)
+#endif
+
+class WXDLLIMPEXP_BASE wxMessageOutput : public wxMessageOutputBase
+{
+public:
+ virtual ~wxMessageOutput() { }
+
+ // gets the current wxMessageOutput object (may be NULL during
+ // initialization or shutdown)
+ static wxMessageOutput* Get();
+
+ // sets the global wxMessageOutput instance; returns the previous one
+ static wxMessageOutput* Set(wxMessageOutput* msgout);
+
+protected:
+#if !wxUSE_UTF8_LOCALE_ONLY
+ virtual void DoPrintfWchar(const wxChar *format, ...);
+#endif
+#if wxUSE_UNICODE_UTF8
+ virtual void DoPrintfUtf8(const char *format, ...);
+#endif
+
+private:
+ static wxMessageOutput* ms_msgOut;
+};
+
+#ifdef __VISUALC__
+ #pragma warning (pop)
+#endif
+
+// ----------------------------------------------------------------------------
+// implementation which sends output to stderr or specified file
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMessageOutputStderr : public wxMessageOutput
+{
+public:
+ wxMessageOutputStderr(FILE *fp = stderr) : m_fp(fp) { }
+
+ virtual void Output(const wxString& str);
+
+protected:
+ // return the string with "\n" appended if it doesn't already terminate
+ // with it (in which case it's returned unchanged)
+ wxString AppendLineFeedIfNeeded(const wxString& str);
+
+ FILE *m_fp;
+};
+
+// ----------------------------------------------------------------------------
+// implementation showing the message to the user in "best" possible way:
+// uses stderr or message box if available according to the flag given to ctor.
+// ----------------------------------------------------------------------------
+
+enum wxMessageOutputFlags
+{
+ wxMSGOUT_PREFER_STDERR = 0, // use stderr if available (this is the default)
+ wxMSGOUT_PREFER_MSGBOX = 1 // always use message box if available
+};
+
+class WXDLLIMPEXP_BASE wxMessageOutputBest : public wxMessageOutputStderr
+{
+public:
+ wxMessageOutputBest(wxMessageOutputFlags flags = wxMSGOUT_PREFER_STDERR)
+ : m_flags(flags) { }
+
+ virtual void Output(const wxString& str);
+
+private:
+ wxMessageOutputFlags m_flags;
+};
+
+// ----------------------------------------------------------------------------
+// implementation which shows output in a message box
+// ----------------------------------------------------------------------------
+
+#if wxUSE_GUI && wxUSE_MSGDLG
+
+class WXDLLIMPEXP_CORE wxMessageOutputMessageBox : public wxMessageOutput
+{
+public:
+ wxMessageOutputMessageBox() { }
+
+ virtual void Output(const wxString& str);
+};
+
+#endif // wxUSE_GUI && wxUSE_MSGDLG
+
+// ----------------------------------------------------------------------------
+// implementation using the native way of outputting debug messages
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMessageOutputDebug : public wxMessageOutputStderr
+{
+public:
+ wxMessageOutputDebug() { }
+
+ virtual void Output(const wxString& str);
+};
+
+// ----------------------------------------------------------------------------
+// implementation using wxLog (mainly for backwards compatibility)
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMessageOutputLog : public wxMessageOutput
+{
+public:
+ wxMessageOutputLog() { }
+
+ virtual void Output(const wxString& str);
+};
+
+#endif // _WX_MSGOUT_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/msqqueue.h
+// Purpose: Message queues for inter-thread communication
+// Author: Evgeniy Tarassov
+// Created: 2007-10-31
+// Copyright: (C) 2007 TT-Solutions SARL
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_MSGQUEUE_H_
+#define _WX_MSGQUEUE_H_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/thread.h"
+
+#if wxUSE_THREADS
+
+#include "wx/stopwatch.h"
+
+#include "wx/beforestd.h"
+#include <queue>
+#include "wx/afterstd.h"
+
+enum wxMessageQueueError
+{
+ wxMSGQUEUE_NO_ERROR = 0, // operation completed successfully
+ wxMSGQUEUE_TIMEOUT, // no messages received before timeout expired
+ wxMSGQUEUE_MISC_ERROR // some unexpected (and fatal) error has occurred
+};
+
+// ---------------------------------------------------------------------------
+// Message queue allows passing message between threads.
+//
+// This class is typically used for communicating between the main and worker
+// threads. The main thread calls Post() and the worker thread calls Receive().
+//
+// For this class a message is an object of arbitrary type T. Notice that
+// typically there must be some special message indicating that the thread
+// should terminate as there is no other way to gracefully shutdown a thread
+// waiting on the message queue.
+// ---------------------------------------------------------------------------
+template <typename T>
+class wxMessageQueue
+{
+public:
+ // The type of the messages transported by this queue
+ typedef T Message;
+
+ // Default ctor creates an initially empty queue
+ wxMessageQueue()
+ : m_conditionNotEmpty(m_mutex)
+ {
+ }
+
+ // Add a message to this queue and signal the threads waiting for messages.
+ //
+ // This method is safe to call from multiple threads in parallel.
+ wxMessageQueueError Post(const Message& msg)
+ {
+ wxMutexLocker locker(m_mutex);
+
+ wxCHECK( locker.IsOk(), wxMSGQUEUE_MISC_ERROR );
+
+ m_messages.push(msg);
+
+ m_conditionNotEmpty.Signal();
+
+ return wxMSGQUEUE_NO_ERROR;
+ }
+
+ // Remove all messages from the queue.
+ //
+ // This method is meant to be called from the same thread(s) that call
+ // Post() to discard any still pending requests if they became unnecessary.
+ wxMessageQueueError Clear()
+ {
+ wxCHECK( IsOk(), wxMSGQUEUE_MISC_ERROR );
+
+ wxMutexLocker locker(m_mutex);
+
+ std::queue<T> empty;
+ std::swap(m_messages, empty);
+
+ return wxMSGQUEUE_NO_ERROR;
+ }
+
+ // Wait no more than timeout milliseconds until a message becomes available.
+ //
+ // Setting timeout to 0 is equivalent to an infinite timeout. See Receive().
+ wxMessageQueueError ReceiveTimeout(long timeout, T& msg)
+ {
+ wxCHECK( IsOk(), wxMSGQUEUE_MISC_ERROR );
+
+ wxMutexLocker locker(m_mutex);
+
+ wxCHECK( locker.IsOk(), wxMSGQUEUE_MISC_ERROR );
+
+ const wxMilliClock_t waitUntil = wxGetLocalTimeMillis() + timeout;
+ while ( m_messages.empty() )
+ {
+ wxCondError result = m_conditionNotEmpty.WaitTimeout(timeout);
+
+ if ( result == wxCOND_NO_ERROR )
+ continue;
+
+ wxCHECK( result == wxCOND_TIMEOUT, wxMSGQUEUE_MISC_ERROR );
+
+ const wxMilliClock_t now = wxGetLocalTimeMillis();
+
+ if ( now >= waitUntil )
+ return wxMSGQUEUE_TIMEOUT;
+
+ timeout = (waitUntil - now).ToLong();
+ wxASSERT(timeout > 0);
+ }
+
+ msg = m_messages.front();
+ m_messages.pop();
+
+ return wxMSGQUEUE_NO_ERROR;
+ }
+
+ // Same as ReceiveTimeout() but waits for as long as it takes for a message
+ // to become available (so it can't return wxMSGQUEUE_TIMEOUT)
+ wxMessageQueueError Receive(T& msg)
+ {
+ wxCHECK( IsOk(), wxMSGQUEUE_MISC_ERROR );
+
+ wxMutexLocker locker(m_mutex);
+
+ wxCHECK( locker.IsOk(), wxMSGQUEUE_MISC_ERROR );
+
+ while ( m_messages.empty() )
+ {
+ wxCondError result = m_conditionNotEmpty.Wait();
+
+ wxCHECK( result == wxCOND_NO_ERROR, wxMSGQUEUE_MISC_ERROR );
+ }
+
+ msg = m_messages.front();
+ m_messages.pop();
+
+ return wxMSGQUEUE_NO_ERROR;
+ }
+
+ // Return false only if there was a fatal error in ctor
+ bool IsOk() const
+ {
+ return m_conditionNotEmpty.IsOk();
+ }
+
+private:
+ // Disable copy ctor and assignment operator
+ wxMessageQueue(const wxMessageQueue<T>& rhs);
+ wxMessageQueue<T>& operator=(const wxMessageQueue<T>& rhs);
+
+ mutable wxMutex m_mutex;
+ wxCondition m_conditionNotEmpty;
+
+ std::queue<T> m_messages;
+};
+
+#endif // wxUSE_THREADS
+
+#endif // _WX_MSGQUEUE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/mstream.h
+// Purpose: Memory stream classes
+// Author: Guilhem Lavaux
+// Modified by:
+// Created: 11/07/98
+// Copyright: (c) Guilhem Lavaux
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WXMMSTREAM_H__
+#define _WX_WXMMSTREAM_H__
+
+#include "wx/defs.h"
+
+#if wxUSE_STREAMS
+
+#include "wx/stream.h"
+
+class WXDLLIMPEXP_FWD_BASE wxMemoryOutputStream;
+
+class WXDLLIMPEXP_BASE wxMemoryInputStream : public wxInputStream
+{
+public:
+ wxMemoryInputStream(const void *data, size_t length);
+ wxMemoryInputStream(const wxMemoryOutputStream& stream);
+ wxMemoryInputStream(wxInputStream& stream,
+ wxFileOffset lenFile = wxInvalidOffset)
+ {
+ InitFromStream(stream, lenFile);
+ }
+ wxMemoryInputStream(wxMemoryInputStream& stream)
+ : wxInputStream()
+ {
+ InitFromStream(stream, wxInvalidOffset);
+ }
+
+ virtual ~wxMemoryInputStream();
+ virtual wxFileOffset GetLength() const { return m_length; }
+ virtual bool IsSeekable() const { return true; }
+
+ virtual char Peek();
+ virtual bool CanRead() const;
+
+ wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; }
+
+#if WXWIN_COMPATIBILITY_2_6
+ // deprecated, compatibility only
+ wxDEPRECATED( wxStreamBuffer *InputStreamBuffer() const );
+#endif // WXWIN_COMPATIBILITY_2_6
+
+protected:
+ wxStreamBuffer *m_i_streambuf;
+
+ size_t OnSysRead(void *buffer, size_t nbytes);
+ wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
+ wxFileOffset OnSysTell() const;
+
+private:
+ // common part of ctors taking wxInputStream
+ void InitFromStream(wxInputStream& stream, wxFileOffset lenFile);
+
+ size_t m_length;
+
+ // copy ctor is implemented above: it copies the other stream in this one
+ DECLARE_ABSTRACT_CLASS(wxMemoryInputStream)
+ wxDECLARE_NO_ASSIGN_CLASS(wxMemoryInputStream);
+};
+
+class WXDLLIMPEXP_BASE wxMemoryOutputStream : public wxOutputStream
+{
+public:
+ // if data is !NULL it must be allocated with malloc()
+ wxMemoryOutputStream(void *data = NULL, size_t length = 0);
+ virtual ~wxMemoryOutputStream();
+ virtual wxFileOffset GetLength() const { return m_o_streambuf->GetLastAccess(); }
+ virtual bool IsSeekable() const { return true; }
+
+ size_t CopyTo(void *buffer, size_t len) const;
+
+ wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; }
+
+#if WXWIN_COMPATIBILITY_2_6
+ // deprecated, compatibility only
+ wxDEPRECATED( wxStreamBuffer *OutputStreamBuffer() const );
+#endif // WXWIN_COMPATIBILITY_2_6
+
+protected:
+ wxStreamBuffer *m_o_streambuf;
+
+protected:
+ size_t OnSysWrite(const void *buffer, size_t nbytes);
+ wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
+ wxFileOffset OnSysTell() const;
+
+ DECLARE_DYNAMIC_CLASS(wxMemoryOutputStream)
+ wxDECLARE_NO_COPY_CLASS(wxMemoryOutputStream);
+};
+
+#if WXWIN_COMPATIBILITY_2_6
+ inline wxStreamBuffer *wxMemoryInputStream::InputStreamBuffer() const { return m_i_streambuf; }
+ inline wxStreamBuffer *wxMemoryOutputStream::OutputStreamBuffer() const { return m_o_streambuf; }
+#endif // WXWIN_COMPATIBILITY_2_6
+
+#endif
+ // wxUSE_STREAMS
+
+#endif
+ // _WX_WXMMSTREAM_H__
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/nativewin.h
+// Purpose: classes allowing to wrap a native window handle
+// Author: Vadim Zeitlin
+// Created: 2008-03-05
+// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_NATIVEWIN_H_
+#define _WX_NATIVEWIN_H_
+
+#include "wx/toplevel.h"
+
+// this symbol can be tested in the user code to see if the current wx port has
+// support for creating wxNativeContainerWindow from native windows
+//
+// be optimistic by default, we undefine it below if we don't have it finally
+#define wxHAS_NATIVE_CONTAINER_WINDOW
+
+// we define the following typedefs for each of the platform supporting native
+// windows wrapping:
+//
+// - wxNativeContainerWindowHandle is the toolkit-level handle of the native
+// window, i.e. HWND/GdkWindow*/NSWindow
+//
+// - wxNativeContainerWindowId is the lowest level identifier of the native
+// window, i.e. HWND/GdkNativeWindow/NSWindow (so it's the same as above for
+// all platforms except GTK where we also can work with Window/XID)
+//
+// later we'll also have
+//
+// - wxNativeWindowHandle for child windows (which will be wrapped by
+// wxNativeWindow<T> class), it is HWND/GtkWidget*/ControlRef
+#if defined(__WXMSW__)
+ #include "wx/msw/wrapwin.h"
+
+ typedef HWND wxNativeContainerWindowId;
+ typedef HWND wxNativeContainerWindowHandle;
+#elif defined(__WXGTK__)
+ // GdkNativeWindow is guint32 under GDK/X11 and gpointer under GDK/WIN32
+ #ifdef __UNIX__
+ typedef unsigned long wxNativeContainerWindowId;
+ #else
+ typedef void *wxNativeContainerWindowId;
+ #endif
+ typedef GdkWindow *wxNativeContainerWindowHandle;
+#else
+ // no support for using native windows under this platform yet
+ #undef wxHAS_NATIVE_CONTAINER_WINDOW
+#endif
+
+#ifdef wxHAS_NATIVE_CONTAINER_WINDOW
+
+// ----------------------------------------------------------------------------
+// wxNativeContainerWindow: can be used for creating other wxWindows inside it
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxNativeContainerWindow : public wxTopLevelWindow
+{
+public:
+ // default ctor, call Create() later
+ wxNativeContainerWindow() { }
+
+ // create a window from an existing native window handle
+ //
+ // use GetHandle() to check if the creation was successful, it will return
+ // 0 if the handle was invalid
+ wxNativeContainerWindow(wxNativeContainerWindowHandle handle)
+ {
+ Create(handle);
+ }
+
+ // same as ctor above but with a return code
+ bool Create(wxNativeContainerWindowHandle handle);
+
+#if defined(__WXGTK__)
+ // this is a convenient ctor for wxGTK applications which can also create
+ // the objects of this class from the really native window handles and not
+ // only the GdkWindow objects
+ //
+ // wxNativeContainerWindowId is Window (i.e. an XID, i.e. an int) under X11
+ // (when GDK_WINDOWING_X11 is defined) or HWND under Win32
+ wxNativeContainerWindow(wxNativeContainerWindowId winid) { Create(winid); }
+
+ bool Create(wxNativeContainerWindowId winid);
+#endif // wxGTK
+
+ // unlike for the normal windows, dtor will not destroy the native window
+ // as it normally doesn't belong to us
+ virtual ~wxNativeContainerWindow();
+
+
+ // provide (trivial) implementation of the base class pure virtuals
+ virtual void SetTitle(const wxString& WXUNUSED(title))
+ {
+ wxFAIL_MSG( "not implemented for native windows" );
+ }
+
+ virtual wxString GetTitle() const
+ {
+ wxFAIL_MSG( "not implemented for native windows" );
+
+ return wxString();
+ }
+
+ virtual void Maximize(bool WXUNUSED(maximize) = true)
+ {
+ wxFAIL_MSG( "not implemented for native windows" );
+ }
+
+ virtual bool IsMaximized() const
+ {
+ wxFAIL_MSG( "not implemented for native windows" );
+
+ return false;
+ }
+
+ virtual void Iconize(bool WXUNUSED(iconize) = true)
+ {
+ wxFAIL_MSG( "not implemented for native windows" );
+ }
+
+ virtual bool IsIconized() const
+ {
+ // this is called by wxGTK implementation so don't assert
+ return false;
+ }
+
+ virtual void Restore()
+ {
+ wxFAIL_MSG( "not implemented for native windows" );
+ }
+
+ virtual bool ShowFullScreen(bool WXUNUSED(show),
+ long WXUNUSED(style) = wxFULLSCREEN_ALL)
+ {
+ wxFAIL_MSG( "not implemented for native windows" );
+
+ return false;
+ }
+
+ virtual bool IsFullScreen() const
+ {
+ wxFAIL_MSG( "not implemented for native windows" );
+
+ return false;
+ }
+
+#ifdef __WXMSW__
+ virtual bool IsShown() const;
+#endif // __WXMSW__
+
+ // this is an implementation detail: called when the native window is
+ // destroyed by an outside agency; deletes the C++ object too but can in
+ // principle be overridden to something else (knowing that the window
+ // handle of this object and all of its children is invalid any more)
+ virtual void OnNativeDestroyed();
+
+protected:
+#ifdef __WXMSW__
+ virtual WXLRESULT
+ MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
+#endif // __WXMSW__
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxNativeContainerWindow);
+};
+
+#endif // wxHAS_NATIVE_CONTAINER_WINDOW
+
+#endif // _WX_NATIVEWIN_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/nonownedwnd.h
+// Purpose: declares wxNonTopLevelWindow class
+// Author: Vaclav Slavik
+// Modified by:
+// Created: 2006-12-24
+// Copyright: (c) 2006 TT-Solutions
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_NONOWNEDWND_H_
+#define _WX_NONOWNEDWND_H_
+
+#include "wx/window.h"
+
+// Styles that can be used with any wxNonOwnedWindow:
+#define wxFRAME_SHAPED 0x0010 // Create a window that is able to be shaped
+
+class WXDLLIMPEXP_FWD_CORE wxGraphicsPath;
+
+// ----------------------------------------------------------------------------
+// wxNonOwnedWindow: a window that is not a child window of another one.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxNonOwnedWindowBase : public wxWindow
+{
+public:
+ // Set the shape of the window to the given region.
+ // Returns true if the platform supports this feature (and the
+ // operation is successful.)
+ bool SetShape(const wxRegion& region)
+ {
+ // This style is in fact only needed by wxOSX/Carbon so once we don't
+ // use this port any more, we could get rid of this requirement, but
+ // for now you must specify wxFRAME_SHAPED for SetShape() to work on
+ // all platforms.
+ wxCHECK_MSG
+ (
+ HasFlag(wxFRAME_SHAPED), false,
+ wxS("Shaped windows must be created with the wxFRAME_SHAPED style.")
+ );
+
+ return region.IsEmpty() ? DoClearShape() : DoSetRegionShape(region);
+ }
+
+#if wxUSE_GRAPHICS_CONTEXT
+ // Set the shape using the specified path.
+ bool SetShape(const wxGraphicsPath& path)
+ {
+ wxCHECK_MSG
+ (
+ HasFlag(wxFRAME_SHAPED), false,
+ wxS("Shaped windows must be created with the wxFRAME_SHAPED style.")
+ );
+
+ return DoSetPathShape(path);
+ }
+#endif // wxUSE_GRAPHICS_CONTEXT
+
+
+ // Overridden base class methods.
+ // ------------------------------
+
+ virtual void AdjustForParentClientOrigin(int& WXUNUSED(x), int& WXUNUSED(y),
+ int WXUNUSED(sizeFlags) = 0) const
+ {
+ // Non owned windows positions don't need to be adjusted for parent
+ // client area origin so simply do nothing here.
+ }
+
+ virtual void InheritAttributes()
+ {
+ // Non owned windows don't inherit attributes from their parent window
+ // (if the parent frame is red, it doesn't mean that all dialogs shown
+ // by it should be red as well), so don't do anything here neither.
+ }
+
+protected:
+ virtual bool DoClearShape()
+ {
+ return false;
+ }
+
+ virtual bool DoSetRegionShape(const wxRegion& WXUNUSED(region))
+ {
+ return false;
+ }
+
+#if wxUSE_GRAPHICS_CONTEXT
+ virtual bool DoSetPathShape(const wxGraphicsPath& WXUNUSED(path))
+ {
+ return false;
+ }
+#endif // wxUSE_GRAPHICS_CONTEXT
+};
+
+#if defined(__WXDFB__)
+ #include "wx/dfb/nonownedwnd.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/nonownedwnd.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/nonownedwnd.h"
+#elif defined(__WXMSW__) && !defined(__WXWINCE__)
+ #include "wx/msw/nonownedwnd.h"
+#else
+ // No special class needed in other ports, they can derive both wxTLW and
+ // wxPopupWindow directly from wxWindow and don't implement SetShape().
+ class wxNonOwnedWindow : public wxNonOwnedWindowBase
+ {
+ };
+#endif
+
+#endif // _WX_NONOWNEDWND_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/notebook.h
+// Purpose: wxNotebook interface
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 01.02.01
+// Copyright: (c) 1996-2000 Vadim Zeitlin
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_NOTEBOOK_H_BASE_
+#define _WX_NOTEBOOK_H_BASE_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_NOTEBOOK
+
+#include "wx/bookctrl.h"
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// wxNotebook hit results, use wxBK_HITTEST so other book controls can share them
+// if wxUSE_NOTEBOOK is disabled
+enum
+{
+ wxNB_HITTEST_NOWHERE = wxBK_HITTEST_NOWHERE,
+ wxNB_HITTEST_ONICON = wxBK_HITTEST_ONICON,
+ wxNB_HITTEST_ONLABEL = wxBK_HITTEST_ONLABEL,
+ wxNB_HITTEST_ONITEM = wxBK_HITTEST_ONITEM,
+ wxNB_HITTEST_ONPAGE = wxBK_HITTEST_ONPAGE
+};
+
+// wxNotebook flags
+
+// use common book wxBK_* flags for describing alignment
+#define wxNB_DEFAULT wxBK_DEFAULT
+#define wxNB_TOP wxBK_TOP
+#define wxNB_BOTTOM wxBK_BOTTOM
+#define wxNB_LEFT wxBK_LEFT
+#define wxNB_RIGHT wxBK_RIGHT
+
+#define wxNB_FIXEDWIDTH 0x0100
+#define wxNB_MULTILINE 0x0200
+#define wxNB_NOPAGETHEME 0x0400
+#define wxNB_FLAT 0x0800
+
+
+typedef wxWindow wxNotebookPage; // so far, any window can be a page
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxNotebookNameStr[];
+
+#if wxUSE_EXTENDED_RTTI
+
+// ----------------------------------------------------------------------------
+// XTI accessor
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxNotebookPageInfo : public wxObject
+{
+public:
+ wxNotebookPageInfo() { m_page = NULL; m_imageId = -1; m_selected = false; }
+ virtual ~wxNotebookPageInfo() { }
+
+ bool Create(wxNotebookPage *page,
+ const wxString& text,
+ bool selected,
+ int imageId)
+ {
+ m_page = page;
+ m_text = text;
+ m_selected = selected;
+ m_imageId = imageId;
+ return true;
+ }
+
+ wxNotebookPage* GetPage() const { return m_page; }
+ wxString GetText() const { return m_text; }
+ bool GetSelected() const { return m_selected; }
+ int GetImageId() const { return m_imageId; }
+
+private:
+ wxNotebookPage *m_page;
+ wxString m_text;
+ bool m_selected;
+ int m_imageId;
+
+ DECLARE_DYNAMIC_CLASS(wxNotebookPageInfo)
+};
+
+WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo, wxNotebookPageInfoList );
+
+#endif
+
+// ----------------------------------------------------------------------------
+// wxNotebookBase: define wxNotebook interface
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxNotebookBase : public wxBookCtrlBase
+{
+public:
+ // ctors
+ // -----
+
+ wxNotebookBase() { }
+
+ // wxNotebook-specific additions to wxBookCtrlBase interface
+ // ---------------------------------------------------------
+
+ // get the number of rows for a control with wxNB_MULTILINE style (not all
+ // versions support it - they will always return 1 then)
+ virtual int GetRowCount() const { return 1; }
+
+ // set the padding between tabs (in pixels)
+ virtual void SetPadding(const wxSize& padding) = 0;
+
+ // set the size of the tabs for wxNB_FIXEDWIDTH controls
+ virtual void SetTabSize(const wxSize& sz) = 0;
+
+
+
+ // implement some base class functions
+ virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
+
+ // On platforms that support it, get the theme page background colour, else invalid colour
+ virtual wxColour GetThemeBackgroundColour() const { return wxNullColour; }
+
+
+ // send wxEVT_NOTEBOOK_PAGE_CHANGING/ED events
+
+ // returns false if the change to nPage is vetoed by the program
+ bool SendPageChangingEvent(int nPage);
+
+ // sends the event about page change from old to new (or GetSelection() if
+ // new is wxNOT_FOUND)
+ void SendPageChangedEvent(int nPageOld, int nPageNew = wxNOT_FOUND);
+
+ // wxBookCtrlBase overrides this method to return false but we do need
+ // focus because we have tabs
+ virtual bool AcceptsFocus() const { return wxControl::AcceptsFocus(); }
+
+#if wxUSE_EXTENDED_RTTI
+ // XTI accessors
+ virtual void AddPageInfo( wxNotebookPageInfo* info );
+ virtual const wxNotebookPageInfoList& GetPageInfos() const;
+#endif
+
+protected:
+#if wxUSE_EXTENDED_RTTI
+ wxNotebookPageInfoList m_pageInfos;
+#endif
+ wxDECLARE_NO_COPY_CLASS(wxNotebookBase);
+};
+
+// ----------------------------------------------------------------------------
+// notebook event class and related stuff
+// ----------------------------------------------------------------------------
+
+// wxNotebookEvent is obsolete and defined for compatibility only (notice that
+// we use #define and not typedef to also keep compatibility with the existing
+// code which forward declares it)
+#define wxNotebookEvent wxBookCtrlEvent
+typedef wxBookCtrlEventFunction wxNotebookEventFunction;
+#define wxNotebookEventHandler(func) wxBookCtrlEventHandler(func)
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_NOTEBOOK_PAGE_CHANGED, wxBookCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_NOTEBOOK_PAGE_CHANGING, wxBookCtrlEvent );
+
+#define EVT_NOTEBOOK_PAGE_CHANGED(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_NOTEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn))
+
+#define EVT_NOTEBOOK_PAGE_CHANGING(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_NOTEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn))
+
+// ----------------------------------------------------------------------------
+// wxNotebook class itself
+// ----------------------------------------------------------------------------
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/notebook.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/notebook.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/generic/notebook.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/notebook.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/notebook.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/notebook.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/notebook.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/notebook.h"
+#endif
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED wxEVT_NOTEBOOK_PAGE_CHANGED
+#define wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING wxEVT_NOTEBOOK_PAGE_CHANGING
+
+#endif // wxUSE_NOTEBOOK
+
+#endif
+ // _WX_NOTEBOOK_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/notifmsg.h
+// Purpose: class allowing to show notification messages to the user
+// Author: Vadim Zeitlin
+// Created: 2007-11-19
+// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_NOTIFMSG_H_
+#define _WX_NOTIFMSG_H_
+
+#include "wx/event.h"
+
+#if wxUSE_NOTIFICATION_MESSAGE
+
+// ----------------------------------------------------------------------------
+// wxNotificationMessage: allows to show the user a message non intrusively
+// ----------------------------------------------------------------------------
+
+// notice that this class is not a window and so doesn't derive from wxWindow
+
+class WXDLLIMPEXP_ADV wxNotificationMessageBase : public wxEvtHandler
+{
+public:
+ // ctors and initializers
+ // ----------------------
+
+ // default ctor, use setters below to initialize it later
+ wxNotificationMessageBase()
+ {
+ m_parent = NULL;
+ m_flags = wxICON_INFORMATION;
+ }
+
+ // create a notification object with the given title and message (the
+ // latter may be empty in which case only the title will be shown)
+ wxNotificationMessageBase(const wxString& title,
+ const wxString& message = wxEmptyString,
+ wxWindow *parent = NULL,
+ int flags = wxICON_INFORMATION)
+ : m_title(title),
+ m_message(message),
+ m_parent(parent)
+ {
+ SetFlags(flags);
+ }
+
+ // note that the setters must be called before Show()
+
+ // set the title: short string, markup not allowed
+ void SetTitle(const wxString& title) { m_title = title; }
+
+ // set the text of the message: this is a longer string than the title and
+ // some platforms allow simple HTML-like markup in it
+ void SetMessage(const wxString& message) { m_message = message; }
+
+ // set the parent for this notification: we'll be associated with the top
+ // level parent of this window or, if this method is not called, with the
+ // main application window by default
+ void SetParent(wxWindow *parent) { m_parent = parent; }
+
+ // this method can currently be used to choose a standard icon to use: the
+ // parameter may be one of wxICON_INFORMATION, wxICON_WARNING or
+ // wxICON_ERROR only (but not wxICON_QUESTION)
+ void SetFlags(int flags)
+ {
+ wxASSERT_MSG( flags == wxICON_INFORMATION ||
+ flags == wxICON_WARNING || flags == wxICON_ERROR,
+ "Invalid icon flags specified" );
+
+ m_flags = flags;
+ }
+
+
+ // showing and hiding
+ // ------------------
+
+ // possible values for Show() timeout
+ enum
+ {
+ Timeout_Auto = -1, // notification will be hidden automatically
+ Timeout_Never = 0 // notification will never time out
+ };
+
+ // show the notification to the user and hides it after timeout seconds
+ // pass (special values Timeout_Auto and Timeout_Never can be used)
+ //
+ // returns false if an error occurred
+ virtual bool Show(int timeout = Timeout_Auto) = 0;
+
+ // hide the notification, returns true if it was hidden or false if it
+ // couldn't be done (e.g. on some systems automatically hidden
+ // notifications can't be hidden manually)
+ virtual bool Close() = 0;
+
+protected:
+ // accessors for the derived classes
+ const wxString& GetTitle() const { return m_title; }
+ const wxString& GetMessage() const { return m_message; }
+ wxWindow *GetParent() const { return m_parent; }
+ int GetFlags() const { return m_flags; }
+
+ // return the concatenation of title and message separated by a new line,
+ // this is suitable for simple implementation which have no support for
+ // separate title and message parts of the notification
+ wxString GetFullMessage() const
+ {
+ wxString text(m_title);
+ if ( !m_message.empty() )
+ {
+ text << "\n\n" << m_message;
+ }
+
+ return text;
+ }
+
+private:
+ wxString m_title,
+ m_message;
+
+ wxWindow *m_parent;
+
+ int m_flags;
+
+ wxDECLARE_NO_COPY_CLASS(wxNotificationMessageBase);
+};
+
+/*
+ TODO: Implement under OS X using notification centre (10.8+) or
+ Growl (http://growl.info/) for the previous versions.
+ */
+#if defined(__WXGTK__) && wxUSE_LIBNOTIFY
+ #include "wx/gtk/notifmsg.h"
+#elif defined(__WXGTK__) && (wxUSE_LIBHILDON || wxUSE_LIBHILDON2)
+ #include "wx/gtk/hildon/notifmsg.h"
+#elif defined(__WXMSW__) && wxUSE_TASKBARICON && wxUSE_TASKBARICON_BALLOONS
+ #include "wx/msw/notifmsg.h"
+#else
+ #include "wx/generic/notifmsg.h"
+
+ class wxNotificationMessage : public wxGenericNotificationMessage
+ {
+ public:
+ wxNotificationMessage() { }
+ wxNotificationMessage(const wxString& title,
+ const wxString& message = wxEmptyString,
+ wxWindow *parent = NULL,
+ int flags = wxICON_INFORMATION)
+ : wxGenericNotificationMessage(title, message, parent, flags)
+ {
+ }
+ };
+#endif
+
+#endif // wxUSE_NOTIFICATION_MESSAGE
+
+#endif // _WX_NOTIFMSG_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/numdlg.h
+// Purpose: wxNumberEntryDialog class
+// Author: John Labenski
+// Modified by:
+// Created: 07.02.04 (extracted from wx/textdlg.h)
+// Copyright: (c) John Labenski
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_NUMDLGDLG_H_BASE_
+#define _WX_NUMDLGDLG_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_NUMBERDLG
+
+#include "wx/generic/numdlgg.h"
+
+#endif // wxUSE_NUMBERDLG
+
+#endif // _WX_NUMDLGDLG_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/numformatter.h
+// Purpose: wxNumberFormatter class
+// Author: Fulvio Senore, Vadim Zeitlin
+// Created: 2010-11-06
+// Copyright: (c) 2010 wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_NUMFORMATTER_H_
+#define _WX_NUMFORMATTER_H_
+
+#include "wx/string.h"
+
+// Helper class for formatting numbers with thousands separators which also
+// supports parsing the numbers formatted by it.
+class WXDLLIMPEXP_BASE wxNumberFormatter
+{
+public:
+ // Bit masks for ToString()
+ enum Style
+ {
+ Style_None = 0x00,
+ Style_WithThousandsSep = 0x01,
+ Style_NoTrailingZeroes = 0x02 // Only for floating point numbers
+ };
+
+ // Format a number as a string. By default, the thousands separator is
+ // used, specify Style_None to prevent this. For floating point numbers,
+ // precision can also be specified.
+ static wxString ToString(long val,
+ int style = Style_WithThousandsSep);
+#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
+ static wxString ToString(wxLongLong_t val,
+ int style = Style_WithThousandsSep);
+#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
+ static wxString ToString(double val,
+ int precision,
+ int style = Style_WithThousandsSep);
+
+ // Parse a string representing a number, possibly with thousands separator.
+ //
+ // Return true on success and stores the result in the provided location
+ // which must be a valid non-NULL pointer.
+ static bool FromString(wxString s, long *val);
+#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
+ static bool FromString(wxString s, wxLongLong_t *val);
+#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
+ static bool FromString(wxString s, double *val);
+
+
+ // Get the decimal separator for the current locale. It is always defined
+ // and we fall back to returning '.' in case of an error.
+ static wxChar GetDecimalSeparator();
+
+ // Get the thousands separator if grouping of the digits is used by the
+ // current locale. The value returned in sep should be only used if the
+ // function returns true.
+ static bool GetThousandsSeparatorIfUsed(wxChar *sep);
+
+private:
+ // Post-process the string representing an integer.
+ static wxString PostProcessIntString(wxString s, int style);
+
+ // Add the thousands separators to a string representing a number without
+ // the separators. This is used by ToString(Style_WithThousandsSep).
+ static void AddThousandsSeparators(wxString& s);
+
+ // Remove trailing zeroes and, if there is nothing left after it, the
+ // decimal separator itself from a string representing a floating point
+ // number. Also used by ToString().
+ static void RemoveTrailingZeroes(wxString& s);
+
+ // Remove all thousands separators from a string representing a number.
+ static void RemoveThousandsSeparators(wxString& s);
+};
+
+#endif // _WX_NUMFORMATTER_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/object.h
+// Purpose: wxObject class, plus run-time type information macros
+// Author: Julian Smart
+// Modified by: Ron Lee
+// Created: 01/02/97
+// Copyright: (c) 1997 Julian Smart
+// (c) 2001 Ron Lee <ron@debian.org>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_OBJECTH__
+#define _WX_OBJECTH__
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/memory.h"
+
+#define wxDECLARE_CLASS_INFO_ITERATORS() \
+class WXDLLIMPEXP_BASE const_iterator \
+ { \
+ typedef wxHashTable_Node Node; \
+ public: \
+ typedef const wxClassInfo* value_type; \
+ typedef const value_type& const_reference; \
+ typedef const_iterator itor; \
+ typedef value_type* ptr_type; \
+ \
+ Node* m_node; \
+ wxHashTable* m_table; \
+ public: \
+ typedef const_reference reference_type; \
+ typedef ptr_type pointer_type; \
+ \
+ const_iterator(Node* node, wxHashTable* table) \
+ : m_node(node), m_table(table) { } \
+ const_iterator() : m_node(NULL), m_table(NULL) { } \
+ value_type operator*() const; \
+ itor& operator++(); \
+ const itor operator++(int); \
+ bool operator!=(const itor& it) const \
+ { return it.m_node != m_node; } \
+ bool operator==(const itor& it) const \
+ { return it.m_node == m_node; } \
+ }; \
+ \
+ static const_iterator begin_classinfo(); \
+ static const_iterator end_classinfo()
+
+// based on the value of wxUSE_EXTENDED_RTTI symbol,
+// only one of the RTTI system will be compiled:
+// - the "old" one (defined by rtti.h) or
+// - the "new" one (defined by xti.h)
+#include "wx/xti.h"
+#include "wx/rtti.h"
+
+#define wxIMPLEMENT_CLASS(name, basename) \
+ wxIMPLEMENT_ABSTRACT_CLASS(name, basename)
+
+#define wxIMPLEMENT_CLASS2(name, basename1, basename2) \
+ wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2)
+
+// -----------------------------------
+// for pluggable classes
+// -----------------------------------
+
+ // NOTE: this should probably be the very first statement
+ // in the class declaration so wxPluginSentinel is
+ // the first member initialised and the last destroyed.
+
+// _DECLARE_DL_SENTINEL(name) wxPluginSentinel m_pluginsentinel;
+
+#if wxUSE_NESTED_CLASSES
+
+#define _DECLARE_DL_SENTINEL(name, exportdecl) \
+class exportdecl name##PluginSentinel { \
+private: \
+ static const wxString sm_className; \
+public: \
+ name##PluginSentinel(); \
+ ~name##PluginSentinel(); \
+}; \
+name##PluginSentinel m_pluginsentinel
+
+#define _IMPLEMENT_DL_SENTINEL(name) \
+ const wxString name::name##PluginSentinel::sm_className(#name); \
+ name::name##PluginSentinel::name##PluginSentinel() { \
+ wxPluginLibrary *e = (wxPluginLibrary*) wxPluginLibrary::ms_classes.Get(#name); \
+ if( e != 0 ) { e->RefObj(); } \
+ } \
+ name::name##PluginSentinel::~name##PluginSentinel() { \
+ wxPluginLibrary *e = (wxPluginLibrary*) wxPluginLibrary::ms_classes.Get(#name); \
+ if( e != 0 ) { e->UnrefObj(); } \
+ }
+#else
+
+#define _DECLARE_DL_SENTINEL(name)
+#define _IMPLEMENT_DL_SENTINEL(name)
+
+#endif // wxUSE_NESTED_CLASSES
+
+#define wxDECLARE_PLUGGABLE_CLASS(name) \
+ wxDECLARE_DYNAMIC_CLASS(name); _DECLARE_DL_SENTINEL(name, WXDLLIMPEXP_CORE)
+#define wxDECLARE_ABSTRACT_PLUGGABLE_CLASS(name) \
+ wxDECLARE_ABSTRACT_CLASS(name); _DECLARE_DL_SENTINEL(name, WXDLLIMPEXP_CORE)
+
+#define wxDECLARE_USER_EXPORTED_PLUGGABLE_CLASS(name, usergoo) \
+ wxDECLARE_DYNAMIC_CLASS(name); _DECLARE_DL_SENTINEL(name, usergoo)
+#define wxDECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, usergoo) \
+ wxDECLARE_ABSTRACT_CLASS(name); _DECLARE_DL_SENTINEL(name, usergoo)
+
+#define wxIMPLEMENT_PLUGGABLE_CLASS(name, basename) \
+ wxIMPLEMENT_DYNAMIC_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name)
+#define wxIMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) \
+ wxIMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name)
+#define wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) \
+ wxIMPLEMENT_ABSTRACT_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name)
+#define wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \
+ wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name)
+
+#define wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(name, basename) \
+ wxIMPLEMENT_PLUGGABLE_CLASS(name, basename)
+#define wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(name, basename1, basename2) \
+ wxIMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2)
+#define wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, basename) \
+ wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename)
+#define wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \
+ wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2)
+
+#define wxCLASSINFO(name) (&name::ms_classInfo)
+
+#define wxIS_KIND_OF(obj, className) obj->IsKindOf(&className::ms_classInfo)
+
+// Just seems a bit nicer-looking (pretend it's not a macro)
+#define wxIsKindOf(obj, className) obj->IsKindOf(&className::ms_classInfo)
+
+// this cast does some more checks at compile time as it uses static_cast
+// internally
+//
+// note that it still has different semantics from dynamic_cast<> and so can't
+// be replaced by it as long as there are any compilers not supporting it
+#define wxDynamicCast(obj, className) \
+ ((className *) wxCheckDynamicCast( \
+ const_cast<wxObject *>(static_cast<const wxObject *>(\
+ const_cast<className *>(static_cast<const className *>(obj)))), \
+ &className::ms_classInfo))
+
+// The 'this' pointer is always true, so use this version
+// to cast the this pointer and avoid compiler warnings.
+#define wxDynamicCastThis(className) \
+ (IsKindOf(&className::ms_classInfo) ? (className *)(this) : (className *)0)
+
+// FIXME-VC6: dummy argument needed because VC6 doesn't support explicitly
+// choosing the template function to call
+template <class T>
+inline T *wxCheckCast(const void *ptr, T * = NULL)
+{
+ wxASSERT_MSG( wxDynamicCast(ptr, T), "wxStaticCast() used incorrectly" );
+ return const_cast<T *>(static_cast<const T *>(ptr));
+}
+
+#define wxStaticCast(obj, className) wxCheckCast((obj), (className *)NULL)
+
+// ----------------------------------------------------------------------------
+// set up memory debugging macros
+// ----------------------------------------------------------------------------
+
+/*
+ Which new/delete operator variants do we want?
+
+ _WX_WANT_NEW_SIZET_WXCHAR_INT = void *operator new (size_t size, wxChar *fileName = 0, int lineNum = 0)
+ _WX_WANT_DELETE_VOID = void operator delete (void * buf)
+ _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET = void operator delete (void *buf, const char *_fname, size_t _line)
+ _WX_WANT_DELETE_VOID_WXCHAR_INT = void operator delete(void *buf, wxChar*, int)
+ _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT = void *operator new[] (size_t size, wxChar *fileName , int lineNum = 0)
+ _WX_WANT_ARRAY_DELETE_VOID = void operator delete[] (void *buf)
+ _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT = void operator delete[] (void* buf, wxChar*, int )
+*/
+
+#if wxUSE_MEMORY_TRACING
+
+// All compilers get this one
+#define _WX_WANT_NEW_SIZET_WXCHAR_INT
+
+// Everyone except Visage gets the next one
+#ifndef __VISAGECPP__
+ #define _WX_WANT_DELETE_VOID
+#endif
+
+// Only visage gets this one under the correct circumstances
+#if defined(__VISAGECPP__) && __DEBUG_ALLOC__
+ #define _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET
+#endif
+
+// Only VC++ 6 gets overloaded delete that matches new
+#if (defined(__VISUALC__) && (__VISUALC__ >= 1200))
+ #define _WX_WANT_DELETE_VOID_WXCHAR_INT
+#endif
+
+// Now see who (if anyone) gets the array memory operators
+#if wxUSE_ARRAY_MEMORY_OPERATORS
+
+ // Everyone except Visual C++ (cause problems for VC++ - crashes)
+ #if !defined(__VISUALC__)
+ #define _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT
+ #endif
+
+ // Everyone except Visual C++ (cause problems for VC++ - crashes)
+ #if !defined(__VISUALC__)
+ #define _WX_WANT_ARRAY_DELETE_VOID
+ #endif
+#endif // wxUSE_ARRAY_MEMORY_OPERATORS
+
+#endif // wxUSE_MEMORY_TRACING
+
+// ----------------------------------------------------------------------------
+// Compatibility macro aliases DECLARE group
+// ----------------------------------------------------------------------------
+// deprecated variants _not_ requiring a semicolon after them and without wx prefix.
+// (note that also some wx-prefixed macro do _not_ require a semicolon because
+// it's not always possible to force the compire to require it)
+
+#define DECLARE_CLASS_INFO_ITERATORS() wxDECLARE_CLASS_INFO_ITERATORS();
+#define DECLARE_ABSTRACT_CLASS(n) wxDECLARE_ABSTRACT_CLASS(n);
+#define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(n) wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(n);
+#define DECLARE_DYNAMIC_CLASS_NO_COPY(n) wxDECLARE_DYNAMIC_CLASS_NO_COPY(n);
+#define DECLARE_DYNAMIC_CLASS(n) wxDECLARE_DYNAMIC_CLASS(n);
+#define DECLARE_CLASS(n) wxDECLARE_CLASS(n);
+
+#define DECLARE_PLUGGABLE_CLASS(n) wxDECLARE_PLUGGABLE_CLASS(n);
+#define DECLARE_ABSTRACT_PLUGGABLE_CLASS(n) wxDECLARE_ABSTRACT_PLUGGABLE_CLASS(n);
+#define DECLARE_USER_EXPORTED_PLUGGABLE_CLASS(n,u) wxDECLARE_USER_EXPORTED_PLUGGABLE_CLASS(n,u);
+#define DECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,u) wxDECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,u);
+
+// ----------------------------------------------------------------------------
+// wxRefCounter: ref counted data "manager"
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxRefCounter
+{
+public:
+ wxRefCounter() { m_count = 1; }
+
+ int GetRefCount() const { return m_count; }
+
+ void IncRef() { m_count++; }
+ void DecRef();
+
+protected:
+ // this object should never be destroyed directly but only as a
+ // result of a DecRef() call:
+ virtual ~wxRefCounter() { }
+
+private:
+ // our refcount:
+ int m_count;
+
+ // It doesn't make sense to copy the reference counted objects, a new ref
+ // counter should be created for a new object instead and compilation
+ // errors in the code using wxRefCounter due to the lack of copy ctor often
+ // indicate a problem, e.g. a forgotten copy ctor implementation somewhere.
+ wxDECLARE_NO_COPY_CLASS(wxRefCounter);
+};
+
+// ----------------------------------------------------------------------------
+// wxObjectRefData: ref counted data meant to be stored in wxObject
+// ----------------------------------------------------------------------------
+
+typedef wxRefCounter wxObjectRefData;
+
+// ----------------------------------------------------------------------------
+// wxObjectDataPtr: helper class to avoid memleaks because of missing calls
+// to wxObjectRefData::DecRef
+// ----------------------------------------------------------------------------
+
+template <class T>
+class wxObjectDataPtr
+{
+public:
+ typedef T element_type;
+
+ wxEXPLICIT wxObjectDataPtr(T *ptr = NULL) : m_ptr(ptr) {}
+
+ // copy ctor
+ wxObjectDataPtr(const wxObjectDataPtr<T> &tocopy)
+ : m_ptr(tocopy.m_ptr)
+ {
+ if (m_ptr)
+ m_ptr->IncRef();
+ }
+
+ ~wxObjectDataPtr()
+ {
+ if (m_ptr)
+ m_ptr->DecRef();
+ }
+
+ T *get() const { return m_ptr; }
+
+ // test for pointer validity: defining conversion to unspecified_bool_type
+ // and not more obvious bool to avoid implicit conversions to integer types
+ typedef T *(wxObjectDataPtr<T>::*unspecified_bool_type)() const;
+ operator unspecified_bool_type() const
+ {
+ return m_ptr ? &wxObjectDataPtr<T>::get : NULL;
+ }
+
+ T& operator*() const
+ {
+ wxASSERT(m_ptr != NULL);
+ return *(m_ptr);
+ }
+
+ T *operator->() const
+ {
+ wxASSERT(m_ptr != NULL);
+ return get();
+ }
+
+ void reset(T *ptr)
+ {
+ if (m_ptr)
+ m_ptr->DecRef();
+ m_ptr = ptr;
+ }
+
+ wxObjectDataPtr& operator=(const wxObjectDataPtr &tocopy)
+ {
+ if (m_ptr)
+ m_ptr->DecRef();
+ m_ptr = tocopy.m_ptr;
+ if (m_ptr)
+ m_ptr->IncRef();
+ return *this;
+ }
+
+ wxObjectDataPtr& operator=(T *ptr)
+ {
+ if (m_ptr)
+ m_ptr->DecRef();
+ m_ptr = ptr;
+ return *this;
+ }
+
+private:
+ T *m_ptr;
+};
+
+// ----------------------------------------------------------------------------
+// wxObject: the root class of wxWidgets object hierarchy
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxObject
+{
+ wxDECLARE_ABSTRACT_CLASS(wxObject);
+
+public:
+ wxObject() { m_refData = NULL; }
+ virtual ~wxObject() { UnRef(); }
+
+ wxObject(const wxObject& other)
+ {
+ m_refData = other.m_refData;
+ if (m_refData)
+ m_refData->IncRef();
+ }
+
+ wxObject& operator=(const wxObject& other)
+ {
+ if ( this != &other )
+ {
+ Ref(other);
+ }
+ return *this;
+ }
+
+ bool IsKindOf(const wxClassInfo *info) const;
+
+
+ // Turn on the correct set of new and delete operators
+
+#ifdef _WX_WANT_NEW_SIZET_WXCHAR_INT
+ void *operator new ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 );
+#endif
+
+#ifdef _WX_WANT_DELETE_VOID
+ void operator delete ( void * buf );
+#endif
+
+#ifdef _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET
+ void operator delete ( void *buf, const char *_fname, size_t _line );
+#endif
+
+#ifdef _WX_WANT_DELETE_VOID_WXCHAR_INT
+ void operator delete ( void *buf, const wxChar*, int );
+#endif
+
+#ifdef _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT
+ void *operator new[] ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 );
+#endif
+
+#ifdef _WX_WANT_ARRAY_DELETE_VOID
+ void operator delete[] ( void *buf );
+#endif
+
+#ifdef _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT
+ void operator delete[] (void* buf, const wxChar*, int );
+#endif
+
+ // ref counted data handling methods
+
+ // get/set
+ wxObjectRefData *GetRefData() const { return m_refData; }
+ void SetRefData(wxObjectRefData *data) { m_refData = data; }
+
+ // make a 'clone' of the object
+ void Ref(const wxObject& clone);
+
+ // destroy a reference
+ void UnRef();
+
+ // Make sure this object has only one reference
+ void UnShare() { AllocExclusive(); }
+
+ // check if this object references the same data as the other one
+ bool IsSameAs(const wxObject& o) const { return m_refData == o.m_refData; }
+
+protected:
+ // ensure that our data is not shared with anybody else: if we have no
+ // data, it is created using CreateRefData() below, if we have shared data
+ // it is copied using CloneRefData(), otherwise nothing is done
+ void AllocExclusive();
+
+ // both methods must be implemented if AllocExclusive() is used, not pure
+ // virtual only because of the backwards compatibility reasons
+
+ // create a new m_refData
+ virtual wxObjectRefData *CreateRefData() const;
+
+ // create a new m_refData initialized with the given one
+ virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
+
+ wxObjectRefData *m_refData;
+};
+
+inline wxObject *wxCheckDynamicCast(wxObject *obj, wxClassInfo *classInfo)
+{
+ return obj && obj->GetClassInfo()->IsKindOf(classInfo) ? obj : NULL;
+}
+
+#include "wx/xti2.h"
+
+// ----------------------------------------------------------------------------
+// more debugging macros
+// ----------------------------------------------------------------------------
+
+#if wxUSE_DEBUG_NEW_ALWAYS
+ #define WXDEBUG_NEW new(__TFILE__,__LINE__)
+
+ #if wxUSE_GLOBAL_MEMORY_OPERATORS
+ #define new WXDEBUG_NEW
+ #elif defined(__VISUALC__)
+ // Including this file redefines new and allows leak reports to
+ // contain line numbers
+ #include "wx/msw/msvcrt.h"
+ #endif
+#endif // wxUSE_DEBUG_NEW_ALWAYS
+
+// ----------------------------------------------------------------------------
+// Compatibility macro aliases IMPLEMENT group
+// ----------------------------------------------------------------------------
+
+// deprecated variants _not_ requiring a semicolon after them and without wx prefix.
+// (note that also some wx-prefixed macro do _not_ require a semicolon because
+// it's not always possible to force the compire to require it)
+
+#define IMPLEMENT_DYNAMIC_CLASS(n,b) wxIMPLEMENT_DYNAMIC_CLASS(n,b)
+#define IMPLEMENT_DYNAMIC_CLASS2(n,b1,b2) wxIMPLEMENT_DYNAMIC_CLASS2(n,b1,b2)
+#define IMPLEMENT_ABSTRACT_CLASS(n,b) wxIMPLEMENT_ABSTRACT_CLASS(n,b)
+#define IMPLEMENT_ABSTRACT_CLASS2(n,b1,b2) wxIMPLEMENT_ABSTRACT_CLASS2(n,b1,b2)
+#define IMPLEMENT_CLASS(n,b) wxIMPLEMENT_CLASS(n,b)
+#define IMPLEMENT_CLASS2(n,b1,b2) wxIMPLEMENT_CLASS2(n,b1,b2)
+
+#define IMPLEMENT_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_PLUGGABLE_CLASS(n,b)
+#define IMPLEMENT_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_PLUGGABLE_CLASS2(n,b,b2)
+#define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(n,b)
+#define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2)
+#define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(n,b)
+#define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(n,b,b2)
+#define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,b)
+#define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2)
+
+#define CLASSINFO(n) wxCLASSINFO(n)
+
+#endif // _WX_OBJECTH__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/odcombo.h
+// Purpose: wxOwnerDrawnComboBox and wxVListBoxPopup
+// Author: Jaakko Salli
+// Modified by:
+// Created: Apr-30-2006
+// Copyright: (c) Jaakko Salli
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_ODCOMBO_H_
+#define _WX_ODCOMBO_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_ODCOMBOBOX
+
+#include "wx/combo.h"
+#include "wx/ctrlsub.h"
+#include "wx/vlbox.h"
+#include "wx/timer.h"
+
+
+//
+// New window styles for wxOwnerDrawnComboBox
+//
+enum
+{
+ // Double-clicking cycles item if wxCB_READONLY is also used.
+ wxODCB_DCLICK_CYCLES = wxCC_SPECIAL_DCLICK,
+
+ // If used, control itself is not custom paint using callback.
+ // Even if this is not used, writable combo is never custom paint
+ // until SetCustomPaintWidth is called
+ wxODCB_STD_CONTROL_PAINT = 0x1000
+};
+
+
+//
+// Callback flags (see wxOwnerDrawnComboBox::OnDrawItem)
+//
+enum wxOwnerDrawnComboBoxPaintingFlags
+{
+ // when set, we are painting the selected item in control,
+ // not in the popup
+ wxODCB_PAINTING_CONTROL = 0x0001,
+
+
+ // when set, we are painting an item which should have
+ // focus rectangle painted in the background. Text colour
+ // and clipping region are then appropriately set in
+ // the default OnDrawBackground implementation.
+ wxODCB_PAINTING_SELECTED = 0x0002
+};
+
+
+// ----------------------------------------------------------------------------
+// wxVListBoxComboPopup is a wxVListBox customized to act as a popup control.
+//
+// Notes:
+// wxOwnerDrawnComboBox uses this as its popup. However, it always derives
+// from native wxComboCtrl. If you need to use this popup with
+// wxGenericComboControl, then remember that vast majority of item manipulation
+// functionality is implemented in the wxVListBoxComboPopup class itself.
+//
+// ----------------------------------------------------------------------------
+
+
+class WXDLLIMPEXP_ADV wxVListBoxComboPopup : public wxVListBox,
+ public wxComboPopup
+{
+ friend class wxOwnerDrawnComboBox;
+public:
+
+ // init and dtor
+ wxVListBoxComboPopup() : wxVListBox(), wxComboPopup() { }
+ virtual ~wxVListBoxComboPopup();
+
+ // required virtuals
+ virtual void Init();
+ virtual bool Create(wxWindow* parent);
+ virtual void SetFocus();
+ virtual wxWindow *GetControl() { return this; }
+ virtual void SetStringValue( const wxString& value );
+ virtual wxString GetStringValue() const;
+
+ // more customization
+ virtual void OnPopup();
+ virtual wxSize GetAdjustedSize( int minWidth, int prefHeight, int maxHeight );
+ virtual void PaintComboControl( wxDC& dc, const wxRect& rect );
+ virtual void OnComboKeyEvent( wxKeyEvent& event );
+ virtual void OnComboCharEvent( wxKeyEvent& event );
+ virtual void OnComboDoubleClick();
+ virtual bool LazyCreate();
+ virtual bool FindItem(const wxString& item, wxString* trueItem);
+
+ // Item management
+ void SetSelection( int item );
+ void Insert( const wxString& item, int pos );
+ int Append(const wxString& item);
+ void Clear();
+ void Delete( unsigned int item );
+ void SetItemClientData(unsigned int n, void* clientData, wxClientDataType clientDataItemsType);
+ void *GetItemClientData(unsigned int n) const;
+ void SetString( int item, const wxString& str );
+ wxString GetString( int item ) const;
+ unsigned int GetCount() const;
+ int FindString(const wxString& s, bool bCase = false) const;
+ int GetSelection() const;
+
+ //void Populate( int n, const wxString choices[] );
+ void Populate( const wxArrayString& choices );
+ void ClearClientDatas();
+
+ // helpers
+ int GetItemAtPosition( const wxPoint& pos ) { return HitTest(pos); }
+ wxCoord GetTotalHeight() const { return EstimateTotalHeight(); }
+ wxCoord GetLineHeight(int line) const { return OnGetRowHeight(line); }
+
+protected:
+
+ // Called by OnComboDoubleClick and OnCombo{Key,Char}Event
+ bool HandleKey( int keycode, bool saturate, wxChar keychar = 0 );
+
+ // sends combobox select event from the parent combo control
+ void SendComboBoxEvent( int selection );
+
+ // gets value, sends event and dismisses
+ void DismissWithEvent();
+
+ // OnMeasureItemWidth will be called on next GetAdjustedSize.
+ void ItemWidthChanged(unsigned int item)
+ {
+ m_widths[item] = -1;
+ m_widthsDirty = true;
+ }
+
+ // Callbacks for drawing and measuring items. Override in a derived class for
+ // owner-drawnness. Font, background and text colour have been prepared according
+ // to selection, focus and such.
+ //
+ // item: item index to be drawn, may be wxNOT_FOUND when painting combo control itself
+ // and there is no valid selection
+ // flags: wxODCB_PAINTING_CONTROL is set if painting to combo control instead of list
+ //
+ // NOTE: If wxVListBoxComboPopup is used with a wxComboCtrl class not derived from
+ // wxOwnerDrawnComboBox, this method must be overridden.
+ virtual void OnDrawItem( wxDC& dc, const wxRect& rect, int item, int flags) const;
+
+ // This is same as in wxVListBox
+ virtual wxCoord OnMeasureItem( size_t item ) const;
+
+ // Return item width, or -1 for calculating from text extent (default)
+ virtual wxCoord OnMeasureItemWidth( size_t item ) const;
+
+ // Draw item and combo control background. Flags are same as with OnDrawItem.
+ // NB: Can't use name OnDrawBackground because of virtual function hiding warnings.
+ virtual void OnDrawBg(wxDC& dc, const wxRect& rect, int item, int flags) const;
+
+ // Additional wxVListBox implementation (no need to override in derived classes)
+ virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const;
+ void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const;
+
+ // filter mouse move events happening outside the list box
+ // move selection with cursor
+ void OnMouseMove(wxMouseEvent& event);
+ void OnKey(wxKeyEvent& event);
+ void OnChar(wxKeyEvent& event);
+ void OnLeftClick(wxMouseEvent& event);
+
+ // Return the widest item width (recalculating it if necessary)
+ int GetWidestItemWidth() { CalcWidths(); return m_widestWidth; }
+
+ // Return the index of the widest item (recalculating it if necessary)
+ int GetWidestItem() { CalcWidths(); return m_widestItem; }
+
+ // Stop partial completion (when some other event occurs)
+ void StopPartialCompletion();
+
+ wxArrayString m_strings;
+ wxArrayPtrVoid m_clientDatas;
+
+ wxFont m_useFont;
+
+ //wxString m_stringValue; // displayed text (may be different than m_strings[m_value])
+ int m_value; // selection
+ int m_itemHover; // on which item the cursor is
+ int m_itemHeight; // default item height (calculate from font size
+ // and used in the absence of callback)
+ wxClientDataType m_clientDataItemsType;
+
+private:
+
+ // Cached item widths (in pixels).
+ wxArrayInt m_widths;
+
+ // Width of currently widest item.
+ int m_widestWidth;
+
+ // Index of currently widest item.
+ int m_widestItem;
+
+ // Measure some items in next GetAdjustedSize?
+ bool m_widthsDirty;
+
+ // Find widest item in next GetAdjustedSize?
+ bool m_findWidest;
+
+ // has the mouse been released on this control?
+ bool m_clicked;
+
+ // Recalculate widths if they are dirty
+ void CalcWidths();
+
+ // Partial completion string
+ wxString m_partialCompletionString;
+
+ wxString m_stringValue;
+
+#if wxUSE_TIMER
+ // Partial completion timer
+ wxTimer m_partialCompletionTimer;
+#endif // wxUSE_TIMER
+
+ DECLARE_EVENT_TABLE()
+};
+
+
+// ----------------------------------------------------------------------------
+// wxOwnerDrawnComboBox: a generic wxComboBox that allows custom paint items
+// in addition to many other types of customization already allowed by
+// the wxComboCtrl.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxOwnerDrawnComboBox :
+ public wxWindowWithItems<wxComboCtrl, wxItemContainer>
+{
+ //friend class wxComboPopupWindow;
+ friend class wxVListBoxComboPopup;
+public:
+
+ // ctors and such
+ wxOwnerDrawnComboBox() { Init(); }
+
+ wxOwnerDrawnComboBox(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value,
+ const wxPoint& pos,
+ const wxSize& size,
+ int n,
+ const wxString choices[],
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxComboBoxNameStr)
+ {
+ Init();
+
+ (void)Create(parent, id, value, pos, size, n,
+ choices, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxComboBoxNameStr);
+
+ wxOwnerDrawnComboBox(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ const wxArrayString& choices = wxArrayString(),
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxComboBoxNameStr);
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value,
+ const wxPoint& pos,
+ const wxSize& size,
+ int n,
+ const wxString choices[],
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxComboBoxNameStr);
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxComboBoxNameStr);
+
+ virtual ~wxOwnerDrawnComboBox();
+
+ // Prevent app from using wxComboPopup
+ void SetPopupControl(wxVListBoxComboPopup* popup)
+ {
+ DoSetPopupControl(popup);
+ }
+
+ // wxControlWithItems methods
+ virtual unsigned int GetCount() const;
+ virtual wxString GetString(unsigned int n) const;
+ virtual void SetString(unsigned int n, const wxString& s);
+ virtual int FindString(const wxString& s, bool bCase = false) const;
+ virtual void Select(int n);
+ virtual int GetSelection() const;
+
+ // Override these just to maintain consistency with virtual methods
+ // between classes.
+ virtual void Clear();
+ virtual void GetSelection(long *from, long *to) const;
+
+ virtual void SetSelection(int n) { Select(n); }
+
+
+ // Prevent a method from being hidden
+ virtual void SetSelection(long from, long to)
+ {
+ wxComboCtrl::SetSelection(from,to);
+ }
+
+ // Return the widest item width (recalculating it if necessary)
+ virtual int GetWidestItemWidth() { EnsurePopupControl(); return GetVListBoxComboPopup()->GetWidestItemWidth(); }
+
+ // Return the index of the widest item (recalculating it if necessary)
+ virtual int GetWidestItem() { EnsurePopupControl(); return GetVListBoxComboPopup()->GetWidestItem(); }
+
+ virtual bool IsSorted() const { return HasFlag(wxCB_SORT); }
+
+protected:
+ virtual void DoClear();
+ virtual void DoDeleteOneItem(unsigned int n);
+
+ // Callback for drawing. Font, background and text colour have been
+ // prepared according to selection, focus and such.
+ // item: item index to be drawn, may be wxNOT_FOUND when painting combo control itself
+ // and there is no valid selection
+ // flags: wxODCB_PAINTING_CONTROL is set if painting to combo control instead of list
+ virtual void OnDrawItem( wxDC& dc, const wxRect& rect, int item, int flags ) const;
+
+ // Callback for item height, or -1 for default
+ virtual wxCoord OnMeasureItem( size_t item ) const;
+
+ // Callback for item width, or -1 for default/undetermined
+ virtual wxCoord OnMeasureItemWidth( size_t item ) const;
+
+ // override base implementation so we can return the size for the
+ // largest item
+ virtual wxSize DoGetBestSize() const;
+
+ // Callback for background drawing. Flags are same as with
+ // OnDrawItem.
+ virtual void OnDrawBackground( wxDC& dc, const wxRect& rect, int item, int flags ) const;
+
+ // NULL popup can be used to indicate default interface
+ virtual void DoSetPopupControl(wxComboPopup* popup);
+
+ // clears all allocated client datas
+ void ClearClientDatas();
+
+ wxVListBoxComboPopup* GetVListBoxComboPopup() const
+ {
+ return (wxVListBoxComboPopup*) m_popupInterface;
+ }
+
+ virtual int DoInsertItems(const wxArrayStringsAdapter& items,
+ unsigned int pos,
+ void **clientData, wxClientDataType type);
+ virtual void DoSetItemClientData(unsigned int n, void* clientData);
+ virtual void* DoGetItemClientData(unsigned int n) const;
+
+ // temporary storage for the initial choices
+ //const wxString* m_baseChoices;
+ //int m_baseChoicesCount;
+ wxArrayString m_initChs;
+
+private:
+ void Init();
+
+ DECLARE_EVENT_TABLE()
+
+ DECLARE_DYNAMIC_CLASS(wxOwnerDrawnComboBox)
+};
+
+
+#endif // wxUSE_ODCOMBOBOX
+
+#endif
+ // _WX_ODCOMBO_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/overlay.h
+// Purpose: wxOverlay class
+// Author: Stefan Csomor
+// Modified by:
+// Created: 2006-10-20
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_OVERLAY_H_
+#define _WX_OVERLAY_H_
+
+#include "wx/defs.h"
+
+#if defined(__WXMAC__) && wxOSX_USE_CARBON
+ #define wxHAS_NATIVE_OVERLAY 1
+#elif defined(__WXDFB__)
+ #define wxHAS_NATIVE_OVERLAY 1
+#else
+ // don't define wxHAS_NATIVE_OVERLAY
+#endif
+
+// ----------------------------------------------------------------------------
+// creates an overlay over an existing window, allowing for manipulations like
+// rubberbanding etc. This API is not stable yet, not to be used outside wx
+// internal code
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxOverlayImpl;
+class WXDLLIMPEXP_FWD_CORE wxDC;
+
+class WXDLLIMPEXP_CORE wxOverlay
+{
+public:
+ wxOverlay();
+ ~wxOverlay();
+
+ // clears the overlay without restoring the former state
+ // to be done eg when the window content has been changed and repainted
+ void Reset();
+
+ // returns (port-specific) implementation of the overlay
+ wxOverlayImpl *GetImpl() { return m_impl; }
+
+private:
+ friend class WXDLLIMPEXP_FWD_CORE wxDCOverlay;
+
+ // returns true if it has been setup
+ bool IsOk();
+
+ void Init(wxDC* dc, int x , int y , int width , int height);
+
+ void BeginDrawing(wxDC* dc);
+
+ void EndDrawing(wxDC* dc);
+
+ void Clear(wxDC* dc);
+
+ wxOverlayImpl* m_impl;
+
+ bool m_inDrawing;
+
+
+ wxDECLARE_NO_COPY_CLASS(wxOverlay);
+};
+
+
+class WXDLLIMPEXP_CORE wxDCOverlay
+{
+public:
+ // connects this overlay to the corresponding drawing dc, if the overlay is
+ // not initialized yet this call will do so
+ wxDCOverlay(wxOverlay &overlay, wxDC *dc, int x , int y , int width , int height);
+
+ // convenience wrapper that behaves the same using the entire area of the dc
+ wxDCOverlay(wxOverlay &overlay, wxDC *dc);
+
+ // removes the connection between the overlay and the dc
+ virtual ~wxDCOverlay();
+
+ // clears the layer, restoring the state at the last init
+ void Clear();
+
+private:
+ void Init(wxDC *dc, int x , int y , int width , int height);
+
+ wxOverlay& m_overlay;
+
+ wxDC* m_dc;
+
+
+ wxDECLARE_NO_COPY_CLASS(wxDCOverlay);
+};
+
+#endif // _WX_OVERLAY_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/ownerdrw.h
+// Purpose: interface for owner-drawn GUI elements
+// Author: Vadim Zeitlin
+// Modified by: Marcin Malich
+// Created: 11.11.97
+// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_OWNERDRW_H_BASE
+#define _WX_OWNERDRW_H_BASE
+
+#include "wx/defs.h"
+
+#if wxUSE_OWNER_DRAWN
+
+#include "wx/font.h"
+#include "wx/colour.h"
+
+class WXDLLIMPEXP_FWD_CORE wxDC;
+
+// ----------------------------------------------------------------------------
+// wxOwnerDrawn - a mix-in base class, derive from it to implement owner-drawn
+// behaviour
+//
+// wxOwnerDrawn supports drawing of an item with non standard font, color and
+// also supports 3 bitmaps: either a checked/unchecked bitmap for a checkable
+// element or one unchangeable bitmap otherwise.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxOwnerDrawnBase
+{
+public:
+ wxOwnerDrawnBase()
+ {
+ m_ownerDrawn = false;
+ m_margin = ms_defaultMargin;
+ }
+
+ virtual ~wxOwnerDrawnBase() {}
+
+ void SetFont(const wxFont& font)
+ { m_font = font; m_ownerDrawn = true; }
+
+ wxFont& GetFont() const
+ { return (wxFont&) m_font; }
+
+
+ void SetTextColour(const wxColour& colText)
+ { m_colText = colText; m_ownerDrawn = true; }
+
+ wxColour& GetTextColour() const
+ { return (wxColour&) m_colText; }
+
+ void SetBackgroundColour(const wxColour& colBack)
+ { m_colBack = colBack; m_ownerDrawn = true; }
+
+ wxColour& GetBackgroundColour() const
+ { return (wxColour&) m_colBack ; }
+
+
+ void SetMarginWidth(int width)
+ { m_margin = width; }
+
+ int GetMarginWidth() const
+ { return m_margin; }
+
+ static int GetDefaultMarginWidth()
+ { return ms_defaultMargin; }
+
+
+ // get item name (with mnemonics if exist)
+ virtual wxString GetName() const = 0;
+
+
+ // this function might seem strange, but if it returns false it means that
+ // no non-standard attribute are set, so there is no need for this control
+ // to be owner-drawn. Moreover, you can force owner-drawn to false if you
+ // want to change, say, the color for the item but only if it is owner-drawn
+ // (see wxMenuItem::wxMenuItem for example)
+ bool IsOwnerDrawn() const
+ { return m_ownerDrawn; }
+
+ // switch on/off owner-drawing the item
+ void SetOwnerDrawn(bool ownerDrawn = true)
+ { m_ownerDrawn = ownerDrawn; }
+
+
+ // constants used in OnDrawItem
+ // (they have the same values as corresponding Win32 constants)
+ enum wxODAction
+ {
+ wxODDrawAll = 0x0001, // redraw entire control
+ wxODSelectChanged = 0x0002, // selection changed (see Status.Select)
+ wxODFocusChanged = 0x0004 // keyboard focus changed (see Status.Focus)
+ };
+
+ enum wxODStatus
+ {
+ wxODSelected = 0x0001, // control is currently selected
+ wxODGrayed = 0x0002, // item is to be grayed
+ wxODDisabled = 0x0004, // item is to be drawn as disabled
+ wxODChecked = 0x0008, // item is to be checked
+ wxODHasFocus = 0x0010, // item has the keyboard focus
+ wxODDefault = 0x0020, // item is the default item
+ wxODHidePrefix= 0x0100 // hide keyboard cues (w2k and xp only)
+ };
+
+ // virtual functions to implement drawing (return true if processed)
+ virtual bool OnMeasureItem(size_t *width, size_t *height);
+ virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat) = 0;
+
+protected:
+
+ // get the font and colour to use, whether it is set or not
+ virtual void GetFontToUse(wxFont& font) const;
+ virtual void GetColourToUse(wxODStatus stat, wxColour& colText, wxColour& colBack) const;
+
+private:
+ bool m_ownerDrawn; // true if something is non standard
+
+ wxFont m_font; // font to use for drawing
+ wxColour m_colText, // color ----"---"---"----
+ m_colBack; // background color
+
+ int m_margin; // space occupied by bitmap to the left of the item
+
+ static int ms_defaultMargin;
+};
+
+// ----------------------------------------------------------------------------
+// include the platform-specific class declaration
+// ----------------------------------------------------------------------------
+
+#if defined(__WXMSW__)
+ #include "wx/msw/ownerdrw.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/ownerdrw.h"
+#endif
+
+#endif // wxUSE_OWNER_DRAWN
+
+#endif // _WX_OWNERDRW_H_BASE
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/palette.h
+// Purpose: Common header and base class for wxPalette
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PALETTE_H_BASE_
+#define _WX_PALETTE_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_PALETTE
+
+#include "wx/object.h"
+#include "wx/gdiobj.h"
+
+// wxPaletteBase
+class WXDLLIMPEXP_CORE wxPaletteBase: public wxGDIObject
+{
+public:
+ virtual ~wxPaletteBase() { }
+
+ virtual int GetColoursCount() const { wxFAIL_MSG( wxT("not implemented") ); return 0; }
+};
+
+#if defined(__WXMSW__)
+ #include "wx/msw/palette.h"
+#elif defined(__WXX11__) || defined(__WXMOTIF__)
+ #include "wx/x11/palette.h"
+#elif defined(__WXGTK__) || defined(__WXCOCOA__)
+ #include "wx/generic/paletteg.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/palette.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/palette.h"
+#endif
+
+#endif // wxUSE_PALETTE
+
+#endif // _WX_PALETTE_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/panel.h
+// Purpose: Base header for wxPanel
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PANEL_H_BASE_
+#define _WX_PANEL_H_BASE_
+
+// ----------------------------------------------------------------------------
+// headers and forward declarations
+// ----------------------------------------------------------------------------
+
+#include "wx/window.h"
+#include "wx/containr.h"
+
+class WXDLLIMPEXP_FWD_CORE wxControlContainer;
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxPanelNameStr[];
+
+// ----------------------------------------------------------------------------
+// wxPanel contains other controls and implements TAB traversal between them
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPanelBase : public wxNavigationEnabled<wxWindow>
+{
+public:
+ wxPanelBase() { }
+
+ // Derived classes should also provide this constructor:
+ /*
+ wxPanelBase(wxWindow *parent,
+ wxWindowID winid = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxTAB_TRAVERSAL | wxNO_BORDER,
+ const wxString& name = wxPanelNameStr);
+ */
+
+ // Pseudo ctor
+ bool Create(wxWindow *parent,
+ wxWindowID winid = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxTAB_TRAVERSAL | wxNO_BORDER,
+ const wxString& name = wxPanelNameStr);
+
+
+ // implementation from now on
+ // --------------------------
+
+ virtual void InitDialog();
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxPanelBase);
+};
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/panel.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/panel.h"
+#else
+ #define wxHAS_GENERIC_PANEL
+ #include "wx/generic/panelg.h"
+#endif
+
+#endif // _WX_PANELH_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/paper.h
+// Purpose: Paper database types and classes
+// Author: Julian Smart
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PAPERH__
+#define _WX_PAPERH__
+
+#include "wx/defs.h"
+#include "wx/event.h"
+#include "wx/cmndata.h"
+#include "wx/intl.h"
+#include "wx/hashmap.h"
+
+/*
+ * Paper type: see defs.h for wxPaperSize enum.
+ * A wxPrintPaperType can have an id and a name, or just a name and wxPAPER_NONE,
+ * so you can add further paper types without needing new ids.
+ */
+
+#ifdef __WXMSW__
+#define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, platformId, name, w, h)
+#else
+#define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, 0, name, w, h)
+#endif
+
+class WXDLLIMPEXP_CORE wxPrintPaperType: public wxObject
+{
+public:
+ wxPrintPaperType();
+
+ // platformId is a platform-specific id, such as in Windows, DMPAPER_...
+ wxPrintPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h);
+
+ inline wxString GetName() const { return wxGetTranslation(m_paperName); }
+ inline wxPaperSize GetId() const { return m_paperId; }
+ inline int GetPlatformId() const { return m_platformId; }
+
+ // Get width and height in tenths of a millimetre
+ inline int GetWidth() const { return m_width; }
+ inline int GetHeight() const { return m_height; }
+
+ // Get size in tenths of a millimetre
+ inline wxSize GetSize() const { return wxSize(m_width, m_height); }
+
+ // Get size in a millimetres
+ inline wxSize GetSizeMM() const { return wxSize(m_width/10, m_height/10); }
+
+ // Get width and height in device units (1/72th of an inch)
+ wxSize GetSizeDeviceUnits() const ;
+
+public:
+ wxPaperSize m_paperId;
+ int m_platformId;
+ int m_width; // In tenths of a millimetre
+ int m_height; // In tenths of a millimetre
+ wxString m_paperName;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPrintPaperType)
+};
+
+WX_DECLARE_STRING_HASH_MAP(wxPrintPaperType*, wxStringToPrintPaperTypeHashMap);
+
+class WXDLLIMPEXP_FWD_CORE wxPrintPaperTypeList;
+
+class WXDLLIMPEXP_CORE wxPrintPaperDatabase
+{
+public:
+ wxPrintPaperDatabase();
+ ~wxPrintPaperDatabase();
+
+ void CreateDatabase();
+ void ClearDatabase();
+
+ void AddPaperType(wxPaperSize paperId, const wxString& name, int w, int h);
+ void AddPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h);
+
+ // Find by name
+ wxPrintPaperType *FindPaperType(const wxString& name);
+
+ // Find by size id
+ wxPrintPaperType *FindPaperType(wxPaperSize id);
+
+ // Find by platform id
+ wxPrintPaperType *FindPaperTypeByPlatformId(int id);
+
+ // Find by size
+ wxPrintPaperType *FindPaperType(const wxSize& size);
+
+ // Convert name to size id
+ wxPaperSize ConvertNameToId(const wxString& name);
+
+ // Convert size id to name
+ wxString ConvertIdToName(wxPaperSize paperId);
+
+ // Get the paper size
+ wxSize GetSize(wxPaperSize paperId);
+
+ // Get the paper size
+ wxPaperSize GetSize(const wxSize& size);
+
+ //
+ wxPrintPaperType* Item(size_t index) const;
+ size_t GetCount() const;
+private:
+ wxStringToPrintPaperTypeHashMap* m_map;
+ wxPrintPaperTypeList* m_list;
+ // DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase)
+};
+
+extern WXDLLIMPEXP_DATA_CORE(wxPrintPaperDatabase*) wxThePrintPaperDatabase;
+
+
+#endif
+ // _WX_PAPERH__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/pen.h
+// Purpose: Base header for wxPen
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PEN_H_BASE_
+#define _WX_PEN_H_BASE_
+
+#include "wx/gdiobj.h"
+#include "wx/gdicmn.h"
+
+enum wxPenStyle
+{
+ wxPENSTYLE_INVALID = -1,
+
+ wxPENSTYLE_SOLID = wxSOLID,
+ wxPENSTYLE_DOT = wxDOT,
+ wxPENSTYLE_LONG_DASH = wxLONG_DASH,
+ wxPENSTYLE_SHORT_DASH = wxSHORT_DASH,
+ wxPENSTYLE_DOT_DASH = wxDOT_DASH,
+ wxPENSTYLE_USER_DASH = wxUSER_DASH,
+
+ wxPENSTYLE_TRANSPARENT = wxTRANSPARENT,
+
+ wxPENSTYLE_STIPPLE_MASK_OPAQUE = wxSTIPPLE_MASK_OPAQUE,
+ wxPENSTYLE_STIPPLE_MASK = wxSTIPPLE_MASK,
+ wxPENSTYLE_STIPPLE = wxSTIPPLE,
+
+ wxPENSTYLE_BDIAGONAL_HATCH = wxHATCHSTYLE_BDIAGONAL,
+ wxPENSTYLE_CROSSDIAG_HATCH = wxHATCHSTYLE_CROSSDIAG,
+ wxPENSTYLE_FDIAGONAL_HATCH = wxHATCHSTYLE_FDIAGONAL,
+ wxPENSTYLE_CROSS_HATCH = wxHATCHSTYLE_CROSS,
+ wxPENSTYLE_HORIZONTAL_HATCH = wxHATCHSTYLE_HORIZONTAL,
+ wxPENSTYLE_VERTICAL_HATCH = wxHATCHSTYLE_VERTICAL,
+ wxPENSTYLE_FIRST_HATCH = wxHATCHSTYLE_FIRST,
+ wxPENSTYLE_LAST_HATCH = wxHATCHSTYLE_LAST
+};
+
+enum wxPenJoin
+{
+ wxJOIN_INVALID = -1,
+
+ wxJOIN_BEVEL = 120,
+ wxJOIN_MITER,
+ wxJOIN_ROUND
+};
+
+enum wxPenCap
+{
+ wxCAP_INVALID = -1,
+
+ wxCAP_ROUND = 130,
+ wxCAP_PROJECTING,
+ wxCAP_BUTT
+};
+
+
+class WXDLLIMPEXP_CORE wxPenBase : public wxGDIObject
+{
+public:
+ virtual ~wxPenBase() { }
+
+ virtual void SetColour(const wxColour& col) = 0;
+ virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) = 0;
+
+ virtual void SetWidth(int width) = 0;
+ virtual void SetStyle(wxPenStyle style) = 0;
+ virtual void SetStipple(const wxBitmap& stipple) = 0;
+ virtual void SetDashes(int nb_dashes, const wxDash *dash) = 0;
+ virtual void SetJoin(wxPenJoin join) = 0;
+ virtual void SetCap(wxPenCap cap) = 0;
+
+ virtual wxColour GetColour() const = 0;
+ virtual wxBitmap *GetStipple() const = 0;
+ virtual wxPenStyle GetStyle() const = 0;
+ virtual wxPenJoin GetJoin() const = 0;
+ virtual wxPenCap GetCap() const = 0;
+ virtual int GetWidth() const = 0;
+ virtual int GetDashes(wxDash **ptr) const = 0;
+
+ // Convenient helpers for testing whether the pen is a transparent one:
+ // unlike GetStyle() == wxPENSTYLE_TRANSPARENT, they work correctly even if
+ // the pen is invalid (they both return false in this case).
+ bool IsTransparent() const
+ {
+ return IsOk() && GetStyle() == wxPENSTYLE_TRANSPARENT;
+ }
+
+ bool IsNonTransparent() const
+ {
+ return IsOk() && GetStyle() != wxPENSTYLE_TRANSPARENT;
+ }
+};
+
+#if defined(__WXMSW__)
+ #include "wx/msw/pen.h"
+#elif defined(__WXMOTIF__) || defined(__WXX11__)
+ #include "wx/x11/pen.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/pen.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/pen.h"
+#elif defined(__WXDFB__)
+ #include "wx/dfb/pen.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/pen.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/pen.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/pen.h"
+#endif
+
+class WXDLLIMPEXP_CORE wxPenList: public wxGDIObjListBase
+{
+public:
+ wxPen *FindOrCreatePen(const wxColour& colour,
+ int width = 1,
+ wxPenStyle style = wxPENSTYLE_SOLID);
+
+#if FUTURE_WXWIN_COMPATIBILITY_3_0
+ wxPen *FindOrCreatePen(const wxColour& colour, int width, int style)
+ { return FindOrCreatePen(colour, width, (wxPenStyle)style); }
+#endif
+#if WXWIN_COMPATIBILITY_2_6
+ wxDEPRECATED( void AddPen(wxPen*) );
+ wxDEPRECATED( void RemovePen(wxPen*) );
+#endif
+};
+
+extern WXDLLIMPEXP_DATA_CORE(wxPenList*) wxThePenList;
+
+// provide comparison operators to allow code such as
+//
+// if ( pen.GetStyle() == wxTRANSPARENT )
+//
+// to compile without warnings which it would otherwise provoke from some
+// compilers as it compares elements of different enums
+#if FUTURE_WXWIN_COMPATIBILITY_3_0
+
+// Unfortunately some compilers have ambiguity issues when enum comparisons are
+// overloaded so we have to disable the overloads in this case, see
+// wxCOMPILER_NO_OVERLOAD_ON_ENUM definition in wx/platform.h for more details.
+#ifndef wxCOMPILER_NO_OVERLOAD_ON_ENUM
+
+inline bool operator==(wxPenStyle s, wxDeprecatedGUIConstants t)
+{
+ return static_cast<int>(s) == static_cast<int>(t);
+}
+
+inline bool operator!=(wxPenStyle s, wxDeprecatedGUIConstants t)
+{
+ return !(s == t);
+}
+
+#endif // wxCOMPILER_NO_OVERLOAD_ON_ENUM
+
+#endif // FUTURE_WXWIN_COMPATIBILITY_3_0
+
+#endif // _WX_PEN_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/persist.h
+// Purpose: common classes for persistence support
+// Author: Vadim Zeitlin
+// Created: 2009-01-18
+// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PERSIST_H_
+#define _WX_PERSIST_H_
+
+#include "wx/string.h"
+#include "wx/hashmap.h"
+#include "wx/confbase.h"
+
+class wxPersistentObject;
+
+WX_DECLARE_VOIDPTR_HASH_MAP(wxPersistentObject *, wxPersistentObjectsMap);
+
+// ----------------------------------------------------------------------------
+// global functions
+// ----------------------------------------------------------------------------
+
+/*
+ We do _not_ declare this function as doing this would force us to specialize
+ it for the user classes deriving from the standard persistent classes.
+ However we do define overloads of wxCreatePersistentObject() for all the wx
+ classes which means that template wxPersistentObject::Restore() picks up the
+ right overload to use provided that the header defining the correct overload
+ is included before calling it. And a compilation error happens if this is
+ not done.
+
+template <class T>
+wxPersistentObject *wxCreatePersistentObject(T *obj);
+
+ */
+
+// ----------------------------------------------------------------------------
+// wxPersistenceManager: global aspects of persistent windows
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPersistenceManager
+{
+public:
+ // Call this method to specify a non-default persistence manager to use.
+ // This function should usually be called very early to affect creation of
+ // all persistent controls and the object passed to it must have a lifetime
+ // long enough to be still alive when the persistent controls are destroyed
+ // and need it to save their state so typically this would be a global or a
+ // wxApp member.
+ static void Set(wxPersistenceManager& manager);
+
+ // accessor to the unique persistence manager object
+ static wxPersistenceManager& Get();
+
+ // trivial but virtual dtor
+ //
+ // FIXME-VC6: this only needs to be public because of VC6 bug
+ virtual ~wxPersistenceManager();
+
+
+ // globally disable restoring or saving the persistent properties (both are
+ // enabled by default)
+ void DisableSaving() { m_doSave = false; }
+ void DisableRestoring() { m_doRestore = false; }
+
+
+ // register an object with the manager: when using the first overload,
+ // wxCreatePersistentObject() must be specialized for this object class;
+ // with the second one the persistent adapter is created by the caller
+ //
+ // the object shouldn't be already registered with us
+ template <class T>
+ wxPersistentObject *Register(T *obj)
+ {
+ return Register(obj, wxCreatePersistentObject(obj));
+ }
+
+ wxPersistentObject *Register(void *obj, wxPersistentObject *po);
+
+ // check if the object is registered and return the associated
+ // wxPersistentObject if it is or NULL otherwise
+ wxPersistentObject *Find(void *obj) const;
+
+ // unregister the object, this is called by wxPersistentObject itself so
+ // there is usually no need to do it explicitly
+ //
+ // deletes the associated wxPersistentObject
+ void Unregister(void *obj);
+
+
+ // save/restore the state of an object
+ //
+ // these methods do nothing if DisableSaving/Restoring() was called
+ //
+ // Restore() returns true if the object state was really restored
+ void Save(void *obj);
+ bool Restore(void *obj);
+
+ // combines both Save() and Unregister() calls
+ void SaveAndUnregister(void *obj)
+ {
+ Save(obj);
+ Unregister(obj);
+ }
+
+ // combines both Register() and Restore() calls
+ template <class T>
+ bool RegisterAndRestore(T *obj)
+ {
+ return Register(obj) && Restore(obj);
+ }
+
+ bool RegisterAndRestore(void *obj, wxPersistentObject *po)
+ {
+ return Register(obj, po) && Restore(obj);
+ }
+
+
+ // methods used by the persistent objects to save and restore the data
+ //
+ // currently these methods simply use wxConfig::Get() but they may be
+ // overridden in the derived class (once we allow creating custom
+ // persistent managers)
+#define wxPERSIST_DECLARE_SAVE_RESTORE_FOR(Type) \
+ virtual bool SaveValue(const wxPersistentObject& who, \
+ const wxString& name, \
+ Type value); \
+ \
+ virtual bool \
+ RestoreValue(const wxPersistentObject& who, \
+ const wxString& name, \
+ Type *value)
+
+ wxPERSIST_DECLARE_SAVE_RESTORE_FOR(bool);
+ wxPERSIST_DECLARE_SAVE_RESTORE_FOR(int);
+ wxPERSIST_DECLARE_SAVE_RESTORE_FOR(long);
+ wxPERSIST_DECLARE_SAVE_RESTORE_FOR(wxString);
+
+#undef wxPERSIST_DECLARE_SAVE_RESTORE_FOR
+
+protected:
+ // ctor is private, use Get()
+ wxPersistenceManager()
+ {
+ m_doSave =
+ m_doRestore = true;
+ }
+
+
+ // Return the config object to use, by default just the global one but a
+ // different one could be used by the derived class if needed.
+ virtual wxConfigBase *GetConfig() const { return wxConfigBase::Get(); }
+
+ // Return the path to use for saving the setting with the given name for
+ // the specified object (notice that the name is the name of the setting,
+ // not the name of the object itself which can be retrieved with GetName()).
+ virtual wxString GetKey(const wxPersistentObject& who,
+ const wxString& name) const;
+
+
+private:
+ // map with the registered objects as keys and associated
+ // wxPersistentObjects as values
+ wxPersistentObjectsMap m_persistentObjects;
+
+ // true if we should restore/save the settings (it doesn't make much sense
+ // to use this class when both of them are false but setting one of them to
+ // false may make sense in some situations)
+ bool m_doSave,
+ m_doRestore;
+
+ wxDECLARE_NO_COPY_CLASS(wxPersistenceManager);
+};
+
+// ----------------------------------------------------------------------------
+// wxPersistentObject: ABC for anything persistent
+// ----------------------------------------------------------------------------
+
+class wxPersistentObject
+{
+public:
+ // ctor associates us with the object whose options we save/restore
+ wxPersistentObject(void *obj) : m_obj(obj) { }
+
+ // trivial but virtual dtor
+ virtual ~wxPersistentObject() { }
+
+
+ // methods used by wxPersistenceManager
+ // ------------------------------------
+
+ // save/restore the corresponding objects settings
+ //
+ // these methods shouldn't be used directly as they don't respect the
+ // global wxPersistenceManager::DisableSaving/Restoring() settings, use
+ // wxPersistenceManager methods with the same name instead
+ virtual void Save() const = 0;
+ virtual bool Restore() = 0;
+
+
+ // get the kind of the objects we correspond to, e.g. "Frame"
+ virtual wxString GetKind() const = 0;
+
+ // get the name of the object we correspond to, e.g. "Main"
+ virtual wxString GetName() const = 0;
+
+
+ // return the associated object
+ void *GetObject() const { return m_obj; }
+
+protected:
+ // wrappers for wxPersistenceManager methods which don't require passing
+ // "this" as the first parameter all the time
+ template <typename T>
+ bool SaveValue(const wxString& name, T value) const
+ {
+ return wxPersistenceManager::Get().SaveValue(*this, name, value);
+ }
+
+ template <typename T>
+ bool RestoreValue(const wxString& name, T *value)
+ {
+ return wxPersistenceManager::Get().RestoreValue(*this, name, value);
+ }
+
+private:
+ void * const m_obj;
+
+ wxDECLARE_NO_COPY_CLASS(wxPersistentObject);
+};
+
+// FIXME-VC6: VC6 has troubles with template methods of DLL-exported classes,
+// apparently it believes they should be defined in the DLL (which
+// is, of course, impossible as the DLL doesn't know for which types
+// will they be instantiated) instead of compiling them when
+// building the main application itself. Because of this problem
+// (which only arises in debug build!) we can't use the usual
+// RegisterAndRestore(obj) with it and need to explicitly create the
+// persistence adapter. To hide this ugliness we define a global
+// function which does it for us.
+template <typename T>
+inline bool wxPersistentRegisterAndRestore(T *obj)
+{
+ wxPersistentObject * const pers = wxCreatePersistentObject(obj);
+
+ return wxPersistenceManager::Get().RegisterAndRestore(obj, pers);
+
+}
+
+// A helper function which also sets the name for the (wxWindow-derived) object
+// before registering and restoring it.
+template <typename T>
+inline bool wxPersistentRegisterAndRestore(T *obj, const wxString& name)
+{
+ obj->SetName(name);
+
+ return wxPersistentRegisterAndRestore(obj);
+}
+
+#endif // _WX_PERSIST_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/persist/bookctrl.h
+// Purpose: persistence support for wxBookCtrl
+// Author: Vadim Zeitlin
+// Created: 2009-01-19
+// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PERSIST_BOOKCTRL_H_
+#define _WX_PERSIST_BOOKCTRL_H_
+
+#include "wx/persist/window.h"
+
+#include "wx/bookctrl.h"
+
+// ----------------------------------------------------------------------------
+// string constants used by wxPersistentBookCtrl
+// ----------------------------------------------------------------------------
+
+#define wxPERSIST_BOOK_KIND "Book"
+
+#define wxPERSIST_BOOK_SELECTION "Selection"
+
+// ----------------------------------------------------------------------------
+// wxPersistentBookCtrl: supports saving/restoring book control selection
+// ----------------------------------------------------------------------------
+
+class wxPersistentBookCtrl : public wxPersistentWindow<wxBookCtrlBase>
+{
+public:
+ wxPersistentBookCtrl(wxBookCtrlBase *book)
+ : wxPersistentWindow<wxBookCtrlBase>(book)
+ {
+ }
+
+ virtual void Save() const
+ {
+ SaveValue(wxPERSIST_BOOK_SELECTION, Get()->GetSelection());
+ }
+
+ virtual bool Restore()
+ {
+ long sel;
+ if ( RestoreValue(wxPERSIST_BOOK_SELECTION, &sel) )
+ {
+ wxBookCtrlBase * const book = Get();
+ if ( sel >= 0 && (unsigned)sel < book->GetPageCount() )
+ {
+ book->SetSelection(sel);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ virtual wxString GetKind() const { return wxPERSIST_BOOK_KIND; }
+};
+
+inline wxPersistentObject *wxCreatePersistentObject(wxBookCtrlBase *book)
+{
+ return new wxPersistentBookCtrl(book);
+}
+
+#endif // _WX_PERSIST_BOOKCTRL_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/persist/splitter.h
+// Purpose: Persistence support for wxSplitterWindow.
+// Author: Vadim Zeitlin
+// Created: 2011-08-31
+// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PERSIST_SPLITTER_H_
+#define _WX_PERSIST_SPLITTER_H_
+
+#include "wx/persist/window.h"
+
+#include "wx/splitter.h"
+
+// ----------------------------------------------------------------------------
+// string constants used by wxPersistentSplitter
+// ----------------------------------------------------------------------------
+
+#define wxPERSIST_SPLITTER_KIND "Splitter"
+
+// Special position value of -1 means the splitter is not split at all.
+#define wxPERSIST_SPLITTER_POSITION "Position"
+
+// ----------------------------------------------------------------------------
+// wxPersistentSplitter: supports saving/restoring splitter position
+// ----------------------------------------------------------------------------
+
+class wxPersistentSplitter : public wxPersistentWindow<wxSplitterWindow>
+{
+public:
+ wxPersistentSplitter(wxSplitterWindow* splitter)
+ : wxPersistentWindow<wxSplitterWindow>(splitter)
+ {
+ }
+
+ virtual void Save() const
+ {
+ wxSplitterWindow* const splitter = Get();
+
+ int pos = splitter->IsSplit() ? splitter->GetSashPosition() : -1;
+ SaveValue(wxPERSIST_SPLITTER_POSITION, pos);
+ }
+
+ virtual bool Restore()
+ {
+ int pos;
+ if ( !RestoreValue(wxPERSIST_SPLITTER_POSITION, &pos) )
+ return false;
+
+ if ( pos == -1 )
+ Get()->Unsplit();
+ else
+ Get()->SetSashPosition(pos);
+
+ return true;
+ }
+
+ virtual wxString GetKind() const { return wxPERSIST_SPLITTER_KIND; }
+};
+
+inline wxPersistentObject *wxCreatePersistentObject(wxSplitterWindow* splitter)
+{
+ return new wxPersistentSplitter(splitter);
+}
+
+#endif // _WX_PERSIST_SPLITTER_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/persist/toplevel.h
+// Purpose: persistence support for wxTLW
+// Author: Vadim Zeitlin
+// Created: 2009-01-19
+// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PERSIST_TOPLEVEL_H_
+#define _WX_PERSIST_TOPLEVEL_H_
+
+#include "wx/persist/window.h"
+
+#include "wx/toplevel.h"
+#include "wx/display.h"
+
+// ----------------------------------------------------------------------------
+// string constants used by wxPersistentTLW
+// ----------------------------------------------------------------------------
+
+// we use just "Window" to keep configuration files and such short, there
+// should be no confusion with wxWindow itself as we don't have persistent
+// windows, just persistent controls which have their own specific kind strings
+#define wxPERSIST_TLW_KIND "Window"
+
+// names for various persistent options
+#define wxPERSIST_TLW_X "x"
+#define wxPERSIST_TLW_Y "y"
+#define wxPERSIST_TLW_W "w"
+#define wxPERSIST_TLW_H "h"
+
+#define wxPERSIST_TLW_MAXIMIZED "Maximized"
+#define wxPERSIST_TLW_ICONIZED "Iconized"
+
+// ----------------------------------------------------------------------------
+// wxPersistentTLW: supports saving/restoring window position and size as well
+// as maximized/iconized/restore state
+// ----------------------------------------------------------------------------
+
+class wxPersistentTLW : public wxPersistentWindow<wxTopLevelWindow>
+{
+public:
+ wxPersistentTLW(wxTopLevelWindow *tlw)
+ : wxPersistentWindow<wxTopLevelWindow>(tlw)
+ {
+ }
+
+ virtual void Save() const
+ {
+ const wxTopLevelWindow * const tlw = Get();
+
+ const wxPoint pos = tlw->GetScreenPosition();
+ SaveValue(wxPERSIST_TLW_X, pos.x);
+ SaveValue(wxPERSIST_TLW_Y, pos.y);
+
+ // notice that we use GetSize() here and not GetClientSize() because
+ // the latter doesn't return correct results for the minimized windows
+ // (at least not under Windows)
+ //
+ // of course, it shouldn't matter anyhow usually, the client size
+ // should be preserved as well unless the size of the decorations
+ // changed between the runs
+ const wxSize size = tlw->GetSize();
+ SaveValue(wxPERSIST_TLW_W, size.x);
+ SaveValue(wxPERSIST_TLW_H, size.y);
+
+ SaveValue(wxPERSIST_TLW_MAXIMIZED, tlw->IsMaximized());
+ SaveValue(wxPERSIST_TLW_ICONIZED, tlw->IsIconized());
+ }
+
+ virtual bool Restore()
+ {
+ wxTopLevelWindow * const tlw = Get();
+
+ long x wxDUMMY_INITIALIZE(-1),
+ y wxDUMMY_INITIALIZE(-1),
+ w wxDUMMY_INITIALIZE(-1),
+ h wxDUMMY_INITIALIZE(-1);
+ const bool hasPos = RestoreValue(wxPERSIST_TLW_X, &x) &&
+ RestoreValue(wxPERSIST_TLW_Y, &y);
+ const bool hasSize = RestoreValue(wxPERSIST_TLW_W, &w) &&
+ RestoreValue(wxPERSIST_TLW_H, &h);
+
+ if ( hasPos )
+ {
+ // to avoid making the window completely invisible if it had been
+ // shown on a monitor which was disconnected since the last run
+ // (this is pretty common for notebook with external displays)
+ //
+ // NB: we should allow window position to be (slightly) off screen,
+ // it's not uncommon to position the window so that its upper
+ // left corner has slightly negative coordinate
+ if ( wxDisplay::GetFromPoint(wxPoint(x, y)) != wxNOT_FOUND ||
+ (hasSize && wxDisplay::GetFromPoint(
+ wxPoint(x + w, y + h)) != wxNOT_FOUND) )
+ {
+ tlw->Move(x, y, wxSIZE_ALLOW_MINUS_ONE);
+ }
+ //else: should we try to adjust position/size somehow?
+ }
+
+ if ( hasSize )
+ tlw->SetSize(w, h);
+
+ // note that the window can be both maximized and iconized
+ bool maximized;
+ if ( RestoreValue(wxPERSIST_TLW_MAXIMIZED, &maximized) && maximized )
+ tlw->Maximize();
+
+ bool iconized;
+ if ( RestoreValue(wxPERSIST_TLW_ICONIZED, &iconized) && iconized )
+ tlw->Iconize();
+
+ // the most important property of the window that we restore is its
+ // size, so disregard the value of hasPos here
+ return hasSize;
+ }
+
+ virtual wxString GetKind() const { return wxPERSIST_TLW_KIND; }
+};
+
+inline wxPersistentObject *wxCreatePersistentObject(wxTopLevelWindow *tlw)
+{
+ return new wxPersistentTLW(tlw);
+}
+
+#endif // _WX_PERSIST_TOPLEVEL_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/persist/treebook.h
+// Purpose: persistence support for wxBookCtrl
+// Author: Vadim Zeitlin
+// Created: 2009-01-19
+// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PERSIST_TREEBOOK_H_
+#define _WX_PERSIST_TREEBOOK_H_
+
+#include "wx/persist/bookctrl.h"
+
+#include "wx/arrstr.h"
+#include "wx/treebook.h"
+
+// ----------------------------------------------------------------------------
+// string constants used by wxPersistentTreeBookCtrl
+// ----------------------------------------------------------------------------
+
+#define wxPERSIST_TREEBOOK_KIND "TreeBook"
+
+// this key contains the indices of all expanded nodes in the tree book
+// separated by wxPERSIST_TREEBOOK_EXPANDED_SEP
+#define wxPERSIST_TREEBOOK_EXPANDED_BRANCHES "Expanded"
+#define wxPERSIST_TREEBOOK_EXPANDED_SEP ','
+
+// ----------------------------------------------------------------------------
+// wxPersistentTreeBookCtrl: supports saving/restoring open tree branches
+// ----------------------------------------------------------------------------
+
+class wxPersistentTreeBookCtrl : public wxPersistentBookCtrl
+{
+public:
+ wxPersistentTreeBookCtrl(wxTreebook *book)
+ : wxPersistentBookCtrl(book)
+ {
+ }
+
+ virtual void Save() const
+ {
+ const wxTreebook * const book = GetTreeBook();
+
+ wxString expanded;
+ const size_t count = book->GetPageCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ if ( book->IsNodeExpanded(n) )
+ {
+ if ( !expanded.empty() )
+ expanded += wxPERSIST_TREEBOOK_EXPANDED_SEP;
+
+ expanded += wxString::Format("%u", static_cast<unsigned>(n));
+ }
+ }
+
+ SaveValue(wxPERSIST_TREEBOOK_EXPANDED_BRANCHES, expanded);
+
+ wxPersistentBookCtrl::Save();
+ }
+
+ virtual bool Restore()
+ {
+ wxTreebook * const book = GetTreeBook();
+
+ wxString expanded;
+ if ( RestoreValue(wxPERSIST_TREEBOOK_EXPANDED_BRANCHES, &expanded) )
+ {
+ const wxArrayString
+ indices(wxSplit(expanded, wxPERSIST_TREEBOOK_EXPANDED_SEP));
+
+ const size_t pageCount = book->GetPageCount();
+ const size_t count = indices.size();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ unsigned long idx;
+ if ( indices[n].ToULong(&idx) && idx < pageCount )
+ book->ExpandNode(idx);
+ }
+ }
+
+ return wxPersistentBookCtrl::Restore();
+ }
+
+ virtual wxString GetKind() const { return wxPERSIST_TREEBOOK_KIND; }
+
+ wxTreebook *GetTreeBook() const { return static_cast<wxTreebook *>(Get()); }
+};
+
+inline wxPersistentObject *wxCreatePersistentObject(wxTreebook *book)
+{
+ return new wxPersistentTreeBookCtrl(book);
+}
+
+#endif // _WX_PERSIST_TREEBOOK_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/persist/window.h
+// Purpose: wxPersistentWindow declaration
+// Author: Vadim Zeitlin
+// Created: 2009-01-23
+// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PERSIST_WINDOW_H_
+#define _WX_PERSIST_WINDOW_H_
+
+#include "wx/persist.h"
+
+#include "wx/window.h"
+
+// ----------------------------------------------------------------------------
+// wxPersistentWindow: base class for persistent windows, uses the window name
+// as persistent name by default and automatically reacts
+// to the window destruction
+// ----------------------------------------------------------------------------
+
+// type-independent part of wxPersistentWindow
+class wxPersistentWindowBase :
+ wxBIND_OR_CONNECT_HACK_BASE_CLASS
+ public wxPersistentObject
+{
+public:
+ wxPersistentWindowBase(wxWindow *win)
+ : wxPersistentObject(win)
+ {
+ wxBIND_OR_CONNECT_HACK(win, wxEVT_DESTROY, wxWindowDestroyEventHandler,
+ wxPersistentWindowBase::HandleDestroy, this);
+ }
+
+ virtual wxString GetName() const
+ {
+ const wxString name = GetWindow()->GetName();
+ wxASSERT_MSG( !name.empty(), "persistent windows should be named!" );
+
+ return name;
+ }
+
+protected:
+ wxWindow *GetWindow() const { return static_cast<wxWindow *>(GetObject()); }
+
+private:
+ void HandleDestroy(wxWindowDestroyEvent& event)
+ {
+ event.Skip();
+
+ // only react to the destruction of this object itself, not of any of
+ // its children
+ if ( event.GetEventObject() == GetObject() )
+ {
+ // this will delete this object itself
+ wxPersistenceManager::Get().SaveAndUnregister(GetWindow());
+ }
+ }
+
+ wxDECLARE_NO_COPY_CLASS(wxPersistentWindowBase);
+};
+
+template <class T>
+class wxPersistentWindow : public wxPersistentWindowBase
+{
+public:
+ typedef T WindowType;
+
+ wxPersistentWindow(WindowType *win)
+ : wxPersistentWindowBase(win)
+ {
+ }
+
+ WindowType *Get() const { return static_cast<WindowType *>(GetWindow()); }
+};
+
+#endif // _WX_PERSIST_WINDOW_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/pickerbase.h
+// Purpose: wxPickerBase definition
+// Author: Francesco Montorsi (based on Vadim Zeitlin's code)
+// Modified by:
+// Created: 14/4/2006
+// Copyright: (c) Vadim Zeitlin, Francesco Montorsi
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PICKERBASE_H_BASE_
+#define _WX_PICKERBASE_H_BASE_
+
+#include "wx/control.h"
+#include "wx/sizer.h"
+#include "wx/containr.h"
+
+class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
+class WXDLLIMPEXP_FWD_CORE wxToolTip;
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxButtonNameStr[];
+
+// ----------------------------------------------------------------------------
+// wxPickerBase is the base class for the picker controls which support
+// a wxPB_USE_TEXTCTRL style; i.e. for those pickers which can use an auxiliary
+// text control next to the 'real' picker.
+//
+// The wxTextPickerHelper class manages enabled/disabled state of the text control,
+// its sizing and positioning.
+// ----------------------------------------------------------------------------
+
+#define wxPB_USE_TEXTCTRL 0x0002
+#define wxPB_SMALL 0x8000
+
+class WXDLLIMPEXP_CORE wxPickerBase : public wxNavigationEnabled<wxControl>
+{
+public:
+ // ctor: text is the associated text control
+ wxPickerBase() : m_text(NULL), m_picker(NULL), m_sizer(NULL)
+ { }
+ virtual ~wxPickerBase() {}
+
+
+ // if present, intercepts wxPB_USE_TEXTCTRL style and creates the text control
+ // The 3rd argument is the initial wxString to display in the text control
+ bool CreateBase(wxWindow *parent,
+ wxWindowID id,
+ const wxString& text = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr);
+
+public: // public API
+
+ // margin between the text control and the picker
+ void SetInternalMargin(int newmargin)
+ { GetTextCtrlItem()->SetBorder(newmargin); m_sizer->Layout(); }
+ int GetInternalMargin() const
+ { return GetTextCtrlItem()->GetBorder(); }
+
+ // proportion of the text control
+ void SetTextCtrlProportion(int prop)
+ { GetTextCtrlItem()->SetProportion(prop); m_sizer->Layout(); }
+ int GetTextCtrlProportion() const
+ { return GetTextCtrlItem()->GetProportion(); }
+
+ // proportion of the picker control
+ void SetPickerCtrlProportion(int prop)
+ { GetPickerCtrlItem()->SetProportion(prop); m_sizer->Layout(); }
+ int GetPickerCtrlProportion() const
+ { return GetPickerCtrlItem()->GetProportion(); }
+
+ bool IsTextCtrlGrowable() const
+ { return (GetTextCtrlItem()->GetFlag() & wxGROW) != 0; }
+ void SetTextCtrlGrowable(bool grow = true)
+ {
+ int f = GetDefaultTextCtrlFlag();
+ if ( grow )
+ f |= wxGROW;
+ else
+ f &= ~wxGROW;
+
+ GetTextCtrlItem()->SetFlag(f);
+ }
+
+ bool IsPickerCtrlGrowable() const
+ { return (GetPickerCtrlItem()->GetFlag() & wxGROW) != 0; }
+ void SetPickerCtrlGrowable(bool grow = true)
+ {
+ int f = GetDefaultPickerCtrlFlag();
+ if ( grow )
+ f |= wxGROW;
+ else
+ f &= ~wxGROW;
+
+ GetPickerCtrlItem()->SetFlag(f);
+ }
+
+ bool HasTextCtrl() const
+ { return m_text != NULL; }
+ wxTextCtrl *GetTextCtrl()
+ { return m_text; }
+ wxControl *GetPickerCtrl()
+ { return m_picker; }
+
+ void SetTextCtrl(wxTextCtrl* text)
+ { m_text = text; }
+ void SetPickerCtrl(wxControl* picker)
+ { m_picker = picker; }
+
+ // methods that derived class must/may override
+ virtual void UpdatePickerFromTextCtrl() = 0;
+ virtual void UpdateTextCtrlFromPicker() = 0;
+
+protected:
+ // overridden base class methods
+#if wxUSE_TOOLTIPS
+ virtual void DoSetToolTip(wxToolTip *tip);
+#endif // wxUSE_TOOLTIPS
+
+
+ // event handlers
+ void OnTextCtrlDelete(wxWindowDestroyEvent &);
+ void OnTextCtrlUpdate(wxCommandEvent &);
+ void OnTextCtrlKillFocus(wxFocusEvent &);
+
+ // returns the set of styles for the attached wxTextCtrl
+ // from given wxPickerBase's styles
+ virtual long GetTextCtrlStyle(long style) const
+ { return (style & wxWINDOW_STYLE_MASK); }
+
+ // returns the set of styles for the m_picker
+ virtual long GetPickerStyle(long style) const
+ { return (style & wxWINDOW_STYLE_MASK); }
+
+
+ wxSizerItem *GetPickerCtrlItem() const
+ {
+ if (this->HasTextCtrl())
+ return m_sizer->GetItem((size_t)1);
+ return m_sizer->GetItem((size_t)0);
+ }
+
+ wxSizerItem *GetTextCtrlItem() const
+ {
+ wxASSERT(this->HasTextCtrl());
+ return m_sizer->GetItem((size_t)0);
+ }
+
+ int GetDefaultPickerCtrlFlag() const
+ {
+ // on macintosh, without additional borders
+ // there's not enough space for focus rect
+ return wxALIGN_CENTER_VERTICAL|wxGROW
+#ifdef __WXMAC__
+ | wxTOP | wxRIGHT | wxBOTTOM
+#endif
+ ;
+ }
+
+ int GetDefaultTextCtrlFlag() const
+ {
+ // on macintosh, without wxALL there's not enough space for focus rect
+ return wxALIGN_CENTER_VERTICAL
+#ifdef __WXMAC__
+ | wxALL
+#else
+ | wxRIGHT
+#endif
+ ;
+ }
+
+ void PostCreation();
+
+protected:
+ wxTextCtrl *m_text; // can be NULL
+ wxControl *m_picker;
+ wxBoxSizer *m_sizer;
+
+private:
+ DECLARE_ABSTRACT_CLASS(wxPickerBase)
+};
+
+
+#endif
+ // _WX_PICKERBASE_H_BASE_
--- /dev/null
+/**
+* Name: wx/platform.h
+* Purpose: define the OS and compiler identification macros
+* Author: Vadim Zeitlin
+* Modified by:
+* Created: 29.10.01 (extracted from wx/defs.h)
+* Copyright: (c) 1997-2001 Vadim Zeitlin
+* Licence: wxWindows licence
+*/
+
+/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
+
+#ifndef _WX_PLATFORM_H_
+#define _WX_PLATFORM_H_
+
+#ifdef __WXMAC_XCODE__
+# include <unistd.h>
+# include <TargetConditionals.h>
+# include <AvailabilityMacros.h>
+# ifndef MAC_OS_X_VERSION_10_4
+# define MAC_OS_X_VERSION_10_4 1040
+# endif
+# ifndef MAC_OS_X_VERSION_10_5
+# define MAC_OS_X_VERSION_10_5 1050
+# endif
+# ifndef MAC_OS_X_VERSION_10_6
+# define MAC_OS_X_VERSION_10_6 1060
+# endif
+# ifndef MAC_OS_X_VERSION_10_7
+# define MAC_OS_X_VERSION_10_7 1070
+# endif
+# ifndef MAC_OS_X_VERSION_10_8
+# define MAC_OS_X_VERSION_10_8 1080
+# endif
+# include "wx/osx/config_xcode.h"
+# ifndef __WXOSX__
+# define __WXOSX__ 1
+# endif
+# ifndef __WXMAC__
+# define __WXMAC__ 1
+# endif
+#endif
+
+/*
+ We use __WINDOWS__ as our main identification symbol for Microsoft Windows
+ but it's actually not predefined directly by any commonly used compilers
+ (only Watcom defines it itself and it's not supported any longer), so we
+ define it ourselves if any of the following macros is defined:
+
+ - MSVC _WIN32 (notice that this is also defined under Win64)
+ - Borland __WIN32__
+ - Our __WXMSW__ which selects Windows as platform automatically
+ */
+#if defined(_WIN32) || defined(__WIN32__) || defined(__WXMSW__)
+# ifndef __WINDOWS__
+# define __WINDOWS__
+# endif /* !__WINDOWS__ */
+#endif /* Any standard symbol indicating Windows */
+
+#if defined(_WIN64)
+# ifndef _WIN32
+ /*
+ a lot of code (mistakenly) uses #ifdef _WIN32 to either test for
+ Windows or to test for !__WIN16__, so we must define _WIN32 for
+ Win64 as well to ensure that the existing code continues to work.
+ */
+# define _WIN32
+# endif /* !_WIN32 */
+
+# ifndef __WIN64__
+# define __WIN64__
+# endif /* !__WIN64__ */
+#endif /* _WIN64 */
+
+#if defined(__WINDOWS__)
+ /* Select wxMSW under Windows if no other port is specified. */
+# if !defined(__WXMSW__) && !defined(__WXMOTIF__) && !defined(__WXGTK__) && !defined(__WXX11__)
+# define __WXMSW__
+# endif
+
+# if !defined(__WINDOWS__)
+# define __WINDOWS__
+# endif
+
+# ifndef _WIN32
+# define _WIN32
+# endif
+
+# ifndef WIN32
+# define WIN32
+# endif
+
+# ifndef __WIN32__
+# define __WIN32__
+# endif
+#endif /* __WINDOWS__ */
+
+/*
+ Don't use widget toolkit specific code in non-GUI code in the library
+ itself to ensure that the same base library is used for both MSW and GTK
+ ports. But keep __WXMSW__ defined for (console) applications using
+ wxWidgets for compatibility.
+ */
+#if defined(WXBUILDING) && defined(wxUSE_GUI) && !wxUSE_GUI
+# ifdef __WXMSW__
+# undef __WXMSW__
+# endif
+# ifdef __WXGTK__
+# undef __WXGTK__
+# endif
+#endif
+
+#if defined(__WXGTK__) && defined(__WINDOWS__)
+
+# ifdef __WXMSW__
+# undef __WXMSW__
+# endif
+
+#endif /* __WXGTK__ && __WINDOWS__ */
+
+/* detect MS SmartPhone */
+#if defined( WIN32_PLATFORM_WFSP )
+# ifndef __SMARTPHONE__
+# define __SMARTPHONE__
+# endif
+# ifndef __WXWINCE__
+# define __WXWINCE__
+# endif
+#endif
+
+/* detect PocketPC */
+#if defined( WIN32_PLATFORM_PSPC )
+# ifndef __POCKETPC__
+# define __POCKETPC__
+# endif
+# ifndef __WXWINCE__
+# define __WXWINCE__
+# endif
+#endif
+
+/* detect Standard WinCE SDK */
+#if defined( WCE_PLATFORM_STANDARDSDK )
+# ifndef __WINCE_STANDARDSDK__
+# define __WINCE_STANDARDSDK__
+# endif
+# ifndef __WXWINCE__
+# define __WXWINCE__
+# endif
+#endif
+
+#if defined(_WIN32_WCE) && !defined(WIN32_PLATFORM_WFSP) && !defined(WIN32_PLATFORM_PSPC)
+# if (_WIN32_WCE >= 400)
+# ifndef __WINCE_NET__
+# define __WINCE_NET__
+# endif
+# elif (_WIN32_WCE >= 200)
+# ifndef __HANDHELDPC__
+# define __HANDHELDPC__
+# endif
+# endif
+# ifndef __WXWINCE__
+# define __WXWINCE__
+# endif
+#endif
+
+#if defined(__WXWINCE__) && defined(_MSC_VER) && (_MSC_VER == 1201)
+ #define __EVC4__
+#endif
+
+#if defined(__POCKETPC__) || defined(__SMARTPHONE__) || defined(__WXGPE__)
+# define __WXHANDHELD__
+#endif
+
+#ifdef __ANDROID__
+# define __WXANDROID__
+# include "wx/android/config_android.h"
+#endif
+
+#include "wx/compiler.h"
+
+/*
+ Include wx/setup.h for the Unix platform defines generated by configure and
+ the library compilation options
+
+ Note that it must be included before defining hardware symbols below as they
+ could be already defined by configure but it must be included after defining
+ the compiler macros above as msvc/wx/setup.h relies on them under Windows.
+ */
+#include "wx/setup.h"
+
+/*
+ Convenience for any optional classes that use the wxAnyButton base class.
+ */
+#if wxUSE_TOGGLEBTN || wxUSE_BUTTON
+ #define wxHAS_ANY_BUTTON
+#endif
+
+
+/*
+ Hardware platform detection.
+
+ VC++ defines _M_xxx symbols.
+ */
+#if defined(_M_IX86) || defined(i386) || defined(__i386) || defined(__i386__)
+ #ifndef __INTEL__
+ #define __INTEL__
+ #endif
+#endif /* x86 */
+
+#if defined(_M_IA64)
+ #ifndef __IA64__
+ #define __IA64__
+ #endif
+#endif /* ia64 */
+
+#if defined(_M_MPPC) || defined(__PPC__) || defined(__ppc__)
+ #ifndef __POWERPC__
+ #define __POWERPC__
+ #endif
+#endif /* alpha */
+
+#if defined(_M_ALPHA) || defined(__AXP__)
+ #ifndef __ALPHA__
+ #define __ALPHA__
+ #endif
+#endif /* alpha */
+
+
+/*
+ adjust the Unicode setting: wxUSE_UNICODE should be defined as 0 or 1
+ and is used by wxWidgets, _UNICODE and/or UNICODE may be defined or used by
+ the system headers so bring these settings in sync
+ */
+
+/* set wxUSE_UNICODE to 1 if UNICODE or _UNICODE is defined */
+#if defined(_UNICODE) || defined(UNICODE)
+# undef wxUSE_UNICODE
+# define wxUSE_UNICODE 1
+#else /* !UNICODE */
+# ifndef wxUSE_UNICODE
+# define wxUSE_UNICODE 0
+# endif
+#endif /* UNICODE/!UNICODE */
+
+/* and vice versa: define UNICODE and _UNICODE if wxUSE_UNICODE is 1 */
+#if wxUSE_UNICODE
+# ifndef _UNICODE
+# define _UNICODE
+# endif
+# ifndef UNICODE
+# define UNICODE
+# endif
+#endif /* wxUSE_UNICODE */
+
+
+/*
+ test for old versions of Borland C, normally need at least 5.82, Turbo
+ explorer, available for free at http://www.turboexplorer.com/downloads
+*/
+
+
+/*
+ Older versions of Borland C have some compiler bugs that need
+ workarounds. Mostly pertains to the free command line compiler 5.5.1.
+*/
+#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x551)
+ /*
+ The Borland free compiler is unable to handle overloaded enum
+ comparisons under certain conditions e.g. when any class has a
+ conversion ctor for an integral type and there's an overload to
+ compare between an integral type and that class type.
+ */
+# define wxCOMPILER_NO_OVERLOAD_ON_ENUM
+
+ /*
+ This is needed to overcome bugs in 5.5.1 STL, linking errors will
+ result if it is not defined.
+ */
+# define _RWSTD_COMPILE_INSTANTIATE
+
+ /*
+ Preprocessor in older Borland compilers have major problems
+ concatenating with ##. Specifically, if the string operands being
+ concatenated have special meaning (e.g. L"str", 123i64 etc)
+ then ## will not concatenate the operands correctly.
+
+ As a workaround, define wxPREPEND* and wxAPPEND* without using
+ wxCONCAT_HELPER.
+ */
+# define wxCOMPILER_BROKEN_CONCAT_OPER
+#endif /* __BORLANDC__ */
+
+/*
+ OS: first of all, test for MS-DOS platform. We must do this before testing
+ for Unix, because DJGPP compiler defines __unix__ under MS-DOS
+ */
+#if defined(__GO32__) || defined(__DJGPP__) || defined(__DOS__)
+# ifndef __DOS__
+# define __DOS__
+# endif
+ /* size_t is the same as unsigned int for Watcom 11 compiler, */
+ /* so define it if it hadn't been done by configure yet */
+# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
+# ifdef __WATCOMC__
+# define wxSIZE_T_IS_UINT
+# endif
+# ifdef __DJGPP__
+# define wxSIZE_T_IS_ULONG
+# endif
+# endif
+
+/*
+ OS: then test for generic Unix defines, then for particular flavours and
+ finally for Unix-like systems
+ Mac OS X matches this case (__MACH__), prior Mac OS do not.
+ */
+#elif defined(__UNIX__) || defined(__unix) || defined(__unix__) || \
+ defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) || \
+ defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) || \
+ defined(__EMX__) || defined(__VMS) || defined(__BEOS__) || defined(__MACH__)
+
+# define __UNIX_LIKE__
+
+ /* Helps SGI compilation, apparently */
+# ifdef __SGI__
+# ifdef __GNUG__
+# define __need_wchar_t
+# else /* !gcc */
+ /*
+ Note I use the term __SGI_CC__ for both cc and CC, its not a good
+ idea to mix gcc and cc/CC, the name mangling is different
+ */
+# define __SGI_CC__
+# endif /* gcc/!gcc */
+
+ /* system headers use this symbol and not __cplusplus in some places */
+# ifndef _LANGUAGE_C_PLUS_PLUS
+# define _LANGUAGE_C_PLUS_PLUS
+# endif
+# endif /* SGI */
+
+# ifdef __EMX__
+# define OS2EMX_PLAIN_CHAR
+# endif
+# if defined(__INNOTEK_LIBC__)
+ /* Ensure visibility of strnlen declaration */
+# define _GNU_SOURCE
+# endif
+
+ /* define __HPUX__ for HP-UX where standard macro is __hpux */
+# if defined(__hpux) && !defined(__HPUX__)
+# define __HPUX__
+# endif /* HP-UX */
+
+# if defined(__CYGWIN__) || defined(__WINE__)
+# if !defined(wxSIZE_T_IS_UINT)
+# define wxSIZE_T_IS_UINT
+# endif
+# endif
+
+ /* All of these should already be defined by including configure-
+ generated setup.h but we wish to support Xcode compilation without
+ requiring the user to define these himself.
+ */
+# if defined(__APPLE__) && defined(__MACH__)
+# ifndef __UNIX__
+# define __UNIX__ 1
+# endif
+# ifndef __BSD__
+# define __BSD__ 1
+# endif
+ /* __DARWIN__ is our own define to mean OS X or pure Darwin */
+# ifndef __DARWIN__
+# define __DARWIN__ 1
+# endif
+ /* NOTE: TARGET_CARBON is actually a 0/1 and must be 1 for OS X */
+# ifndef TARGET_CARBON
+# define TARGET_CARBON 1
+# endif
+ /* OS X uses unsigned long size_t for both ILP32 and LP64 modes. */
+# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
+# define wxSIZE_T_IS_ULONG
+# endif
+# endif
+
+/*
+ OS: OS/2
+ */
+#elif defined(__OS2__)
+
+ /* wxOS2 vs. non wxOS2 ports on OS2 platform */
+# if !defined(__WXMOTIF__) && !defined(__WXGTK__) && !defined(__WXX11__)
+# ifndef __WXPM__
+# define __WXPM__
+# endif
+# endif
+
+# if defined(__IBMCPP__)
+# define __VISAGEAVER__ __IBMCPP__
+# endif
+
+ /* Place other OS/2 compiler environment defines here */
+# if defined(__VISAGECPP__)
+ /* VisualAge is the only thing that understands _Optlink */
+# define LINKAGEMODE _Optlink
+# endif
+# define wxSIZE_T_IS_UINT
+
+/*
+ OS: Windows
+ */
+#elif defined(__WINDOWS__)
+
+ /* to be changed for Win64! */
+# ifndef __WIN32__
+# error "__WIN32__ should be defined for Win32 and Win64, Win16 is not supported"
+# endif
+
+ /* size_t is the same as unsigned int for all Windows compilers we know, */
+ /* so define it if it hadn't been done by configure yet */
+# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG) && !defined(__WIN64__)
+# define wxSIZE_T_IS_UINT
+# endif
+#else
+# error "Unknown platform."
+#endif /* OS */
+
+/*
+ if we're on a Unix system but didn't use configure (so that setup.h didn't
+ define __UNIX__), do define __UNIX__ now
+ */
+#if !defined(__UNIX__) && defined(__UNIX_LIKE__)
+# define __UNIX__
+#endif /* Unix */
+
+#if defined(__WXMOTIF__) || defined(__WXX11__)
+# define __X__
+#endif
+
+/*
+ We get "Large Files (ILP32) not supported in strict ANSI mode." #error
+ from HP-UX standard headers when compiling with g++ without this:
+ */
+#if defined(__HPUX__) && !defined(__STDC_EXT__)
+# define __STDC_EXT__ 1
+#endif
+
+/* Force linking against required libraries under Windows: */
+#ifdef __WXWINCE__
+# include "wx/msw/wince/libraries.h"
+#elif defined __WINDOWS__
+# include "wx/msw/libraries.h"
+#endif
+
+#if defined(__BORLANDC__) || (defined(__GNUC__) && __GNUC__ < 3)
+#define wxNEEDS_CHARPP
+#endif
+
+#if ( defined( __GNUWIN32__ ) || defined( __MINGW32__ ) || \
+ ( defined( __CYGWIN__ ) && defined( __WINDOWS__ ) ) || \
+ wxCHECK_WATCOM_VERSION(1,0) ) && \
+ !defined(__DOS__) && \
+ !defined(__WXPM__) && \
+ !defined(__WXMOTIF__) && \
+ !defined(__WXX11__)
+# include "wx/msw/gccpriv.h"
+#else
+# undef wxCHECK_W32API_VERSION
+# define wxCHECK_W32API_VERSION(maj, min) (0)
+#endif
+
+
+/*
+ Handle Darwin gcc universal compilation. Don't do this in an Apple-
+ specific case since no sane compiler should be defining either
+ __BIG_ENDIAN__ or __LITTLE_ENDIAN__ unless it really is generating
+ code that will be hosted on a machine with the appropriate endianness.
+ If a compiler defines neither, assume the user or configure set
+ WORDS_BIGENDIAN appropriately.
+ */
+#if defined(__BIG_ENDIAN__)
+# undef WORDS_BIGENDIAN
+# define WORDS_BIGENDIAN 1
+#elif defined(__LITTLE_ENDIAN__)
+# undef WORDS_BIGENDIAN
+#elif defined(__WXMAC__) && !defined(WORDS_BIGENDIAN)
+/* According to Stefan even ancient Mac compilers defined __BIG_ENDIAN__ */
+# warning "Compiling wxMac with probably wrong endianness"
+#endif
+/* also the 32/64 bit universal builds must be handled accordingly */
+#ifdef __DARWIN__
+# ifdef __LP64__
+# undef SIZEOF_VOID_P
+# undef SIZEOF_LONG
+# undef SIZEOF_SIZE_T
+# define SIZEOF_VOID_P 8
+# define SIZEOF_LONG 8
+# define SIZEOF_SIZE_T 8
+# else
+# undef SIZEOF_VOID_P
+# undef SIZEOF_LONG
+# undef SIZEOF_SIZE_T
+# define SIZEOF_VOID_P 4
+# define SIZEOF_LONG 4
+# define SIZEOF_SIZE_T 4
+# endif
+#endif
+
+/*
+ Define various OS X symbols before including wx/chkconf.h which uses them.
+
+ __WXOSX_MAC__ means Mac OS X, non embedded
+ __WXOSX_IPHONE__ means OS X iPhone
+ */
+
+/*
+ Normally all of __WXOSX_XXX__, __WXOSX__ and __WXMAC__ are defined by
+ configure but ensure that we also define them if configure was not used for
+ whatever reason.
+
+ The primary symbol remains __WXOSX_XXX__ one, __WXOSX__ exists to allow
+ checking for any OS X port (Carbon and Cocoa) and __WXMAC__ is an old name
+ for it.
+ */
+#if defined(__WXOSX_CARBON__) || defined(__WXOSX_COCOA__) || defined(__WXOSX_IPHONE__)
+# ifndef __WXOSX__
+# define __WXOSX__ 1
+# endif
+# ifndef __WXMAC__
+# define __WXMAC__ 1
+# endif
+#endif
+
+#ifdef __WXOSX__
+/* setup precise defines according to sdk used */
+# include <TargetConditionals.h>
+# if defined(__WXOSX_IPHONE__)
+# if !( defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE )
+# error "incorrect SDK for an iPhone build"
+# endif
+# else
+# if wxUSE_GUI && !(defined(__WXOSX_CARBON__) || defined(__WXOSX_COCOA__))
+# error "one of __WXOSX_IPHONE__, __WXOSX_CARBON__ or __WXOSX_COCOA__ must be defined for the GUI build"
+# endif
+# if !( defined(TARGET_OS_MAC) && TARGET_OS_MAC )
+# error "incorrect SDK for a Mac OS X build"
+# endif
+# define __WXOSX_MAC__ 1
+# endif
+#endif
+
+#ifdef __WXOSX_MAC__
+# if defined(__MACH__)
+# include <AvailabilityMacros.h>
+# ifndef MAC_OS_X_VERSION_10_4
+# define MAC_OS_X_VERSION_10_4 1040
+# endif
+# ifndef MAC_OS_X_VERSION_10_5
+# define MAC_OS_X_VERSION_10_5 1050
+# endif
+# ifndef MAC_OS_X_VERSION_10_6
+# define MAC_OS_X_VERSION_10_6 1060
+# endif
+# ifndef MAC_OS_X_VERSION_10_7
+# define MAC_OS_X_VERSION_10_7 1070
+# endif
+# ifndef MAC_OS_X_VERSION_10_8
+# define MAC_OS_X_VERSION_10_8 1080
+# endif
+# else
+# error "only mach-o configurations are supported"
+# endif
+#endif
+
+/*
+ __WXOSX_OR_COCOA__ is a common define to wxOSX (Carbon or Cocoa) and wxCocoa ports under OS X.
+
+ DO NOT use this define in base library code. Although wxMac has its own
+ private base library (and thus __WXOSX_OR_COCOA__,__WXMAC__ and related defines are
+ valid there), wxCocoa shares its library with other ports like wxGTK and wxX11.
+
+ To keep wx authors from screwing this up, only enable __WXOSX_OR_COCOA__ for wxCocoa when
+ not compiling the base library. We determine this by first checking if
+ wxUSE_BASE is not defined. If it is not defined, then we're not buildling
+ the base library, and possibly not building wx at all (but actually building
+ user code that's using wx). If it is defined then we must check to make sure
+ it is not true. If it is true, we're building base.
+
+ If you want it in the common darwin base library then use __DARWIN__. You
+ can use any Darwin-available libraries like CoreFoundation but please avoid
+ using OS X libraries like Carbon or CoreServices.
+
+ */
+#if defined(__WXOSX__) || (defined(__WXCOCOA__) && (!defined(wxUSE_BASE) || !wxUSE_BASE))
+# define __WXOSX_OR_COCOA__ 1
+#endif
+
+/*
+ check the consistency of the settings in setup.h: note that this must be
+ done after setting wxUSE_UNICODE correctly as it is used in wx/chkconf.h
+ and after defining the compiler macros which are used in it too
+ */
+#include "wx/chkconf.h"
+
+
+/*
+ some compilers don't support iostream.h any longer, while some of theme
+ are not updated with <iostream> yet, so override the users setting here
+ in such case.
+ */
+#if defined(_MSC_VER) && (_MSC_VER >= 1310)
+# undef wxUSE_IOSTREAMH
+# define wxUSE_IOSTREAMH 0
+#elif defined(__DMC__) || defined(__WATCOMC__)
+# undef wxUSE_IOSTREAMH
+# define wxUSE_IOSTREAMH 1
+#elif defined(__MINGW32__)
+# undef wxUSE_IOSTREAMH
+# define wxUSE_IOSTREAMH 0
+#endif /* compilers with/without iostream.h */
+
+/*
+ old C++ headers (like <iostream.h>) declare classes in the global namespace
+ while the new, standard ones (like <iostream>) do it in std:: namespace,
+ unless it's an old gcc version.
+
+ using this macro allows constuctions like "wxSTD iostream" to work in
+ either case
+ */
+#if !wxUSE_IOSTREAMH && (!defined(__GNUC__) || ( __GNUC__ > 2 ) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
+# define wxSTD std::
+#else
+# define wxSTD
+#endif
+
+/* On OpenVMS with the most recent HP C++ compiler some function (i.e. wscanf)
+ * are only available in the std-namespace. (BUG???)
+ */
+#if defined( __VMS ) && (__DECCXX_VER >= 70100000) && !defined(__STD_CFRONT) && !defined( __NONAMESPACE_STD )
+# define wxVMS_USE_STD std::
+#else
+# define wxVMS_USE_STD
+#endif
+
+#ifdef __VMS
+#define XtDisplay XTDISPLAY
+#ifdef __WXMOTIF__
+#define XtParent XTPARENT
+#define XtScreen XTSCREEN
+#define XtWindow XTWINDOW
+#endif
+#endif
+
+/* Choose which method we will use for updating menus
+ * - in OnIdle, or when we receive a wxEVT_MENU_OPEN event.
+ * Presently, only Windows, OS X and GTK+ support wxEVT_MENU_OPEN.
+ */
+#ifndef wxUSE_IDLEMENUUPDATES
+# if (defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXOSX__)) && !defined(__WXUNIVERSAL__)
+# define wxUSE_IDLEMENUUPDATES 0
+# else
+# define wxUSE_IDLEMENUUPDATES 1
+# endif
+#endif
+
+/*
+ * Define symbols that are not yet in
+ * configure or possibly some setup.h files.
+ * They will need to be added.
+ */
+
+#ifndef wxUSE_FILECONFIG
+# if wxUSE_CONFIG && wxUSE_TEXTFILE
+# define wxUSE_FILECONFIG 1
+# else
+# define wxUSE_FILECONFIG 0
+# endif
+#endif
+
+#ifndef wxUSE_HOTKEY
+# define wxUSE_HOTKEY 0
+#endif
+
+#if !defined(wxUSE_WXDIB) && defined(__WXMSW__)
+# define wxUSE_WXDIB 1
+#endif
+
+/*
+ Optionally supported C++ features.
+ */
+
+/*
+ RTTI: if it is disabled in build/msw/makefile.* then this symbol will
+ already be defined but it's also possible to do it from configure (with
+ g++) or by editing project files with MSVC so test for it here too.
+ */
+#ifndef wxNO_RTTI
+ /*
+ Only 4.3 defines __GXX_RTTI by default so its absence is not an
+ indication of disabled RTTI with the previous versions.
+ */
+# if wxCHECK_GCC_VERSION(4, 3)
+# ifndef __GXX_RTTI
+# define wxNO_RTTI
+# endif
+# elif defined(_MSC_VER)
+# ifndef _CPPRTTI
+# define wxNO_RTTI
+# endif
+# endif
+#endif /* wxNO_RTTI */
+
+#endif /* _WX_PLATFORM_H_ */
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/platinfo.h
+// Purpose: declaration of the wxPlatformInfo class
+// Author: Francesco Montorsi
+// Modified by:
+// Created: 07.07.2006 (based on wxToolkitInfo)
+// Copyright: (c) 2006 Francesco Montorsi
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PLATINFO_H_
+#define _WX_PLATINFO_H_
+
+#include "wx/string.h"
+
+// ----------------------------------------------------------------------------
+// wxPlatformInfo enums & structs
+// ----------------------------------------------------------------------------
+
+// VERY IMPORTANT: when changing these enum values, also change the relative
+// string tables in src/common/platinfo.cpp
+
+
+// families & sub-families of operating systems
+enum wxOperatingSystemId
+{
+ wxOS_UNKNOWN = 0, // returned on error
+
+ wxOS_MAC_OS = 1 << 0, // Apple Mac OS 8/9/X with Mac paths
+ wxOS_MAC_OSX_DARWIN = 1 << 1, // Apple Mac OS X with Unix paths
+ wxOS_MAC = wxOS_MAC_OS|wxOS_MAC_OSX_DARWIN,
+
+ wxOS_WINDOWS_9X = 1 << 2, // Windows 9x family (95/98/ME)
+ wxOS_WINDOWS_NT = 1 << 3, // Windows NT family (NT/2000/XP)
+ wxOS_WINDOWS_MICRO = 1 << 4, // MicroWindows
+ wxOS_WINDOWS_CE = 1 << 5, // Windows CE (Window Mobile)
+ wxOS_WINDOWS = wxOS_WINDOWS_9X |
+ wxOS_WINDOWS_NT |
+ wxOS_WINDOWS_MICRO |
+ wxOS_WINDOWS_CE,
+
+ wxOS_UNIX_LINUX = 1 << 6, // Linux
+ wxOS_UNIX_FREEBSD = 1 << 7, // FreeBSD
+ wxOS_UNIX_OPENBSD = 1 << 8, // OpenBSD
+ wxOS_UNIX_NETBSD = 1 << 9, // NetBSD
+ wxOS_UNIX_SOLARIS = 1 << 10, // SunOS
+ wxOS_UNIX_AIX = 1 << 11, // AIX
+ wxOS_UNIX_HPUX = 1 << 12, // HP/UX
+ wxOS_UNIX = wxOS_UNIX_LINUX |
+ wxOS_UNIX_FREEBSD |
+ wxOS_UNIX_OPENBSD |
+ wxOS_UNIX_NETBSD |
+ wxOS_UNIX_SOLARIS |
+ wxOS_UNIX_AIX |
+ wxOS_UNIX_HPUX,
+
+ // 1<<13 and 1<<14 available for other Unix flavours
+
+ wxOS_DOS = 1 << 15, // Microsoft DOS
+ wxOS_OS2 = 1 << 16 // OS/2
+};
+
+// list of wxWidgets ports - some of them can be used with more than
+// a single toolkit.
+enum wxPortId
+{
+ wxPORT_UNKNOWN = 0, // returned on error
+
+ wxPORT_BASE = 1 << 0, // wxBase, no native toolkit used
+
+ wxPORT_MSW = 1 << 1, // wxMSW, native toolkit is Windows API
+ wxPORT_MOTIF = 1 << 2, // wxMotif, using [Open]Motif or Lesstif
+ wxPORT_GTK = 1 << 3, // wxGTK, using GTK+ 1.x, 2.x, GPE or Maemo
+ wxPORT_DFB = 1 << 4, // wxDFB, using wxUniversal
+ wxPORT_X11 = 1 << 5, // wxX11, using wxUniversal
+ wxPORT_PM = 1 << 6, // wxOS2, using OS/2 Presentation Manager
+ wxPORT_OS2 = wxPORT_PM, // wxOS2, using OS/2 Presentation Manager
+ wxPORT_MAC = 1 << 7, // wxOSX (former wxMac), using Cocoa, Carbon or iPhone API
+ wxPORT_OSX = wxPORT_MAC, // wxOSX, using Cocoa, Carbon or iPhone API
+ wxPORT_COCOA = 1 << 8, // wxCocoa, using Cocoa NextStep/Mac API
+ wxPORT_WINCE = 1 << 9 // wxWinCE, toolkit is WinCE SDK API
+};
+
+// architecture of the operating system
+// (regardless of the build environment of wxWidgets library - see
+// wxIsPlatform64bit documentation for more info)
+enum wxArchitecture
+{
+ wxARCH_INVALID = -1, // returned on error
+
+ wxARCH_32, // 32 bit
+ wxARCH_64,
+
+ wxARCH_MAX
+};
+
+
+// endian-ness of the machine
+enum wxEndianness
+{
+ wxENDIAN_INVALID = -1, // returned on error
+
+ wxENDIAN_BIG, // 4321
+ wxENDIAN_LITTLE, // 1234
+ wxENDIAN_PDP, // 3412
+
+ wxENDIAN_MAX
+};
+
+// informations about a linux distro returned by the lsb_release utility
+struct wxLinuxDistributionInfo
+{
+ wxString Id;
+ wxString Release;
+ wxString CodeName;
+ wxString Description;
+
+ bool operator==(const wxLinuxDistributionInfo& ldi) const
+ {
+ return Id == ldi.Id &&
+ Release == ldi.Release &&
+ CodeName == ldi.CodeName &&
+ Description == ldi.Description;
+ }
+
+ bool operator!=(const wxLinuxDistributionInfo& ldi) const
+ { return !(*this == ldi); }
+};
+
+
+// ----------------------------------------------------------------------------
+// wxPlatformInfo
+// ----------------------------------------------------------------------------
+
+// Information about the toolkit that the app is running under and some basic
+// platform and architecture info
+class WXDLLIMPEXP_BASE wxPlatformInfo
+{
+public:
+ wxPlatformInfo();
+ wxPlatformInfo(wxPortId pid,
+ int tkMajor = -1, int tkMinor = -1,
+ wxOperatingSystemId id = wxOS_UNKNOWN,
+ int osMajor = -1, int osMinor = -1,
+ wxArchitecture arch = wxARCH_INVALID,
+ wxEndianness endian = wxENDIAN_INVALID,
+ bool usingUniversal = false);
+
+ // default copy ctor, assignment operator and dtor are ok
+
+ bool operator==(const wxPlatformInfo &t) const;
+
+ bool operator!=(const wxPlatformInfo &t) const
+ { return !(*this == t); }
+
+ // Gets a wxPlatformInfo already initialized with the values for
+ // the currently running platform.
+ static const wxPlatformInfo& Get();
+
+
+
+ // string -> enum conversions
+ // ---------------------------------
+
+ static wxOperatingSystemId GetOperatingSystemId(const wxString &name);
+ static wxPortId GetPortId(const wxString &portname);
+
+ static wxArchitecture GetArch(const wxString &arch);
+ static wxEndianness GetEndianness(const wxString &end);
+
+ // enum -> string conversions
+ // ---------------------------------
+
+ static wxString GetOperatingSystemFamilyName(wxOperatingSystemId os);
+ static wxString GetOperatingSystemIdName(wxOperatingSystemId os);
+ static wxString GetPortIdName(wxPortId port, bool usingUniversal);
+ static wxString GetPortIdShortName(wxPortId port, bool usingUniversal);
+
+ static wxString GetArchName(wxArchitecture arch);
+ static wxString GetEndiannessName(wxEndianness end);
+
+
+ // getters
+ // -----------------
+
+ int GetOSMajorVersion() const
+ { return m_osVersionMajor; }
+ int GetOSMinorVersion() const
+ { return m_osVersionMinor; }
+
+ // return true if the OS version >= major.minor
+ bool CheckOSVersion(int major, int minor) const
+ {
+ return DoCheckVersion(GetOSMajorVersion(),
+ GetOSMinorVersion(),
+ major,
+ minor);
+ }
+
+ int GetToolkitMajorVersion() const
+ { return m_tkVersionMajor; }
+ int GetToolkitMinorVersion() const
+ { return m_tkVersionMinor; }
+
+ bool CheckToolkitVersion(int major, int minor) const
+ {
+ return DoCheckVersion(GetToolkitMajorVersion(),
+ GetToolkitMinorVersion(),
+ major,
+ minor);
+ }
+
+ bool IsUsingUniversalWidgets() const
+ { return m_usingUniversal; }
+
+ wxOperatingSystemId GetOperatingSystemId() const
+ { return m_os; }
+ wxLinuxDistributionInfo GetLinuxDistributionInfo() const
+ { return m_ldi; }
+ wxPortId GetPortId() const
+ { return m_port; }
+ wxArchitecture GetArchitecture() const
+ { return m_arch; }
+ wxEndianness GetEndianness() const
+ { return m_endian; }
+
+
+ // string getters
+ // -----------------
+
+ wxString GetOperatingSystemFamilyName() const
+ { return GetOperatingSystemFamilyName(m_os); }
+ wxString GetOperatingSystemIdName() const
+ { return GetOperatingSystemIdName(m_os); }
+ wxString GetPortIdName() const
+ { return GetPortIdName(m_port, m_usingUniversal); }
+ wxString GetPortIdShortName() const
+ { return GetPortIdShortName(m_port, m_usingUniversal); }
+ wxString GetArchName() const
+ { return GetArchName(m_arch); }
+ wxString GetEndiannessName() const
+ { return GetEndiannessName(m_endian); }
+ wxString GetOperatingSystemDescription() const
+ { return m_osDesc; }
+ wxString GetDesktopEnvironment() const
+ { return m_desktopEnv; }
+
+ static wxString GetOperatingSystemDirectory();
+ // doesn't make sense to store inside wxPlatformInfo the OS directory,
+ // thus this function is static; note that this function simply calls
+ // wxGetOSDirectory() and is here just to make it easier for the user to
+ // find it that feature (global functions can be difficult to find in the docs)
+
+ // setters
+ // -----------------
+
+ void SetOSVersion(int major, int minor)
+ { m_osVersionMajor=major; m_osVersionMinor=minor; }
+ void SetToolkitVersion(int major, int minor)
+ { m_tkVersionMajor=major; m_tkVersionMinor=minor; }
+
+ void SetOperatingSystemId(wxOperatingSystemId n)
+ { m_os = n; }
+ void SetOperatingSystemDescription(const wxString& desc)
+ { m_osDesc = desc; }
+ void SetPortId(wxPortId n)
+ { m_port = n; }
+ void SetArchitecture(wxArchitecture n)
+ { m_arch = n; }
+ void SetEndianness(wxEndianness n)
+ { m_endian = n; }
+
+ void SetDesktopEnvironment(const wxString& de)
+ { m_desktopEnv = de; }
+ void SetLinuxDistributionInfo(const wxLinuxDistributionInfo& di)
+ { m_ldi = di; }
+
+
+ // miscellaneous
+ // -----------------
+
+ bool IsOk() const
+ {
+ return m_osVersionMajor != -1 && m_osVersionMinor != -1 &&
+ m_os != wxOS_UNKNOWN &&
+ !m_osDesc.IsEmpty() &&
+ m_tkVersionMajor != -1 && m_tkVersionMinor != -1 &&
+ m_port != wxPORT_UNKNOWN &&
+ m_arch != wxARCH_INVALID &&
+ m_endian != wxENDIAN_INVALID;
+
+ // do not check linux-specific info; it's ok to have them empty
+ }
+
+
+protected:
+ static bool DoCheckVersion(int majorCur, int minorCur, int major, int minor)
+ {
+ return majorCur > major || (majorCur == major && minorCur >= minor);
+ }
+
+ void InitForCurrentPlatform();
+
+
+ // OS stuff
+ // -----------------
+
+ // Version of the OS; valid if m_os != wxOS_UNKNOWN
+ // (-1 means not initialized yet).
+ int m_osVersionMajor,
+ m_osVersionMinor;
+
+ // Operating system ID.
+ wxOperatingSystemId m_os;
+
+ // Operating system description.
+ wxString m_osDesc;
+
+
+ // linux-specific
+ // -----------------
+
+ wxString m_desktopEnv;
+ wxLinuxDistributionInfo m_ldi;
+
+
+ // toolkit
+ // -----------------
+
+ // Version of the underlying toolkit
+ // (-1 means not initialized yet; zero means no toolkit).
+ int m_tkVersionMajor, m_tkVersionMinor;
+
+ // name of the wxWidgets port
+ wxPortId m_port;
+
+ // is using wxUniversal widgets?
+ bool m_usingUniversal;
+
+
+ // others
+ // -----------------
+
+ // architecture of the OS/machine
+ wxArchitecture m_arch;
+
+ // endianness of the machine
+ wxEndianness m_endian;
+};
+
+
+#if WXWIN_COMPATIBILITY_2_6
+ #define wxUNKNOWN_PLATFORM wxOS_UNKNOWN
+ #define wxUnix wxOS_UNIX
+ #define wxWin95 wxOS_WINDOWS_9X
+ #define wxWIN95 wxOS_WINDOWS_9X
+ #define wxWINDOWS_NT wxOS_WINDOWS_NT
+ #define wxMSW wxOS_WINDOWS
+ #define wxWinCE wxOS_WINDOWS_CE
+ #define wxWIN32S wxOS_WINDOWS_9X
+
+ #define wxOS2 wxPORT_OS2
+ #define wxCocoa wxPORT_MAC
+ #define wxMac wxPORT_MAC
+ #define wxMotif wxPORT_MOTIF
+ #define wxGTK wxPORT_GTK
+#endif // WXWIN_COMPATIBILITY_2_6
+
+#endif // _WX_PLATINFO_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/popupwin.h
+// Purpose: wxPopupWindow interface declaration
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 06.01.01
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_POPUPWIN_H_BASE_
+#define _WX_POPUPWIN_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_POPUPWIN
+
+#include "wx/nonownedwnd.h"
+
+// ----------------------------------------------------------------------------
+// wxPopupWindow: a special kind of top level window used for popup menus,
+// combobox popups and such.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPopupWindowBase : public wxNonOwnedWindow
+{
+public:
+ wxPopupWindowBase() { }
+ virtual ~wxPopupWindowBase();
+
+ // create the popup window
+ //
+ // style may only contain border flags
+ bool Create(wxWindow *parent, int style = wxBORDER_NONE);
+
+ // move the popup window to the right position, i.e. such that it is
+ // entirely visible
+ //
+ // the popup is positioned at ptOrigin + size if it opens below and to the
+ // right (default), at ptOrigin - sizePopup if it opens above and to the
+ // left &c
+ //
+ // the point must be given in screen coordinates!
+ virtual void Position(const wxPoint& ptOrigin,
+ const wxSize& size);
+
+ virtual bool IsTopLevel() const { return true; }
+
+ wxDECLARE_NO_COPY_CLASS(wxPopupWindowBase);
+};
+
+
+// include the real class declaration
+#if defined(__WXMSW__)
+ #include "wx/msw/popupwin.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/popupwin.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/popupwin.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/popupwin.h"
+#elif defined(__WXX11__)
+ #include "wx/x11/popupwin.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/popupwin.h"
+#elif defined(__WXDFB__)
+ #include "wx/dfb/popupwin.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/popupwin.h"
+#else
+ #error "wxPopupWindow is not supported under this platform."
+#endif
+
+// ----------------------------------------------------------------------------
+// wxPopupTransientWindow: a wxPopupWindow which disappears automatically
+// when the user clicks mouse outside it or if it loses focus in any other way
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxPopupWindowHandler;
+class WXDLLIMPEXP_FWD_CORE wxPopupFocusHandler;
+
+class WXDLLIMPEXP_CORE wxPopupTransientWindow : public wxPopupWindow
+{
+public:
+ // ctors
+ wxPopupTransientWindow() { Init(); }
+ wxPopupTransientWindow(wxWindow *parent, int style = wxBORDER_NONE);
+
+ virtual ~wxPopupTransientWindow();
+
+ // popup the window (this will show it too) and keep focus at winFocus
+ // (or itself if it's NULL), dismiss the popup if we lose focus
+ virtual void Popup(wxWindow *focus = NULL);
+
+ // hide the window
+ virtual void Dismiss();
+
+ // can the window be dismissed now?
+ //
+ // VZ: where is this used??
+ virtual bool CanDismiss()
+ { return true; }
+
+ // called when a mouse is pressed while the popup is shown: return true
+ // from here to prevent its normal processing by the popup (which consists
+ // in dismissing it if the mouse is clicked outside it)
+ virtual bool ProcessLeftDown(wxMouseEvent& event);
+
+ // Overridden to grab the input on some plaforms
+ virtual bool Show( bool show = true );
+
+ // Override to implement delayed destruction of this window.
+ virtual bool Destroy();
+
+protected:
+ // common part of all ctors
+ void Init();
+
+ // this is called when the popup is disappeared because of anything
+ // else but direct call to Dismiss()
+ virtual void OnDismiss();
+
+ // dismiss and notify the derived class
+ void DismissAndNotify();
+
+ // remove our event handlers
+ void PopHandlers();
+
+ // get alerted when child gets deleted from under us
+ void OnDestroy(wxWindowDestroyEvent& event);
+
+#if defined(__WXMSW__) ||(defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON)
+ // Check if the mouse needs to be captured or released: we must release
+ // when it's inside our window if we want the embedded controls to work.
+ void OnIdle(wxIdleEvent& event);
+#endif
+
+ // the child of this popup if any
+ wxWindow *m_child;
+
+ // the window which has the focus while we're shown
+ wxWindow *m_focus;
+
+ // these classes may call our DismissAndNotify()
+ friend class wxPopupWindowHandler;
+ friend class wxPopupFocusHandler;
+
+ // the handlers we created, may be NULL (if not, must be deleted)
+ wxPopupWindowHandler *m_handlerPopup;
+ wxPopupFocusHandler *m_handlerFocus;
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxPopupTransientWindow)
+ wxDECLARE_NO_COPY_CLASS(wxPopupTransientWindow);
+};
+
+#if wxUSE_COMBOBOX && defined(__WXUNIVERSAL__)
+
+// ----------------------------------------------------------------------------
+// wxPopupComboWindow: wxPopupTransientWindow used by wxComboBox
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxComboBox;
+class WXDLLIMPEXP_FWD_CORE wxComboCtrl;
+
+class WXDLLIMPEXP_CORE wxPopupComboWindow : public wxPopupTransientWindow
+{
+public:
+ wxPopupComboWindow() { m_combo = NULL; }
+ wxPopupComboWindow(wxComboCtrl *parent);
+
+ bool Create(wxComboCtrl *parent);
+
+ // position the window correctly relatively to the combo
+ void PositionNearCombo();
+
+protected:
+ // notify the combo here
+ virtual void OnDismiss();
+
+ // forward the key presses to the combobox
+ void OnKeyDown(wxKeyEvent& event);
+
+ // the parent combobox
+ wxComboCtrl *m_combo;
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxPopupComboWindow)
+};
+
+#endif // wxUSE_COMBOBOX && defined(__WXUNIVERSAL__)
+
+#endif // wxUSE_POPUPWIN
+
+#endif // _WX_POPUPWIN_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/position.h
+// Purpose: Common structure and methods for positional information.
+// Author: Vadim Zeitlin, Robin Dunn, Brad Anderson, Bryan Petty
+// Created: 2007-03-13
+// Copyright: (c) 2007 The wxWidgets Team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_POSITION_H_
+#define _WX_POSITION_H_
+
+#include "wx/gdicmn.h"
+
+class WXDLLIMPEXP_CORE wxPosition
+{
+public:
+ wxPosition() : m_row(0), m_column(0) {}
+ wxPosition(int row, int col) : m_row(row), m_column(col) {}
+
+ // default copy ctor and assignment operator are okay.
+
+ int GetRow() const { return m_row; }
+ int GetColumn() const { return m_column; }
+ int GetCol() const { return GetColumn(); }
+ void SetRow(int row) { m_row = row; }
+ void SetColumn(int column) { m_column = column; }
+ void SetCol(int column) { SetColumn(column); }
+
+ bool operator==(const wxPosition& p) const
+ { return m_row == p.m_row && m_column == p.m_column; }
+ bool operator!=(const wxPosition& p) const
+ { return !(*this == p); }
+
+ wxPosition& operator+=(const wxPosition& p)
+ { m_row += p.m_row; m_column += p.m_column; return *this; }
+ wxPosition& operator-=(const wxPosition& p)
+ { m_row -= p.m_row; m_column -= p.m_column; return *this; }
+ wxPosition& operator+=(const wxSize& s)
+ { m_row += s.y; m_column += s.x; return *this; }
+ wxPosition& operator-=(const wxSize& s)
+ { m_row -= s.y; m_column -= s.x; return *this; }
+
+ wxPosition operator+(const wxPosition& p) const
+ { return wxPosition(m_row + p.m_row, m_column + p.m_column); }
+ wxPosition operator-(const wxPosition& p) const
+ { return wxPosition(m_row - p.m_row, m_column - p.m_column); }
+ wxPosition operator+(const wxSize& s) const
+ { return wxPosition(m_row + s.y, m_column + s.x); }
+ wxPosition operator-(const wxSize& s) const
+ { return wxPosition(m_row - s.y, m_column - s.x); }
+
+private:
+ int m_row;
+ int m_column;
+};
+
+#endif // _WX_POSITION_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/power.h
+// Purpose: functions and classes for system power management
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 2006-05-27
+// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_POWER_H_
+#define _WX_POWER_H_
+
+#include "wx/event.h"
+
+// ----------------------------------------------------------------------------
+// power management constants
+// ----------------------------------------------------------------------------
+
+enum wxPowerType
+{
+ wxPOWER_SOCKET,
+ wxPOWER_BATTERY,
+ wxPOWER_UNKNOWN
+};
+
+enum wxBatteryState
+{
+ wxBATTERY_NORMAL_STATE, // system is fully usable
+ wxBATTERY_LOW_STATE, // start to worry
+ wxBATTERY_CRITICAL_STATE, // save quickly
+ wxBATTERY_SHUTDOWN_STATE, // too late
+ wxBATTERY_UNKNOWN_STATE
+};
+
+// ----------------------------------------------------------------------------
+// wxPowerEvent is generated when the system online status changes
+// ----------------------------------------------------------------------------
+
+// currently the power events are only available under Windows, to avoid
+// compiling in the code for handling them which is never going to be invoked
+// under the other platforms, we define wxHAS_POWER_EVENTS symbol if this event
+// is available, it should be used to guard all code using wxPowerEvent
+#ifdef __WINDOWS__
+
+#define wxHAS_POWER_EVENTS
+
+class WXDLLIMPEXP_BASE wxPowerEvent : public wxEvent
+{
+public:
+ wxPowerEvent() // just for use by wxRTTI
+ : m_veto(false) { }
+
+ wxPowerEvent(wxEventType evtType) : wxEvent(wxID_NONE, evtType)
+ {
+ m_veto = false;
+ }
+
+ // Veto the operation (only makes sense with EVT_POWER_SUSPENDING)
+ void Veto() { m_veto = true; }
+
+ bool IsVetoed() const { return m_veto; }
+
+
+ // default copy ctor, assignment operator and dtor are ok
+
+ virtual wxEvent *Clone() const { return new wxPowerEvent(*this); }
+
+private:
+ bool m_veto;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPowerEvent)
+};
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPENDING, wxPowerEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPENDED, wxPowerEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPEND_CANCEL, wxPowerEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_BASE, wxEVT_POWER_RESUME, wxPowerEvent );
+
+typedef void (wxEvtHandler::*wxPowerEventFunction)(wxPowerEvent&);
+
+#define wxPowerEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxPowerEventFunction, func)
+
+#define EVT_POWER_SUSPENDING(func) \
+ wx__DECLARE_EVT0(wxEVT_POWER_SUSPENDING, wxPowerEventHandler(func))
+#define EVT_POWER_SUSPENDED(func) \
+ wx__DECLARE_EVT0(wxEVT_POWER_SUSPENDED, wxPowerEventHandler(func))
+#define EVT_POWER_SUSPEND_CANCEL(func) \
+ wx__DECLARE_EVT0(wxEVT_POWER_SUSPEND_CANCEL, wxPowerEventHandler(func))
+#define EVT_POWER_RESUME(func) \
+ wx__DECLARE_EVT0(wxEVT_POWER_RESUME, wxPowerEventHandler(func))
+
+#else // no support for power events
+ #undef wxHAS_POWER_EVENTS
+#endif // support for power events/no support
+
+// ----------------------------------------------------------------------------
+// power management functions
+// ----------------------------------------------------------------------------
+
+// return the current system power state: online or offline
+WXDLLIMPEXP_BASE wxPowerType wxGetPowerType();
+
+// return approximate battery state
+WXDLLIMPEXP_BASE wxBatteryState wxGetBatteryState();
+
+#endif // _WX_POWER_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/print.h
+// Purpose: Base header for printer classes
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PRINT_H_BASE_
+#define _WX_PRINT_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_PRINTING_ARCHITECTURE
+
+#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
+
+#include "wx/msw/printwin.h"
+
+#elif defined(__WXMAC__)
+
+#include "wx/osx/printmac.h"
+
+#elif defined(__WXPM__)
+
+#include "wx/os2/printos2.h"
+
+#else
+
+#include "wx/generic/printps.h"
+
+#endif
+
+#endif // wxUSE_PRINTING_ARCHITECTURE
+#endif
+ // _WX_PRINT_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/printdlg.h
+// Purpose: Base header and class for print dialogs
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PRINTDLG_H_BASE_
+#define _WX_PRINTDLG_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_PRINTING_ARCHITECTURE
+
+#include "wx/event.h"
+#include "wx/dialog.h"
+#include "wx/intl.h"
+#include "wx/cmndata.h"
+
+
+// ---------------------------------------------------------------------------
+// wxPrintDialogBase: interface for the dialog for printing
+// ---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPrintDialogBase : public wxDialog
+{
+public:
+ wxPrintDialogBase() { }
+ wxPrintDialogBase(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxString &title = wxEmptyString,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE);
+
+ virtual wxPrintDialogData& GetPrintDialogData() = 0;
+ virtual wxPrintData& GetPrintData() = 0;
+ virtual wxDC *GetPrintDC() = 0;
+
+private:
+ DECLARE_ABSTRACT_CLASS(wxPrintDialogBase)
+ wxDECLARE_NO_COPY_CLASS(wxPrintDialogBase);
+};
+
+// ---------------------------------------------------------------------------
+// wxPrintDialog: the dialog for printing.
+// ---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPrintDialog : public wxObject
+{
+public:
+ wxPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL);
+ wxPrintDialog(wxWindow *parent, wxPrintData* data);
+ virtual ~wxPrintDialog();
+
+ virtual int ShowModal();
+
+ virtual wxPrintDialogData& GetPrintDialogData();
+ virtual wxPrintData& GetPrintData();
+ virtual wxDC *GetPrintDC();
+
+private:
+ wxPrintDialogBase *m_pimpl;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPrintDialog)
+ wxDECLARE_NO_COPY_CLASS(wxPrintDialog);
+};
+
+// ---------------------------------------------------------------------------
+// wxPageSetupDialogBase: interface for the page setup dialog
+// ---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPageSetupDialogBase: public wxDialog
+{
+public:
+ wxPageSetupDialogBase() { }
+ wxPageSetupDialogBase(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxString &title = wxEmptyString,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE);
+
+ virtual wxPageSetupDialogData& GetPageSetupDialogData() = 0;
+
+private:
+ DECLARE_ABSTRACT_CLASS(wxPageSetupDialogBase)
+ wxDECLARE_NO_COPY_CLASS(wxPageSetupDialogBase);
+};
+
+// ---------------------------------------------------------------------------
+// wxPageSetupDialog: the page setup dialog
+// ---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPageSetupDialog: public wxObject
+{
+public:
+ wxPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL);
+ virtual ~wxPageSetupDialog();
+
+ int ShowModal();
+ wxPageSetupDialogData& GetPageSetupDialogData();
+ // old name
+ wxPageSetupDialogData& GetPageSetupData();
+
+private:
+ wxPageSetupDialogBase *m_pimpl;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPageSetupDialog)
+ wxDECLARE_NO_COPY_CLASS(wxPageSetupDialog);
+};
+
+#endif
+
+#endif
+ // _WX_PRINTDLG_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/prntbase.h
+// Purpose: Base classes for printing framework
+// Author: Julian Smart
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PRNTBASEH__
+#define _WX_PRNTBASEH__
+
+#include "wx/defs.h"
+
+#if wxUSE_PRINTING_ARCHITECTURE
+
+#include "wx/event.h"
+#include "wx/cmndata.h"
+#include "wx/panel.h"
+#include "wx/scrolwin.h"
+#include "wx/dialog.h"
+#include "wx/frame.h"
+#include "wx/dc.h"
+
+class WXDLLIMPEXP_FWD_CORE wxDC;
+class WXDLLIMPEXP_FWD_CORE wxButton;
+class WXDLLIMPEXP_FWD_CORE wxChoice;
+class WXDLLIMPEXP_FWD_CORE wxPrintout;
+class WXDLLIMPEXP_FWD_CORE wxPrinterBase;
+class WXDLLIMPEXP_FWD_CORE wxPrintDialogBase;
+class WXDLLIMPEXP_FWD_CORE wxPrintDialog;
+class WXDLLIMPEXP_FWD_CORE wxPageSetupDialogBase;
+class WXDLLIMPEXP_FWD_CORE wxPageSetupDialog;
+class WXDLLIMPEXP_FWD_CORE wxPrintPreviewBase;
+class WXDLLIMPEXP_FWD_CORE wxPreviewCanvas;
+class WXDLLIMPEXP_FWD_CORE wxPreviewControlBar;
+class WXDLLIMPEXP_FWD_CORE wxPreviewFrame;
+class WXDLLIMPEXP_FWD_CORE wxPrintFactory;
+class WXDLLIMPEXP_FWD_CORE wxPrintNativeDataBase;
+class WXDLLIMPEXP_FWD_CORE wxPrintPreview;
+class WXDLLIMPEXP_FWD_CORE wxPrintAbortDialog;
+class WXDLLIMPEXP_FWD_CORE wxStaticText;
+class wxPrintPageMaxCtrl;
+class wxPrintPageTextCtrl;
+
+//----------------------------------------------------------------------------
+// error consts
+//----------------------------------------------------------------------------
+
+enum wxPrinterError
+{
+ wxPRINTER_NO_ERROR = 0,
+ wxPRINTER_CANCELLED,
+ wxPRINTER_ERROR
+};
+
+// Preview frame modality kind used with wxPreviewFrame::Initialize()
+enum wxPreviewFrameModalityKind
+{
+ // Disable all the other top level windows while the preview is shown.
+ wxPreviewFrame_AppModal,
+
+ // Disable only the parent window while the preview is shown.
+ wxPreviewFrame_WindowModal,
+
+ // Don't disable any windows.
+ wxPreviewFrame_NonModal
+};
+
+//----------------------------------------------------------------------------
+// wxPrintFactory
+//----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPrintFactory
+{
+public:
+ wxPrintFactory() {}
+ virtual ~wxPrintFactory() {}
+
+ virtual wxPrinterBase *CreatePrinter( wxPrintDialogData* data ) = 0;
+
+ virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
+ wxPrintout *printout = NULL,
+ wxPrintDialogData *data = NULL ) = 0;
+ virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
+ wxPrintout *printout,
+ wxPrintData *data ) = 0;
+
+ virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
+ wxPrintDialogData *data = NULL ) = 0;
+ virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
+ wxPrintData *data ) = 0;
+
+ virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent,
+ wxPageSetupDialogData * data = NULL ) = 0;
+
+ virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ) = 0;
+
+ // What to do and what to show in the wxPrintDialog
+ // a) Use the generic print setup dialog or a native one?
+ virtual bool HasPrintSetupDialog() = 0;
+ virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data ) = 0;
+ // b) Provide the "print to file" option ourselves or via print setup?
+ virtual bool HasOwnPrintToFile() = 0;
+ // c) Show current printer
+ virtual bool HasPrinterLine() = 0;
+ virtual wxString CreatePrinterLine() = 0;
+ // d) Show Status line for current printer?
+ virtual bool HasStatusLine() = 0;
+ virtual wxString CreateStatusLine() = 0;
+
+
+ virtual wxPrintNativeDataBase *CreatePrintNativeData() = 0;
+
+ static void SetPrintFactory( wxPrintFactory *factory );
+ static wxPrintFactory *GetFactory();
+private:
+ static wxPrintFactory *m_factory;
+};
+
+class WXDLLIMPEXP_CORE wxNativePrintFactory: public wxPrintFactory
+{
+public:
+ virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data );
+
+ virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
+ wxPrintout *printout = NULL,
+ wxPrintDialogData *data = NULL );
+ virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
+ wxPrintout *printout,
+ wxPrintData *data );
+
+ virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
+ wxPrintDialogData *data = NULL );
+ virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
+ wxPrintData *data );
+
+ virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent,
+ wxPageSetupDialogData * data = NULL );
+
+ virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data );
+
+ virtual bool HasPrintSetupDialog();
+ virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data );
+ virtual bool HasOwnPrintToFile();
+ virtual bool HasPrinterLine();
+ virtual wxString CreatePrinterLine();
+ virtual bool HasStatusLine();
+ virtual wxString CreateStatusLine();
+
+ virtual wxPrintNativeDataBase *CreatePrintNativeData();
+};
+
+//----------------------------------------------------------------------------
+// wxPrintNativeDataBase
+//----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPrintNativeDataBase: public wxObject
+{
+public:
+ wxPrintNativeDataBase();
+ virtual ~wxPrintNativeDataBase() {}
+
+ virtual bool TransferTo( wxPrintData &data ) = 0;
+ virtual bool TransferFrom( const wxPrintData &data ) = 0;
+
+ virtual bool Ok() const { return IsOk(); }
+ virtual bool IsOk() const = 0;
+
+ int m_ref;
+
+private:
+ DECLARE_CLASS(wxPrintNativeDataBase)
+ wxDECLARE_NO_COPY_CLASS(wxPrintNativeDataBase);
+};
+
+//----------------------------------------------------------------------------
+// wxPrinterBase
+//----------------------------------------------------------------------------
+
+/*
+ * Represents the printer: manages printing a wxPrintout object
+ */
+
+class WXDLLIMPEXP_CORE wxPrinterBase: public wxObject
+{
+public:
+ wxPrinterBase(wxPrintDialogData *data = NULL);
+ virtual ~wxPrinterBase();
+
+ virtual wxPrintAbortDialog *CreateAbortWindow(wxWindow *parent, wxPrintout *printout);
+ virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message);
+
+ virtual wxPrintDialogData& GetPrintDialogData() const;
+ bool GetAbort() const { return sm_abortIt; }
+
+ static wxPrinterError GetLastError() { return sm_lastError; }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // OVERRIDES
+
+ virtual bool Setup(wxWindow *parent) = 0;
+ virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true) = 0;
+ virtual wxDC* PrintDialog(wxWindow *parent) = 0;
+
+protected:
+ wxPrintDialogData m_printDialogData;
+ wxPrintout* m_currentPrintout;
+
+ static wxPrinterError sm_lastError;
+
+public:
+ static wxWindow* sm_abortWindow;
+ static bool sm_abortIt;
+
+private:
+ DECLARE_CLASS(wxPrinterBase)
+ wxDECLARE_NO_COPY_CLASS(wxPrinterBase);
+};
+
+//----------------------------------------------------------------------------
+// wxPrinter
+//----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPrinter: public wxPrinterBase
+{
+public:
+ wxPrinter(wxPrintDialogData *data = NULL);
+ virtual ~wxPrinter();
+
+ virtual wxPrintAbortDialog *CreateAbortWindow(wxWindow *parent, wxPrintout *printout);
+ virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message);
+
+ virtual bool Setup(wxWindow *parent);
+ virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true);
+ virtual wxDC* PrintDialog(wxWindow *parent);
+
+ virtual wxPrintDialogData& GetPrintDialogData() const;
+
+protected:
+ wxPrinterBase *m_pimpl;
+
+private:
+ DECLARE_CLASS(wxPrinter)
+ wxDECLARE_NO_COPY_CLASS(wxPrinter);
+};
+
+//----------------------------------------------------------------------------
+// wxPrintout
+//----------------------------------------------------------------------------
+
+/*
+ * Represents an object via which a document may be printed.
+ * The programmer derives from this, overrides (at least) OnPrintPage,
+ * and passes it to a wxPrinter object for printing, or a wxPrintPreview
+ * object for previewing.
+ */
+
+class WXDLLIMPEXP_CORE wxPrintout: public wxObject
+{
+public:
+ wxPrintout(const wxString& title = wxGetTranslation("Printout"));
+ virtual ~wxPrintout();
+
+ virtual bool OnBeginDocument(int startPage, int endPage);
+ virtual void OnEndDocument();
+ virtual void OnBeginPrinting();
+ virtual void OnEndPrinting();
+
+ // Guaranteed to be before any other functions are called
+ virtual void OnPreparePrinting() { }
+
+ virtual bool HasPage(int page);
+ virtual bool OnPrintPage(int page) = 0;
+ virtual void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo);
+
+ virtual wxString GetTitle() const { return m_printoutTitle; }
+
+ wxDC *GetDC() const { return m_printoutDC; }
+ void SetDC(wxDC *dc) { m_printoutDC = dc; }
+
+ void FitThisSizeToPaper(const wxSize& imageSize);
+ void FitThisSizeToPage(const wxSize& imageSize);
+ void FitThisSizeToPageMargins(const wxSize& imageSize, const wxPageSetupDialogData& pageSetupData);
+ void MapScreenSizeToPaper();
+ void MapScreenSizeToPage();
+ void MapScreenSizeToPageMargins(const wxPageSetupDialogData& pageSetupData);
+ void MapScreenSizeToDevice();
+
+ wxRect GetLogicalPaperRect() const;
+ wxRect GetLogicalPageRect() const;
+ wxRect GetLogicalPageMarginsRect(const wxPageSetupDialogData& pageSetupData) const;
+
+ void SetLogicalOrigin(wxCoord x, wxCoord y);
+ void OffsetLogicalOrigin(wxCoord xoff, wxCoord yoff);
+
+ void SetPageSizePixels(int w, int h) { m_pageWidthPixels = w; m_pageHeightPixels = h; }
+ void GetPageSizePixels(int *w, int *h) const { *w = m_pageWidthPixels; *h = m_pageHeightPixels; }
+ void SetPageSizeMM(int w, int h) { m_pageWidthMM = w; m_pageHeightMM = h; }
+ void GetPageSizeMM(int *w, int *h) const { *w = m_pageWidthMM; *h = m_pageHeightMM; }
+
+ void SetPPIScreen(int x, int y) { m_PPIScreenX = x; m_PPIScreenY = y; }
+ void SetPPIScreen(const wxSize& ppi) { SetPPIScreen(ppi.x, ppi.y); }
+ void GetPPIScreen(int *x, int *y) const { *x = m_PPIScreenX; *y = m_PPIScreenY; }
+ void SetPPIPrinter(int x, int y) { m_PPIPrinterX = x; m_PPIPrinterY = y; }
+ void SetPPIPrinter(const wxSize& ppi) { SetPPIPrinter(ppi.x, ppi.y); }
+ void GetPPIPrinter(int *x, int *y) const { *x = m_PPIPrinterX; *y = m_PPIPrinterY; }
+
+ void SetPaperRectPixels(const wxRect& paperRectPixels) { m_paperRectPixels = paperRectPixels; }
+ wxRect GetPaperRectPixels() const { return m_paperRectPixels; }
+
+ // This must be called by wxPrintPreview to associate itself with the
+ // printout it uses.
+ virtual void SetPreview(wxPrintPreview *preview) { m_preview = preview; }
+
+ wxPrintPreview *GetPreview() const { return m_preview; }
+ virtual bool IsPreview() const { return GetPreview() != NULL; }
+
+private:
+ wxString m_printoutTitle;
+ wxDC* m_printoutDC;
+ wxPrintPreview *m_preview;
+
+ int m_pageWidthPixels;
+ int m_pageHeightPixels;
+
+ int m_pageWidthMM;
+ int m_pageHeightMM;
+
+ int m_PPIScreenX;
+ int m_PPIScreenY;
+ int m_PPIPrinterX;
+ int m_PPIPrinterY;
+
+ wxRect m_paperRectPixels;
+
+private:
+ DECLARE_ABSTRACT_CLASS(wxPrintout)
+ wxDECLARE_NO_COPY_CLASS(wxPrintout);
+};
+
+//----------------------------------------------------------------------------
+// wxPreviewCanvas
+//----------------------------------------------------------------------------
+
+/*
+ * Canvas upon which a preview is drawn.
+ */
+
+class WXDLLIMPEXP_CORE wxPreviewCanvas: public wxScrolledWindow
+{
+public:
+ wxPreviewCanvas(wxPrintPreviewBase *preview,
+ wxWindow *parent,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxT("canvas"));
+ virtual ~wxPreviewCanvas();
+
+ void SetPreview(wxPrintPreviewBase *preview) { m_printPreview = preview; }
+
+ void OnPaint(wxPaintEvent& event);
+ void OnChar(wxKeyEvent &event);
+ // Responds to colour changes
+ void OnSysColourChanged(wxSysColourChangedEvent& event);
+
+private:
+#if wxUSE_MOUSEWHEEL
+ void OnMouseWheel(wxMouseEvent& event);
+#endif // wxUSE_MOUSEWHEEL
+ void OnIdle(wxIdleEvent& event);
+
+ wxPrintPreviewBase* m_printPreview;
+
+ DECLARE_CLASS(wxPreviewCanvas)
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxPreviewCanvas);
+};
+
+//----------------------------------------------------------------------------
+// wxPreviewFrame
+//----------------------------------------------------------------------------
+
+/*
+ * Default frame for showing preview.
+ */
+
+class WXDLLIMPEXP_CORE wxPreviewFrame: public wxFrame
+{
+public:
+ wxPreviewFrame(wxPrintPreviewBase *preview,
+ wxWindow *parent,
+ const wxString& title = wxGetTranslation("Print Preview"),
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE | wxFRAME_FLOAT_ON_PARENT,
+ const wxString& name = wxFrameNameStr);
+ virtual ~wxPreviewFrame();
+
+ // Either Initialize() or InitializeWithModality() must be called before
+ // showing the preview frame, the former being just a particular case of
+ // the latter initializing the frame for being showing app-modally.
+
+ // Notice that we must keep Initialize() with its existing signature to
+ // avoid breaking the old code that overrides it and we can't reuse the
+ // same name for the other functions to avoid virtual function hiding
+ // problem and the associated warnings given by some compilers (e.g. from
+ // g++ with -Woverloaded-virtual).
+ virtual void Initialize()
+ {
+ InitializeWithModality(wxPreviewFrame_AppModal);
+ }
+
+ // Also note that this method is not virtual as it doesn't need to be
+ // overridden: it's never called by wxWidgets (of course, the same is true
+ // for Initialize() but, again, it must remain virtual for compatibility).
+ void InitializeWithModality(wxPreviewFrameModalityKind kind);
+
+ void OnCloseWindow(wxCloseEvent& event);
+ virtual void CreateCanvas();
+ virtual void CreateControlBar();
+
+ inline wxPreviewControlBar* GetControlBar() const { return m_controlBar; }
+
+protected:
+ wxPreviewCanvas* m_previewCanvas;
+ wxPreviewControlBar* m_controlBar;
+ wxPrintPreviewBase* m_printPreview;
+ wxWindowDisabler* m_windowDisabler;
+
+ wxPreviewFrameModalityKind m_modalityKind;
+
+
+private:
+ void OnChar(wxKeyEvent& event);
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_CLASS(wxPreviewFrame)
+ wxDECLARE_NO_COPY_CLASS(wxPreviewFrame);
+};
+
+//----------------------------------------------------------------------------
+// wxPreviewControlBar
+//----------------------------------------------------------------------------
+
+/*
+ * A panel with buttons for controlling a print preview.
+ * The programmer may wish to use other means for controlling
+ * the print preview.
+ */
+
+#define wxPREVIEW_PRINT 1
+#define wxPREVIEW_PREVIOUS 2
+#define wxPREVIEW_NEXT 4
+#define wxPREVIEW_ZOOM 8
+#define wxPREVIEW_FIRST 16
+#define wxPREVIEW_LAST 32
+#define wxPREVIEW_GOTO 64
+
+#define wxPREVIEW_DEFAULT (wxPREVIEW_PREVIOUS|wxPREVIEW_NEXT|wxPREVIEW_ZOOM\
+ |wxPREVIEW_FIRST|wxPREVIEW_GOTO|wxPREVIEW_LAST)
+
+// Ids for controls
+#define wxID_PREVIEW_CLOSE 1
+#define wxID_PREVIEW_NEXT 2
+#define wxID_PREVIEW_PREVIOUS 3
+#define wxID_PREVIEW_PRINT 4
+#define wxID_PREVIEW_ZOOM 5
+#define wxID_PREVIEW_FIRST 6
+#define wxID_PREVIEW_LAST 7
+#define wxID_PREVIEW_GOTO 8
+#define wxID_PREVIEW_ZOOM_IN 9
+#define wxID_PREVIEW_ZOOM_OUT 10
+
+class WXDLLIMPEXP_CORE wxPreviewControlBar: public wxPanel
+{
+ DECLARE_CLASS(wxPreviewControlBar)
+
+public:
+ wxPreviewControlBar(wxPrintPreviewBase *preview,
+ long buttons,
+ wxWindow *parent,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxTAB_TRAVERSAL,
+ const wxString& name = wxT("panel"));
+ virtual ~wxPreviewControlBar();
+
+ virtual void CreateButtons();
+ virtual void SetPageInfo(int minPage, int maxPage);
+ virtual void SetZoomControl(int zoom);
+ virtual int GetZoomControl();
+ virtual wxPrintPreviewBase *GetPrintPreview() const
+ { return m_printPreview; }
+
+
+ // Implementation only from now on.
+ void OnWindowClose(wxCommandEvent& event);
+ void OnNext();
+ void OnPrevious();
+ void OnFirst();
+ void OnLast();
+ void OnGotoPage();
+ void OnPrint();
+
+ void OnPrintButton(wxCommandEvent& WXUNUSED(event)) { OnPrint(); }
+ void OnNextButton(wxCommandEvent & WXUNUSED(event)) { OnNext(); }
+ void OnPreviousButton(wxCommandEvent & WXUNUSED(event)) { OnPrevious(); }
+ void OnFirstButton(wxCommandEvent & WXUNUSED(event)) { OnFirst(); }
+ void OnLastButton(wxCommandEvent & WXUNUSED(event)) { OnLast(); }
+ void OnPaint(wxPaintEvent& event);
+
+ void OnUpdateNextButton(wxUpdateUIEvent& event)
+ { event.Enable(IsNextEnabled()); }
+ void OnUpdatePreviousButton(wxUpdateUIEvent& event)
+ { event.Enable(IsPreviousEnabled()); }
+ void OnUpdateFirstButton(wxUpdateUIEvent& event)
+ { event.Enable(IsFirstEnabled()); }
+ void OnUpdateLastButton(wxUpdateUIEvent& event)
+ { event.Enable(IsLastEnabled()); }
+ void OnUpdateZoomInButton(wxUpdateUIEvent& event)
+ { event.Enable(IsZoomInEnabled()); }
+ void OnUpdateZoomOutButton(wxUpdateUIEvent& event)
+ { event.Enable(IsZoomOutEnabled()); }
+
+ // These methods are not private because they are called by wxPreviewCanvas.
+ void DoZoomIn();
+ void DoZoomOut();
+
+protected:
+ wxPrintPreviewBase* m_printPreview;
+ wxButton* m_closeButton;
+ wxChoice* m_zoomControl;
+ wxPrintPageTextCtrl* m_currentPageText;
+ wxPrintPageMaxCtrl* m_maxPageText;
+
+ long m_buttonFlags;
+
+private:
+ void DoGotoPage(int page);
+
+ void DoZoom();
+
+ bool IsNextEnabled() const;
+ bool IsPreviousEnabled() const;
+ bool IsFirstEnabled() const;
+ bool IsLastEnabled() const;
+ bool IsZoomInEnabled() const;
+ bool IsZoomOutEnabled() const;
+
+ void OnZoomInButton(wxCommandEvent & WXUNUSED(event)) { DoZoomIn(); }
+ void OnZoomOutButton(wxCommandEvent & WXUNUSED(event)) { DoZoomOut(); }
+ void OnZoomChoice(wxCommandEvent& WXUNUSED(event)) { DoZoom(); }
+
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxPreviewControlBar);
+};
+
+//----------------------------------------------------------------------------
+// wxPrintPreviewBase
+//----------------------------------------------------------------------------
+
+/*
+ * Programmer creates an object of this class to preview a wxPrintout.
+ */
+
+class WXDLLIMPEXP_CORE wxPrintPreviewBase: public wxObject
+{
+public:
+ wxPrintPreviewBase(wxPrintout *printout,
+ wxPrintout *printoutForPrinting = NULL,
+ wxPrintDialogData *data = NULL);
+ wxPrintPreviewBase(wxPrintout *printout,
+ wxPrintout *printoutForPrinting,
+ wxPrintData *data);
+ virtual ~wxPrintPreviewBase();
+
+ virtual bool SetCurrentPage(int pageNum);
+ virtual int GetCurrentPage() const;
+
+ virtual void SetPrintout(wxPrintout *printout);
+ virtual wxPrintout *GetPrintout() const;
+ virtual wxPrintout *GetPrintoutForPrinting() const;
+
+ virtual void SetFrame(wxFrame *frame);
+ virtual void SetCanvas(wxPreviewCanvas *canvas);
+
+ virtual wxFrame *GetFrame() const;
+ virtual wxPreviewCanvas *GetCanvas() const;
+
+ // This is a helper routine, used by the next 4 routines.
+
+ virtual void CalcRects(wxPreviewCanvas *canvas, wxRect& printableAreaRect, wxRect& paperRect);
+
+ // The preview canvas should call this from OnPaint
+ virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
+
+ // Updates rendered page by calling RenderPage() if needed, returns true
+ // if there was some change. Preview canvas should call it at idle time
+ virtual bool UpdatePageRendering();
+
+ // This draws a blank page onto the preview canvas
+ virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
+
+ // Adjusts the scrollbars for the current scale
+ virtual void AdjustScrollbars(wxPreviewCanvas *canvas);
+
+ // This is called by wxPrintPreview to render a page into a wxMemoryDC.
+ virtual bool RenderPage(int pageNum);
+
+
+ virtual void SetZoom(int percent);
+ virtual int GetZoom() const;
+
+ virtual wxPrintDialogData& GetPrintDialogData();
+
+ virtual int GetMaxPage() const;
+ virtual int GetMinPage() const;
+
+ virtual bool Ok() const { return IsOk(); }
+ virtual bool IsOk() const;
+ virtual void SetOk(bool ok);
+
+ ///////////////////////////////////////////////////////////////////////////
+ // OVERRIDES
+
+ // If we own a wxPrintout that can be used for printing, this
+ // will invoke the actual printing procedure. Called
+ // by the wxPreviewControlBar.
+ virtual bool Print(bool interactive) = 0;
+
+ // Calculate scaling that needs to be done to get roughly
+ // the right scaling for the screen pretending to be
+ // the currently selected printer.
+ virtual void DetermineScaling() = 0;
+
+protected:
+ // helpers for RenderPage():
+ virtual bool RenderPageIntoDC(wxDC& dc, int pageNum);
+ // renders preview into m_previewBitmap
+ virtual bool RenderPageIntoBitmap(wxBitmap& bmp, int pageNum);
+
+ void InvalidatePreviewBitmap();
+
+protected:
+ wxPrintDialogData m_printDialogData;
+ wxPreviewCanvas* m_previewCanvas;
+ wxFrame* m_previewFrame;
+ wxBitmap* m_previewBitmap;
+ bool m_previewFailed;
+ wxPrintout* m_previewPrintout;
+ wxPrintout* m_printPrintout;
+ int m_currentPage;
+ int m_currentZoom;
+ float m_previewScaleX;
+ float m_previewScaleY;
+ int m_topMargin;
+ int m_leftMargin;
+ int m_pageWidth;
+ int m_pageHeight;
+ int m_minPage;
+ int m_maxPage;
+
+ bool m_isOk;
+ bool m_printingPrepared; // Called OnPreparePrinting?
+
+private:
+ void Init(wxPrintout *printout, wxPrintout *printoutForPrinting);
+
+ wxDECLARE_NO_COPY_CLASS(wxPrintPreviewBase);
+ DECLARE_CLASS(wxPrintPreviewBase)
+};
+
+//----------------------------------------------------------------------------
+// wxPrintPreview
+//----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPrintPreview: public wxPrintPreviewBase
+{
+public:
+ wxPrintPreview(wxPrintout *printout,
+ wxPrintout *printoutForPrinting = NULL,
+ wxPrintDialogData *data = NULL);
+ wxPrintPreview(wxPrintout *printout,
+ wxPrintout *printoutForPrinting,
+ wxPrintData *data);
+ virtual ~wxPrintPreview();
+
+ virtual bool SetCurrentPage(int pageNum);
+ virtual int GetCurrentPage() const;
+ virtual void SetPrintout(wxPrintout *printout);
+ virtual wxPrintout *GetPrintout() const;
+ virtual wxPrintout *GetPrintoutForPrinting() const;
+ virtual void SetFrame(wxFrame *frame);
+ virtual void SetCanvas(wxPreviewCanvas *canvas);
+
+ virtual wxFrame *GetFrame() const;
+ virtual wxPreviewCanvas *GetCanvas() const;
+ virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
+ virtual bool UpdatePageRendering();
+ virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
+ virtual void AdjustScrollbars(wxPreviewCanvas *canvas);
+ virtual bool RenderPage(int pageNum);
+ virtual void SetZoom(int percent);
+ virtual int GetZoom() const;
+
+ virtual bool Print(bool interactive);
+ virtual void DetermineScaling();
+
+ virtual wxPrintDialogData& GetPrintDialogData();
+
+ virtual int GetMaxPage() const;
+ virtual int GetMinPage() const;
+
+ virtual bool Ok() const { return IsOk(); }
+ virtual bool IsOk() const;
+ virtual void SetOk(bool ok);
+
+private:
+ wxPrintPreviewBase *m_pimpl;
+
+private:
+ DECLARE_CLASS(wxPrintPreview)
+ wxDECLARE_NO_COPY_CLASS(wxPrintPreview);
+};
+
+//----------------------------------------------------------------------------
+// wxPrintAbortDialog
+//----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPrintAbortDialog: public wxDialog
+{
+public:
+ wxPrintAbortDialog(wxWindow *parent,
+ const wxString& documentTitle,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE,
+ const wxString& name = wxT("dialog"));
+
+ void SetProgress(int currentPage, int totalPages,
+ int currentCopy, int totalCopies);
+
+ void OnCancel(wxCommandEvent& event);
+
+private:
+ wxStaticText *m_progress;
+
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxPrintAbortDialog);
+};
+
+#endif // wxUSE_PRINTING_ARCHITECTURE
+
+#endif
+ // _WX_PRNTBASEH__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/process.h
+// Purpose: wxProcess class
+// Author: Guilhem Lavaux
+// Modified by: Vadim Zeitlin to check error codes, added Detach() method
+// Created: 24/06/98
+// Copyright: (c) 1998 Guilhem Lavaux
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PROCESSH__
+#define _WX_PROCESSH__
+
+#include "wx/event.h"
+
+#if wxUSE_STREAMS
+ #include "wx/stream.h"
+#endif
+
+#include "wx/utils.h" // for wxSignal
+
+// the wxProcess creation flags
+enum
+{
+ // no redirection
+ wxPROCESS_DEFAULT = 0,
+
+ // redirect the IO of the child process
+ wxPROCESS_REDIRECT = 1
+};
+
+// ----------------------------------------------------------------------------
+// A wxProcess object should be passed to wxExecute - than its OnTerminate()
+// function will be called when the process terminates.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxProcess : public wxEvtHandler
+{
+public:
+ // kill the process with the given PID
+ static wxKillError Kill(int pid, wxSignal sig = wxSIGTERM, int flags = wxKILL_NOCHILDREN);
+
+ // test if the given process exists
+ static bool Exists(int pid);
+
+ // this function replaces the standard popen() one: it launches a process
+ // asynchronously and allows the caller to get the streams connected to its
+ // std{in|out|err}
+ //
+ // on error NULL is returned, in any case the process object will be
+ // deleted automatically when the process terminates and should *not* be
+ // deleted by the caller
+ static wxProcess *Open(const wxString& cmd, int flags = wxEXEC_ASYNC);
+
+
+ // ctors
+ wxProcess(wxEvtHandler *parent = NULL, int nId = wxID_ANY)
+ { Init(parent, nId, wxPROCESS_DEFAULT); }
+
+ wxProcess(int flags) { Init(NULL, wxID_ANY, flags); }
+
+ virtual ~wxProcess();
+
+ // get the process ID of the process executed by Open()
+ long GetPid() const { return m_pid; }
+
+ // may be overridden to be notified about process termination
+ virtual void OnTerminate(int pid, int status);
+
+ // call this before passing the object to wxExecute() to redirect the
+ // launched process stdin/stdout, then use GetInputStream() and
+ // GetOutputStream() to get access to them
+ void Redirect() { m_redirect = true; }
+ bool IsRedirected() const { return m_redirect; }
+
+ // detach from the parent - should be called by the parent if it's deleted
+ // before the process it started terminates
+ void Detach();
+
+#if wxUSE_STREAMS
+ // Pipe handling
+ wxInputStream *GetInputStream() const { return m_inputStream; }
+ wxInputStream *GetErrorStream() const { return m_errorStream; }
+ wxOutputStream *GetOutputStream() const { return m_outputStream; }
+
+ // close the output stream indicating that nothing more will be written
+ void CloseOutput() { delete m_outputStream; m_outputStream = NULL; }
+
+ // return true if the child process stdout is not closed
+ bool IsInputOpened() const;
+
+ // return true if any input is available on the child process stdout/err
+ bool IsInputAvailable() const;
+ bool IsErrorAvailable() const;
+
+ // implementation only (for wxExecute)
+ //
+ // NB: the streams passed here should correspond to the child process
+ // stdout, stdin and stderr and here the normal naming convention is
+ // used unlike elsewhere in this class
+ void SetPipeStreams(wxInputStream *outStream,
+ wxOutputStream *inStream,
+ wxInputStream *errStream);
+#endif // wxUSE_STREAMS
+
+ // priority
+ // Sets the priority to the given value: see wxPRIORITY_XXX constants.
+ //
+ // NB: the priority can only be set before the process is created
+ void SetPriority(unsigned priority);
+
+ // Get the current priority.
+ unsigned GetPriority() const { return m_priority; }
+
+ // implementation only - don't use!
+ // --------------------------------
+
+ // needs to be public since it needs to be used from wxExecute() global func
+ void SetPid(long pid) { m_pid = pid; }
+
+protected:
+ void Init(wxEvtHandler *parent, int id, int flags);
+
+ int m_id;
+ long m_pid;
+
+ unsigned m_priority;
+
+#if wxUSE_STREAMS
+ // these streams are connected to stdout, stderr and stdin of the child
+ // process respectively (yes, m_inputStream corresponds to stdout -- very
+ // confusing but too late to change now)
+ wxInputStream *m_inputStream,
+ *m_errorStream;
+ wxOutputStream *m_outputStream;
+#endif // wxUSE_STREAMS
+
+ bool m_redirect;
+
+ DECLARE_DYNAMIC_CLASS(wxProcess)
+ wxDECLARE_NO_COPY_CLASS(wxProcess);
+};
+
+// ----------------------------------------------------------------------------
+// wxProcess events
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_BASE wxProcessEvent;
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_BASE, wxEVT_END_PROCESS, wxProcessEvent );
+
+class WXDLLIMPEXP_BASE wxProcessEvent : public wxEvent
+{
+public:
+ wxProcessEvent(int nId = 0, int pid = 0, int exitcode = 0) : wxEvent(nId)
+ {
+ m_eventType = wxEVT_END_PROCESS;
+ m_pid = pid;
+ m_exitcode = exitcode;
+ }
+
+ // accessors
+ // PID of process which terminated
+ int GetPid() { return m_pid; }
+
+ // the exit code
+ int GetExitCode() { return m_exitcode; }
+
+ // implement the base class pure virtual
+ virtual wxEvent *Clone() const { return new wxProcessEvent(*this); }
+
+public:
+ int m_pid,
+ m_exitcode;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxProcessEvent)
+};
+
+typedef void (wxEvtHandler::*wxProcessEventFunction)(wxProcessEvent&);
+
+#define wxProcessEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxProcessEventFunction, func)
+
+#define EVT_END_PROCESS(id, func) \
+ wx__DECLARE_EVT1(wxEVT_END_PROCESS, id, wxProcessEventHandler(func))
+
+#endif // _WX_PROCESSH__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/progdlg.h
+// Purpose: Base header for wxProgressDialog
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PROGDLG_H_BASE_
+#define _WX_PROGDLG_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_PROGRESSDLG
+
+/*
+ * wxProgressDialog flags
+ */
+#define wxPD_CAN_ABORT 0x0001
+#define wxPD_APP_MODAL 0x0002
+#define wxPD_AUTO_HIDE 0x0004
+#define wxPD_ELAPSED_TIME 0x0008
+#define wxPD_ESTIMATED_TIME 0x0010
+#define wxPD_SMOOTH 0x0020
+#define wxPD_REMAINING_TIME 0x0040
+#define wxPD_CAN_SKIP 0x0080
+
+
+#include "wx/generic/progdlgg.h"
+
+#if defined(__WXMSW__) && wxUSE_THREADS && !defined(__WXUNIVERSAL__)
+ #include "wx/msw/progdlg.h"
+#else
+ class WXDLLIMPEXP_CORE wxProgressDialog
+ : public wxGenericProgressDialog
+ {
+ public:
+ wxProgressDialog( const wxString& title, const wxString& message,
+ int maximum = 100,
+ wxWindow *parent = NULL,
+ int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE )
+ : wxGenericProgressDialog( title, message, maximum,
+ parent, style )
+ { }
+
+ private:
+ wxDECLARE_DYNAMIC_CLASS_NO_COPY( wxProgressDialog );
+ };
+#endif // defined(__WXMSW__) && wxUSE_THREADS
+
+#endif // wxUSE_PROGRESSDLG
+
+#endif // _WX_PROGDLG_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/propdlg.h
+// Purpose: wxPropertySheetDialog base header
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PROPDLG_H_BASE_
+#define _WX_PROPDLG_H_BASE_
+
+#include "wx/generic/propdlg.h"
+
+#endif
+ // _WX_PROPDLG_H_BASE_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/propgrid/advprops.h
+// Purpose: wxPropertyGrid Advanced Properties (font, colour, etc.)
+// Author: Jaakko Salli
+// Modified by:
+// Created: 2004-09-25
+// Copyright: (c) Jaakko Salli
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PROPGRID_ADVPROPS_H_
+#define _WX_PROPGRID_ADVPROPS_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_PROPGRID
+
+#include "wx/propgrid/props.h"
+
+// -----------------------------------------------------------------------
+
+//
+// Additional Value Type Handlers
+//
+bool WXDLLIMPEXP_PROPGRID
+operator==(const wxArrayInt& array1, const wxArrayInt& array2);
+
+//
+// Additional Property Editors
+//
+#if wxUSE_SPINBTN
+WX_PG_DECLARE_EDITOR_WITH_DECL(SpinCtrl,WXDLLIMPEXP_PROPGRID)
+#endif
+
+#if wxUSE_DATEPICKCTRL
+WX_PG_DECLARE_EDITOR_WITH_DECL(DatePickerCtrl,WXDLLIMPEXP_PROPGRID)
+#endif
+
+// -----------------------------------------------------------------------
+
+
+// Web colour is currently unsupported
+#define wxPG_COLOUR_WEB_BASE 0x10000
+//#define wxPG_TO_WEB_COLOUR(A) ((wxUint32)(A+wxPG_COLOUR_WEB_BASE))
+
+
+#define wxPG_COLOUR_CUSTOM 0xFFFFFF
+#define wxPG_COLOUR_UNSPECIFIED (wxPG_COLOUR_CUSTOM+1)
+
+/** @class wxColourPropertyValue
+
+ Because text, background and other colours tend to differ between
+ platforms, wxSystemColourProperty must be able to select between system
+ colour and, when necessary, to pick a custom one. wxSystemColourProperty
+ value makes this possible.
+*/
+class WXDLLIMPEXP_PROPGRID wxColourPropertyValue : public wxObject
+{
+public:
+ /** An integer value relating to the colour, and which exact
+ meaning depends on the property with which it is used.
+
+ For wxSystemColourProperty:
+
+ Any of wxSYS_COLOUR_XXX, or any web-colour ( use wxPG_TO_WEB_COLOUR
+ macro - (currently unsupported) ), or wxPG_COLOUR_CUSTOM.
+
+ For custom colour properties without values array specified:
+
+ index or wxPG_COLOUR_CUSTOM
+
+ For custom colour properties <b>with</b> values array specified:
+
+ m_arrValues[index] or wxPG_COLOUR_CUSTOM
+ */
+ wxUint32 m_type;
+
+ /** Resulting colour. Should be correct regardless of type. */
+ wxColour m_colour;
+
+ wxColourPropertyValue()
+ : wxObject()
+ {
+ m_type = 0;
+ }
+
+ virtual ~wxColourPropertyValue()
+ {
+ }
+
+ wxColourPropertyValue( const wxColourPropertyValue& v )
+ : wxObject()
+ {
+ m_type = v.m_type;
+ m_colour = v.m_colour;
+ }
+
+ void Init( wxUint32 type, const wxColour& colour )
+ {
+ m_type = type;
+ m_colour = colour;
+ }
+
+ wxColourPropertyValue( const wxColour& colour )
+ : wxObject()
+ {
+ m_type = wxPG_COLOUR_CUSTOM;
+ m_colour = colour;
+ }
+
+ wxColourPropertyValue( wxUint32 type )
+ : wxObject()
+ {
+ m_type = type;
+ }
+
+ wxColourPropertyValue( wxUint32 type, const wxColour& colour )
+ : wxObject()
+ {
+ Init( type, colour );
+ }
+
+ void operator=(const wxColourPropertyValue& cpv)
+ {
+ if (this != &cpv)
+ Init( cpv.m_type, cpv.m_colour );
+ }
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxColourPropertyValue)
+};
+
+
+bool WXDLLIMPEXP_PROPGRID
+operator==(const wxColourPropertyValue&, const wxColourPropertyValue&);
+
+DECLARE_VARIANT_OBJECT_EXPORTED(wxColourPropertyValue, WXDLLIMPEXP_PROPGRID)
+
+// -----------------------------------------------------------------------
+// Declare part of custom colour property macro pairs.
+
+#if wxUSE_IMAGE
+ #include "wx/image.h"
+#endif
+
+// -----------------------------------------------------------------------
+
+/** @class wxFontProperty
+ @ingroup classes
+ Property representing wxFont.
+*/
+class WXDLLIMPEXP_PROPGRID wxFontProperty : public wxPGProperty
+{
+ WX_PG_DECLARE_PROPERTY_CLASS(wxFontProperty)
+public:
+
+ wxFontProperty(const wxString& label = wxPG_LABEL,
+ const wxString& name = wxPG_LABEL,
+ const wxFont& value = wxFont());
+ virtual ~wxFontProperty();
+ virtual void OnSetValue();
+ virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+ virtual bool OnEvent( wxPropertyGrid* propgrid,
+ wxWindow* primary, wxEvent& event );
+ virtual wxVariant ChildChanged( wxVariant& thisValue,
+ int childIndex,
+ wxVariant& childValue ) const;
+ virtual void RefreshChildren();
+
+protected:
+};
+
+// -----------------------------------------------------------------------
+
+
+/** If set, then match from list is searched for a custom colour. */
+#define wxPG_PROP_TRANSLATE_CUSTOM wxPG_PROP_CLASS_SPECIFIC_1
+
+
+/** @class wxSystemColourProperty
+ @ingroup classes
+ Has dropdown list of wxWidgets system colours. Value used is
+ of wxColourPropertyValue type.
+*/
+class WXDLLIMPEXP_PROPGRID wxSystemColourProperty : public wxEnumProperty
+{
+ WX_PG_DECLARE_PROPERTY_CLASS(wxSystemColourProperty)
+public:
+
+ wxSystemColourProperty( const wxString& label = wxPG_LABEL,
+ const wxString& name = wxPG_LABEL,
+ const wxColourPropertyValue&
+ value = wxColourPropertyValue() );
+ virtual ~wxSystemColourProperty();
+
+ virtual void OnSetValue();
+ virtual bool IntToValue(wxVariant& variant,
+ int number,
+ int argFlags = 0) const;
+
+ /**
+ Override in derived class to customize how colours are printed as
+ strings.
+ */
+ virtual wxString ColourToString( const wxColour& col, int index,
+ int argFlags = 0 ) const;
+
+ /** Returns index of entry that triggers colour picker dialog
+ (default is last).
+ */
+ virtual int GetCustomColourIndex() const;
+
+ virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+ virtual bool StringToValue( wxVariant& variant,
+ const wxString& text,
+ int argFlags = 0 ) const;
+ virtual bool OnEvent( wxPropertyGrid* propgrid,
+ wxWindow* primary, wxEvent& event );
+ virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
+ virtual wxSize OnMeasureImage( int item ) const;
+ virtual void OnCustomPaint( wxDC& dc,
+ const wxRect& rect, wxPGPaintData& paintdata );
+
+ // Helper function to show the colour dialog
+ bool QueryColourFromUser( wxVariant& variant ) const;
+
+ /** Default is to use wxSystemSettings::GetColour(index). Override to use
+ custom colour tables etc.
+ */
+ virtual wxColour GetColour( int index ) const;
+
+ wxColourPropertyValue GetVal( const wxVariant* pVariant = NULL ) const;
+
+protected:
+
+ // Special constructors to be used by derived classes.
+ wxSystemColourProperty( const wxString& label, const wxString& name,
+ const wxChar* const* labels, const long* values, wxPGChoices* choicesCache,
+ const wxColourPropertyValue& value );
+ wxSystemColourProperty( const wxString& label, const wxString& name,
+ const wxChar* const* labels, const long* values, wxPGChoices* choicesCache,
+ const wxColour& value );
+
+ void Init( int type, const wxColour& colour );
+
+ // Utility functions for internal use
+ virtual wxVariant DoTranslateVal( wxColourPropertyValue& v ) const;
+ wxVariant TranslateVal( wxColourPropertyValue& v ) const
+ {
+ return DoTranslateVal( v );
+ }
+ wxVariant TranslateVal( int type, const wxColour& colour ) const
+ {
+ wxColourPropertyValue v(type, colour);
+ return DoTranslateVal( v );
+ }
+
+ // Translates colour to a int value, return wxNOT_FOUND if no match.
+ int ColToInd( const wxColour& colour ) const;
+};
+
+// -----------------------------------------------------------------------
+
+class WXDLLIMPEXP_PROPGRID wxColourProperty : public wxSystemColourProperty
+{
+ WX_PG_DECLARE_PROPERTY_CLASS(wxColourProperty)
+public:
+ wxColourProperty( const wxString& label = wxPG_LABEL,
+ const wxString& name = wxPG_LABEL,
+ const wxColour& value = *wxWHITE );
+ virtual ~wxColourProperty();
+
+ virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+ virtual wxColour GetColour( int index ) const;
+
+protected:
+ virtual wxVariant DoTranslateVal( wxColourPropertyValue& v ) const;
+
+private:
+ void Init( wxColour colour );
+};
+
+// -----------------------------------------------------------------------
+
+/** @class wxCursorProperty
+ @ingroup classes
+ Property representing wxCursor.
+*/
+class WXDLLIMPEXP_PROPGRID wxCursorProperty : public wxEnumProperty
+{
+ DECLARE_DYNAMIC_CLASS(wxCursorProperty)
+
+ wxCursorProperty( const wxString& label= wxPG_LABEL,
+ const wxString& name= wxPG_LABEL,
+ int value = 0 );
+ virtual ~wxCursorProperty();
+
+ virtual wxSize OnMeasureImage( int item ) const;
+ virtual void OnCustomPaint( wxDC& dc,
+ const wxRect& rect, wxPGPaintData& paintdata );
+};
+
+// -----------------------------------------------------------------------
+
+#if wxUSE_IMAGE
+
+WXDLLIMPEXP_PROPGRID const wxString& wxPGGetDefaultImageWildcard();
+
+/** @class wxImageFileProperty
+ @ingroup classes
+ Property representing image file(name).
+*/
+class WXDLLIMPEXP_PROPGRID wxImageFileProperty : public wxFileProperty
+{
+ DECLARE_DYNAMIC_CLASS(wxImageFileProperty)
+public:
+
+ wxImageFileProperty( const wxString& label= wxPG_LABEL,
+ const wxString& name = wxPG_LABEL,
+ const wxString& value = wxEmptyString);
+ virtual ~wxImageFileProperty();
+
+ virtual void OnSetValue();
+
+ virtual wxSize OnMeasureImage( int item ) const;
+ virtual void OnCustomPaint( wxDC& dc,
+ const wxRect& rect, wxPGPaintData& paintdata );
+
+protected:
+ wxBitmap* m_pBitmap; // final thumbnail area
+ wxImage* m_pImage; // intermediate thumbnail area
+
+private:
+ // Initialize m_pImage using the current file name.
+ void LoadImageFromFile();
+};
+
+#endif
+
+#if wxUSE_CHOICEDLG
+
+/** @class wxMultiChoiceProperty
+ @ingroup classes
+ Property that manages a value resulting from wxMultiChoiceDialog. Value is
+ array of strings. You can get value as array of choice values/indices by
+ calling wxMultiChoiceProperty::GetValueAsArrayInt().
+
+ <b>Supported special attributes:</b>
+ - "UserStringMode": If > 0, allow user to manually enter strings that are
+ not in the list of choices. If this value is 1, user strings are
+ preferably placed in front of valid choices. If value is 2, then those
+ strings will placed behind valid choices.
+*/
+class WXDLLIMPEXP_PROPGRID wxMultiChoiceProperty : public wxPGProperty
+{
+ WX_PG_DECLARE_PROPERTY_CLASS(wxMultiChoiceProperty)
+public:
+
+ wxMultiChoiceProperty( const wxString& label,
+ const wxString& name,
+ const wxArrayString& strings,
+ const wxArrayString& value );
+ wxMultiChoiceProperty( const wxString& label,
+ const wxString& name,
+ const wxPGChoices& choices,
+ const wxArrayString& value = wxArrayString() );
+
+ wxMultiChoiceProperty( const wxString& label = wxPG_LABEL,
+ const wxString& name = wxPG_LABEL,
+ const wxArrayString& value = wxArrayString() );
+
+ virtual ~wxMultiChoiceProperty();
+
+ virtual void OnSetValue();
+ virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+ virtual bool StringToValue(wxVariant& variant,
+ const wxString& text,
+ int argFlags = 0) const;
+ virtual bool OnEvent( wxPropertyGrid* propgrid,
+ wxWindow* primary, wxEvent& event );
+
+ wxArrayInt GetValueAsArrayInt() const
+ {
+ return m_choices.GetValuesForStrings(m_value.GetArrayString());
+ }
+
+protected:
+
+ void GenerateValueAsString( wxVariant& value, wxString* target ) const;
+
+ // Returns translation of values into string indices.
+ wxArrayInt GetValueAsIndices() const;
+
+ wxArrayString m_valueAsStrings; // Value as array of strings
+
+ // Cache displayed text since generating it is relatively complicated.
+ wxString m_display;
+};
+
+#endif // wxUSE_CHOICEDLG
+
+// -----------------------------------------------------------------------
+
+#if wxUSE_DATETIME
+
+/** @class wxDateProperty
+ @ingroup classes
+ Property representing wxDateTime.
+
+ <b>Supported special attributes:</b>
+ - "DateFormat": Determines displayed date format.
+ - "PickerStyle": Determines window style used with wxDatePickerCtrl.
+ Default is wxDP_DEFAULT | wxDP_SHOWCENTURY. Using wxDP_ALLOWNONE
+ enables additional support for unspecified property value.
+*/
+class WXDLLIMPEXP_PROPGRID wxDateProperty : public wxPGProperty
+{
+ WX_PG_DECLARE_PROPERTY_CLASS(wxDateProperty)
+public:
+
+ wxDateProperty( const wxString& label = wxPG_LABEL,
+ const wxString& name = wxPG_LABEL,
+ const wxDateTime& value = wxDateTime() );
+ virtual ~wxDateProperty();
+
+ virtual void OnSetValue();
+ virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+ virtual bool StringToValue(wxVariant& variant,
+ const wxString& text,
+ int argFlags = 0) const;
+
+ virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
+
+ void SetFormat( const wxString& format )
+ {
+ m_format = format;
+ }
+
+ const wxString& GetFormat() const
+ {
+ return m_format;
+ }
+
+ void SetDateValue( const wxDateTime& dt )
+ {
+ //m_valueDateTime = dt;
+ m_value = dt;
+ }
+
+ wxDateTime GetDateValue() const
+ {
+ //return m_valueDateTime;
+ return m_value;
+ }
+
+ long GetDatePickerStyle() const
+ {
+ return m_dpStyle;
+ }
+
+protected:
+ wxString m_format;
+ long m_dpStyle; // DatePicker style
+
+ static wxString ms_defaultDateFormat;
+ static wxString DetermineDefaultDateFormat( bool showCentury );
+};
+
+#endif // wxUSE_DATETIME
+
+// -----------------------------------------------------------------------
+
+#if wxUSE_SPINBTN
+
+//
+// Implement an editor control that allows using wxSpinCtrl (actually, a
+// combination of wxTextCtrl and wxSpinButton) to edit value of wxIntProperty
+// and wxFloatProperty (and similar).
+//
+// Note that new editor classes needs to be registered before use. This can be
+// accomplished using wxPGRegisterEditorClass macro, which is used for SpinCtrl
+// in wxPropertyGridInterface::RegisterAdditionalEditors (see below).
+// Registration can also be performed in a constructor of a property that is
+// likely to require the editor in question.
+//
+
+
+#include "wx/spinbutt.h"
+#include "wx/propgrid/editors.h"
+
+
+// NOTE: Regardless that this class inherits from a working editor, it has
+// all necessary methods to work independently. wxTextCtrl stuff is only
+// used for event handling here.
+class WXDLLIMPEXP_PROPGRID wxPGSpinCtrlEditor : public wxPGTextCtrlEditor
+{
+ DECLARE_DYNAMIC_CLASS(wxPGSpinCtrlEditor)
+public:
+ virtual ~wxPGSpinCtrlEditor();
+
+ wxString GetName() const;
+ virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid,
+ wxPGProperty* property,
+ const wxPoint& pos,
+ const wxSize& size) const;
+ virtual bool OnEvent( wxPropertyGrid* propgrid, wxPGProperty* property,
+ wxWindow* wnd, wxEvent& event ) const;
+
+private:
+ mutable wxString m_tempString;
+};
+
+#endif // wxUSE_SPINBTN
+
+// -----------------------------------------------------------------------
+
+#endif // wxUSE_PROPGRID
+
+#endif // _WX_PROPGRID_ADVPROPS_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/propgrid/editors.h
+// Purpose: wxPropertyGrid editors
+// Author: Jaakko Salli
+// Modified by:
+// Created: 2007-04-14
+// Copyright: (c) Jaakko Salli
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PROPGRID_EDITORS_H_
+#define _WX_PROPGRID_EDITORS_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_PROPGRID
+
+class WXDLLIMPEXP_FWD_PROPGRID wxPGCell;
+class WXDLLIMPEXP_FWD_PROPGRID wxPGProperty;
+class WXDLLIMPEXP_FWD_PROPGRID wxPropertyGrid;
+
+// -----------------------------------------------------------------------
+// wxPGWindowList contains list of editor windows returned by CreateControls.
+
+class wxPGWindowList
+{
+public:
+ wxPGWindowList()
+ {
+ m_primary = m_secondary = NULL;
+ }
+
+ void SetSecondary( wxWindow* secondary ) { m_secondary = secondary; }
+
+ wxWindow* m_primary;
+ wxWindow* m_secondary;
+
+ wxPGWindowList( wxWindow* a )
+ {
+ m_primary = a;
+ m_secondary = NULL;
+ };
+ wxPGWindowList( wxWindow* a, wxWindow* b )
+ {
+ m_primary = a;
+ m_secondary = b;
+ };
+};
+
+// -----------------------------------------------------------------------
+
+/** @class wxPGEditor
+
+ Base class for custom wxPropertyGrid editors.
+
+ @remarks
+ - Names of builtin property editors are: TextCtrl, Choice,
+ ComboBox, CheckBox, TextCtrlAndButton, and ChoiceAndButton. Additional
+ editors include SpinCtrl and DatePickerCtrl, but using them requires
+ calling wxPropertyGrid::RegisterAdditionalEditors() prior use.
+
+ - Pointer to builtin editor is available as wxPGEditor_EditorName
+ (eg. wxPGEditor_TextCtrl).
+
+ - To add new editor you need to register it first using static function
+ wxPropertyGrid::RegisterEditorClass(), with code like this:
+ @code
+ wxPGEditor *editorPointer = wxPropertyGrid::RegisterEditorClass(
+ new MyEditorClass(), "MyEditor");
+ @endcode
+ After that, wxPropertyGrid will take ownership of the given object, but
+ you should still store editorPointer somewhere, so you can pass it to
+ wxPGProperty::SetEditor(), or return it from
+ wxPGEditor::DoGetEditorClass().
+
+ @library{wxpropgrid}
+ @category{propgrid}
+*/
+class WXDLLIMPEXP_PROPGRID wxPGEditor : public wxObject
+{
+ DECLARE_ABSTRACT_CLASS(wxPGEditor)
+public:
+
+ /** Constructor. */
+ wxPGEditor()
+ : wxObject()
+ {
+ m_clientData = NULL;
+ }
+
+ /** Destructor. */
+ virtual ~wxPGEditor();
+
+ /**
+ Returns pointer to the name of the editor. For example,
+ wxPGEditor_TextCtrl has name "TextCtrl". If you dont' need to access
+ your custom editor by string name, then you do not need to implement
+ this function.
+ */
+ virtual wxString GetName() const;
+
+ /**
+ Instantiates editor controls.
+
+ @param propgrid
+ wxPropertyGrid to which the property belongs (use as parent for
+ control).
+ @param property
+ Property for which this method is called.
+ @param pos
+ Position, inside wxPropertyGrid, to create control(s) to.
+ @param size
+ Initial size for control(s).
+
+ @remarks
+ - Primary control shall use id wxPG_SUBID1, and secondary (button)
+ control shall use wxPG_SUBID2.
+ - Unlike in previous version of wxPropertyGrid, it is no longer
+ necessary to call wxEvtHandler::Connect() for interesting editor
+ events. Instead, all events from control are now automatically
+ forwarded to wxPGEditor::OnEvent() and wxPGProperty::OnEvent().
+ */
+ virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid,
+ wxPGProperty* property,
+ const wxPoint& pos,
+ const wxSize& size) const = 0;
+
+ /** Loads value from property to the control. */
+ virtual void UpdateControl( wxPGProperty* property,
+ wxWindow* ctrl ) const = 0;
+
+ /**
+ Used to get the renderer to draw the value with when the control is
+ hidden.
+
+ Default implementation returns g_wxPGDefaultRenderer.
+ */
+ //virtual wxPGCellRenderer* GetCellRenderer() const;
+
+ /** Draws value for given property.
+ */
+ virtual void DrawValue( wxDC& dc,
+ const wxRect& rect,
+ wxPGProperty* property,
+ const wxString& text ) const;
+
+ /** Handles events. Returns true if value in control was modified
+ (see wxPGProperty::OnEvent for more information).
+
+ @remarks wxPropertyGrid will automatically unfocus the editor when
+ wxEVT_TEXT_ENTER is received and when it results in
+ property value being modified. This happens regardless of
+ editor type (ie. behaviour is same for any wxTextCtrl and
+ wxComboBox based editor).
+ */
+ virtual bool OnEvent( wxPropertyGrid* propgrid, wxPGProperty* property,
+ wxWindow* wnd_primary, wxEvent& event ) const = 0;
+
+ /** Returns value from control, via parameter 'variant'.
+ Usually ends up calling property's StringToValue or IntToValue.
+ Returns true if value was different.
+ */
+ virtual bool GetValueFromControl( wxVariant& variant,
+ wxPGProperty* property,
+ wxWindow* ctrl ) const;
+
+ /**
+ Sets new appearance for the control. Default implementation
+ sets foreground colour, background colour, font, plus text
+ for wxTextCtrl and wxComboCtrl.
+
+ @param appearance
+ New appearance to be applied.
+
+ @param oldAppearance
+ Previously applied appearance. Used to detect which
+ control attributes need to be changed (e.g. so we only
+ change background colour if really needed).
+
+ @param unspecified
+ @true if the new appearance represents an unspecified
+ property value.
+ */
+ virtual void SetControlAppearance( wxPropertyGrid* pg,
+ wxPGProperty* property,
+ wxWindow* ctrl,
+ const wxPGCell& appearance,
+ const wxPGCell& oldAppearance,
+ bool unspecified ) const;
+
+ /**
+ Sets value in control to unspecified.
+ */
+ virtual void SetValueToUnspecified( wxPGProperty* property,
+ wxWindow* ctrl ) const;
+
+ /** Sets control's value specifically from string. */
+ virtual void SetControlStringValue( wxPGProperty* property,
+ wxWindow* ctrl,
+ const wxString& txt ) const;
+
+ /** Sets control's value specifically from int (applies to choice etc.). */
+ virtual void SetControlIntValue( wxPGProperty* property,
+ wxWindow* ctrl,
+ int value ) const;
+
+ /** Inserts item to existing control. Index -1 means appending.
+ Default implementation does nothing. Returns index of item added.
+ */
+ virtual int InsertItem( wxWindow* ctrl,
+ const wxString& label,
+ int index ) const;
+
+ /** Deletes item from existing control.
+ Default implementation does nothing.
+ */
+ virtual void DeleteItem( wxWindow* ctrl, int index ) const;
+
+ /** Extra processing when control gains focus. For example, wxTextCtrl
+ based controls should select all text.
+ */
+ virtual void OnFocus( wxPGProperty* property, wxWindow* wnd ) const;
+
+ /** Returns true if control itself can contain the custom image. Default is
+ to return false.
+ */
+ virtual bool CanContainCustomImage() const;
+
+ //
+ // This member is public so scripting language bindings
+ // wrapper code can access it freely.
+ void* m_clientData;
+};
+
+
+#define WX_PG_IMPLEMENT_INTERNAL_EDITOR_CLASS(EDITOR,CLASSNAME,BASECLASS) \
+IMPLEMENT_DYNAMIC_CLASS(CLASSNAME, BASECLASS) \
+wxString CLASSNAME::GetName() const \
+{ \
+ return wxS(#EDITOR); \
+} \
+wxPGEditor* wxPGEditor_##EDITOR = NULL;
+
+
+//
+// Following are the built-in editor classes.
+//
+
+class WXDLLIMPEXP_PROPGRID wxPGTextCtrlEditor : public wxPGEditor
+{
+ DECLARE_DYNAMIC_CLASS(wxPGTextCtrlEditor)
+public:
+ wxPGTextCtrlEditor() {}
+ virtual ~wxPGTextCtrlEditor();
+
+ virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid,
+ wxPGProperty* property,
+ const wxPoint& pos,
+ const wxSize& size) const;
+ virtual void UpdateControl( wxPGProperty* property,
+ wxWindow* ctrl ) const;
+ virtual bool OnEvent( wxPropertyGrid* propgrid,
+ wxPGProperty* property,
+ wxWindow* primaryCtrl,
+ wxEvent& event ) const;
+ virtual bool GetValueFromControl( wxVariant& variant,
+ wxPGProperty* property,
+ wxWindow* ctrl ) const;
+
+ virtual wxString GetName() const;
+
+ //virtual wxPGCellRenderer* GetCellRenderer() const;
+ virtual void SetControlStringValue( wxPGProperty* property,
+ wxWindow* ctrl,
+ const wxString& txt ) const;
+ virtual void OnFocus( wxPGProperty* property, wxWindow* wnd ) const;
+
+ // Provided so that, for example, ComboBox editor can use the same code
+ // (multiple inheritance would get way too messy).
+ static bool OnTextCtrlEvent( wxPropertyGrid* propgrid,
+ wxPGProperty* property,
+ wxWindow* ctrl,
+ wxEvent& event );
+
+ static bool GetTextCtrlValueFromControl( wxVariant& variant,
+ wxPGProperty* property,
+ wxWindow* ctrl );
+
+};
+
+
+class WXDLLIMPEXP_PROPGRID wxPGChoiceEditor : public wxPGEditor
+{
+ DECLARE_DYNAMIC_CLASS(wxPGChoiceEditor)
+public:
+ wxPGChoiceEditor() {}
+ virtual ~wxPGChoiceEditor();
+
+ virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid,
+ wxPGProperty* property,
+ const wxPoint& pos,
+ const wxSize& size) const;
+ virtual void UpdateControl( wxPGProperty* property,
+ wxWindow* ctrl ) const;
+ virtual bool OnEvent( wxPropertyGrid* propgrid,
+ wxPGProperty* property,
+ wxWindow* primaryCtrl,
+ wxEvent& event ) const;
+ virtual bool GetValueFromControl( wxVariant& variant,
+ wxPGProperty* property,
+ wxWindow* ctrl ) const;
+ virtual void SetValueToUnspecified( wxPGProperty* property,
+ wxWindow* ctrl ) const;
+ virtual wxString GetName() const;
+
+ virtual void SetControlIntValue( wxPGProperty* property,
+ wxWindow* ctrl,
+ int value ) const;
+ virtual void SetControlStringValue( wxPGProperty* property,
+ wxWindow* ctrl,
+ const wxString& txt ) const;
+
+ virtual int InsertItem( wxWindow* ctrl,
+ const wxString& label,
+ int index ) const;
+ virtual void DeleteItem( wxWindow* ctrl, int index ) const;
+ virtual bool CanContainCustomImage() const;
+
+ // CreateControls calls this with CB_READONLY in extraStyle
+ wxWindow* CreateControlsBase( wxPropertyGrid* propgrid,
+ wxPGProperty* property,
+ const wxPoint& pos,
+ const wxSize& sz,
+ long extraStyle ) const;
+
+};
+
+
+class WXDLLIMPEXP_PROPGRID wxPGComboBoxEditor : public wxPGChoiceEditor
+{
+ DECLARE_DYNAMIC_CLASS(wxPGComboBoxEditor)
+public:
+ wxPGComboBoxEditor() {}
+ virtual ~wxPGComboBoxEditor();
+
+ virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid,
+ wxPGProperty* property,
+ const wxPoint& pos,
+ const wxSize& size) const;
+
+ virtual wxString GetName() const;
+
+ virtual void UpdateControl( wxPGProperty* property, wxWindow* ctrl ) const;
+
+ virtual bool OnEvent( wxPropertyGrid* propgrid, wxPGProperty* property,
+ wxWindow* ctrl, wxEvent& event ) const;
+
+ virtual bool GetValueFromControl( wxVariant& variant,
+ wxPGProperty* property,
+ wxWindow* ctrl ) const;
+
+ virtual void OnFocus( wxPGProperty* property, wxWindow* wnd ) const;
+
+};
+
+
+class WXDLLIMPEXP_PROPGRID wxPGChoiceAndButtonEditor : public wxPGChoiceEditor
+{
+public:
+ wxPGChoiceAndButtonEditor() {}
+ virtual ~wxPGChoiceAndButtonEditor();
+ virtual wxString GetName() const;
+
+ virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid,
+ wxPGProperty* property,
+ const wxPoint& pos,
+ const wxSize& size) const;
+
+ DECLARE_DYNAMIC_CLASS(wxPGChoiceAndButtonEditor)
+};
+
+class WXDLLIMPEXP_PROPGRID
+wxPGTextCtrlAndButtonEditor : public wxPGTextCtrlEditor
+{
+public:
+ wxPGTextCtrlAndButtonEditor() {}
+ virtual ~wxPGTextCtrlAndButtonEditor();
+ virtual wxString GetName() const;
+
+ virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid,
+ wxPGProperty* property,
+ const wxPoint& pos,
+ const wxSize& size) const;
+
+ DECLARE_DYNAMIC_CLASS(wxPGTextCtrlAndButtonEditor)
+};
+
+
+#if wxPG_INCLUDE_CHECKBOX
+
+//
+// Use custom check box code instead of native control
+// for cleaner (ie. more integrated) look.
+//
+class WXDLLIMPEXP_PROPGRID wxPGCheckBoxEditor : public wxPGEditor
+{
+ DECLARE_DYNAMIC_CLASS(wxPGCheckBoxEditor)
+public:
+ wxPGCheckBoxEditor() {}
+ virtual ~wxPGCheckBoxEditor();
+
+ virtual wxString GetName() const;
+ virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid,
+ wxPGProperty* property,
+ const wxPoint& pos,
+ const wxSize& size) const;
+ virtual void UpdateControl( wxPGProperty* property,
+ wxWindow* ctrl ) const;
+ virtual bool OnEvent( wxPropertyGrid* propgrid,
+ wxPGProperty* property,
+ wxWindow* primaryCtrl,
+ wxEvent& event ) const;
+ virtual bool GetValueFromControl( wxVariant& variant,
+ wxPGProperty* property,
+ wxWindow* ctrl ) const;
+ virtual void SetValueToUnspecified( wxPGProperty* property,
+ wxWindow* ctrl ) const;
+
+ virtual void DrawValue( wxDC& dc,
+ const wxRect& rect,
+ wxPGProperty* property,
+ const wxString& text ) const;
+ //virtual wxPGCellRenderer* GetCellRenderer() const;
+
+ virtual void SetControlIntValue( wxPGProperty* property,
+ wxWindow* ctrl,
+ int value ) const;
+};
+
+#endif
+
+
+// -----------------------------------------------------------------------
+// Editor class registeration macro (mostly for internal use)
+
+#define wxPGRegisterEditorClass(EDITOR) \
+ if ( wxPGEditor_##EDITOR == NULL ) \
+ { \
+ wxPGEditor_##EDITOR = wxPropertyGrid::RegisterEditorClass( \
+ new wxPG##EDITOR##Editor ); \
+ }
+
+// -----------------------------------------------------------------------
+
+/** @class wxPGEditorDialogAdapter
+
+ Derive a class from this to adapt an existing editor dialog or function to
+ be used when editor button of a property is pushed.
+
+ You only need to derive class and implement DoShowDialog() to create and
+ show the dialog, and finally submit the value returned by the dialog
+ via SetValue().
+
+ @library{wxpropgrid}
+ @category{propgrid}
+*/
+class WXDLLIMPEXP_PROPGRID wxPGEditorDialogAdapter : public wxObject
+{
+ DECLARE_ABSTRACT_CLASS(wxPGEditorDialogAdapter)
+public:
+ wxPGEditorDialogAdapter()
+ : wxObject()
+ {
+ m_clientData = NULL;
+ }
+
+ virtual ~wxPGEditorDialogAdapter() { }
+
+ bool ShowDialog( wxPropertyGrid* propGrid, wxPGProperty* property );
+
+ virtual bool DoShowDialog( wxPropertyGrid* propGrid,
+ wxPGProperty* property ) = 0;
+
+ void SetValue( wxVariant value )
+ {
+ m_value = value;
+ }
+
+ /**
+ This method is typically only used if deriving class from existing
+ adapter with value conversion purposes.
+ */
+ wxVariant& GetValue() { return m_value; }
+
+ //
+ // This member is public so scripting language bindings
+ // wrapper code can access it freely.
+ void* m_clientData;
+
+private:
+ wxVariant m_value;
+};
+
+// -----------------------------------------------------------------------
+
+
+/** @class wxPGMultiButton
+
+ This class can be used to have multiple buttons in a property editor.
+ You will need to create a new property editor class, override
+ CreateControls, and have it return wxPGMultiButton instance in
+ wxPGWindowList::SetSecondary().
+*/
+class WXDLLIMPEXP_PROPGRID wxPGMultiButton : public wxWindow
+{
+public:
+ wxPGMultiButton( wxPropertyGrid* pg, const wxSize& sz );
+ virtual ~wxPGMultiButton() {}
+
+ wxWindow* GetButton( unsigned int i ) { return (wxWindow*) m_buttons[i]; }
+ const wxWindow* GetButton( unsigned int i ) const
+ { return (const wxWindow*) m_buttons[i]; }
+
+ /** Utility function to be used in event handlers.
+ */
+ int GetButtonId( unsigned int i ) const { return GetButton(i)->GetId(); }
+
+ /** Returns number of buttons.
+ */
+ unsigned int GetCount() const { return (unsigned int) m_buttons.size(); }
+
+ void Add( const wxString& label, int id = -2 );
+#if wxUSE_BMPBUTTON
+ void Add( const wxBitmap& bitmap, int id = -2 );
+#endif
+
+ wxSize GetPrimarySize() const
+ {
+ return wxSize(m_fullEditorSize.x - m_buttonsWidth, m_fullEditorSize.y);
+ }
+
+ void Finalize( wxPropertyGrid* propGrid, const wxPoint& pos );
+
+protected:
+
+ void DoAddButton( wxWindow* button, const wxSize& sz );
+
+ int GenId( int id ) const;
+
+ wxArrayPtrVoid m_buttons;
+ wxSize m_fullEditorSize;
+ int m_buttonsWidth;
+};
+
+// -----------------------------------------------------------------------
+
+#endif // wxUSE_PROPGRID
+
+#endif // _WX_PROPGRID_EDITORS_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/propgrid/manager.h
+// Purpose: wxPropertyGridManager
+// Author: Jaakko Salli
+// Modified by:
+// Created: 2005-01-14
+// Copyright: (c) Jaakko Salli
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PROPGRID_MANAGER_H_
+#define _WX_PROPGRID_MANAGER_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_PROPGRID
+
+#include "wx/propgrid/propgrid.h"
+
+#include "wx/dcclient.h"
+#include "wx/scrolwin.h"
+#include "wx/toolbar.h"
+#include "wx/stattext.h"
+#include "wx/button.h"
+#include "wx/textctrl.h"
+#include "wx/dialog.h"
+#include "wx/headerctrl.h"
+
+// -----------------------------------------------------------------------
+
+#ifndef SWIG
+extern WXDLLIMPEXP_DATA_PROPGRID(const char) wxPropertyGridManagerNameStr[];
+#endif
+
+/** @class wxPropertyGridPage
+
+ Holder of property grid page information. You can subclass this and
+ give instance in wxPropertyGridManager::AddPage. It inherits from
+ wxEvtHandler and can be used to process events specific to this
+ page (id of events will still be same as manager's). If you don't
+ want to use it to process all events of the page, you need to
+ return false in the derived wxPropertyGridPage::IsHandlingAllEvents.
+
+ Please note that wxPropertyGridPage lacks many non-const property
+ manipulation functions found in wxPropertyGridManager. Please use
+ parent manager (m_manager member variable) when needed.
+
+ Please note that most member functions are inherited and as such not
+ documented on this page. This means you will probably also want to read
+ wxPropertyGridInterface class reference.
+
+ @section propgridpage_event_handling Event Handling
+
+ wxPropertyGridPage receives events emitted by its wxPropertyGridManager, but
+ only those events that are specific to that page. If
+ wxPropertyGridPage::IsHandlingAllEvents returns false, then unhandled
+ events are sent to the manager's parent, as usual.
+
+ See @ref propgrid_event_handling "wxPropertyGrid Event Handling"
+ for more information.
+
+ @library{wxpropgrid}
+ @category{propgrid}
+*/
+class WXDLLIMPEXP_PROPGRID wxPropertyGridPage : public wxEvtHandler,
+ public wxPropertyGridInterface,
+ public wxPropertyGridPageState
+{
+ friend class wxPropertyGridManager;
+ DECLARE_CLASS(wxPropertyGridPage)
+public:
+
+ wxPropertyGridPage();
+ virtual ~wxPropertyGridPage();
+
+ /** Deletes all properties on page.
+ */
+ virtual void Clear();
+
+ /**
+ Reduces column sizes to minimum possible that contents are still
+ visibly (naturally some margin space will be applied as well).
+
+ @return
+ Minimum size for the page to still display everything.
+
+ @remarks
+ This function only works properly if size of containing grid was
+ already fairly large.
+
+ Note that you can also get calculated column widths by calling
+ GetColumnWidth() immediately after this function returns.
+ */
+ wxSize FitColumns();
+
+ /** Returns page index in manager;
+ */
+ inline int GetIndex() const;
+
+ /** Returns x-coordinate position of splitter on a page.
+ */
+ int GetSplitterPosition( int col = 0 ) const
+ { return GetStatePtr()->DoGetSplitterPosition(col); }
+
+ /** Returns "root property". It does not have name, etc. and it is not
+ visible. It is only useful for accessing its children.
+ */
+ wxPGProperty* GetRoot() const { return GetStatePtr()->DoGetRoot(); }
+
+ /** Return pointer to contained property grid state.
+ */
+ wxPropertyGridPageState* GetStatePtr()
+ {
+ return this;
+ }
+
+ /** Return pointer to contained property grid state.
+ */
+ const wxPropertyGridPageState* GetStatePtr() const
+ {
+ return this;
+ }
+
+ /**
+ Returns id of the tool bar item that represents this page on
+ wxPropertyGridManager's wxToolBar.
+ */
+ int GetToolId() const
+ {
+ return m_toolId;
+ }
+
+ /** Do any member initialization in this method.
+ @remarks
+ - Called every time the page is added into a manager.
+ - You can add properties to the page here.
+ */
+ virtual void Init() {}
+
+ /** Return false here to indicate unhandled events should be
+ propagated to manager's parent, as normal.
+ */
+ virtual bool IsHandlingAllEvents() const { return true; }
+
+ /** Called every time page is about to be shown.
+ Useful, for instance, creating properties just-in-time.
+ */
+ virtual void OnShow();
+
+ virtual void RefreshProperty( wxPGProperty* p );
+
+ /** Sets splitter position on page.
+ @remarks
+ Splitter position cannot exceed grid size, and therefore setting it
+ during form creation may fail as initial grid size is often smaller
+ than desired splitter position, especially when sizers are being used.
+ */
+ void SetSplitterPosition( int splitterPos, int col = 0 );
+
+protected:
+
+ /** Propagate to other pages.
+ */
+ virtual void DoSetSplitterPosition( int pos,
+ int splitterColumn = 0,
+ int flags = wxPG_SPLITTER_REFRESH );
+
+ /** Page label (may be referred as name in some parts of documentation).
+ Can be set in constructor, or passed in
+ wxPropertyGridManager::AddPage(), but *not* in both.
+ */
+ wxString m_label;
+
+ //virtual bool ProcessEvent( wxEvent& event );
+
+ wxPropertyGridManager* m_manager;
+
+ // Toolbar tool id. Note that this is only valid when the tool bar
+ // exists.
+ int m_toolId;
+
+private:
+ bool m_isDefault; // is this base page object?
+
+ DECLARE_EVENT_TABLE()
+};
+
+// -----------------------------------------------------------------------
+
+#if wxUSE_HEADERCTRL
+class wxPGHeaderCtrl;
+#endif
+
+
+/** @class wxPropertyGridManager
+
+ wxPropertyGridManager is an efficient multi-page version of wxPropertyGrid,
+ which can optionally have toolbar for mode and page selection, and help
+ text box.
+ Use window flags to select components to include.
+
+ @section propgridmanager_window_styles_ Window Styles
+
+ See @ref propgrid_window_styles.
+
+ @section propgridmanager_event_handling Event Handling
+
+ See @ref propgrid_event_handling "wxPropertyGrid Event Handling"
+ for more information.
+
+ @library{wxpropgrid}
+ @category{propgrid}
+*/
+class WXDLLIMPEXP_PROPGRID
+ wxPropertyGridManager : public wxPanel, public wxPropertyGridInterface
+{
+ DECLARE_CLASS(wxPropertyGridManager)
+ friend class wxPropertyGridPage;
+public:
+
+#ifndef SWIG
+ /**
+ Two step constructor.
+ Call Create when this constructor is called to build up the
+ wxPropertyGridManager.
+ */
+ wxPropertyGridManager();
+#endif
+
+ /** The default constructor. The styles to be used are styles valid for
+ the wxWindow.
+ @see @link wndflags Additional Window Styles@endlink
+ */
+ wxPropertyGridManager( wxWindow *parent, wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxPGMAN_DEFAULT_STYLE,
+ const wxString& name = wxPropertyGridManagerNameStr );
+
+ /** Destructor */
+ virtual ~wxPropertyGridManager();
+
+ /** Creates new property page. Note that the first page is not created
+ automatically.
+ @param label
+ A label for the page. This may be shown as a toolbar tooltip etc.
+ @param bmp
+ Bitmap image for toolbar. If wxNullBitmap is used, then a built-in
+ default image is used.
+ @param pageObj
+ wxPropertyGridPage instance. Manager will take ownership of this object.
+ NULL indicates that a default page instance should be created.
+
+ @return
+ Returns pointer to created page.
+
+ @remarks
+ If toolbar is used, it is highly recommended that the pages are
+ added when the toolbar is not turned off using window style flag
+ switching.
+ */
+ wxPropertyGridPage* AddPage( const wxString& label = wxEmptyString,
+ const wxBitmap& bmp = wxPG_NULL_BITMAP,
+ wxPropertyGridPage* pageObj = NULL )
+ {
+ return InsertPage(-1, label, bmp, pageObj);
+ }
+
+ /** Deletes all all properties and all pages.
+ */
+ virtual void Clear();
+
+ /** Deletes all properties on given page.
+ */
+ void ClearPage( int page );
+
+ /** Forces updating the value of property from the editor control.
+ Returns true if DoPropertyChanged was actually called.
+ */
+ bool CommitChangesFromEditor( wxUint32 flags = 0 )
+ {
+ return m_pPropGrid->CommitChangesFromEditor(flags);
+ }
+
+ /**
+ Two step creation.
+ Whenever the control is created without any parameters, use Create to
+ actually create it. Don't access the control's public methods before
+ this is called.
+ @see @link wndflags Additional Window Styles@endlink
+ */
+ bool Create( wxWindow *parent, wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxPGMAN_DEFAULT_STYLE,
+ const wxString& name = wxPropertyGridManagerNameStr );
+
+ /**
+ Enables or disables (shows/hides) categories according to parameter
+ enable.
+
+ WARNING: Not tested properly, use at your own risk.
+ */
+ bool EnableCategories( bool enable )
+ {
+ long fl = m_windowStyle | wxPG_HIDE_CATEGORIES;
+ if ( enable ) fl = m_windowStyle & ~(wxPG_HIDE_CATEGORIES);
+ SetWindowStyleFlag(fl);
+ return true;
+ }
+
+ /** Selects page, scrolls and/or expands items to ensure that the
+ given item is visible. Returns true if something was actually done.
+ */
+ bool EnsureVisible( wxPGPropArg id );
+
+ /** Returns number of columns on given page. By the default,
+ returns number of columns on current page. */
+ int GetColumnCount( int page = -1 ) const;
+
+ /** Returns height of the description text box. */
+ int GetDescBoxHeight() const;
+
+ /** Returns pointer to the contained wxPropertyGrid. This does not change
+ after wxPropertyGridManager has been created, so you can safely obtain
+ pointer once and use it for the entire lifetime of the instance.
+ */
+ wxPropertyGrid* GetGrid()
+ {
+ wxASSERT(m_pPropGrid);
+ return m_pPropGrid;
+ };
+
+ const wxPropertyGrid* GetGrid() const
+ {
+ wxASSERT(m_pPropGrid);
+ return (const wxPropertyGrid*)m_pPropGrid;
+ };
+
+ /** Returns iterator class instance.
+ @remarks
+ Calling this method in wxPropertyGridManager causes run-time assertion
+ failure. Please only iterate through individual pages or use
+ CreateVIterator().
+ */
+ wxPropertyGridIterator GetIterator( int flags = wxPG_ITERATE_DEFAULT,
+ wxPGProperty* firstProp = NULL )
+ {
+ wxFAIL_MSG( "Please only iterate through individual pages "
+ "or use CreateVIterator()" );
+ return wxPropertyGridInterface::GetIterator( flags, firstProp );
+ }
+
+ wxPropertyGridConstIterator
+ GetIterator(int flags = wxPG_ITERATE_DEFAULT,
+ wxPGProperty* firstProp = NULL) const
+ {
+ wxFAIL_MSG( "Please only iterate through individual pages "
+ " or use CreateVIterator()" );
+ return wxPropertyGridInterface::GetIterator( flags, firstProp );
+ }
+
+ /** Returns iterator class instance.
+ @remarks
+ Calling this method in wxPropertyGridManager causes run-time assertion
+ failure. Please only iterate through individual pages or use
+ CreateVIterator().
+ */
+ wxPropertyGridIterator GetIterator( int flags, int startPos )
+ {
+ wxFAIL_MSG( "Please only iterate through individual pages "
+ "or use CreateVIterator()" );
+
+ return wxPropertyGridInterface::GetIterator( flags, startPos );
+ }
+
+ wxPropertyGridConstIterator GetIterator( int flags, int startPos ) const
+ {
+ wxFAIL_MSG( "Please only iterate through individual pages "
+ "or use CreateVIterator()" );
+ return wxPropertyGridInterface::GetIterator( flags, startPos );
+ }
+
+ /** Similar to GetIterator, but instead returns wxPGVIterator instance,
+ which can be useful for forward-iterating through arbitrary property
+ containers.
+ */
+ virtual wxPGVIterator GetVIterator( int flags ) const;
+
+ /** Returns currently selected page.
+ */
+ wxPropertyGridPage* GetCurrentPage() const
+ {
+ return GetPage(m_selPage);
+ }
+
+ /** Returns page object for given page index.
+ */
+ wxPropertyGridPage* GetPage( unsigned int ind ) const
+ {
+ return m_arrPages[ind];
+ }
+
+ /** Returns page object for given page name.
+ */
+ wxPropertyGridPage* GetPage( const wxString& name ) const
+ {
+ return GetPage(GetPageByName(name));
+ }
+
+ /**
+ Returns index for a page name.
+
+ If no match is found, wxNOT_FOUND is returned.
+ */
+ int GetPageByName( const wxString& name ) const;
+
+ /** Returns index for a relevant propertygrid state.
+
+ If no match is found, wxNOT_FOUND is returned.
+ */
+ int GetPageByState( const wxPropertyGridPageState* pstate ) const;
+
+protected:
+ /** Returns wxPropertyGridPageState of given page, current page's for -1.
+ */
+ virtual wxPropertyGridPageState* GetPageState( int page ) const;
+
+public:
+ /** Returns number of managed pages. */
+ size_t GetPageCount() const;
+
+ /** Returns name of given page. */
+ const wxString& GetPageName( int index ) const;
+
+ /** Returns "root property" of the given page. It does not have name, etc.
+ and it is not visible. It is only useful for accessing its children.
+ */
+ wxPGProperty* GetPageRoot( int index ) const;
+
+ /** Returns index to currently selected page. */
+ int GetSelectedPage() const { return m_selPage; }
+
+ /** Alias for GetSelection(). */
+ wxPGProperty* GetSelectedProperty() const
+ {
+ return GetSelection();
+ }
+
+ /** Shortcut for GetGrid()->GetSelection(). */
+ wxPGProperty* GetSelection() const
+ {
+ return m_pPropGrid->GetSelection();
+ }
+
+ /** Returns a pointer to the toolbar currently associated with the
+ wxPropertyGridManager (if any). */
+ wxToolBar* GetToolBar() const { return m_pToolbar; }
+
+ /** Creates new property page. Note that the first page is not created
+ automatically.
+ @param index
+ Add to this position. -1 will add as the last item.
+ @param label
+ A label for the page. This may be shown as a toolbar tooltip etc.
+ @param bmp
+ Bitmap image for toolbar. If wxNullBitmap is used, then a built-in
+ default image is used.
+ @param pageObj
+ wxPropertyGridPage instance. Manager will take ownership of this object.
+ If NULL, default page object is constructed.
+
+ @return
+ Returns pointer to created page.
+ */
+ virtual wxPropertyGridPage* InsertPage( int index,
+ const wxString& label,
+ const wxBitmap& bmp = wxNullBitmap,
+ wxPropertyGridPage* pageObj = NULL );
+
+ /**
+ Returns true if any property on any page has been modified by the user.
+ */
+ bool IsAnyModified() const;
+
+ /**
+ Returns true if updating is frozen (ie Freeze() called but not yet
+ Thaw() ).
+ */
+ bool IsFrozen() const { return m_pPropGrid->m_frozen > 0; }
+
+ /**
+ Returns true if any property on given page has been modified by the
+ user.
+ */
+ bool IsPageModified( size_t index ) const;
+
+ /**
+ Returns true if property is selected. Since selection is page
+ based, this function checks every page in the manager.
+ */
+ virtual bool IsPropertySelected( wxPGPropArg id ) const;
+
+ virtual void Refresh( bool eraseBackground = true,
+ const wxRect* rect = (const wxRect*) NULL );
+
+ /** Removes a page.
+ @return
+ Returns false if it was not possible to remove page in question.
+ */
+ virtual bool RemovePage( int page );
+
+ /** Select and displays a given page.
+
+ @param index
+ Index of page being seleced. Can be -1 to select nothing.
+ */
+ void SelectPage( int index );
+
+ /** Select and displays a given page (by label). */
+ void SelectPage( const wxString& label )
+ {
+ int index = GetPageByName(label);
+ wxCHECK_RET( index >= 0, wxT("No page with such name") );
+ SelectPage( index );
+ }
+
+ /** Select and displays a given page. */
+ void SelectPage( wxPropertyGridPage* ptr )
+ {
+ SelectPage( GetPageByState(ptr) );
+ }
+
+ /** Select a property. */
+ bool SelectProperty( wxPGPropArg id, bool focus = false )
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
+ return p->GetParentState()->DoSelectProperty(p, focus);
+ }
+
+ /**
+ Sets a column title. Default title for column 0 is "Property",
+ and "Value" for column 1.
+
+ @remarks If header is not shown yet, then calling this
+ member function will make it visible.
+ */
+ void SetColumnTitle( int idx, const wxString& title );
+
+ /**
+ Sets number of columns on given page (default is current page).
+
+ @remarks If you use header, then you should always use this
+ member function to set the column count, instead of
+ ones present in wxPropertyGrid or wxPropertyGridPage.
+ */
+ void SetColumnCount( int colCount, int page = -1 );
+
+ /** Sets label and text in description box.
+ */
+ void SetDescription( const wxString& label, const wxString& content );
+
+ /** Sets y coordinate of the description box splitter. */
+ void SetDescBoxHeight( int ht, bool refresh = true );
+
+ /** Moves splitter as left as possible, while still allowing all
+ labels to be shown in full.
+ @param subProps
+ If false, will still allow sub-properties (ie. properties which
+ parent is not root or category) to be cropped.
+ @param allPages
+ If true, takes labels on all pages into account.
+ */
+ void SetSplitterLeft( bool subProps = false, bool allPages = true );
+
+ /** Moves splitter as left as possible on an individual page, while still allowing all
+ labels to be shown in full.
+ */
+ void SetPageSplitterLeft(int page, bool subProps = false);
+
+ /**
+ Sets splitter position on individual page.
+
+ @remarks If you use header, then you should always use this
+ member function to set the splitter position, instead of
+ ones present in wxPropertyGrid or wxPropertyGridPage.
+ */
+ void SetPageSplitterPosition( int page, int pos, int column = 0 );
+
+ /**
+ Sets splitter position for all pages.
+
+ @remarks Splitter position cannot exceed grid size, and therefore
+ setting it during form creation may fail as initial grid
+ size is often smaller than desired splitter position,
+ especially when sizers are being used.
+
+ If you use header, then you should always use this
+ member function to set the splitter position, instead of
+ ones present in wxPropertyGrid or wxPropertyGridPage.
+ */
+ void SetSplitterPosition( int pos, int column = 0 );
+
+#if wxUSE_HEADERCTRL
+ /**
+ Show or hide the property grid header control. It is hidden
+ by the default.
+
+ @remarks Grid may look better if you use wxPG_NO_INTERNAL_BORDER
+ window style when showing a header.
+ */
+ void ShowHeader(bool show = true);
+#endif
+
+protected:
+
+ //
+ // Subclassing helpers
+ //
+
+ /**
+ Creates property grid for the manager. Reimplement in derived class to
+ use subclassed wxPropertyGrid. However, if you do this then you
+ must also use the two-step construction (ie. default constructor and
+ Create() instead of constructor with arguments) when creating the
+ manager.
+ */
+ virtual wxPropertyGrid* CreatePropertyGrid() const;
+
+public:
+ virtual void RefreshProperty( wxPGProperty* p );
+
+ //
+ // Overridden functions - no documentation required.
+ //
+
+ void SetId( wxWindowID winid );
+
+ virtual void Freeze();
+ virtual void Thaw();
+ virtual void SetExtraStyle ( long exStyle );
+ virtual bool SetFont ( const wxFont& font );
+ virtual void SetWindowStyleFlag ( long style );
+ virtual bool Reparent( wxWindowBase *newParent );
+
+protected:
+ virtual wxSize DoGetBestSize() const;
+
+ //
+ // Event handlers
+ //
+ void OnMouseMove( wxMouseEvent &event );
+ void OnMouseClick( wxMouseEvent &event );
+ void OnMouseUp( wxMouseEvent &event );
+ void OnMouseEntry( wxMouseEvent &event );
+
+ void OnPaint( wxPaintEvent &event );
+
+ void OnToolbarClick( wxCommandEvent &event );
+ void OnResize( wxSizeEvent& event );
+ void OnPropertyGridSelect( wxPropertyGridEvent& event );
+ void OnPGColDrag( wxPropertyGridEvent& event );
+
+
+ wxPropertyGrid* m_pPropGrid;
+
+ wxVector<wxPropertyGridPage*> m_arrPages;
+
+#if wxUSE_TOOLBAR
+ wxToolBar* m_pToolbar;
+#endif
+#if wxUSE_HEADERCTRL
+ wxPGHeaderCtrl* m_pHeaderCtrl;
+#endif
+ wxStaticText* m_pTxtHelpCaption;
+ wxStaticText* m_pTxtHelpContent;
+
+ wxPropertyGridPage* m_emptyPage;
+
+ wxArrayString m_columnLabels;
+
+ long m_iFlags;
+
+ // Selected page index.
+ int m_selPage;
+
+ int m_width;
+
+ int m_height;
+
+ int m_extraHeight;
+
+ int m_splitterY;
+
+ int m_splitterHeight;
+
+ int m_dragOffset;
+
+ wxCursor m_cursorSizeNS;
+
+ int m_nextDescBoxSize;
+
+ // Toolbar tool ids for categorized and alphabetic mode selectors.
+ int m_categorizedModeToolId;
+ int m_alphabeticModeToolId;
+
+ unsigned char m_dragStatus;
+
+ unsigned char m_onSplitter;
+
+ bool m_showHeader;
+
+ virtual wxPGProperty* DoGetPropertyByName( const wxString& name ) const;
+
+ /** Select and displays a given page. */
+ virtual bool DoSelectPage( int index );
+
+ // Sets some members to defaults.
+ void Init1();
+
+ // Initializes some members.
+ void Init2( int style );
+
+/*#ifdef __WXMSW__
+ virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const;
+#endif*/
+
+ virtual bool ProcessEvent( wxEvent& event );
+
+ /** Recalculates new positions for components, according to the
+ given size.
+ */
+ void RecalculatePositions( int width, int height );
+
+ /** (Re)creates/destroys controls, according to the window style bits. */
+ void RecreateControls();
+
+ void UpdateDescriptionBox( int new_splittery, int new_width, int new_height );
+
+ void RepaintDescBoxDecorations( wxDC& dc,
+ int newSplitterY,
+ int newWidth,
+ int newHeight );
+
+ void SetDescribedProperty( wxPGProperty* p );
+
+ // Reimplement these to handle "descboxheight" state item
+ virtual bool SetEditableStateItem( const wxString& name, wxVariant value );
+ virtual wxVariant GetEditableStateItem( const wxString& name ) const;
+
+private:
+ DECLARE_EVENT_TABLE()
+};
+
+// -----------------------------------------------------------------------
+
+inline int wxPropertyGridPage::GetIndex() const
+{
+ if ( !m_manager )
+ return wxNOT_FOUND;
+ return m_manager->GetPageByState(this);
+}
+
+// -----------------------------------------------------------------------
+
+#endif // wxUSE_PROPGRID
+
+#endif // _WX_PROPGRID_MANAGER_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/propgrid/property.h
+// Purpose: wxPGProperty and related support classes
+// Author: Jaakko Salli
+// Modified by:
+// Created: 2008-08-23
+// Copyright: (c) Jaakko Salli
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PROPGRID_PROPERTY_H_
+#define _WX_PROPGRID_PROPERTY_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_PROPGRID
+
+#include "wx/propgrid/propgriddefs.h"
+
+// -----------------------------------------------------------------------
+
+#define wxNullProperty ((wxPGProperty*)NULL)
+
+
+/** @class wxPGPaintData
+
+ Contains information relayed to property's OnCustomPaint.
+*/
+struct wxPGPaintData
+{
+ /** wxPropertyGrid. */
+ const wxPropertyGrid* m_parent;
+
+ /**
+ Normally -1, otherwise index to drop-down list item that has to be
+ drawn.
+ */
+ int m_choiceItem;
+
+ /** Set to drawn width in OnCustomPaint (optional). */
+ int m_drawnWidth;
+
+ /**
+ In a measure item call, set this to the height of item at m_choiceItem
+ index.
+ */
+ int m_drawnHeight;
+};
+
+
+// space between vertical sides of a custom image
+#define wxPG_CUSTOM_IMAGE_SPACINGY 1
+
+// space between caption and selection rectangle,
+#define wxPG_CAPRECTXMARGIN 2
+
+// horizontally and vertically
+#define wxPG_CAPRECTYMARGIN 1
+
+
+/** @class wxPGCellRenderer
+
+ Base class for wxPropertyGrid cell renderers.
+*/
+class WXDLLIMPEXP_PROPGRID wxPGCellRenderer : public wxObjectRefData
+{
+public:
+
+ wxPGCellRenderer()
+ : wxObjectRefData() { }
+ virtual ~wxPGCellRenderer() { }
+
+ // Render flags
+ enum
+ {
+ // We are painting selected item
+ Selected = 0x00010000,
+
+ // We are painting item in choice popup
+ ChoicePopup = 0x00020000,
+
+ // We are rendering wxOwnerDrawnComboBox control
+ // (or other owner drawn control, but that is only
+ // officially supported one ATM).
+ Control = 0x00040000,
+
+ // We are painting a disable property
+ Disabled = 0x00080000,
+
+ // We are painting selected, disabled, or similar
+ // item that dictates fore- and background colours,
+ // overriding any cell values.
+ DontUseCellFgCol = 0x00100000,
+ DontUseCellBgCol = 0x00200000,
+ DontUseCellColours = DontUseCellFgCol |
+ DontUseCellBgCol
+ };
+
+ /**
+ Returns @true if rendered something in the foreground (text or
+ bitmap.
+ */
+ virtual bool Render( wxDC& dc,
+ const wxRect& rect,
+ const wxPropertyGrid* propertyGrid,
+ wxPGProperty* property,
+ int column,
+ int item,
+ int flags ) const = 0;
+
+ /** Returns size of the image in front of the editable area.
+ @remarks
+ If property is NULL, then this call is for a custom value. In that case
+ the item is index to wxPropertyGrid's custom values.
+ */
+ virtual wxSize GetImageSize( const wxPGProperty* property,
+ int column,
+ int item ) const;
+
+ /** Paints property category selection rectangle.
+ */
+ virtual void DrawCaptionSelectionRect( wxDC& dc,
+ int x, int y,
+ int w, int h ) const;
+
+ /** Utility to draw vertically centered text.
+ */
+ void DrawText( wxDC& dc,
+ const wxRect& rect,
+ int imageWidth,
+ const wxString& text ) const;
+
+ /**
+ Utility to draw editor's value, or vertically aligned text if editor is
+ NULL.
+ */
+ void DrawEditorValue( wxDC& dc, const wxRect& rect,
+ int xOffset, const wxString& text,
+ wxPGProperty* property,
+ const wxPGEditor* editor ) const;
+
+ /** Utility to render cell bitmap and set text colour plus bg brush
+ colour.
+
+ @return Returns image width, which, for instance, can be passed to
+ DrawText.
+ */
+ int PreDrawCell( wxDC& dc,
+ const wxRect& rect,
+ const wxPGCell& cell,
+ int flags ) const;
+
+ /**
+ Utility to be called after drawing is done, to revert whatever
+ changes PreDrawCell() did.
+
+ @param flags
+ Same as those passed to PreDrawCell().
+ */
+ void PostDrawCell( wxDC& dc,
+ const wxPropertyGrid* propGrid,
+ const wxPGCell& cell,
+ int flags ) const;
+};
+
+
+/**
+ @class wxPGDefaultRenderer
+
+ Default cell renderer, that can handles the common
+ scenarios.
+*/
+class WXDLLIMPEXP_PROPGRID wxPGDefaultRenderer : public wxPGCellRenderer
+{
+public:
+ virtual bool Render( wxDC& dc,
+ const wxRect& rect,
+ const wxPropertyGrid* propertyGrid,
+ wxPGProperty* property,
+ int column,
+ int item,
+ int flags ) const;
+
+ virtual wxSize GetImageSize( const wxPGProperty* property,
+ int column,
+ int item ) const;
+
+protected:
+};
+
+
+class WXDLLIMPEXP_PROPGRID wxPGCellData : public wxObjectRefData
+{
+ friend class wxPGCell;
+public:
+ wxPGCellData();
+
+ void SetText( const wxString& text )
+ {
+ m_text = text;
+ m_hasValidText = true;
+ }
+ void SetBitmap( const wxBitmap& bitmap ) { m_bitmap = bitmap; }
+ void SetFgCol( const wxColour& col ) { m_fgCol = col; }
+ void SetBgCol( const wxColour& col ) { m_bgCol = col; }
+ void SetFont( const wxFont& font ) { m_font = font; }
+
+protected:
+ virtual ~wxPGCellData() { }
+
+ wxString m_text;
+ wxBitmap m_bitmap;
+ wxColour m_fgCol;
+ wxColour m_bgCol;
+ wxFont m_font;
+
+ // True if m_text is valid and specified
+ bool m_hasValidText;
+};
+
+
+/**
+ @class wxPGCell
+
+ Base class for wxPropertyGrid cell information.
+*/
+class WXDLLIMPEXP_PROPGRID wxPGCell : public wxObject
+{
+public:
+ wxPGCell();
+ wxPGCell(const wxPGCell& other)
+ : wxObject(other)
+ {
+ }
+
+ wxPGCell( const wxString& text,
+ const wxBitmap& bitmap = wxNullBitmap,
+ const wxColour& fgCol = wxNullColour,
+ const wxColour& bgCol = wxNullColour );
+
+ virtual ~wxPGCell() { }
+
+ wxPGCellData* GetData()
+ {
+ return (wxPGCellData*) m_refData;
+ }
+
+ const wxPGCellData* GetData() const
+ {
+ return (const wxPGCellData*) m_refData;
+ }
+
+ bool HasText() const
+ {
+ return (m_refData && GetData()->m_hasValidText);
+ }
+
+ /**
+ Sets empty but valid data to this cell object.
+ */
+ void SetEmptyData();
+
+ /**
+ Merges valid data from srcCell into this.
+ */
+ void MergeFrom( const wxPGCell& srcCell );
+
+ void SetText( const wxString& text );
+ void SetBitmap( const wxBitmap& bitmap );
+ void SetFgCol( const wxColour& col );
+
+ /**
+ Sets font of the cell.
+
+ @remarks Because wxPropertyGrid does not support rows of
+ different height, it makes little sense to change
+ size of the font. Therefore it is recommended
+ to use return value of wxPropertyGrid::GetFont()
+ or wxPropertyGrid::GetCaptionFont() as a basis
+ for the font that, after modifications, is passed
+ to this member function.
+ */
+ void SetFont( const wxFont& font );
+
+ void SetBgCol( const wxColour& col );
+
+ const wxString& GetText() const { return GetData()->m_text; }
+ const wxBitmap& GetBitmap() const { return GetData()->m_bitmap; }
+ const wxColour& GetFgCol() const { return GetData()->m_fgCol; }
+
+ /**
+ Returns font of the cell. If no specific font is set for this
+ cell, then the font will be invalid.
+ */
+ const wxFont& GetFont() const { return GetData()->m_font; }
+
+ const wxColour& GetBgCol() const { return GetData()->m_bgCol; }
+
+ wxPGCell& operator=( const wxPGCell& other )
+ {
+ if ( this != &other )
+ {
+ Ref(other);
+ }
+ return *this;
+ }
+
+ // Used mostly internally to figure out if this cell is supposed
+ // to have default values when attached to a grid.
+ bool IsInvalid() const
+ {
+ return ( m_refData == NULL );
+ }
+
+private:
+ virtual wxObjectRefData *CreateRefData() const
+ { return new wxPGCellData(); }
+
+ virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
+};
+
+// -----------------------------------------------------------------------
+
+/** @class wxPGAttributeStorage
+
+ wxPGAttributeStorage is somewhat optimized storage for
+ key=variant pairs (ie. a map).
+*/
+class WXDLLIMPEXP_PROPGRID wxPGAttributeStorage
+{
+public:
+ wxPGAttributeStorage();
+ ~wxPGAttributeStorage();
+
+ void Set( const wxString& name, const wxVariant& value );
+ unsigned int GetCount() const { return (unsigned int) m_map.size(); }
+ wxVariant FindValue( const wxString& name ) const
+ {
+ wxPGHashMapS2P::const_iterator it = m_map.find(name);
+ if ( it != m_map.end() )
+ {
+ wxVariantData* data = (wxVariantData*) it->second;
+ data->IncRef();
+ return wxVariant(data, it->first);
+ }
+ return wxVariant();
+ }
+
+ typedef wxPGHashMapS2P::const_iterator const_iterator;
+ const_iterator StartIteration() const
+ {
+ return m_map.begin();
+ }
+ bool GetNext( const_iterator& it, wxVariant& variant ) const
+ {
+ if ( it == m_map.end() )
+ return false;
+
+ wxVariantData* data = (wxVariantData*) it->second;
+ data->IncRef();
+ variant.SetData(data);
+ variant.SetName(it->first);
+ ++it;
+ return true;
+ }
+
+protected:
+ wxPGHashMapS2P m_map;
+};
+
+
+// -----------------------------------------------------------------------
+
+/** @section propgrid_propflags wxPGProperty Flags
+ @{
+*/
+
+enum wxPGPropertyFlags
+{
+
+/** Indicates bold font.
+*/
+wxPG_PROP_MODIFIED = 0x0001,
+
+/** Disables ('greyed' text and editor does not activate) property.
+*/
+wxPG_PROP_DISABLED = 0x0002,
+
+/** Hider button will hide this property.
+*/
+wxPG_PROP_HIDDEN = 0x0004,
+
+/** This property has custom paint image just in front of its value.
+ If property only draws custom images into a popup list, then this
+ flag should not be set.
+*/
+wxPG_PROP_CUSTOMIMAGE = 0x0008,
+
+/** Do not create text based editor for this property (but button-triggered
+ dialog and choice are ok).
+*/
+wxPG_PROP_NOEDITOR = 0x0010,
+
+/** Property is collapsed, ie. it's children are hidden.
+*/
+wxPG_PROP_COLLAPSED = 0x0020,
+
+/**
+ If property is selected, then indicates that validation failed for pending
+ value.
+
+ If property is not selected, that indicates that the actual property
+ value has failed validation (NB: this behaviour is not currently supported,
+ but may be used in future).
+*/
+wxPG_PROP_INVALID_VALUE = 0x0040,
+
+// 0x0080,
+
+/** Switched via SetWasModified(). Temporary flag - only used when
+ setting/changing property value.
+*/
+wxPG_PROP_WAS_MODIFIED = 0x0200,
+
+/**
+ If set, then child properties (if any) are private, and should be
+ "invisible" to the application.
+*/
+wxPG_PROP_AGGREGATE = 0x0400,
+
+/** If set, then child properties (if any) are copies and should not
+ be deleted in dtor.
+*/
+wxPG_PROP_CHILDREN_ARE_COPIES = 0x0800,
+
+/**
+ Classifies this item as a non-category.
+
+ Used for faster item type identification.
+*/
+wxPG_PROP_PROPERTY = 0x1000,
+
+/**
+ Classifies this item as a category.
+
+ Used for faster item type identification.
+*/
+wxPG_PROP_CATEGORY = 0x2000,
+
+/** Classifies this item as a property that has children, but is not aggregate
+ (ie children are not private).
+*/
+wxPG_PROP_MISC_PARENT = 0x4000,
+
+/** Property is read-only. Editor is still created for wxTextCtrl-based
+ property editors. For others, editor is not usually created because
+ they do implement wxTE_READONLY style or equivalent.
+*/
+wxPG_PROP_READONLY = 0x8000,
+
+//
+// NB: FLAGS ABOVE 0x8000 CANNOT BE USED WITH PROPERTY ITERATORS
+//
+
+/** Property's value is composed from values of child properties.
+ @remarks
+ This flag cannot be used with property iterators.
+*/
+wxPG_PROP_COMPOSED_VALUE = 0x00010000,
+
+/** Common value of property is selectable in editor.
+ @remarks
+ This flag cannot be used with property iterators.
+*/
+wxPG_PROP_USES_COMMON_VALUE = 0x00020000,
+
+/** Property can be set to unspecified value via editor.
+ Currently, this applies to following properties:
+ - wxIntProperty, wxUIntProperty, wxFloatProperty, wxEditEnumProperty:
+ Clear the text field
+
+ @remarks
+ This flag cannot be used with property iterators.
+
+ @see wxPGProperty::SetAutoUnspecified()
+*/
+wxPG_PROP_AUTO_UNSPECIFIED = 0x00040000,
+
+/** Indicates the bit useable by derived properties.
+*/
+wxPG_PROP_CLASS_SPECIFIC_1 = 0x00080000,
+
+/** Indicates the bit useable by derived properties.
+*/
+wxPG_PROP_CLASS_SPECIFIC_2 = 0x00100000,
+
+/** Indicates that the property is being deleted and should be ignored.
+*/
+wxPG_PROP_BEING_DELETED = 0x00200000
+
+};
+
+/** Topmost flag.
+*/
+#define wxPG_PROP_MAX wxPG_PROP_AUTO_UNSPECIFIED
+
+/** Property with children must have one of these set, otherwise iterators
+ will not work correctly.
+ Code should automatically take care of this, however.
+*/
+#define wxPG_PROP_PARENTAL_FLAGS \
+ ((wxPGPropertyFlags)(wxPG_PROP_AGGREGATE | \
+ wxPG_PROP_CATEGORY | \
+ wxPG_PROP_MISC_PARENT))
+
+/** @}
+*/
+
+// Combination of flags that can be stored by GetFlagsAsString
+#define wxPG_STRING_STORED_FLAGS \
+ (wxPG_PROP_DISABLED|wxPG_PROP_HIDDEN|wxPG_PROP_NOEDITOR|wxPG_PROP_COLLAPSED)
+
+// -----------------------------------------------------------------------
+
+/**
+ @section propgrid_property_attributes wxPropertyGrid Property Attribute
+ Identifiers.
+
+ wxPGProperty::SetAttribute() and
+ wxPropertyGridInterface::SetPropertyAttribute() accept one of these as
+ attribute name argument.
+
+ You can use strings instead of constants. However, some of these
+ constants are redefined to use cached strings which may reduce
+ your binary size by some amount.
+
+ @{
+*/
+
+/** Set default value for property.
+*/
+#define wxPG_ATTR_DEFAULT_VALUE wxS("DefaultValue")
+
+/** Universal, int or double. Minimum value for numeric properties.
+*/
+#define wxPG_ATTR_MIN wxS("Min")
+
+/** Universal, int or double. Maximum value for numeric properties.
+*/
+#define wxPG_ATTR_MAX wxS("Max")
+
+/** Universal, string. When set, will be shown as text after the displayed
+ text value. Alternatively, if third column is enabled, text will be shown
+ there (for any type of property).
+*/
+#define wxPG_ATTR_UNITS wxS("Units")
+
+/** When set, will be shown as 'greyed' text in property's value cell when
+ the actual displayed value is blank.
+*/
+#define wxPG_ATTR_HINT wxS("Hint")
+
+#if wxPG_COMPATIBILITY_1_4
+/**
+ @deprecated Use "Hint" (wxPG_ATTR_HINT) instead.
+*/
+#define wxPG_ATTR_INLINE_HELP wxS("InlineHelp")
+#endif
+
+/** Universal, wxArrayString. Set to enable auto-completion in any
+ wxTextCtrl-based property editor.
+*/
+#define wxPG_ATTR_AUTOCOMPLETE wxS("AutoComplete")
+
+/** wxBoolProperty and wxFlagsProperty specific. Value type is bool.
+ Default value is False.
+
+ When set to True, bool property will use check box instead of a
+ combo box as its editor control. If you set this attribute
+ for a wxFlagsProperty, it is automatically applied to child
+ bool properties.
+*/
+#define wxPG_BOOL_USE_CHECKBOX wxS("UseCheckbox")
+
+/** wxBoolProperty and wxFlagsProperty specific. Value type is bool.
+ Default value is False.
+
+ Set to True for the bool property to cycle value on double click
+ (instead of showing the popup listbox). If you set this attribute
+ for a wxFlagsProperty, it is automatically applied to child
+ bool properties.
+*/
+#define wxPG_BOOL_USE_DOUBLE_CLICK_CYCLING wxS("UseDClickCycling")
+
+/**
+ wxFloatProperty (and similar) specific, int, default -1.
+
+ Sets the (max) precision used when floating point value is rendered as
+ text. The default -1 means infinite precision.
+*/
+#define wxPG_FLOAT_PRECISION wxS("Precision")
+
+/**
+ The text will be echoed as asterisks (wxTE_PASSWORD will be passed to
+ textctrl etc).
+*/
+#define wxPG_STRING_PASSWORD wxS("Password")
+
+/** Define base used by a wxUIntProperty. Valid constants are
+ wxPG_BASE_OCT, wxPG_BASE_DEC, wxPG_BASE_HEX and wxPG_BASE_HEXL
+ (lowercase characters).
+*/
+#define wxPG_UINT_BASE wxS("Base")
+
+/** Define prefix rendered to wxUIntProperty. Accepted constants
+ wxPG_PREFIX_NONE, wxPG_PREFIX_0x, and wxPG_PREFIX_DOLLAR_SIGN.
+ <b>Note:</b> Only wxPG_PREFIX_NONE works with Decimal and Octal
+ numbers.
+*/
+#define wxPG_UINT_PREFIX wxS("Prefix")
+
+/**
+ wxFileProperty/wxImageFileProperty specific, wxChar*, default is
+ detected/varies.
+ Sets the wildcard used in the triggered wxFileDialog. Format is the same.
+*/
+#define wxPG_FILE_WILDCARD wxS("Wildcard")
+
+/** wxFileProperty/wxImageFileProperty specific, int, default 1.
+ When 0, only the file name is shown (i.e. drive and directory are hidden).
+*/
+#define wxPG_FILE_SHOW_FULL_PATH wxS("ShowFullPath")
+
+/** Specific to wxFileProperty and derived properties, wxString, default empty.
+ If set, then the filename is shown relative to the given path string.
+*/
+#define wxPG_FILE_SHOW_RELATIVE_PATH wxS("ShowRelativePath")
+
+/**
+ Specific to wxFileProperty and derived properties, wxString, default is
+ empty.
+
+ Sets the initial path of where to look for files.
+*/
+#define wxPG_FILE_INITIAL_PATH wxS("InitialPath")
+
+/** Specific to wxFileProperty and derivatives, wxString, default is empty.
+ Sets a specific title for the dir dialog.
+*/
+#define wxPG_FILE_DIALOG_TITLE wxS("DialogTitle")
+
+/** Specific to wxFileProperty and derivatives, long, default is 0.
+ Sets a specific wxFileDialog style for the file dialog.
+*/
+#define wxPG_FILE_DIALOG_STYLE wxS("DialogStyle")
+
+/** Specific to wxDirProperty, wxString, default is empty.
+ Sets a specific message for the dir dialog.
+*/
+#define wxPG_DIR_DIALOG_MESSAGE wxS("DialogMessage")
+
+/**
+ wxArrayStringProperty's string delimiter character. If this is a quotation
+ mark or hyphen, then strings will be quoted instead (with given
+ character).
+
+ Default delimiter is quotation mark.
+*/
+#define wxPG_ARRAY_DELIMITER wxS("Delimiter")
+
+/** Sets displayed date format for wxDateProperty.
+*/
+#define wxPG_DATE_FORMAT wxS("DateFormat")
+
+/** Sets wxDatePickerCtrl window style used with wxDateProperty. Default
+ is wxDP_DEFAULT | wxDP_SHOWCENTURY.
+*/
+#define wxPG_DATE_PICKER_STYLE wxS("PickerStyle")
+
+/** SpinCtrl editor, int or double. How much number changes when button is
+ pressed (or up/down on keyboard).
+*/
+#define wxPG_ATTR_SPINCTRL_STEP wxS("Step")
+
+/** SpinCtrl editor, bool. If true, value wraps at Min/Max.
+*/
+#define wxPG_ATTR_SPINCTRL_WRAP wxS("Wrap")
+
+/**
+ wxMultiChoiceProperty, int.
+ If 0, no user strings allowed. If 1, user strings appear before list
+ strings. If 2, user strings appear after list string.
+*/
+#define wxPG_ATTR_MULTICHOICE_USERSTRINGMODE wxS("UserStringMode")
+
+/**
+ wxColourProperty and its kind, int, default 1.
+
+ Setting this attribute to 0 hides custom colour from property's list of
+ choices.
+*/
+#define wxPG_COLOUR_ALLOW_CUSTOM wxS("AllowCustom")
+
+/**
+ wxColourProperty and its kind: Set to True in order to support editing
+ alpha colour component.
+*/
+#define wxPG_COLOUR_HAS_ALPHA wxS("HasAlpha")
+
+/** @}
+*/
+
+// Redefine attribute macros to use cached strings
+#undef wxPG_ATTR_DEFAULT_VALUE
+#define wxPG_ATTR_DEFAULT_VALUE wxPGGlobalVars->m_strDefaultValue
+#undef wxPG_ATTR_MIN
+#define wxPG_ATTR_MIN wxPGGlobalVars->m_strMin
+#undef wxPG_ATTR_MAX
+#define wxPG_ATTR_MAX wxPGGlobalVars->m_strMax
+#undef wxPG_ATTR_UNITS
+#define wxPG_ATTR_UNITS wxPGGlobalVars->m_strUnits
+#undef wxPG_ATTR_HINT
+#define wxPG_ATTR_HINT wxPGGlobalVars->m_strHint
+#if wxPG_COMPATIBILITY_1_4
+#undef wxPG_ATTR_INLINE_HELP
+#define wxPG_ATTR_INLINE_HELP wxPGGlobalVars->m_strInlineHelp
+#endif
+
+// -----------------------------------------------------------------------
+
+/** @class wxPGChoiceEntry
+ Data of a single wxPGChoices choice.
+*/
+class WXDLLIMPEXP_PROPGRID wxPGChoiceEntry : public wxPGCell
+{
+public:
+ wxPGChoiceEntry();
+ wxPGChoiceEntry(const wxPGChoiceEntry& other)
+ : wxPGCell(other)
+ {
+ m_value = other.m_value;
+ }
+ wxPGChoiceEntry( const wxString& label,
+ int value = wxPG_INVALID_VALUE )
+ : wxPGCell(), m_value(value)
+ {
+ SetText(label);
+ }
+
+ virtual ~wxPGChoiceEntry() { }
+
+ void SetValue( int value ) { m_value = value; }
+ int GetValue() const { return m_value; }
+
+ wxPGChoiceEntry& operator=( const wxPGChoiceEntry& other )
+ {
+ if ( this != &other )
+ {
+ Ref(other);
+ }
+ m_value = other.m_value;
+ return *this;
+ }
+
+protected:
+ int m_value;
+};
+
+
+typedef void* wxPGChoicesId;
+
+class WXDLLIMPEXP_PROPGRID wxPGChoicesData : public wxObjectRefData
+{
+ friend class wxPGChoices;
+public:
+ // Constructor sets m_refCount to 1.
+ wxPGChoicesData();
+
+ void CopyDataFrom( wxPGChoicesData* data );
+
+ wxPGChoiceEntry& Insert( int index, const wxPGChoiceEntry& item );
+
+ // Delete all entries
+ void Clear();
+
+ unsigned int GetCount() const
+ {
+ return (unsigned int) m_items.size();
+ }
+
+ const wxPGChoiceEntry& Item( unsigned int i ) const
+ {
+ wxASSERT_MSG( i < GetCount(), "invalid index" );
+ return m_items[i];
+ }
+
+ wxPGChoiceEntry& Item( unsigned int i )
+ {
+ wxASSERT_MSG( i < GetCount(), "invalid index" );
+ return m_items[i];
+ }
+
+private:
+ wxVector<wxPGChoiceEntry> m_items;
+
+ virtual ~wxPGChoicesData();
+};
+
+#define wxPGChoicesEmptyData ((wxPGChoicesData*)NULL)
+
+
+/** @class wxPGChoices
+
+ Helper class for managing choices of wxPropertyGrid properties.
+ Each entry can have label, value, bitmap, text colour, and background
+ colour.
+
+ wxPGChoices uses reference counting, similar to other wxWidgets classes.
+ This means that assignment operator and copy constructor only copy the
+ reference and not the actual data. Use Copy() member function to create a
+ real copy.
+
+ @remarks If you do not specify value for entry, index is used.
+
+ @library{wxpropgrid}
+ @category{propgrid}
+*/
+class WXDLLIMPEXP_PROPGRID wxPGChoices
+{
+public:
+ typedef long ValArrItem;
+
+ /** Default constructor. */
+ wxPGChoices()
+ {
+ Init();
+ }
+
+ /**
+ Copy constructor, uses reference counting. To create a real copy,
+ use Copy() member function instead.
+ */
+ wxPGChoices( const wxPGChoices& a )
+ {
+ if ( a.m_data != wxPGChoicesEmptyData )
+ {
+ m_data = a.m_data;
+ m_data->IncRef();
+ }
+ }
+
+ /**
+ Constructor.
+
+ @param labels
+ Labels for choices
+
+ @param values
+ Values for choices. If NULL, indexes are used.
+ */
+ wxPGChoices( const wxChar* const* labels, const long* values = NULL )
+ {
+ Init();
+ Set(labels,values);
+ }
+
+ /**
+ Constructor.
+
+ @param labels
+ Labels for choices
+
+ @param values
+ Values for choices. If empty, indexes are used.
+ */
+ wxPGChoices( const wxArrayString& labels,
+ const wxArrayInt& values = wxArrayInt() )
+ {
+ Init();
+ Set(labels,values);
+ }
+
+ /** Simple interface constructor. */
+ wxPGChoices( wxPGChoicesData* data )
+ {
+ wxASSERT(data);
+ m_data = data;
+ data->IncRef();
+ }
+
+ /** Destructor. */
+ ~wxPGChoices()
+ {
+ Free();
+ }
+
+ /**
+ Adds to current.
+
+ If did not have own copies, creates them now. If was empty, identical
+ to set except that creates copies.
+
+ @param labels
+ Labels for added choices.
+
+ @param values
+ Values for added choices. If empty, relevant entry indexes are used.
+ */
+ void Add( const wxChar* const* labels, const ValArrItem* values = NULL );
+
+ /** Version that works with wxArrayString and wxArrayInt. */
+ void Add( const wxArrayString& arr, const wxArrayInt& arrint = wxArrayInt() );
+
+ /**
+ Adds a single choice.
+
+ @param label
+ Label for added choice.
+
+ @param value
+ Value for added choice. If unspecified, index is used.
+ */
+ wxPGChoiceEntry& Add( const wxString& label,
+ int value = wxPG_INVALID_VALUE );
+
+ /** Adds a single item, with bitmap. */
+ wxPGChoiceEntry& Add( const wxString& label,
+ const wxBitmap& bitmap,
+ int value = wxPG_INVALID_VALUE );
+
+ /** Adds a single item with full entry information. */
+ wxPGChoiceEntry& Add( const wxPGChoiceEntry& entry )
+ {
+ return Insert(entry, -1);
+ }
+
+ /** Adds single item. */
+ wxPGChoiceEntry& AddAsSorted( const wxString& label,
+ int value = wxPG_INVALID_VALUE );
+
+ /**
+ Assigns choices data, using reference counting. To create a real copy,
+ use Copy() member function instead.
+ */
+ void Assign( const wxPGChoices& a )
+ {
+ AssignData(a.m_data);
+ }
+
+ void AssignData( wxPGChoicesData* data );
+
+ /** Delete all choices. */
+ void Clear();
+
+ /**
+ Returns a real copy of the choices.
+ */
+ wxPGChoices Copy() const
+ {
+ wxPGChoices dst;
+ dst.EnsureData();
+ dst.m_data->CopyDataFrom(m_data);
+ return dst;
+ }
+
+ void EnsureData()
+ {
+ if ( m_data == wxPGChoicesEmptyData )
+ m_data = new wxPGChoicesData();
+ }
+
+ /** Gets a unsigned number identifying this list. */
+ wxPGChoicesId GetId() const { return (wxPGChoicesId) m_data; }
+
+ const wxString& GetLabel( unsigned int ind ) const
+ {
+ return Item(ind).GetText();
+ }
+
+ unsigned int GetCount () const
+ {
+ if ( !m_data )
+ return 0;
+
+ return m_data->GetCount();
+ }
+
+ int GetValue( unsigned int ind ) const { return Item(ind).GetValue(); }
+
+ /** Returns array of values matching the given strings. Unmatching strings
+ result in wxPG_INVALID_VALUE entry in array.
+ */
+ wxArrayInt GetValuesForStrings( const wxArrayString& strings ) const;
+
+ /** Returns array of indices matching given strings. Unmatching strings
+ are added to 'unmatched', if not NULL.
+ */
+ wxArrayInt GetIndicesForStrings( const wxArrayString& strings,
+ wxArrayString* unmatched = NULL ) const;
+
+ int Index( const wxString& str ) const;
+ int Index( int val ) const;
+
+ /** Inserts single item. */
+ wxPGChoiceEntry& Insert( const wxString& label,
+ int index,
+ int value = wxPG_INVALID_VALUE );
+
+ /** Inserts a single item with full entry information. */
+ wxPGChoiceEntry& Insert( const wxPGChoiceEntry& entry, int index );
+
+ /** Returns false if this is a constant empty set of choices,
+ which should not be modified.
+ */
+ bool IsOk() const
+ {
+ return ( m_data != wxPGChoicesEmptyData );
+ }
+
+ const wxPGChoiceEntry& Item( unsigned int i ) const
+ {
+ wxASSERT( IsOk() );
+ return m_data->Item(i);
+ }
+
+ wxPGChoiceEntry& Item( unsigned int i )
+ {
+ wxASSERT( IsOk() );
+ return m_data->Item(i);
+ }
+
+ /** Removes count items starting at position nIndex. */
+ void RemoveAt(size_t nIndex, size_t count = 1);
+
+ /** Does not create copies for itself.
+ TODO: Deprecate.
+ */
+ void Set( const wxChar* const* labels, const long* values = NULL )
+ {
+ Free();
+ Add(labels,values);
+ }
+
+ /** Version that works with wxArrayString and wxArrayInt. */
+ void Set( const wxArrayString& labels,
+ const wxArrayInt& values = wxArrayInt() )
+ {
+ Free();
+ if ( &values )
+ Add(labels,values);
+ else
+ Add(labels);
+ }
+
+ // Creates exclusive copy of current choices
+ void AllocExclusive();
+
+ // Returns data, increases refcount.
+ wxPGChoicesData* GetData()
+ {
+ wxASSERT( m_data->GetRefCount() != -1 );
+ m_data->IncRef();
+ return m_data;
+ }
+
+ // Returns plain data ptr - no refcounting stuff is done.
+ wxPGChoicesData* GetDataPtr() const { return m_data; }
+
+ // Changes ownership of data to you.
+ wxPGChoicesData* ExtractData()
+ {
+ wxPGChoicesData* data = m_data;
+ m_data = wxPGChoicesEmptyData;
+ return data;
+ }
+
+ wxArrayString GetLabels() const;
+
+ void operator= (const wxPGChoices& a)
+ {
+ if (this != &a)
+ AssignData(a.m_data);
+ }
+
+ wxPGChoiceEntry& operator[](unsigned int i)
+ {
+ return Item(i);
+ }
+
+ const wxPGChoiceEntry& operator[](unsigned int i) const
+ {
+ return Item(i);
+ }
+
+protected:
+ wxPGChoicesData* m_data;
+
+ void Init();
+ void Free();
+};
+
+// -----------------------------------------------------------------------
+
+/** @class wxPGProperty
+
+ wxPGProperty is base class for all wxPropertyGrid properties.
+
+ NB: Full class overview is now only present in
+ interface/wx/propgrid/property.h.
+
+ @library{wxpropgrid}
+ @category{propgrid}
+*/
+class WXDLLIMPEXP_PROPGRID wxPGProperty : public wxObject
+{
+ friend class wxPropertyGrid;
+ friend class wxPropertyGridInterface;
+ friend class wxPropertyGridPageState;
+ friend class wxPropertyGridPopulator;
+ friend class wxStringProperty; // Proper "<composed>" support requires this
+
+ DECLARE_ABSTRACT_CLASS(wxPGProperty)
+public:
+ typedef wxUint32 FlagType;
+
+ /**
+ Default constructor.
+ */
+ wxPGProperty();
+
+ /**
+ Constructor.
+
+ All non-abstract property classes should have a constructor with
+ the same first two arguments as this one.
+ */
+ wxPGProperty( const wxString& label, const wxString& name );
+
+ /**
+ Virtual destructor.
+ It is customary for derived properties to implement this.
+ */
+ virtual ~wxPGProperty();
+
+ /** This virtual function is called after m_value has been set.
+
+ @remarks
+ - If m_value was set to Null variant (ie. unspecified value),
+ OnSetValue() will not be called.
+ - m_value may be of any variant type. Typically properties internally
+ support only one variant type, and as such OnSetValue() provides a
+ good opportunity to convert
+ supported values into internal type.
+ - Default implementation does nothing.
+ */
+ virtual void OnSetValue();
+
+ /** Override this to return something else than m_value as the value.
+ */
+ virtual wxVariant DoGetValue() const { return m_value; }
+
+ /** Implement this function in derived class to check the value.
+ Return true if it is ok. Returning false prevents property change events
+ from occurring.
+
+ @remarks
+ - Default implementation always returns true.
+ */
+ virtual bool ValidateValue( wxVariant& value,
+ wxPGValidationInfo& validationInfo ) const;
+
+ /**
+ Converts text into wxVariant value appropriate for this property.
+
+ @param variant
+ On function entry this is the old value (should not be wxNullVariant
+ in normal cases). Translated value must be assigned back to it.
+
+ @param text
+ Text to be translated into variant.
+
+ @param argFlags
+ If wxPG_FULL_VALUE is set, returns complete, storable value instead
+ of displayable one (they may be different).
+ If wxPG_COMPOSITE_FRAGMENT is set, text is interpreted as a part of
+ composite property string value (as generated by ValueToString()
+ called with this same flag).
+
+ @return Returns @true if resulting wxVariant value was different.
+
+ @remarks Default implementation converts semicolon delimited tokens into
+ child values. Only works for properties with children.
+
+ You might want to take into account that m_value is Null variant
+ if property value is unspecified (which is usually only case if
+ you explicitly enabled that sort behaviour).
+ */
+ virtual bool StringToValue( wxVariant& variant,
+ const wxString& text,
+ int argFlags = 0 ) const;
+
+ /**
+ Converts integer (possibly a choice selection) into wxVariant value
+ appropriate for this property.
+
+ @param variant
+ On function entry this is the old value (should not be wxNullVariant
+ in normal cases). Translated value must be assigned back to it.
+
+ @param number
+ Integer to be translated into variant.
+
+ @param argFlags
+ If wxPG_FULL_VALUE is set, returns complete, storable value instead
+ of displayable one.
+
+ @return Returns @true if resulting wxVariant value was different.
+
+ @remarks
+ - If property is not supposed to use choice or spinctrl or other editor
+ with int-based value, it is not necessary to implement this method.
+ - Default implementation simply assign given int to m_value.
+ - If property uses choice control, and displays a dialog on some choice
+ items, then it is preferred to display that dialog in IntToValue
+ instead of OnEvent.
+ - You might want to take into account that m_value is Null variant if
+ property value is unspecified (which is usually only case if you
+ explicitly enabled that sort behaviour).
+ */
+ virtual bool IntToValue( wxVariant& value,
+ int number,
+ int argFlags = 0 ) const;
+
+ /**
+ Converts property value into a text representation.
+
+ @param value
+ Value to be converted.
+
+ @param argFlags
+ If 0 (default value), then displayed string is returned.
+ If wxPG_FULL_VALUE is set, returns complete, storable string value
+ instead of displayable. If wxPG_EDITABLE_VALUE is set, returns
+ string value that must be editable in textctrl. If
+ wxPG_COMPOSITE_FRAGMENT is set, returns text that is appropriate to
+ display as a part of string property's composite text
+ representation.
+
+ @remarks Default implementation calls GenerateComposedValue().
+ */
+ virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+
+ /** Converts string to a value, and if successful, calls SetValue() on it.
+ Default behaviour is to do nothing.
+ @param text
+ String to get the value from.
+ @return
+ true if value was changed.
+ */
+ bool SetValueFromString( const wxString& text, int flags = wxPG_PROGRAMMATIC_VALUE );
+
+ /** Converts integer to a value, and if successful, calls SetValue() on it.
+ Default behaviour is to do nothing.
+ @param value
+ Int to get the value from.
+ @param flags
+ If has wxPG_FULL_VALUE, then the value given is a actual value and
+ not an index.
+ @return
+ True if value was changed.
+ */
+ bool SetValueFromInt( long value, int flags = 0 );
+
+ /**
+ Returns size of the custom painted image in front of property.
+
+ This method must be overridden to return non-default value if
+ OnCustomPaint is to be called.
+ @param item
+ Normally -1, but can be an index to the property's list of items.
+ @remarks
+ - Default behaviour is to return wxSize(0,0), which means no image.
+ - Default image width or height is indicated with dimension -1.
+ - You can also return wxPG_DEFAULT_IMAGE_SIZE, i.e. wxSize(-1, -1).
+ */
+ virtual wxSize OnMeasureImage( int item = -1 ) const;
+
+ /**
+ Events received by editor widgets are processed here.
+
+ Note that editor class usually processes most events. Some, such as
+ button press events of TextCtrlAndButton class, can be handled here.
+ Also, if custom handling for regular events is desired, then that can
+ also be done (for example, wxSystemColourProperty custom handles
+ wxEVT_CHOICE to display colour picker dialog when
+ 'custom' selection is made).
+
+ If the event causes value to be changed, SetValueInEvent()
+ should be called to set the new value.
+
+ @param event
+ Associated wxEvent.
+ @return
+ Should return true if any changes in value should be reported.
+ @remarks
+ If property uses choice control, and displays a dialog on some choice
+ items, then it is preferred to display that dialog in IntToValue
+ instead of OnEvent.
+ */
+ virtual bool OnEvent( wxPropertyGrid* propgrid,
+ wxWindow* wnd_primary,
+ wxEvent& event );
+
+ /**
+ Called after value of a child property has been altered. Must return
+ new value of the whole property (after any alterations warranted by
+ child's new value).
+
+ Note that this function is usually called at the time that value of
+ this property, or given child property, is still pending for change,
+ and as such, result of GetValue() or m_value should not be relied
+ on.
+
+ Sample pseudo-code implementation:
+
+ @code
+ wxVariant MyProperty::ChildChanged( wxVariant& thisValue,
+ int childIndex,
+ wxVariant& childValue ) const
+ {
+ // Acquire reference to actual type of data stored in variant
+ // (TFromVariant only exists if wxPropertyGrid's wxVariant-macros
+ // were used to create the variant class).
+ T& data = TFromVariant(thisValue);
+
+ // Copy childValue into data.
+ switch ( childIndex )
+ {
+ case 0:
+ data.SetSubProp1( childvalue.GetLong() );
+ break;
+ case 1:
+ data.SetSubProp2( childvalue.GetString() );
+ break;
+ ...
+ }
+
+ // Return altered data
+ return data;
+ }
+ @endcode
+
+ @param thisValue
+ Value of this property. Changed value should be returned (in
+ previous versions of wxPropertyGrid it was only necessary to
+ write value back to this argument).
+ @param childIndex
+ Index of child changed (you can use Item(childIndex) to get
+ child property).
+ @param childValue
+ (Pending) value of the child property.
+
+ @return
+ Modified value of the whole property.
+ */
+ virtual wxVariant ChildChanged( wxVariant& thisValue,
+ int childIndex,
+ wxVariant& childValue ) const;
+
+ /** Returns pointer to an instance of used editor.
+ */
+ virtual const wxPGEditor* DoGetEditorClass() const;
+
+ /** Returns pointer to the wxValidator that should be used
+ with the editor of this property (NULL for no validator).
+ Setting validator explicitly via SetPropertyValidator
+ will override this.
+
+ In most situations, code like this should work well
+ (macros are used to maintain one actual validator instance,
+ so on the second call the function exits within the first
+ macro):
+
+ @code
+
+ wxValidator* wxMyPropertyClass::DoGetValidator () const
+ {
+ WX_PG_DOGETVALIDATOR_ENTRY()
+
+ wxMyValidator* validator = new wxMyValidator(...);
+
+ ... prepare validator...
+
+ WX_PG_DOGETVALIDATOR_EXIT(validator)
+ }
+
+ @endcode
+
+ @remarks
+ You can get common filename validator by returning
+ wxFileProperty::GetClassValidator(). wxDirProperty,
+ for example, uses it.
+ */
+ virtual wxValidator* DoGetValidator () const;
+
+ /**
+ Override to paint an image in front of the property value text or
+ drop-down list item (but only if wxPGProperty::OnMeasureImage is
+ overridden as well).
+
+ If property's OnMeasureImage() returns size that has height != 0 but
+ less than row height ( < 0 has special meanings), wxPropertyGrid calls
+ this method to draw a custom image in a limited area in front of the
+ editor control or value text/graphics, and if control has drop-down
+ list, then the image is drawn there as well (even in the case
+ OnMeasureImage() returned higher height than row height).
+
+ NOTE: Following applies when OnMeasureImage() returns a "flexible"
+ height ( using wxPG_FLEXIBLE_SIZE(W,H) macro), which implies variable
+ height items: If rect.x is < 0, then this is a measure item call, which
+ means that dc is invalid and only thing that should be done is to set
+ paintdata.m_drawnHeight to the height of the image of item at index
+ paintdata.m_choiceItem. This call may be done even as often as once
+ every drop-down popup show.
+
+ @param dc
+ wxDC to paint on.
+ @param rect
+ Box reserved for custom graphics. Includes surrounding rectangle,
+ if any. If x is < 0, then this is a measure item call (see above).
+ @param paintdata
+ wxPGPaintData structure with much useful data.
+
+ @remarks
+ - You can actually exceed rect width, but if you do so then
+ paintdata.m_drawnWidth must be set to the full width drawn in
+ pixels.
+ - Due to technical reasons, rect's height will be default even if
+ custom height was reported during measure call.
+ - Brush is guaranteed to be default background colour. It has been
+ already used to clear the background of area being painted. It
+ can be modified.
+ - Pen is guaranteed to be 1-wide 'black' (or whatever is the proper
+ colour) pen for drawing framing rectangle. It can be changed as
+ well.
+
+ @see ValueToString()
+ */
+ virtual void OnCustomPaint( wxDC& dc,
+ const wxRect& rect,
+ wxPGPaintData& paintdata );
+
+ /**
+ Returns used wxPGCellRenderer instance for given property column
+ (label=0, value=1).
+
+ Default implementation returns editor's renderer for all columns.
+ */
+ virtual wxPGCellRenderer* GetCellRenderer( int column ) const;
+
+ /** Returns which choice is currently selected. Only applies to properties
+ which have choices.
+
+ Needs to reimplemented in derived class if property value does not
+ map directly to a choice. Integer as index, bool, and string usually do.
+ */
+ virtual int GetChoiceSelection() const;
+
+ /**
+ Refresh values of child properties.
+
+ Automatically called after value is set.
+ */
+ virtual void RefreshChildren();
+
+ /**
+ Reimplement this member function to add special handling for
+ attributes of this property.
+
+ @return Return @false to have the attribute automatically stored in
+ m_attributes. Default implementation simply does that and
+ nothing else.
+
+ @remarks To actually set property attribute values from the
+ application, use wxPGProperty::SetAttribute() instead.
+ */
+ virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
+
+ /** Returns value of an attribute.
+
+ Override if custom handling of attributes is needed.
+
+ Default implementation simply return NULL variant.
+ */
+ virtual wxVariant DoGetAttribute( const wxString& name ) const;
+
+ /** Returns instance of a new wxPGEditorDialogAdapter instance, which is
+ used when user presses the (optional) button next to the editor control;
+
+ Default implementation returns NULL (ie. no action is generated when
+ button is pressed).
+ */
+ virtual wxPGEditorDialogAdapter* GetEditorDialog() const;
+
+ /**
+ Called whenever validation has failed with given pending value.
+
+ @remarks If you implement this in your custom property class, please
+ remember to call the baser implementation as well, since they
+ may use it to revert property into pre-change state.
+ */
+ virtual void OnValidationFailure( wxVariant& pendingValue );
+
+ /** Append a new choice to property's list of choices.
+ */
+ int AddChoice( const wxString& label, int value = wxPG_INVALID_VALUE )
+ {
+ return InsertChoice(label, wxNOT_FOUND, value);
+ }
+
+ /**
+ Returns true if children of this property are component values (for
+ instance, points size, face name, and is_underlined are component
+ values of a font).
+ */
+ bool AreChildrenComponents() const
+ {
+ if ( m_flags & (wxPG_PROP_COMPOSED_VALUE|wxPG_PROP_AGGREGATE) )
+ return true;
+
+ return false;
+ }
+
+ /**
+ Deletes children of the property.
+ */
+ void DeleteChildren();
+
+ /**
+ Removes entry from property's wxPGChoices and editor control (if it is
+ active).
+
+ If selected item is deleted, then the value is set to unspecified.
+ */
+ void DeleteChoice( int index );
+
+ /**
+ Enables or disables the property. Disabled property usually appears
+ as having grey text.
+
+ @param enable
+ If @false, property is disabled instead.
+
+ @see wxPropertyGridInterface::EnableProperty()
+ */
+ void Enable( bool enable = true );
+
+ /**
+ Call to enable or disable usage of common value (integer value that can
+ be selected for properties instead of their normal values) for this
+ property.
+
+ Common values are disabled by the default for all properties.
+ */
+ void EnableCommonValue( bool enable = true )
+ {
+ if ( enable ) SetFlag( wxPG_PROP_USES_COMMON_VALUE );
+ else ClearFlag( wxPG_PROP_USES_COMMON_VALUE );
+ }
+
+ /**
+ Composes text from values of child properties.
+ */
+ wxString GenerateComposedValue() const
+ {
+ wxString s;
+ DoGenerateComposedValue(s);
+ return s;
+ }
+
+ /** Returns property's label. */
+ const wxString& GetLabel() const { return m_label; }
+
+ /** Returns property's name with all (non-category, non-root) parents. */
+ wxString GetName() const;
+
+ /**
+ Returns property's base name (ie parent's name is not added in any
+ case)
+ */
+ const wxString& GetBaseName() const { return m_name; }
+
+ /** Returns read-only reference to property's list of choices.
+ */
+ const wxPGChoices& GetChoices() const
+ {
+ return m_choices;
+ }
+
+ /** Returns coordinate to the top y of the property. Note that the
+ position of scrollbars is not taken into account.
+ */
+ int GetY() const;
+
+ wxVariant GetValue() const
+ {
+ return DoGetValue();
+ }
+
+ /** Returns reference to the internal stored value. GetValue is preferred
+ way to get the actual value, since GetValueRef ignores DoGetValue,
+ which may override stored value.
+ */
+ wxVariant& GetValueRef()
+ {
+ return m_value;
+ }
+
+ const wxVariant& GetValueRef() const
+ {
+ return m_value;
+ }
+
+ // Helper function (for wxPython bindings and such) for settings protected
+ // m_value.
+ wxVariant GetValuePlain() const
+ {
+ return m_value;
+ }
+
+ /** Returns text representation of property's value.
+
+ @param argFlags
+ If 0 (default value), then displayed string is returned.
+ If wxPG_FULL_VALUE is set, returns complete, storable string value
+ instead of displayable. If wxPG_EDITABLE_VALUE is set, returns
+ string value that must be editable in textctrl. If
+ wxPG_COMPOSITE_FRAGMENT is set, returns text that is appropriate to
+ display as a part of string property's composite text
+ representation.
+
+ @remarks In older versions, this function used to be overridden to convert
+ property's value into a string representation. This function is
+ now handled by ValueToString(), and overriding this function now
+ will result in run-time assertion failure.
+ */
+ virtual wxString GetValueAsString( int argFlags = 0 ) const;
+
+ /** Synonymous to GetValueAsString().
+
+ @deprecated Use GetValueAsString() instead.
+
+ @see GetValueAsString()
+ */
+ wxDEPRECATED( wxString GetValueString( int argFlags = 0 ) const );
+
+ /**
+ Returns wxPGCell of given column.
+
+ @remarks const version of this member function returns 'default'
+ wxPGCell object if the property itself didn't hold
+ cell data.
+ */
+ const wxPGCell& GetCell( unsigned int column ) const;
+
+ /**
+ Returns wxPGCell of given column, creating one if necessary.
+ */
+ wxPGCell& GetCell( unsigned int column )
+ {
+ return GetOrCreateCell(column);
+ }
+
+ /**
+ Returns wxPGCell of given column, creating one if necessary.
+ */
+ wxPGCell& GetOrCreateCell( unsigned int column );
+
+ /** Return number of displayed common values for this property.
+ */
+ int GetDisplayedCommonValueCount() const;
+
+ wxString GetDisplayedString() const
+ {
+ return GetValueAsString(0);
+ }
+
+ /**
+ Returns property's hint text (shown in empty value cell).
+ */
+ inline wxString GetHintText() const;
+
+ /** Returns property grid where property lies. */
+ wxPropertyGrid* GetGrid() const;
+
+ /** Returns owner wxPropertyGrid, but only if one is currently on a page
+ displaying this property. */
+ wxPropertyGrid* GetGridIfDisplayed() const;
+
+ /** Returns highest level non-category, non-root parent. Useful when you
+ have nested wxCustomProperties/wxParentProperties.
+ @remarks
+ Thus, if immediate parent is root or category, this will return the
+ property itself.
+ */
+ wxPGProperty* GetMainParent() const;
+
+ /** Return parent of property */
+ wxPGProperty* GetParent() const { return m_parent; }
+
+ /** Returns true if property has editable wxTextCtrl when selected.
+
+ @remarks
+ Although disabled properties do not displayed editor, they still
+ return True here as being disabled is considered a temporary
+ condition (unlike being read-only or having limited editing enabled).
+ */
+ bool IsTextEditable() const;
+
+ bool IsValueUnspecified() const
+ {
+ return m_value.IsNull();
+ }
+
+ /**
+ Returns non-zero if property has given flag set.
+
+ @see propgrid_propflags
+ */
+ FlagType HasFlag( wxPGPropertyFlags flag ) const
+ {
+ return ( m_flags & flag );
+ }
+
+ /** Returns comma-delimited string of property attributes.
+ */
+ const wxPGAttributeStorage& GetAttributes() const
+ {
+ return m_attributes;
+ }
+
+ /** Returns m_attributes as list wxVariant.
+ */
+ wxVariant GetAttributesAsList() const;
+
+ /**
+ Returns property flags.
+ */
+ FlagType GetFlags() const
+ {
+ return m_flags;
+ }
+
+ const wxPGEditor* GetEditorClass() const;
+
+ wxString GetValueType() const
+ {
+ return m_value.GetType();
+ }
+
+ /** Returns editor used for given column. NULL for no editor.
+ */
+ const wxPGEditor* GetColumnEditor( int column ) const
+ {
+ if ( column == 1 )
+ return GetEditorClass();
+
+ return NULL;
+ }
+
+ /** Returns common value selected for this property. -1 for none.
+ */
+ int GetCommonValue() const
+ {
+ return m_commonValue;
+ }
+
+ /** Returns true if property has even one visible child.
+ */
+ bool HasVisibleChildren() const;
+
+ /**
+ Use this member function to add independent (ie. regular) children to
+ a property.
+
+ @return Inserted childProperty.
+
+ @remarks wxPropertyGrid is not automatically refreshed by this
+ function.
+
+ @see AddPrivateChild()
+ */
+ wxPGProperty* InsertChild( int index, wxPGProperty* childProperty );
+
+ /** Inserts a new choice to property's list of choices.
+ */
+ int InsertChoice( const wxString& label, int index, int value = wxPG_INVALID_VALUE );
+
+ /**
+ Returns true if this property is actually a wxPropertyCategory.
+ */
+ bool IsCategory() const { return HasFlag(wxPG_PROP_CATEGORY)?true:false; }
+
+ /** Returns true if this property is actually a wxRootProperty.
+ */
+ bool IsRoot() const { return (m_parent == NULL); }
+
+ /** Returns true if this is a sub-property. */
+ bool IsSubProperty() const
+ {
+ wxPGProperty* parent = (wxPGProperty*)m_parent;
+ if ( parent && !parent->IsCategory() )
+ return true;
+ return false;
+ }
+
+ /** Returns last visible sub-property, recursively.
+ */
+ const wxPGProperty* GetLastVisibleSubItem() const;
+
+ wxVariant GetDefaultValue() const;
+
+ int GetMaxLength() const
+ {
+ return (int) m_maxLen;
+ }
+
+ /**
+ Determines, recursively, if all children are not unspecified.
+
+ @param pendingList
+ Assumes members in this wxVariant list as pending
+ replacement values.
+ */
+ bool AreAllChildrenSpecified( wxVariant* pendingList = NULL ) const;
+
+ /** Updates composed values of parent non-category properties, recursively.
+ Returns topmost property updated.
+
+ @remarks
+ - Must not call SetValue() (as can be called in it).
+ */
+ wxPGProperty* UpdateParentValues();
+
+ /** Returns true if containing grid uses wxPG_EX_AUTO_UNSPECIFIED_VALUES.
+ */
+ bool UsesAutoUnspecified() const
+ {
+ return HasFlag(wxPG_PROP_AUTO_UNSPECIFIED)?true:false;
+ }
+
+ wxBitmap* GetValueImage() const
+ {
+ return m_valueBitmap;
+ }
+
+ wxVariant GetAttribute( const wxString& name ) const;
+
+ /**
+ Returns named attribute, as string, if found.
+
+ Otherwise defVal is returned.
+ */
+ wxString GetAttribute( const wxString& name, const wxString& defVal ) const;
+
+ /**
+ Returns named attribute, as long, if found.
+
+ Otherwise defVal is returned.
+ */
+ long GetAttributeAsLong( const wxString& name, long defVal ) const;
+
+ /**
+ Returns named attribute, as double, if found.
+
+ Otherwise defVal is returned.
+ */
+ double GetAttributeAsDouble( const wxString& name, double defVal ) const;
+
+ unsigned int GetDepth() const { return (unsigned int)m_depth; }
+
+ /** Gets flags as a'|' delimited string. Note that flag names are not
+ prepended with 'wxPG_PROP_'.
+ @param flagsMask
+ String will only be made to include flags combined by this parameter.
+ */
+ wxString GetFlagsAsString( FlagType flagsMask ) const;
+
+ /** Returns position in parent's array. */
+ unsigned int GetIndexInParent() const
+ {
+ return (unsigned int)m_arrIndex;
+ }
+
+ /** Hides or reveals the property.
+ @param hide
+ true for hide, false for reveal.
+ @param flags
+ By default changes are applied recursively. Set this paramter
+ wxPG_DONT_RECURSE to prevent this.
+ */
+ bool Hide( bool hide, int flags = wxPG_RECURSE );
+
+ bool IsExpanded() const
+ { return (!(m_flags & wxPG_PROP_COLLAPSED) && GetChildCount()); }
+
+ /** Returns true if all parents expanded.
+ */
+ bool IsVisible() const;
+
+ bool IsEnabled() const { return !(m_flags & wxPG_PROP_DISABLED); }
+
+ /** If property's editor is created this forces its recreation.
+ Useful in SetAttribute etc. Returns true if actually did anything.
+ */
+ bool RecreateEditor();
+
+ /** If property's editor is active, then update it's value.
+ */
+ void RefreshEditor();
+
+ /** Sets an attribute for this property.
+ @param name
+ Text identifier of attribute. See @ref propgrid_property_attributes.
+ @param value
+ Value of attribute.
+ */
+ void SetAttribute( const wxString& name, wxVariant value );
+
+ void SetAttributes( const wxPGAttributeStorage& attributes );
+
+ /**
+ Set if user can change the property's value to unspecified by
+ modifying the value of the editor control (usually by clearing
+ it). Currently, this can work with following properties:
+ wxIntProperty, wxUIntProperty, wxFloatProperty, wxEditEnumProperty.
+
+ @param enable
+ Whether to enable or disable this behaviour (it is disabled by
+ default).
+ */
+ void SetAutoUnspecified( bool enable = true )
+ {
+ ChangeFlag(wxPG_PROP_AUTO_UNSPECIFIED, enable);
+ }
+
+ /**
+ Sets property's background colour.
+
+ @param colour
+ Background colour to use.
+
+ @param flags
+ Default is wxPG_RECURSE which causes colour to be set recursively.
+ Omit this flag to only set colour for the property in question
+ and not any of its children.
+ */
+ void SetBackgroundColour( const wxColour& colour,
+ int flags = wxPG_RECURSE );
+
+ /**
+ Sets property's text colour.
+
+ @param colour
+ Text colour to use.
+
+ @param flags
+ Default is wxPG_RECURSE which causes colour to be set recursively.
+ Omit this flag to only set colour for the property in question
+ and not any of its children.
+ */
+ void SetTextColour( const wxColour& colour,
+ int flags = wxPG_RECURSE );
+
+ /** Set default value of a property. Synonymous to
+
+ @code
+ SetAttribute("DefaultValue", value);
+ @endcode
+ */
+ void SetDefaultValue( wxVariant& value );
+
+ /** Sets editor for a property.
+
+ @param editor
+ For builtin editors, use wxPGEditor_X, where X is builtin editor's
+ name (TextCtrl, Choice, etc. see wxPGEditor documentation for full
+ list).
+
+ For custom editors, use pointer you received from
+ wxPropertyGrid::RegisterEditorClass().
+ */
+ void SetEditor( const wxPGEditor* editor )
+ {
+ m_customEditor = editor;
+ }
+
+ /** Sets editor for a property.
+ */
+ inline void SetEditor( const wxString& editorName );
+
+ /**
+ Sets cell information for given column.
+ */
+ void SetCell( int column, const wxPGCell& cell );
+
+ /** Sets common value selected for this property. -1 for none.
+ */
+ void SetCommonValue( int commonValue )
+ {
+ m_commonValue = commonValue;
+ }
+
+ /** Sets flags from a '|' delimited string. Note that flag names are not
+ prepended with 'wxPG_PROP_'.
+ */
+ void SetFlagsFromString( const wxString& str );
+
+ /** Sets property's "is it modified?" flag. Affects children recursively.
+ */
+ void SetModifiedStatus( bool modified )
+ {
+ SetFlagRecursively(wxPG_PROP_MODIFIED, modified);
+ }
+
+ /** Call in OnEvent(), OnButtonClick() etc. to change the property value
+ based on user input.
+
+ @remarks
+ This method is const since it doesn't actually modify value, but posts
+ given variant as pending value, stored in wxPropertyGrid.
+ */
+ void SetValueInEvent( wxVariant value ) const;
+
+ /**
+ Call this to set value of the property.
+
+ Unlike methods in wxPropertyGrid, this does not automatically update
+ the display.
+
+ @remarks
+ Use wxPropertyGrid::ChangePropertyValue() instead if you need to run
+ through validation process and send property change event.
+
+ If you need to change property value in event, based on user input, use
+ SetValueInEvent() instead.
+
+ @param pList
+ Pointer to list variant that contains child values. Used to
+ indicate which children should be marked as modified.
+
+ @param flags
+ Various flags (for instance, wxPG_SETVAL_REFRESH_EDITOR, which is
+ enabled by default).
+ */
+ void SetValue( wxVariant value, wxVariant* pList = NULL,
+ int flags = wxPG_SETVAL_REFRESH_EDITOR );
+
+ /** Set wxBitmap in front of the value. This bitmap may be ignored
+ by custom cell renderers.
+ */
+ void SetValueImage( wxBitmap& bmp );
+
+ /** Sets selected choice and changes property value.
+
+ Tries to retain value type, although currently if it is not string,
+ then it is forced to integer.
+ */
+ void SetChoiceSelection( int newValue );
+
+ void SetExpanded( bool expanded )
+ {
+ if ( !expanded ) m_flags |= wxPG_PROP_COLLAPSED;
+ else m_flags &= ~wxPG_PROP_COLLAPSED;
+ }
+
+ /**
+ Sets or clears given property flag. Mainly for internal use.
+
+ @remarks Setting a property flag never has any side-effect, and is
+ intended almost exclusively for internal use. So, for
+ example, if you want to disable a property, call
+ Enable(false) instead of setting wxPG_PROP_DISABLED flag.
+
+ @see HasFlag(), GetFlags()
+ */
+ void ChangeFlag( wxPGPropertyFlags flag, bool set )
+ {
+ if ( set )
+ m_flags |= flag;
+ else
+ m_flags &= ~flag;
+ }
+
+ /**
+ Sets or clears given property flag, recursively. This function is
+ primarily intended for internal use.
+
+ @see ChangeFlag()
+ */
+ void SetFlagRecursively( wxPGPropertyFlags flag, bool set );
+
+ void SetHelpString( const wxString& helpString )
+ {
+ m_helpString = helpString;
+ }
+
+ void SetLabel( const wxString& label ) { m_label = label; }
+
+ void SetName( const wxString& newName );
+
+ /**
+ Changes what sort of parent this property is for its children.
+
+ @param flag
+ Use one of the following values: wxPG_PROP_MISC_PARENT (for
+ generic parents), wxPG_PROP_CATEGORY (for categories), or
+ wxPG_PROP_AGGREGATE (for derived property classes with private
+ children).
+
+ @remarks You generally do not need to call this function.
+ */
+ void SetParentalType( int flag )
+ {
+ m_flags &= ~(wxPG_PROP_PROPERTY|wxPG_PROP_PARENTAL_FLAGS);
+ m_flags |= flag;
+ }
+
+ void SetValueToUnspecified()
+ {
+ wxVariant val; // Create NULL variant
+ SetValue(val, NULL, wxPG_SETVAL_REFRESH_EDITOR);
+ }
+
+ // Helper function (for wxPython bindings and such) for settings protected
+ // m_value.
+ void SetValuePlain( wxVariant value )
+ {
+ m_value = value;
+ }
+
+#if wxUSE_VALIDATORS
+ /** Sets wxValidator for a property*/
+ void SetValidator( const wxValidator& validator )
+ {
+ m_validator = wxDynamicCast(validator.Clone(),wxValidator);
+ }
+
+ /** Gets assignable version of property's validator. */
+ wxValidator* GetValidator() const
+ {
+ if ( m_validator )
+ return m_validator;
+ return DoGetValidator();
+ }
+#endif // wxUSE_VALIDATORS
+
+ /** Returns client data (void*) of a property.
+ */
+ void* GetClientData() const
+ {
+ return m_clientData;
+ }
+
+ /** Sets client data (void*) of a property.
+ @remarks
+ This untyped client data has to be deleted manually.
+ */
+ void SetClientData( void* clientData )
+ {
+ m_clientData = clientData;
+ }
+
+ /** Returns client object of a property.
+ */
+ void SetClientObject(wxClientData* clientObject)
+ {
+ delete m_clientObject;
+ m_clientObject = clientObject;
+ }
+
+ /** Sets managed client object of a property.
+ */
+ wxClientData *GetClientObject() const { return m_clientObject; }
+
+ /**
+ Sets new set of choices for the property.
+
+ @remarks This operation deselects the property and clears its
+ value.
+ */
+ bool SetChoices( const wxPGChoices& choices );
+
+ /** Set max length of text in text editor.
+ */
+ inline bool SetMaxLength( int maxLen );
+
+ /** Call with 'false' in OnSetValue to cancel value changes after all
+ (ie. cancel 'true' returned by StringToValue() or IntToValue()).
+ */
+ void SetWasModified( bool set = true )
+ {
+ if ( set ) m_flags |= wxPG_PROP_WAS_MODIFIED;
+ else m_flags &= ~wxPG_PROP_WAS_MODIFIED;
+ }
+
+ const wxString& GetHelpString() const
+ {
+ return m_helpString;
+ }
+
+ // Use, for example, to detect if item is inside collapsed section.
+ bool IsSomeParent( wxPGProperty* candidate_parent ) const;
+
+ /**
+ Adapts list variant into proper value using consecutive
+ ChildChanged-calls.
+ */
+ void AdaptListToValue( wxVariant& list, wxVariant* value ) const;
+
+#if wxPG_COMPATIBILITY_1_4
+ /**
+ Adds a private child property.
+
+ @deprecated Use AddPrivateChild() instead.
+
+ @see AddPrivateChild()
+ */
+ wxDEPRECATED( void AddChild( wxPGProperty* prop ) );
+#endif
+
+ /**
+ Adds a private child property. If you use this instead of
+ wxPropertyGridInterface::Insert() or
+ wxPropertyGridInterface::AppendIn(), then property's parental
+ type will automatically be set up to wxPG_PROP_AGGREGATE. In other
+ words, all properties of this property will become private.
+ */
+ void AddPrivateChild( wxPGProperty* prop );
+
+ /**
+ Appends a new child property.
+ */
+ wxPGProperty* AppendChild( wxPGProperty* prop )
+ {
+ return InsertChild(-1, prop);
+ }
+
+ /** Returns height of children, recursively, and
+ by taking expanded/collapsed status into account.
+
+ iMax is used when finding property y-positions.
+ */
+ int GetChildrenHeight( int lh, int iMax = -1 ) const;
+
+ /** Returns number of child properties */
+ unsigned int GetChildCount() const
+ {
+ return (unsigned int) m_children.size();
+ }
+
+ /** Returns sub-property at index i. */
+ wxPGProperty* Item( unsigned int i ) const
+ { return m_children[i]; }
+
+ /** Returns last sub-property.
+ */
+ wxPGProperty* Last() const { return m_children.back(); }
+
+ /** Returns index of given child property. */
+ int Index( const wxPGProperty* p ) const;
+
+ // Puts correct indexes to children
+ void FixIndicesOfChildren( unsigned int starthere = 0 );
+
+ /**
+ Converts image width into full image offset, with margins.
+ */
+ int GetImageOffset( int imageWidth ) const;
+
+ // Returns wxPropertyGridPageState in which this property resides.
+ wxPropertyGridPageState* GetParentState() const { return m_parentState; }
+
+ wxPGProperty* GetItemAtY( unsigned int y,
+ unsigned int lh,
+ unsigned int* nextItemY ) const;
+
+ /** Returns property at given virtual y coordinate.
+ */
+ wxPGProperty* GetItemAtY( unsigned int y ) const;
+
+ /** Returns (direct) child property with given name (or NULL if not found).
+ */
+ wxPGProperty* GetPropertyByName( const wxString& name ) const;
+
+ // Returns various display-related information for given column
+ void GetDisplayInfo( unsigned int column,
+ int choiceIndex,
+ int flags,
+ wxString* pString,
+ const wxPGCell** pCell );
+
+ static wxString* sm_wxPG_LABEL;
+
+ /** This member is public so scripting language bindings
+ wrapper code can access it freely.
+ */
+ void* m_clientData;
+
+protected:
+
+ /**
+ Sets property cell in fashion that reduces number of exclusive
+ copies of cell data. Used when setting, for instance, same
+ background colour for a number of properties.
+
+ @param firstCol
+ First column to affect.
+
+ @param lastCol
+ Last column to affect.
+
+ @param preparedCell
+ Pre-prepared cell that is used for those which cell data
+ before this matched unmodCellData.
+
+ @param srcData
+ If unmodCellData did not match, valid cell data from this
+ is merged into cell (usually generating new exclusive copy
+ of cell's data).
+
+ @param unmodCellData
+ If cell's cell data matches this, its cell is now set to
+ preparedCell.
+
+ @param ignoreWithFlags
+ Properties with any one of these flags are skipped.
+
+ @param recursively
+ If @true, apply this operation recursively in child properties.
+ */
+ void AdaptiveSetCell( unsigned int firstCol,
+ unsigned int lastCol,
+ const wxPGCell& preparedCell,
+ const wxPGCell& srcData,
+ wxPGCellData* unmodCellData,
+ FlagType ignoreWithFlags,
+ bool recursively );
+
+ /**
+ Makes sure m_cells has size of column+1 (or more).
+ */
+ void EnsureCells( unsigned int column );
+
+ /** Returns (direct) child property with given name (or NULL if not found),
+ with hint index.
+
+ @param hintIndex
+ Start looking for the child at this index.
+
+ @remarks
+ Does not support scope (ie. Parent.Child notation).
+ */
+ wxPGProperty* GetPropertyByNameWH( const wxString& name,
+ unsigned int hintIndex ) const;
+
+ /** This is used by Insert etc. */
+ void DoAddChild( wxPGProperty* prop,
+ int index = -1,
+ bool correct_mode = true );
+
+ void DoGenerateComposedValue( wxString& text,
+ int argFlags = wxPG_VALUE_IS_CURRENT,
+ const wxVariantList* valueOverrides = NULL,
+ wxPGHashMapS2S* childResults = NULL ) const;
+
+ bool DoHide( bool hide, int flags );
+
+ void DoSetName(const wxString& str) { m_name = str; }
+
+ /** Deletes all sub-properties. */
+ void Empty();
+
+ bool HasCell( unsigned int column ) const
+ {
+ if ( m_cells.size() > column )
+ return true;
+ return false;
+ }
+
+ void InitAfterAdded( wxPropertyGridPageState* pageState,
+ wxPropertyGrid* propgrid );
+
+ /**
+ Returns true if child property is selected.
+ */
+ bool IsChildSelected( bool recursive = false ) const;
+
+ // Removes child property with given pointer. Does not delete it.
+ void RemoveChild( wxPGProperty* p );
+
+ void DoEnable( bool enable );
+
+ void DoPreAddChild( int index, wxPGProperty* prop );
+
+ void SetParentState( wxPropertyGridPageState* pstate )
+ { m_parentState = pstate; }
+
+ void SetFlag( wxPGPropertyFlags flag )
+ {
+ //
+ // NB: While using wxPGPropertyFlags here makes it difficult to
+ // combine different flags, it usefully prevents user from
+ // using incorrect flags (say, wxWindow styles).
+ m_flags |= flag;
+ }
+
+ void ClearFlag( FlagType flag ) { m_flags &= ~(flag); }
+
+ // Called when the property is being removed from the grid and/or
+ // page state (but *not* when it is also deleted).
+ void OnDetached(wxPropertyGridPageState* state,
+ wxPropertyGrid* propgrid);
+
+ // Call after fixed sub-properties added/removed after creation.
+ // if oldSelInd >= 0 and < new max items, then selection is
+ // moved to it.
+ void SubPropsChanged( int oldSelInd = -1 );
+
+ int GetY2( int lh ) const;
+
+ wxString m_label;
+ wxString m_name;
+ wxPGProperty* m_parent;
+ wxPropertyGridPageState* m_parentState;
+
+ wxClientData* m_clientObject;
+
+ // Overrides editor returned by property class
+ const wxPGEditor* m_customEditor;
+#if wxUSE_VALIDATORS
+ // Editor is going to get this validator
+ wxValidator* m_validator;
+#endif
+ // Show this in front of the value
+ //
+ // TODO: Can bitmap be implemented with wxPGCell?
+ wxBitmap* m_valueBitmap;
+
+ wxVariant m_value;
+ wxPGAttributeStorage m_attributes;
+ wxArrayPGProperty m_children;
+
+ // Extended cell information
+ wxVector<wxPGCell> m_cells;
+
+ // Choices shown in drop-down list of editor control.
+ wxPGChoices m_choices;
+
+ // Help shown in statusbar or help box.
+ wxString m_helpString;
+
+ // Index in parent's property array.
+ unsigned int m_arrIndex;
+
+ // If not -1, then overrides m_value
+ int m_commonValue;
+
+ FlagType m_flags;
+
+ // Maximum length (mainly for string properties). Could be in some sort of
+ // wxBaseStringProperty, but currently, for maximum flexibility and
+ // compatibility, we'll stick it here. Anyway, we had 3 excess bytes to use
+ // so short int will fit in just fine.
+ short m_maxLen;
+
+ // Root has 0, categories etc. at that level 1, etc.
+ unsigned char m_depth;
+
+ // m_depthBgCol indicates width of background colour between margin and item
+ // (essentially this is category's depth, if none then equals m_depth).
+ unsigned char m_depthBgCol;
+
+private:
+ // Called in constructors.
+ void Init();
+ void Init( const wxString& label, const wxString& name );
+};
+
+// -----------------------------------------------------------------------
+
+//
+// Property class declaration helper macros
+// (wxPGRootPropertyClass and wxPropertyCategory require this).
+//
+
+#define WX_PG_DECLARE_DOGETEDITORCLASS \
+ virtual const wxPGEditor* DoGetEditorClass() const;
+
+#ifndef WX_PG_DECLARE_PROPERTY_CLASS
+ #define WX_PG_DECLARE_PROPERTY_CLASS(CLASSNAME) \
+ public: \
+ DECLARE_DYNAMIC_CLASS(CLASSNAME) \
+ WX_PG_DECLARE_DOGETEDITORCLASS \
+ private:
+#endif
+
+// Implements sans constructor function. Also, first arg is class name, not
+// property name.
+#define WX_PG_IMPLEMENT_PROPERTY_CLASS_PLAIN(PROPNAME,T,EDITOR) \
+const wxPGEditor* PROPNAME::DoGetEditorClass() const \
+{ \
+ return wxPGEditor_##EDITOR; \
+}
+
+// -----------------------------------------------------------------------
+
+/** @class wxPGRootProperty
+ @ingroup classes
+ Root parent property.
+*/
+class WXDLLIMPEXP_PROPGRID wxPGRootProperty : public wxPGProperty
+{
+public:
+ WX_PG_DECLARE_PROPERTY_CLASS(wxPGRootProperty)
+public:
+
+ /** Constructor. */
+ wxPGRootProperty( const wxString& name = wxS("<Root>") );
+ virtual ~wxPGRootProperty();
+
+ virtual bool StringToValue( wxVariant&, const wxString&, int ) const
+ {
+ return false;
+ }
+
+protected:
+};
+
+// -----------------------------------------------------------------------
+
+/** @class wxPropertyCategory
+ @ingroup classes
+ Category (caption) property.
+*/
+class WXDLLIMPEXP_PROPGRID wxPropertyCategory : public wxPGProperty
+{
+ friend class wxPropertyGrid;
+ friend class wxPropertyGridPageState;
+ WX_PG_DECLARE_PROPERTY_CLASS(wxPropertyCategory)
+public:
+
+ /** Default constructor is only used in special cases. */
+ wxPropertyCategory();
+
+ wxPropertyCategory( const wxString& label,
+ const wxString& name = wxPG_LABEL );
+ ~wxPropertyCategory();
+
+ int GetTextExtent( const wxWindow* wnd, const wxFont& font ) const;
+
+ virtual wxString ValueToString( wxVariant& value, int argFlags ) const;
+ virtual wxString GetValueAsString( int argFlags = 0 ) const;
+
+protected:
+ void SetTextColIndex( unsigned int colInd )
+ { m_capFgColIndex = (wxByte) colInd; }
+ unsigned int GetTextColIndex() const
+ { return (unsigned int) m_capFgColIndex; }
+
+ void CalculateTextExtent( wxWindow* wnd, const wxFont& font );
+
+ int m_textExtent; // pre-calculated length of text
+ wxByte m_capFgColIndex; // caption text colour index
+
+private:
+ void Init();
+};
+
+// -----------------------------------------------------------------------
+
+#endif // wxUSE_PROPGRID
+
+#endif // _WX_PROPGRID_PROPERTY_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/propgrid/propgrid.h
+// Purpose: wxPropertyGrid
+// Author: Jaakko Salli
+// Modified by:
+// Created: 2004-09-25
+// Copyright: (c) Jaakko Salli
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PROPGRID_PROPGRID_H_
+#define _WX_PROPGRID_PROPGRID_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_PROPGRID
+
+#include "wx/thread.h"
+#include "wx/dcclient.h"
+#include "wx/control.h"
+#include "wx/scrolwin.h"
+#include "wx/tooltip.h"
+#include "wx/datetime.h"
+#include "wx/recguard.h"
+
+#include "wx/propgrid/property.h"
+#include "wx/propgrid/propgridiface.h"
+
+
+#ifndef SWIG
+extern WXDLLIMPEXP_DATA_PROPGRID(const char) wxPropertyGridNameStr[];
+#endif
+
+class wxPGComboBox;
+
+#if wxUSE_STATUSBAR
+class WXDLLIMPEXP_FWD_CORE wxStatusBar;
+#endif
+
+// -----------------------------------------------------------------------
+// Global variables
+// -----------------------------------------------------------------------
+
+// This is required for sharing common global variables.
+class WXDLLIMPEXP_PROPGRID wxPGGlobalVarsClass
+{
+public:
+
+ wxPGGlobalVarsClass();
+ ~wxPGGlobalVarsClass();
+
+#if wxUSE_THREADS
+ // Critical section for handling the globals. Generally it is not needed
+ // since GUI code is supposed to be in single thread. However,
+ // we do want the user to be able to convey wxPropertyGridEvents to other
+ // threads.
+ wxCriticalSection m_critSect;
+#endif
+
+ // Used by advprops, but here to make things easier.
+ wxString m_pDefaultImageWildcard;
+
+ // Map of editor class instances (keys are name string).
+ wxPGHashMapS2P m_mapEditorClasses;
+
+#if wxUSE_VALIDATORS
+ wxVector<wxValidator*> m_arrValidators; // These wxValidators need to be freed
+#endif
+
+ wxPGHashMapS2P m_dictPropertyClassInfo; // PropertyName -> ClassInfo
+
+ wxPGChoices* m_fontFamilyChoices;
+
+ // Replace with your own to affect all properties using default renderer.
+ wxPGCellRenderer* m_defaultRenderer;
+
+ wxPGChoices m_boolChoices;
+
+ wxVariant m_vEmptyString;
+ wxVariant m_vZero;
+ wxVariant m_vMinusOne;
+ wxVariant m_vTrue;
+ wxVariant m_vFalse;
+
+ // Cached constant strings
+ wxPGCachedString m_strstring;
+ wxPGCachedString m_strlong;
+ wxPGCachedString m_strbool;
+ wxPGCachedString m_strlist;
+
+ wxPGCachedString m_strDefaultValue;
+ wxPGCachedString m_strMin;
+ wxPGCachedString m_strMax;
+ wxPGCachedString m_strUnits;
+ wxPGCachedString m_strHint;
+#if wxPG_COMPATIBILITY_1_4
+ wxPGCachedString m_strInlineHelp;
+#endif
+
+ // If true then some things are automatically translated
+ bool m_autoGetTranslation;
+
+ // > 0 if errors cannot or should not be shown in statusbar etc.
+ int m_offline;
+
+ int m_extraStyle; // global extra style
+
+ int m_warnings;
+
+ int HasExtraStyle( int style ) const { return (m_extraStyle & style); }
+};
+
+extern WXDLLIMPEXP_DATA_PROPGRID(wxPGGlobalVarsClass*) wxPGGlobalVars;
+
+#define wxPGVariant_EmptyString (wxPGGlobalVars->m_vEmptyString)
+#define wxPGVariant_Zero (wxPGGlobalVars->m_vZero)
+#define wxPGVariant_MinusOne (wxPGGlobalVars->m_vMinusOne)
+#define wxPGVariant_True (wxPGGlobalVars->m_vTrue)
+#define wxPGVariant_False (wxPGGlobalVars->m_vFalse)
+
+#define wxPGVariant_Bool(A) (A?wxPGVariant_True:wxPGVariant_False)
+
+// When wxPG is loaded dynamically after the application is already running
+// then the built-in module system won't pick this one up. Add it manually.
+WXDLLIMPEXP_PROPGRID void wxPGInitResourceModule();
+
+// -----------------------------------------------------------------------
+
+/** @section propgrid_window_styles wxPropertyGrid Window Styles
+
+ SetWindowStyleFlag method can be used to modify some of these at run-time.
+ @{
+*/
+enum wxPG_WINDOW_STYLES
+{
+
+/** This will cause Sort() automatically after an item is added.
+ When inserting a lot of items in this mode, it may make sense to
+ use Freeze() before operations and Thaw() afterwards to increase
+ performance.
+*/
+wxPG_AUTO_SORT = 0x00000010,
+
+/** Categories are not initially shown (even if added).
+ IMPORTANT NOTE: If you do not plan to use categories, then this
+ style will waste resources.
+ This flag can also be changed using wxPropertyGrid::EnableCategories method.
+*/
+wxPG_HIDE_CATEGORIES = 0x00000020,
+
+/* This style combines non-categoric mode and automatic sorting.
+*/
+wxPG_ALPHABETIC_MODE = (wxPG_HIDE_CATEGORIES|wxPG_AUTO_SORT),
+
+/** Modified values are shown in bold font. Changing this requires Refresh()
+ to show changes.
+*/
+wxPG_BOLD_MODIFIED = 0x00000040,
+
+/** Using this style, the column splitters move automatically based on column
+ proportions (default is equal proportion for every column). This behaviour
+ stops once the user manually moves a splitter, and returns when a
+ splitter is double-clicked.
+
+ @see wxPropertyGridInterface::SetColumnProportion().
+*/
+wxPG_SPLITTER_AUTO_CENTER = 0x00000080,
+
+/** Display tooltips for cell text that cannot be shown completely. If
+ wxUSE_TOOLTIPS is 0, then this doesn't have any effect.
+*/
+wxPG_TOOLTIPS = 0x00000100,
+
+/** Disables margin and hides all expand/collapse buttons that would appear
+ outside the margin (for sub-properties). Toggling this style automatically
+ expands all collapsed items.
+*/
+wxPG_HIDE_MARGIN = 0x00000200,
+
+/** This style prevents user from moving the splitter.
+*/
+wxPG_STATIC_SPLITTER = 0x00000400,
+
+/** Combination of other styles that make it impossible for user to modify
+ the layout.
+*/
+wxPG_STATIC_LAYOUT = (wxPG_HIDE_MARGIN|wxPG_STATIC_SPLITTER),
+
+/** Disables wxTextCtrl based editors for properties which
+ can be edited in another way.
+
+ Equals calling wxPropertyGrid::LimitPropertyEditing for all added
+ properties.
+*/
+wxPG_LIMITED_EDITING = 0x00000800,
+
+/** wxPropertyGridManager only: Show toolbar for mode and page selection. */
+wxPG_TOOLBAR = 0x00001000,
+
+/** wxPropertyGridManager only: Show adjustable text box showing description
+ or help text, if available, for currently selected property.
+*/
+wxPG_DESCRIPTION = 0x00002000,
+
+/** wxPropertyGridManager only: don't show an internal border around the
+ property grid. Recommended if you use a header.
+*/
+wxPG_NO_INTERNAL_BORDER = 0x00004000
+};
+
+#if wxPG_COMPATIBILITY_1_4
+ // In wxPG 1.4 this was used to enable now-default theme border support
+ // in wxPropertyGridManager.
+ #define wxPG_THEME_BORDER 0x00000000
+#endif
+
+
+enum wxPG_EX_WINDOW_STYLES
+{
+
+/**
+ NOTE: wxPG_EX_xxx are extra window styles and must be set using
+ SetExtraStyle() member function.
+
+ Speeds up switching to wxPG_HIDE_CATEGORIES mode. Initially, if
+ wxPG_HIDE_CATEGORIES is not defined, the non-categorized data storage is
+ not activated, and switching the mode first time becomes somewhat slower.
+ wxPG_EX_INIT_NOCAT activates the non-categorized data storage right away.
+ IMPORTANT NOTE: If you do plan not switching to non-categoric mode, or if
+ you don't plan to use categories at all, then using this style will result
+ in waste of resources.
+
+*/
+wxPG_EX_INIT_NOCAT = 0x00001000,
+
+/** Extended window style that sets wxPropertyGridManager toolbar to not
+ use flat style.
+*/
+wxPG_EX_NO_FLAT_TOOLBAR = 0x00002000,
+
+/** Shows alphabetic/categoric mode buttons from toolbar.
+*/
+wxPG_EX_MODE_BUTTONS = 0x00008000,
+
+/** Show property help strings as tool tips instead as text on the status bar.
+ You can set the help strings using SetPropertyHelpString member function.
+*/
+wxPG_EX_HELP_AS_TOOLTIPS = 0x00010000,
+
+/** Prevent TAB from focusing to wxButtons. This behaviour was default
+ in version 1.2.0 and earlier.
+ NOTE! Tabbing to button doesn't work yet. Problem seems to be that on wxMSW
+ atleast the button doesn't properly propagate key events (yes, I'm using
+ wxWANTS_CHARS).
+*/
+//wxPG_EX_NO_TAB_TO_BUTTON = 0x00020000,
+
+/** Allows relying on native double-buffering.
+*/
+wxPG_EX_NATIVE_DOUBLE_BUFFERING = 0x00080000,
+
+/** Set this style to let user have ability to set values of properties to
+ unspecified state. Same as setting wxPG_PROP_AUTO_UNSPECIFIED for
+ all properties.
+*/
+wxPG_EX_AUTO_UNSPECIFIED_VALUES = 0x00200000,
+
+/**
+ If this style is used, built-in attributes (such as wxPG_FLOAT_PRECISION
+ and wxPG_STRING_PASSWORD) are not stored into property's attribute storage
+ (thus they are not readable).
+
+ Note that this option is global, and applies to all wxPG property
+ containers.
+*/
+wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES = 0x00400000,
+
+/** Hides page selection buttons from toolbar.
+*/
+wxPG_EX_HIDE_PAGE_BUTTONS = 0x01000000,
+
+/** Allows multiple properties to be selected by user (by pressing SHIFT
+ when clicking on a property, or by dragging with left mouse button
+ down).
+
+ You can get array of selected properties with
+ wxPropertyGridInterface::GetSelectedProperties(). In multiple selection
+ mode wxPropertyGridInterface::GetSelection() returns
+ property which has editor active (usually the first one
+ selected). Other useful member functions are ClearSelection(),
+ AddToSelection() and RemoveFromSelection().
+*/
+wxPG_EX_MULTIPLE_SELECTION = 0x02000000,
+
+/**
+ This enables top-level window tracking which allows wxPropertyGrid to
+ notify the application of last-minute property value changes by user.
+
+ This style is not enabled by default because it may cause crashes when
+ wxPropertyGrid is used in with wxAUI or similar system.
+
+ @remarks If you are not in fact using any system that may change
+ wxPropertyGrid's top-level parent window on its own, then you
+ are recommended to enable this style.
+*/
+wxPG_EX_ENABLE_TLP_TRACKING = 0x04000000,
+
+/** Don't show divider above toolbar, on Windows.
+*/
+wxPG_EX_NO_TOOLBAR_DIVIDER = 0x08000000,
+
+/** Show a separator below the toolbar.
+*/
+wxPG_EX_TOOLBAR_SEPARATOR = 0x10000000
+
+};
+
+#if wxPG_COMPATIBILITY_1_4
+ #define wxPG_EX_DISABLE_TLP_TRACKING 0x00000000
+#endif
+
+/** Combines various styles.
+*/
+#define wxPG_DEFAULT_STYLE (0)
+
+/** Combines various styles.
+*/
+#define wxPGMAN_DEFAULT_STYLE (0)
+
+/** @}
+*/
+
+// -----------------------------------------------------------------------
+
+//
+// Ids for sub-controls
+// NB: It should not matter what these are.
+#define wxPG_SUBID1 2
+#define wxPG_SUBID2 3
+#define wxPG_SUBID_TEMP1 4
+
+// -----------------------------------------------------------------------
+
+/** @class wxPGCommonValue
+
+ wxPropertyGrid stores information about common values in these
+ records.
+
+ NB: Common value feature is not complete, and thus not mentioned in
+ documentation.
+*/
+class WXDLLIMPEXP_PROPGRID wxPGCommonValue
+{
+public:
+
+ wxPGCommonValue( const wxString& label, wxPGCellRenderer* renderer )
+ {
+ m_label = label;
+ m_renderer = renderer;
+ renderer->IncRef();
+ }
+ virtual ~wxPGCommonValue()
+ {
+ m_renderer->DecRef();
+ }
+
+ virtual wxString GetEditableText() const { return m_label; }
+ const wxString& GetLabel() const { return m_label; }
+ wxPGCellRenderer* GetRenderer() const { return m_renderer; }
+
+protected:
+ wxString m_label;
+ wxPGCellRenderer* m_renderer;
+};
+
+// -----------------------------------------------------------------------
+
+/** @section propgrid_vfbflags wxPropertyGrid Validation Failure behaviour Flags
+ @{
+*/
+
+enum wxPG_VALIDATION_FAILURE_BEHAVIOR_FLAGS
+{
+
+/** Prevents user from leaving property unless value is valid. If this
+ behaviour flag is not used, then value change is instead cancelled.
+*/
+wxPG_VFB_STAY_IN_PROPERTY = 0x01,
+
+/** Calls wxBell() on validation failure.
+*/
+wxPG_VFB_BEEP = 0x02,
+
+/** Cell with invalid value will be marked (with red colour).
+*/
+wxPG_VFB_MARK_CELL = 0x04,
+
+/**
+ Display a text message explaining the situation.
+
+ To customize the way the message is displayed, you need to
+ reimplement wxPropertyGrid::DoShowPropertyError() in a
+ derived class. Default behaviour is to display the text on
+ the top-level frame's status bar, if present, and otherwise
+ using wxMessageBox.
+*/
+wxPG_VFB_SHOW_MESSAGE = 0x08,
+
+/**
+ Similar to wxPG_VFB_SHOW_MESSAGE, except always displays the
+ message using wxMessageBox.
+*/
+wxPG_VFB_SHOW_MESSAGEBOX = 0x10,
+
+/**
+ Similar to wxPG_VFB_SHOW_MESSAGE, except always displays the
+ message on the status bar (when present - you can reimplement
+ wxPropertyGrid::GetStatusBar() in a derived class to specify
+ this yourself).
+*/
+wxPG_VFB_SHOW_MESSAGE_ON_STATUSBAR = 0x20,
+
+/** Defaults. */
+wxPG_VFB_DEFAULT = wxPG_VFB_MARK_CELL |
+ wxPG_VFB_SHOW_MESSAGEBOX,
+
+/** Only used internally. */
+wxPG_VFB_UNDEFINED = 0x80
+
+};
+
+/** @}
+*/
+
+// Having this as define instead of wxByte typedef makes things easier for
+// wxPython bindings (ignoring and redefining it in SWIG interface file
+// seemed rather tricky)
+#define wxPGVFBFlags unsigned char
+
+/**
+ wxPGValidationInfo
+
+ Used to convey validation information to and from functions that
+ actually perform validation. Mostly used in custom property
+ classes.
+*/
+class WXDLLIMPEXP_PROPGRID wxPGValidationInfo
+{
+ friend class wxPropertyGrid;
+public:
+ wxPGValidationInfo()
+ {
+ m_failureBehavior = 0;
+ m_isFailing = false;
+ }
+
+ ~wxPGValidationInfo()
+ {
+ }
+
+ /**
+ @return Returns failure behaviour which is a combination of
+ @ref propgrid_vfbflags.
+ */
+ wxPGVFBFlags GetFailureBehavior() const
+ { return m_failureBehavior; }
+
+ /**
+ Returns current failure message.
+ */
+ const wxString& GetFailureMessage() const
+ { return m_failureMessage; }
+
+ /**
+ Returns reference to pending value.
+ */
+ wxVariant& GetValue()
+ {
+ wxASSERT(m_pValue);
+ return *m_pValue;
+ }
+
+ /** Set validation failure behaviour
+
+ @param failureBehavior
+ Mixture of @ref propgrid_vfbflags.
+ */
+ void SetFailureBehavior(wxPGVFBFlags failureBehavior)
+ { m_failureBehavior = failureBehavior; }
+
+ /**
+ Set current failure message.
+ */
+ void SetFailureMessage(const wxString& message)
+ { m_failureMessage = message; }
+
+private:
+ /** Value to be validated.
+ */
+ wxVariant* m_pValue;
+
+ /** Message displayed on validation failure.
+ */
+ wxString m_failureMessage;
+
+ /** Validation failure behaviour. Use wxPG_VFB_XXX flags.
+ */
+ wxPGVFBFlags m_failureBehavior;
+
+ // True when validation is currently failing.
+ bool m_isFailing;
+};
+
+// -----------------------------------------------------------------------
+
+/** @section propgrid_pgactions wxPropertyGrid Action Identifiers
+
+ These are used with wxPropertyGrid::AddActionTrigger() and
+ wxPropertyGrid::ClearActionTriggers().
+ @{
+*/
+
+enum wxPG_KEYBOARD_ACTIONS
+{
+ wxPG_ACTION_INVALID = 0,
+
+ /** Select the next property. */
+ wxPG_ACTION_NEXT_PROPERTY,
+
+ /** Select the previous property. */
+ wxPG_ACTION_PREV_PROPERTY,
+
+ /** Expand the selected property, if it has child items. */
+ wxPG_ACTION_EXPAND_PROPERTY,
+
+ /** Collapse the selected property, if it has child items. */
+ wxPG_ACTION_COLLAPSE_PROPERTY,
+
+ /** Cancel and undo any editing done in the currently active property
+ editor.
+ */
+ wxPG_ACTION_CANCEL_EDIT,
+
+ /** Move focus to the editor control of the currently selected
+ property.
+ */
+ wxPG_ACTION_EDIT,
+
+ /** Causes editor's button (if any) to be pressed. */
+ wxPG_ACTION_PRESS_BUTTON,
+
+ wxPG_ACTION_MAX
+};
+
+/** @}
+*/
+
+// -----------------------------------------------------------------------
+
+
+// wxPropertyGrid::DoSelectProperty flags (selFlags)
+
+// Focuses to created editor
+#define wxPG_SEL_FOCUS 0x0001
+// Forces deletion and recreation of editor
+#define wxPG_SEL_FORCE 0x0002
+// For example, doesn't cause EnsureVisible
+#define wxPG_SEL_NONVISIBLE 0x0004
+// Do not validate editor's value before selecting
+#define wxPG_SEL_NOVALIDATE 0x0008
+// Property being deselected is about to be deleted
+#define wxPG_SEL_DELETING 0x0010
+// Property's values was set to unspecified by the user
+#define wxPG_SEL_SETUNSPEC 0x0020
+// Property's event handler changed the value
+#define wxPG_SEL_DIALOGVAL 0x0040
+// Set to disable sending of wxEVT_PG_SELECTED event
+#define wxPG_SEL_DONT_SEND_EVENT 0x0080
+// Don't make any graphics updates
+#define wxPG_SEL_NO_REFRESH 0x0100
+
+// -----------------------------------------------------------------------
+
+// DoSetSplitterPosition() flags
+
+enum wxPG_SET_SPLITTER_POSITION_SPLITTER_FLAGS
+{
+ wxPG_SPLITTER_REFRESH = 0x0001,
+ wxPG_SPLITTER_ALL_PAGES = 0x0002,
+ wxPG_SPLITTER_FROM_EVENT = 0x0004,
+ wxPG_SPLITTER_FROM_AUTO_CENTER = 0x0008
+};
+
+
+// -----------------------------------------------------------------------
+
+// Internal flags
+#define wxPG_FL_INITIALIZED 0x0001
+// Set when creating editor controls if it was clicked on.
+#define wxPG_FL_ACTIVATION_BY_CLICK 0x0002
+#define wxPG_FL_DONT_CENTER_SPLITTER 0x0004
+#define wxPG_FL_FOCUSED 0x0008
+#define wxPG_FL_MOUSE_CAPTURED 0x0010
+#define wxPG_FL_MOUSE_INSIDE 0x0020
+#define wxPG_FL_VALUE_MODIFIED 0x0040
+// don't clear background of m_wndEditor
+#define wxPG_FL_PRIMARY_FILLS_ENTIRE 0x0080
+// currently active editor uses custom image
+#define wxPG_FL_CUR_USES_CUSTOM_IMAGE 0x0100
+// cell colours override selection colours for selected cell
+#define wxPG_FL_CELL_OVERRIDES_SEL 0x0200
+#define wxPG_FL_SCROLLED 0x0400
+// set when all added/inserted properties get hideable flag
+#define wxPG_FL_ADDING_HIDEABLES 0x0800
+// Disables showing help strings on statusbar.
+#define wxPG_FL_NOSTATUSBARHELP 0x1000
+// Marks that we created the state, so we have to destroy it too.
+#define wxPG_FL_CREATEDSTATE 0x2000
+// Set if scrollbar's existence was detected in last onresize.
+#define wxPG_FL_SCROLLBAR_DETECTED 0x4000
+// Set if wxPGMan requires redrawing of description text box.
+#define wxPG_FL_DESC_REFRESH_REQUIRED 0x8000
+// Set if contained in wxPropertyGridManager
+#define wxPG_FL_IN_MANAGER 0x00020000
+// Set after wxPropertyGrid is shown in its initial good size
+#define wxPG_FL_GOOD_SIZE_SET 0x00040000
+// Set when in SelectProperty.
+#define wxPG_FL_IN_SELECT_PROPERTY 0x00100000
+// Set when help string is shown in status bar
+#define wxPG_FL_STRING_IN_STATUSBAR 0x00200000
+// Auto sort is enabled (for categorized mode)
+#define wxPG_FL_CATMODE_AUTO_SORT 0x01000000
+// Set after page has been inserted to manager
+#define wxPG_MAN_FL_PAGE_INSERTED 0x02000000
+// Active editor control is abnormally large
+#define wxPG_FL_ABNORMAL_EDITOR 0x04000000
+// Recursion guard for HandleCustomEditorEvent
+#define wxPG_FL_IN_HANDLECUSTOMEDITOREVENT 0x08000000
+#define wxPG_FL_VALUE_CHANGE_IN_EVENT 0x10000000
+// Editor control width should not change on resize
+#define wxPG_FL_FIXED_WIDTH_EDITOR 0x20000000
+// Width of panel can be different than width of grid
+#define wxPG_FL_HAS_VIRTUAL_WIDTH 0x40000000
+// Prevents RecalculateVirtualSize re-entrancy
+#define wxPG_FL_RECALCULATING_VIRTUAL_SIZE 0x80000000
+
+#if !defined(__wxPG_SOURCE_FILE__)
+ // Reduce compile time, but still include in user app
+ #include "wx/propgrid/props.h"
+#endif
+
+// -----------------------------------------------------------------------
+
+/** @class wxPropertyGrid
+
+ wxPropertyGrid is a specialized grid for editing properties
+ such as strings, numbers, flagsets, fonts, and colours. wxPropertySheet
+ used to do the very same thing, but it hasn't been updated for a while
+ and it is currently deprecated.
+
+ Please note that most member functions are inherited and as such not
+ documented on this page. This means you will probably also want to read
+ wxPropertyGridInterface class reference.
+
+ See also @ref overview_propgrid.
+
+ @section propgrid_window_styles_ Window Styles
+
+ See @ref propgrid_window_styles.
+
+ @section propgrid_event_handling Event Handling
+
+ To process input from a propertygrid control, use these event handler
+ macros to direct input to member functions that take a wxPropertyGridEvent
+ argument.
+
+ @beginEventTable{wxPropertyGridEvent}
+ @event{EVT_PG_SELECTED (id, func)}
+ Respond to wxEVT_PG_SELECTED event, generated when a property selection
+ has been changed, either by user action or by indirect program
+ function. For instance, collapsing a parent property programmatically
+ causes any selected child property to become unselected, and may
+ therefore cause this event to be generated.
+ @event{EVT_PG_CHANGING(id, func)}
+ Respond to wxEVT_PG_CHANGING event, generated when property value
+ is about to be changed by user. Use wxPropertyGridEvent::GetValue()
+ to take a peek at the pending value, and wxPropertyGridEvent::Veto()
+ to prevent change from taking place, if necessary.
+ @event{EVT_PG_HIGHLIGHTED(id, func)}
+ Respond to wxEVT_PG_HIGHLIGHTED event, which occurs when mouse
+ moves over a property. Event's property is NULL if hovered area does
+ not belong to any property.
+ @event{EVT_PG_RIGHT_CLICK(id, func)}
+ Respond to wxEVT_PG_RIGHT_CLICK event, which occurs when property is
+ clicked on with right mouse button.
+ @event{EVT_PG_DOUBLE_CLICK(id, func)}
+ Respond to wxEVT_PG_DOUBLE_CLICK event, which occurs when property is
+ double-clicked onwith left mouse button.
+ @event{EVT_PG_ITEM_COLLAPSED(id, func)}
+ Respond to wxEVT_PG_ITEM_COLLAPSED event, generated when user collapses
+ a property or category..
+ @event{EVT_PG_ITEM_EXPANDED(id, func)}
+ Respond to wxEVT_PG_ITEM_EXPANDED event, generated when user expands
+ a property or category..
+ @event{EVT_PG_LABEL_EDIT_BEGIN(id, func)}
+ Respond to wxEVT_PG_LABEL_EDIT_BEGIN event, generated when is about to
+ begin editing a property label. You can veto this event to prevent the
+ action.
+ @event{EVT_PG_LABEL_EDIT_ENDING(id, func)}
+ Respond to wxEVT_PG_LABEL_EDIT_ENDING event, generated when is about to
+ end editing of a property label. You can veto this event to prevent the
+ action.
+ @event{EVT_PG_COL_BEGIN_DRAG(id, func)}
+ Respond to wxEVT_PG_COL_BEGIN_DRAG event, generated when user
+ starts resizing a column - can be vetoed.
+ @event{EVT_PG_COL_DRAGGING,(id, func)}
+ Respond to wxEVT_PG_COL_DRAGGING, event, generated when a
+ column resize by user is in progress. This event is also generated
+ when user double-clicks the splitter in order to recenter
+ it.
+ @event{EVT_PG_COL_END_DRAG(id, func)}
+ Respond to wxEVT_PG_COL_END_DRAG event, generated after column
+ resize by user has finished.
+ @endEventTable
+
+ @remarks
+
+ - Use Freeze() and Thaw() respectively to disable and enable drawing. This
+ will also delay sorting etc. miscellaneous calculations to the last
+ possible moment.
+
+ @library{wxpropgrid}
+ @category{propgrid}
+*/
+class WXDLLIMPEXP_PROPGRID wxPropertyGrid : public wxControl,
+ public wxScrollHelper,
+ public wxPropertyGridInterface
+{
+ friend class wxPropertyGridEvent;
+ friend class wxPropertyGridPageState;
+ friend class wxPropertyGridInterface;
+ friend class wxPropertyGridManager;
+ friend class wxPGHeaderCtrl;
+
+ DECLARE_DYNAMIC_CLASS(wxPropertyGrid)
+public:
+
+#ifndef SWIG
+ /**
+ Two step constructor.
+
+ Call Create when this constructor is called to build up the
+ wxPropertyGrid
+ */
+ wxPropertyGrid();
+#endif
+
+ /** The default constructor. The styles to be used are styles valid for
+ the wxWindow.
+
+ @see @link wndflags Additional Window Styles @endlink
+ */
+ wxPropertyGrid( wxWindow *parent, wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxPG_DEFAULT_STYLE,
+ const wxString& name = wxPropertyGridNameStr );
+
+ /** Destructor */
+ virtual ~wxPropertyGrid();
+
+ /** Adds given key combination to trigger given action.
+
+ Here is a sample code to make Enter key press move focus to
+ the next property.
+
+ @code
+ propGrid->AddActionTrigger(wxPG_ACTION_NEXT_PROPERTY,
+ WXK_RETURN);
+ propGrid->DedicateKey(WXK_RETURN);
+ @endcode
+
+ @param action
+ Which action to trigger. See @ref propgrid_keyboard_actions.
+ @param keycode
+ Which keycode triggers the action.
+ @param modifiers
+ Which key event modifiers, in addition to keycode, are needed to
+ trigger the action.
+ */
+ void AddActionTrigger( int action, int keycode, int modifiers = 0 );
+
+ /**
+ Dedicates a specific keycode to wxPropertyGrid. This means that such
+ key presses will not be redirected to editor controls.
+
+ Using this function allows, for example, navigation between
+ properties using arrow keys even when the focus is in the editor
+ control.
+ */
+ void DedicateKey( int keycode )
+ {
+ m_dedicatedKeys.push_back(keycode);
+ }
+
+ /**
+ This static function enables or disables automatic use of
+ wxGetTranslation for following strings: wxEnumProperty list labels,
+ wxFlagsProperty sub-property labels.
+
+ Default is false.
+ */
+ static void AutoGetTranslation( bool enable );
+
+ /**
+ Changes value of a property, as if from an editor.
+
+ Use this instead of SetPropertyValue() if you need the value to run
+ through validation process, and also send the property change event.
+
+ @return
+ Returns true if value was successfully changed.
+ */
+ bool ChangePropertyValue( wxPGPropArg id, wxVariant newValue );
+
+ /**
+ Centers the splitter.
+
+ @param enableAutoResizing
+ If @true, automatic column resizing is enabled (only applicapple
+ if window style wxPG_SPLITTER_AUTO_CENTER is used).
+ */
+ void CenterSplitter( bool enableAutoResizing = false );
+
+ /** Deletes all properties.
+ */
+ virtual void Clear();
+
+ /** Clears action triggers for given action.
+ @param action
+ Which action to trigger. See @link pgactions List of list of
+ wxPropertyGrid actions@endlink.
+ */
+ void ClearActionTriggers( int action );
+
+ /** Forces updating the value of property from the editor control.
+
+ Note that wxEVT_PG_CHANGING and wxEVT_PG_CHANGED are dispatched using
+ ProcessEvent, meaning your event handlers will be called immediately.
+
+ @return
+ Returns true if anything was changed.
+ */
+ virtual bool CommitChangesFromEditor( wxUint32 flags = 0 );
+
+ /**
+ Two step creation.
+
+ Whenever the control is created without any parameters, use Create to
+ actually create it. Don't access the control's public methods before
+ this is called @see @link wndflags Additional Window Styles@endlink
+ */
+ bool Create( wxWindow *parent, wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxPG_DEFAULT_STYLE,
+ const wxString& name = wxPropertyGridNameStr );
+
+ /**
+ Call when editor widget's contents is modified.
+
+ For example, this is called when changes text in wxTextCtrl (used in
+ wxStringProperty and wxIntProperty).
+
+ @remarks
+ This function should only be called by custom properties.
+
+ @see wxPGProperty::OnEvent()
+ */
+ void EditorsValueWasModified() { m_iFlags |= wxPG_FL_VALUE_MODIFIED; }
+
+ /** Reverse of EditorsValueWasModified().
+
+ @remarks
+ This function should only be called by custom properties.
+ */
+ void EditorsValueWasNotModified()
+ {
+ m_iFlags &= ~(wxPG_FL_VALUE_MODIFIED);
+ }
+
+ /**
+ Enables or disables (shows/hides) categories according to parameter
+ enable.
+ */
+ bool EnableCategories( bool enable );
+
+ /** Scrolls and/or expands items to ensure that the given item is visible.
+ Returns true if something was actually done.
+ */
+ bool EnsureVisible( wxPGPropArg id );
+
+ /**
+ Reduces column sizes to minimum possible that contents are still
+ visibly (naturally some margin space will be applied as well).
+
+ @return
+ Minimum size for the grid to still display everything.
+
+ @remarks
+ Does not work well with wxPG_SPLITTER_AUTO_CENTER window style.
+
+ This function only works properly if grid size prior to call was already
+ fairly large.
+
+ Note that you can also get calculated column widths by calling
+ GetState->GetColumnWidth() immediately after this function returns.
+ */
+ wxSize FitColumns()
+ {
+ wxSize sz = m_pState->DoFitColumns();
+ return sz;
+ }
+
+ /**
+ Returns wxWindow that the properties are painted on, and which should
+ be used as the parent for editor controls.
+ */
+ wxWindow* GetPanel()
+ {
+ return this;
+ }
+
+ /** Returns current category caption background colour. */
+ wxColour GetCaptionBackgroundColour() const { return m_colCapBack; }
+
+ wxFont& GetCaptionFont() { return m_captionFont; }
+
+ const wxFont& GetCaptionFont() const { return m_captionFont; }
+
+ /** Returns current category caption text colour. */
+ wxColour GetCaptionForegroundColour() const { return m_colCapFore; }
+
+ /** Returns current cell background colour. */
+ wxColour GetCellBackgroundColour() const { return m_colPropBack; }
+
+ /** Returns current cell text colour when disabled. */
+ wxColour GetCellDisabledTextColour() const { return m_colDisPropFore; }
+
+ /** Returns current cell text colour. */
+ wxColour GetCellTextColour() const { return m_colPropFore; }
+
+ /**
+ Returns number of columns currently on grid.
+ */
+ unsigned int GetColumnCount() const
+ {
+ return (unsigned int) m_pState->m_colWidths.size();
+ }
+
+ /** Returns colour of empty space below properties. */
+ wxColour GetEmptySpaceColour() const { return m_colEmptySpace; }
+
+ /** Returns height of highest characters of used font. */
+ int GetFontHeight() const { return m_fontHeight; }
+
+ /** Returns pointer to itself. Dummy function that enables same kind
+ of code to use wxPropertyGrid and wxPropertyGridManager.
+ */
+ wxPropertyGrid* GetGrid() { return this; }
+
+ /** Returns rectangle of custom paint image.
+ */
+ wxRect GetImageRect( wxPGProperty* p, int item ) const;
+
+ /** Returns size of the custom paint image in front of property.
+ If no argument is given, returns preferred size.
+ */
+ wxSize GetImageSize( wxPGProperty* p = NULL, int item = -1 ) const;
+
+ //@{
+ /** Returns last item which could be iterated using given flags.
+ @param flags
+ See @ref propgrid_iterator_flags.
+ */
+ wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT )
+ {
+ return m_pState->GetLastItem(flags);
+ }
+
+ const wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT ) const
+ {
+ return m_pState->GetLastItem(flags);
+ }
+ //@}
+
+ /** Returns colour of lines between cells. */
+ wxColour GetLineColour() const { return m_colLine; }
+
+ /** Returns background colour of margin. */
+ wxColour GetMarginColour() const { return m_colMargin; }
+
+ /** Returns margin width. */
+ int GetMarginWidth() const { return m_marginWidth; }
+
+ /**
+ Returns most up-to-date value of selected property. This will return
+ value different from GetSelectedProperty()->GetValue() only when text
+ editor is activate and string edited by user represents valid,
+ uncommitted property value.
+ */
+ wxVariant GetUncommittedPropertyValue();
+
+ /** Returns "root property". It does not have name, etc. and it is not
+ visible. It is only useful for accessing its children.
+ */
+ wxPGProperty* GetRoot() const { return m_pState->m_properties; }
+
+ /** Returns height of a single grid row (in pixels). */
+ int GetRowHeight() const { return m_lineHeight; }
+
+ /** Returns currently selected property. */
+ wxPGProperty* GetSelectedProperty() const { return GetSelection(); }
+
+ /** Returns current selection background colour. */
+ wxColour GetSelectionBackgroundColour() const { return m_colSelBack; }
+
+ /** Returns current selection text colour. */
+ wxColour GetSelectionForegroundColour() const { return m_colSelFore; }
+
+ /**
+ Returns current splitter x position.
+ */
+ int GetSplitterPosition( unsigned int splitterIndex = 0 ) const
+ {
+ return m_pState->DoGetSplitterPosition(splitterIndex);
+ }
+
+ /** Returns wxTextCtrl active in currently selected property, if any. Takes
+ into account wxOwnerDrawnComboBox.
+ */
+ wxTextCtrl* GetEditorTextCtrl() const;
+
+ wxPGValidationInfo& GetValidationInfo()
+ {
+ return m_validationInfo;
+ }
+
+ /** Returns current vertical spacing. */
+ int GetVerticalSpacing() const { return (int)m_vspacing; }
+
+ /**
+ Returns @true if a property editor control has focus.
+ */
+ bool IsEditorFocused() const;
+
+ /** Returns true if editor's value was marked modified.
+ */
+ bool IsEditorsValueModified() const
+ { return ( m_iFlags & wxPG_FL_VALUE_MODIFIED ) ? true : false; }
+
+ /**
+ Returns information about arbitrary position in the grid.
+
+ @param pt
+ Coordinates in the virtual grid space. You may need to use
+ wxScrolled<T>::CalcScrolledPosition() for translating
+ wxPropertyGrid client coordinates into something this member
+ function can use.
+ */
+ wxPropertyGridHitTestResult HitTest( const wxPoint& pt ) const;
+
+ /** Returns true if any property has been modified by the user. */
+ bool IsAnyModified() const { return (m_pState->m_anyModified>0); }
+
+ /**
+ Returns true if updating is frozen (ie Freeze() called but not yet
+ Thaw() ).
+ */
+ bool IsFrozen() const { return (m_frozen>0)?true:false; }
+
+ /**
+ It is recommended that you call this function any time your code causes
+ wxPropertyGrid's top-level parent to change. wxPropertyGrid's OnIdle()
+ handler should be able to detect most changes, but it is not perfect.
+
+ @param newTLP
+ New top-level parent that is about to be set. Old top-level parent
+ window should still exist as the current one.
+
+ @remarks This function is automatically called from wxPropertyGrid::
+ Reparent() and wxPropertyGridManager::Reparent(). You only
+ need to use it if you reparent wxPropertyGrid indirectly.
+ */
+ void OnTLPChanging( wxWindow* newTLP );
+
+ /** Redraws given property.
+ */
+ virtual void RefreshProperty( wxPGProperty* p );
+
+ /** Registers a new editor class.
+ @return
+ Pointer to the editor class instance that should be used.
+ */
+ static wxPGEditor* RegisterEditorClass( wxPGEditor* editor,
+ bool noDefCheck = false )
+ {
+ return DoRegisterEditorClass(editor, wxEmptyString, noDefCheck);
+ }
+
+ static wxPGEditor* DoRegisterEditorClass( wxPGEditor* editorClass,
+ const wxString& editorName,
+ bool noDefCheck = false );
+
+ /** Resets all colours to the original system values.
+ */
+ void ResetColours();
+
+ /**
+ Resets column sizes and splitter positions, based on proportions.
+
+ @param enableAutoResizing
+ If @true, automatic column resizing is enabled (only applicapple
+ if window style wxPG_SPLITTER_AUTO_CENTER is used).
+
+ @see wxPropertyGridInterface::SetColumnProportion()
+ */
+ void ResetColumnSizes( bool enableAutoResizing = false );
+
+ /**
+ Selects a property.
+ Editor widget is automatically created, but not focused unless focus is
+ true.
+
+ @param id
+ Property to select.
+
+ @return
+ True if selection finished successfully. Usually only fails if
+ current value in editor is not valid.
+
+ @remarks In wxPropertyGrid 1.4, this member function used to generate
+ wxEVT_PG_SELECTED. In wxWidgets 2.9 and later, it no longer
+ does that.
+
+ @remarks This clears any previous selection.
+ */
+ bool SelectProperty( wxPGPropArg id, bool focus = false );
+
+ /**
+ Set entire new selection from given list of properties.
+ */
+ void SetSelection( const wxArrayPGProperty& newSelection )
+ {
+ DoSetSelection( newSelection, wxPG_SEL_DONT_SEND_EVENT );
+ }
+
+ /**
+ Adds given property into selection. If wxPG_EX_MULTIPLE_SELECTION
+ extra style is not used, then this has same effect as
+ calling SelectProperty().
+
+ @remarks Multiple selection is not supported for categories. This
+ means that if you have properties selected, you cannot
+ add category to selection, and also if you have category
+ selected, you cannot add other properties to selection.
+ This member function will fail silently in these cases,
+ even returning true.
+ */
+ bool AddToSelection( wxPGPropArg id )
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
+ return DoAddToSelection(p, wxPG_SEL_DONT_SEND_EVENT);
+ }
+
+ /**
+ Removes given property from selection. If property is not selected,
+ an assertion failure will occur.
+ */
+ bool RemoveFromSelection( wxPGPropArg id )
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
+ return DoRemoveFromSelection(p, wxPG_SEL_DONT_SEND_EVENT);
+ }
+
+ /**
+ Makes given column editable by user.
+
+ @param editable
+ Using @false here will disable column from being editable.
+ */
+ void MakeColumnEditable( unsigned int column, bool editable = true );
+
+ /**
+ Creates label editor wxTextCtrl for given column, for property
+ that is currently selected. When multiple selection is
+ enabled, this applies to whatever property GetSelection()
+ returns.
+
+ @param colIndex
+ Which column's label to edit. Note that you should not
+ use value 1, which is reserved for property value
+ column.
+
+ @see EndLabelEdit(), MakeColumnEditable()
+ */
+ void BeginLabelEdit( unsigned int column = 0 )
+ {
+ DoBeginLabelEdit(column, wxPG_SEL_DONT_SEND_EVENT);
+ }
+
+ /**
+ Destroys label editor wxTextCtrl, if any.
+
+ @param commit
+ Use @true (default) to store edited label text in
+ property cell data.
+
+ @see BeginLabelEdit(), MakeColumnEditable()
+ */
+ void EndLabelEdit( bool commit = true )
+ {
+ DoEndLabelEdit(commit, wxPG_SEL_DONT_SEND_EVENT);
+ }
+
+ /**
+ Returns currently active label editor, NULL if none.
+ */
+ wxTextCtrl* GetLabelEditor() const
+ {
+ return m_labelEditor;
+ }
+
+ /** Sets category caption background colour. */
+ void SetCaptionBackgroundColour(const wxColour& col);
+
+ /** Sets category caption text colour. */
+ void SetCaptionTextColour(const wxColour& col);
+
+ /** Sets default cell background colour - applies to property cells.
+ Note that appearance of editor widgets may not be affected.
+ */
+ void SetCellBackgroundColour(const wxColour& col);
+
+ /** Sets cell text colour for disabled properties.
+ */
+ void SetCellDisabledTextColour(const wxColour& col);
+
+ /** Sets default cell text colour - applies to property name and value text.
+ Note that appearance of editor widgets may not be affected.
+ */
+ void SetCellTextColour(const wxColour& col);
+
+ /** Set number of columns (2 or more).
+ */
+ void SetColumnCount( int colCount )
+ {
+ m_pState->SetColumnCount(colCount);
+ Refresh();
+ }
+
+ /**
+ Sets the 'current' category - Append will add non-category properties
+ under it.
+ */
+ void SetCurrentCategory( wxPGPropArg id )
+ {
+ wxPG_PROP_ARG_CALL_PROLOG()
+ wxPropertyCategory* pc = wxDynamicCast(p, wxPropertyCategory);
+ wxASSERT(pc);
+ m_pState->m_currentCategory = pc;
+ }
+
+ /** Sets colour of empty space below properties. */
+ void SetEmptySpaceColour(const wxColour& col);
+
+ /** Sets colour of lines between cells. */
+ void SetLineColour(const wxColour& col);
+
+ /** Sets background colour of margin. */
+ void SetMarginColour(const wxColour& col);
+
+ /**
+ Sets selection background colour - applies to selected property name
+ background.
+ */
+ void SetSelectionBackgroundColour(const wxColour& col);
+
+ /**
+ Sets selection foreground colour - applies to selected property name
+ text.
+ */
+ void SetSelectionTextColour(const wxColour& col);
+
+ /** Sets x coordinate of the splitter.
+ @remarks
+ Splitter position cannot exceed grid size, and therefore setting it
+ during form creation may fail as initial grid size is often smaller
+ than desired splitter position, especially when sizers are being used.
+ */
+ void SetSplitterPosition( int newXPos, int col = 0 )
+ {
+ DoSetSplitterPosition(newXPos, col, wxPG_SPLITTER_REFRESH);
+ }
+
+ /**
+ Sets the property sorting function.
+
+ @param sortFunction
+ The sorting function to be used. It should return a value greater
+ than 0 if position of p1 is after p2. So, for instance, when
+ comparing property names, you can use following implementation:
+
+ @code
+ int MyPropertySortFunction(wxPropertyGrid* propGrid,
+ wxPGProperty* p1,
+ wxPGProperty* p2)
+ {
+ return p1->GetBaseName().compare( p2->GetBaseName() );
+ }
+ @endcode
+
+ @remarks
+ Default property sort function sorts properties by their labels
+ (case-insensitively).
+
+ @see GetSortFunction, wxPropertyGridInterface::Sort,
+ wxPropertyGridInterface::SortChildren
+ */
+ void SetSortFunction( wxPGSortCallback sortFunction )
+ {
+ m_sortFunction = sortFunction;
+ }
+
+ /**
+ Returns the property sort function (default is @NULL).
+
+ @see SetSortFunction
+ */
+ wxPGSortCallback GetSortFunction() const
+ {
+ return m_sortFunction;
+ }
+
+ /**
+ Sets appearance of value cells representing an unspecified property
+ value. Default appearance is blank.
+
+ @remarks If you set the unspecified value to have any
+ textual representation, then that will override
+ "InlineHelp" attribute.
+
+ @see wxPGProperty::SetValueToUnspecified(),
+ wxPGProperty::IsValueUnspecified()
+ */
+ void SetUnspecifiedValueAppearance( const wxPGCell& cell )
+ {
+ m_unspecifiedAppearance = m_propertyDefaultCell;
+ m_unspecifiedAppearance.MergeFrom(cell);
+ }
+
+ /**
+ Returns current appearance of unspecified value cells.
+
+ @see SetUnspecifiedValueAppearance()
+ */
+ const wxPGCell& GetUnspecifiedValueAppearance() const
+ {
+ return m_unspecifiedAppearance;
+ }
+
+ /**
+ Returns (visual) text representation of the unspecified
+ property value.
+
+ @param argFlags For internal use only.
+ */
+ wxString GetUnspecifiedValueText( int argFlags = 0 ) const;
+
+ /** Set virtual width for this particular page. Width -1 indicates that the
+ virtual width should be disabled. */
+ void SetVirtualWidth( int width );
+
+ /**
+ Moves splitter as left as possible, while still allowing all
+ labels to be shown in full.
+
+ @param privateChildrenToo
+ If @false, will still allow private children to be cropped.
+ */
+ void SetSplitterLeft( bool privateChildrenToo = false )
+ {
+ m_pState->SetSplitterLeft(privateChildrenToo);
+ }
+
+ /** Sets vertical spacing. Can be 1, 2, or 3 - a value relative to font
+ height. Value of 2 should be default on most platforms.
+ */
+ void SetVerticalSpacing( int vspacing )
+ {
+ m_vspacing = (unsigned char)vspacing;
+ CalculateFontAndBitmapStuff( vspacing );
+ if ( !m_pState->m_itemsAdded ) Refresh();
+ }
+
+ /** Shows an brief error message that is related to a property. */
+ void ShowPropertyError( wxPGPropArg id, const wxString& msg )
+ {
+ wxPG_PROP_ARG_CALL_PROLOG()
+ DoShowPropertyError(p, msg);
+ }
+
+ /////////////////////////////////////////////////////////////////
+ //
+ // Following methods do not need to be (currently) documented
+ //
+ /////////////////////////////////////////////////////////////////
+
+ bool HasVirtualWidth() const
+ { return (m_iFlags & wxPG_FL_HAS_VIRTUAL_WIDTH) ? true : false; }
+
+ const wxPGCommonValue* GetCommonValue( unsigned int i ) const
+ {
+ return (wxPGCommonValue*) m_commonValues[i];
+ }
+
+ /** Returns number of common values.
+ */
+ unsigned int GetCommonValueCount() const
+ {
+ return (unsigned int) m_commonValues.size();
+ }
+
+ /** Returns label of given common value.
+ */
+ wxString GetCommonValueLabel( unsigned int i ) const
+ {
+ wxASSERT( GetCommonValue(i) );
+ return GetCommonValue(i)->GetLabel();
+ }
+
+ /**
+ Returns index of common value that will truly change value to
+ unspecified.
+ */
+ int GetUnspecifiedCommonValue() const { return m_cvUnspecified; }
+
+ /** Set index of common value that will truly change value to unspecified.
+ Using -1 will set none to have such effect.
+ Default is 0.
+ */
+ void SetUnspecifiedCommonValue( int index ) { m_cvUnspecified = index; }
+
+ /**
+ Shortcut for creating dialog-caller button. Used, for example, by
+ wxFontProperty.
+ @remarks
+ This should only be called by properties.
+ */
+ wxWindow* GenerateEditorButton( const wxPoint& pos, const wxSize& sz );
+
+ /** Fixes position of wxTextCtrl-like control (wxSpinCtrl usually
+ fits as one). Call after control has been created (but before
+ shown).
+ */
+ void FixPosForTextCtrl( wxWindow* ctrl,
+ unsigned int forColumn = 1,
+ const wxPoint& offset = wxPoint(0, 0) );
+
+ /** Shortcut for creating text editor widget.
+ @param pos
+ Same as pos given for CreateEditor.
+ @param sz
+ Same as sz given for CreateEditor.
+ @param value
+ Initial text for wxTextCtrl.
+ @param secondary
+ If right-side control, such as button, also created, then create it
+ first and pass it as this parameter.
+ @param extraStyle
+ Extra style flags to pass for wxTextCtrl.
+ @remarks
+ Note that this should generally be called only by new classes derived
+ from wxPGProperty.
+ */
+ wxWindow* GenerateEditorTextCtrl( const wxPoint& pos,
+ const wxSize& sz,
+ const wxString& value,
+ wxWindow* secondary,
+ int extraStyle = 0,
+ int maxLen = 0,
+ unsigned int forColumn = 1 );
+
+ /* Generates both textctrl and button.
+ */
+ wxWindow* GenerateEditorTextCtrlAndButton( const wxPoint& pos,
+ const wxSize& sz, wxWindow** psecondary, int limited_editing,
+ wxPGProperty* property );
+
+ /** Generates position for a widget editor dialog box.
+ @param p
+ Property for which dialog is positioned.
+ @param sz
+ Known or over-approximated size of the dialog.
+ @return
+ Position for dialog.
+ */
+ wxPoint GetGoodEditorDialogPosition( wxPGProperty* p,
+ const wxSize& sz );
+
+ // Converts escape sequences in src_str to newlines,
+ // tabs, etc. and copies result to dst_str.
+ static wxString& ExpandEscapeSequences( wxString& dst_str,
+ wxString& src_str );
+
+ // Converts newlines, tabs, etc. in src_str to escape
+ // sequences, and copies result to dst_str.
+ static wxString& CreateEscapeSequences( wxString& dst_str,
+ wxString& src_str );
+
+ /**
+ Returns rectangle that fully contains properties between and including
+ p1 and p2. Rectangle is in virtual scrolled window coordinates.
+ */
+ wxRect GetPropertyRect( const wxPGProperty* p1,
+ const wxPGProperty* p2 ) const;
+
+ /** Returns pointer to current active primary editor control (NULL if none).
+ */
+ wxWindow* GetEditorControl() const;
+
+ wxWindow* GetPrimaryEditor() const
+ {
+ return GetEditorControl();
+ }
+
+ /**
+ Returns pointer to current active secondary editor control (NULL if
+ none).
+ */
+ wxWindow* GetEditorControlSecondary() const
+ {
+ return m_wndEditor2;
+ }
+
+ /**
+ Refreshes any active editor control.
+ */
+ void RefreshEditor();
+
+ // Events from editor controls are forward to this function
+ bool HandleCustomEditorEvent( wxEvent &event );
+
+ // Mostly useful for page switching.
+ void SwitchState( wxPropertyGridPageState* pNewState );
+
+ long GetInternalFlags() const { return m_iFlags; }
+ bool HasInternalFlag( long flag ) const
+ { return (m_iFlags & flag) ? true : false; }
+ void SetInternalFlag( long flag ) { m_iFlags |= flag; }
+ void ClearInternalFlag( long flag ) { m_iFlags &= ~(flag); }
+ void IncFrozen() { m_frozen++; }
+ void DecFrozen() { m_frozen--; }
+
+ void OnComboItemPaint( const wxPGComboBox* pCb,
+ int item,
+ wxDC* pDc,
+ wxRect& rect,
+ int flags );
+
+ /** Standardized double-to-string conversion.
+ */
+ static const wxString& DoubleToString( wxString& target,
+ double value,
+ int precision,
+ bool removeZeroes,
+ wxString* precTemplate = NULL );
+
+ /**
+ Call this from wxPGProperty::OnEvent() to cause property value to be
+ changed after the function returns (with true as return value).
+ ValueChangeInEvent() must be used if you wish the application to be
+ able to use wxEVT_PG_CHANGING to potentially veto the given value.
+ */
+ void ValueChangeInEvent( wxVariant variant )
+ {
+ m_changeInEventValue = variant;
+ m_iFlags |= wxPG_FL_VALUE_CHANGE_IN_EVENT;
+ }
+
+ /**
+ You can use this member function, for instance, to detect in
+ wxPGProperty::OnEvent() if wxPGProperty::SetValueInEvent() was
+ already called in wxPGEditor::OnEvent(). It really only detects
+ if was value was changed using wxPGProperty::SetValueInEvent(), which
+ is usually used when a 'picker' dialog is displayed. If value was
+ written by "normal means" in wxPGProperty::StringToValue() or
+ IntToValue(), then this function will return false (on the other hand,
+ wxPGProperty::OnEvent() is not even called in those cases).
+ */
+ bool WasValueChangedInEvent() const
+ {
+ return (m_iFlags & wxPG_FL_VALUE_CHANGE_IN_EVENT) ? true : false;
+ }
+
+ /** Returns true if given event is from first of an array of buttons
+ (as can be in case when wxPGMultiButton is used).
+ */
+ bool IsMainButtonEvent( const wxEvent& event )
+ {
+ return (event.GetEventType() == wxEVT_BUTTON)
+ && (m_wndSecId == event.GetId());
+ }
+
+ /** Pending value is expected to be passed in PerformValidation().
+ */
+ virtual bool DoPropertyChanged( wxPGProperty* p,
+ unsigned int selFlags = 0 );
+
+ /** Called when validation for given property fails.
+ @param invalidValue
+ Value which failed in validation.
+ @return
+ Return true if user is allowed to change to another property even
+ if current has invalid value.
+ @remarks
+ To add your own validation failure behaviour, override
+ wxPropertyGrid::DoOnValidationFailure().
+ */
+ bool OnValidationFailure( wxPGProperty* property,
+ wxVariant& invalidValue );
+
+ /** Called to indicate property and editor has valid value now.
+ */
+ void OnValidationFailureReset( wxPGProperty* property )
+ {
+ if ( property && property->HasFlag(wxPG_PROP_INVALID_VALUE) )
+ {
+ DoOnValidationFailureReset(property);
+ property->ClearFlag(wxPG_PROP_INVALID_VALUE);
+ }
+ m_validationInfo.m_failureMessage.clear();
+ }
+
+ /**
+ Override in derived class to display error messages in custom manner
+ (these message usually only result from validation failure).
+
+ @remarks If you implement this, then you also need to implement
+ DoHidePropertyError() - possibly to do nothing, if error
+ does not need hiding (e.g. it was logged or shown in a
+ message box).
+
+ @see DoHidePropertyError()
+ */
+ virtual void DoShowPropertyError( wxPGProperty* property,
+ const wxString& msg );
+
+ /**
+ Override in derived class to hide an error displayed by
+ DoShowPropertyError().
+
+ @see DoShowPropertyError()
+ */
+ virtual void DoHidePropertyError( wxPGProperty* property );
+
+#if wxUSE_STATUSBAR
+ /**
+ Return wxStatusBar that is used by this wxPropertyGrid. You can
+ reimplement this member function in derived class to override
+ the default behaviour of using the top-level wxFrame's status
+ bar, if any.
+ */
+ virtual wxStatusBar* GetStatusBar();
+#endif
+
+ /** Override to customize property validation failure behaviour.
+ @param invalidValue
+ Value which failed in validation.
+ @return
+ Return true if user is allowed to change to another property even
+ if current has invalid value.
+ */
+ virtual bool DoOnValidationFailure( wxPGProperty* property,
+ wxVariant& invalidValue );
+
+ /** Override to customize resetting of property validation failure status.
+ @remarks
+ Property is guaranteed to have flag wxPG_PROP_INVALID_VALUE set.
+ */
+ virtual void DoOnValidationFailureReset( wxPGProperty* property );
+
+ int GetSpacingY() const { return m_spacingy; }
+
+ /**
+ Must be called in wxPGEditor::CreateControls() if primary editor window
+ is wxTextCtrl, just before textctrl is created.
+ @param text
+ Initial text value of created wxTextCtrl.
+ */
+ void SetupTextCtrlValue( const wxString text ) { m_prevTcValue = text; }
+
+ /**
+ Unfocuses or closes editor if one was open, but does not deselect
+ property.
+ */
+ bool UnfocusEditor();
+
+ virtual void SetWindowStyleFlag( long style );
+
+ void DrawItems( const wxPGProperty* p1, const wxPGProperty* p2 );
+
+ void DrawItem( wxPGProperty* p )
+ {
+ DrawItems(p,p);
+ }
+
+ virtual void DrawItemAndChildren( wxPGProperty* p );
+
+ /**
+ Draws item, children, and consequtive parents as long as category is
+ not met.
+ */
+ void DrawItemAndValueRelated( wxPGProperty* p );
+
+protected:
+
+ /**
+ wxPropertyGridPageState used by the grid is created here.
+
+ If grid is used in wxPropertyGridManager, there is no point overriding
+ this - instead, set custom wxPropertyGridPage classes.
+ */
+ virtual wxPropertyGridPageState* CreateState() const;
+
+ enum PerformValidationFlags
+ {
+ SendEvtChanging = 0x0001,
+ IsStandaloneValidation = 0x0002 // Not called in response to event
+ };
+
+ /**
+ Runs all validation functionality (includes sending wxEVT_PG_CHANGING).
+ Returns true if all tests passed. Implement in derived class to
+ add additional validation behaviour.
+ */
+ virtual bool PerformValidation( wxPGProperty* p,
+ wxVariant& pendingValue,
+ int flags = SendEvtChanging );
+
+public:
+
+ // Control font changer helper.
+ void SetCurControlBoldFont();
+
+ wxPGCell& GetPropertyDefaultCell()
+ {
+ return m_propertyDefaultCell;
+ }
+
+ wxPGCell& GetCategoryDefaultCell()
+ {
+ return m_categoryDefaultCell;
+ }
+
+ //
+ // Public methods for semi-public use
+ //
+ bool DoSelectProperty( wxPGProperty* p, unsigned int flags = 0 );
+
+ // Overridden functions.
+ virtual bool Destroy();
+ // Returns property at given y coordinate (relative to grid's top left).
+ wxPGProperty* GetItemAtY( int y ) const { return DoGetItemAtY(y); }
+
+ virtual void Refresh( bool eraseBackground = true,
+ const wxRect *rect = (const wxRect *) NULL );
+ virtual bool SetFont( const wxFont& font );
+ virtual void Freeze();
+ virtual void SetExtraStyle( long exStyle );
+ virtual void Thaw();
+ virtual bool Reparent( wxWindowBase *newParent );
+
+protected:
+ virtual wxSize DoGetBestSize() const;
+
+#ifndef wxPG_ICON_WIDTH
+ wxBitmap *m_expandbmp, *m_collbmp;
+#endif
+
+ wxCursor *m_cursorSizeWE;
+
+ /** wxWindow pointers to editor control(s). */
+ wxWindow *m_wndEditor;
+ wxWindow *m_wndEditor2;
+
+ wxBitmap *m_doubleBuffer;
+
+ /** Local time ms when control was created. */
+ wxLongLong m_timeCreated;
+
+ /** wxPGProperty::OnEvent can change value by setting this. */
+ wxVariant m_changeInEventValue;
+
+ /** Id of m_wndEditor2, or its first child, if any. */
+ int m_wndSecId;
+
+ /** Extra Y spacing between the items. */
+ int m_spacingy;
+
+ /** Control client area width; updated on resize. */
+ int m_width;
+
+ /** Control client area height; updated on resize. */
+ int m_height;
+
+ /** Current non-client width (needed when auto-centering). */
+ int m_ncWidth;
+
+ /** Non-client width (auto-centering helper). */
+ //int m_fWidth;
+
+ /** Previously recorded scroll start position. */
+ int m_prevVY;
+
+ /**
+ The gutter spacing in front and back of the image.
+ This determines the amount of spacing in front of each item
+ */
+ int m_gutterWidth;
+
+ /** Includes separator line. */
+ int m_lineHeight;
+
+ /** Gutter*2 + image width. */
+ int m_marginWidth;
+
+ // y spacing for expand/collapse button.
+ int m_buttonSpacingY;
+
+ /** Extra margin for expanded sub-group items. */
+ int m_subgroup_extramargin;
+
+ /**
+ The image width of the [+] icon.
+
+ This is also calculated in the gutter
+ */
+ int m_iconWidth;
+
+#ifndef wxPG_ICON_WIDTH
+
+ /**
+ The image height of the [+] icon.
+
+ This is calculated as minimal size and to align
+ */
+ int m_iconHeight;
+#endif
+
+ /** Current cursor id. */
+ int m_curcursor;
+
+ // Caption font. Same as normal font plus bold style.
+ wxFont m_captionFont;
+
+ int m_fontHeight; // Height of the font.
+
+ /** m_splitterx when drag began. */
+ int m_startingSplitterX;
+
+ /**
+ Index to splitter currently being dragged (0=one after the first
+ column).
+ */
+ int m_draggedSplitter;
+
+ /** Changed property, calculated in PerformValidation(). */
+ wxPGProperty* m_chgInfo_changedProperty;
+
+ /**
+ Lowest property for which editing happened, but which does not have
+ aggregate parent
+ */
+ wxPGProperty* m_chgInfo_baseChangedProperty;
+
+ /** Changed property value, calculated in PerformValidation(). */
+ wxVariant m_chgInfo_pendingValue;
+
+ /** Passed to SetValue. */
+ wxVariant m_chgInfo_valueList;
+
+ /** Validation information. */
+ wxPGValidationInfo m_validationInfo;
+
+ /** Actions and keys that trigger them. */
+ wxPGHashMapI2I m_actionTriggers;
+
+ /** Appearance of currently active editor. */
+ wxPGCell m_editorAppearance;
+
+ /** Appearance of a unspecified value cell. */
+ wxPGCell m_unspecifiedAppearance;
+
+ /** List of properties to be deleted/removed in idle event handler. */
+ wxArrayPGProperty m_deletedProperties;
+ wxArrayPGProperty m_removedProperties;
+
+ /** List of key codes that will not be handed over to editor controls. */
+ // FIXME: Make this a hash set once there is template-based wxHashSet.
+ wxVector<int> m_dedicatedKeys;
+
+ //
+ // Temporary values
+ //
+
+ /** Bits are used to indicate which colours are customized. */
+ unsigned short m_coloursCustomized;
+
+ /** x - m_splitterx. */
+ signed char m_dragOffset;
+
+ /** 0 = not dragging, 1 = drag just started, 2 = drag in progress */
+ unsigned char m_dragStatus;
+
+ /** 0 = margin, 1 = label, 2 = value. */
+ unsigned char m_mouseSide;
+
+ /** True when editor control is focused. */
+ unsigned char m_editorFocused;
+
+ /** 1 if m_latsCaption is also the bottommost caption. */
+ //unsigned char m_lastCaptionBottomnest;
+
+ /** Set to 1 when graphics frozen. */
+ unsigned char m_frozen;
+
+ unsigned char m_vspacing;
+
+ // Used to track when Alt/Ctrl+Key was consumed.
+ unsigned char m_keyComboConsumed;
+
+ /** 1 if in DoPropertyChanged() */
+ bool m_inDoPropertyChanged;
+
+ /** 1 if in CommitChangesFromEditor() */
+ bool m_inCommitChangesFromEditor;
+
+ /** 1 if in DoSelectProperty() */
+ bool m_inDoSelectProperty;
+
+ bool m_inOnValidationFailure;
+
+ wxPGVFBFlags m_permanentValidationFailureBehavior; // Set by app
+
+ // DoEditorValidate() recursion guard
+ wxRecursionGuardFlag m_validatingEditor;
+
+ /** Internal flags - see wxPG_FL_XXX constants. */
+ wxUint32 m_iFlags;
+
+ /** When drawing next time, clear this many item slots at the end. */
+ int m_clearThisMany;
+
+ // Mouse is hovering over this column (index)
+ unsigned int m_colHover;
+
+ // pointer to property that has mouse hovering
+ wxPGProperty* m_propHover;
+
+ // Active label editor
+ wxTextCtrl* m_labelEditor;
+
+ // For which property the label editor is active
+ wxPGProperty* m_labelEditorProperty;
+
+ // EventObject for wxPropertyGridEvents
+ wxWindow* m_eventObject;
+
+ // What (global) window is currently focused (needed to resolve event
+ // handling mess).
+ wxWindow* m_curFocused;
+
+ // Event currently being sent - NULL if none at the moment
+ wxPropertyGridEvent* m_processedEvent;
+
+ // Last known top-level parent
+ wxWindow* m_tlp;
+
+ // Last closed top-level parent
+ wxWindow* m_tlpClosed;
+
+ // Local time ms when tlp was closed.
+ wxLongLong m_tlpClosedTime;
+
+ // Sort function
+ wxPGSortCallback m_sortFunction;
+
+ // y coordinate of property that mouse hovering
+ int m_propHoverY;
+
+ // Which column's editor is selected (usually 1)?
+ unsigned int m_selColumn;
+
+ // x relative to splitter (needed for resize).
+ int m_ctrlXAdjust;
+
+ // lines between cells
+ wxColour m_colLine;
+ // property labels and values are written in this colour
+ wxColour m_colPropFore;
+ // or with this colour when disabled
+ wxColour m_colDisPropFore;
+ // background for m_colPropFore
+ wxColour m_colPropBack;
+ // text color for captions
+ wxColour m_colCapFore;
+ // background color for captions
+ wxColour m_colCapBack;
+ // foreground for selected property
+ wxColour m_colSelFore;
+ // background for selected property (actually use background color when
+ // control out-of-focus)
+ wxColour m_colSelBack;
+ // background colour for margin
+ wxColour m_colMargin;
+ // background colour for empty space below the grid
+ wxColour m_colEmptySpace;
+
+ // Default property colours
+ wxPGCell m_propertyDefaultCell;
+
+ // Default property category
+ wxPGCell m_categoryDefaultCell;
+
+ // Backup of selected property's cells
+ wxVector<wxPGCell> m_propCellsBackup;
+
+ // NB: These *cannot* be moved to globals.
+
+ // labels when properties use common values
+ wxVector<wxPGCommonValue*> m_commonValues;
+
+ // array of live events
+ wxVector<wxPropertyGridEvent*> m_liveEvents;
+
+ // Which cv selection really sets value to unspecified?
+ int m_cvUnspecified;
+
+ // Used to skip excess text editor events
+ wxString m_prevTcValue;
+
+protected:
+
+ // Sets some members to defaults (called constructors).
+ void Init1();
+
+ // Initializes some members (called by Create and complex constructor).
+ void Init2();
+
+ void OnPaint(wxPaintEvent &event );
+
+ // main event receivers
+ void OnMouseMove( wxMouseEvent &event );
+ void OnMouseClick( wxMouseEvent &event );
+ void OnMouseRightClick( wxMouseEvent &event );
+ void OnMouseDoubleClick( wxMouseEvent &event );
+ void OnMouseUp( wxMouseEvent &event );
+ void OnKey( wxKeyEvent &event );
+ void OnResize( wxSizeEvent &event );
+
+ // event handlers
+ bool HandleMouseMove( int x, unsigned int y, wxMouseEvent &event );
+ bool HandleMouseClick( int x, unsigned int y, wxMouseEvent &event );
+ bool HandleMouseRightClick( int x, unsigned int y, wxMouseEvent &event );
+ bool HandleMouseDoubleClick( int x, unsigned int y, wxMouseEvent &event );
+ bool HandleMouseUp( int x, unsigned int y, wxMouseEvent &event );
+ void HandleKeyEvent( wxKeyEvent &event, bool fromChild );
+
+ void OnMouseEntry( wxMouseEvent &event );
+
+ void OnIdle( wxIdleEvent &event );
+ void OnFocusEvent( wxFocusEvent &event );
+ void OnChildFocusEvent( wxChildFocusEvent& event );
+
+ bool OnMouseCommon( wxMouseEvent &event, int* px, int *py );
+ bool OnMouseChildCommon( wxMouseEvent &event, int* px, int *py );
+
+ // sub-control event handlers
+ void OnMouseClickChild( wxMouseEvent &event );
+ void OnMouseRightClickChild( wxMouseEvent &event );
+ void OnMouseMoveChild( wxMouseEvent &event );
+ void OnMouseUpChild( wxMouseEvent &event );
+ void OnChildKeyDown( wxKeyEvent &event );
+
+ void OnCaptureChange( wxMouseCaptureChangedEvent &event );
+
+ void OnScrollEvent( wxScrollWinEvent &event );
+
+ void OnSysColourChanged( wxSysColourChangedEvent &event );
+
+ void OnTLPClose( wxCloseEvent& event );
+
+protected:
+
+ bool AddToSelectionFromInputEvent( wxPGProperty* prop,
+ unsigned int colIndex,
+ wxMouseEvent* event = NULL,
+ int selFlags = 0 );
+
+ /**
+ Adjust the centering of the bitmap icons (collapse / expand) when the
+ caption font changes.
+
+ They need to be centered in the middle of the font, so a bit of deltaY
+ adjustment is needed. On entry, m_captionFont must be set to window
+ font. It will be modified properly.
+ */
+ void CalculateFontAndBitmapStuff( int vspacing );
+
+ wxRect GetEditorWidgetRect( wxPGProperty* p, int column ) const;
+
+ void CorrectEditorWidgetSizeX();
+
+ /** Called in RecalculateVirtualSize() to reposition control
+ on virtual height changes.
+ */
+ void CorrectEditorWidgetPosY();
+
+ int DoDrawItems( wxDC& dc,
+ const wxRect* itemsRect,
+ bool isBuffered ) const;
+
+ /** Draws an expand/collapse (ie. +/-) button.
+ */
+ virtual void DrawExpanderButton( wxDC& dc, const wxRect& rect,
+ wxPGProperty* property ) const;
+
+ /** Draws items from topitemy to bottomitemy */
+ void DrawItems( wxDC& dc,
+ unsigned int topItemY,
+ unsigned int bottomItemY,
+ const wxRect* itemsRect = NULL );
+
+ // Translate wxKeyEvent to wxPG_ACTION_XXX
+ int KeyEventToActions(wxKeyEvent &event, int* pSecond) const;
+
+ int KeyEventToAction(wxKeyEvent &event) const
+ {
+ return KeyEventToActions(event, NULL);
+ }
+
+ void ImprovedClientToScreen( int* px, int* py );
+
+ // Called by focus event handlers. newFocused is the window that becomes
+ // focused.
+ void HandleFocusChange( wxWindow* newFocused );
+
+ /** Reloads all non-customized colours from system settings. */
+ void RegainColours();
+
+ virtual bool DoEditorValidate();
+
+ // Similar to DoSelectProperty() but also works on columns
+ // other than 1. Does not active editor if column is not
+ // editable.
+ bool DoSelectAndEdit( wxPGProperty* prop,
+ unsigned int colIndex,
+ unsigned int selFlags );
+
+ void DoSetSelection( const wxArrayPGProperty& newSelection,
+ int selFlags = 0 );
+
+ void DoSetSplitterPosition( int newxpos,
+ int splitterIndex = 0,
+ int flags = wxPG_SPLITTER_REFRESH );
+
+ bool DoAddToSelection( wxPGProperty* prop,
+ int selFlags = 0 );
+
+ bool DoRemoveFromSelection( wxPGProperty* prop,
+ int selFlags = 0 );
+
+ void DoBeginLabelEdit( unsigned int colIndex, int selFlags = 0 );
+ void DoEndLabelEdit( bool commit, int selFlags = 0 );
+ void OnLabelEditorEnterPress( wxCommandEvent& event );
+ void OnLabelEditorKeyPress( wxKeyEvent& event );
+
+ wxPGProperty* DoGetItemAtY( int y ) const;
+
+ void DestroyEditorWnd( wxWindow* wnd );
+ void FreeEditors();
+
+ virtual bool DoExpand( wxPGProperty* p, bool sendEvent = false );
+
+ virtual bool DoCollapse( wxPGProperty* p, bool sendEvent = false );
+
+ // Returns nearest paint visible property (such that will be painted unless
+ // window is scrolled or resized). If given property is paint visible, then
+ // it itself will be returned.
+ wxPGProperty* GetNearestPaintVisible( wxPGProperty* p ) const;
+
+ static void RegisterDefaultEditors();
+
+ // Sets up basic event handling for child control
+ void SetupChildEventHandling( wxWindow* wnd );
+
+ void CustomSetCursor( int type, bool override = false );
+
+ /**
+ Repositions scrollbar and underlying panel according to changed virtual
+ size.
+ */
+ void RecalculateVirtualSize( int forceXPos = -1 );
+
+ void SetEditorAppearance( const wxPGCell& cell,
+ bool unspecified = false );
+
+ void ResetEditorAppearance()
+ {
+ wxPGCell cell;
+ cell.SetEmptyData();
+ SetEditorAppearance(cell, false);
+ }
+
+ void PrepareAfterItemsAdded();
+
+ /**
+ Send event from the property grid.
+
+ Omit the wxPG_SEL_NOVALIDATE flag to allow vetoing the event
+ */
+ bool SendEvent( int eventType, wxPGProperty* p,
+ wxVariant* pValue = NULL,
+ unsigned int selFlags = wxPG_SEL_NOVALIDATE,
+ unsigned int column = 1 );
+
+ // This function only moves focus to the wxPropertyGrid if it already
+ // was on one of its child controls.
+ void SetFocusOnCanvas();
+
+ bool DoHideProperty( wxPGProperty* p, bool hide, int flags );
+
+private:
+
+ bool ButtonTriggerKeyTest( int action, wxKeyEvent& event );
+
+ DECLARE_EVENT_TABLE()
+};
+
+// -----------------------------------------------------------------------
+//
+// Bunch of inlines that need to resolved after all classes have been defined.
+//
+
+inline bool wxPropertyGridPageState::IsDisplayed() const
+{
+ return ( this == m_pPropGrid->GetState() );
+}
+
+inline unsigned int wxPropertyGridPageState::GetActualVirtualHeight() const
+{
+ return DoGetRoot()->GetChildrenHeight(GetGrid()->GetRowHeight());
+}
+
+inline wxString wxPGProperty::GetHintText() const
+{
+ wxVariant vHintText = GetAttribute(wxPGGlobalVars->m_strHint);
+
+#if wxPG_COMPATIBILITY_1_4
+ // Try the old, deprecated "InlineHelp"
+ if ( vHintText.IsNull() )
+ vHintText = GetAttribute(wxPGGlobalVars->m_strInlineHelp);
+#endif
+
+ if ( !vHintText.IsNull() )
+ return vHintText.GetString();
+
+ return wxEmptyString;
+}
+
+inline int wxPGProperty::GetDisplayedCommonValueCount() const
+{
+ if ( HasFlag(wxPG_PROP_USES_COMMON_VALUE) )
+ {
+ wxPropertyGrid* pg = GetGrid();
+ if ( pg )
+ return (int) pg->GetCommonValueCount();
+ }
+ return 0;
+}
+
+inline void wxPGProperty::SetDefaultValue( wxVariant& value )
+{
+ SetAttribute(wxPG_ATTR_DEFAULT_VALUE, value);
+}
+
+inline void wxPGProperty::SetEditor( const wxString& editorName )
+{
+ m_customEditor = wxPropertyGridInterface::GetEditorByName(editorName);
+}
+
+inline bool wxPGProperty::SetMaxLength( int maxLen )
+{
+ return GetGrid()->SetPropertyMaxLength(this,maxLen);
+}
+
+// -----------------------------------------------------------------------
+
+#define wxPG_BASE_EVT_PRE_ID 1775
+
+#ifndef SWIG
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_SELECTED, wxPropertyGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_CHANGING, wxPropertyGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_CHANGED, wxPropertyGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_HIGHLIGHTED, wxPropertyGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_RIGHT_CLICK, wxPropertyGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_PAGE_CHANGED, wxPropertyGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_ITEM_COLLAPSED, wxPropertyGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_ITEM_EXPANDED, wxPropertyGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_DOUBLE_CLICK, wxPropertyGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID,
+ wxEVT_PG_LABEL_EDIT_BEGIN, wxPropertyGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID,
+ wxEVT_PG_LABEL_EDIT_ENDING, wxPropertyGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID,
+ wxEVT_PG_COL_BEGIN_DRAG, wxPropertyGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID,
+ wxEVT_PG_COL_DRAGGING, wxPropertyGridEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID,
+ wxEVT_PG_COL_END_DRAG, wxPropertyGridEvent );
+
+#else
+ enum {
+ wxEVT_PG_SELECTED = wxPG_BASE_EVT_PRE_ID,
+ wxEVT_PG_CHANGING,
+ wxEVT_PG_CHANGED,
+ wxEVT_PG_HIGHLIGHTED,
+ wxEVT_PG_RIGHT_CLICK,
+ wxEVT_PG_PAGE_CHANGED,
+ wxEVT_PG_ITEM_COLLAPSED,
+ wxEVT_PG_ITEM_EXPANDED,
+ wxEVT_PG_DOUBLE_CLICK,
+ wxEVT_PG_LABEL_EDIT_BEGIN,
+ wxEVT_PG_LABEL_EDIT_ENDING,
+ wxEVT_PG_COL_BEGIN_DRAG,
+ wxEVT_PG_COL_DRAGGING,
+ wxEVT_PG_COL_END_DRAG
+ };
+#endif
+
+
+#define wxPG_BASE_EVT_TYPE wxEVT_PG_SELECTED
+#define wxPG_MAX_EVT_TYPE (wxPG_BASE_EVT_TYPE+30)
+
+
+#ifndef SWIG
+typedef void (wxEvtHandler::*wxPropertyGridEventFunction)(wxPropertyGridEvent&);
+
+#define EVT_PG_SELECTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_SELECTED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
+#define EVT_PG_CHANGING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_CHANGING, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
+#define EVT_PG_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_CHANGED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
+#define EVT_PG_HIGHLIGHTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_HIGHLIGHTED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
+#define EVT_PG_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_RIGHT_CLICK, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
+#define EVT_PG_DOUBLE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_DOUBLE_CLICK, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
+#define EVT_PG_PAGE_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_PAGE_CHANGED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
+#define EVT_PG_ITEM_COLLAPSED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_ITEM_COLLAPSED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
+#define EVT_PG_ITEM_EXPANDED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_ITEM_EXPANDED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
+#define EVT_PG_LABEL_EDIT_BEGIN(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_LABEL_EDIT_BEGIN, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
+#define EVT_PG_LABEL_EDIT_ENDING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_LABEL_EDIT_ENDING, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
+#define EVT_PG_COL_BEGIN_DRAG(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_COL_BEGIN_DRAG, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
+#define EVT_PG_COL_DRAGGING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_COL_DRAGGING, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
+#define EVT_PG_COL_END_DRAG(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_COL_END_DRAG, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
+
+#define wxPropertyGridEventHandler(fn) \
+ wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn )
+
+#endif
+
+
+/** @class wxPropertyGridEvent
+
+ A propertygrid event holds information about events associated with
+ wxPropertyGrid objects.
+
+ @library{wxpropgrid}
+ @category{propgrid}
+*/
+class WXDLLIMPEXP_PROPGRID wxPropertyGridEvent : public wxCommandEvent
+{
+public:
+
+ /** Constructor. */
+ wxPropertyGridEvent(wxEventType commandType=0, int id=0);
+
+ /** Copy constructor. */
+ wxPropertyGridEvent(const wxPropertyGridEvent& event);
+
+ /** Destructor. */
+ ~wxPropertyGridEvent();
+
+ /** Copyer. */
+ virtual wxEvent* Clone() const;
+
+ /**
+ Returns the column index associated with this event.
+ For the column dragging events, it is the column to the left
+ of the splitter being dragged
+ */
+ unsigned int GetColumn() const
+ {
+ return m_column;
+ }
+
+ wxPGProperty* GetMainParent() const
+ {
+ wxASSERT(m_property);
+ return m_property->GetMainParent();
+ }
+
+ /** Returns id of associated property. */
+ wxPGProperty* GetProperty() const
+ {
+ return m_property;
+ }
+
+ wxPGValidationInfo& GetValidationInfo()
+ {
+ wxASSERT(m_validationInfo);
+ return *m_validationInfo;
+ }
+
+ /** Returns true if you can veto the action that the event is signaling.
+ */
+ bool CanVeto() const { return m_canVeto; }
+
+ /**
+ Call this from your event handler to veto action that the event is
+ signaling.
+
+ You can only veto a shutdown if wxPropertyGridEvent::CanVeto returns
+ true.
+ @remarks
+ Currently only wxEVT_PG_CHANGING supports vetoing.
+ */
+ void Veto( bool veto = true ) { m_wasVetoed = veto; }
+
+ /**
+ Returns name of the associated property.
+
+ @remarks Property name is stored in event, so it remains
+ accessible even after the associated property or
+ the property grid has been deleted.
+ */
+ wxString GetPropertyName() const
+ {
+ return m_propertyName;
+ }
+
+ /**
+ Returns value of the associated property. Works for all event
+ types, but for wxEVT_PG_CHANGING this member function returns
+ the value that is pending, so you can call Veto() if the
+ value is not satisfactory.
+
+ @remarks Property value is stored in event, so it remains
+ accessible even after the associated property or
+ the property grid has been deleted.
+ */
+ wxVariant GetPropertyValue() const
+ {
+ if ( m_validationInfo )
+ return m_validationInfo->GetValue();
+ return m_value;
+ }
+
+ /**
+ Returns value of the associated property.
+
+ @see GetPropertyValue
+ */
+ wxVariant GetValue() const
+ {
+ return GetPropertyValue();
+ }
+
+ /**
+ Set override validation failure behaviour.
+
+ Only effective if Veto was also called, and only allowed if event type
+ is wxEVT_PG_CHANGING.
+ */
+ void SetValidationFailureBehavior( wxPGVFBFlags flags )
+ {
+ wxASSERT( GetEventType() == wxEVT_PG_CHANGING );
+ m_validationInfo->SetFailureBehavior( flags );
+ }
+
+ /** Sets custom failure message for this time only. Only applies if
+ wxPG_VFB_SHOW_MESSAGE is set in validation failure flags.
+ */
+ void SetValidationFailureMessage( const wxString& message )
+ {
+ wxASSERT( GetEventType() == wxEVT_PG_CHANGING );
+ m_validationInfo->SetFailureMessage( message );
+ }
+
+ wxPGVFBFlags GetValidationFailureBehavior() const
+ {
+ wxASSERT( GetEventType() == wxEVT_PG_CHANGING );
+ return m_validationInfo->GetFailureBehavior();
+ }
+
+ void SetColumn( unsigned int column )
+ {
+ m_column = column;
+ }
+
+ void SetCanVeto( bool canVeto ) { m_canVeto = canVeto; }
+ bool WasVetoed() const { return m_wasVetoed; }
+
+ /** Changes the associated property. */
+ void SetProperty( wxPGProperty* p )
+ {
+ m_property = p;
+ if ( p )
+ m_propertyName = p->GetName();
+ }
+
+ void SetPropertyValue( wxVariant value )
+ {
+ m_value = value;
+ }
+
+ void SetPropertyGrid( wxPropertyGrid* pg )
+ {
+ m_pg = pg;
+ OnPropertyGridSet();
+ }
+
+ void SetupValidationInfo()
+ {
+ wxASSERT(m_pg);
+ wxASSERT( GetEventType() == wxEVT_PG_CHANGING );
+ m_validationInfo = &m_pg->GetValidationInfo();
+ m_value = m_validationInfo->GetValue();
+ }
+
+private:
+ void Init();
+ void OnPropertyGridSet();
+ DECLARE_DYNAMIC_CLASS(wxPropertyGridEvent)
+
+ wxPGProperty* m_property;
+ wxPropertyGrid* m_pg;
+ wxPGValidationInfo* m_validationInfo;
+
+ wxString m_propertyName;
+ wxVariant m_value;
+
+ unsigned int m_column;
+
+ bool m_canVeto;
+ bool m_wasVetoed;
+};
+
+
+// -----------------------------------------------------------------------
+
+/** @class wxPropertyGridPopulator
+ @ingroup classes
+ Allows populating wxPropertyGrid from arbitrary text source.
+*/
+class WXDLLIMPEXP_PROPGRID wxPropertyGridPopulator
+{
+public:
+ /** Default constructor.
+ */
+ wxPropertyGridPopulator();
+
+ /** Destructor. */
+ virtual ~wxPropertyGridPopulator();
+
+ void SetState( wxPropertyGridPageState* state );
+
+ void SetGrid( wxPropertyGrid* pg );
+
+ /** Appends a new property under bottommost parent.
+ @param propClass
+ Property class as string.
+ */
+ wxPGProperty* Add( const wxString& propClass,
+ const wxString& propLabel,
+ const wxString& propName,
+ const wxString* propValue,
+ wxPGChoices* pChoices = NULL );
+
+ /**
+ Pushes property to the back of parent array (ie it becomes bottommost
+ parent), and starts scanning/adding children for it.
+
+ When finished, parent array is returned to the original state.
+ */
+ void AddChildren( wxPGProperty* property );
+
+ /** Adds attribute to the bottommost property.
+ @param type
+ Allowed values: "string", (same as string), "int", "bool". Empty string
+ mean autodetect.
+ */
+ bool AddAttribute( const wxString& name,
+ const wxString& type,
+ const wxString& value );
+
+ /** Called once in AddChildren.
+ */
+ virtual void DoScanForChildren() = 0;
+
+ /**
+ Returns id of parent property for which children can currently be
+ added.
+ */
+ wxPGProperty* GetCurParent() const
+ {
+ return (wxPGProperty*) m_propHierarchy[m_propHierarchy.size()-1];
+ }
+
+ wxPropertyGridPageState* GetState() { return m_state; }
+ const wxPropertyGridPageState* GetState() const { return m_state; }
+
+ /** Like wxString::ToLong, except allows N% in addition of N.
+ */
+ static bool ToLongPCT( const wxString& s, long* pval, long max );
+
+ /** Parses strings of format "choice1"[=value1] ... "choiceN"[=valueN] into
+ wxPGChoices. Registers parsed result using idString (if not empty).
+ Also, if choices with given id already registered, then don't parse but
+ return those choices instead.
+ */
+ wxPGChoices ParseChoices( const wxString& choicesString,
+ const wxString& idString );
+
+ /** Implement in derived class to do custom process when an error occurs.
+ Default implementation uses wxLogError.
+ */
+ virtual void ProcessError( const wxString& msg );
+
+protected:
+
+ /** Used property grid. */
+ wxPropertyGrid* m_pg;
+
+ /** Used property grid state. */
+ wxPropertyGridPageState* m_state;
+
+ /** Tree-hierarchy of added properties (that can have children). */
+ wxArrayPGProperty m_propHierarchy;
+
+ /** Hashmap for string-id to wxPGChoicesData mapping. */
+ wxPGHashMapS2P m_dictIdChoices;
+};
+
+// -----------------------------------------------------------------------
+
+//
+// Undefine macros that are not needed outside propertygrid sources
+//
+#ifndef __wxPG_SOURCE_FILE__
+ #undef wxPG_FL_DESC_REFRESH_REQUIRED
+ #undef wxPG_FL_SCROLLBAR_DETECTED
+ #undef wxPG_FL_CREATEDSTATE
+ #undef wxPG_FL_NOSTATUSBARHELP
+ #undef wxPG_FL_SCROLLED
+ #undef wxPG_FL_FOCUS_INSIDE_CHILD
+ #undef wxPG_FL_FOCUS_INSIDE
+ #undef wxPG_FL_MOUSE_INSIDE_CHILD
+ #undef wxPG_FL_CUR_USES_CUSTOM_IMAGE
+ #undef wxPG_FL_PRIMARY_FILLS_ENTIRE
+ #undef wxPG_FL_VALUE_MODIFIED
+ #undef wxPG_FL_MOUSE_INSIDE
+ #undef wxPG_FL_FOCUSED
+ #undef wxPG_FL_MOUSE_CAPTURED
+ #undef wxPG_FL_INITIALIZED
+ #undef wxPG_FL_ACTIVATION_BY_CLICK
+ #undef wxPG_SUPPORT_TOOLTIPS
+ #undef wxPG_ICON_WIDTH
+ #undef wxPG_USE_RENDERER_NATIVE
+// Following are needed by the manager headers
+// #undef const wxString&
+#endif
+
+// -----------------------------------------------------------------------
+
+#endif
+
+#endif // _WX_PROPGRID_PROPGRID_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/propgrid/propgriddefs.h
+// Purpose: wxPropertyGrid miscellaneous definitions
+// Author: Jaakko Salli
+// Modified by:
+// Created: 2008-08-31
+// Copyright: (c) Jaakko Salli
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PROPGRID_PROPGRIDDEFS_H_
+#define _WX_PROPGRID_PROPGRIDDEFS_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_PROPGRID
+
+#include "wx/dynarray.h"
+#include "wx/vector.h"
+#include "wx/hashmap.h"
+#include "wx/variant.h"
+#include "wx/any.h"
+#include "wx/longlong.h"
+#include "wx/clntdata.h"
+
+// -----------------------------------------------------------------------
+
+//
+// Here are some platform dependent defines
+// NOTE: More in propertygrid.cpp
+//
+
+#if defined(__WXMSW__)
+
+ // space between vertical line and value text
+ #define wxPG_XBEFORETEXT 4
+ // space between vertical line and value editor control
+ #define wxPG_XBEFOREWIDGET 1
+
+ // comment to use bitmap buttons
+ #define wxPG_ICON_WIDTH 9
+ // 1 if wxRendererNative should be employed
+ #define wxPG_USE_RENDERER_NATIVE 0
+
+ // Enable tooltips
+ #define wxPG_SUPPORT_TOOLTIPS 1
+
+ // width of optional bitmap/image in front of property
+ #define wxPG_CUSTOM_IMAGE_WIDTH 20
+
+ // 1 if splitter drag detect margin and control cannot overlap
+ #define wxPG_NO_CHILD_EVT_MOTION 0
+
+ #define wxPG_NAT_BUTTON_BORDER_ANY 1
+ #define wxPG_NAT_BUTTON_BORDER_X 1
+ #define wxPG_NAT_BUTTON_BORDER_Y 1
+
+ // If 1 then controls are refreshed explicitly in a few places
+ #define wxPG_REFRESH_CONTROLS 0
+
+#elif defined(__WXGTK__)
+
+ // space between vertical line and value text
+ #define wxPG_XBEFORETEXT 5
+ // space between vertical line and value editor control
+ #define wxPG_XBEFOREWIDGET 1
+
+ // x position adjustment for wxTextCtrl (and like)
+ // NB: Only define wxPG_TEXTCTRLXADJUST for platforms that do not
+ // (yet) support wxTextEntry::SetMargins() for the left margin.
+ //#define wxPG_TEXTCTRLXADJUST 3
+
+ // comment to use bitmap buttons
+ #define wxPG_ICON_WIDTH 9
+ // 1 if wxRendererNative should be employed
+ #define wxPG_USE_RENDERER_NATIVE 1
+
+ // Enable tooltips
+ #define wxPG_SUPPORT_TOOLTIPS 1
+
+ // width of optional bitmap/image in front of property
+ #define wxPG_CUSTOM_IMAGE_WIDTH 20
+
+ // 1 if splitter drag detect margin and control cannot overlap
+ #define wxPG_NO_CHILD_EVT_MOTION 1
+
+ #define wxPG_NAT_BUTTON_BORDER_ANY 1
+ #define wxPG_NAT_BUTTON_BORDER_X 1
+ #define wxPG_NAT_BUTTON_BORDER_Y 1
+
+ // If 1 then controls are refreshed after selected was drawn.
+ #define wxPG_REFRESH_CONTROLS 1
+
+#elif defined(__WXMAC__)
+
+ // space between vertical line and value text
+ #define wxPG_XBEFORETEXT 4
+ // space between vertical line and value editor widget
+ #define wxPG_XBEFOREWIDGET 1
+
+ // x position adjustment for wxTextCtrl (and like)
+ #define wxPG_TEXTCTRLXADJUST 0
+
+ // comment to use bitmap buttons
+ #define wxPG_ICON_WIDTH 11
+ // 1 if wxRendererNative should be employed
+ #define wxPG_USE_RENDERER_NATIVE 1
+
+ // Enable tooltips
+ #define wxPG_SUPPORT_TOOLTIPS 1
+
+ // width of optional bitmap/image in front of property
+ #define wxPG_CUSTOM_IMAGE_WIDTH 20
+
+ // 1 if splitter drag detect margin and control cannot overlap
+ #define wxPG_NO_CHILD_EVT_MOTION 0
+
+ #define wxPG_NAT_BUTTON_BORDER_ANY 0
+ #define wxPG_NAT_BUTTON_BORDER_X 0
+ #define wxPG_NAT_BUTTON_BORDER_Y 0
+
+ // If 1 then controls are refreshed after selected was drawn.
+ #define wxPG_REFRESH_CONTROLS 0
+
+#else // defaults
+
+ // space between vertical line and value text
+ #define wxPG_XBEFORETEXT 5
+ // space between vertical line and value editor widget
+ #define wxPG_XBEFOREWIDGET 1
+
+ // x position adjustment for wxTextCtrl (and like)
+ #define wxPG_TEXTCTRLXADJUST 3
+
+ // comment to use bitmap buttons
+ #define wxPG_ICON_WIDTH 9
+ // 1 if wxRendererNative should be employed
+ #define wxPG_USE_RENDERER_NATIVE 0
+
+ // Enable tooltips
+ #define wxPG_SUPPORT_TOOLTIPS 0
+
+ // width of optional bitmap/image in front of property
+ #define wxPG_CUSTOM_IMAGE_WIDTH 20
+
+ // 1 if splitter drag detect margin and control cannot overlap
+ #define wxPG_NO_CHILD_EVT_MOTION 1
+
+ #define wxPG_NAT_BUTTON_BORDER_ANY 0
+ #define wxPG_NAT_BUTTON_BORDER_X 0
+ #define wxPG_NAT_BUTTON_BORDER_Y 0
+
+ // If 1 then controls are refreshed after selected was drawn.
+ #define wxPG_REFRESH_CONTROLS 0
+#endif // platform
+
+
+#define wxPG_CONTROL_MARGIN 0 // space between splitter and control
+
+#define wxCC_CUSTOM_IMAGE_MARGIN1 4 // before image
+#define wxCC_CUSTOM_IMAGE_MARGIN2 5 // after image
+
+#define DEFAULT_IMAGE_OFFSET_INCREMENT \
+ (wxCC_CUSTOM_IMAGE_MARGIN1 + wxCC_CUSTOM_IMAGE_MARGIN2)
+
+#define wxPG_DRAG_MARGIN 30
+
+#if wxPG_NO_CHILD_EVT_MOTION
+ #define wxPG_SPLITTERX_DETECTMARGIN1 3 // this much on left
+ #define wxPG_SPLITTERX_DETECTMARGIN2 2 // this much on right
+#else
+ #define wxPG_SPLITTERX_DETECTMARGIN1 3 // this much on left
+ #define wxPG_SPLITTERX_DETECTMARGIN2 2 // this much on right
+#endif
+
+// Use this macro to generate standard custom image height from
+#define wxPG_STD_CUST_IMAGE_HEIGHT(LINEHEIGHT) (LINEHEIGHT-3)
+
+
+#if defined(__WXWINCE__)
+ #define wxPG_SMALL_SCREEN 1
+#else
+ #define wxPG_SMALL_SCREEN 0
+#endif
+
+
+// Undefine wxPG_ICON_WIDTH to use supplied xpm bitmaps instead
+// (for tree buttons)
+//#undef wxPG_ICON_WIDTH
+
+#if WXWIN_COMPATIBILITY_2_6 || WXWIN_COMPATIBILITY_2_8
+ #define wxPG_COMPATIBILITY_1_4 1
+#else
+ #define wxPG_COMPATIBILITY_1_4 0
+#endif
+
+// Need to force disable tooltips?
+#if !wxUSE_TOOLTIPS
+ #undef wxPG_SUPPORT_TOOLTIPS
+ #define wxPG_SUPPORT_TOOLTIPS 0
+#endif
+
+// Set 1 to include advanced properties (wxFontProperty, wxColourProperty, etc.)
+#ifndef wxPG_INCLUDE_ADVPROPS
+ #define wxPG_INCLUDE_ADVPROPS 1
+#endif
+
+// Set 1 to include checkbox editor class
+#define wxPG_INCLUDE_CHECKBOX 1
+
+// -----------------------------------------------------------------------
+
+
+class wxPGEditor;
+class wxPGProperty;
+class wxPropertyCategory;
+class wxPGChoices;
+class wxPropertyGridPageState;
+class wxPGCell;
+class wxPGCellRenderer;
+class wxPGChoiceEntry;
+class wxPGPropArgCls;
+class wxPropertyGridInterface;
+class wxPropertyGrid;
+class wxPropertyGridEvent;
+class wxPropertyGridManager;
+class wxPGOwnerDrawnComboBox;
+class wxPGEditorDialogAdapter;
+class wxPGValidationInfo;
+
+
+// -----------------------------------------------------------------------
+
+/** @section propgrid_misc wxPropertyGrid Miscellanous
+
+ This section describes some miscellanous values, types and macros.
+ @{
+*/
+
+// Used to tell wxPGProperty to use label as name as well
+#define wxPG_LABEL (*wxPGProperty::sm_wxPG_LABEL)
+
+// This is the value placed in wxPGProperty::sm_wxPG_LABEL
+#define wxPG_LABEL_STRING wxS("@!")
+#define wxPG_NULL_BITMAP wxNullBitmap
+#define wxPG_COLOUR_BLACK (*wxBLACK)
+
+/** Convert Red, Green and Blue to a single 32-bit value.
+*/
+#define wxPG_COLOUR(R,G,B) ((wxUint32)(R+(G<<8)+(B<<16)))
+
+
+/** If property is supposed to have custom-painted image, then returning
+ this in OnMeasureImage() will usually be enough.
+*/
+#define wxPG_DEFAULT_IMAGE_SIZE wxSize(-1, -1)
+
+
+/** This callback function is used for sorting properties.
+
+ Call wxPropertyGrid::SetSortFunction() to set it.
+
+ Sort function should return a value greater than 0 if position of p1 is
+ after p2. So, for instance, when comparing property names, you can use
+ following implementation:
+
+ @code
+ int MyPropertySortFunction(wxPropertyGrid* propGrid,
+ wxPGProperty* p1,
+ wxPGProperty* p2)
+ {
+ return p1->GetBaseName().compare( p2->GetBaseName() );
+ }
+ @endcode
+*/
+typedef int (*wxPGSortCallback)(wxPropertyGrid* propGrid,
+ wxPGProperty* p1,
+ wxPGProperty* p2);
+
+
+
+typedef wxString wxPGCachedString;
+
+/** @}
+*/
+
+// -----------------------------------------------------------------------
+
+// Used to indicate wxPGChoices::Add etc that the value is actually not given
+// by the caller.
+#define wxPG_INVALID_VALUE INT_MAX
+
+// -----------------------------------------------------------------------
+
+WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(wxPGProperty*, wxArrayPGProperty,
+ wxBaseArrayPtrVoid,
+ class WXDLLIMPEXP_PROPGRID);
+
+WX_DECLARE_STRING_HASH_MAP_WITH_DECL(void*,
+ wxPGHashMapS2P,
+ class WXDLLIMPEXP_PROPGRID);
+
+WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxString,
+ wxPGHashMapS2S,
+ class WXDLLIMPEXP_PROPGRID);
+
+WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL(void*,
+ wxPGHashMapP2P,
+ class WXDLLIMPEXP_PROPGRID);
+
+WX_DECLARE_HASH_MAP_WITH_DECL(wxInt32,
+ wxInt32,
+ wxIntegerHash,
+ wxIntegerEqual,
+ wxPGHashMapI2I,
+ class WXDLLIMPEXP_PROPGRID);
+
+// Utility to find if specific item is in a vector. Returns index to
+// the item, or wxNOT_FOUND if not present.
+template<typename CONTAINER, typename T>
+int wxPGFindInVector( CONTAINER vector, const T& item )
+{
+ for ( unsigned int i=0; i<vector.size(); i++ )
+ {
+ if ( vector[i] == item )
+ return (int) i;
+ }
+ return wxNOT_FOUND;
+}
+
+// -----------------------------------------------------------------------
+
+enum wxPG_GETPROPERTYVALUES_FLAGS
+{
+
+/** Flags for wxPropertyGridInterface::GetPropertyValues */
+wxPG_KEEP_STRUCTURE = 0x00000010,
+
+/** Flags for wxPropertyGrid::SetPropertyAttribute() etc */
+wxPG_RECURSE = 0x00000020,
+
+/** Include attributes for GetPropertyValues. */
+wxPG_INC_ATTRIBUTES = 0x00000040,
+
+/** Used when first starting recursion. */
+wxPG_RECURSE_STARTS = 0x00000080,
+
+/** Force value change. */
+wxPG_FORCE = 0x00000100,
+
+/** Only sort categories and their immediate children.
+ Sorting done by wxPG_AUTO_SORT option uses this.
+*/
+wxPG_SORT_TOP_LEVEL_ONLY = 0x00000200
+
+};
+
+/** Flags for wxPropertyGrid::SetPropertyAttribute() etc */
+#define wxPG_DONT_RECURSE 0x00000000
+
+// -----------------------------------------------------------------------
+
+// Misc argument flags.
+enum wxPG_MISC_ARG_FLAGS
+{
+ // Get/Store full value instead of displayed value.
+ wxPG_FULL_VALUE = 0x00000001,
+
+ wxPG_REPORT_ERROR = 0x00000002,
+
+ wxPG_PROPERTY_SPECIFIC = 0x00000004,
+
+ // Get/Store editable value instead of displayed one (should only be
+ // different in the case of common values)
+ wxPG_EDITABLE_VALUE = 0x00000008,
+
+ // Used when dealing with fragments of composite string value
+ wxPG_COMPOSITE_FRAGMENT = 0x00000010,
+
+ // Means property for which final string value is for cannot really be
+ // edited.
+ wxPG_UNEDITABLE_COMPOSITE_FRAGMENT = 0x00000020,
+
+ // ValueToString() called from GetValueAsString()
+ // (guarantees that input wxVariant value is current own value)
+ wxPG_VALUE_IS_CURRENT = 0x00000040,
+
+ // Value is being set programmatically (ie. not by user)
+ wxPG_PROGRAMMATIC_VALUE = 0x00000080
+};
+
+// -----------------------------------------------------------------------
+
+// wxPGProperty::SetValue() flags
+enum wxPG_SETVALUE_FLAGS
+{
+ wxPG_SETVAL_REFRESH_EDITOR = 0x0001,
+ wxPG_SETVAL_AGGREGATED = 0x0002,
+ wxPG_SETVAL_FROM_PARENT = 0x0004,
+ wxPG_SETVAL_BY_USER = 0x0008 // Set if value changed by user
+};
+
+// -----------------------------------------------------------------------
+
+//
+// Valid constants for wxPG_UINT_BASE attribute
+// (long because of wxVariant constructor)
+#define wxPG_BASE_OCT (long)8
+#define wxPG_BASE_DEC (long)10
+#define wxPG_BASE_HEX (long)16
+#define wxPG_BASE_HEXL (long)32
+
+//
+// Valid constants for wxPG_UINT_PREFIX attribute
+#define wxPG_PREFIX_NONE (long)0
+#define wxPG_PREFIX_0x (long)1
+#define wxPG_PREFIX_DOLLAR_SIGN (long)2
+
+// -----------------------------------------------------------------------
+// Editor class.
+
+// Editor accessor (for backwards compatiblity use only).
+#define wxPG_EDITOR(T) wxPGEditor_##T
+
+// Macro for declaring editor class, with optional impexpdecl part.
+#ifndef WX_PG_DECLARE_EDITOR_WITH_DECL
+
+ #define WX_PG_DECLARE_EDITOR_WITH_DECL(EDITOR,DECL) \
+ extern DECL wxPGEditor* wxPGEditor_##EDITOR; \
+ extern DECL wxPGEditor* wxPGConstruct##EDITOR##EditorClass();
+
+#endif
+
+// Declare editor class.
+#define WX_PG_DECLARE_EDITOR(EDITOR) \
+extern wxPGEditor* wxPGEditor_##EDITOR; \
+extern wxPGEditor* wxPGConstruct##EDITOR##EditorClass();
+
+// Declare builtin editor classes.
+WX_PG_DECLARE_EDITOR_WITH_DECL(TextCtrl,WXDLLIMPEXP_PROPGRID)
+WX_PG_DECLARE_EDITOR_WITH_DECL(Choice,WXDLLIMPEXP_PROPGRID)
+WX_PG_DECLARE_EDITOR_WITH_DECL(ComboBox,WXDLLIMPEXP_PROPGRID)
+WX_PG_DECLARE_EDITOR_WITH_DECL(TextCtrlAndButton,WXDLLIMPEXP_PROPGRID)
+#if wxPG_INCLUDE_CHECKBOX
+WX_PG_DECLARE_EDITOR_WITH_DECL(CheckBox,WXDLLIMPEXP_PROPGRID)
+#endif
+WX_PG_DECLARE_EDITOR_WITH_DECL(ChoiceAndButton,WXDLLIMPEXP_PROPGRID)
+
+// -----------------------------------------------------------------------
+
+#ifndef SWIG
+
+//
+// Macro WXVARIANT allows creation of wxVariant from any type supported by
+// wxWidgets internally, and of all types created using
+// WX_PG_DECLARE_VARIANT_DATA.
+template<class T>
+wxVariant WXVARIANT( const T& WXUNUSED(value) )
+{
+ wxFAIL_MSG("Code should always call specializations of this template");
+ return wxVariant();
+}
+
+template<> inline wxVariant WXVARIANT( const int& value )
+ { return wxVariant((long)value); }
+template<> inline wxVariant WXVARIANT( const long& value )
+ { return wxVariant(value); }
+template<> inline wxVariant WXVARIANT( const bool& value )
+ { return wxVariant(value); }
+template<> inline wxVariant WXVARIANT( const double& value )
+ { return wxVariant(value); }
+template<> inline wxVariant WXVARIANT( const wxArrayString& value )
+ { return wxVariant(value); }
+template<> inline wxVariant WXVARIANT( const wxString& value )
+ { return wxVariant(value); }
+#if wxUSE_LONGLONG
+template<> inline wxVariant WXVARIANT( const wxLongLong& value )
+ { return wxVariant(value); }
+template<> inline wxVariant WXVARIANT( const wxULongLong& value )
+ { return wxVariant(value); }
+#endif
+#if wxUSE_DATETIME
+template<> inline wxVariant WXVARIANT( const wxDateTime& value )
+ { return wxVariant(value); }
+#endif
+
+
+//
+// These are modified versions of DECLARE/WX_PG_IMPLEMENT_VARIANT_DATA
+// macros found in variant.h. Difference are as follows:
+// * These support non-wxObject data
+// * These implement classname##RefFromVariant function which returns
+// reference to data within.
+// * const char* classname##_VariantType which equals classname.
+// * WXVARIANT
+//
+#define WX_PG_DECLARE_VARIANT_DATA(classname) \
+ WX_PG_DECLARE_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
+
+#define WX_PG_DECLARE_VARIANT_DATA_EXPORTED(classname,expdecl) \
+expdecl classname& operator << ( classname &object, const wxVariant &variant ); \
+expdecl wxVariant& operator << ( wxVariant &variant, const classname &object ); \
+expdecl const classname& classname##RefFromVariant( const wxVariant& variant ); \
+expdecl classname& classname##RefFromVariant( wxVariant& variant ); \
+template<> inline wxVariant WXVARIANT( const classname& value ) \
+{ \
+ wxVariant variant; \
+ variant << value; \
+ return variant; \
+} \
+extern expdecl const char* classname##_VariantType;
+
+
+#define WX_PG_IMPLEMENT_VARIANT_DATA(classname) \
+ WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
+
+// Add getter (ie. classname << variant) separately to allow
+// custom implementations.
+#define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,expdecl) \
+const char* classname##_VariantType = #classname; \
+class classname##VariantData: public wxVariantData \
+{ \
+public:\
+ classname##VariantData() {} \
+ classname##VariantData( const classname &value ) { m_value = value; } \
+\
+ classname &GetValue() { return m_value; } \
+\
+ const classname &GetValue() const { return m_value; } \
+\
+ virtual bool Eq(wxVariantData& data) const; \
+\
+ virtual wxString GetType() const; \
+\
+ virtual wxVariantData* Clone() const { return new classname##VariantData(m_value); } \
+\
+ DECLARE_WXANY_CONVERSION() \
+protected:\
+ classname m_value; \
+};\
+\
+IMPLEMENT_TRIVIAL_WXANY_CONVERSION(classname, classname##VariantData) \
+\
+wxString classname##VariantData::GetType() const\
+{\
+ return wxS(#classname);\
+}\
+\
+expdecl wxVariant& operator << ( wxVariant &variant, const classname &value )\
+{\
+ classname##VariantData *data = new classname##VariantData( value );\
+ variant.SetData( data );\
+ return variant;\
+} \
+expdecl classname& classname##RefFromVariant( wxVariant& variant ) \
+{ \
+ wxASSERT_MSG( variant.GetType() == wxS(#classname), \
+ wxString::Format("Variant type should have been '%s'" \
+ "instead of '%s'", \
+ wxS(#classname), \
+ variant.GetType().c_str())); \
+ classname##VariantData *data = \
+ (classname##VariantData*) variant.GetData(); \
+ return data->GetValue();\
+} \
+expdecl const classname& classname##RefFromVariant( const wxVariant& variant ) \
+{ \
+ wxASSERT_MSG( variant.GetType() == wxS(#classname), \
+ wxString::Format("Variant type should have been '%s'" \
+ "instead of '%s'", \
+ wxS(#classname), \
+ variant.GetType().c_str())); \
+ classname##VariantData *data = \
+ (classname##VariantData*) variant.GetData(); \
+ return data->GetValue();\
+}
+
+#define WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname, expdecl) \
+expdecl classname& operator << ( classname &value, const wxVariant &variant )\
+{\
+ wxASSERT( variant.GetType() == #classname );\
+ \
+ classname##VariantData *data = (classname##VariantData*) variant.GetData();\
+ value = data->GetValue();\
+ return value;\
+}
+
+#define WX_PG_IMPLEMENT_VARIANT_DATA_EQ(classname, expdecl) \
+bool classname##VariantData::Eq(wxVariantData& data) const \
+{\
+ wxASSERT( GetType() == data.GetType() );\
+\
+ classname##VariantData & otherData = (classname##VariantData &) data;\
+\
+ return otherData.m_value == m_value;\
+}
+
+// implements a wxVariantData-derived class using for the Eq() method the
+// operator== which must have been provided by "classname"
+#define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname,expdecl) \
+WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
+WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
+WX_PG_IMPLEMENT_VARIANT_DATA_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl)
+
+#define WX_PG_IMPLEMENT_VARIANT_DATA(classname) \
+WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
+
+// with Eq() implementation that always returns false
+#define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_DUMMY_EQ(classname,expdecl) \
+WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
+WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
+\
+bool classname##VariantData::Eq(wxVariantData& WXUNUSED(data)) const \
+{\
+ return false; \
+}
+
+#define WX_PG_IMPLEMENT_VARIANT_DATA_DUMMY_EQ(classname) \
+WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_DUMMY_EQ(classname, wxEMPTY_PARAMETER_VALUE)
+
+WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxPoint, WXDLLIMPEXP_PROPGRID)
+WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxSize, WXDLLIMPEXP_PROPGRID)
+WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxArrayInt, WXDLLIMPEXP_PROPGRID)
+DECLARE_VARIANT_OBJECT_EXPORTED(wxFont, WXDLLIMPEXP_PROPGRID)
+template<> inline wxVariant WXVARIANT( const wxFont& value )
+{
+ wxVariant variant;
+ variant << value;
+ return variant;
+}
+
+template<> inline wxVariant WXVARIANT( const wxColour& value )
+{
+ wxVariant variant;
+ variant << value;
+ return variant;
+}
+
+// Define constants for common wxVariant type strings
+
+#define wxPG_VARIANT_TYPE_STRING wxPGGlobalVars->m_strstring
+#define wxPG_VARIANT_TYPE_LONG wxPGGlobalVars->m_strlong
+#define wxPG_VARIANT_TYPE_BOOL wxPGGlobalVars->m_strbool
+#define wxPG_VARIANT_TYPE_LIST wxPGGlobalVars->m_strlist
+#define wxPG_VARIANT_TYPE_DOUBLE wxS("double")
+#define wxPG_VARIANT_TYPE_ARRSTRING wxS("arrstring")
+#define wxPG_VARIANT_TYPE_DATETIME wxS("datetime")
+#define wxPG_VARIANT_TYPE_LONGLONG wxS("longlong")
+#define wxPG_VARIANT_TYPE_ULONGLONG wxS("ulonglong")
+
+#endif // !SWIG
+
+// -----------------------------------------------------------------------
+
+//
+// Tokenizer macros.
+// NOTE: I have made two versions - worse ones (performance and consistency
+// wise) use wxStringTokenizer and better ones (may have unfound bugs)
+// use custom code.
+//
+
+#include "wx/tokenzr.h"
+
+// TOKENIZER1 can be done with wxStringTokenizer
+#define WX_PG_TOKENIZER1_BEGIN(WXSTRING,DELIMITER) \
+ wxStringTokenizer tkz(WXSTRING,DELIMITER,wxTOKEN_RET_EMPTY); \
+ while ( tkz.HasMoreTokens() ) \
+ { \
+ wxString token = tkz.GetNextToken(); \
+ token.Trim(true); \
+ token.Trim(false);
+
+#define WX_PG_TOKENIZER1_END() \
+ }
+
+
+//
+// 2nd version: tokens are surrounded by DELIMITERs (for example, C-style
+// strings). TOKENIZER2 must use custom code (a class) for full compliance with
+// " surrounded strings with \" inside.
+//
+// class implementation is in propgrid.cpp
+//
+
+class WXDLLIMPEXP_PROPGRID wxPGStringTokenizer
+{
+public:
+ wxPGStringTokenizer( const wxString& str, wxChar delimeter );
+ ~wxPGStringTokenizer();
+
+ bool HasMoreTokens(); // not const so we can do some stuff in it
+ wxString GetNextToken();
+
+protected:
+ const wxString* m_str;
+ wxString::const_iterator m_curPos;
+ wxString m_readyToken;
+ wxUniChar m_delimeter;
+};
+
+#define WX_PG_TOKENIZER2_BEGIN(WXSTRING,DELIMITER) \
+ wxPGStringTokenizer tkz(WXSTRING,DELIMITER); \
+ while ( tkz.HasMoreTokens() ) \
+ { \
+ wxString token = tkz.GetNextToken();
+
+#define WX_PG_TOKENIZER2_END() \
+ }
+
+// -----------------------------------------------------------------------
+
+#endif // wxUSE_PROPGRID
+
+#endif // _WX_PROPGRID_PROPGRIDDEFS_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/propgrid/propgridiface.h
+// Purpose: wxPropertyGridInterface class
+// Author: Jaakko Salli
+// Modified by:
+// Created: 2008-08-24
+// Copyright: (c) Jaakko Salli
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __WX_PROPGRID_PROPGRIDIFACE_H__
+#define __WX_PROPGRID_PROPGRIDIFACE_H__
+
+#include "wx/defs.h"
+
+#if wxUSE_PROPGRID
+
+#include "wx/propgrid/property.h"
+#include "wx/propgrid/propgridpagestate.h"
+
+// -----------------------------------------------------------------------
+
+/** @section wxPGPropArgCls
+
+ Most property grid functions have this type as their argument, as it can
+ convey a property by either a pointer or name.
+*/
+class WXDLLIMPEXP_PROPGRID wxPGPropArgCls
+{
+public:
+ wxPGPropArgCls( const wxPGProperty* property )
+ {
+ m_ptr.property = (wxPGProperty*) property;
+ m_flags = IsProperty;
+ }
+ wxPGPropArgCls( const wxString& str )
+ {
+ m_ptr.stringName = &str;
+ m_flags = IsWxString;
+ }
+ wxPGPropArgCls( const wxPGPropArgCls& id )
+ {
+ m_ptr = id.m_ptr;
+ m_flags = id.m_flags;
+ }
+ // This is only needed for wxPython bindings
+ wxPGPropArgCls( wxString* str, bool WXUNUSED(deallocPtr) )
+ {
+ m_ptr.stringName = str;
+ m_flags = IsWxString | OwnsWxString;
+ }
+ ~wxPGPropArgCls()
+ {
+ if ( m_flags & OwnsWxString )
+ delete m_ptr.stringName;
+ }
+ wxPGProperty* GetPtr() const
+ {
+ wxCHECK( m_flags == IsProperty, NULL );
+ return m_ptr.property;
+ }
+ wxPGPropArgCls( const char* str )
+ {
+ m_ptr.charName = str;
+ m_flags = IsCharPtr;
+ }
+ wxPGPropArgCls( const wchar_t* str )
+ {
+ m_ptr.wcharName = str;
+ m_flags = IsWCharPtr;
+ }
+ /** This constructor is required for NULL. */
+ wxPGPropArgCls( int )
+ {
+ m_ptr.property = NULL;
+ m_flags = IsProperty;
+ }
+ wxPGProperty* GetPtr( wxPropertyGridInterface* iface ) const;
+ wxPGProperty* GetPtr( const wxPropertyGridInterface* iface ) const
+ {
+ return GetPtr((wxPropertyGridInterface*)iface);
+ }
+ wxPGProperty* GetPtr0() const { return m_ptr.property; }
+ bool HasName() const { return (m_flags != IsProperty); }
+ const wxString& GetName() const { return *m_ptr.stringName; }
+private:
+
+ enum
+ {
+ IsProperty = 0x00,
+ IsWxString = 0x01,
+ IsCharPtr = 0x02,
+ IsWCharPtr = 0x04,
+ OwnsWxString = 0x10
+ };
+
+ union
+ {
+ wxPGProperty* property;
+ const char* charName;
+ const wchar_t* wcharName;
+ const wxString* stringName;
+ } m_ptr;
+ unsigned char m_flags;
+};
+
+typedef const wxPGPropArgCls& wxPGPropArg;
+
+// -----------------------------------------------------------------------
+
+WXDLLIMPEXP_PROPGRID
+void wxPGTypeOperationFailed( const wxPGProperty* p,
+ const wxString& typestr,
+ const wxString& op );
+WXDLLIMPEXP_PROPGRID
+void wxPGGetFailed( const wxPGProperty* p, const wxString& typestr );
+
+// -----------------------------------------------------------------------
+
+// Helper macro that does necessary preparations when calling
+// some wxPGProperty's member function.
+#define wxPG_PROP_ARG_CALL_PROLOG_0(PROPERTY) \
+ PROPERTY *p = (PROPERTY*)id.GetPtr(this); \
+ if ( !p ) return;
+
+#define wxPG_PROP_ARG_CALL_PROLOG_RETVAL_0(PROPERTY, RETVAL) \
+ PROPERTY *p = (PROPERTY*)id.GetPtr(this); \
+ if ( !p ) return RETVAL;
+
+#define wxPG_PROP_ARG_CALL_PROLOG() \
+ wxPG_PROP_ARG_CALL_PROLOG_0(wxPGProperty)
+
+#define wxPG_PROP_ARG_CALL_PROLOG_RETVAL(RVAL) \
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL_0(wxPGProperty, RVAL)
+
+#define wxPG_PROP_ID_CONST_CALL_PROLOG() \
+ wxPG_PROP_ARG_CALL_PROLOG_0(const wxPGProperty)
+
+#define wxPG_PROP_ID_CONST_CALL_PROLOG_RETVAL(RVAL) \
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL_0(const wxPGProperty, RVAL)
+
+// -----------------------------------------------------------------------
+
+
+/** @class wxPropertyGridInterface
+
+ Most of the shared property manipulation interface shared by wxPropertyGrid,
+ wxPropertyGridPage, and wxPropertyGridManager is defined in this class.
+
+ @remarks
+ - In separate wxPropertyGrid component this class was known as
+ wxPropertyContainerMethods.
+
+ @library{wxpropgrid}
+ @category{propgrid}
+*/
+class WXDLLIMPEXP_PROPGRID wxPropertyGridInterface
+{
+public:
+
+ /** Destructor */
+ virtual ~wxPropertyGridInterface() { }
+
+ /**
+ Appends property to the list.
+
+ wxPropertyGrid assumes ownership of the object.
+ Becomes child of most recently added category.
+ @remarks
+ - wxPropertyGrid takes the ownership of the property pointer.
+ - If appending a category with name identical to a category already in
+ the wxPropertyGrid, then newly created category is deleted, and most
+ recently added category (under which properties are appended) is set
+ to the one with same name. This allows easier adding of items to same
+ categories in multiple passes.
+ - Does not automatically redraw the control, so you may need to call
+ Refresh when calling this function after control has been shown for
+ the first time.
+ */
+ wxPGProperty* Append( wxPGProperty* property );
+
+ wxPGProperty* AppendIn( wxPGPropArg id, wxPGProperty* newproperty );
+
+ /**
+ In order to add new items into a property with fixed children (for
+ instance, wxFlagsProperty), you need to call this method. After
+ populating has been finished, you need to call EndAddChildren.
+ */
+ void BeginAddChildren( wxPGPropArg id );
+
+ /** Deletes all properties.
+ */
+ virtual void Clear() = 0;
+
+ /**
+ Clears current selection, if any.
+
+ @param validation
+ If set to @false, deselecting the property will always work,
+ even if its editor had invalid value in it.
+
+ @return Returns @true if successful or if there was no selection. May
+ fail if validation was enabled and active editor had invalid
+ value.
+
+ @remarks In wxPropertyGrid 1.4, this member function used to send
+ wxPG_EVT_SELECTED. In wxWidgets 2.9 and later, it no longer
+ does that.
+ */
+ bool ClearSelection( bool validation = false );
+
+ /** Resets modified status of all properties.
+ */
+ void ClearModifiedStatus();
+
+ /** Collapses given category or property with children.
+ Returns true if actually collapses.
+ */
+ bool Collapse( wxPGPropArg id );
+
+ /** Collapses all items that can be collapsed.
+
+ @return
+ Return false if failed (may fail if editor value cannot be validated).
+ */
+ bool CollapseAll() { return ExpandAll(false); }
+
+ /**
+ Changes value of a property, as if from an editor.
+ Use this instead of SetPropertyValue() if you need the value to run
+ through validation process, and also send the property change event.
+
+ @return
+ Returns true if value was successfully changed.
+ */
+ bool ChangePropertyValue( wxPGPropArg id, wxVariant newValue );
+
+ /**
+ Removes and deletes a property and any children.
+
+ @param id
+ Pointer or name of a property.
+
+ @remarks If you delete a property in a wxPropertyGrid event
+ handler, the actual deletion is postponed until the next
+ idle event.
+
+ This functions deselects selected property, if any.
+ Validation failure option wxPG_VFB_STAY_IN_PROPERTY is not
+ respected, ie. selection is cleared even if editor had
+ invalid value.
+ */
+ void DeleteProperty( wxPGPropArg id );
+
+ /**
+ Removes a property. Does not delete the property object, but
+ instead returns it.
+
+ @param id
+ Pointer or name of a property.
+
+ @remarks Removed property cannot have any children.
+
+ Also, if you remove property in a wxPropertyGrid event
+ handler, the actual removal is postponed until the next
+ idle event.
+ */
+ wxPGProperty* RemoveProperty( wxPGPropArg id );
+
+ /**
+ Disables a property.
+
+ @see EnableProperty(), wxPGProperty::Enable()
+ */
+ bool DisableProperty( wxPGPropArg id ) { return EnableProperty(id,false); }
+
+ /**
+ Returns true if all property grid data changes have been committed.
+
+ Usually only returns false if value in active editor has been
+ invalidated by a wxValidator.
+ */
+ bool EditorValidate();
+
+ /**
+ Enables or disables property, depending on whether enable is true or
+ false. Disabled property usually appears as having grey text.
+
+ @param id
+ Name or pointer to a property.
+ @param enable
+ If @false, property is disabled instead.
+
+ @see wxPGProperty::Enable()
+ */
+ bool EnableProperty( wxPGPropArg id, bool enable = true );
+
+ /** Called after population of property with fixed children has finished.
+ */
+ void EndAddChildren( wxPGPropArg id );
+
+ /** Expands given category or property with children.
+ Returns true if actually expands.
+ */
+ bool Expand( wxPGPropArg id );
+
+ /** Expands all items that can be expanded.
+ */
+ bool ExpandAll( bool expand = true );
+
+ /** Returns id of first child of given property.
+ @remarks
+ Does not return sub-properties!
+ */
+ wxPGProperty* GetFirstChild( wxPGPropArg id )
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullProperty)
+
+ if ( !p->GetChildCount() || p->HasFlag(wxPG_PROP_AGGREGATE) )
+ return wxNullProperty;
+
+ return p->Item(0);
+ }
+
+ //@{
+ /** Returns iterator class instance.
+ @param flags
+ See @ref propgrid_iterator_flags. Value wxPG_ITERATE_DEFAULT causes
+ iteration over everything except private child properties.
+ @param firstProp
+ Property to start iteration from. If NULL, then first child of root
+ is used.
+ @param startPos
+ Either wxTOP or wxBOTTOM. wxTOP will indicate that iterations start
+ from the first property from the top, and wxBOTTOM means that the
+ iteration will instead begin from bottommost valid item.
+ */
+ wxPropertyGridIterator GetIterator( int flags = wxPG_ITERATE_DEFAULT,
+ wxPGProperty* firstProp = NULL )
+ {
+ return wxPropertyGridIterator( m_pState, flags, firstProp );
+ }
+
+ wxPropertyGridConstIterator
+ GetIterator( int flags = wxPG_ITERATE_DEFAULT,
+ wxPGProperty* firstProp = NULL ) const
+ {
+ return wxPropertyGridConstIterator( m_pState, flags, firstProp );
+ }
+
+ wxPropertyGridIterator GetIterator( int flags, int startPos )
+ {
+ return wxPropertyGridIterator( m_pState, flags, startPos );
+ }
+
+ wxPropertyGridConstIterator GetIterator( int flags, int startPos ) const
+ {
+ return wxPropertyGridConstIterator( m_pState, flags, startPos );
+ }
+ //@}
+
+ /** Returns id of first item, whether it is a category or property.
+ @param flags
+ @link iteratorflags List of iterator flags@endlink
+ */
+ wxPGProperty* GetFirst( int flags = wxPG_ITERATE_ALL )
+ {
+ wxPropertyGridIterator it( m_pState, flags, wxNullProperty, 1 );
+ return *it;
+ }
+
+ const wxPGProperty* GetFirst( int flags = wxPG_ITERATE_ALL ) const
+ {
+ return ((wxPropertyGridInterface*)this)->GetFirst(flags);
+ }
+
+ /**
+ Returns pointer to a property with given name (case-sensitive).
+ If there is no property with such name, @NULL pointer is returned.
+
+ @remarks Properties which have non-category, non-root parent
+ cannot be accessed globally by their name. Instead, use
+ "<property>.<subproperty>" instead of "<subproperty>".
+ */
+ wxPGProperty* GetProperty( const wxString& name ) const
+ {
+ return GetPropertyByName(name);
+ }
+
+ /** Returns map-like storage of property's attributes.
+ @remarks
+ Note that if extra style wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES is set,
+ then builtin-attributes are not included in the storage.
+ */
+ const wxPGAttributeStorage& GetPropertyAttributes( wxPGPropArg id ) const
+ {
+ // If 'id' refers to invalid property, then we will return dummy
+ // attributes (ie. root property's attributes, which contents should
+ // should always be empty and of no consequence).
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(m_pState->DoGetRoot()->GetAttributes());
+ return p->GetAttributes();
+ }
+
+ /** Adds to 'targetArr' pointers to properties that have given
+ flags 'flags' set. However, if 'inverse' is set to true, then
+ only properties without given flags are stored.
+ @param flags
+ Property flags to use.
+ @param iterFlags
+ Iterator flags to use. Default is everything expect private children.
+ */
+ void GetPropertiesWithFlag( wxArrayPGProperty* targetArr,
+ wxPGProperty::FlagType flags,
+ bool inverse = false,
+ int iterFlags = wxPG_ITERATE_PROPERTIES |
+ wxPG_ITERATE_HIDDEN |
+ wxPG_ITERATE_CATEGORIES) const;
+
+ /** Returns value of given attribute. If none found, returns NULL-variant.
+ */
+ wxVariant GetPropertyAttribute( wxPGPropArg id,
+ const wxString& attrName ) const
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullVariant)
+ return p->GetAttribute(attrName);
+ }
+
+ /** Returns pointer of property's nearest parent category. If no category
+ found, returns NULL.
+ */
+ wxPropertyCategory* GetPropertyCategory( wxPGPropArg id ) const
+ {
+ wxPG_PROP_ID_CONST_CALL_PROLOG_RETVAL(NULL)
+ return m_pState->GetPropertyCategory(p);
+ }
+
+ /** Returns client data (void*) of a property. */
+ void* GetPropertyClientData( wxPGPropArg id ) const
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(NULL)
+ return p->GetClientData();
+ }
+
+ /**
+ Returns first property which label matches given string.
+
+ NULL if none found. Note that this operation is extremely slow when
+ compared to GetPropertyByName().
+ */
+ wxPGProperty* GetPropertyByLabel( const wxString& label ) const;
+
+ /** Returns property with given name. NULL if none found.
+ */
+ wxPGProperty* GetPropertyByName( const wxString& name ) const;
+
+ /** Returns child property 'subname' of property 'name'. Same as
+ calling GetPropertyByName("name.subname"), albeit slightly faster.
+ */
+ wxPGProperty* GetPropertyByName( const wxString& name,
+ const wxString& subname ) const;
+
+ /** Returns property's editor. */
+ const wxPGEditor* GetPropertyEditor( wxPGPropArg id ) const
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(NULL)
+ return p->GetEditorClass();
+ }
+
+ /** Returns help string associated with a property. */
+ wxString GetPropertyHelpString( wxPGPropArg id ) const
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(m_emptyString)
+ return p->GetHelpString();
+ }
+
+ /** Returns property's custom value image (NULL of none). */
+ wxBitmap* GetPropertyImage( wxPGPropArg id ) const
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(NULL)
+ return p->GetValueImage();
+ }
+
+ /** Returns label of a property. */
+ const wxString& GetPropertyLabel( wxPGPropArg id )
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(m_emptyString)
+ return p->GetLabel();
+ }
+
+ /** Returns name of a property, by which it is globally accessible. */
+ wxString GetPropertyName( wxPGProperty* property )
+ {
+ return property->GetName();
+ }
+
+ /** Returns parent item of a property. */
+ wxPGProperty* GetPropertyParent( wxPGPropArg id )
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullProperty)
+ return p->GetParent();
+ }
+
+#if wxUSE_VALIDATORS
+ /** Returns validator of a property as a reference, which you
+ can pass to any number of SetPropertyValidator.
+ */
+ wxValidator* GetPropertyValidator( wxPGPropArg id )
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(NULL)
+ return p->GetValidator();
+ }
+#endif
+
+ /** Returns value as wxVariant. To get wxObject pointer from it,
+ you will have to use WX_PG_VARIANT_TO_WXOBJECT(VARIANT,CLASSNAME) macro.
+
+ If property value is unspecified, Null variant is returned.
+ */
+ wxVariant GetPropertyValue( wxPGPropArg id )
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxVariant())
+ return p->GetValue();
+ }
+
+ wxString GetPropertyValueAsString( wxPGPropArg id ) const;
+ long GetPropertyValueAsLong( wxPGPropArg id ) const;
+ unsigned long GetPropertyValueAsULong( wxPGPropArg id ) const
+ {
+ return (unsigned long) GetPropertyValueAsLong(id);
+ }
+ int GetPropertyValueAsInt( wxPGPropArg id ) const
+ { return (int)GetPropertyValueAsLong(id); }
+ bool GetPropertyValueAsBool( wxPGPropArg id ) const;
+ double GetPropertyValueAsDouble( wxPGPropArg id ) const;
+
+#define wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL(TYPENAME, DEFVAL) \
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(DEFVAL) \
+ wxString typeName(wxS(TYPENAME)); \
+ wxVariant value = p->GetValue(); \
+ if ( value.GetType() != typeName ) \
+ { \
+ wxPGGetFailed(p, typeName); \
+ return DEFVAL; \
+ }
+
+#define wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL_WFALLBACK(TYPENAME, DEFVAL) \
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(DEFVAL) \
+ wxVariant value = p->GetValue(); \
+ if ( value.GetType() != wxS(TYPENAME) ) \
+ return DEFVAL; \
+
+ wxArrayString GetPropertyValueAsArrayString( wxPGPropArg id ) const
+ {
+ wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL("arrstring",
+ wxArrayString())
+ return value.GetArrayString();
+ }
+
+#ifdef wxLongLong_t
+ wxLongLong_t GetPropertyValueAsLongLong( wxPGPropArg id ) const
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(0)
+ return p->GetValue().GetLongLong().GetValue();
+ }
+
+ wxULongLong_t GetPropertyValueAsULongLong( wxPGPropArg id ) const
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(0)
+ return p->GetValue().GetULongLong().GetValue();
+ }
+#endif
+
+ wxArrayInt GetPropertyValueAsArrayInt( wxPGPropArg id ) const
+ {
+ wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL("wxArrayInt",
+ wxArrayInt())
+ wxArrayInt arr;
+ arr << value;
+ return arr;
+ }
+
+#if wxUSE_DATETIME
+ wxDateTime GetPropertyValueAsDateTime( wxPGPropArg id ) const
+ {
+ wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL("datetime",
+ wxDateTime())
+ return value.GetDateTime();
+ }
+#endif
+
+ /** Returns a wxVariant list containing wxVariant versions of all
+ property values. Order is not guaranteed.
+ @param flags
+ Use wxPG_KEEP_STRUCTURE to retain category structure; each sub
+ category will be its own wxVariantList of wxVariant.
+ Use wxPG_INC_ATTRIBUTES to include property attributes as well.
+ Each attribute will be stored as list variant named
+ "@@<propname>@@attr."
+ @remarks
+ */
+ wxVariant GetPropertyValues( const wxString& listname = wxEmptyString,
+ wxPGProperty* baseparent = NULL, long flags = 0 ) const
+ {
+ return m_pState->DoGetPropertyValues(listname, baseparent, flags);
+ }
+
+ /**
+ Returns currently selected property. NULL if none.
+
+ @remarks When wxPG_EX_MULTIPLE_SELECTION extra style is used, this
+ member function returns the focused property, that is the
+ one which can have active editor.
+ */
+ wxPGProperty* GetSelection() const;
+
+ /**
+ Returns list of currently selected properties.
+
+ @remarks wxArrayPGProperty should be compatible with std::vector API.
+ */
+ const wxArrayPGProperty& GetSelectedProperties() const
+ {
+ return m_pState->m_selection;
+ }
+
+ wxPropertyGridPageState* GetState() const { return m_pState; }
+
+ /** Similar to GetIterator(), but instead returns wxPGVIterator instance,
+ which can be useful for forward-iterating through arbitrary property
+ containers.
+
+ @param flags
+ See @ref propgrid_iterator_flags.
+ */
+ virtual wxPGVIterator GetVIterator( int flags ) const;
+
+ /** Hides or reveals a property.
+ @param hide
+ If true, hides property, otherwise reveals it.
+ @param flags
+ By default changes are applied recursively. Set this paramter
+ wxPG_DONT_RECURSE to prevent this.
+ */
+ bool HideProperty( wxPGPropArg id,
+ bool hide = true,
+ int flags = wxPG_RECURSE );
+
+#if wxPG_INCLUDE_ADVPROPS
+ /** Initializes *all* property types. Causes references to most object
+ files in the library, so calling this may cause significant increase
+ in executable size when linking with static library.
+ */
+ static void InitAllTypeHandlers();
+#else
+ static void InitAllTypeHandlers() { }
+#endif
+
+ //@{
+ /** Inserts property to the property container.
+
+ @param priorThis
+ New property is inserted just prior to this. Available only
+ in the first variant. There are two versions of this function
+ to allow this parameter to be either an id or name to
+ a property.
+
+ @param newproperty
+ Pointer to the inserted property. wxPropertyGrid will take
+ ownership of this object.
+
+ @param parent
+ New property is inserted under this category. Available only
+ in the second variant. There are two versions of this function
+ to allow this parameter to be either an id or name to
+ a property.
+
+ @param index
+ Index under category. Available only in the second variant.
+ If index is < 0, property is appended in category.
+
+ @return
+ Returns id for the property,
+
+ @remarks
+
+ - wxPropertyGrid takes the ownership of the property pointer.
+
+ - While Append may be faster way to add items, make note that when
+ both types of data storage (categoric and
+ non-categoric) are active, Insert becomes even more slow. This is
+ especially true if current mode is non-categoric.
+
+ Example of use:
+
+ @code
+
+ // append category
+ wxPGProperty* my_cat_id = propertygrid->Append(
+ new wxPropertyCategory("My Category") );
+
+ ...
+
+ // insert into category - using second variant
+ wxPGProperty* my_item_id_1 = propertygrid->Insert(
+ my_cat_id, 0, new wxStringProperty("My String 1") );
+
+ // insert before to first item - using first variant
+ wxPGProperty* my_item_id_2 = propertygrid->Insert(
+ my_item_id, new wxStringProperty("My String 2") );
+
+ @endcode
+
+ */
+ wxPGProperty* Insert( wxPGPropArg priorThis, wxPGProperty* newproperty );
+ wxPGProperty* Insert( wxPGPropArg parent,
+ int index,
+ wxPGProperty* newproperty );
+ //@}
+
+ /** Returns true if property is a category. */
+ bool IsPropertyCategory( wxPGPropArg id ) const
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
+ return p->IsCategory();
+ }
+
+ /** Returns true if property is enabled. */
+ bool IsPropertyEnabled( wxPGPropArg id ) const
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
+ return (!(p->GetFlags() & wxPG_PROP_DISABLED))?true:false;
+ }
+
+ /**
+ Returns true if given property is expanded.
+
+ Naturally, always returns false for properties that cannot be expanded.
+ */
+ bool IsPropertyExpanded( wxPGPropArg id ) const;
+
+ /**
+ Returns true if property has been modified after value set or modify
+ flag clear by software.
+ */
+ bool IsPropertyModified( wxPGPropArg id ) const
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
+ return ( (p->GetFlags() & wxPG_PROP_MODIFIED) ? true : false );
+ }
+
+ /**
+ Returns true if property is selected.
+ */
+ bool IsPropertySelected( wxPGPropArg id ) const
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
+ return m_pState->DoIsPropertySelected(p);
+ }
+
+ /**
+ Returns true if property is shown (ie hideproperty with true not
+ called for it).
+ */
+ bool IsPropertyShown( wxPGPropArg id ) const
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
+ return (!(p->GetFlags() & wxPG_PROP_HIDDEN))?true:false;
+ }
+
+ /** Returns true if property value is set to unspecified.
+ */
+ bool IsPropertyValueUnspecified( wxPGPropArg id ) const
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
+ return p->IsValueUnspecified();
+ }
+
+ /**
+ Disables (limit = true) or enables (limit = false) wxTextCtrl editor of
+ a property, if it is not the sole mean to edit the value.
+ */
+ void LimitPropertyEditing( wxPGPropArg id, bool limit = true );
+
+ /** If state is shown in it's grid, refresh it now.
+ */
+ virtual void RefreshGrid( wxPropertyGridPageState* state = NULL );
+
+#if wxPG_INCLUDE_ADVPROPS
+ /**
+ Initializes additional property editors (SpinCtrl etc.). Causes
+ references to most object files in the library, so calling this may
+ cause significant increase in executable size when linking with static
+ library.
+ */
+ static void RegisterAdditionalEditors();
+#else
+ static void RegisterAdditionalEditors() { }
+#endif
+
+ /** Replaces property with id with newly created property. For example,
+ this code replaces existing property named "Flags" with one that
+ will have different set of items:
+ @code
+ pg->ReplaceProperty("Flags",
+ wxFlagsProperty("Flags", wxPG_LABEL, newItems))
+ @endcode
+ For more info, see wxPropertyGrid::Insert.
+ */
+ wxPGProperty* ReplaceProperty( wxPGPropArg id, wxPGProperty* property );
+
+ /** @anchor propgridinterface_editablestate_flags
+
+ Flags for wxPropertyGridInterface::SaveEditableState() and
+ wxPropertyGridInterface::RestoreEditableState().
+ */
+ enum EditableStateFlags
+ {
+ /** Include selected property. */
+ SelectionState = 0x01,
+ /** Include expanded/collapsed property information. */
+ ExpandedState = 0x02,
+ /** Include scrolled position. */
+ ScrollPosState = 0x04,
+ /** Include selected page information.
+ Only applies to wxPropertyGridManager. */
+ PageState = 0x08,
+ /** Include splitter position. Stored for each page. */
+ SplitterPosState = 0x10,
+ /** Include description box size.
+ Only applies to wxPropertyGridManager. */
+ DescBoxState = 0x20,
+
+ /**
+ Include all supported user editable state information.
+ This is usually the default value. */
+ AllStates = SelectionState |
+ ExpandedState |
+ ScrollPosState |
+ PageState |
+ SplitterPosState |
+ DescBoxState
+ };
+
+ /**
+ Restores user-editable state.
+
+ See also wxPropertyGridInterface::SaveEditableState().
+
+ @param src
+ String generated by SaveEditableState.
+
+ @param restoreStates
+ Which parts to restore from source string. See @ref
+ propgridinterface_editablestate_flags "list of editable state
+ flags".
+
+ @return
+ False if there was problem reading the string.
+
+ @remarks
+ If some parts of state (such as scrolled or splitter position) fail to
+ restore correctly, please make sure that you call this function after
+ wxPropertyGrid size has been set (this may sometimes be tricky when
+ sizers are used).
+ */
+ bool RestoreEditableState( const wxString& src,
+ int restoreStates = AllStates );
+
+ /**
+ Used to acquire user-editable state (selected property, expanded
+ properties, scrolled position, splitter positions).
+
+ @param includedStates
+ Which parts of state to include. See @ref
+ propgridinterface_editablestate_flags "list of editable state flags".
+ */
+ wxString SaveEditableState( int includedStates = AllStates ) const;
+
+ /**
+ Lets user set the strings listed in the choice dropdown of a
+ wxBoolProperty. Defaults are "True" and "False", so changing them to,
+ say, "Yes" and "No" may be useful in some less technical applications.
+ */
+ static void SetBoolChoices( const wxString& trueChoice,
+ const wxString& falseChoice );
+
+ /**
+ Set proportion of a auto-stretchable column. wxPG_SPLITTER_AUTO_CENTER
+ window style needs to be used to indicate that columns are auto-
+ resizable.
+
+ @returns Returns @false on failure.
+
+ @remarks You should call this for individual pages of
+ wxPropertyGridManager (if used).
+
+ @see GetColumnProportion()
+ */
+ bool SetColumnProportion( unsigned int column, int proportion );
+
+ /**
+ Returns auto-resize proportion of the given column.
+
+ @see SetColumnProportion()
+ */
+ int GetColumnProportion( unsigned int column ) const
+ {
+ return m_pState->DoGetColumnProportion(column);
+ }
+
+ /** Sets an attribute for this property.
+ @param name
+ Text identifier of attribute. See @ref propgrid_property_attributes.
+ @param value
+ Value of attribute.
+ @param argFlags
+ Optional. Use wxPG_RECURSE to set the attribute to child properties
+ recursively.
+ */
+ void SetPropertyAttribute( wxPGPropArg id,
+ const wxString& attrName,
+ wxVariant value,
+ long argFlags = 0 )
+ {
+ DoSetPropertyAttribute(id,attrName,value,argFlags);
+ }
+
+ /** Sets property attribute for all applicapple properties.
+ Be sure to use this method only after all properties have been
+ added to the grid.
+ */
+ void SetPropertyAttributeAll( const wxString& attrName, wxVariant value );
+
+ /**
+ Sets background colour of a property.
+
+ @param id
+ Property name or pointer.
+
+ @param colour
+ New background colour.
+
+ @param flags
+ Default is wxPG_RECURSE which causes colour to be set recursively.
+ Omit this flag to only set colour for the property in question
+ and not any of its children.
+ */
+ void SetPropertyBackgroundColour( wxPGPropArg id,
+ const wxColour& colour,
+ int flags = wxPG_RECURSE );
+
+ /** Resets text and background colours of given property.
+ */
+ void SetPropertyColoursToDefault( wxPGPropArg id );
+
+ /**
+ Sets text colour of a property.
+
+ @param id
+ Property name or pointer.
+
+ @param colour
+ New background colour.
+
+ @param flags
+ Default is wxPG_RECURSE which causes colour to be set recursively.
+ Omit this flag to only set colour for the property in question
+ and not any of its children.
+ */
+ void SetPropertyTextColour( wxPGPropArg id,
+ const wxColour& col,
+ int flags = wxPG_RECURSE );
+
+ /**
+ Returns background colour of first cell of a property.
+ */
+ wxColour GetPropertyBackgroundColour( wxPGPropArg id ) const
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxColour())
+ return p->GetCell(0).GetBgCol();
+ }
+
+ /**
+ Returns text colour of first cell of a property.
+ */
+ wxColour GetPropertyTextColour( wxPGPropArg id ) const
+ {
+ wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxColour())
+ return p->GetCell(0).GetFgCol();
+ }
+
+ /** Sets text, bitmap, and colours for given column's cell.
+
+ @remarks
+ - You can set label cell by setting column to 0.
+ - You can use wxPG_LABEL as text to use default text for column.
+ */
+ void SetPropertyCell( wxPGPropArg id,
+ int column,
+ const wxString& text = wxEmptyString,
+ const wxBitmap& bitmap = wxNullBitmap,
+ const wxColour& fgCol = wxNullColour,
+ const wxColour& bgCol = wxNullColour );
+
+ /** Sets client data (void*) of a property.
+ @remarks
+ This untyped client data has to be deleted manually.
+ */
+ void SetPropertyClientData( wxPGPropArg id, void* clientData )
+ {
+ wxPG_PROP_ARG_CALL_PROLOG()
+ p->SetClientData(clientData);
+ }
+
+ /** Sets editor for a property.
+
+ @param editor
+ For builtin editors, use wxPGEditor_X, where X is builtin editor's
+ name (TextCtrl, Choice, etc. see wxPGEditor documentation for full
+ list).
+
+ For custom editors, use pointer you received from
+ wxPropertyGrid::RegisterEditorClass().
+ */
+ void SetPropertyEditor( wxPGPropArg id, const wxPGEditor* editor )
+ {
+ wxPG_PROP_ARG_CALL_PROLOG()
+ wxCHECK_RET( editor, wxT("unknown/NULL editor") );
+ p->SetEditor(editor);
+ RefreshProperty(p);
+ }
+
+ /** Sets editor control of a property. As editor argument, use
+ editor name string, such as "TextCtrl" or "Choice".
+ */
+ void SetPropertyEditor( wxPGPropArg id, const wxString& editorName )
+ {
+ SetPropertyEditor(id,GetEditorByName(editorName));
+ }
+
+ /** Sets label of a property.
+ */
+ void SetPropertyLabel( wxPGPropArg id, const wxString& newproplabel );
+
+ /**
+ Sets name of a property.
+
+ @param id
+ Name or pointer of property which name to change.
+
+ @param newName
+ New name for property.
+ */
+ void SetPropertyName( wxPGPropArg id, const wxString& newName )
+ {
+ wxPG_PROP_ARG_CALL_PROLOG()
+ m_pState->DoSetPropertyName( p, newName );
+ }
+
+ /**
+ Sets property (and, recursively, its children) to have read-only value.
+ In other words, user cannot change the value in the editor, but they
+ can still copy it.
+ @remarks
+ This is mainly for use with textctrl editor. Not all other editors fully
+ support it.
+ @param flags
+ By default changes are applied recursively. Set this paramter
+ wxPG_DONT_RECURSE to prevent this.
+ */
+ void SetPropertyReadOnly( wxPGPropArg id,
+ bool set = true,
+ int flags = wxPG_RECURSE )
+ {
+ wxPG_PROP_ARG_CALL_PROLOG()
+ if ( flags & wxPG_RECURSE )
+ p->SetFlagRecursively(wxPG_PROP_READONLY, set);
+ else
+ p->ChangeFlag(wxPG_PROP_READONLY, set);
+ }
+
+ /** Sets property's value to unspecified.
+ If it has children (it may be category), then the same thing is done to
+ them.
+ */
+ void SetPropertyValueUnspecified( wxPGPropArg id )
+ {
+ wxPG_PROP_ARG_CALL_PROLOG()
+ p->SetValueToUnspecified();
+ }
+
+ /**
+ Sets property values from a list of wxVariants.
+ */
+ void SetPropertyValues( const wxVariantList& list,
+ wxPGPropArg defaultCategory = wxNullProperty )
+ {
+ wxPGProperty *p;
+ if ( defaultCategory.HasName() ) p = defaultCategory.GetPtr(this);
+ else p = defaultCategory.GetPtr0();
+ m_pState->DoSetPropertyValues(list, p);
+ }
+
+ /**
+ Sets property values from a list of wxVariants.
+ */
+ void SetPropertyValues( const wxVariant& list,
+ wxPGPropArg defaultCategory = wxNullProperty )
+ {
+ SetPropertyValues(list.GetList(),defaultCategory);
+ }
+
+ /** Associates the help string with property.
+ @remarks
+ By default, text is shown either in the manager's "description"
+ text box or in the status bar. If extra window style
+ wxPG_EX_HELP_AS_TOOLTIPS is used, then the text will appear as a
+ tooltip.
+ */
+ void SetPropertyHelpString( wxPGPropArg id, const wxString& helpString )
+ {
+ wxPG_PROP_ARG_CALL_PROLOG()
+ p->SetHelpString(helpString);
+ }
+
+ /** Set wxBitmap in front of the value.
+ @remarks
+ - Bitmap will be scaled to a size returned by
+ wxPropertyGrid::GetImageSize();
+ */
+ void SetPropertyImage( wxPGPropArg id, wxBitmap& bmp )
+ {
+ wxPG_PROP_ARG_CALL_PROLOG()
+ p->SetValueImage(bmp);
+ RefreshProperty(p);
+ }
+
+ /** Sets max length of property's text.
+ */
+ bool SetPropertyMaxLength( wxPGPropArg id, int maxLen );
+
+#if wxUSE_VALIDATORS
+ /** Sets validator of a property.
+ */
+ void SetPropertyValidator( wxPGPropArg id, const wxValidator& validator )
+ {
+ wxPG_PROP_ARG_CALL_PROLOG()
+ p->SetValidator(validator);
+ }
+#endif
+
+ /** Sets value (long integer) of a property.
+ */
+ void SetPropertyValue( wxPGPropArg id, long value )
+ {
+ wxVariant v(value);
+ SetPropVal( id, v );
+ }
+
+ /** Sets value (integer) of a property.
+ */
+ void SetPropertyValue( wxPGPropArg id, int value )
+ {
+ wxVariant v((long)value);
+ SetPropVal( id, v );
+ }
+ /** Sets value (floating point) of a property.
+ */
+ void SetPropertyValue( wxPGPropArg id, double value )
+ {
+ wxVariant v(value);
+ SetPropVal( id, v );
+ }
+ /** Sets value (bool) of a property.
+ */
+ void SetPropertyValue( wxPGPropArg id, bool value )
+ {
+ wxVariant v(value);
+ SetPropVal( id, v );
+ }
+ void SetPropertyValue( wxPGPropArg id, const wchar_t* value )
+ {
+ SetPropertyValueString( id, wxString(value) );
+ }
+ void SetPropertyValue( wxPGPropArg id, const char* value )
+ {
+ SetPropertyValueString( id, wxString(value) );
+ }
+ void SetPropertyValue( wxPGPropArg id, const wxString& value )
+ {
+ SetPropertyValueString( id, value );
+ }
+
+ /** Sets value (wxArrayString) of a property.
+ */
+ void SetPropertyValue( wxPGPropArg id, const wxArrayString& value )
+ {
+ wxVariant v(value);
+ SetPropVal( id, v );
+ }
+
+#if wxUSE_DATETIME
+ void SetPropertyValue( wxPGPropArg id, const wxDateTime& value )
+ {
+ wxVariant v(value);
+ SetPropVal( id, v );
+ }
+#endif
+
+ /** Sets value (wxObject*) of a property.
+ */
+ void SetPropertyValue( wxPGPropArg id, wxObject* value )
+ {
+ wxVariant v(value);
+ SetPropVal( id, v );
+ }
+
+ void SetPropertyValue( wxPGPropArg id, wxObject& value )
+ {
+ wxVariant v(&value);
+ SetPropVal( id, v );
+ }
+
+#ifdef wxLongLong_t
+ /** Sets value (wxLongLong&) of a property.
+ */
+ void SetPropertyValue( wxPGPropArg id, wxLongLong_t value )
+ {
+ wxVariant v = WXVARIANT(wxLongLong(value));
+ SetPropVal( id, v );
+ }
+ /** Sets value (wxULongLong&) of a property.
+ */
+ void SetPropertyValue( wxPGPropArg id, wxULongLong_t value )
+ {
+ wxVariant v = WXVARIANT(wxULongLong(value));
+ SetPropVal( id, v );
+ }
+#endif
+
+ /** Sets value (wxArrayInt&) of a property.
+ */
+ void SetPropertyValue( wxPGPropArg id, const wxArrayInt& value )
+ {
+ wxVariant v = WXVARIANT(value);
+ SetPropVal( id, v );
+ }
+
+ /** Sets value (wxString) of a property.
+
+ @remarks
+ This method uses wxPGProperty::SetValueFromString, which all properties
+ should implement. This means that there should not be a type error,
+ and instead the string is converted to property's actual value type.
+ */
+ void SetPropertyValueString( wxPGPropArg id, const wxString& value );
+
+ /** Sets value (wxVariant&) of a property.
+
+ @remarks
+ Use wxPropertyGrid::ChangePropertyValue() instead if you need to run
+ through validation process and send property change event.
+ */
+ void SetPropertyValue( wxPGPropArg id, wxVariant value )
+ {
+ SetPropVal( id, value );
+ }
+
+ /** Sets value (wxVariant&) of a property. Same as SetPropertyValue, but
+ accepts reference. */
+ void SetPropVal( wxPGPropArg id, wxVariant& value );
+
+ /** Adjusts how wxPropertyGrid behaves when invalid value is entered
+ in a property.
+ @param vfbFlags
+ See @link vfbflags list of valid flags values@endlink
+ */
+ void SetValidationFailureBehavior( int vfbFlags );
+
+ /**
+ Sorts all properties recursively.
+
+ @param flags
+ This can contain any of the following options:
+ wxPG_SORT_TOP_LEVEL_ONLY: Only sort categories and their
+ immediate children. Sorting done by wxPG_AUTO_SORT option
+ uses this.
+
+ @see SortChildren, wxPropertyGrid::SetSortFunction
+ */
+ void Sort( int flags = 0 );
+
+ /**
+ Sorts children of a property.
+
+ @param id
+ Name or pointer to a property.
+
+ @param flags
+ This can contain any of the following options:
+ wxPG_RECURSE: Sorts recursively.
+
+ @see Sort, wxPropertyGrid::SetSortFunction
+ */
+ void SortChildren( wxPGPropArg id, int flags = 0 )
+ {
+ wxPG_PROP_ARG_CALL_PROLOG()
+ m_pState->DoSortChildren(p, flags);
+ }
+
+ // GetPropertyByName With nice assertion error message.
+ wxPGProperty* GetPropertyByNameA( const wxString& name ) const;
+
+ static wxPGEditor* GetEditorByName( const wxString& editorName );
+
+ // NOTE: This function reselects the property and may cause
+ // excess flicker, so to just call Refresh() on a rect
+ // of single property, call DrawItem() instead.
+ virtual void RefreshProperty( wxPGProperty* p ) = 0;
+
+protected:
+
+ bool DoClearSelection( bool validation = false,
+ int selFlags = 0 );
+
+ /**
+ In derived class, implement to set editable state component with
+ given name to given value.
+ */
+ virtual bool SetEditableStateItem( const wxString& name, wxVariant value )
+ {
+ wxUnusedVar(name);
+ wxUnusedVar(value);
+ return false;
+ }
+
+ /**
+ In derived class, implement to return editable state component with
+ given name.
+ */
+ virtual wxVariant GetEditableStateItem( const wxString& name ) const
+ {
+ wxUnusedVar(name);
+ return wxNullVariant;
+ }
+
+ // Returns page state data for given (sub) page (-1 means current page).
+ virtual wxPropertyGridPageState* GetPageState( int pageIndex ) const
+ {
+ if ( pageIndex <= 0 )
+ return m_pState;
+ return NULL;
+ }
+
+ virtual bool DoSelectPage( int WXUNUSED(index) ) { return true; }
+
+ // Default call's m_pState's BaseGetPropertyByName
+ virtual wxPGProperty* DoGetPropertyByName( const wxString& name ) const;
+
+ // Deriving classes must set this (it must be only or current page).
+ wxPropertyGridPageState* m_pState;
+
+ // Intermediate version needed due to wxVariant copying inefficiency
+ void DoSetPropertyAttribute( wxPGPropArg id,
+ const wxString& name,
+ wxVariant& value, long argFlags );
+
+ // Empty string object to return from member functions returning const
+ // wxString&.
+ wxString m_emptyString;
+
+private:
+ // Cannot be GetGrid() due to ambiguity issues.
+ wxPropertyGrid* GetPropertyGrid()
+ {
+ if ( !m_pState )
+ return NULL;
+ return m_pState->GetGrid();
+ }
+
+ // Cannot be GetGrid() due to ambiguity issues.
+ const wxPropertyGrid* GetPropertyGrid() const
+ {
+ if ( !m_pState )
+ return NULL;
+
+ return m_pState->GetGrid();
+ }
+
+ friend class wxPropertyGrid;
+ friend class wxPropertyGridManager;
+};
+
+#endif // wxUSE_PROPGRID
+
+#endif // __WX_PROPGRID_PROPGRIDIFACE_H__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/propgrid/propgridpagestate.h
+// Purpose: wxPropertyGridPageState class
+// Author: Jaakko Salli
+// Modified by:
+// Created: 2008-08-24
+// Copyright: (c) Jaakko Salli
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PROPGRID_PROPGRIDPAGESTATE_H_
+#define _WX_PROPGRID_PROPGRIDPAGESTATE_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_PROPGRID
+
+#include "wx/propgrid/property.h"
+
+// -----------------------------------------------------------------------
+
+/** @section propgrid_hittestresult wxPropertyGridHitTestResult
+
+ A return value from wxPropertyGrid::HitTest(),
+ contains all you need to know about an arbitrary location on the grid.
+*/
+class WXDLLIMPEXP_PROPGRID wxPropertyGridHitTestResult
+{
+ friend class wxPropertyGridPageState;
+public:
+ wxPropertyGridHitTestResult()
+ {
+ m_property = NULL;
+ m_column = -1;
+ m_splitter = -1;
+ m_splitterHitOffset = 0;
+ }
+
+ ~wxPropertyGridHitTestResult()
+ {
+ }
+
+ /**
+ Returns column hit. -1 for margin.
+ */
+ int GetColumn() const { return m_column; }
+
+ /**
+ Returns property hit. NULL if empty space below
+ properties was hit instead.
+ */
+ wxPGProperty* GetProperty() const
+ {
+ return m_property;
+ }
+
+ /**
+ Returns index of splitter hit, -1 for none.
+ */
+ int GetSplitter() const { return m_splitter; }
+
+ /**
+ If splitter hit, then this member function
+ returns offset to the exact splitter position.
+ */
+ int GetSplitterHitOffset() const { return m_splitterHitOffset; }
+
+private:
+ /** Property. NULL if empty space below properties was hit */
+ wxPGProperty* m_property;
+
+ /** Column. -1 for margin. */
+ int m_column;
+
+ /** Index of splitter hit, -1 for none. */
+ int m_splitter;
+
+ /** If splitter hit, offset to that */
+ int m_splitterHitOffset;
+};
+
+// -----------------------------------------------------------------------
+
+#define wxPG_IT_CHILDREN(A) ((A)<<16)
+
+/** @section propgrid_iterator_flags wxPropertyGridIterator Flags
+ @{
+
+ NOTES: At lower 16-bits, there are flags to check if item will be included.
+ At higher 16-bits, there are same flags, but to instead check if children
+ will be included.
+*/
+
+enum wxPG_ITERATOR_FLAGS
+{
+
+/**
+ Iterate through 'normal' property items (does not include children of
+ aggregate or hidden items by default).
+*/
+wxPG_ITERATE_PROPERTIES = wxPG_PROP_PROPERTY |
+ wxPG_PROP_MISC_PARENT |
+ wxPG_PROP_AGGREGATE |
+ wxPG_PROP_COLLAPSED |
+ wxPG_IT_CHILDREN(wxPG_PROP_MISC_PARENT) |
+ wxPG_IT_CHILDREN(wxPG_PROP_CATEGORY),
+
+/** Iterate children of collapsed parents, and individual items that are hidden.
+*/
+wxPG_ITERATE_HIDDEN = wxPG_PROP_HIDDEN |
+ wxPG_IT_CHILDREN(wxPG_PROP_COLLAPSED),
+
+/**
+ Iterate children of parent that is an aggregate property (ie has fixed
+ children).
+*/
+wxPG_ITERATE_FIXED_CHILDREN = wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE) |
+ wxPG_ITERATE_PROPERTIES,
+
+/** Iterate categories.
+ Note that even without this flag, children of categories are still iterated
+ through.
+*/
+wxPG_ITERATE_CATEGORIES = wxPG_PROP_CATEGORY |
+ wxPG_IT_CHILDREN(wxPG_PROP_CATEGORY) |
+ wxPG_PROP_COLLAPSED,
+
+wxPG_ITERATE_ALL_PARENTS = wxPG_PROP_MISC_PARENT |
+ wxPG_PROP_AGGREGATE |
+ wxPG_PROP_CATEGORY,
+
+wxPG_ITERATE_ALL_PARENTS_RECURSIVELY = wxPG_ITERATE_ALL_PARENTS |
+ wxPG_IT_CHILDREN(
+ wxPG_ITERATE_ALL_PARENTS),
+
+wxPG_ITERATOR_FLAGS_ALL = wxPG_PROP_PROPERTY |
+ wxPG_PROP_MISC_PARENT |
+ wxPG_PROP_AGGREGATE |
+ wxPG_PROP_HIDDEN |
+ wxPG_PROP_CATEGORY |
+ wxPG_PROP_COLLAPSED,
+
+wxPG_ITERATOR_MASK_OP_ITEM = wxPG_ITERATOR_FLAGS_ALL,
+
+// (wxPG_PROP_MISC_PARENT|wxPG_PROP_AGGREGATE|wxPG_PROP_CATEGORY)
+wxPG_ITERATOR_MASK_OP_PARENT = wxPG_ITERATOR_FLAGS_ALL,
+
+/** Combines all flags needed to iterate through visible properties
+ (ie hidden properties and children of collapsed parents are skipped).
+*/
+wxPG_ITERATE_VISIBLE = wxPG_ITERATE_PROPERTIES |
+ wxPG_PROP_CATEGORY |
+ wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE),
+
+/** Iterate all items.
+*/
+wxPG_ITERATE_ALL = wxPG_ITERATE_VISIBLE |
+ wxPG_ITERATE_HIDDEN,
+
+/** Iterate through individual properties (ie categories and children of
+ aggregate properties are skipped).
+*/
+wxPG_ITERATE_NORMAL = wxPG_ITERATE_PROPERTIES |
+ wxPG_ITERATE_HIDDEN,
+
+/** Default iterator flags.
+*/
+wxPG_ITERATE_DEFAULT = wxPG_ITERATE_NORMAL
+
+};
+
+/** @}
+*/
+
+
+#define wxPG_ITERATOR_CREATE_MASKS(FLAGS, A, B) \
+ A = (FLAGS ^ wxPG_ITERATOR_MASK_OP_ITEM) & \
+ wxPG_ITERATOR_MASK_OP_ITEM & 0xFFFF; \
+ B = ((FLAGS>>16) ^ wxPG_ITERATOR_MASK_OP_PARENT) & \
+ wxPG_ITERATOR_MASK_OP_PARENT & 0xFFFF;
+
+
+// Macro to test if children of PWC should be iterated through
+#define wxPG_ITERATOR_PARENTEXMASK_TEST(PWC, PARENTMASK) \
+ ( \
+ !(PWC->GetFlags() & PARENTMASK) && \
+ PWC->GetChildCount() \
+ )
+
+
+// Base for wxPropertyGridIterator classes.
+class WXDLLIMPEXP_PROPGRID wxPropertyGridIteratorBase
+{
+public:
+ wxPropertyGridIteratorBase()
+ {
+ }
+
+ void Assign( const wxPropertyGridIteratorBase& it );
+
+ bool AtEnd() const { return m_property == NULL; }
+
+ /** Get current property.
+ */
+ wxPGProperty* GetProperty() const { return m_property; }
+
+ void Init( wxPropertyGridPageState* state,
+ int flags,
+ wxPGProperty* property,
+ int dir = 1 );
+
+ void Init( wxPropertyGridPageState* state,
+ int flags,
+ int startPos = wxTOP,
+ int dir = 0 );
+
+ /** Iterate to the next property.
+ */
+ void Next( bool iterateChildren = true );
+
+ /** Iterate to the previous property.
+ */
+ void Prev();
+
+ /**
+ Set base parent, ie a property when, in which iteration returns, it
+ ends.
+
+ Default base parent is the root of the used wxPropertyGridPageState.
+ */
+ void SetBaseParent( wxPGProperty* baseParent )
+ { m_baseParent = baseParent; }
+
+protected:
+
+ wxPGProperty* m_property;
+
+private:
+ wxPropertyGridPageState* m_state;
+ wxPGProperty* m_baseParent;
+
+ // Masks are used to quickly exclude items
+ int m_itemExMask;
+ int m_parentExMask;
+};
+
+
+#define wxPG_IMPLEMENT_ITERATOR(CLASS, PROPERTY, STATE) \
+ CLASS( STATE* state, int flags = wxPG_ITERATE_DEFAULT, \
+ PROPERTY* property = NULL, int dir = 1 ) \
+ : wxPropertyGridIteratorBase() \
+ { Init( (wxPropertyGridPageState*)state, flags, \
+ (wxPGProperty*)property, dir ); } \
+ CLASS( STATE* state, int flags, int startPos, int dir = 0 ) \
+ : wxPropertyGridIteratorBase() \
+ { Init( (wxPropertyGridPageState*)state, flags, startPos, dir ); } \
+ CLASS() \
+ : wxPropertyGridIteratorBase() \
+ { \
+ m_property = NULL; \
+ } \
+ CLASS( const CLASS& it ) \
+ : wxPropertyGridIteratorBase( ) \
+ { \
+ Assign(it); \
+ } \
+ ~CLASS() \
+ { \
+ } \
+ const CLASS& operator=( const CLASS& it ) \
+ { \
+ if (this != &it) \
+ Assign(it); \
+ return *this; \
+ } \
+ CLASS& operator++() { Next(); return *this; } \
+ CLASS operator++(int) { CLASS it=*this;Next();return it; } \
+ CLASS& operator--() { Prev(); return *this; } \
+ CLASS operator--(int) { CLASS it=*this;Prev();return it; } \
+ PROPERTY* operator *() const { return (PROPERTY*)m_property; } \
+ static PROPERTY* OneStep( STATE* state, \
+ int flags = wxPG_ITERATE_DEFAULT, \
+ PROPERTY* property = NULL, \
+ int dir = 1 ) \
+ { \
+ CLASS it( state, flags, property, dir ); \
+ if ( property ) \
+ { \
+ if ( dir == 1 ) it.Next(); \
+ else it.Prev(); \
+ } \
+ return *it; \
+ }
+
+
+/** @class wxPropertyGridIterator
+
+ Preferable way to iterate through contents of wxPropertyGrid,
+ wxPropertyGridManager, and wxPropertyGridPage.
+
+ See wxPropertyGridInterface::GetIterator() for more information about usage.
+
+ @library{wxpropgrid}
+ @category{propgrid}
+*/
+class WXDLLIMPEXP_PROPGRID
+ wxPropertyGridIterator : public wxPropertyGridIteratorBase
+{
+public:
+
+ wxPG_IMPLEMENT_ITERATOR(wxPropertyGridIterator,
+ wxPGProperty,
+ wxPropertyGridPageState)
+
+protected:
+};
+
+
+// Const version of wxPropertyGridIterator.
+class WXDLLIMPEXP_PROPGRID
+ wxPropertyGridConstIterator : public wxPropertyGridIteratorBase
+{
+public:
+ wxPG_IMPLEMENT_ITERATOR(wxPropertyGridConstIterator,
+ const wxPGProperty,
+ const wxPropertyGridPageState)
+
+ /**
+ Additional copy constructor.
+ */
+ wxPropertyGridConstIterator( const wxPropertyGridIterator& other )
+ {
+ Assign(other);
+ }
+
+ /**
+ Additional assignment operator.
+ */
+ const wxPropertyGridConstIterator& operator=( const wxPropertyGridIterator& it )
+ {
+ Assign(it);
+ return *this;
+ }
+
+protected:
+};
+
+// -----------------------------------------------------------------------
+
+/** Base class to derive new viterators.
+*/
+class WXDLLIMPEXP_PROPGRID wxPGVIteratorBase : public wxObjectRefData
+{
+ friend class wxPGVIterator;
+public:
+ wxPGVIteratorBase() { }
+ virtual void Next() = 0;
+protected:
+ virtual ~wxPGVIteratorBase() { }
+
+ wxPropertyGridIterator m_it;
+};
+
+/** @class wxPGVIterator
+
+ Abstract implementation of a simple iterator. Can only be used
+ to iterate in forward order, and only through the entire container.
+ Used to have functions dealing with all properties work with both
+ wxPropertyGrid and wxPropertyGridManager.
+*/
+class WXDLLIMPEXP_PROPGRID wxPGVIterator
+{
+public:
+ wxPGVIterator() { m_pIt = NULL; }
+ wxPGVIterator( wxPGVIteratorBase* obj ) { m_pIt = obj; }
+ ~wxPGVIterator() { UnRef(); }
+ void UnRef() { if (m_pIt) m_pIt->DecRef(); }
+ wxPGVIterator( const wxPGVIterator& it )
+ {
+ m_pIt = it.m_pIt;
+ m_pIt->IncRef();
+ }
+ const wxPGVIterator& operator=( const wxPGVIterator& it )
+ {
+ if (this != &it)
+ {
+ UnRef();
+ m_pIt = it.m_pIt;
+ m_pIt->IncRef();
+ }
+ return *this;
+ }
+ void Next() { m_pIt->Next(); }
+ bool AtEnd() const { return m_pIt->m_it.AtEnd(); }
+ wxPGProperty* GetProperty() const { return m_pIt->m_it.GetProperty(); }
+protected:
+ wxPGVIteratorBase* m_pIt;
+};
+
+// -----------------------------------------------------------------------
+
+/** @class wxPropertyGridPageState
+
+ Contains low-level property page information (properties, column widths,
+ etc) of a single wxPropertyGrid or single wxPropertyGridPage. Generally you
+ should not use this class directly, but instead member functions in
+ wxPropertyGridInterface, wxPropertyGrid, wxPropertyGridPage, and
+ wxPropertyGridManager.
+
+ @remarks
+ - In separate wxPropertyGrid component this class was known as
+ wxPropertyGridState.
+ - Currently this class is not implemented in wxPython.
+
+ @library{wxpropgrid}
+ @category{propgrid}
+*/
+class WXDLLIMPEXP_PROPGRID wxPropertyGridPageState
+{
+ friend class wxPGProperty;
+ friend class wxPropertyGrid;
+ friend class wxPGCanvas;
+ friend class wxPropertyGridInterface;
+ friend class wxPropertyGridPage;
+ friend class wxPropertyGridManager;
+public:
+
+ /** Default constructor. */
+ wxPropertyGridPageState();
+
+ /** Destructor. */
+ virtual ~wxPropertyGridPageState();
+
+ /** Makes sure all columns have minimum width.
+ */
+ void CheckColumnWidths( int widthChange = 0 );
+
+ /**
+ Override this member function to add custom behaviour on property
+ deletion.
+ */
+ virtual void DoDelete( wxPGProperty* item, bool doDelete = true );
+
+ wxSize DoFitColumns( bool allowGridResize = false );
+
+ wxPGProperty* DoGetItemAtY( int y ) const;
+
+ /**
+ Override this member function to add custom behaviour on property
+ insertion.
+ */
+ virtual wxPGProperty* DoInsert( wxPGProperty* parent,
+ int index,
+ wxPGProperty* property );
+
+ /**
+ This needs to be overridden in grid used the manager so that splitter
+ changes can be propagated to other pages.
+ */
+ virtual void DoSetSplitterPosition( int pos,
+ int splitterColumn = 0,
+ int flags = 0 );
+
+ bool EnableCategories( bool enable );
+
+ /** Make sure virtual height is up-to-date.
+ */
+ void EnsureVirtualHeight()
+ {
+ if ( m_vhCalcPending )
+ {
+ RecalculateVirtualHeight();
+ m_vhCalcPending = 0;
+ }
+ }
+
+ /** Returns (precalculated) height of contained visible properties.
+ */
+ unsigned int GetVirtualHeight() const
+ {
+ wxASSERT( !m_vhCalcPending );
+ return m_virtualHeight;
+ }
+
+ /** Returns (precalculated) height of contained visible properties.
+ */
+ unsigned int GetVirtualHeight()
+ {
+ EnsureVirtualHeight();
+ return m_virtualHeight;
+ }
+
+ /** Returns actual height of contained visible properties.
+ @remarks
+ Mostly used for internal diagnostic purposes.
+ */
+ inline unsigned int GetActualVirtualHeight() const;
+
+ unsigned int GetColumnCount() const
+ {
+ return (unsigned int) m_colWidths.size();
+ }
+
+ int GetColumnMinWidth( int column ) const;
+
+ int GetColumnWidth( unsigned int column ) const
+ {
+ return m_colWidths[column];
+ }
+
+ wxPropertyGrid* GetGrid() const { return m_pPropGrid; }
+
+ /** Returns last item which could be iterated using given flags.
+ @param flags
+ @link iteratorflags List of iterator flags@endlink
+ */
+ wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT );
+
+ const wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT ) const
+ {
+ return ((wxPropertyGridPageState*)this)->GetLastItem(flags);
+ }
+
+ /**
+ Returns currently selected property.
+ */
+ wxPGProperty* GetSelection() const
+ {
+ if ( m_selection.size() == 0 )
+ return NULL;
+ return m_selection[0];
+ }
+
+ void DoSetSelection( wxPGProperty* prop )
+ {
+ m_selection.clear();
+ if ( prop )
+ m_selection.push_back(prop);
+ }
+
+ bool DoClearSelection()
+ {
+ return DoSelectProperty(NULL);
+ }
+
+ void DoRemoveFromSelection( wxPGProperty* prop );
+
+ void DoSetColumnProportion( unsigned int column, int proportion );
+
+ int DoGetColumnProportion( unsigned int column ) const
+ {
+ return m_columnProportions[column];
+ }
+
+ void ResetColumnSizes( int setSplitterFlags );
+
+ wxPropertyCategory* GetPropertyCategory( const wxPGProperty* p ) const;
+
+ wxPGProperty* GetPropertyByLabel( const wxString& name,
+ wxPGProperty* parent = NULL ) const;
+
+ wxVariant DoGetPropertyValues( const wxString& listname,
+ wxPGProperty* baseparent,
+ long flags ) const;
+
+ wxPGProperty* DoGetRoot() const { return m_properties; }
+
+ void DoSetPropertyName( wxPGProperty* p, const wxString& newName );
+
+ // Returns combined width of margin and all the columns
+ int GetVirtualWidth() const
+ {
+ return m_width;
+ }
+
+ /**
+ Returns minimal width for given column so that all images and texts
+ will fit entirely.
+
+ Used by SetSplitterLeft() and DoFitColumns().
+ */
+ int GetColumnFitWidth(wxClientDC& dc,
+ wxPGProperty* pwc,
+ unsigned int col,
+ bool subProps) const;
+
+ int GetColumnFullWidth(wxClientDC &dc, wxPGProperty *p, unsigned int col);
+
+ /**
+ Returns information about arbitrary position in the grid.
+
+ @param pt
+ Logical coordinates in the virtual grid space. Use
+ wxScrolled<T>::CalcUnscrolledPosition() if you need to
+ translate a scrolled position into a logical one.
+ */
+ wxPropertyGridHitTestResult HitTest( const wxPoint& pt ) const;
+
+ /** Returns true if page is visibly displayed.
+ */
+ inline bool IsDisplayed() const;
+
+ bool IsInNonCatMode() const { return (bool)(m_properties == m_abcArray); }
+
+ void DoLimitPropertyEditing( wxPGProperty* p, bool limit = true )
+ {
+ p->SetFlagRecursively(wxPG_PROP_NOEDITOR, limit);
+ }
+
+ bool DoSelectProperty( wxPGProperty* p, unsigned int flags = 0 );
+
+ /** widthChange is non-client.
+ */
+ void OnClientWidthChange( int newWidth,
+ int widthChange,
+ bool fromOnResize = false );
+
+ /** Recalculates m_virtualHeight.
+ */
+ void RecalculateVirtualHeight()
+ {
+ m_virtualHeight = GetActualVirtualHeight();
+ }
+
+ void SetColumnCount( int colCount );
+
+ void PropagateColSizeDec( int column, int decrease, int dir );
+
+ bool DoHideProperty( wxPGProperty* p, bool hide, int flags = wxPG_RECURSE );
+
+ bool DoSetPropertyValueString( wxPGProperty* p, const wxString& value );
+
+ bool DoSetPropertyValue( wxPGProperty* p, wxVariant& value );
+
+ bool DoSetPropertyValueWxObjectPtr( wxPGProperty* p, wxObject* value );
+ void DoSetPropertyValues( const wxVariantList& list,
+ wxPGProperty* default_category );
+
+ void SetSplitterLeft( bool subProps = false );
+
+ /** Set virtual width for this particular page. */
+ void SetVirtualWidth( int width );
+
+ void DoSortChildren( wxPGProperty* p, int flags = 0 );
+ void DoSort( int flags = 0 );
+
+ bool PrepareAfterItemsAdded();
+
+ /** Called after virtual height needs to be recalculated.
+ */
+ void VirtualHeightChanged()
+ {
+ m_vhCalcPending = 1;
+ }
+
+ /** Base append. */
+ wxPGProperty* DoAppend( wxPGProperty* property );
+
+ /** Returns property by its name. */
+ wxPGProperty* BaseGetPropertyByName( const wxString& name ) const;
+
+ /** Called in, for example, wxPropertyGrid::Clear. */
+ void DoClear();
+
+ bool DoIsPropertySelected( wxPGProperty* prop ) const;
+
+ bool DoCollapse( wxPGProperty* p );
+
+ bool DoExpand( wxPGProperty* p );
+
+ void CalculateFontAndBitmapStuff( int vspacing );
+
+protected:
+
+ // Utility to check if two properties are visibly next to each other
+ bool ArePropertiesAdjacent( wxPGProperty* prop1,
+ wxPGProperty* prop2,
+ int iterFlags = wxPG_ITERATE_VISIBLE ) const;
+
+ int DoGetSplitterPosition( int splitterIndex = 0 ) const;
+
+ /** Returns column at x coordinate (in GetGrid()->GetPanel()).
+ @param pSplitterHit
+ Give pointer to int that receives index to splitter that is at x.
+ @param pSplitterHitOffset
+ Distance from said splitter.
+ */
+ int HitTestH( int x, int* pSplitterHit, int* pSplitterHitOffset ) const;
+
+ bool PrepareToAddItem( wxPGProperty* property,
+ wxPGProperty* scheduledParent );
+
+ /** If visible, then this is pointer to wxPropertyGrid.
+ This shall *never* be NULL to indicate that this state is not visible.
+ */
+ wxPropertyGrid* m_pPropGrid;
+
+ /** Pointer to currently used array. */
+ wxPGProperty* m_properties;
+
+ /** Array for categoric mode. */
+ wxPGRootProperty m_regularArray;
+
+ /** Array for root of non-categoric mode. */
+ wxPGRootProperty* m_abcArray;
+
+ /** Dictionary for name-based access. */
+ wxPGHashMapS2P m_dictName;
+
+ /** List of column widths (first column does not include margin). */
+ wxArrayInt m_colWidths;
+
+ /** List of indices of columns the user can edit by clicking it. */
+ wxArrayInt m_editableColumns;
+
+ /** Column proportions */
+ wxArrayInt m_columnProportions;
+
+ double m_fSplitterX;
+
+ /** Most recently added category. */
+ wxPropertyCategory* m_currentCategory;
+
+ /** Array of selected property. */
+ wxArrayPGProperty m_selection;
+
+ /** Virtual width. */
+ int m_width;
+
+ /** Indicates total virtual height of visible properties. */
+ unsigned int m_virtualHeight;
+
+ /** 1 if m_lastCaption is also the bottommost caption. */
+ unsigned char m_lastCaptionBottomnest;
+
+ /** 1 items appended/inserted, so stuff needs to be done before drawing;
+ If m_virtualHeight == 0, then calcylatey's must be done.
+ Otherwise just sort.
+ */
+ unsigned char m_itemsAdded;
+
+ /** 1 if any value is modified. */
+ unsigned char m_anyModified;
+
+ unsigned char m_vhCalcPending;
+
+ /** True if splitter has been pre-set by the application. */
+ bool m_isSplitterPreSet;
+
+ /** Used to (temporarily) disable splitter centering. */
+ bool m_dontCenterSplitter;
+
+private:
+ /** Only inits arrays, doesn't migrate things or such. */
+ void InitNonCatMode();
+};
+
+// -----------------------------------------------------------------------
+
+#endif // wxUSE_PROPGRID
+
+#endif // _WX_PROPGRID_PROPGRIDPAGESTATE_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/propgrid/props.h
+// Purpose: wxPropertyGrid Property Classes
+// Author: Jaakko Salli
+// Modified by:
+// Created: 2007-03-28
+// Copyright: (c) Jaakko Salli
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PROPGRID_PROPS_H_
+#define _WX_PROPGRID_PROPS_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_PROPGRID
+
+// -----------------------------------------------------------------------
+
+class wxPGArrayEditorDialog;
+
+#include "wx/propgrid/editors.h"
+
+#include "wx/filename.h"
+#include "wx/dialog.h"
+#include "wx/textctrl.h"
+#include "wx/button.h"
+#include "wx/listbox.h"
+#include "wx/valtext.h"
+
+// -----------------------------------------------------------------------
+
+//
+// Property class implementation helper macros.
+//
+
+#define WX_PG_IMPLEMENT_PROPERTY_CLASS(NAME, UPCLASS, T, T_AS_ARG, EDITOR) \
+IMPLEMENT_DYNAMIC_CLASS(NAME, UPCLASS) \
+WX_PG_IMPLEMENT_PROPERTY_CLASS_PLAIN(NAME, T, EDITOR)
+
+// -----------------------------------------------------------------------
+
+//
+// These macros help creating DoGetValidator
+#define WX_PG_DOGETVALIDATOR_ENTRY() \
+ static wxValidator* s_ptr = NULL; \
+ if ( s_ptr ) return s_ptr;
+
+// Common function exit
+#define WX_PG_DOGETVALIDATOR_EXIT(VALIDATOR) \
+ s_ptr = VALIDATOR; \
+ wxPGGlobalVars->m_arrValidators.push_back( VALIDATOR ); \
+ return VALIDATOR;
+
+// -----------------------------------------------------------------------
+
+/** @class wxPGInDialogValidator
+ @ingroup classes
+ Creates and manages a temporary wxTextCtrl for validation purposes.
+ Uses wxPropertyGrid's current editor, if available.
+*/
+class WXDLLIMPEXP_PROPGRID wxPGInDialogValidator
+{
+public:
+ wxPGInDialogValidator()
+ {
+ m_textCtrl = NULL;
+ }
+
+ ~wxPGInDialogValidator()
+ {
+ if ( m_textCtrl )
+ m_textCtrl->Destroy();
+ }
+
+ bool DoValidate( wxPropertyGrid* propGrid,
+ wxValidator* validator,
+ const wxString& value );
+
+private:
+ wxTextCtrl* m_textCtrl;
+};
+
+
+// -----------------------------------------------------------------------
+// Property classes
+// -----------------------------------------------------------------------
+
+#define wxPG_PROP_PASSWORD wxPG_PROP_CLASS_SPECIFIC_2
+
+/** @class wxStringProperty
+ @ingroup classes
+ Basic property with string value.
+
+ <b>Supported special attributes:</b>
+ - "Password": set to 1 in order to enable wxTE_PASSWORD on the editor.
+
+ @remarks
+ - If value "<composed>" is set, then actual value is formed (or composed)
+ from values of child properties.
+*/
+class WXDLLIMPEXP_PROPGRID wxStringProperty : public wxPGProperty
+{
+ WX_PG_DECLARE_PROPERTY_CLASS(wxStringProperty)
+public:
+ wxStringProperty( const wxString& label = wxPG_LABEL,
+ const wxString& name = wxPG_LABEL,
+ const wxString& value = wxEmptyString );
+ virtual ~wxStringProperty();
+
+ virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+ virtual bool StringToValue( wxVariant& variant,
+ const wxString& text,
+ int argFlags = 0 ) const;
+
+ virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
+
+ /** This is updated so "<composed>" special value can be handled.
+ */
+ virtual void OnSetValue();
+
+protected:
+};
+
+// -----------------------------------------------------------------------
+
+/** Constants used with NumericValidation<>().
+*/
+enum wxPGNumericValidationConstants
+{
+ /** Instead of modifying the value, show an error message.
+ */
+ wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE = 0,
+
+ /** Modify value, but stick with the limitations.
+ */
+ wxPG_PROPERTY_VALIDATION_SATURATE = 1,
+
+ /** Modify value, wrap around on overflow.
+ */
+ wxPG_PROPERTY_VALIDATION_WRAP = 2
+};
+
+// -----------------------------------------------------------------------
+
+#if wxUSE_VALIDATORS
+
+/**
+ A more comprehensive numeric validator class.
+*/
+class WXDLLIMPEXP_PROPGRID wxNumericPropertyValidator : public wxTextValidator
+{
+public:
+ enum NumericType
+ {
+ Signed = 0,
+ Unsigned,
+ Float
+ };
+
+ wxNumericPropertyValidator( NumericType numericType, int base = 10 );
+ virtual ~wxNumericPropertyValidator() { }
+ virtual bool Validate(wxWindow* parent);
+};
+
+#endif // wxUSE_VALIDATORS
+
+
+/** @class wxIntProperty
+ @ingroup classes
+ Basic property with integer value.
+
+ Seamlessly supports 64-bit integer (wxLongLong) on overflow.
+
+ <b>Example how to use seamless 64-bit integer support</b>
+
+ Getting value:
+
+ @code
+ wxLongLong_t value = pg->GetPropertyValueAsLongLong();
+ @endcode
+
+ or
+
+ @code
+ wxLongLong_t value;
+ wxVariant variant = property->GetValue();
+ if ( variant.GetType() == "wxLongLong" )
+ value = wxLongLongFromVariant(variant);
+ else
+ value = variant.GetLong();
+ @endcode
+
+ Setting value:
+
+ @code
+ pg->SetPropertyValue(longLongVal);
+ @endcode
+
+ or
+
+ @code
+ property->SetValue(WXVARIANT(longLongVal));
+ @endcode
+
+
+ <b>Supported special attributes:</b>
+ - "Min", "Max": Specify acceptable value range.
+*/
+class WXDLLIMPEXP_PROPGRID wxIntProperty : public wxPGProperty
+{
+ WX_PG_DECLARE_PROPERTY_CLASS(wxIntProperty)
+public:
+ wxIntProperty( const wxString& label = wxPG_LABEL,
+ const wxString& name = wxPG_LABEL,
+ long value = 0 );
+ virtual ~wxIntProperty();
+
+ wxIntProperty( const wxString& label,
+ const wxString& name,
+ const wxLongLong& value );
+ virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+ virtual bool StringToValue( wxVariant& variant,
+ const wxString& text,
+ int argFlags = 0 ) const;
+ virtual bool ValidateValue( wxVariant& value,
+ wxPGValidationInfo& validationInfo ) const;
+ virtual bool IntToValue( wxVariant& variant,
+ int number,
+ int argFlags = 0 ) const;
+ static wxValidator* GetClassValidator();
+ virtual wxValidator* DoGetValidator() const;
+
+ /** Validation helper.
+ */
+ static bool DoValidation( const wxPGProperty* property,
+ wxLongLong_t& value,
+ wxPGValidationInfo* pValidationInfo,
+ int mode =
+ wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE );
+
+protected:
+};
+
+// -----------------------------------------------------------------------
+
+/** @class wxUIntProperty
+ @ingroup classes
+ Basic property with unsigned integer value.
+ Seamlessly supports 64-bit integer (wxULongLong) on overflow.
+
+ <b>Supported special attributes:</b>
+ - "Min", "Max": Specify acceptable value range.
+ - "Base": Define base. Valid constants are wxPG_BASE_OCT, wxPG_BASE_DEC,
+ wxPG_BASE_HEX and wxPG_BASE_HEXL (lowercase characters). Arbitrary bases
+ are <b>not</b> supported.
+ - "Prefix": Possible values are wxPG_PREFIX_NONE, wxPG_PREFIX_0x, and
+ wxPG_PREFIX_DOLLAR_SIGN. Only wxPG_PREFIX_NONE works with Decimal and Octal
+ numbers.
+
+ @remarks
+ - For example how to use seamless 64-bit integer support, see wxIntProperty
+ documentation (just use wxULongLong instead of wxLongLong).
+*/
+class WXDLLIMPEXP_PROPGRID wxUIntProperty : public wxPGProperty
+{
+ WX_PG_DECLARE_PROPERTY_CLASS(wxUIntProperty)
+public:
+ wxUIntProperty( const wxString& label = wxPG_LABEL,
+ const wxString& name = wxPG_LABEL,
+ unsigned long value = 0 );
+ virtual ~wxUIntProperty();
+ wxUIntProperty( const wxString& label,
+ const wxString& name,
+ const wxULongLong& value );
+ virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+ virtual bool StringToValue( wxVariant& variant,
+ const wxString& text,
+ int argFlags = 0 ) const;
+ virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
+ virtual bool ValidateValue( wxVariant& value,
+ wxPGValidationInfo& validationInfo ) const;
+ virtual wxValidator* DoGetValidator () const;
+ virtual bool IntToValue( wxVariant& variant,
+ int number,
+ int argFlags = 0 ) const;
+protected:
+ wxByte m_base;
+ wxByte m_realBase; // translated to 8,16,etc.
+ wxByte m_prefix;
+private:
+ void Init();
+};
+
+// -----------------------------------------------------------------------
+
+/** @class wxFloatProperty
+ @ingroup classes
+ Basic property with double-precision floating point value.
+
+ <b>Supported special attributes:</b>
+ - "Precision": Sets the (max) precision used when floating point value is
+ rendered as text. The default -1 means infinite precision.
+*/
+class WXDLLIMPEXP_PROPGRID wxFloatProperty : public wxPGProperty
+{
+ WX_PG_DECLARE_PROPERTY_CLASS(wxFloatProperty)
+public:
+ wxFloatProperty( const wxString& label = wxPG_LABEL,
+ const wxString& name = wxPG_LABEL,
+ double value = 0.0 );
+ virtual ~wxFloatProperty();
+
+ virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+ virtual bool StringToValue( wxVariant& variant,
+ const wxString& text,
+ int argFlags = 0 ) const;
+ virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
+ virtual bool ValidateValue( wxVariant& value,
+ wxPGValidationInfo& validationInfo ) const;
+
+ /** Validation helper.
+ */
+ static bool DoValidation( const wxPGProperty* property,
+ double& value,
+ wxPGValidationInfo* pValidationInfo,
+ int mode =
+ wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE );
+ static wxValidator* GetClassValidator();
+ virtual wxValidator* DoGetValidator () const;
+
+protected:
+ int m_precision;
+};
+
+// -----------------------------------------------------------------------
+
+/** @class wxBoolProperty
+ @ingroup classes
+ Basic property with boolean value.
+
+ <b>Supported special attributes:</b>
+ - "UseCheckbox": Set to 1 to use check box editor instead of combo box.
+ - "UseDClickCycling": Set to 1 to cycle combo box instead showing the list.
+*/
+class WXDLLIMPEXP_PROPGRID wxBoolProperty : public wxPGProperty
+{
+ WX_PG_DECLARE_PROPERTY_CLASS(wxBoolProperty)
+public:
+ wxBoolProperty( const wxString& label = wxPG_LABEL,
+ const wxString& name = wxPG_LABEL,
+ bool value = false );
+ virtual ~wxBoolProperty();
+
+ virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+ virtual bool StringToValue( wxVariant& variant,
+ const wxString& text,
+ int argFlags = 0 ) const;
+ virtual bool IntToValue( wxVariant& variant,
+ int number, int argFlags = 0 ) const;
+ virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
+};
+
+// -----------------------------------------------------------------------
+
+// If set, then selection of choices is static and should not be
+// changed (i.e. returns NULL in GetPropertyChoices).
+#define wxPG_PROP_STATIC_CHOICES wxPG_PROP_CLASS_SPECIFIC_1
+
+/** @class wxEnumProperty
+ @ingroup classes
+ You can derive custom properties with choices from this class. See
+ wxBaseEnumProperty for remarks.
+
+ @remarks
+ - Updating private index is important. You can do this either by calling
+ SetIndex() in IntToValue, and then letting wxBaseEnumProperty::OnSetValue
+ be called (by not implementing it, or by calling super class function in
+ it) -OR- you can just call SetIndex in OnSetValue.
+*/
+class WXDLLIMPEXP_PROPGRID wxEnumProperty : public wxPGProperty
+{
+ WX_PG_DECLARE_PROPERTY_CLASS(wxEnumProperty)
+public:
+
+#ifndef SWIG
+ wxEnumProperty( const wxString& label = wxPG_LABEL,
+ const wxString& name = wxPG_LABEL,
+ const wxChar* const* labels = NULL,
+ const long* values = NULL,
+ int value = 0 );
+ wxEnumProperty( const wxString& label,
+ const wxString& name,
+ wxPGChoices& choices,
+ int value = 0 );
+
+ // Special constructor for caching choices (used by derived class)
+ wxEnumProperty( const wxString& label,
+ const wxString& name,
+ const wxChar* const* labels,
+ const long* values,
+ wxPGChoices* choicesCache,
+ int value = 0 );
+
+ wxEnumProperty( const wxString& label,
+ const wxString& name,
+ const wxArrayString& labels,
+ const wxArrayInt& values = wxArrayInt(),
+ int value = 0 );
+#else
+ wxEnumProperty( const wxString& label = wxPG_LABEL,
+ const wxString& name = wxPG_LABEL,
+ const wxArrayString& labels = wxArrayString(),
+ const wxArrayInt& values = wxArrayInt(),
+ int value = 0 );
+#endif
+
+ virtual ~wxEnumProperty();
+
+ size_t GetItemCount() const { return m_choices.GetCount(); }
+
+ virtual void OnSetValue();
+ virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+ virtual bool StringToValue( wxVariant& variant,
+ const wxString& text,
+ int argFlags = 0 ) const;
+ virtual bool ValidateValue( wxVariant& value,
+ wxPGValidationInfo& validationInfo ) const;
+
+ // If wxPG_FULL_VALUE is not set in flags, then the value is interpreted
+ // as index to choices list. Otherwise, it is actual value.
+ virtual bool IntToValue( wxVariant& variant,
+ int number,
+ int argFlags = 0 ) const;
+
+ //
+ // Additional virtuals
+
+ // This must be overridden to have non-index based value
+ virtual int GetIndexForValue( int value ) const;
+
+ // GetChoiceSelection needs to overridden since m_index is
+ // the true index, and various property classes derived from
+ // this take advantage of it.
+ virtual int GetChoiceSelection() const { return m_index; }
+
+ virtual void OnValidationFailure( wxVariant& pendingValue );
+
+protected:
+
+ int GetIndex() const;
+ void SetIndex( int index );
+
+ bool ValueFromString_( wxVariant& value,
+ const wxString& text,
+ int argFlags ) const;
+ bool ValueFromInt_( wxVariant& value, int intVal, int argFlags ) const;
+
+ static void ResetNextIndex() { ms_nextIndex = -2; }
+
+private:
+ // This is private so that classes are guaranteed to use GetIndex
+ // for up-to-date index value.
+ int m_index;
+
+ // Relies on ValidateValue being called always before OnSetValue
+ static int ms_nextIndex;
+};
+
+// -----------------------------------------------------------------------
+
+/** @class wxEditEnumProperty
+ @ingroup classes
+ wxEnumProperty with wxString value and writable combo box editor.
+
+ @remarks
+ Uses int value, similar to wxEnumProperty, unless text entered by user is
+ is not in choices (in which case string value is used).
+*/
+class WXDLLIMPEXP_PROPGRID wxEditEnumProperty : public wxEnumProperty
+{
+ WX_PG_DECLARE_PROPERTY_CLASS(wxEditEnumProperty)
+public:
+
+ wxEditEnumProperty( const wxString& label,
+ const wxString& name,
+ const wxChar* const* labels,
+ const long* values,
+ const wxString& value );
+ wxEditEnumProperty( const wxString& label = wxPG_LABEL,
+ const wxString& name = wxPG_LABEL,
+ const wxArrayString& labels = wxArrayString(),
+ const wxArrayInt& values = wxArrayInt(),
+ const wxString& value = wxEmptyString );
+ wxEditEnumProperty( const wxString& label,
+ const wxString& name,
+ wxPGChoices& choices,
+ const wxString& value = wxEmptyString );
+
+ // Special constructor for caching choices (used by derived class)
+ wxEditEnumProperty( const wxString& label,
+ const wxString& name,
+ const wxChar* const* labels,
+ const long* values,
+ wxPGChoices* choicesCache,
+ const wxString& value );
+
+ virtual ~wxEditEnumProperty();
+
+protected:
+};
+
+// -----------------------------------------------------------------------
+
+/** @class wxFlagsProperty
+ @ingroup classes
+ Represents a bit set that fits in a long integer. wxBoolProperty
+ sub-properties are created for editing individual bits. Textctrl is created
+ to manually edit the flags as a text; a continuous sequence of spaces,
+ commas and semicolons is considered as a flag id separator.
+ <b>Note:</b> When changing "choices" (ie. flag labels) of wxFlagsProperty,
+ you will need to use SetPropertyChoices - otherwise they will not get
+ updated properly.
+*/
+class WXDLLIMPEXP_PROPGRID wxFlagsProperty : public wxPGProperty
+{
+ WX_PG_DECLARE_PROPERTY_CLASS(wxFlagsProperty)
+public:
+
+#ifndef SWIG
+ wxFlagsProperty( const wxString& label,
+ const wxString& name,
+ const wxChar* const* labels,
+ const long* values = NULL,
+ long value = 0 );
+ wxFlagsProperty( const wxString& label,
+ const wxString& name,
+ wxPGChoices& choices,
+ long value = 0 );
+#endif
+ wxFlagsProperty( const wxString& label = wxPG_LABEL,
+ const wxString& name = wxPG_LABEL,
+ const wxArrayString& labels = wxArrayString(),
+ const wxArrayInt& values = wxArrayInt(),
+ int value = 0 );
+ virtual ~wxFlagsProperty ();
+
+ virtual void OnSetValue();
+ virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+ virtual bool StringToValue( wxVariant& variant,
+ const wxString& text,
+ int flags ) const;
+ virtual wxVariant ChildChanged( wxVariant& thisValue,
+ int childIndex,
+ wxVariant& childValue ) const;
+ virtual void RefreshChildren();
+ virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
+
+ // GetChoiceSelection needs to overridden since m_choices is
+ // used and value is integer, but it is not index.
+ virtual int GetChoiceSelection() const { return wxNOT_FOUND; }
+
+ // helpers
+ size_t GetItemCount() const { return m_choices.GetCount(); }
+ const wxString& GetLabel( size_t ind ) const
+ { return m_choices.GetLabel(static_cast<int>(ind)); }
+
+protected:
+ // Used to detect if choices have been changed
+ wxPGChoicesData* m_oldChoicesData;
+
+ // Needed to properly mark changed sub-properties
+ long m_oldValue;
+
+ // Converts string id to a relevant bit.
+ long IdToBit( const wxString& id ) const;
+
+ // Creates children and sets value.
+ void Init();
+};
+
+// -----------------------------------------------------------------------
+
+/** @class wxPGFileDialogAdapter
+ @ingroup classes
+*/
+class WXDLLIMPEXP_PROPGRID
+ wxPGFileDialogAdapter : public wxPGEditorDialogAdapter
+{
+public:
+ virtual bool DoShowDialog( wxPropertyGrid* propGrid,
+ wxPGProperty* property );
+};
+
+// -----------------------------------------------------------------------
+
+// Indicates first bit useable by derived properties.
+#define wxPG_PROP_SHOW_FULL_FILENAME wxPG_PROP_CLASS_SPECIFIC_1
+
+/** @class wxFileProperty
+ @ingroup classes
+ Like wxLongStringProperty, but the button triggers file selector instead.
+
+ <b>Supported special attributes:</b>
+ - "Wildcard": Sets wildcard (see wxFileDialog for format details), "All
+ files..." is default.
+ - "ShowFullPath": Default 1. When 0, only the file name is shown (i.e. drive
+ and directory are hidden).
+ - "ShowRelativePath": If set, then the filename is shown relative to the
+ given path string.
+ - "InitialPath": Sets the initial path of where to look for files.
+ - "DialogTitle": Sets a specific title for the dir dialog.
+*/
+class WXDLLIMPEXP_PROPGRID wxFileProperty : public wxPGProperty
+{
+ friend class wxPGFileDialogAdapter;
+ WX_PG_DECLARE_PROPERTY_CLASS(wxFileProperty)
+public:
+
+ wxFileProperty( const wxString& label = wxPG_LABEL,
+ const wxString& name = wxPG_LABEL,
+ const wxString& value = wxEmptyString );
+ virtual ~wxFileProperty ();
+
+ virtual void OnSetValue();
+ virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+ virtual bool StringToValue( wxVariant& variant,
+ const wxString& text,
+ int argFlags = 0 ) const;
+ virtual wxPGEditorDialogAdapter* GetEditorDialog() const;
+ virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
+
+ static wxValidator* GetClassValidator();
+ virtual wxValidator* DoGetValidator() const;
+
+ /**
+ Returns filename to file represented by current value.
+ */
+ wxFileName GetFileName() const;
+
+protected:
+ wxString m_wildcard;
+ wxString m_basePath; // If set, then show path relative to it
+ wxString m_initialPath; // If set, start the file dialog here
+ wxString m_dlgTitle; // If set, used as title for file dialog
+ int m_indFilter; // index to the selected filter
+};
+
+// -----------------------------------------------------------------------
+
+#define wxPG_PROP_NO_ESCAPE wxPG_PROP_CLASS_SPECIFIC_1
+
+
+/** @class wxPGLongStringDialogAdapter
+ @ingroup classes
+*/
+class WXDLLIMPEXP_PROPGRID
+ wxPGLongStringDialogAdapter : public wxPGEditorDialogAdapter
+{
+public:
+ virtual bool DoShowDialog( wxPropertyGrid* propGrid,
+ wxPGProperty* property );
+};
+
+
+/** @class wxLongStringProperty
+ @ingroup classes
+ Like wxStringProperty, but has a button that triggers a small text
+ editor dialog.
+*/
+class WXDLLIMPEXP_PROPGRID wxLongStringProperty : public wxPGProperty
+{
+ WX_PG_DECLARE_PROPERTY_CLASS(wxLongStringProperty)
+public:
+
+ wxLongStringProperty( const wxString& label = wxPG_LABEL,
+ const wxString& name = wxPG_LABEL,
+ const wxString& value = wxEmptyString );
+ virtual ~wxLongStringProperty();
+
+ virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+ virtual bool StringToValue( wxVariant& variant,
+ const wxString& text,
+ int argFlags = 0 ) const;
+ virtual bool OnEvent( wxPropertyGrid* propgrid,
+ wxWindow* primary, wxEvent& event );
+
+ // Shows string editor dialog. Value to be edited should be read from
+ // value, and if dialog is not cancelled, it should be stored back and true
+ // should be returned if that was the case.
+ virtual bool OnButtonClick( wxPropertyGrid* propgrid, wxString& value );
+
+ static bool DisplayEditorDialog( wxPGProperty* prop,
+ wxPropertyGrid* propGrid,
+ wxString& value );
+
+protected:
+};
+
+// -----------------------------------------------------------------------
+
+
+/** @class wxDirProperty
+ @ingroup classes
+ Like wxLongStringProperty, but the button triggers dir selector instead.
+
+ <b>Supported special attributes:</b>
+ - "DialogMessage": Sets specific message in the dir selector.
+*/
+class WXDLLIMPEXP_PROPGRID wxDirProperty : public wxLongStringProperty
+{
+ DECLARE_DYNAMIC_CLASS(wxDirProperty)
+public:
+ wxDirProperty( const wxString& name = wxPG_LABEL,
+ const wxString& label = wxPG_LABEL,
+ const wxString& value = wxEmptyString );
+ virtual ~wxDirProperty();
+
+ virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
+ virtual wxValidator* DoGetValidator() const;
+
+ virtual bool OnButtonClick ( wxPropertyGrid* propGrid, wxString& value );
+
+protected:
+ wxString m_dlgMessage;
+};
+
+// -----------------------------------------------------------------------
+
+// wxBoolProperty specific flags
+#define wxPG_PROP_USE_CHECKBOX wxPG_PROP_CLASS_SPECIFIC_1
+// DCC = Double Click Cycles
+#define wxPG_PROP_USE_DCC wxPG_PROP_CLASS_SPECIFIC_2
+
+
+// -----------------------------------------------------------------------
+
+/** @class wxArrayStringProperty
+ @ingroup classes
+ Property that manages a list of strings.
+*/
+class WXDLLIMPEXP_PROPGRID wxArrayStringProperty : public wxPGProperty
+{
+ WX_PG_DECLARE_PROPERTY_CLASS(wxArrayStringProperty)
+public:
+ wxArrayStringProperty( const wxString& label = wxPG_LABEL,
+ const wxString& name = wxPG_LABEL,
+ const wxArrayString& value = wxArrayString() );
+ virtual ~wxArrayStringProperty();
+
+ virtual void OnSetValue();
+ virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+ virtual bool StringToValue( wxVariant& variant,
+ const wxString& text,
+ int argFlags = 0 ) const;
+ virtual bool OnEvent( wxPropertyGrid* propgrid,
+ wxWindow* primary, wxEvent& event );
+ virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
+
+ // Implement in derived class for custom array-to-string conversion.
+ virtual void ConvertArrayToString(const wxArrayString& arr,
+ wxString* pString,
+ const wxUniChar& delimiter) const;
+
+ // Shows string editor dialog. Value to be edited should be read from
+ // value, and if dialog is not cancelled, it should be stored back and true
+ // should be returned if that was the case.
+ virtual bool OnCustomStringEdit( wxWindow* parent, wxString& value );
+
+ // Helper.
+ virtual bool OnButtonClick( wxPropertyGrid* propgrid,
+ wxWindow* primary,
+ const wxChar* cbt );
+
+ // Creates wxPGArrayEditorDialog for string editing. Called in OnButtonClick.
+ virtual wxPGArrayEditorDialog* CreateEditorDialog();
+
+ enum ConversionFlags
+ {
+ Escape = 0x01,
+ QuoteStrings = 0x02
+ };
+
+ /**
+ Generates contents for string dst based on the contents of
+ wxArrayString src.
+ */
+ static void ArrayStringToString( wxString& dst, const wxArrayString& src,
+ wxUniChar delimiter, int flags );
+
+protected:
+ // Previously this was to be implemented in derived class for array-to-
+ // string conversion. Now you should implement ConvertValueToString()
+ // instead.
+ virtual void GenerateValueAsString();
+
+ wxString m_display; // Cache for displayed text.
+ wxUniChar m_delimiter;
+};
+
+// -----------------------------------------------------------------------
+
+#define WX_PG_DECLARE_ARRAYSTRING_PROPERTY_WITH_VALIDATOR_WITH_DECL(PROPNAME, \
+ DECL) \
+DECL PROPNAME : public wxArrayStringProperty \
+{ \
+ WX_PG_DECLARE_PROPERTY_CLASS(PROPNAME) \
+public: \
+ PROPNAME( const wxString& label = wxPG_LABEL, \
+ const wxString& name = wxPG_LABEL, \
+ const wxArrayString& value = wxArrayString() ); \
+ ~PROPNAME(); \
+ virtual bool OnEvent( wxPropertyGrid* propgrid, \
+ wxWindow* primary, wxEvent& event ); \
+ virtual bool OnCustomStringEdit( wxWindow* parent, wxString& value ); \
+ virtual wxValidator* DoGetValidator() const; \
+};
+
+#define WX_PG_DECLARE_ARRAYSTRING_PROPERTY_WITH_VALIDATOR(PROPNAM) \
+WX_PG_DECLARE_ARRAYSTRING_PROPERTY_WITH_VALIDATOR(PROPNAM, class)
+
+#define WX_PG_IMPLEMENT_ARRAYSTRING_PROPERTY_WITH_VALIDATOR(PROPNAME, \
+ DELIMCHAR, \
+ CUSTBUTTXT) \
+WX_PG_IMPLEMENT_PROPERTY_CLASS(PROPNAME, wxArrayStringProperty, \
+ wxArrayString, const wxArrayString&, \
+ TextCtrlAndButton) \
+PROPNAME::PROPNAME( const wxString& label, \
+ const wxString& name, \
+ const wxArrayString& value ) \
+ : wxArrayStringProperty(label,name,value) \
+{ \
+ PROPNAME::GenerateValueAsString(); \
+ m_delimiter = DELIMCHAR; \
+} \
+PROPNAME::~PROPNAME() { } \
+bool PROPNAME::OnEvent( wxPropertyGrid* propgrid, \
+ wxWindow* primary, wxEvent& event ) \
+{ \
+ if ( event.GetEventType() == wxEVT_BUTTON ) \
+ return OnButtonClick(propgrid,primary,(const wxChar*) CUSTBUTTXT); \
+ return false; \
+}
+
+#define WX_PG_DECLARE_ARRAYSTRING_PROPERTY(PROPNAME) \
+WX_PG_DECLARE_ARRAYSTRING_PROPERTY_WITH_VALIDATOR(PROPNAME)
+
+#define WX_PG_DECLARE_ARRAYSTRING_PROPERTY_WITH_DECL(PROPNAME, DECL) \
+WX_PG_DECLARE_ARRAYSTRING_PROPERTY_WITH_VALIDATOR_WITH_DECL(PROPNAME, DECL)
+
+#define WX_PG_IMPLEMENT_ARRAYSTRING_PROPERTY(PROPNAME,DELIMCHAR,CUSTBUTTXT) \
+WX_PG_IMPLEMENT_ARRAYSTRING_PROPERTY_WITH_VALIDATOR(PROPNAME, \
+ DELIMCHAR, \
+ CUSTBUTTXT) \
+wxValidator* PROPNAME::DoGetValidator () const \
+{ return NULL; }
+
+
+// -----------------------------------------------------------------------
+// wxPGArrayEditorDialog
+// -----------------------------------------------------------------------
+
+#if wxUSE_EDITABLELISTBOX
+
+class WXDLLIMPEXP_FWD_ADV wxEditableListBox;
+class WXDLLIMPEXP_FWD_CORE wxListEvent;
+
+#define wxAEDIALOG_STYLE \
+ (wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE)
+
+class WXDLLIMPEXP_PROPGRID wxPGArrayEditorDialog : public wxDialog
+{
+public:
+ wxPGArrayEditorDialog();
+ virtual ~wxPGArrayEditorDialog() { }
+
+ void Init();
+
+ wxPGArrayEditorDialog( wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ long style = wxAEDIALOG_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& sz = wxDefaultSize );
+
+ bool Create( wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ long style = wxAEDIALOG_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& sz = wxDefaultSize );
+
+ void EnableCustomNewAction()
+ {
+ m_hasCustomNewAction = true;
+ }
+
+ /** Set value modified by dialog.
+ */
+ virtual void SetDialogValue( const wxVariant& WXUNUSED(value) )
+ {
+ wxFAIL_MSG(wxT("re-implement this member function in derived class"));
+ }
+
+ /** Return value modified by dialog.
+ */
+ virtual wxVariant GetDialogValue() const
+ {
+ wxFAIL_MSG(wxT("re-implement this member function in derived class"));
+ return wxVariant();
+ }
+
+ /** Override to return wxValidator to be used with the wxTextCtrl
+ in dialog. Note that the validator is used in the standard
+ wx way, ie. it immediately prevents user from entering invalid
+ input.
+
+ @remarks
+ Dialog frees the validator.
+ */
+ virtual wxValidator* GetTextCtrlValidator() const
+ {
+ return NULL;
+ }
+
+ // Returns true if array was actually modified
+ bool IsModified() const { return m_modified; }
+
+ // wxEditableListBox utilities
+ int GetSelection() const;
+
+ // implementation from now on
+ void OnAddClick(wxCommandEvent& event);
+ void OnDeleteClick(wxCommandEvent& event);
+ void OnUpClick(wxCommandEvent& event);
+ void OnDownClick(wxCommandEvent& event);
+ void OnEndLabelEdit(wxListEvent& event);
+ void OnIdle(wxIdleEvent& event);
+
+protected:
+ wxEditableListBox* m_elb;
+
+ // These are used for focus repair
+ wxWindow* m_elbSubPanel;
+ wxWindow* m_lastFocused;
+
+ // A new item, edited by user, is pending at this index.
+ // It will be committed once list ctrl item editing is done.
+ int m_itemPendingAtIndex;
+
+ bool m_modified;
+ bool m_hasCustomNewAction;
+
+ // These must be overridden - must return true on success.
+ virtual wxString ArrayGet( size_t index ) = 0;
+ virtual size_t ArrayGetCount() = 0;
+ virtual bool ArrayInsert( const wxString& str, int index ) = 0;
+ virtual bool ArraySet( size_t index, const wxString& str ) = 0;
+ virtual void ArrayRemoveAt( int index ) = 0;
+ virtual void ArraySwap( size_t first, size_t second ) = 0;
+ virtual bool OnCustomNewAction(wxString* WXUNUSED(resString))
+ {
+ return false;
+ }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxPGArrayEditorDialog)
+ DECLARE_EVENT_TABLE()
+};
+
+#endif // wxUSE_EDITABLELISTBOX
+
+// -----------------------------------------------------------------------
+// wxPGArrayStringEditorDialog
+// -----------------------------------------------------------------------
+
+class WXDLLIMPEXP_PROPGRID
+ wxPGArrayStringEditorDialog : public wxPGArrayEditorDialog
+{
+public:
+ wxPGArrayStringEditorDialog();
+ virtual ~wxPGArrayStringEditorDialog() { }
+
+ void Init();
+
+ virtual void SetDialogValue( const wxVariant& value )
+ {
+ m_array = value.GetArrayString();
+ }
+
+ virtual wxVariant GetDialogValue() const
+ {
+ return m_array;
+ }
+
+ void SetCustomButton( const wxString& custBtText,
+ wxArrayStringProperty* pcc )
+ {
+ if ( !custBtText.empty() )
+ {
+ EnableCustomNewAction();
+ m_pCallingClass = pcc;
+ }
+ }
+
+ virtual bool OnCustomNewAction(wxString* resString);
+
+protected:
+ wxArrayString m_array;
+
+ wxArrayStringProperty* m_pCallingClass;
+
+ virtual wxString ArrayGet( size_t index );
+ virtual size_t ArrayGetCount();
+ virtual bool ArrayInsert( const wxString& str, int index );
+ virtual bool ArraySet( size_t index, const wxString& str );
+ virtual void ArrayRemoveAt( int index );
+ virtual void ArraySwap( size_t first, size_t second );
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxPGArrayStringEditorDialog)
+ DECLARE_EVENT_TABLE()
+};
+
+// -----------------------------------------------------------------------
+
+#endif // wxUSE_PROPGRID
+
+#endif // _WX_PROPGRID_PROPS_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/protocol/file.h
+// Purpose: File protocol
+// Author: Guilhem Lavaux
+// Modified by:
+// Created: 1997
+// Copyright: (c) 1997, 1998 Guilhem Lavaux
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __WX_PROTO_FILE_H__
+#define __WX_PROTO_FILE_H__
+
+#include "wx/defs.h"
+
+#if wxUSE_PROTOCOL_FILE
+
+#include "wx/protocol/protocol.h"
+
+class WXDLLIMPEXP_NET wxFileProto: public wxProtocol
+{
+public:
+ wxFileProto();
+ virtual ~wxFileProto();
+
+ bool Abort() { return true; }
+ wxString GetContentType() const { return wxEmptyString; }
+
+ wxInputStream *GetInputStream(const wxString& path);
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxFileProto)
+ DECLARE_PROTOCOL(wxFileProto)
+};
+
+#endif // wxUSE_PROTOCOL_FILE
+
+#endif // __WX_PROTO_FILE_H__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/protocol/ftp.h
+// Purpose: FTP protocol
+// Author: Vadim Zeitlin
+// Modified by: Mark Johnson, wxWindows@mj10777.de
+// 20000917 : RmDir, GetLastResult, GetList
+// Created: 07/07/1997
+// Copyright: (c) 1997, 1998 Guilhem Lavaux
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __WX_FTP_H__
+#define __WX_FTP_H__
+
+#include "wx/defs.h"
+
+#if wxUSE_PROTOCOL_FTP
+
+#include "wx/sckaddr.h"
+#include "wx/protocol/protocol.h"
+#include "wx/url.h"
+
+class WXDLLIMPEXP_NET wxFTP : public wxProtocol
+{
+public:
+ enum TransferMode
+ {
+ NONE, // not set by user explicitly
+ ASCII,
+ BINARY
+ };
+
+ wxFTP();
+ virtual ~wxFTP();
+
+ // Connecting and disconnecting
+ virtual bool Connect(const wxSockAddress& addr, bool wait = true);
+ virtual bool Connect(const wxString& host) { return Connect(host, 0); }
+ virtual bool Connect(const wxString& host, unsigned short port);
+
+ // disconnect
+ virtual bool Close();
+
+ // Parameters set up
+
+ // set transfer mode now
+ void SetPassive(bool pasv) { m_bPassive = pasv; }
+ bool SetBinary() { return SetTransferMode(BINARY); }
+ bool SetAscii() { return SetTransferMode(ASCII); }
+ bool SetTransferMode(TransferMode mode);
+
+ // Generic FTP interface
+
+ // FTP doesn't know the MIME type of the last downloaded/uploaded file
+ virtual wxString GetContentType() const { return wxEmptyString; }
+
+ // the last FTP server reply
+ const wxString& GetLastResult() const { return m_lastResult; }
+
+ // send any FTP command (should be full FTP command line but without
+ // trailing "\r\n") and return its return code
+ char SendCommand(const wxString& command);
+
+ // check that the command returned the given code
+ bool CheckCommand(const wxString& command, char expectedReturn)
+ {
+ // SendCommand() does updates m_lastError
+ return SendCommand(command) == expectedReturn;
+ }
+
+ // Filesystem commands
+ bool ChDir(const wxString& dir);
+ bool MkDir(const wxString& dir);
+ bool RmDir(const wxString& dir);
+ wxString Pwd();
+ bool Rename(const wxString& src, const wxString& dst);
+ bool RmFile(const wxString& path);
+
+ // Get the size of a file in the current dir.
+ // this function tries its best to deliver the size in bytes using BINARY
+ // (the SIZE command reports different sizes depending on whether
+ // type is set to ASCII or BINARY)
+ // returns -1 if file is non-existent or size could not be found
+ int GetFileSize(const wxString& fileName);
+
+ // Check to see if a file exists in the current dir
+ bool FileExists(const wxString& fileName);
+
+ // Download methods
+ bool Abort();
+
+ virtual wxInputStream *GetInputStream(const wxString& path);
+ virtual wxOutputStream *GetOutputStream(const wxString& path);
+
+ // Directory listing
+
+ // get the list of full filenames, the format is fixed: one file name per
+ // line
+ bool GetFilesList(wxArrayString& files,
+ const wxString& wildcard = wxEmptyString)
+ {
+ return GetList(files, wildcard, false);
+ }
+
+ // get a directory list in server dependent format - this can be shown
+ // directly to the user
+ bool GetDirList(wxArrayString& files,
+ const wxString& wildcard = wxEmptyString)
+ {
+ return GetList(files, wildcard, true);
+ }
+
+ // equivalent to either GetFilesList() (default) or GetDirList()
+ bool GetList(wxArrayString& files,
+ const wxString& wildcard = wxEmptyString,
+ bool details = false);
+
+protected:
+ // this executes a simple ftp command with the given argument and returns
+ // true if it its return code starts with '2'
+ bool DoSimpleCommand(const wxChar *command,
+ const wxString& arg = wxEmptyString);
+
+ // get the server reply, return the first character of the reply code,
+ // '1'..'5' for normal FTP replies, 0 (*not* '0') if an error occurred
+ char GetResult();
+
+ // check that the result is equal to expected value
+ bool CheckResult(char ch) { return GetResult() == ch; }
+
+ // return the socket to be used, Passive/Active versions are used only by
+ // GetPort()
+ wxSocketBase *GetPort();
+ wxSocketBase *GetPassivePort();
+ wxSocketBase *GetActivePort();
+
+ // helper for GetPort()
+ wxString GetPortCmdArgument(const wxIPV4address& Local, const wxIPV4address& New);
+
+ // accept connection from server in active mode, returns the same socket as
+ // passed in passive mode
+ wxSocketBase *AcceptIfActive(wxSocketBase *sock);
+
+
+ // internal variables:
+
+ wxString m_lastResult;
+
+ // true if there is an FTP transfer going on
+ bool m_streaming;
+
+ // although this should be set to ASCII by default according to STD9,
+ // we will use BINARY transfer mode by default for backwards compatibility
+ TransferMode m_currentTransfermode;
+
+ bool m_bPassive;
+
+ // following is true when a read or write times out, we then assume
+ // the connection is dead and abort. we avoid additional delays this way
+ bool m_bEncounteredError;
+
+
+ friend class wxInputFTPStream;
+ friend class wxOutputFTPStream;
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxFTP)
+ DECLARE_PROTOCOL(wxFTP)
+};
+
+// the trace mask used by assorted wxLogTrace() in ftp code, do
+// wxLog::AddTraceMask(FTP_TRACE_MASK) to see them in output
+#define FTP_TRACE_MASK wxT("ftp")
+
+#endif // wxUSE_PROTOCOL_FTP
+
+#endif // __WX_FTP_H__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/protocol/http.h
+// Purpose: HTTP protocol
+// Author: Guilhem Lavaux
+// Modified by: Simo Virokannas (authentication, Dec 2005)
+// Created: August 1997
+// Copyright: (c) 1997, 1998 Guilhem Lavaux
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+#ifndef _WX_HTTP_H
+#define _WX_HTTP_H
+
+#include "wx/defs.h"
+
+#if wxUSE_PROTOCOL_HTTP
+
+#include "wx/hashmap.h"
+#include "wx/protocol/protocol.h"
+#include "wx/buffer.h"
+
+class WXDLLIMPEXP_NET wxHTTP : public wxProtocol
+{
+public:
+ wxHTTP();
+ virtual ~wxHTTP();
+
+ virtual bool Connect(const wxString& host, unsigned short port);
+ virtual bool Connect(const wxString& host) { return Connect(host, 0); }
+ virtual bool Connect(const wxSockAddress& addr, bool wait);
+ bool Abort();
+
+ wxInputStream *GetInputStream(const wxString& path);
+
+ wxString GetContentType() const;
+ wxString GetHeader(const wxString& header) const;
+ int GetResponse() const { return m_http_response; }
+
+ void SetMethod(const wxString& method) { m_method = method; }
+ void SetHeader(const wxString& header, const wxString& h_data);
+ bool SetPostText(const wxString& contentType,
+ const wxString& data,
+ const wxMBConv& conv = wxConvUTF8);
+ bool SetPostBuffer(const wxString& contentType, const wxMemoryBuffer& data);
+ void SetProxyMode(bool on);
+
+ /* Cookies */
+ wxString GetCookie(const wxString& cookie) const;
+ bool HasCookies() const { return m_cookies.size() > 0; }
+
+ // Use the other SetPostBuffer() overload or SetPostText() instead.
+ wxDEPRECATED(void SetPostBuffer(const wxString& post_buf));
+
+protected:
+ typedef wxStringToStringHashMap::iterator wxHeaderIterator;
+ typedef wxStringToStringHashMap::const_iterator wxHeaderConstIterator;
+ typedef wxStringToStringHashMap::iterator wxCookieIterator;
+ typedef wxStringToStringHashMap::const_iterator wxCookieConstIterator;
+
+ bool BuildRequest(const wxString& path, const wxString& method);
+ void SendHeaders();
+ bool ParseHeaders();
+
+ wxString GenerateAuthString(const wxString& user, const wxString& pass) const;
+
+ // find the header in m_headers
+ wxHeaderIterator FindHeader(const wxString& header);
+ wxHeaderConstIterator FindHeader(const wxString& header) const;
+ wxCookieIterator FindCookie(const wxString& cookie);
+ wxCookieConstIterator FindCookie(const wxString& cookie) const;
+
+ // deletes the header value strings
+ void ClearHeaders();
+ void ClearCookies();
+
+ // internal variables:
+
+ wxString m_method;
+ wxStringToStringHashMap m_cookies;
+
+ wxStringToStringHashMap m_headers;
+ bool m_read,
+ m_proxy_mode;
+ wxSockAddress *m_addr;
+ wxMemoryBuffer m_postBuffer;
+ wxString m_contentType;
+ int m_http_response;
+
+ DECLARE_DYNAMIC_CLASS(wxHTTP)
+ DECLARE_PROTOCOL(wxHTTP)
+ wxDECLARE_NO_COPY_CLASS(wxHTTP);
+};
+
+#endif // wxUSE_PROTOCOL_HTTP
+
+#endif // _WX_HTTP_H
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/protocol/log.h
+// Purpose: wxProtocolLog class for logging network exchanges
+// Author: Troelsk, Vadim Zeitlin
+// Created: 2009-03-06
+// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PROTOCOL_LOG_H_
+#define _WX_PROTOCOL_LOG_H_
+
+#include "wx/string.h"
+
+// ----------------------------------------------------------------------------
+// wxProtocolLog: simple class for logging network requests and responses
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_NET wxProtocolLog
+{
+public:
+ // Create object doing the logging using wxLogTrace() with the specified
+ // trace mask.
+ wxProtocolLog(const wxString& traceMask)
+ : m_traceMask(traceMask)
+ {
+ }
+
+ // Virtual dtor for the base class
+ virtual ~wxProtocolLog() { }
+
+ // Called by wxProtocol-derived classes to actually log something
+ virtual void LogRequest(const wxString& str)
+ {
+ DoLogString("==> " + str);
+ }
+
+ virtual void LogResponse(const wxString& str)
+ {
+ DoLogString("<== " + str);
+ }
+
+protected:
+ // Can be overridden by the derived classes.
+ virtual void DoLogString(const wxString& str);
+
+private:
+ const wxString m_traceMask;
+
+ wxDECLARE_NO_COPY_CLASS(wxProtocolLog);
+};
+
+#endif // _WX_PROTOCOL_LOG_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/protocol/protocol.h
+// Purpose: Protocol base class
+// Author: Guilhem Lavaux
+// Modified by:
+// Created: 10/07/1997
+// Copyright: (c) 1997, 1998 Guilhem Lavaux
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_PROTOCOL_PROTOCOL_H
+#define _WX_PROTOCOL_PROTOCOL_H
+
+#include "wx/defs.h"
+
+#if wxUSE_PROTOCOL
+
+#include "wx/object.h"
+#include "wx/string.h"
+#include "wx/stream.h"
+
+#if wxUSE_SOCKETS
+ #include "wx/socket.h"
+#endif
+
+class WXDLLIMPEXP_FWD_NET wxProtocolLog;
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+typedef enum
+{
+ wxPROTO_NOERR = 0,
+ wxPROTO_NETERR,
+ wxPROTO_PROTERR,
+ wxPROTO_CONNERR,
+ wxPROTO_INVVAL,
+ wxPROTO_NOHNDLR,
+ wxPROTO_NOFILE,
+ wxPROTO_ABRT,
+ wxPROTO_RCNCT,
+ wxPROTO_STREAMING
+} wxProtocolError;
+
+// ----------------------------------------------------------------------------
+// wxProtocol: abstract base class for all protocols
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_NET wxProtocol
+#if wxUSE_SOCKETS
+ : public wxSocketClient
+#else
+ : public wxObject
+#endif
+{
+public:
+ wxProtocol();
+ virtual ~wxProtocol();
+
+#if wxUSE_SOCKETS
+ bool Reconnect();
+ virtual bool Connect( const wxString& WXUNUSED(host) ) { return false; }
+ virtual bool Connect( const wxSockAddress& addr, bool WXUNUSED(wait) = true)
+ { return wxSocketClient::Connect(addr); }
+
+ // read a '\r\n' terminated line from the given socket and put it in
+ // result (without the terminators)
+ static wxProtocolError ReadLine(wxSocketBase *socket, wxString& result);
+
+ // read a line from this socket - this one can be overridden in the
+ // derived classes if different line termination convention is to be used
+ virtual wxProtocolError ReadLine(wxString& result);
+#endif // wxUSE_SOCKETS
+
+ virtual bool Abort() = 0;
+ virtual wxInputStream *GetInputStream(const wxString& path) = 0;
+ virtual wxString GetContentType() const = 0;
+
+ // the error code
+ virtual wxProtocolError GetError() const { return m_lastError; }
+
+ void SetUser(const wxString& user) { m_username = user; }
+ void SetPassword(const wxString& passwd) { m_password = passwd; }
+
+ virtual void SetDefaultTimeout(wxUint32 Value);
+
+ // override wxSocketBase::SetTimeout function to avoid that the internal
+ // m_uiDefaultTimeout goes out-of-sync:
+ virtual void SetTimeout(long seconds)
+ { SetDefaultTimeout(seconds); }
+
+
+ // logging support: each wxProtocol object may have the associated logger
+ // (by default there is none) which is used to log network requests and
+ // responses
+
+ // set the logger, deleting the old one and taking ownership of this one
+ void SetLog(wxProtocolLog *log);
+
+ // return the current logger, may be NULL
+ wxProtocolLog *GetLog() const { return m_log; }
+
+ // detach the existing logger without deleting it, the caller is
+ // responsible for deleting the returned pointer if it's non-NULL
+ wxProtocolLog *DetachLog()
+ {
+ wxProtocolLog * const log = m_log;
+ m_log = NULL;
+ return log;
+ }
+
+ // these functions forward to the same functions with the same names in
+ // wxProtocolLog if we have a valid logger and do nothing otherwise
+ void LogRequest(const wxString& str);
+ void LogResponse(const wxString& str);
+
+protected:
+ // the timeout associated with the protocol:
+ wxUint32 m_uiDefaultTimeout;
+
+ wxString m_username;
+ wxString m_password;
+
+ // this must be always updated by the derived classes!
+ wxProtocolError m_lastError;
+
+private:
+ wxProtocolLog *m_log;
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxProtocol)
+};
+
+// ----------------------------------------------------------------------------
+// macros for protocol classes
+// ----------------------------------------------------------------------------
+
+#define DECLARE_PROTOCOL(class) \
+public: \
+ static wxProtoInfo g_proto_##class;
+
+#define IMPLEMENT_PROTOCOL(class, name, serv, host) \
+wxProtoInfo class::g_proto_##class(name, serv, host, wxCLASSINFO(class)); \
+bool wxProtocolUse##class = true;
+
+#define USE_PROTOCOL(class) \
+ extern bool wxProtocolUse##class ; \
+ static struct wxProtocolUserFor##class \
+ { \
+ wxProtocolUserFor##class() { wxProtocolUse##class = true; } \
+ } wxProtocolDoUse##class;
+
+class WXDLLIMPEXP_NET wxProtoInfo : public wxObject
+{
+public:
+ wxProtoInfo(const wxChar *name,
+ const wxChar *serv_name,
+ const bool need_host1,
+ wxClassInfo *info);
+
+protected:
+ wxProtoInfo *next;
+ wxString m_protoname;
+ wxString prefix;
+ wxString m_servname;
+ wxClassInfo *m_cinfo;
+ bool m_needhost;
+
+ friend class wxURL;
+
+ DECLARE_DYNAMIC_CLASS(wxProtoInfo)
+ wxDECLARE_NO_COPY_CLASS(wxProtoInfo);
+};
+
+#endif // wxUSE_PROTOCOL
+
+#endif // _WX_PROTOCOL_PROTOCOL_H
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/ptr_scpd.h
+// Purpose: compatibility wrapper for wxScoped{Ptr,Array}
+// Author: Vadim Zeitlin
+// Created: 2009-02-03
+// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+// do not include this file in any new code, include either wx/scopedptr.h or
+// wx/scopedarray.h (or both) instead
+#include "wx/scopedarray.h"
+#include "wx/scopedptr.h"
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/ptr_shrd.h
+// Purpose: compatibility wrapper for wx/sharedptr.h
+// Author: Vadim Zeitlin
+// Created: 2009-02-03
+// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+// do not include this file in any new code, include wx/sharedptr.h instead
+#include "wx/sharedptr.h"
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/quantize.h
+// Purpose: wxQuantizer class
+// Author: Julian Smart
+// Modified by:
+// Created: 22/6/2000
+// Copyright: (c) Julian Smart
+// Licence:
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_QUANTIZE_H_
+#define _WX_QUANTIZE_H_
+
+#include "wx/object.h"
+
+/*
+ * From jquant2.c
+ *
+ * Copyright (C) 1991-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ */
+
+class WXDLLIMPEXP_FWD_CORE wxImage;
+class WXDLLIMPEXP_FWD_CORE wxPalette;
+
+/*
+ * wxQuantize
+ * Based on the JPEG quantization code. Reduces the number of colours in a wxImage.
+ */
+
+#define wxQUANTIZE_INCLUDE_WINDOWS_COLOURS 0x01
+#define wxQUANTIZE_RETURN_8BIT_DATA 0x02
+#define wxQUANTIZE_FILL_DESTINATION_IMAGE 0x04
+
+class WXDLLIMPEXP_CORE wxQuantize: public wxObject
+{
+public:
+DECLARE_DYNAMIC_CLASS(wxQuantize)
+
+//// Constructor
+
+ wxQuantize() {}
+ virtual ~wxQuantize() {}
+
+//// Operations
+
+ // Reduce the colours in the source image and put the result into the
+ // destination image. Both images may be the same, to overwrite the source image.
+ // Specify an optional palette pointer to receive the resulting palette.
+ // This palette may be passed to ConvertImageToBitmap, for example.
+ // If you pass a palette pointer, you must free the palette yourself.
+
+ static bool Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalette, int desiredNoColours = 236,
+ unsigned char** eightBitData = 0, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA);
+
+ // This version sets a palette in the destination image so you don't
+ // have to manage it yourself.
+
+ static bool Quantize(const wxImage& src, wxImage& dest, int desiredNoColours = 236,
+ unsigned char** eightBitData = 0, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA);
+
+//// Helpers
+
+ // Converts input bitmap(s) into 8bit representation with custom palette
+
+ // in_rows and out_rows are arrays [0..h-1] of pointer to rows
+ // (in_rows contains w * 3 bytes per row, out_rows w bytes per row)
+ // fills out_rows with indexes into palette (which is also stored into palette variable)
+ static void DoQuantize(unsigned w, unsigned h, unsigned char **in_rows, unsigned char **out_rows, unsigned char *palette, int desiredNoColours);
+
+};
+
+#endif
+ // _WX_QUANTIZE_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/radiobox.h
+// Purpose: wxRadioBox declaration
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 10.09.00
+// Copyright: (c) Vadim Zeitlin
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RADIOBOX_H_BASE_
+#define _WX_RADIOBOX_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_RADIOBOX
+
+#include "wx/ctrlsub.h"
+
+#if wxUSE_TOOLTIPS
+
+#include "wx/dynarray.h"
+
+class WXDLLIMPEXP_FWD_CORE wxToolTip;
+
+WX_DEFINE_EXPORTED_ARRAY_PTR(wxToolTip *, wxToolTipArray);
+
+#endif // wxUSE_TOOLTIPS
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxRadioBoxNameStr[];
+
+// ----------------------------------------------------------------------------
+// wxRadioBoxBase is not a normal base class, but rather a mix-in because the
+// real wxRadioBox derives from different classes on different platforms: for
+// example, it is a wxStaticBox in wxUniv and wxMSW but not in other ports
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxRadioBoxBase : public wxItemContainerImmutable
+{
+public:
+ virtual ~wxRadioBoxBase();
+
+ // change/query the individual radio button state
+ virtual bool Enable(unsigned int n, bool enable = true) = 0;
+ virtual bool Show(unsigned int n, bool show = true) = 0;
+ virtual bool IsItemEnabled(unsigned int n) const = 0;
+ virtual bool IsItemShown(unsigned int n) const = 0;
+
+ // return number of columns/rows in this radiobox
+ unsigned int GetColumnCount() const { return m_numCols; }
+ unsigned int GetRowCount() const { return m_numRows; }
+
+ // return the next active (i.e. shown and not disabled) item above/below/to
+ // the left/right of the given one
+ int GetNextItem(int item, wxDirection dir, long style) const;
+
+#if wxUSE_TOOLTIPS
+ // set the tooltip text for a radio item, empty string unsets any tooltip
+ void SetItemToolTip(unsigned int item, const wxString& text);
+
+ // get the individual items tooltip; returns NULL if none
+ wxToolTip *GetItemToolTip(unsigned int item) const
+ { return m_itemsTooltips ? (*m_itemsTooltips)[item] : NULL; }
+#endif // wxUSE_TOOLTIPS
+
+#if wxUSE_HELP
+ // set helptext for a particular item, pass an empty string to erase it
+ void SetItemHelpText(unsigned int n, const wxString& helpText);
+
+ // retrieve helptext for a particular item, empty string means no help text
+ wxString GetItemHelpText(unsigned int n) const;
+#else // wxUSE_HELP
+ // just silently ignore the help text, it's better than requiring using
+ // conditional compilation in all code using this function
+ void SetItemHelpText(unsigned int WXUNUSED(n),
+ const wxString& WXUNUSED(helpText))
+ {
+ }
+#endif // wxUSE_HELP
+
+ // returns the radio item at the given position or wxNOT_FOUND if none
+ // (currently implemented only under MSW and GTK)
+ virtual int GetItemFromPoint(const wxPoint& WXUNUSED(pt)) const
+ {
+ return wxNOT_FOUND;
+ }
+
+
+protected:
+ wxRadioBoxBase()
+ {
+ m_numCols =
+ m_numRows =
+ m_majorDim = 0;
+
+#if wxUSE_TOOLTIPS
+ m_itemsTooltips = NULL;
+#endif // wxUSE_TOOLTIPS
+ }
+
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ // return the number of items in major direction (which depends on whether
+ // we have wxRA_SPECIFY_COLS or wxRA_SPECIFY_ROWS style)
+ unsigned int GetMajorDim() const { return m_majorDim; }
+
+ // sets m_majorDim and also updates m_numCols/Rows
+ //
+ // the style parameter should be the style of the radiobox itself
+ void SetMajorDim(unsigned int majorDim, long style);
+
+#if wxUSE_TOOLTIPS
+ // called from SetItemToolTip() to really set the tooltip for the specified
+ // item in the box (or, if tooltip is NULL, to remove any existing one).
+ //
+ // NB: this function should really be pure virtual but to avoid breaking
+ // the build of the ports for which it's not implemented yet we provide
+ // an empty stub in the base class for now
+ virtual void DoSetItemToolTip(unsigned int item, wxToolTip *tooltip);
+
+ // returns true if we have any item tooltips
+ bool HasItemToolTips() const { return m_itemsTooltips != NULL; }
+#endif // wxUSE_TOOLTIPS
+
+#if wxUSE_HELP
+ // Retrieve help text for an item: this is a helper for the implementation
+ // of wxWindow::GetHelpTextAtPoint() in the real radiobox class
+ wxString DoGetHelpTextAtPoint(const wxWindow *derived,
+ const wxPoint& pt,
+ wxHelpEvent::Origin origin) const;
+#endif // wxUSE_HELP
+
+private:
+ // the number of elements in major dimension (i.e. number of columns if
+ // wxRA_SPECIFY_COLS or the number of rows if wxRA_SPECIFY_ROWS) and also
+ // the number of rows/columns calculated from it
+ unsigned int m_majorDim,
+ m_numCols,
+ m_numRows;
+
+#if wxUSE_TOOLTIPS
+ // array of tooltips for the individual items
+ //
+ // this array is initially NULL and initialized on first use
+ wxToolTipArray *m_itemsTooltips;
+#endif
+
+#if wxUSE_HELP
+ // help text associated with a particular item or empty string if none
+ wxArrayString m_itemsHelpTexts;
+#endif // wxUSE_HELP
+};
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/radiobox.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/radiobox.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/radiobox.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/radiobox.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/radiobox.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/radiobox.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/radiobox.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/radiobox.h"
+#endif
+
+#endif // wxUSE_RADIOBOX
+
+#endif // _WX_RADIOBOX_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/radiobut.h
+// Purpose: wxRadioButton declaration
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 07.09.00
+// Copyright: (c) Vadim Zeitlin
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RADIOBUT_H_BASE_
+#define _WX_RADIOBUT_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_RADIOBTN
+
+/*
+ There is no wxRadioButtonBase class as wxRadioButton interface is the same
+ as wxCheckBox(Base), but under some platforms wxRadioButton really
+ derives from wxCheckBox and on the others it doesn't.
+
+ The pseudo-declaration of wxRadioButtonBase would look like this:
+
+ class wxRadioButtonBase : public ...
+ {
+ public:
+ virtual void SetValue(bool value);
+ virtual bool GetValue() const;
+ };
+ */
+
+#include "wx/control.h"
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxRadioButtonNameStr[];
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/radiobut.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/radiobut.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/radiobut.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/radiobut.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/radiobut.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/radiobut.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/radiobut.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/radiobut.h"
+#endif
+
+#endif // wxUSE_RADIOBTN
+
+#endif
+ // _WX_RADIOBUT_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/range.h
+// Purpose: Range Value Class
+// Author: Stefan Csomor
+// Modified by:
+// Created: 2011-01-07
+// Copyright: (c) 2011 Stefan Csomor
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RANGE_H_
+#define _WX_RANGE_H_
+
+#include "wx/defs.h"
+
+class wxRange
+{
+public :
+ wxRange(): m_minVal(0), m_maxVal(0) {}
+ wxRange( int minVal, int maxVal) : m_minVal(minVal), m_maxVal(maxVal) {}
+ int GetMin() const { return m_minVal; }
+ int GetMax() const { return m_maxVal; }
+private :
+ int m_minVal;
+ int m_maxVal;
+};
+
+#endif // _WX_RANGE_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/rawbmp.h
+// Purpose: macros for fast, raw bitmap data access
+// Author: Eric Kidd, Vadim Zeitlin
+// Modified by:
+// Created: 10.03.03
+// Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RAWBMP_H_
+#define _WX_RAWBMP_H_
+
+#include "wx/defs.h"
+
+#ifdef wxHAS_RAW_BITMAP
+
+#include "wx/image.h"
+#include "wx/bitmap.h"
+
+// ----------------------------------------------------------------------------
+// Abstract Pixel API
+//
+// We need to access our raw bitmap data (1) portably and (2) efficiently.
+// We do this using a two-dimensional "iteration" interface. Performance
+// is extremely important here: these functions will be called hundreds
+// of thousands of times in a row, and even small inefficiencies will
+// make applications seem slow.
+//
+// We can't always rely on inline functions, because not all compilers actually
+// bother to inline them unless we crank the optimization levels way up.
+// Therefore, we also provide macros to wring maximum speed out of compiler
+// unconditionally (e.g. even in debug builds). Of course, if the performance
+// isn't absolutely crucial for you you shouldn't be using them but the inline
+// functions instead.
+// ----------------------------------------------------------------------------
+
+/*
+ Usage example:
+
+ typedef wxPixelData<wxBitmap, wxNativePixelFormat> PixelData;
+
+ wxBitmap bmp;
+ PixelData data(bmp);
+ if ( !data )
+ {
+ ... raw access to bitmap data unavailable, do something else ...
+ return;
+ }
+
+ if ( data.GetWidth() < 20 || data.GetHeight() < 20 )
+ {
+ ... complain: the bitmap it too small ...
+ return;
+ }
+
+ PixelData::Iterator p(data);
+
+ // we draw a (10, 10)-(20, 20) rect manually using the given r, g, b
+ p.Offset(data, 10, 10);
+
+ for ( int y = 0; y < 10; ++y )
+ {
+ PixelData::Iterator rowStart = p;
+
+ for ( int x = 0; x < 10; ++x, ++p )
+ {
+ p.Red() = r;
+ p.Green() = g;
+ p.Blue() = b;
+ }
+
+ p = rowStart;
+ p.OffsetY(data, 1);
+ }
+ */
+
+/*
+ Note: we do not use WXDLLIMPEXP_CORE with classes in this file because VC++ has
+ problems with exporting inner class defined inside a specialization of a
+ template class from a DLL. Besides, as all the methods are inline it's not
+ really necessary to put them in DLL at all.
+ */
+
+// ----------------------------------------------------------------------------
+// wxPixelFormat
+// ----------------------------------------------------------------------------
+
+/*
+ wxPixelFormat is a template class describing the bitmap data format. It
+ contains the constants describing the format of pixel data, but does not
+ describe how the entire bitmap is stored (i.e. top-to-bottom,
+ bottom-to-top, ...). It is also a "traits"-like class, i.e. it only
+ contains some constants and maybe static methods but nothing more, so it
+ can be safely used without incurring any overhead as all accesses to it are
+ done at compile-time.
+
+ Current limitations: we don't support RAGABA and ARAGAB formats supported
+ by Mac OS X. If there is sufficient interest, these classes could be
+ extended to deal with them. Neither do we support alpha channel having
+ different representation from the RGB ones (happens under QNX/Photon I
+ think), but again this could be achieved with some small extra effort.
+
+ Template parameters are:
+ - type of a single pixel component
+ - size of the single pixel in bits
+ - indices of red, green and blue pixel components inside the pixel
+ - index of the alpha component or -1 if none
+ - type which can contain the full pixel value (all channels)
+ */
+
+template <class Channel,
+ size_t Bpp, int R, int G, int B, int A = -1,
+ class Pixel = wxUint32>
+
+struct wxPixelFormat
+{
+ // iterator over pixels is usually of type "ChannelType *"
+ typedef Channel ChannelType;
+
+ // the type which may hold the entire pixel value
+ typedef Pixel PixelType;
+
+ // NB: using static ints initialized inside the class declaration is not
+ // portable as it doesn't work with VC++ 6, so we must use enums
+
+ // size of one pixel in bits
+ enum { BitsPerPixel = Bpp };
+
+ // size of one pixel in ChannelType units (usually bytes)
+ enum { SizePixel = Bpp / (8 * sizeof(Channel)) };
+
+ // the channels indices inside the pixel
+ enum
+ {
+ RED = R,
+ GREEN = G,
+ BLUE = B,
+ ALPHA = A
+ };
+
+ // true if we have an alpha channel (together with the other channels, this
+ // doesn't cover the case of wxImage which stores alpha separately)
+ enum { HasAlpha = A != -1 };
+};
+
+// some "predefined" pixel formats
+// -------------------------------
+
+// wxImage format is common to all platforms
+typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxImagePixelFormat;
+
+// the (most common) native bitmap format without alpha support
+#if defined(__WXMSW__)
+ // under MSW the RGB components are reversed, they're in BGR order
+ typedef wxPixelFormat<unsigned char, 24, 2, 1, 0> wxNativePixelFormat;
+
+ #define wxPIXEL_FORMAT_ALPHA 3
+#elif defined(__WXMAC__)
+ // under Mac, first component is unused but still present, hence we use
+ // 32bpp, not 24
+ typedef wxPixelFormat<unsigned char, 32, 1, 2, 3> wxNativePixelFormat;
+
+ #define wxPIXEL_FORMAT_ALPHA 0
+#elif defined(__WXCOCOA__)
+ // Cocoa is standard RGB or RGBA (normally it is RGBA)
+ typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxNativePixelFormat;
+
+ #define wxPIXEL_FORMAT_ALPHA 3
+#elif defined(__WXGTK__)
+ // Under GTK+ 2.X we use GdkPixbuf, which is standard RGB or RGBA
+ typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxNativePixelFormat;
+
+ #define wxPIXEL_FORMAT_ALPHA 3
+#elif defined(__WXPM__)
+ // Under PM, we can use standard RGB or RGBA
+ typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxNativePixelFormat;
+
+ #define wxPIXEL_FORMAT_ALPHA 3
+#elif defined(__WXDFB__)
+ // Under DirectFB, RGB components are reversed, they're in BGR order
+ typedef wxPixelFormat<unsigned char, 24, 2, 1, 0> wxNativePixelFormat;
+
+ #define wxPIXEL_FORMAT_ALPHA 3
+#endif
+
+// the (most common) native format for bitmaps with alpha channel
+#ifdef wxPIXEL_FORMAT_ALPHA
+ typedef wxPixelFormat<unsigned char, 32,
+ wxNativePixelFormat::RED,
+ wxNativePixelFormat::GREEN,
+ wxNativePixelFormat::BLUE,
+ wxPIXEL_FORMAT_ALPHA> wxAlphaPixelFormat;
+#endif // wxPIXEL_FORMAT_ALPHA
+
+// we also define the (default/best) pixel format for the given class: this is
+// used as default value for the pixel format in wxPixelIterator template
+template <class T> struct wxPixelFormatFor;
+
+#if wxUSE_IMAGE
+// wxPixelFormatFor is only defined for wxImage, attempt to use it with other
+// classes (wxBitmap...) will result in compile errors which is exactly what we
+// want
+template <>
+struct wxPixelFormatFor<wxImage>
+{
+ typedef wxImagePixelFormat Format;
+};
+#endif //wxUSE_IMAGE
+
+// ----------------------------------------------------------------------------
+// wxPixelData
+// ----------------------------------------------------------------------------
+
+/*
+ wxPixelDataBase is just a helper for wxPixelData: it contains things common
+ to both wxImage and wxBitmap specializations.
+ */
+class wxPixelDataBase
+{
+public:
+ // origin of the rectangular region we represent
+ wxPoint GetOrigin() const { return m_ptOrigin; }
+
+ // width and height of the region we represent
+ int GetWidth() const { return m_width; }
+ int GetHeight() const { return m_height; }
+
+ wxSize GetSize() const { return wxSize(m_width, m_height); }
+
+ // the distance between two rows
+ int GetRowStride() const { return m_stride; }
+
+// private: -- see comment in the beginning of the file
+
+ // the origin of this image inside the bigger bitmap (usually (0, 0))
+ wxPoint m_ptOrigin;
+
+ // the size of the image we address, in pixels
+ int m_width,
+ m_height;
+
+ // this parameter is the offset of the start of the (N+1)st row from the
+ // Nth one and can be different from m_bypp*width in some cases:
+ // a) the most usual one is to force 32/64 bit alignment of rows
+ // b) another one is for bottom-to-top images where it's negative
+ // c) finally, it could conceivably be 0 for the images with all
+ // lines being identical
+ int m_stride;
+
+protected:
+ // ctor is protected because this class is only meant to be used as the
+ // base class by wxPixelData
+ wxPixelDataBase()
+ {
+ m_width =
+ m_height =
+ m_stride = 0;
+ }
+};
+
+/*
+ wxPixelData represents the entire bitmap data, i.e. unlike
+ wxPixelFormat (which it uses) it also stores the global bitmap
+ characteristics such as its size, inter-row separation and so on.
+
+ Because of this it can be used to move the pixel iterators (which don't
+ have enough information about the bitmap themselves). This may seem a bit
+ unnatural but must be done in this way to keep the iterator objects as
+ small as possible for maximum efficiency as otherwise they wouldn't be put
+ into the CPU registers by the compiler any more.
+
+ Implementation note: we use the standard workaround for lack of partial
+ template specialization support in VC (both 6 and 7): instead of partly
+ specializing the class Foo<T, U> for some T we introduce FooOut<T> and
+ FooIn<U> nested in it, make Foo<T, U> equivalent to FooOut<T>::FooIn<U> and
+ fully specialize FooOut.
+
+ Also note that this class doesn't have any default definition because we
+ can't really do anything without knowing the exact image class. We do
+ provide wxPixelDataBase to make it simpler to write new wxPixelData
+ specializations.
+ */
+
+// we need to define this skeleton template to mollify VC++
+template <class Image>
+struct wxPixelDataOut
+{
+ template <class PixelFormat>
+ class wxPixelDataIn
+ {
+ public:
+ class Iterator { };
+ };
+};
+
+#if wxUSE_IMAGE
+// wxPixelData specialization for wxImage: this is the simplest case as we
+// don't have to care about different pixel formats here
+template <>
+struct wxPixelDataOut<wxImage>
+{
+ // NB: this is a template class even though it doesn't use its template
+ // parameter because otherwise wxPixelData couldn't compile
+ template <class dummyPixelFormat>
+ class wxPixelDataIn : public wxPixelDataBase
+ {
+ public:
+ // the type of the class we're working with
+ typedef wxImage ImageType;
+
+ // the iterator which should be used for working with data in this
+ // format
+ class Iterator
+ {
+ public:
+ // the pixel format we use
+ typedef wxImagePixelFormat PixelFormat;
+
+ // the pixel data we're working with
+ typedef
+ wxPixelDataOut<wxImage>::wxPixelDataIn<PixelFormat> PixelData;
+
+ // go back to (0, 0)
+ void Reset(const PixelData& data)
+ {
+ *this = data.GetPixels();
+ }
+
+ // creates the iterator pointing to the beginning of data
+ Iterator(PixelData& data)
+ {
+ Reset(data);
+ }
+
+ // creates the iterator initially pointing to the image origin
+ Iterator(const wxImage& image)
+ {
+ m_pRGB = image.GetData();
+
+ if ( image.HasAlpha() )
+ {
+ m_pAlpha = image.GetAlpha();
+ }
+ else // alpha is not used at all
+ {
+ m_pAlpha = NULL;
+ }
+ }
+
+ // true if the iterator is valid
+ bool IsOk() const { return m_pRGB != NULL; }
+
+
+ // navigation
+ // ----------
+
+ // advance the iterator to the next pixel, prefix version
+ Iterator& operator++()
+ {
+ m_pRGB += PixelFormat::SizePixel;
+ if ( m_pAlpha )
+ ++m_pAlpha;
+
+ return *this;
+ }
+
+ // postfix (hence less efficient -- don't use it unless you
+ // absolutely must) version
+ Iterator operator++(int)
+ {
+ Iterator p(*this);
+ ++*this;
+ return p;
+ }
+
+ // move x pixels to the right and y down
+ //
+ // note that the rows don't wrap!
+ void Offset(const PixelData& data, int x, int y)
+ {
+ m_pRGB += data.GetRowStride()*y + PixelFormat::SizePixel*x;
+ if ( m_pAlpha )
+ m_pAlpha += data.GetWidth() + x;
+ }
+
+ // move x pixels to the right (again, no row wrapping)
+ void OffsetX(const PixelData& WXUNUSED(data), int x)
+ {
+ m_pRGB += PixelFormat::SizePixel*x;
+ if ( m_pAlpha )
+ m_pAlpha += x;
+ }
+
+ // move y rows to the bottom
+ void OffsetY(const PixelData& data, int y)
+ {
+ m_pRGB += data.GetRowStride()*y;
+ if ( m_pAlpha )
+ m_pAlpha += data.GetWidth();
+ }
+
+ // go to the given position
+ void MoveTo(const PixelData& data, int x, int y)
+ {
+ Reset(data);
+ Offset(data, x, y);
+ }
+
+
+ // data access
+ // -----------
+
+ // access to individual colour components
+ PixelFormat::ChannelType& Red() { return m_pRGB[PixelFormat::RED]; }
+ PixelFormat::ChannelType& Green() { return m_pRGB[PixelFormat::GREEN]; }
+ PixelFormat::ChannelType& Blue() { return m_pRGB[PixelFormat::BLUE]; }
+ PixelFormat::ChannelType& Alpha() { return *m_pAlpha; }
+
+ // address the pixel contents directly (always RGB, without alpha)
+ //
+ // this can't be used to modify the image as assigning a 32bpp
+ // value to 24bpp pixel would overwrite an extra byte in the next
+ // pixel or beyond the end of image
+ const typename PixelFormat::PixelType& Data()
+ { return *(typename PixelFormat::PixelType *)m_pRGB; }
+
+ // private: -- see comment in the beginning of the file
+
+ // pointer into RGB buffer
+ unsigned char *m_pRGB;
+
+ // pointer into alpha buffer or NULL if alpha isn't used
+ unsigned char *m_pAlpha;
+ };
+
+ // initializes us with the data of the given image
+ wxPixelDataIn(ImageType& image) : m_image(image), m_pixels(image)
+ {
+ m_width = image.GetWidth();
+ m_height = image.GetHeight();
+ m_stride = Iterator::PixelFormat::SizePixel * m_width;
+ }
+
+ // initializes us with the given region of the specified image
+ wxPixelDataIn(ImageType& image,
+ const wxPoint& pt,
+ const wxSize& sz) : m_image(image), m_pixels(image)
+ {
+ m_stride = Iterator::PixelFormat::SizePixel * m_width;
+
+ InitRect(pt, sz);
+ }
+
+ // initializes us with the given region of the specified image
+ wxPixelDataIn(ImageType& image,
+ const wxRect& rect) : m_image(image), m_pixels(image)
+ {
+ m_stride = Iterator::PixelFormat::SizePixel * m_width;
+
+ InitRect(rect.GetPosition(), rect.GetSize());
+ }
+
+ // we evaluate to true only if we could get access to bitmap data
+ // successfully
+ operator bool() const { return m_pixels.IsOk(); }
+
+ // get the iterator pointing to the origin
+ Iterator GetPixels() const { return m_pixels; }
+
+ private:
+ void InitRect(const wxPoint& pt, const wxSize& sz)
+ {
+ m_width = sz.x;
+ m_height = sz.y;
+
+ m_ptOrigin = pt;
+ m_pixels.Offset(*this, pt.x, pt.y);
+ }
+
+ // the image we're working with
+ ImageType& m_image;
+
+ // the iterator pointing to the image origin
+ Iterator m_pixels;
+ };
+};
+#endif //wxUSE_IMAGE
+
+#if wxUSE_GUI
+// wxPixelData specialization for wxBitmap: here things are more interesting as
+// we also have to support different pixel formats
+template <>
+struct wxPixelDataOut<wxBitmap>
+{
+ template <class Format>
+ class wxPixelDataIn : public wxPixelDataBase
+ {
+ public:
+ // the type of the class we're working with
+ typedef wxBitmap ImageType;
+
+ class Iterator
+ {
+ public:
+ // the pixel format we use
+ typedef Format PixelFormat;
+
+ // the type of the pixel components
+ typedef typename PixelFormat::ChannelType ChannelType;
+
+ // the pixel data we're working with
+ typedef wxPixelDataOut<wxBitmap>::wxPixelDataIn<Format> PixelData;
+
+
+ // go back to (0, 0)
+ void Reset(const PixelData& data)
+ {
+ *this = data.GetPixels();
+ }
+
+ // initializes the iterator to point to the origin of the given
+ // pixel data
+ Iterator(PixelData& data)
+ {
+ Reset(data);
+ }
+
+ // initializes the iterator to point to the origin of the given
+ // bitmap
+ Iterator(wxBitmap& bmp, PixelData& data)
+ {
+ // using cast here is ugly but it should be safe as
+ // GetRawData() real return type should be consistent with
+ // BitsPerPixel (which is in turn defined by ChannelType) and
+ // this is the only thing we can do without making GetRawData()
+ // a template function which is undesirable
+ m_ptr = (ChannelType *)
+ bmp.GetRawData(data, PixelFormat::BitsPerPixel);
+ }
+
+ // default constructor
+ Iterator()
+ {
+ m_ptr = NULL;
+ }
+
+ // return true if this iterator is valid
+ bool IsOk() const { return m_ptr != NULL; }
+
+
+ // navigation
+ // ----------
+
+ // advance the iterator to the next pixel, prefix version
+ Iterator& operator++()
+ {
+ m_ptr += PixelFormat::SizePixel;
+
+ return *this;
+ }
+
+ // postfix (hence less efficient -- don't use it unless you
+ // absolutely must) version
+ Iterator operator++(int)
+ {
+ Iterator p(*this);
+ ++*this;
+ return p;
+ }
+
+ // move x pixels to the right and y down
+ //
+ // note that the rows don't wrap!
+ void Offset(const PixelData& data, int x, int y)
+ {
+ m_ptr += data.GetRowStride()*y + PixelFormat::SizePixel*x;
+ }
+
+ // move x pixels to the right (again, no row wrapping)
+ void OffsetX(const PixelData& WXUNUSED(data), int x)
+ {
+ m_ptr += PixelFormat::SizePixel*x;
+ }
+
+ // move y rows to the bottom
+ void OffsetY(const PixelData& data, int y)
+ {
+ m_ptr += data.GetRowStride()*y;
+ }
+
+ // go to the given position
+ void MoveTo(const PixelData& data, int x, int y)
+ {
+ Reset(data);
+ Offset(data, x, y);
+ }
+
+
+ // data access
+ // -----------
+
+ // access to individual colour components
+ ChannelType& Red() { return m_ptr[PixelFormat::RED]; }
+ ChannelType& Green() { return m_ptr[PixelFormat::GREEN]; }
+ ChannelType& Blue() { return m_ptr[PixelFormat::BLUE]; }
+ ChannelType& Alpha() { return m_ptr[PixelFormat::ALPHA]; }
+
+ // address the pixel contents directly
+ //
+ // warning: the format is platform dependent
+ //
+ // warning 2: assigning to Data() only works correctly for 16bpp or
+ // 32bpp formats but using it for 24bpp ones overwrites
+ // one extra byte and so can't be done
+ typename PixelFormat::PixelType& Data()
+ { return *(typename PixelFormat::PixelType *)m_ptr; }
+
+ // private: -- see comment in the beginning of the file
+
+ // for efficiency reasons this class should not have any other
+ // fields, otherwise it won't be put into a CPU register (as it
+ // should inside the inner loops) by some compilers, notably gcc
+ ChannelType *m_ptr;
+ };
+
+ // ctor associates this pointer with a bitmap and locks the bitmap for
+ // raw access, it will be unlocked only by our dtor and so these
+ // objects should normally be only created on the stack, i.e. have
+ // limited life-time
+ wxPixelDataIn(wxBitmap& bmp) : m_bmp(bmp), m_pixels(bmp, *this)
+ {
+ }
+
+ wxPixelDataIn(wxBitmap& bmp, const wxRect& rect)
+ : m_bmp(bmp), m_pixels(bmp, *this)
+ {
+ InitRect(rect.GetPosition(), rect.GetSize());
+ }
+
+ wxPixelDataIn(wxBitmap& bmp, const wxPoint& pt, const wxSize& sz)
+ : m_bmp(bmp), m_pixels(bmp, *this)
+ {
+ InitRect(pt, sz);
+ }
+
+ // we evaluate to true only if we could get access to bitmap data
+ // successfully
+ operator bool() const { return m_pixels.IsOk(); }
+
+ // get the iterator pointing to the origin
+ Iterator GetPixels() const { return m_pixels; }
+
+ // dtor unlocks the bitmap
+ ~wxPixelDataIn()
+ {
+ if ( m_pixels.IsOk() )
+ {
+#if defined(__WXMSW__) || defined(__WXMAC__)
+ // this is a hack to mark wxBitmap as using alpha channel
+ if ( Format::HasAlpha )
+ m_bmp.UseAlpha();
+#endif
+ m_bmp.UngetRawData(*this);
+ }
+ // else: don't call UngetRawData() if GetRawData() failed
+ }
+
+#if WXWIN_COMPATIBILITY_2_8
+ // not needed anymore, calls to it should be simply removed
+ wxDEPRECATED_INLINE( void UseAlpha(), wxEMPTY_PARAMETER_VALUE )
+#endif
+
+ // private: -- see comment in the beginning of the file
+
+ // the bitmap we're associated with
+ wxBitmap m_bmp;
+
+ // the iterator pointing to the image origin
+ Iterator m_pixels;
+
+ private:
+ void InitRect(const wxPoint& pt, const wxSize& sz)
+ {
+ m_pixels.Offset(*this, pt.x, pt.y);
+
+ m_ptOrigin = pt;
+ m_width = sz.x;
+ m_height = sz.y;
+ }
+ };
+};
+
+#endif //wxUSE_GUI
+
+// FIXME-VC6: VC6 doesn't like typename in default template parameters while
+// it is necessary with standard-conforming compilers, remove this
+// #define and just use typename when we drop VC6 support
+#if defined(__VISUALC__) && !wxCHECK_VISUALC_VERSION(7)
+ #define wxTYPENAME_IN_TEMPLATE_DEFAULT_PARAM
+#else
+ #define wxTYPENAME_IN_TEMPLATE_DEFAULT_PARAM typename
+#endif
+
+template <class Image,
+ class PixelFormat = wxTYPENAME_IN_TEMPLATE_DEFAULT_PARAM
+ wxPixelFormatFor<Image>::Format >
+class wxPixelData :
+ public wxPixelDataOut<Image>::template wxPixelDataIn<PixelFormat>
+{
+public:
+ typedef
+ typename wxPixelDataOut<Image>::template wxPixelDataIn<PixelFormat>
+ Base;
+
+ wxPixelData(Image& image) : Base(image) { }
+
+ wxPixelData(Image& i, const wxRect& rect) : Base(i, rect) { }
+
+ wxPixelData(Image& i, const wxPoint& pt, const wxSize& sz)
+ : Base(i, pt, sz)
+ {
+ }
+};
+
+// some "predefined" pixel data classes
+#if wxUSE_IMAGE
+typedef wxPixelData<wxImage> wxImagePixelData;
+#endif //wxUSE_IMAGE
+#if wxUSE_GUI
+typedef wxPixelData<wxBitmap, wxNativePixelFormat> wxNativePixelData;
+typedef wxPixelData<wxBitmap, wxAlphaPixelFormat> wxAlphaPixelData;
+
+#endif //wxUSE_GUI
+
+// ----------------------------------------------------------------------------
+// wxPixelIterator
+// ----------------------------------------------------------------------------
+
+/*
+ wxPixel::Iterator represents something which points to the pixel data and
+ allows us to iterate over it. In the simplest case of wxBitmap it is,
+ indeed, just a pointer, but it can be something more complicated and,
+ moreover, you are free to specialize it for other image classes and bitmap
+ formats.
+
+ Note that although it would have been much more intuitive to have a real
+ class here instead of what we have now, this class would need two template
+ parameters, and this can't be done because we'd need compiler support for
+ partial template specialization then and neither VC6 nor VC7 provide it.
+ */
+template < class Image, class PixelFormat = wxPixelFormatFor<Image> >
+struct wxPixelIterator : public wxPixelData<Image, PixelFormat>::Iterator
+{
+};
+
+#endif // wxHAS_RAW_BITMAP
+#endif // _WX_RAWBMP_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/rearrangectrl.h
+// Purpose: various controls for rearranging the items interactively
+// Author: Vadim Zeitlin
+// Created: 2008-12-15
+// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_REARRANGECTRL_H_
+#define _WX_REARRANGECTRL_H_
+
+#include "wx/checklst.h"
+
+#if wxUSE_REARRANGECTRL
+
+#include "wx/panel.h"
+#include "wx/dialog.h"
+
+#include "wx/arrstr.h"
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxRearrangeListNameStr[];
+extern WXDLLIMPEXP_DATA_CORE(const char) wxRearrangeDialogNameStr[];
+
+// ----------------------------------------------------------------------------
+// wxRearrangeList: a (check) list box allowing to move items around
+// ----------------------------------------------------------------------------
+
+// This class works allows to change the order of the items shown in it as well
+// as to check or uncheck them individually. The data structure used to allow
+// this is the order array which contains the items indices indexed by their
+// position with an added twist that the unchecked items are represented by the
+// bitwise complement of the corresponding index (for any architecture using
+// two's complement for negative numbers representation (i.e. just about any at
+// all) this means that a checked item N is represented by -N-1 in unchecked
+// state).
+//
+// So, for example, the array order [1 -3 0] used in conjunction with the items
+// array ["first", "second", "third"] means that the items are displayed in the
+// order "second", "third", "first" and the "third" item is unchecked while the
+// other two are checked.
+class WXDLLIMPEXP_CORE wxRearrangeList : public wxCheckListBox
+{
+public:
+ // ctors and such
+ // --------------
+
+ // default ctor, call Create() later
+ wxRearrangeList() { }
+
+ // ctor creating the control, the arguments are the same as for
+ // wxCheckListBox except for the extra order array which defines the
+ // (initial) display order of the items as well as their statuses, see the
+ // description above
+ wxRearrangeList(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayInt& order,
+ const wxArrayString& items,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxRearrangeListNameStr)
+ {
+ Create(parent, id, pos, size, order, items, style, validator, name);
+ }
+
+ // Create() function takes the same parameters as the base class one and
+ // the order array determining the initial display order
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayInt& order,
+ const wxArrayString& items,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxRearrangeListNameStr);
+
+
+ // items order
+ // -----------
+
+ // get the current items order; the returned array uses the same convention
+ // as the one passed to the ctor
+ const wxArrayInt& GetCurrentOrder() const { return m_order; }
+
+ // return true if the current item can be moved up or down (i.e. just that
+ // it's not the first or the last one)
+ bool CanMoveCurrentUp() const;
+ bool CanMoveCurrentDown() const;
+
+ // move the current item one position up or down, return true if it was moved
+ // or false if the current item was the first/last one and so nothing was done
+ bool MoveCurrentUp();
+ bool MoveCurrentDown();
+
+private:
+ // swap two items at the given positions in the listbox
+ void Swap(int pos1, int pos2);
+
+ // event handler for item checking/unchecking
+ void OnCheck(wxCommandEvent& event);
+
+
+ // the current order array
+ wxArrayInt m_order;
+
+
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxRearrangeList);
+};
+
+// ----------------------------------------------------------------------------
+// wxRearrangeCtrl: composite control containing a wxRearrangeList and buttons
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxRearrangeCtrl : public wxPanel
+{
+public:
+ // ctors/Create function are the same as for wxRearrangeList
+ wxRearrangeCtrl()
+ {
+ Init();
+ }
+
+ wxRearrangeCtrl(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayInt& order,
+ const wxArrayString& items,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxRearrangeListNameStr)
+ {
+ Init();
+
+ Create(parent, id, pos, size, order, items, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayInt& order,
+ const wxArrayString& items,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxRearrangeListNameStr);
+
+ // get the underlying listbox
+ wxRearrangeList *GetList() const { return m_list; }
+
+private:
+ // common part of all ctors
+ void Init();
+
+ // event handlers for the buttons
+ void OnUpdateButtonUI(wxUpdateUIEvent& event);
+ void OnButton(wxCommandEvent& event);
+
+
+ wxRearrangeList *m_list;
+
+
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxRearrangeCtrl);
+};
+
+// ----------------------------------------------------------------------------
+// wxRearrangeDialog: dialog containing a wxRearrangeCtrl
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxRearrangeDialog : public wxDialog
+{
+public:
+ // default ctor, use Create() later
+ wxRearrangeDialog() { Init(); }
+
+ // ctor for the dialog: message is shown inside the dialog itself, order
+ // and items are passed to wxRearrangeList used internally
+ wxRearrangeDialog(wxWindow *parent,
+ const wxString& message,
+ const wxString& title,
+ const wxArrayInt& order,
+ const wxArrayString& items,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxString& name = wxRearrangeDialogNameStr)
+ {
+ Init();
+
+ Create(parent, message, title, order, items, pos, name);
+ }
+
+ bool Create(wxWindow *parent,
+ const wxString& message,
+ const wxString& title,
+ const wxArrayInt& order,
+ const wxArrayString& items,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxString& name = wxRearrangeDialogNameStr);
+
+
+ // methods for the dialog customization
+
+ // add extra contents to the dialog below the wxRearrangeCtrl part: the
+ // given window (usually a wxPanel containing more control inside it) must
+ // have the dialog as its parent and will be inserted into it at the right
+ // place by this method
+ void AddExtraControls(wxWindow *win);
+
+ // return the wxRearrangeList control used by the dialog
+ wxRearrangeList *GetList() const;
+
+
+ // get the order of items after it was modified by the user
+ wxArrayInt GetOrder() const;
+
+private:
+ // common part of all ctors
+ void Init() { m_ctrl = NULL; }
+
+ wxRearrangeCtrl *m_ctrl;
+
+ wxDECLARE_NO_COPY_CLASS(wxRearrangeDialog);
+};
+
+#endif // wxUSE_REARRANGECTRL
+
+#endif // _WX_REARRANGECTRL_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/recguard.h
+// Purpose: declaration and implementation of wxRecursionGuard class
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 14.08.2003
+// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RECGUARD_H_
+#define _WX_RECGUARD_H_
+
+#include "wx/defs.h"
+
+// ----------------------------------------------------------------------------
+// wxRecursionGuardFlag is used with wxRecursionGuard
+// ----------------------------------------------------------------------------
+
+typedef int wxRecursionGuardFlag;
+
+// ----------------------------------------------------------------------------
+// wxRecursionGuard is the simplest way to protect a function from reentrancy
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxRecursionGuard
+{
+public:
+ wxRecursionGuard(wxRecursionGuardFlag& flag)
+ : m_flag(flag)
+ {
+ m_isInside = flag++ != 0;
+ }
+
+ ~wxRecursionGuard()
+ {
+ wxASSERT_MSG( m_flag > 0, wxT("unbalanced wxRecursionGuards!?") );
+
+ m_flag--;
+ }
+
+ bool IsInside() const { return m_isInside; }
+
+private:
+ wxRecursionGuardFlag& m_flag;
+
+ // true if the flag had been already set when we were created
+ bool m_isInside;
+};
+
+#endif // _WX_RECGUARD_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/regex.h
+// Purpose: regular expression matching
+// Author: Karsten Ballueder
+// Modified by: VZ at 13.07.01 (integrated to wxWin)
+// Created: 05.02.2000
+// Copyright: (c) 2000 Karsten Ballueder <ballueder@gmx.net>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_REGEX_H_
+#define _WX_REGEX_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_REGEX
+
+#include "wx/string.h"
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// flags for regex compilation: these can be used with Compile()
+enum
+{
+ // use extended regex syntax
+ wxRE_EXTENDED = 0,
+
+ // use advanced RE syntax (built-in regex only)
+#ifdef wxHAS_REGEX_ADVANCED
+ wxRE_ADVANCED = 1,
+#endif
+
+ // use basic RE syntax
+ wxRE_BASIC = 2,
+
+ // ignore case in match
+ wxRE_ICASE = 4,
+
+ // only check match, don't set back references
+ wxRE_NOSUB = 8,
+
+ // if not set, treat '\n' as an ordinary character, otherwise it is
+ // special: it is not matched by '.' and '^' and '$' always match
+ // after/before it regardless of the setting of wxRE_NOT[BE]OL
+ wxRE_NEWLINE = 16,
+
+ // default flags
+ wxRE_DEFAULT = wxRE_EXTENDED
+};
+
+// flags for regex matching: these can be used with Matches()
+//
+// these flags are mainly useful when doing several matches in a long string,
+// they can be used to prevent erroneous matches for '^' and '$'
+enum
+{
+ // '^' doesn't match at the start of line
+ wxRE_NOTBOL = 32,
+
+ // '$' doesn't match at the end of line
+ wxRE_NOTEOL = 64
+};
+
+// ----------------------------------------------------------------------------
+// wxRegEx: a regular expression
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_BASE wxRegExImpl;
+
+class WXDLLIMPEXP_BASE wxRegEx
+{
+public:
+ // default ctor: use Compile() later
+ wxRegEx() { Init(); }
+
+ // create and compile
+ wxRegEx(const wxString& expr, int flags = wxRE_DEFAULT)
+ {
+ Init();
+ (void)Compile(expr, flags);
+ }
+
+ // return true if this is a valid compiled regular expression
+ bool IsValid() const { return m_impl != NULL; }
+
+ // compile the string into regular expression, return true if ok or false
+ // if string has a syntax error
+ bool Compile(const wxString& pattern, int flags = wxRE_DEFAULT);
+
+ // matches the precompiled regular expression against a string, return
+ // true if matches and false otherwise
+ //
+ // flags may be combination of wxRE_NOTBOL and wxRE_NOTEOL
+ // len may be the length of text (ignored by most system regex libs)
+ //
+ // may only be called after successful call to Compile()
+ bool Matches(const wxString& text, int flags = 0) const;
+ bool Matches(const wxChar *text, int flags, size_t len) const
+ { return Matches(wxString(text, len), flags); }
+
+ // get the start index and the length of the match of the expression
+ // (index 0) or a bracketed subexpression (index != 0)
+ //
+ // may only be called after successful call to Matches()
+ //
+ // return false if no match or on error
+ bool GetMatch(size_t *start, size_t *len, size_t index = 0) const;
+
+ // return the part of string corresponding to the match, empty string is
+ // returned if match failed
+ //
+ // may only be called after successful call to Matches()
+ wxString GetMatch(const wxString& text, size_t index = 0) const;
+
+ // return the size of the array of matches, i.e. the number of bracketed
+ // subexpressions plus one for the expression itself, or 0 on error.
+ //
+ // may only be called after successful call to Compile()
+ size_t GetMatchCount() const;
+
+ // replaces the current regular expression in the string pointed to by
+ // pattern, with the text in replacement and return number of matches
+ // replaced (maybe 0 if none found) or -1 on error
+ //
+ // the replacement text may contain backreferences (\number) which will be
+ // replaced with the value of the corresponding subexpression in the
+ // pattern match
+ //
+ // maxMatches may be used to limit the number of replacements made, setting
+ // it to 1, for example, will only replace first occurrence (if any) of the
+ // pattern in the text while default value of 0 means replace all
+ int Replace(wxString *text, const wxString& replacement,
+ size_t maxMatches = 0) const;
+
+ // replace the first occurrence
+ int ReplaceFirst(wxString *text, const wxString& replacement) const
+ { return Replace(text, replacement, 1); }
+
+ // replace all occurrences: this is actually a synonym for Replace()
+ int ReplaceAll(wxString *text, const wxString& replacement) const
+ { return Replace(text, replacement, 0); }
+
+ // dtor not virtual, don't derive from this class
+ ~wxRegEx();
+
+private:
+ // common part of all ctors
+ void Init();
+
+ // the real guts of this class
+ wxRegExImpl *m_impl;
+
+ // as long as the class wxRegExImpl is not ref-counted,
+ // instances of the handle wxRegEx must not be copied.
+ wxRegEx(const wxRegEx&);
+ wxRegEx &operator=(const wxRegEx&);
+};
+
+#endif // wxUSE_REGEX
+
+#endif // _WX_REGEX_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/region.h
+// Purpose: Base header for wxRegion
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_REGION_H_BASE_
+#define _WX_REGION_H_BASE_
+
+#include "wx/gdiobj.h"
+#include "wx/gdicmn.h"
+
+class WXDLLIMPEXP_FWD_CORE wxBitmap;
+class WXDLLIMPEXP_FWD_CORE wxColour;
+class WXDLLIMPEXP_FWD_CORE wxRegion;
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// result of wxRegion::Contains() call
+enum wxRegionContain
+{
+ wxOutRegion = 0,
+ wxPartRegion = 1,
+ wxInRegion = 2
+};
+
+// these constants are used with wxRegion::Combine() in the ports which have
+// this method
+enum wxRegionOp
+{
+ // Creates the intersection of the two combined regions.
+ wxRGN_AND,
+
+ // Creates a copy of the region
+ wxRGN_COPY,
+
+ // Combines the parts of first region that are not in the second one
+ wxRGN_DIFF,
+
+ // Creates the union of two combined regions.
+ wxRGN_OR,
+
+ // Creates the union of two regions except for any overlapping areas.
+ wxRGN_XOR
+};
+
+// ----------------------------------------------------------------------------
+// wxRegionBase defines wxRegion API
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxRegionBase : public wxGDIObject
+{
+public:
+ // ctors
+ // -----
+
+ // none are defined here but the following should be available:
+#if 0
+ wxRegion();
+ wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
+ wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
+ wxRegion(const wxRect& rect);
+ wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
+ wxRegion(const wxBitmap& bmp);
+ wxRegion(const wxBitmap& bmp, const wxColour& transp, int tolerance = 0);
+#endif // 0
+
+ // operators
+ // ---------
+
+ bool operator==(const wxRegion& region) const { return IsEqual(region); }
+ bool operator!=(const wxRegion& region) const { return !(*this == region); }
+
+
+ // accessors
+ // ---------
+
+ // Is region empty?
+ virtual bool IsEmpty() const = 0;
+ bool Empty() const { return IsEmpty(); }
+
+ // Is region equal (i.e. covers the same area as another one)?
+ bool IsEqual(const wxRegion& region) const;
+
+ // Get the bounding box
+ bool GetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const
+ { return DoGetBox(x, y, w, h); }
+ wxRect GetBox() const
+ {
+ wxCoord x, y, w, h;
+ return DoGetBox(x, y, w, h) ? wxRect(x, y, w, h) : wxRect();
+ }
+
+ // Test if the given point or rectangle is inside this region
+ wxRegionContain Contains(wxCoord x, wxCoord y) const
+ { return DoContainsPoint(x, y); }
+ wxRegionContain Contains(const wxPoint& pt) const
+ { return DoContainsPoint(pt.x, pt.y); }
+ wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) const
+ { return DoContainsRect(wxRect(x, y, w, h)); }
+ wxRegionContain Contains(const wxRect& rect) const
+ { return DoContainsRect(rect); }
+
+
+ // operations
+ // ----------
+
+ virtual void Clear() = 0;
+
+ // Move the region
+ bool Offset(wxCoord x, wxCoord y)
+ { return DoOffset(x, y); }
+ bool Offset(const wxPoint& pt)
+ { return DoOffset(pt.x, pt.y); }
+
+ // Union rectangle or region with this region.
+ bool Union(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
+ { return DoUnionWithRect(wxRect(x, y, w, h)); }
+ bool Union(const wxRect& rect)
+ { return DoUnionWithRect(rect); }
+ bool Union(const wxRegion& region)
+ { return DoUnionWithRegion(region); }
+
+#if wxUSE_IMAGE
+ // Use the non-transparent pixels of a wxBitmap for the region to combine
+ // with this region. First version takes transparency from bitmap's mask,
+ // second lets the user specify the colour to be treated as transparent
+ // along with an optional tolerance value.
+ // NOTE: implemented in common/rgncmn.cpp
+ bool Union(const wxBitmap& bmp);
+ bool Union(const wxBitmap& bmp, const wxColour& transp, int tolerance = 0);
+#endif // wxUSE_IMAGE
+
+ // Intersect rectangle or region with this one.
+ bool Intersect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
+ bool Intersect(const wxRect& rect);
+ bool Intersect(const wxRegion& region)
+ { return DoIntersect(region); }
+
+ // Subtract rectangle or region from this:
+ // Combines the parts of 'this' that are not part of the second region.
+ bool Subtract(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
+ bool Subtract(const wxRect& rect);
+ bool Subtract(const wxRegion& region)
+ { return DoSubtract(region); }
+
+ // XOR: the union of two combined regions except for any overlapping areas.
+ bool Xor(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
+ bool Xor(const wxRect& rect);
+ bool Xor(const wxRegion& region)
+ { return DoXor(region); }
+
+
+ // Convert the region to a B&W bitmap with the white pixels being inside
+ // the region.
+ wxBitmap ConvertToBitmap() const;
+
+protected:
+ virtual bool DoIsEqual(const wxRegion& region) const = 0;
+ virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const = 0;
+ virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const = 0;
+ virtual wxRegionContain DoContainsRect(const wxRect& rect) const = 0;
+
+ virtual bool DoOffset(wxCoord x, wxCoord y) = 0;
+
+ virtual bool DoUnionWithRect(const wxRect& rect) = 0;
+ virtual bool DoUnionWithRegion(const wxRegion& region) = 0;
+
+ virtual bool DoIntersect(const wxRegion& region) = 0;
+ virtual bool DoSubtract(const wxRegion& region) = 0;
+ virtual bool DoXor(const wxRegion& region) = 0;
+};
+
+// some ports implement a generic Combine() function while others only
+// implement individual wxRegion operations, factor out the common code for the
+// ports with Combine() in this class
+#if defined(__WXMSW__) || \
+ ( defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON ) || \
+ defined(__WXPM__)
+
+#define wxHAS_REGION_COMBINE
+
+class WXDLLIMPEXP_CORE wxRegionWithCombine : public wxRegionBase
+{
+public:
+ // these methods are not part of public API as they're not implemented on
+ // all ports
+ bool Combine(wxCoord x, wxCoord y, wxCoord w, wxCoord h, wxRegionOp op);
+ bool Combine(const wxRect& rect, wxRegionOp op);
+ bool Combine(const wxRegion& region, wxRegionOp op)
+ { return DoCombine(region, op); }
+
+
+protected:
+ // the real Combine() method, to be defined in the derived class
+ virtual bool DoCombine(const wxRegion& region, wxRegionOp op) = 0;
+
+ // implement some wxRegionBase pure virtuals in terms of Combine()
+ virtual bool DoUnionWithRect(const wxRect& rect);
+ virtual bool DoUnionWithRegion(const wxRegion& region);
+ virtual bool DoIntersect(const wxRegion& region);
+ virtual bool DoSubtract(const wxRegion& region);
+ virtual bool DoXor(const wxRegion& region);
+};
+
+#endif // ports with wxRegion::Combine()
+
+#if defined(__WXMSW__)
+ #include "wx/msw/region.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/region.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/region.h"
+#elif defined(__WXMOTIF__) || defined(__WXX11__)
+ #include "wx/x11/region.h"
+#elif defined(__WXDFB__)
+ #include "wx/dfb/region.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/region.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/region.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/region.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// inline functions implementation
+// ----------------------------------------------------------------------------
+
+// NB: these functions couldn't be defined in the class declaration as they use
+// wxRegion and so can be only defined after including the header declaring
+// the real class
+
+inline bool wxRegionBase::Intersect(const wxRect& rect)
+{
+ return DoIntersect(wxRegion(rect));
+}
+
+inline bool wxRegionBase::Subtract(const wxRect& rect)
+{
+ return DoSubtract(wxRegion(rect));
+}
+
+inline bool wxRegionBase::Xor(const wxRect& rect)
+{
+ return DoXor(wxRegion(rect));
+}
+
+// ...and these functions are here because they call the ones above, and its
+// not really proper to call an inline function before its defined inline.
+
+inline bool wxRegionBase::Intersect(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
+{
+ return Intersect(wxRect(x, y, w, h));
+}
+
+inline bool wxRegionBase::Subtract(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
+{
+ return Subtract(wxRect(x, y, w, h));
+}
+
+inline bool wxRegionBase::Xor(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
+{
+ return Xor(wxRect(x, y, w, h));
+}
+
+#ifdef wxHAS_REGION_COMBINE
+
+inline bool wxRegionWithCombine::Combine(wxCoord x,
+ wxCoord y,
+ wxCoord w,
+ wxCoord h,
+ wxRegionOp op)
+{
+ return DoCombine(wxRegion(x, y, w, h), op);
+}
+
+inline bool wxRegionWithCombine::Combine(const wxRect& rect, wxRegionOp op)
+{
+ return DoCombine(wxRegion(rect), op);
+}
+
+#endif // wxHAS_REGION_COMBINE
+
+#endif // _WX_REGION_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/renderer.h
+// Purpose: wxRendererNative class declaration
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 20.07.2003
+// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+/*
+ Renderers are used in wxWidgets for two similar but different things:
+ (a) wxUniversal uses them to draw everything, i.e. all the control
+ (b) all the native ports use them to draw generic controls only
+
+ wxUniversal needs more functionality than what is included in the base class
+ as it needs to draw stuff like scrollbars which are never going to be
+ generic. So we put the bare minimum needed by the native ports here and the
+ full wxRenderer class is declared in wx/univ/renderer.h and is only used by
+ wxUniveral (although note that native ports can load wxRenderer objects from
+ theme DLLs and use them as wxRendererNative ones, of course).
+ */
+
+#ifndef _WX_RENDERER_H_
+#define _WX_RENDERER_H_
+
+class WXDLLIMPEXP_FWD_CORE wxDC;
+class WXDLLIMPEXP_FWD_CORE wxWindow;
+
+#include "wx/gdicmn.h" // for wxPoint, wxSize
+#include "wx/colour.h"
+#include "wx/font.h"
+#include "wx/bitmap.h"
+#include "wx/string.h"
+
+// some platforms have their own renderers, others use the generic one
+#if defined(__WXMSW__) || ( defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON ) || defined(__WXGTK__)
+ #define wxHAS_NATIVE_RENDERER
+#else
+ #undef wxHAS_NATIVE_RENDERER
+#endif
+
+// only MSW and OS X currently provides DrawTitleBarBitmap() method
+#if defined(__WXMSW__) || (defined(__WXMAC__) && wxUSE_LIBPNG && wxUSE_IMAGE)
+ #define wxHAS_DRAW_TITLE_BAR_BITMAP
+#endif
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// control state flags used in wxRenderer and wxColourScheme
+enum
+{
+ wxCONTROL_DISABLED = 0x00000001, // control is disabled
+ wxCONTROL_FOCUSED = 0x00000002, // currently has keyboard focus
+ wxCONTROL_PRESSED = 0x00000004, // (button) is pressed
+ wxCONTROL_SPECIAL = 0x00000008, // control-specific bit:
+ wxCONTROL_ISDEFAULT = wxCONTROL_SPECIAL, // only for the buttons
+ wxCONTROL_ISSUBMENU = wxCONTROL_SPECIAL, // only for the menu items
+ wxCONTROL_EXPANDED = wxCONTROL_SPECIAL, // only for the tree items
+ wxCONTROL_SIZEGRIP = wxCONTROL_SPECIAL, // only for the status bar panes
+ wxCONTROL_FLAT = wxCONTROL_SPECIAL, // checkboxes only: flat border
+ wxCONTROL_CURRENT = 0x00000010, // mouse is currently over the control
+ wxCONTROL_SELECTED = 0x00000020, // selected item in e.g. listbox
+ wxCONTROL_CHECKED = 0x00000040, // (check/radio button) is checked
+ wxCONTROL_CHECKABLE = 0x00000080, // (menu) item can be checked
+ wxCONTROL_UNDETERMINED = wxCONTROL_CHECKABLE, // (check) undetermined state
+
+ wxCONTROL_FLAGS_MASK = 0x000000ff,
+
+ // this is a pseudo flag not used directly by wxRenderer but rather by some
+ // controls internally
+ wxCONTROL_DIRTY = 0x80000000
+};
+
+// title bar buttons supported by DrawTitleBarBitmap()
+//
+// NB: they have the same values as wxTOPLEVEL_BUTTON_XXX constants in
+// wx/univ/toplevel.h as they really represent the same things
+enum wxTitleBarButton
+{
+ wxTITLEBAR_BUTTON_CLOSE = 0x01000000,
+ wxTITLEBAR_BUTTON_MAXIMIZE = 0x02000000,
+ wxTITLEBAR_BUTTON_ICONIZE = 0x04000000,
+ wxTITLEBAR_BUTTON_RESTORE = 0x08000000,
+ wxTITLEBAR_BUTTON_HELP = 0x10000000
+};
+
+// ----------------------------------------------------------------------------
+// helper structs
+// ----------------------------------------------------------------------------
+
+// wxSplitterWindow parameters
+struct WXDLLIMPEXP_CORE wxSplitterRenderParams
+{
+ // the only way to initialize this struct is by using this ctor
+ wxSplitterRenderParams(wxCoord widthSash_, wxCoord border_, bool isSens_)
+ : widthSash(widthSash_), border(border_), isHotSensitive(isSens_)
+ {
+ }
+
+ // the width of the splitter sash
+ const wxCoord widthSash;
+
+ // the width of the border of the splitter window
+ const wxCoord border;
+
+ // true if the splitter changes its appearance when the mouse is over it
+ const bool isHotSensitive;
+};
+
+
+// extra optional parameters for DrawHeaderButton
+struct WXDLLIMPEXP_CORE wxHeaderButtonParams
+{
+ wxHeaderButtonParams()
+ : m_labelAlignment(wxALIGN_LEFT)
+ { }
+
+ wxColour m_arrowColour;
+ wxColour m_selectionColour;
+ wxString m_labelText;
+ wxFont m_labelFont;
+ wxColour m_labelColour;
+ wxBitmap m_labelBitmap;
+ int m_labelAlignment;
+};
+
+enum wxHeaderSortIconType
+{
+ wxHDR_SORT_ICON_NONE, // Header button has no sort arrow
+ wxHDR_SORT_ICON_UP, // Header button an up sort arrow icon
+ wxHDR_SORT_ICON_DOWN // Header button a down sort arrow icon
+};
+
+
+// wxRendererNative interface version
+struct WXDLLIMPEXP_CORE wxRendererVersion
+{
+ wxRendererVersion(int version_, int age_) : version(version_), age(age_) { }
+
+ // default copy ctor, assignment operator and dtor are ok
+
+ // the current version and age of wxRendererNative interface: different
+ // versions are incompatible (in both ways) while the ages inside the same
+ // version are upwards compatible, i.e. the version of the renderer must
+ // match the version of the main program exactly while the age may be
+ // highergreater or equal to it
+ //
+ // NB: don't forget to increment age after adding any new virtual function!
+ enum
+ {
+ Current_Version = 1,
+ Current_Age = 5
+ };
+
+
+ // check if the given version is compatible with the current one
+ static bool IsCompatible(const wxRendererVersion& ver)
+ {
+ return ver.version == Current_Version && ver.age >= Current_Age;
+ }
+
+ const int version;
+ const int age;
+};
+
+// ----------------------------------------------------------------------------
+// wxRendererNative: abstracts drawing methods needed by the native controls
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxRendererNative
+{
+public:
+ // drawing functions
+ // -----------------
+
+ // draw the header control button (used by wxListCtrl) Returns optimal
+ // width for the label contents.
+ virtual int DrawHeaderButton(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0,
+ wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
+ wxHeaderButtonParams* params=NULL) = 0;
+
+
+ // Draw the contents of a header control button (label, sort arrows, etc.)
+ // Normally only called by DrawHeaderButton.
+ virtual int DrawHeaderButtonContents(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0,
+ wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
+ wxHeaderButtonParams* params=NULL) = 0;
+
+ // Returns the default height of a header button, either a fixed platform
+ // height if available, or a generic height based on the window's font.
+ virtual int GetHeaderButtonHeight(wxWindow *win) = 0;
+
+ // Returns the margin on left and right sides of header button's label
+ virtual int GetHeaderButtonMargin(wxWindow *win) = 0;
+
+
+ // draw the expanded/collapsed icon for a tree control item
+ virtual void DrawTreeItemButton(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0) = 0;
+
+ // draw the border for sash window: this border must be such that the sash
+ // drawn by DrawSash() blends into it well
+ virtual void DrawSplitterBorder(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0) = 0;
+
+ // draw a (vertical) sash
+ virtual void DrawSplitterSash(wxWindow *win,
+ wxDC& dc,
+ const wxSize& size,
+ wxCoord position,
+ wxOrientation orient,
+ int flags = 0) = 0;
+
+ // draw a combobox dropdown button
+ //
+ // flags may use wxCONTROL_PRESSED and wxCONTROL_CURRENT
+ virtual void DrawComboBoxDropButton(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0) = 0;
+
+ // draw a dropdown arrow
+ //
+ // flags may use wxCONTROL_PRESSED and wxCONTROL_CURRENT
+ virtual void DrawDropArrow(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0) = 0;
+
+ // draw check button
+ //
+ // flags may use wxCONTROL_CHECKED, wxCONTROL_UNDETERMINED and wxCONTROL_CURRENT
+ virtual void DrawCheckBox(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0) = 0;
+
+ // Returns the default size of a check box.
+ virtual wxSize GetCheckBoxSize(wxWindow *win) = 0;
+
+ // draw blank button
+ //
+ // flags may use wxCONTROL_PRESSED, wxCONTROL_CURRENT and wxCONTROL_ISDEFAULT
+ virtual void DrawPushButton(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0) = 0;
+
+ // draw rectangle indicating that an item in e.g. a list control
+ // has been selected or focused
+ //
+ // flags may use
+ // wxCONTROL_SELECTED (item is selected, e.g. draw background)
+ // wxCONTROL_CURRENT (item is the current item, e.g. dotted border)
+ // wxCONTROL_FOCUSED (the whole control has focus, e.g. blue background vs. grey otherwise)
+ virtual void DrawItemSelectionRect(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0) = 0;
+
+ // draw the focus rectangle around the label contained in the given rect
+ //
+ // only wxCONTROL_SELECTED makes sense in flags here
+ virtual void DrawFocusRect(wxWindow* win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0) = 0;
+
+ // Draw a native wxChoice
+ virtual void DrawChoice(wxWindow* win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0) = 0;
+
+ // Draw a native wxComboBox
+ virtual void DrawComboBox(wxWindow* win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0) = 0;
+
+ // Draw a native wxTextCtrl frame
+ virtual void DrawTextCtrl(wxWindow* win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0) = 0;
+
+ // Draw a native wxRadioButton bitmap
+ virtual void DrawRadioBitmap(wxWindow* win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0) = 0;
+
+#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP
+ // Draw one of the standard title bar buttons
+ //
+ // This is currently implemented only for MSW and OS X (for the close
+ // button only) because there is no way to render standard title bar
+ // buttons under the other platforms, the best can be done is to use normal
+ // (only) images which wxArtProvider provides for wxART_HELP and
+ // wxART_CLOSE (but not any other title bar buttons)
+ //
+ // NB: make sure PNG handler is enabled if using this function under OS X
+ virtual void DrawTitleBarBitmap(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ wxTitleBarButton button,
+ int flags = 0) = 0;
+#endif // wxHAS_DRAW_TITLE_BAR_BITMAP
+
+
+ // geometry functions
+ // ------------------
+
+ // get the splitter parameters: the x field of the returned point is the
+ // sash width and the y field is the border width
+ virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) = 0;
+
+
+ // pseudo constructors
+ // -------------------
+
+ // return the currently used renderer
+ static wxRendererNative& Get();
+
+ // return the generic implementation of the renderer
+ static wxRendererNative& GetGeneric();
+
+ // return the default (native) implementation for this platform
+ static wxRendererNative& GetDefault();
+
+
+ // changing the global renderer
+ // ----------------------------
+
+#if wxUSE_DYNLIB_CLASS
+ // load the renderer from the specified DLL, the returned pointer must be
+ // deleted by caller if not NULL when it is not used any more
+ static wxRendererNative *Load(const wxString& name);
+#endif // wxUSE_DYNLIB_CLASS
+
+ // set the renderer to use, passing NULL reverts to using the default
+ // renderer
+ //
+ // return the previous renderer used with Set() or NULL if none
+ static wxRendererNative *Set(wxRendererNative *renderer);
+
+
+ // miscellaneous stuff
+ // -------------------
+
+ // this function is used for version checking: Load() refuses to load any
+ // DLLs implementing an older or incompatible version; it should be
+ // implemented simply by returning wxRendererVersion::Current_XXX values
+ virtual wxRendererVersion GetVersion() const = 0;
+
+ // virtual dtor for any base class
+ virtual ~wxRendererNative();
+};
+
+// ----------------------------------------------------------------------------
+// wxDelegateRendererNative: allows reuse of renderers code
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxDelegateRendererNative : public wxRendererNative
+{
+public:
+ wxDelegateRendererNative()
+ : m_rendererNative(GetGeneric()) { }
+
+ wxDelegateRendererNative(wxRendererNative& rendererNative)
+ : m_rendererNative(rendererNative) { }
+
+
+ virtual int DrawHeaderButton(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0,
+ wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
+ wxHeaderButtonParams* params = NULL)
+ { return m_rendererNative.DrawHeaderButton(win, dc, rect, flags, sortArrow, params); }
+
+ virtual int DrawHeaderButtonContents(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0,
+ wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
+ wxHeaderButtonParams* params = NULL)
+ { return m_rendererNative.DrawHeaderButtonContents(win, dc, rect, flags, sortArrow, params); }
+
+ virtual int GetHeaderButtonHeight(wxWindow *win)
+ { return m_rendererNative.GetHeaderButtonHeight(win); }
+
+ virtual int GetHeaderButtonMargin(wxWindow *win)
+ { return m_rendererNative.GetHeaderButtonMargin(win); }
+
+ virtual void DrawTreeItemButton(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0)
+ { m_rendererNative.DrawTreeItemButton(win, dc, rect, flags); }
+
+ virtual void DrawSplitterBorder(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0)
+ { m_rendererNative.DrawSplitterBorder(win, dc, rect, flags); }
+
+ virtual void DrawSplitterSash(wxWindow *win,
+ wxDC& dc,
+ const wxSize& size,
+ wxCoord position,
+ wxOrientation orient,
+ int flags = 0)
+ { m_rendererNative.DrawSplitterSash(win, dc, size,
+ position, orient, flags); }
+
+ virtual void DrawComboBoxDropButton(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0)
+ { m_rendererNative.DrawComboBoxDropButton(win, dc, rect, flags); }
+
+ virtual void DrawDropArrow(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0)
+ { m_rendererNative.DrawDropArrow(win, dc, rect, flags); }
+
+ virtual void DrawCheckBox(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0)
+ { m_rendererNative.DrawCheckBox( win, dc, rect, flags ); }
+
+ virtual wxSize GetCheckBoxSize(wxWindow *win)
+ { return m_rendererNative.GetCheckBoxSize(win); }
+
+ virtual void DrawPushButton(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0)
+ { m_rendererNative.DrawPushButton( win, dc, rect, flags ); }
+
+ virtual void DrawItemSelectionRect(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0)
+ { m_rendererNative.DrawItemSelectionRect( win, dc, rect, flags ); }
+
+ virtual void DrawFocusRect(wxWindow* win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0)
+ { m_rendererNative.DrawFocusRect( win, dc, rect, flags ); }
+
+ virtual void DrawChoice(wxWindow* win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0)
+ { m_rendererNative.DrawChoice( win, dc, rect, flags); }
+
+ virtual void DrawComboBox(wxWindow* win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0)
+ { m_rendererNative.DrawComboBox( win, dc, rect, flags); }
+
+ virtual void DrawTextCtrl(wxWindow* win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0)
+ { m_rendererNative.DrawTextCtrl( win, dc, rect, flags); }
+
+ virtual void DrawRadioBitmap(wxWindow* win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0)
+ { m_rendererNative.DrawRadioBitmap(win, dc, rect, flags); }
+
+#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP
+ virtual void DrawTitleBarBitmap(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ wxTitleBarButton button,
+ int flags = 0)
+ { m_rendererNative.DrawTitleBarBitmap(win, dc, rect, button, flags); }
+#endif // wxHAS_DRAW_TITLE_BAR_BITMAP
+
+ virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win)
+ { return m_rendererNative.GetSplitterParams(win); }
+
+ virtual wxRendererVersion GetVersion() const
+ { return m_rendererNative.GetVersion(); }
+
+protected:
+ wxRendererNative& m_rendererNative;
+
+ wxDECLARE_NO_COPY_CLASS(wxDelegateRendererNative);
+};
+
+// ----------------------------------------------------------------------------
+// inline functions implementation
+// ----------------------------------------------------------------------------
+
+#ifndef wxHAS_NATIVE_RENDERER
+
+// default native renderer is the generic one then
+/* static */ inline
+wxRendererNative& wxRendererNative::GetDefault()
+{
+ return GetGeneric();
+}
+
+#endif // !wxHAS_NATIVE_RENDERER
+
+#endif // _WX_RENDERER_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/ribbon/art.h
+// Purpose: Art providers for ribbon-bar-style interface
+// Author: Peter Cawley
+// Modified by:
+// Created: 2009-05-25
+// Copyright: (C) Peter Cawley
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RIBBON_ART_H_
+#define _WX_RIBBON_ART_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_RIBBON
+
+#include "wx/brush.h"
+#include "wx/colour.h"
+#include "wx/font.h"
+#include "wx/pen.h"
+#include "wx/bitmap.h"
+#include "wx/ribbon/bar.h"
+
+class WXDLLIMPEXP_FWD_CORE wxDC;
+class WXDLLIMPEXP_FWD_CORE wxWindow;
+
+enum wxRibbonArtSetting
+{
+ wxRIBBON_ART_TAB_SEPARATION_SIZE,
+ wxRIBBON_ART_PAGE_BORDER_LEFT_SIZE,
+ wxRIBBON_ART_PAGE_BORDER_TOP_SIZE,
+ wxRIBBON_ART_PAGE_BORDER_RIGHT_SIZE,
+ wxRIBBON_ART_PAGE_BORDER_BOTTOM_SIZE,
+ wxRIBBON_ART_PANEL_X_SEPARATION_SIZE,
+ wxRIBBON_ART_PANEL_Y_SEPARATION_SIZE,
+ wxRIBBON_ART_TOOL_GROUP_SEPARATION_SIZE,
+ wxRIBBON_ART_GALLERY_BITMAP_PADDING_LEFT_SIZE,
+ wxRIBBON_ART_GALLERY_BITMAP_PADDING_RIGHT_SIZE,
+ wxRIBBON_ART_GALLERY_BITMAP_PADDING_TOP_SIZE,
+ wxRIBBON_ART_GALLERY_BITMAP_PADDING_BOTTOM_SIZE,
+ wxRIBBON_ART_PANEL_LABEL_FONT,
+ wxRIBBON_ART_BUTTON_BAR_LABEL_FONT,
+ wxRIBBON_ART_TAB_LABEL_FONT,
+ wxRIBBON_ART_BUTTON_BAR_LABEL_COLOUR,
+ wxRIBBON_ART_BUTTON_BAR_HOVER_BORDER_COLOUR,
+ wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_COLOUR,
+ wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR,
+ wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_COLOUR,
+ wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_GRADIENT_COLOUR,
+ wxRIBBON_ART_BUTTON_BAR_ACTIVE_BORDER_COLOUR,
+ wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_TOP_COLOUR,
+ wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR,
+ wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_COLOUR,
+ wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_GRADIENT_COLOUR,
+ wxRIBBON_ART_GALLERY_BORDER_COLOUR,
+ wxRIBBON_ART_GALLERY_HOVER_BACKGROUND_COLOUR,
+ wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_COLOUR,
+ wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_GRADIENT_COLOUR,
+ wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_TOP_COLOUR,
+ wxRIBBON_ART_GALLERY_BUTTON_FACE_COLOUR,
+ wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_COLOUR,
+ wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_GRADIENT_COLOUR,
+ wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_TOP_COLOUR,
+ wxRIBBON_ART_GALLERY_BUTTON_HOVER_FACE_COLOUR,
+ wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_COLOUR,
+ wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_GRADIENT_COLOUR,
+ wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_TOP_COLOUR,
+ wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_FACE_COLOUR,
+ wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_COLOUR,
+ wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_GRADIENT_COLOUR,
+ wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_TOP_COLOUR,
+ wxRIBBON_ART_GALLERY_BUTTON_DISABLED_FACE_COLOUR,
+ wxRIBBON_ART_GALLERY_ITEM_BORDER_COLOUR,
+ wxRIBBON_ART_TAB_LABEL_COLOUR,
+ wxRIBBON_ART_TAB_SEPARATOR_COLOUR,
+ wxRIBBON_ART_TAB_SEPARATOR_GRADIENT_COLOUR,
+ wxRIBBON_ART_TAB_CTRL_BACKGROUND_COLOUR,
+ wxRIBBON_ART_TAB_CTRL_BACKGROUND_GRADIENT_COLOUR,
+ wxRIBBON_ART_TAB_HOVER_BACKGROUND_TOP_COLOUR,
+ wxRIBBON_ART_TAB_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR,
+ wxRIBBON_ART_TAB_HOVER_BACKGROUND_COLOUR,
+ wxRIBBON_ART_TAB_HOVER_BACKGROUND_GRADIENT_COLOUR,
+ wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_COLOUR,
+ wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR,
+ wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_COLOUR,
+ wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_GRADIENT_COLOUR,
+ wxRIBBON_ART_TAB_BORDER_COLOUR,
+ wxRIBBON_ART_PANEL_BORDER_COLOUR,
+ wxRIBBON_ART_PANEL_BORDER_GRADIENT_COLOUR,
+ wxRIBBON_ART_PANEL_MINIMISED_BORDER_COLOUR,
+ wxRIBBON_ART_PANEL_MINIMISED_BORDER_GRADIENT_COLOUR,
+ wxRIBBON_ART_PANEL_LABEL_BACKGROUND_COLOUR,
+ wxRIBBON_ART_PANEL_LABEL_BACKGROUND_GRADIENT_COLOUR,
+ wxRIBBON_ART_PANEL_LABEL_COLOUR,
+ wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_COLOUR,
+ wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_GRADIENT_COLOUR,
+ wxRIBBON_ART_PANEL_HOVER_LABEL_COLOUR,
+ wxRIBBON_ART_PANEL_MINIMISED_LABEL_COLOUR,
+ wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_TOP_COLOUR,
+ wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR,
+ wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_COLOUR,
+ wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_GRADIENT_COLOUR,
+ wxRIBBON_ART_PANEL_BUTTON_FACE_COLOUR,
+ wxRIBBON_ART_PANEL_BUTTON_HOVER_FACE_COLOUR,
+
+ wxRIBBON_ART_PAGE_TOGGLE_FACE_COLOUR,
+ wxRIBBON_ART_PAGE_TOGGLE_HOVER_FACE_COLOUR,
+
+ wxRIBBON_ART_PAGE_BORDER_COLOUR,
+ wxRIBBON_ART_PAGE_BACKGROUND_TOP_COLOUR,
+ wxRIBBON_ART_PAGE_BACKGROUND_TOP_GRADIENT_COLOUR,
+ wxRIBBON_ART_PAGE_BACKGROUND_COLOUR,
+ wxRIBBON_ART_PAGE_BACKGROUND_GRADIENT_COLOUR,
+ wxRIBBON_ART_PAGE_HOVER_BACKGROUND_TOP_COLOUR,
+ wxRIBBON_ART_PAGE_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR,
+ wxRIBBON_ART_PAGE_HOVER_BACKGROUND_COLOUR,
+ wxRIBBON_ART_PAGE_HOVER_BACKGROUND_GRADIENT_COLOUR,
+ wxRIBBON_ART_TOOLBAR_BORDER_COLOUR,
+ wxRIBBON_ART_TOOLBAR_HOVER_BORDER_COLOUR,
+ wxRIBBON_ART_TOOLBAR_FACE_COLOUR,
+ wxRIBBON_ART_TOOL_BACKGROUND_TOP_COLOUR,
+ wxRIBBON_ART_TOOL_BACKGROUND_TOP_GRADIENT_COLOUR,
+ wxRIBBON_ART_TOOL_BACKGROUND_COLOUR,
+ wxRIBBON_ART_TOOL_BACKGROUND_GRADIENT_COLOUR,
+ wxRIBBON_ART_TOOL_HOVER_BACKGROUND_TOP_COLOUR,
+ wxRIBBON_ART_TOOL_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR,
+ wxRIBBON_ART_TOOL_HOVER_BACKGROUND_COLOUR,
+ wxRIBBON_ART_TOOL_HOVER_BACKGROUND_GRADIENT_COLOUR,
+ wxRIBBON_ART_TOOL_ACTIVE_BACKGROUND_TOP_COLOUR,
+ wxRIBBON_ART_TOOL_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR,
+ wxRIBBON_ART_TOOL_ACTIVE_BACKGROUND_COLOUR,
+ wxRIBBON_ART_TOOL_ACTIVE_BACKGROUND_GRADIENT_COLOUR,
+ wxRIBBON_ART_BUTTON_BAR_LABEL_DISABLED_COLOUR
+};
+
+enum wxRibbonScrollButtonStyle
+{
+ wxRIBBON_SCROLL_BTN_LEFT = 0,
+ wxRIBBON_SCROLL_BTN_RIGHT = 1,
+ wxRIBBON_SCROLL_BTN_UP = 2,
+ wxRIBBON_SCROLL_BTN_DOWN = 3,
+
+ wxRIBBON_SCROLL_BTN_DIRECTION_MASK = 3,
+
+ wxRIBBON_SCROLL_BTN_NORMAL = 0,
+ wxRIBBON_SCROLL_BTN_HOVERED = 4,
+ wxRIBBON_SCROLL_BTN_ACTIVE = 8,
+
+ wxRIBBON_SCROLL_BTN_STATE_MASK = 12,
+
+ wxRIBBON_SCROLL_BTN_FOR_OTHER = 0,
+ wxRIBBON_SCROLL_BTN_FOR_TABS = 16,
+ wxRIBBON_SCROLL_BTN_FOR_PAGE = 32,
+
+ wxRIBBON_SCROLL_BTN_FOR_MASK = 48
+};
+
+enum wxRibbonButtonKind
+{
+ wxRIBBON_BUTTON_NORMAL = 1 << 0,
+ wxRIBBON_BUTTON_DROPDOWN = 1 << 1,
+ wxRIBBON_BUTTON_HYBRID = wxRIBBON_BUTTON_NORMAL | wxRIBBON_BUTTON_DROPDOWN,
+ wxRIBBON_BUTTON_TOGGLE = 1 << 2
+};
+
+enum wxRibbonButtonBarButtonState
+{
+ wxRIBBON_BUTTONBAR_BUTTON_SMALL = 0 << 0,
+ wxRIBBON_BUTTONBAR_BUTTON_MEDIUM = 1 << 0,
+ wxRIBBON_BUTTONBAR_BUTTON_LARGE = 2 << 0,
+ wxRIBBON_BUTTONBAR_BUTTON_SIZE_MASK = 3 << 0,
+
+ wxRIBBON_BUTTONBAR_BUTTON_NORMAL_HOVERED = 1 << 3,
+ wxRIBBON_BUTTONBAR_BUTTON_DROPDOWN_HOVERED = 1 << 4,
+ wxRIBBON_BUTTONBAR_BUTTON_HOVER_MASK = wxRIBBON_BUTTONBAR_BUTTON_NORMAL_HOVERED | wxRIBBON_BUTTONBAR_BUTTON_DROPDOWN_HOVERED,
+ wxRIBBON_BUTTONBAR_BUTTON_NORMAL_ACTIVE = 1 << 5,
+ wxRIBBON_BUTTONBAR_BUTTON_DROPDOWN_ACTIVE = 1 << 6,
+ wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK = wxRIBBON_BUTTONBAR_BUTTON_NORMAL_ACTIVE | wxRIBBON_BUTTONBAR_BUTTON_DROPDOWN_ACTIVE,
+ wxRIBBON_BUTTONBAR_BUTTON_DISABLED = 1 << 7,
+ wxRIBBON_BUTTONBAR_BUTTON_TOGGLED = 1 << 8,
+ wxRIBBON_BUTTONBAR_BUTTON_STATE_MASK = 0x1F8
+};
+
+enum wxRibbonGalleryButtonState
+{
+ wxRIBBON_GALLERY_BUTTON_NORMAL,
+ wxRIBBON_GALLERY_BUTTON_HOVERED,
+ wxRIBBON_GALLERY_BUTTON_ACTIVE,
+ wxRIBBON_GALLERY_BUTTON_DISABLED
+};
+
+class wxRibbonBar;
+class wxRibbonPage;
+class wxRibbonPanel;
+class wxRibbonGallery;
+class wxRibbonGalleryItem;
+class wxRibbonPageTabInfo;
+class wxRibbonPageTabInfoArray;
+
+class WXDLLIMPEXP_RIBBON wxRibbonArtProvider
+{
+public:
+ wxRibbonArtProvider();
+ virtual ~wxRibbonArtProvider();
+
+ virtual wxRibbonArtProvider* Clone() const = 0;
+ virtual void SetFlags(long flags) = 0;
+ virtual long GetFlags() const = 0;
+
+ virtual int GetMetric(int id) const = 0;
+ virtual void SetMetric(int id, int new_val) = 0;
+ virtual void SetFont(int id, const wxFont& font) = 0;
+ virtual wxFont GetFont(int id) const = 0;
+ virtual wxColour GetColour(int id) const = 0;
+ virtual void SetColour(int id, const wxColor& colour) = 0;
+ wxColour GetColor(int id) const { return GetColour(id); }
+ void SetColor(int id, const wxColour& color) { SetColour(id, color); }
+ virtual void GetColourScheme(wxColour* primary,
+ wxColour* secondary,
+ wxColour* tertiary) const = 0;
+ virtual void SetColourScheme(const wxColour& primary,
+ const wxColour& secondary,
+ const wxColour& tertiary) = 0;
+
+ virtual void DrawTabCtrlBackground(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect) = 0;
+
+ virtual void DrawTab(wxDC& dc,
+ wxWindow* wnd,
+ const wxRibbonPageTabInfo& tab) = 0;
+
+ virtual void DrawTabSeparator(wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect,
+ double visibility) = 0;
+
+ virtual void DrawPageBackground(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect) = 0;
+
+ virtual void DrawScrollButton(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect,
+ long style) = 0;
+
+ virtual void DrawPanelBackground(
+ wxDC& dc,
+ wxRibbonPanel* wnd,
+ const wxRect& rect) = 0;
+
+ virtual void DrawGalleryBackground(
+ wxDC& dc,
+ wxRibbonGallery* wnd,
+ const wxRect& rect) = 0;
+
+ virtual void DrawGalleryItemBackground(
+ wxDC& dc,
+ wxRibbonGallery* wnd,
+ const wxRect& rect,
+ wxRibbonGalleryItem* item) = 0;
+
+ virtual void DrawMinimisedPanel(
+ wxDC& dc,
+ wxRibbonPanel* wnd,
+ const wxRect& rect,
+ wxBitmap& bitmap) = 0;
+
+ virtual void DrawButtonBarBackground(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect) = 0;
+
+ virtual void DrawButtonBarButton(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect,
+ wxRibbonButtonKind kind,
+ long state,
+ const wxString& label,
+ const wxBitmap& bitmap_large,
+ const wxBitmap& bitmap_small) = 0;
+
+ virtual void DrawToolBarBackground(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect) = 0;
+
+ virtual void DrawToolGroupBackground(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect) = 0;
+
+ virtual void DrawTool(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect,
+ const wxBitmap& bitmap,
+ wxRibbonButtonKind kind,
+ long state) = 0;
+
+ virtual void DrawToggleButton(
+ wxDC& dc,
+ wxRibbonBar* wnd,
+ const wxRect& rect,
+ wxRibbonDisplayMode mode) = 0;
+
+ virtual void DrawHelpButton(
+ wxDC& dc,
+ wxRibbonBar* wnd,
+ const wxRect& rect) = 0;
+
+ virtual void GetBarTabWidth(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ int* ideal,
+ int* small_begin_need_separator,
+ int* small_must_have_separator,
+ int* minimum) = 0;
+
+ virtual int GetTabCtrlHeight(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRibbonPageTabInfoArray& pages) = 0;
+
+ virtual wxSize GetScrollButtonMinimumSize(
+ wxDC& dc,
+ wxWindow* wnd,
+ long style) = 0;
+
+ virtual wxSize GetPanelSize(
+ wxDC& dc,
+ const wxRibbonPanel* wnd,
+ wxSize client_size,
+ wxPoint* client_offset) = 0;
+
+ virtual wxSize GetPanelClientSize(
+ wxDC& dc,
+ const wxRibbonPanel* wnd,
+ wxSize size,
+ wxPoint* client_offset) = 0;
+
+ virtual wxRect GetPanelExtButtonArea(
+ wxDC& dc,
+ const wxRibbonPanel* wnd,
+ wxRect rect) = 0;
+
+ virtual wxSize GetGallerySize(
+ wxDC& dc,
+ const wxRibbonGallery* wnd,
+ wxSize client_size) = 0;
+
+ virtual wxSize GetGalleryClientSize(
+ wxDC& dc,
+ const wxRibbonGallery* wnd,
+ wxSize size,
+ wxPoint* client_offset,
+ wxRect* scroll_up_button,
+ wxRect* scroll_down_button,
+ wxRect* extension_button) = 0;
+
+ virtual wxRect GetPageBackgroundRedrawArea(
+ wxDC& dc,
+ const wxRibbonPage* wnd,
+ wxSize page_old_size,
+ wxSize page_new_size) = 0;
+
+ virtual bool GetButtonBarButtonSize(
+ wxDC& dc,
+ wxWindow* wnd,
+ wxRibbonButtonKind kind,
+ wxRibbonButtonBarButtonState size,
+ const wxString& label,
+ wxSize bitmap_size_large,
+ wxSize bitmap_size_small,
+ wxSize* button_size,
+ wxRect* normal_region,
+ wxRect* dropdown_region) = 0;
+
+ virtual wxSize GetMinimisedPanelMinimumSize(
+ wxDC& dc,
+ const wxRibbonPanel* wnd,
+ wxSize* desired_bitmap_size,
+ wxDirection* expanded_panel_direction) = 0;
+
+ virtual wxSize GetToolSize(
+ wxDC& dc,
+ wxWindow* wnd,
+ wxSize bitmap_size,
+ wxRibbonButtonKind kind,
+ bool is_first,
+ bool is_last,
+ wxRect* dropdown_region) = 0;
+
+ virtual wxRect GetBarToggleButtonArea(const wxRect& rect)= 0;
+
+ virtual wxRect GetRibbonHelpButtonArea(const wxRect& rect) = 0;
+};
+
+class WXDLLIMPEXP_RIBBON wxRibbonMSWArtProvider : public wxRibbonArtProvider
+{
+public:
+ wxRibbonMSWArtProvider(bool set_colour_scheme = true);
+ virtual ~wxRibbonMSWArtProvider();
+
+ wxRibbonArtProvider* Clone() const;
+ void SetFlags(long flags);
+ long GetFlags() const;
+
+ int GetMetric(int id) const;
+ void SetMetric(int id, int new_val);
+ void SetFont(int id, const wxFont& font);
+ wxFont GetFont(int id) const;
+ wxColour GetColour(int id) const;
+ void SetColour(int id, const wxColor& colour);
+ void GetColourScheme(wxColour* primary,
+ wxColour* secondary,
+ wxColour* tertiary) const;
+ void SetColourScheme(const wxColour& primary,
+ const wxColour& secondary,
+ const wxColour& tertiary);
+
+ int GetTabCtrlHeight(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRibbonPageTabInfoArray& pages);
+
+ void DrawTabCtrlBackground(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect);
+
+ void DrawTab(wxDC& dc,
+ wxWindow* wnd,
+ const wxRibbonPageTabInfo& tab);
+
+ void DrawTabSeparator(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect,
+ double visibility);
+
+ void DrawPageBackground(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect);
+
+ void DrawScrollButton(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect,
+ long style);
+
+ void DrawPanelBackground(
+ wxDC& dc,
+ wxRibbonPanel* wnd,
+ const wxRect& rect);
+
+ void DrawGalleryBackground(
+ wxDC& dc,
+ wxRibbonGallery* wnd,
+ const wxRect& rect);
+
+ void DrawGalleryItemBackground(
+ wxDC& dc,
+ wxRibbonGallery* wnd,
+ const wxRect& rect,
+ wxRibbonGalleryItem* item);
+
+ void DrawMinimisedPanel(
+ wxDC& dc,
+ wxRibbonPanel* wnd,
+ const wxRect& rect,
+ wxBitmap& bitmap);
+
+ void DrawButtonBarBackground(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect);
+
+ void DrawButtonBarButton(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect,
+ wxRibbonButtonKind kind,
+ long state,
+ const wxString& label,
+ const wxBitmap& bitmap_large,
+ const wxBitmap& bitmap_small);
+
+ void DrawToolBarBackground(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect);
+
+ void DrawToolGroupBackground(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect);
+
+ void DrawTool(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect,
+ const wxBitmap& bitmap,
+ wxRibbonButtonKind kind,
+ long state);
+
+ void DrawToggleButton(
+ wxDC& dc,
+ wxRibbonBar* wnd,
+ const wxRect& rect,
+ wxRibbonDisplayMode mode);
+
+ void DrawHelpButton(wxDC& dc,
+ wxRibbonBar* wnd,
+ const wxRect& rect);
+
+ void GetBarTabWidth(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ int* ideal,
+ int* small_begin_need_separator,
+ int* small_must_have_separator,
+ int* minimum);
+
+ wxSize GetScrollButtonMinimumSize(
+ wxDC& dc,
+ wxWindow* wnd,
+ long style);
+
+ wxSize GetPanelSize(
+ wxDC& dc,
+ const wxRibbonPanel* wnd,
+ wxSize client_size,
+ wxPoint* client_offset);
+
+ wxSize GetPanelClientSize(
+ wxDC& dc,
+ const wxRibbonPanel* wnd,
+ wxSize size,
+ wxPoint* client_offset);
+
+ wxRect GetPanelExtButtonArea(
+ wxDC& dc,
+ const wxRibbonPanel* wnd,
+ wxRect rect);
+
+ wxSize GetGallerySize(
+ wxDC& dc,
+ const wxRibbonGallery* wnd,
+ wxSize client_size);
+
+ wxSize GetGalleryClientSize(
+ wxDC& dc,
+ const wxRibbonGallery* wnd,
+ wxSize size,
+ wxPoint* client_offset,
+ wxRect* scroll_up_button,
+ wxRect* scroll_down_button,
+ wxRect* extension_button);
+
+ wxRect GetPageBackgroundRedrawArea(
+ wxDC& dc,
+ const wxRibbonPage* wnd,
+ wxSize page_old_size,
+ wxSize page_new_size);
+
+ bool GetButtonBarButtonSize(
+ wxDC& dc,
+ wxWindow* wnd,
+ wxRibbonButtonKind kind,
+ wxRibbonButtonBarButtonState size,
+ const wxString& label,
+ wxSize bitmap_size_large,
+ wxSize bitmap_size_small,
+ wxSize* button_size,
+ wxRect* normal_region,
+ wxRect* dropdown_region);
+
+ wxSize GetMinimisedPanelMinimumSize(
+ wxDC& dc,
+ const wxRibbonPanel* wnd,
+ wxSize* desired_bitmap_size,
+ wxDirection* expanded_panel_direction);
+
+ wxSize GetToolSize(
+ wxDC& dc,
+ wxWindow* wnd,
+ wxSize bitmap_size,
+ wxRibbonButtonKind kind,
+ bool is_first,
+ bool is_last,
+ wxRect* dropdown_region);
+
+ wxRect GetBarToggleButtonArea(const wxRect& rect);
+
+ wxRect GetRibbonHelpButtonArea(const wxRect& rect);
+
+protected:
+ void ReallyDrawTabSeparator(wxWindow* wnd, const wxRect& rect, double visibility);
+ void DrawPartialPageBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect,
+ bool allow_hovered = true);
+ void DrawPartialPageBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect,
+ wxRibbonPage* page, wxPoint offset, bool hovered = false);
+ void DrawPanelBorder(wxDC& dc, const wxRect& rect, wxPen& primary_colour,
+ wxPen& secondary_colour);
+ void RemovePanelPadding(wxRect* rect);
+ void DrawDropdownArrow(wxDC& dc, int x, int y, const wxColour& colour);
+ void DrawGalleryBackgroundCommon(wxDC& dc, wxRibbonGallery* wnd,
+ const wxRect& rect);
+ virtual void DrawGalleryButton(wxDC& dc, wxRect rect,
+ wxRibbonGalleryButtonState state, wxBitmap* bitmaps);
+ void DrawButtonBarButtonForeground(
+ wxDC& dc,
+ const wxRect& rect,
+ wxRibbonButtonKind kind,
+ long state,
+ const wxString& label,
+ const wxBitmap& bitmap_large,
+ const wxBitmap& bitmap_small);
+ void DrawMinimisedPanelCommon(
+ wxDC& dc,
+ wxRibbonPanel* wnd,
+ const wxRect& rect,
+ wxRect* preview_rect);
+ void CloneTo(wxRibbonMSWArtProvider* copy) const;
+
+ wxBitmap m_cached_tab_separator;
+ wxBitmap m_gallery_up_bitmap[4];
+ wxBitmap m_gallery_down_bitmap[4];
+ wxBitmap m_gallery_extension_bitmap[4];
+ wxBitmap m_toolbar_drop_bitmap;
+ wxBitmap m_panel_extension_bitmap[2];
+ wxBitmap m_ribbon_toggle_up_bitmap[2];
+ wxBitmap m_ribbon_toggle_down_bitmap[2];
+ wxBitmap m_ribbon_toggle_pin_bitmap[2];
+ wxBitmap m_ribbon_bar_help_button_bitmap[2];
+
+ wxColour m_primary_scheme_colour;
+ wxColour m_secondary_scheme_colour;
+ wxColour m_tertiary_scheme_colour;
+
+ wxColour m_button_bar_label_colour;
+ wxColour m_button_bar_label_disabled_colour;
+ wxColour m_tab_label_colour;
+ wxColour m_tab_separator_colour;
+ wxColour m_tab_separator_gradient_colour;
+ wxColour m_tab_active_background_colour;
+ wxColour m_tab_active_background_gradient_colour;
+ wxColour m_tab_hover_background_colour;
+ wxColour m_tab_hover_background_gradient_colour;
+ wxColour m_tab_hover_background_top_colour;
+ wxColour m_tab_hover_background_top_gradient_colour;
+ wxColour m_panel_label_colour;
+ wxColour m_panel_minimised_label_colour;
+ wxColour m_panel_hover_label_colour;
+ wxColour m_panel_active_background_colour;
+ wxColour m_panel_active_background_gradient_colour;
+ wxColour m_panel_active_background_top_colour;
+ wxColour m_panel_active_background_top_gradient_colour;
+ wxColour m_panel_button_face_colour;
+ wxColour m_panel_button_hover_face_colour;
+ wxColour m_page_toggle_face_colour;
+ wxColour m_page_toggle_hover_face_colour;
+ wxColour m_page_background_colour;
+ wxColour m_page_background_gradient_colour;
+ wxColour m_page_background_top_colour;
+ wxColour m_page_background_top_gradient_colour;
+ wxColour m_page_hover_background_colour;
+ wxColour m_page_hover_background_gradient_colour;
+ wxColour m_page_hover_background_top_colour;
+ wxColour m_page_hover_background_top_gradient_colour;
+ wxColour m_button_bar_hover_background_colour;
+ wxColour m_button_bar_hover_background_gradient_colour;
+ wxColour m_button_bar_hover_background_top_colour;
+ wxColour m_button_bar_hover_background_top_gradient_colour;
+ wxColour m_button_bar_active_background_colour;
+ wxColour m_button_bar_active_background_gradient_colour;
+ wxColour m_button_bar_active_background_top_colour;
+ wxColour m_button_bar_active_background_top_gradient_colour;
+ wxColour m_gallery_button_background_colour;
+ wxColour m_gallery_button_background_gradient_colour;
+ wxColour m_gallery_button_hover_background_colour;
+ wxColour m_gallery_button_hover_background_gradient_colour;
+ wxColour m_gallery_button_active_background_colour;
+ wxColour m_gallery_button_active_background_gradient_colour;
+ wxColour m_gallery_button_disabled_background_colour;
+ wxColour m_gallery_button_disabled_background_gradient_colour;
+ wxColour m_gallery_button_face_colour;
+ wxColour m_gallery_button_hover_face_colour;
+ wxColour m_gallery_button_active_face_colour;
+ wxColour m_gallery_button_disabled_face_colour;
+
+ wxColour m_tool_face_colour;
+ wxColour m_tool_background_top_colour;
+ wxColour m_tool_background_top_gradient_colour;
+ wxColour m_tool_background_colour;
+ wxColour m_tool_background_gradient_colour;
+ wxColour m_tool_hover_background_top_colour;
+ wxColour m_tool_hover_background_top_gradient_colour;
+ wxColour m_tool_hover_background_colour;
+ wxColour m_tool_hover_background_gradient_colour;
+ wxColour m_tool_active_background_top_colour;
+ wxColour m_tool_active_background_top_gradient_colour;
+ wxColour m_tool_active_background_colour;
+ wxColour m_tool_active_background_gradient_colour;
+
+ wxBrush m_tab_ctrl_background_brush;
+ wxBrush m_panel_label_background_brush;
+ wxBrush m_panel_hover_label_background_brush;
+ wxBrush m_panel_hover_button_background_brush;
+ wxBrush m_gallery_hover_background_brush;
+ wxBrush m_gallery_button_background_top_brush;
+ wxBrush m_gallery_button_hover_background_top_brush;
+ wxBrush m_gallery_button_active_background_top_brush;
+ wxBrush m_gallery_button_disabled_background_top_brush;
+ wxBrush m_ribbon_toggle_brush;
+
+ wxFont m_tab_label_font;
+ wxFont m_panel_label_font;
+ wxFont m_button_bar_label_font;
+
+ wxPen m_page_border_pen;
+ wxPen m_panel_border_pen;
+ wxPen m_panel_border_gradient_pen;
+ wxPen m_panel_minimised_border_pen;
+ wxPen m_panel_minimised_border_gradient_pen;
+ wxPen m_panel_hover_button_border_pen;
+ wxPen m_tab_border_pen;
+ wxPen m_button_bar_hover_border_pen;
+ wxPen m_button_bar_active_border_pen;
+ wxPen m_gallery_border_pen;
+ wxPen m_gallery_item_border_pen;
+ wxPen m_toolbar_border_pen;
+ wxPen m_ribbon_toggle_pen;
+
+ double m_cached_tab_separator_visibility;
+ long m_flags;
+
+ int m_tab_separation_size;
+ int m_page_border_left;
+ int m_page_border_top;
+ int m_page_border_right;
+ int m_page_border_bottom;
+ int m_panel_x_separation_size;
+ int m_panel_y_separation_size;
+ int m_tool_group_separation_size;
+ int m_gallery_bitmap_padding_left_size;
+ int m_gallery_bitmap_padding_right_size;
+ int m_gallery_bitmap_padding_top_size;
+ int m_gallery_bitmap_padding_bottom_size;
+ int m_toggle_button_offset;
+ int m_help_button_offset;
+};
+
+class WXDLLIMPEXP_RIBBON wxRibbonAUIArtProvider : public wxRibbonMSWArtProvider
+{
+public:
+ wxRibbonAUIArtProvider();
+ virtual ~wxRibbonAUIArtProvider();
+
+ wxRibbonArtProvider* Clone() const;
+
+ wxColour GetColour(int id) const;
+ void SetColour(int id, const wxColor& colour);
+ void SetColourScheme(const wxColour& primary,
+ const wxColour& secondary,
+ const wxColour& tertiary);
+ void SetFont(int id, const wxFont& font);
+
+ wxSize GetScrollButtonMinimumSize(
+ wxDC& dc,
+ wxWindow* wnd,
+ long style);
+
+ void DrawScrollButton(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect,
+ long style);
+
+ wxSize GetPanelSize(
+ wxDC& dc,
+ const wxRibbonPanel* wnd,
+ wxSize client_size,
+ wxPoint* client_offset);
+
+ wxSize GetPanelClientSize(
+ wxDC& dc,
+ const wxRibbonPanel* wnd,
+ wxSize size,
+ wxPoint* client_offset);
+
+ wxRect GetPanelExtButtonArea(
+ wxDC& dc,
+ const wxRibbonPanel* wnd,
+ wxRect rect);
+
+ void DrawTabCtrlBackground(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect);
+
+ int GetTabCtrlHeight(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRibbonPageTabInfoArray& pages);
+
+ void GetBarTabWidth(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ int* ideal,
+ int* small_begin_need_separator,
+ int* small_must_have_separator,
+ int* minimum);
+
+ void DrawTab(wxDC& dc,
+ wxWindow* wnd,
+ const wxRibbonPageTabInfo& tab);
+
+ void DrawTabSeparator(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect,
+ double visibility);
+
+ void DrawPageBackground(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect);
+
+ void DrawPanelBackground(
+ wxDC& dc,
+ wxRibbonPanel* wnd,
+ const wxRect& rect);
+
+ void DrawMinimisedPanel(
+ wxDC& dc,
+ wxRibbonPanel* wnd,
+ const wxRect& rect,
+ wxBitmap& bitmap);
+
+ void DrawGalleryBackground(
+ wxDC& dc,
+ wxRibbonGallery* wnd,
+ const wxRect& rect);
+
+ void DrawGalleryItemBackground(
+ wxDC& dc,
+ wxRibbonGallery* wnd,
+ const wxRect& rect,
+ wxRibbonGalleryItem* item);
+
+ void DrawButtonBarBackground(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect);
+
+ void DrawButtonBarButton(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect,
+ wxRibbonButtonKind kind,
+ long state,
+ const wxString& label,
+ const wxBitmap& bitmap_large,
+ const wxBitmap& bitmap_small);
+
+ void DrawToolBarBackground(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect);
+
+ void DrawToolGroupBackground(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect);
+
+ void DrawTool(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect,
+ const wxBitmap& bitmap,
+ wxRibbonButtonKind kind,
+ long state);
+
+protected:
+ void DrawPartialPanelBackground(wxDC& dc, wxWindow* wnd,
+ const wxRect& rect);
+ void DrawGalleryButton(wxDC& dc, wxRect rect,
+ wxRibbonGalleryButtonState state, wxBitmap* bitmaps);
+
+ wxColour m_tab_ctrl_background_colour;
+ wxColour m_tab_ctrl_background_gradient_colour;
+ wxColour m_panel_label_background_colour;
+ wxColour m_panel_label_background_gradient_colour;
+ wxColour m_panel_hover_label_background_colour;
+ wxColour m_panel_hover_label_background_gradient_colour;
+
+ wxBrush m_background_brush;
+ wxBrush m_tab_active_top_background_brush;
+ wxBrush m_tab_hover_background_brush;
+ wxBrush m_button_bar_hover_background_brush;
+ wxBrush m_button_bar_active_background_brush;
+ wxBrush m_gallery_button_active_background_brush;
+ wxBrush m_gallery_button_hover_background_brush;
+ wxBrush m_gallery_button_disabled_background_brush;
+ wxBrush m_tool_hover_background_brush;
+ wxBrush m_tool_active_background_brush;
+
+ wxPen m_toolbar_hover_borden_pen;
+
+ wxFont m_tab_active_label_font;
+};
+
+#if defined(__WXMSW__)
+typedef wxRibbonMSWArtProvider wxRibbonDefaultArtProvider;
+#elif defined(__WXOSX_CARBON__) || \
+ defined(__WXOSX_COCOA__) || \
+ defined(__WXOSX_IPHONE__) || \
+ defined(__WXCOCOA__)
+// TODO: Once implemented, change typedef to OSX
+// typedef wxRibbonOSXArtProvider wxRibbonDefaultArtProvider;
+typedef wxRibbonAUIArtProvider wxRibbonDefaultArtProvider;
+#else
+// TODO: Once implemented, change typedef to AUI
+typedef wxRibbonAUIArtProvider wxRibbonDefaultArtProvider;
+#endif
+
+#endif // wxUSE_RIBBON
+
+#endif // _WX_RIBBON_ART_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/ribbon/art_internal.h
+// Purpose: Helper functions & classes used by ribbon art providers
+// Author: Peter Cawley
+// Modified by:
+// Created: 2009-08-04
+// Copyright: (C) Peter Cawley
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RIBBON_ART_INTERNAL_H_
+#define _WX_RIBBON_ART_INTERNAL_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_RIBBON
+
+WXDLLIMPEXP_RIBBON wxColour wxRibbonInterpolateColour(
+ const wxColour& start_colour,
+ const wxColour& end_colour,
+ int position,
+ int start_position,
+ int end_position);
+
+WXDLLIMPEXP_RIBBON bool wxRibbonCanLabelBreakAtPosition(
+ const wxString& label,
+ size_t pos);
+
+WXDLLIMPEXP_RIBBON void wxRibbonDrawParallelGradientLines(
+ wxDC& dc,
+ int nlines,
+ const wxPoint* line_origins,
+ int stepx,
+ int stepy,
+ int numsteps,
+ int offset_x,
+ int offset_y,
+ const wxColour& start_colour,
+ const wxColour& end_colour);
+
+WXDLLIMPEXP_RIBBON wxBitmap wxRibbonLoadPixmap(
+ const char* const* bits,
+ wxColour fore);
+
+/*
+ HSL colour class, using interface as discussed in wx-dev. Provided mainly
+ for art providers to perform colour scheme calculations in the HSL colour
+ space. If such a class makes it into base / core, then this class should be
+ removed and users switched over to the one in base / core.
+
+ 0.0 <= Hue < 360.0
+ 0.0 <= Saturation <= 1.0
+ 0.0 <= Luminance <= 1.0
+*/
+class WXDLLIMPEXP_RIBBON wxRibbonHSLColour
+{
+public:
+ wxRibbonHSLColour()
+ : hue(0.0), saturation(0.0), luminance(0.0) {}
+ wxRibbonHSLColour(float H, float S, float L)
+ : hue(H), saturation(S), luminance(L) { }
+ wxRibbonHSLColour(const wxColour& C);
+
+ wxColour ToRGB() const;
+
+ wxRibbonHSLColour& MakeDarker(float delta);
+ wxRibbonHSLColour Darker(float delta) const;
+ wxRibbonHSLColour Lighter(float delta) const;
+ wxRibbonHSLColour Saturated(float delta) const;
+ wxRibbonHSLColour Desaturated(float delta) const;
+ wxRibbonHSLColour ShiftHue(float delta) const;
+
+ float hue, saturation, luminance;
+};
+
+WXDLLIMPEXP_RIBBON wxRibbonHSLColour wxRibbonShiftLuminance(
+ wxRibbonHSLColour colour, float amount);
+
+#endif // wxUSE_RIBBON
+
+#endif // _WX_RIBBON_ART_INTERNAL_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/ribbon/bar.h
+// Purpose: Top-level component of the ribbon-bar-style interface
+// Author: Peter Cawley
+// Modified by:
+// Created: 2009-05-23
+// Copyright: (C) Peter Cawley
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RIBBON_BAR_H_
+#define _WX_RIBBON_BAR_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_RIBBON
+
+#include "wx/ribbon/control.h"
+#include "wx/ribbon/page.h"
+
+enum wxRibbonBarOption
+{
+ wxRIBBON_BAR_SHOW_PAGE_LABELS = 1 << 0,
+ wxRIBBON_BAR_SHOW_PAGE_ICONS = 1 << 1,
+ wxRIBBON_BAR_FLOW_HORIZONTAL = 0,
+ wxRIBBON_BAR_FLOW_VERTICAL = 1 << 2,
+ wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS = 1 << 3,
+ wxRIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS = 1 << 4,
+ wxRIBBON_BAR_ALWAYS_SHOW_TABS = 1 << 5,
+ wxRIBBON_BAR_SHOW_TOGGLE_BUTTON = 1 << 6,
+ wxRIBBON_BAR_SHOW_HELP_BUTTON = 1 << 7,
+
+ wxRIBBON_BAR_DEFAULT_STYLE = wxRIBBON_BAR_FLOW_HORIZONTAL
+ | wxRIBBON_BAR_SHOW_PAGE_LABELS
+ | wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS
+ | wxRIBBON_BAR_SHOW_TOGGLE_BUTTON
+ | wxRIBBON_BAR_SHOW_HELP_BUTTON,
+
+ wxRIBBON_BAR_FOLDBAR_STYLE = wxRIBBON_BAR_FLOW_VERTICAL
+ | wxRIBBON_BAR_SHOW_PAGE_ICONS
+ | wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS
+ | wxRIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS
+};
+
+enum wxRibbonDisplayMode
+{
+ wxRIBBON_BAR_PINNED,
+ wxRIBBON_BAR_MINIMIZED,
+ wxRIBBON_BAR_EXPANDED
+};
+
+class WXDLLIMPEXP_RIBBON wxRibbonBarEvent : public wxNotifyEvent
+{
+public:
+ wxRibbonBarEvent(wxEventType command_type = wxEVT_NULL,
+ int win_id = 0,
+ wxRibbonPage* page = NULL)
+ : wxNotifyEvent(command_type, win_id)
+ , m_page(page)
+ {
+ }
+#ifndef SWIG
+ wxRibbonBarEvent(const wxRibbonBarEvent& c) : wxNotifyEvent(c)
+ {
+ m_page = c.m_page;
+ }
+#endif
+ wxEvent *Clone() const { return new wxRibbonBarEvent(*this); }
+
+ wxRibbonPage* GetPage() {return m_page;}
+ void SetPage(wxRibbonPage* page) {m_page = page;}
+
+protected:
+ wxRibbonPage* m_page;
+
+#ifndef SWIG
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRibbonBarEvent)
+#endif
+};
+
+class WXDLLIMPEXP_RIBBON wxRibbonPageTabInfo
+{
+public:
+ wxRect rect;
+ wxRibbonPage *page;
+ int ideal_width;
+ int small_begin_need_separator_width;
+ int small_must_have_separator_width;
+ int minimum_width;
+ bool active;
+ bool hovered;
+ bool highlight;
+ bool shown;
+};
+
+#ifndef SWIG
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxRibbonPageTabInfo, wxRibbonPageTabInfoArray, WXDLLIMPEXP_RIBBON);
+#endif
+
+class WXDLLIMPEXP_RIBBON wxRibbonBar : public wxRibbonControl
+{
+public:
+ wxRibbonBar();
+
+ wxRibbonBar(wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxRIBBON_BAR_DEFAULT_STYLE);
+
+ virtual ~wxRibbonBar();
+
+ bool Create(wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxRIBBON_BAR_DEFAULT_STYLE);
+
+ void SetTabCtrlMargins(int left, int right);
+
+ void SetArtProvider(wxRibbonArtProvider* art);
+
+ bool SetActivePage(size_t page);
+ bool SetActivePage(wxRibbonPage* page);
+ int GetActivePage() const;
+ wxRibbonPage* GetPage(int n);
+ size_t GetPageCount() const;
+ bool DismissExpandedPanel();
+ int GetPageNumber(wxRibbonPage* page) const;
+
+ void DeletePage(size_t n);
+ void ClearPages();
+
+ bool IsPageShown(size_t page) const;
+ void ShowPage(size_t page, bool show = true);
+ void HidePage(size_t page) { ShowPage(page, false); }
+
+ bool IsPageHighlighted(size_t page) const;
+ void AddPageHighlight(size_t page, bool highlight = true);
+ void RemovePageHighlight(size_t page) { AddPageHighlight(page, false); }
+
+ void ShowPanels(bool show = true);
+ void HidePanels() { ShowPanels(false); }
+ bool ArePanelsShown() const { return m_arePanelsShown; }
+
+ virtual bool HasMultiplePages() const { return true; }
+
+ void SetWindowStyleFlag(long style);
+ long GetWindowStyleFlag() const;
+ virtual bool Realize();
+
+ // Implementation only.
+ bool IsToggleButtonHovered() const { return m_toggle_button_hovered; }
+ bool IsHelpButtonHovered() const { return m_help_button_hovered; }
+
+ void HideIfExpanded();
+
+protected:
+ friend class wxRibbonPage;
+
+ virtual wxSize DoGetBestSize() const;
+ wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+ wxRibbonPageTabInfo* HitTestTabs(wxPoint position, int* index = NULL);
+ void HitTestRibbonButton(const wxRect& rect, const wxPoint& position, bool &hover_flag);
+
+ void CommonInit(long style);
+ void AddPage(wxRibbonPage *page);
+ void RecalculateTabSizes();
+ void RecalculateMinSize();
+ void ScrollTabBar(int npixels);
+ void RefreshTabBar();
+ void RepositionPage(wxRibbonPage *page);
+
+ void OnPaint(wxPaintEvent& evt);
+ void OnEraseBackground(wxEraseEvent& evt);
+ void DoEraseBackground(wxDC& dc);
+ void OnSize(wxSizeEvent& evt);
+ void OnMouseLeftDown(wxMouseEvent& evt);
+ void OnMouseLeftUp(wxMouseEvent& evt);
+ void OnMouseMiddleDown(wxMouseEvent& evt);
+ void OnMouseMiddleUp(wxMouseEvent& evt);
+ void OnMouseRightDown(wxMouseEvent& evt);
+ void OnMouseRightUp(wxMouseEvent& evt);
+ void OnMouseMove(wxMouseEvent& evt);
+ void OnMouseLeave(wxMouseEvent& evt);
+ void OnMouseDoubleClick(wxMouseEvent& evt);
+ void DoMouseButtonCommon(wxMouseEvent& evt, wxEventType tab_event_type);
+ void OnKillFocus(wxFocusEvent& evt);
+
+ wxRibbonPageTabInfoArray m_pages;
+ wxRect m_tab_scroll_left_button_rect;
+ wxRect m_tab_scroll_right_button_rect;
+ wxRect m_toggle_button_rect;
+ wxRect m_help_button_rect;
+ long m_flags;
+ int m_tabs_total_width_ideal;
+ int m_tabs_total_width_minimum;
+ int m_tab_margin_left;
+ int m_tab_margin_right;
+ int m_tab_height;
+ int m_tab_scroll_amount;
+ int m_current_page;
+ int m_current_hovered_page;
+ int m_tab_scroll_left_button_state;
+ int m_tab_scroll_right_button_state;
+ bool m_tab_scroll_buttons_shown;
+ bool m_arePanelsShown;
+ bool m_bar_hovered;
+ bool m_toggle_button_hovered;
+ bool m_help_button_hovered;
+
+ wxRibbonDisplayMode m_ribbon_state;
+
+#ifndef SWIG
+ DECLARE_CLASS(wxRibbonBar)
+ DECLARE_EVENT_TABLE()
+#endif
+};
+
+#ifndef SWIG
+
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBAR_PAGE_CHANGED, wxRibbonBarEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBAR_PAGE_CHANGING, wxRibbonBarEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBAR_TAB_MIDDLE_DOWN, wxRibbonBarEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBAR_TAB_MIDDLE_UP, wxRibbonBarEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBAR_TAB_RIGHT_DOWN, wxRibbonBarEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBAR_TAB_RIGHT_UP, wxRibbonBarEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBAR_TAB_LEFT_DCLICK, wxRibbonBarEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBAR_TOGGLED, wxRibbonBarEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBAR_HELP_CLICK, wxRibbonBarEvent);
+
+typedef void (wxEvtHandler::*wxRibbonBarEventFunction)(wxRibbonBarEvent&);
+
+#define wxRibbonBarEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxRibbonBarEventFunction, func)
+
+#define EVT_RIBBONBAR_PAGE_CHANGED(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_RIBBONBAR_PAGE_CHANGED, winid, wxRibbonBarEventHandler(fn))
+#define EVT_RIBBONBAR_PAGE_CHANGING(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_RIBBONBAR_PAGE_CHANGING, winid, wxRibbonBarEventHandler(fn))
+#define EVT_RIBBONBAR_TAB_MIDDLE_DOWN(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_RIBBONBAR_TAB_MIDDLE_DOWN, winid, wxRibbonBarEventHandler(fn))
+#define EVT_RIBBONBAR_TAB_MIDDLE_UP(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_RIBBONBAR_TAB_MIDDLE_UP, winid, wxRibbonBarEventHandler(fn))
+#define EVT_RIBBONBAR_TAB_RIGHT_DOWN(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_RIBBONBAR_TAB_RIGHT_DOWN, winid, wxRibbonBarEventHandler(fn))
+#define EVT_RIBBONBAR_TAB_RIGHT_UP(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_RIBBONBAR_TAB_RIGHT_UP, winid, wxRibbonBarEventHandler(fn))
+#define EVT_RIBBONBAR_TAB_LEFT_DCLICK(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_RIBBONBAR_TAB_LEFT_DCLICK, winid, wxRibbonBarEventHandler(fn))
+#define EVT_RIBBONBAR_TOGGLED(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_RIBBONBAR_TOGGLED, winid, wxRibbonBarEventHandler(fn))
+#define EVT_RIBBONBAR_HELP_CLICK(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_RIBBONBAR_HELP_CLICK, winid, wxRibbonBarEventHandler(fn))
+#else
+
+// wxpython/swig event work
+%constant wxEventType wxEVT_RIBBONBAR_PAGE_CHANGED;
+%constant wxEventType wxEVT_RIBBONBAR_PAGE_CHANGING;
+%constant wxEventType wxEVT_RIBBONBAR_TAB_MIDDLE_DOWN;
+%constant wxEventType wxEVT_RIBBONBAR_TAB_MIDDLE_UP;
+%constant wxEventType wxEVT_RIBBONBAR_TAB_RIGHT_DOWN;
+%constant wxEventType wxEVT_RIBBONBAR_TAB_RIGHT_UP;
+%constant wxEventType wxEVT_RIBBONBAR_TAB_LEFT_DCLICK;
+%constant wxEventType wxEVT_RIBBONBAR_TOGGLED;
+%constant wxEventType wxEVT_RIBBONBAR_HELP_CLICK;
+
+%pythoncode {
+ EVT_RIBBONBAR_PAGE_CHANGED = wx.PyEventBinder( wxEVT_RIBBONBAR_PAGE_CHANGED, 1 )
+ EVT_RIBBONBAR_PAGE_CHANGING = wx.PyEventBinder( wxEVT_RIBBONBAR_PAGE_CHANGING, 1 )
+ EVT_RIBBONBAR_TAB_MIDDLE_DOWN = wx.PyEventBinder( wxEVT_RIBBONBAR_TAB_MIDDLE_DOWN, 1 )
+ EVT_RIBBONBAR_TAB_MIDDLE_UP = wx.PyEventBinder( wxEVT_RIBBONBAR_TAB_MIDDLE_UP, 1 )
+ EVT_RIBBONBAR_TAB_RIGHT_DOWN = wx.PyEventBinder( wxEVT_RIBBONBAR_TAB_RIGHT_DOWN, 1 )
+ EVT_RIBBONBAR_TAB_RIGHT_UP = wx.PyEventBinder( wxEVT_RIBBONBAR_TAB_RIGHT_UP, 1 )
+ EVT_RIBBONBAR_TAB_LEFT_DCLICK = wx.PyEventBinder( wxEVT_RIBBONBAR_TAB_LEFT_DCLICK, 1 )
+ EVT_RIBBONBAR_TOGGLED = wx.PyEventBinder( wxEVT_RIBBONBAR_TOGGLED, 1 )
+ EVT_RIBBONBAR_HELP_CLICK = wx.PyEventBinder( wxEVT_RIBBONBAR_HELP_CLICK, 1 )
+}
+#endif
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_RIBBONBAR_PAGE_CHANGED wxEVT_RIBBONBAR_PAGE_CHANGED
+#define wxEVT_COMMAND_RIBBONBAR_PAGE_CHANGING wxEVT_RIBBONBAR_PAGE_CHANGING
+#define wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_DOWN wxEVT_RIBBONBAR_TAB_MIDDLE_DOWN
+#define wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_UP wxEVT_RIBBONBAR_TAB_MIDDLE_UP
+#define wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_DOWN wxEVT_RIBBONBAR_TAB_RIGHT_DOWN
+#define wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_UP wxEVT_RIBBONBAR_TAB_RIGHT_UP
+#define wxEVT_COMMAND_RIBBONBAR_TAB_LEFT_DCLICK wxEVT_RIBBONBAR_TAB_LEFT_DCLICK
+#define wxEVT_COMMAND_RIBBONBAR_TOGGLED wxEVT_RIBBONBAR_TOGGLED
+#define wxEVT_COMMAND_RIBBONBAR_HELP_CLICKED wxEVT_RIBBONBAR_HELP_CLICK
+
+#endif // wxUSE_RIBBON
+
+#endif // _WX_RIBBON_BAR_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/ribbon/buttonbar.h
+// Purpose: Ribbon control similar to a tool bar
+// Author: Peter Cawley
+// Modified by:
+// Created: 2009-07-01
+// Copyright: (C) Peter Cawley
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+#ifndef _WX_RIBBON_BUTTON_BAR_H_
+#define _WX_RIBBON_BUTTON_BAR_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_RIBBON
+
+#include "wx/ribbon/art.h"
+#include "wx/ribbon/control.h"
+#include "wx/dynarray.h"
+
+class wxRibbonButtonBarButtonBase;
+class wxRibbonButtonBarLayout;
+class wxRibbonButtonBarButtonInstance;
+
+WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxRibbonButtonBarLayout*, wxArrayRibbonButtonBarLayout, class WXDLLIMPEXP_RIBBON);
+WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxRibbonButtonBarButtonBase*, wxArrayRibbonButtonBarButtonBase, class WXDLLIMPEXP_RIBBON);
+
+class WXDLLIMPEXP_RIBBON wxRibbonButtonBar : public wxRibbonControl
+{
+public:
+ wxRibbonButtonBar();
+
+ wxRibbonButtonBar(wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0);
+
+ virtual ~wxRibbonButtonBar();
+
+ bool Create(wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0);
+
+ virtual wxRibbonButtonBarButtonBase* AddButton(
+ int button_id,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxString& help_string,
+ wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL);
+ // NB: help_string cannot be optional as that would cause the signature
+ // to be identical to the full version of AddButton when 3 arguments are
+ // given.
+
+ virtual wxRibbonButtonBarButtonBase* AddDropdownButton(
+ int button_id,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxString& help_string = wxEmptyString);
+
+ virtual wxRibbonButtonBarButtonBase* AddHybridButton(
+ int button_id,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxString& help_string = wxEmptyString);
+
+ virtual wxRibbonButtonBarButtonBase* AddToggleButton(
+ int button_id,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxString& help_string = wxEmptyString);
+
+ virtual wxRibbonButtonBarButtonBase* AddButton(
+ int button_id,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxBitmap& bitmap_small = wxNullBitmap,
+ const wxBitmap& bitmap_disabled = wxNullBitmap,
+ const wxBitmap& bitmap_small_disabled = wxNullBitmap,
+ wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL,
+ const wxString& help_string = wxEmptyString);
+
+ virtual wxRibbonButtonBarButtonBase* InsertButton(
+ size_t pos,
+ int button_id,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxString& help_string,
+ wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL);
+
+ virtual wxRibbonButtonBarButtonBase* InsertDropdownButton(
+ size_t pos,
+ int button_id,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxString& help_string = wxEmptyString);
+
+ virtual wxRibbonButtonBarButtonBase* InsertHybridButton(
+ size_t pos,
+ int button_id,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxString& help_string = wxEmptyString);
+
+ virtual wxRibbonButtonBarButtonBase* InsertToggleButton(
+ size_t pos,
+ int button_id,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxString& help_string = wxEmptyString);
+
+ virtual wxRibbonButtonBarButtonBase* InsertButton(
+ size_t pos,
+ int button_id,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxBitmap& bitmap_small = wxNullBitmap,
+ const wxBitmap& bitmap_disabled = wxNullBitmap,
+ const wxBitmap& bitmap_small_disabled = wxNullBitmap,
+ wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL,
+ const wxString& help_string = wxEmptyString);
+
+ void SetItemClientObject(wxRibbonButtonBarButtonBase* item, wxClientData* data);
+ wxClientData* GetItemClientObject(const wxRibbonButtonBarButtonBase* item) const;
+ void SetItemClientData(wxRibbonButtonBarButtonBase* item, void* data);
+ void* GetItemClientData(const wxRibbonButtonBarButtonBase* item) const;
+
+ virtual size_t GetButtonCount() const;
+ virtual wxRibbonButtonBarButtonBase *GetItem(size_t n) const;
+ virtual wxRibbonButtonBarButtonBase *GetItemById(int id) const;
+ virtual int GetItemId(wxRibbonButtonBarButtonBase *button) const;
+
+
+ virtual bool Realize();
+ virtual void ClearButtons();
+ virtual bool DeleteButton(int button_id);
+ virtual void EnableButton(int button_id, bool enable = true);
+ virtual void ToggleButton(int button_id, bool checked);
+
+ virtual wxRibbonButtonBarButtonBase *GetActiveItem() const;
+ virtual wxRibbonButtonBarButtonBase *GetHoveredItem() const;
+
+ virtual void SetArtProvider(wxRibbonArtProvider* art);
+ virtual bool IsSizingContinuous() const;
+
+ virtual wxSize GetMinSize() const;
+
+ void SetShowToolTipsForDisabled(bool show);
+ bool GetShowToolTipsForDisabled() const;
+
+protected:
+ friend class wxRibbonButtonBarEvent;
+ virtual wxSize DoGetBestSize() const;
+ wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ void OnEraseBackground(wxEraseEvent& evt);
+ void OnPaint(wxPaintEvent& evt);
+ void OnSize(wxSizeEvent& evt);
+ void OnMouseMove(wxMouseEvent& evt);
+ void OnMouseEnter(wxMouseEvent& evt);
+ void OnMouseLeave(wxMouseEvent& evt);
+ void OnMouseDown(wxMouseEvent& evt);
+ void OnMouseUp(wxMouseEvent& evt);
+
+ virtual wxSize DoGetNextSmallerSize(wxOrientation direction,
+ wxSize relative_to) const;
+ virtual wxSize DoGetNextLargerSize(wxOrientation direction,
+ wxSize relative_to) const;
+
+ void CommonInit(long style);
+ void MakeLayouts();
+ bool TryCollapseLayout(wxRibbonButtonBarLayout* original, size_t first_btn, size_t* last_button);
+ static wxBitmap MakeResizedBitmap(const wxBitmap& original, wxSize size);
+ static wxBitmap MakeDisabledBitmap(const wxBitmap& original);
+ void FetchButtonSizeInfo(wxRibbonButtonBarButtonBase* button,
+ wxRibbonButtonBarButtonState size, wxDC& dc);
+ virtual void UpdateWindowUI(long flags);
+
+ wxArrayRibbonButtonBarLayout m_layouts;
+ wxArrayRibbonButtonBarButtonBase m_buttons;
+ wxRibbonButtonBarButtonInstance* m_hovered_button;
+ wxRibbonButtonBarButtonInstance* m_active_button;
+
+ wxPoint m_layout_offset;
+ wxSize m_bitmap_size_large;
+ wxSize m_bitmap_size_small;
+ int m_current_layout;
+ bool m_layouts_valid;
+ bool m_lock_active_state;
+ bool m_show_tooltips_for_disabled;
+
+#ifndef SWIG
+ DECLARE_CLASS(wxRibbonButtonBar)
+ DECLARE_EVENT_TABLE()
+#endif
+};
+
+class WXDLLIMPEXP_RIBBON wxRibbonButtonBarEvent : public wxCommandEvent
+{
+public:
+ wxRibbonButtonBarEvent(wxEventType command_type = wxEVT_NULL,
+ int win_id = 0,
+ wxRibbonButtonBar* bar = NULL,
+ wxRibbonButtonBarButtonBase* button = NULL)
+ : wxCommandEvent(command_type, win_id)
+ , m_bar(bar), m_button(button)
+ {
+ }
+#ifndef SWIG
+ wxRibbonButtonBarEvent(const wxRibbonButtonBarEvent& e) : wxCommandEvent(e)
+ {
+ m_bar = e.m_bar;
+ m_button = e.m_button;
+ }
+#endif
+ wxEvent *Clone() const { return new wxRibbonButtonBarEvent(*this); }
+
+ wxRibbonButtonBar* GetBar() {return m_bar;}
+ wxRibbonButtonBarButtonBase *GetButton() { return m_button; }
+ void SetBar(wxRibbonButtonBar* bar) {m_bar = bar;}
+ void SetButton(wxRibbonButtonBarButtonBase* button) { m_button = button; }
+ bool PopupMenu(wxMenu* menu);
+
+protected:
+ wxRibbonButtonBar* m_bar;
+ wxRibbonButtonBarButtonBase *m_button;
+
+#ifndef SWIG
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRibbonButtonBarEvent)
+#endif
+};
+
+#ifndef SWIG
+
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBUTTONBAR_CLICKED, wxRibbonButtonBarEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED, wxRibbonButtonBarEvent);
+
+typedef void (wxEvtHandler::*wxRibbonButtonBarEventFunction)(wxRibbonButtonBarEvent&);
+
+#define wxRibbonButtonBarEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxRibbonButtonBarEventFunction, func)
+
+#define EVT_RIBBONBUTTONBAR_CLICKED(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_RIBBONBUTTONBAR_CLICKED, winid, wxRibbonButtonBarEventHandler(fn))
+#define EVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED, winid, wxRibbonButtonBarEventHandler(fn))
+#else
+
+// wxpython/swig event work
+%constant wxEventType wxEVT_RIBBONBUTTONBAR_CLICKED;
+%constant wxEventType wxEVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED;
+
+%pythoncode {
+ EVT_RIBBONBUTTONBAR_CLICKED = wx.PyEventBinder( wxEVT_RIBBONBUTTONBAR_CLICKED, 1 )
+ EVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED = wx.PyEventBinder( wxEVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED, 1 )
+}
+#endif
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_RIBBONBUTTON_CLICKED wxEVT_RIBBONBUTTONBAR_CLICKED
+#define wxEVT_COMMAND_RIBBONBUTTON_DROPDOWN_CLICKED wxEVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED
+
+#endif // wxUSE_RIBBON
+
+#endif // _WX_RIBBON_BUTTON_BAR_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/ribbon/control.h
+// Purpose: Extension of wxControl with common ribbon methods
+// Author: Peter Cawley
+// Modified by:
+// Created: 2009-06-05
+// Copyright: (C) Peter Cawley
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RIBBON_CONTROL_H_
+#define _WX_RIBBON_CONTROL_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_RIBBON
+
+#include "wx/control.h"
+#include "wx/dynarray.h"
+
+class wxRibbonBar;
+class wxRibbonArtProvider;
+
+class WXDLLIMPEXP_RIBBON wxRibbonControl : public wxControl
+{
+public:
+ wxRibbonControl() { Init(); }
+
+ wxRibbonControl(wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxControlNameStr)
+ {
+ Init();
+
+ Create(parent, id, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxControlNameStr);
+
+ virtual void SetArtProvider(wxRibbonArtProvider* art);
+ wxRibbonArtProvider* GetArtProvider() const {return m_art;}
+
+ virtual bool IsSizingContinuous() const {return true;}
+ wxSize GetNextSmallerSize(wxOrientation direction, wxSize relative_to) const;
+ wxSize GetNextLargerSize(wxOrientation direction, wxSize relative_to) const;
+ wxSize GetNextSmallerSize(wxOrientation direction) const;
+ wxSize GetNextLargerSize(wxOrientation direction) const;
+
+ virtual bool Realize();
+ bool Realise() {return Realize();}
+
+ virtual wxRibbonBar* GetAncestorRibbonBar()const;
+
+ // Finds the best width and height given the parent's width and height
+ virtual wxSize GetBestSizeForParentSize(const wxSize& WXUNUSED(parentSize)) const { return GetBestSize(); }
+
+protected:
+ wxRibbonArtProvider* m_art;
+
+ virtual wxSize DoGetNextSmallerSize(wxOrientation direction,
+ wxSize relative_to) const;
+ virtual wxSize DoGetNextLargerSize(wxOrientation direction,
+ wxSize relative_to) const;
+
+private:
+ void Init() { m_art = NULL; }
+
+#ifndef SWIG
+ DECLARE_CLASS(wxRibbonControl)
+#endif
+};
+
+WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxRibbonControl*, wxArrayRibbonControl, class WXDLLIMPEXP_RIBBON);
+
+#endif // wxUSE_RIBBON
+
+#endif // _WX_RIBBON_CONTROL_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/ribbon/gallery.h
+// Purpose: Ribbon control which displays a gallery of items to choose from
+// Author: Peter Cawley
+// Modified by:
+// Created: 2009-07-22
+// Copyright: (C) Peter Cawley
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+#ifndef _WX_RIBBON_GALLERY_H_
+#define _WX_RIBBON_GALLERY_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_RIBBON
+
+#include "wx/ribbon/art.h"
+#include "wx/ribbon/control.h"
+
+class wxRibbonGalleryItem;
+
+WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxRibbonGalleryItem*, wxArrayRibbonGalleryItem, class WXDLLIMPEXP_RIBBON);
+
+class WXDLLIMPEXP_RIBBON wxRibbonGallery : public wxRibbonControl
+{
+public:
+ wxRibbonGallery();
+
+ wxRibbonGallery(wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0);
+
+ virtual ~wxRibbonGallery();
+
+ bool Create(wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0);
+
+ void Clear();
+
+ bool IsEmpty() const;
+ unsigned int GetCount() const;
+ wxRibbonGalleryItem* GetItem(unsigned int n);
+ wxRibbonGalleryItem* Append(const wxBitmap& bitmap, int id);
+ wxRibbonGalleryItem* Append(const wxBitmap& bitmap, int id, void* clientData);
+ wxRibbonGalleryItem* Append(const wxBitmap& bitmap, int id, wxClientData* clientData);
+
+ void SetItemClientObject(wxRibbonGalleryItem* item, wxClientData* data);
+ wxClientData* GetItemClientObject(const wxRibbonGalleryItem* item) const;
+ void SetItemClientData(wxRibbonGalleryItem* item, void* data);
+ void* GetItemClientData(const wxRibbonGalleryItem* item) const;
+
+ void SetSelection(wxRibbonGalleryItem* item);
+ wxRibbonGalleryItem* GetSelection() const;
+ wxRibbonGalleryItem* GetHoveredItem() const;
+ wxRibbonGalleryItem* GetActiveItem() const;
+ wxRibbonGalleryButtonState GetUpButtonState() const;
+ wxRibbonGalleryButtonState GetDownButtonState() const;
+ wxRibbonGalleryButtonState GetExtensionButtonState() const;
+
+ bool IsHovered() const;
+ virtual bool IsSizingContinuous() const;
+ virtual bool Realize();
+ virtual bool Layout();
+
+ virtual bool ScrollLines(int lines);
+ bool ScrollPixels(int pixels);
+ void EnsureVisible(const wxRibbonGalleryItem* item);
+
+protected:
+ wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+ void CommonInit(long style);
+ void CalculateMinSize();
+ bool TestButtonHover(const wxRect& rect, wxPoint pos,
+ wxRibbonGalleryButtonState* state);
+
+ void OnEraseBackground(wxEraseEvent& evt);
+ void OnMouseEnter(wxMouseEvent& evt);
+ void OnMouseMove(wxMouseEvent& evt);
+ void OnMouseLeave(wxMouseEvent& evt);
+ void OnMouseDown(wxMouseEvent& evt);
+ void OnMouseUp(wxMouseEvent& evt);
+ void OnMouseDClick(wxMouseEvent& evt);
+ void OnPaint(wxPaintEvent& evt);
+ void OnSize(wxSizeEvent& evt);
+ int GetScrollLineSize() const;
+
+ virtual wxSize DoGetBestSize() const;
+ virtual wxSize DoGetNextSmallerSize(wxOrientation direction,
+ wxSize relative_to) const;
+ virtual wxSize DoGetNextLargerSize(wxOrientation direction,
+ wxSize relative_to) const;
+
+ wxArrayRibbonGalleryItem m_items;
+ wxRibbonGalleryItem* m_selected_item;
+ wxRibbonGalleryItem* m_hovered_item;
+ wxRibbonGalleryItem* m_active_item;
+ wxSize m_bitmap_size;
+ wxSize m_bitmap_padded_size;
+ wxSize m_best_size;
+ wxRect m_client_rect;
+ wxRect m_scroll_up_button_rect;
+ wxRect m_scroll_down_button_rect;
+ wxRect m_extension_button_rect;
+ const wxRect* m_mouse_active_rect;
+ int m_item_separation_x;
+ int m_item_separation_y;
+ int m_scroll_amount;
+ int m_scroll_limit;
+ wxRibbonGalleryButtonState m_up_button_state;
+ wxRibbonGalleryButtonState m_down_button_state;
+ wxRibbonGalleryButtonState m_extension_button_state;
+ bool m_hovered;
+
+#ifndef SWIG
+ DECLARE_CLASS(wxRibbonGallery)
+ DECLARE_EVENT_TABLE()
+#endif
+};
+
+class WXDLLIMPEXP_RIBBON wxRibbonGalleryEvent : public wxCommandEvent
+{
+public:
+ wxRibbonGalleryEvent(wxEventType command_type = wxEVT_NULL,
+ int win_id = 0,
+ wxRibbonGallery* gallery = NULL,
+ wxRibbonGalleryItem* item = NULL)
+ : wxCommandEvent(command_type, win_id)
+ , m_gallery(gallery), m_item(item)
+ {
+ }
+#ifndef SWIG
+ wxRibbonGalleryEvent(const wxRibbonGalleryEvent& e) : wxCommandEvent(e)
+ {
+ m_gallery = e.m_gallery;
+ m_item = e.m_item;
+ }
+#endif
+ wxEvent *Clone() const { return new wxRibbonGalleryEvent(*this); }
+
+ wxRibbonGallery* GetGallery() {return m_gallery;}
+ wxRibbonGalleryItem* GetGalleryItem() {return m_item;}
+ void SetGallery(wxRibbonGallery* gallery) {m_gallery = gallery;}
+ void SetGalleryItem(wxRibbonGalleryItem* item) {m_item = item;}
+
+protected:
+ wxRibbonGallery* m_gallery;
+ wxRibbonGalleryItem* m_item;
+
+#ifndef SWIG
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRibbonGalleryEvent)
+#endif
+};
+
+#ifndef SWIG
+
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONGALLERY_HOVER_CHANGED, wxRibbonGalleryEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONGALLERY_SELECTED, wxRibbonGalleryEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONGALLERY_CLICKED, wxRibbonGalleryEvent);
+
+typedef void (wxEvtHandler::*wxRibbonGalleryEventFunction)(wxRibbonGalleryEvent&);
+
+#define wxRibbonGalleryEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxRibbonGalleryEventFunction, func)
+
+#define EVT_RIBBONGALLERY_HOVER_CHANGED(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_RIBBONGALLERY_HOVER_CHANGED, winid, wxRibbonGalleryEventHandler(fn))
+#define EVT_RIBBONGALLERY_SELECTED(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_RIBBONGALLERY_SELECTED, winid, wxRibbonGalleryEventHandler(fn))
+#define EVT_RIBBONGALLERY_CLICKED(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_RIBBONGALLERY_CLICKED, winid, wxRibbonGalleryEventHandler(fn))
+#else
+
+// wxpython/swig event work
+%constant wxEventType wxEVT_RIBBONGALLERY_HOVER_CHANGED;
+%constant wxEventType wxEVT_RIBBONGALLERY_SELECTED;
+
+%pythoncode {
+ EVT_RIBBONGALLERY_HOVER_CHANGED = wx.PyEventBinder( wxEVT_RIBBONGALLERY_HOVER_CHANGED, 1 )
+ EVT_RIBBONGALLERY_SELECTED = wx.PyEventBinder( wxEVT_RIBBONGALLERY_SELECTED, 1 )
+}
+#endif // SWIG
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_RIBBONGALLERY_HOVER_CHANGED wxEVT_RIBBONGALLERY_HOVER_CHANGED
+#define wxEVT_COMMAND_RIBBONGALLERY_SELECTED wxEVT_RIBBONGALLERY_SELECTED
+#define wxEVT_COMMAND_RIBBONGALLERY_CLICKED wxEVT_RIBBONGALLERY_CLICKED
+
+#endif // wxUSE_RIBBON
+
+#endif // _WX_RIBBON_GALLERY_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/ribbon/page.h
+// Purpose: Container for ribbon-bar-style interface panels
+// Author: Peter Cawley
+// Modified by:
+// Created: 2009-05-25
+// Copyright: (C) Peter Cawley
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RIBBON_PAGE_H_
+#define _WX_RIBBON_PAGE_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_RIBBON
+
+#include "wx/ribbon/control.h"
+#include "wx/ribbon/panel.h"
+#include "wx/bitmap.h"
+
+class wxRibbonBar;
+class wxRibbonPageScrollButton;
+
+class WXDLLIMPEXP_RIBBON wxRibbonPage : public wxRibbonControl
+{
+public:
+ wxRibbonPage();
+
+ wxRibbonPage(wxRibbonBar* parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& label = wxEmptyString,
+ const wxBitmap& icon = wxNullBitmap,
+ long style = 0);
+
+ virtual ~wxRibbonPage();
+
+ bool Create(wxRibbonBar* parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& label = wxEmptyString,
+ const wxBitmap& icon = wxNullBitmap,
+ long style = 0);
+
+ void SetArtProvider(wxRibbonArtProvider* art);
+
+ wxBitmap& GetIcon() {return m_icon;}
+ virtual wxSize GetMinSize() const;
+ void SetSizeWithScrollButtonAdjustment(int x, int y, int width, int height);
+ void AdjustRectToIncludeScrollButtons(wxRect* rect) const;
+
+ bool DismissExpandedPanel();
+
+ virtual bool Realize();
+ virtual bool Show(bool show = true);
+ virtual bool Layout();
+ virtual bool ScrollLines(int lines);
+ bool ScrollPixels(int pixels);
+ bool ScrollSections(int sections);
+
+ wxOrientation GetMajorAxis() const;
+
+ virtual void RemoveChild(wxWindowBase *child);
+
+ void HideIfExpanded();
+
+protected:
+ virtual wxSize DoGetBestSize() const;
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
+ bool DoActualLayout();
+ void OnEraseBackground(wxEraseEvent& evt);
+ void OnPaint(wxPaintEvent& evt);
+ void OnSize(wxSizeEvent& evt);
+
+ bool ExpandPanels(wxOrientation direction, int maximum_amount);
+ bool CollapsePanels(wxOrientation direction, int minimum_amount);
+ void ShowScrollButtons();
+ void HideScrollButtons();
+
+ void CommonInit(const wxString& label, const wxBitmap& icon);
+ void PopulateSizeCalcArray(wxSize (wxWindow::*get_size)(void) const);
+
+ wxArrayRibbonControl m_collapse_stack;
+ wxBitmap m_icon;
+ wxSize m_old_size;
+ // NB: Scroll button windows are siblings rather than children (to get correct clipping of children)
+ wxRibbonPageScrollButton* m_scroll_left_btn;
+ wxRibbonPageScrollButton* m_scroll_right_btn;
+ wxSize* m_size_calc_array;
+ size_t m_size_calc_array_size;
+ int m_scroll_amount;
+ int m_scroll_amount_limit;
+ int m_size_in_major_axis_for_children;
+ bool m_scroll_buttons_visible;
+
+#ifndef SWIG
+ DECLARE_CLASS(wxRibbonPage)
+ DECLARE_EVENT_TABLE()
+#endif
+};
+
+#endif // wxUSE_RIBBON
+
+#endif // _WX_RIBBON_PAGE_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/ribbon/panel.h
+// Purpose: Ribbon-style container for a group of related tools / controls
+// Author: Peter Cawley
+// Modified by:
+// Created: 2009-05-25
+// Copyright: (C) Peter Cawley
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+#ifndef _WX_RIBBON_PANEL_H_
+#define _WX_RIBBON_PANEL_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_RIBBON
+
+#include "wx/bitmap.h"
+#include "wx/ribbon/control.h"
+
+enum wxRibbonPanelOption
+{
+ wxRIBBON_PANEL_NO_AUTO_MINIMISE = 1 << 0,
+ wxRIBBON_PANEL_EXT_BUTTON = 1 << 3,
+ wxRIBBON_PANEL_MINIMISE_BUTTON = 1 << 4,
+ wxRIBBON_PANEL_STRETCH = 1 << 5,
+ wxRIBBON_PANEL_FLEXIBLE = 1 << 6,
+
+ wxRIBBON_PANEL_DEFAULT_STYLE = 0
+};
+
+class WXDLLIMPEXP_RIBBON wxRibbonPanel : public wxRibbonControl
+{
+public:
+ wxRibbonPanel();
+
+ wxRibbonPanel(wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& label = wxEmptyString,
+ const wxBitmap& minimised_icon = wxNullBitmap,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxRIBBON_PANEL_DEFAULT_STYLE);
+
+ virtual ~wxRibbonPanel();
+
+ bool Create(wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& label = wxEmptyString,
+ const wxBitmap& icon = wxNullBitmap,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxRIBBON_PANEL_DEFAULT_STYLE);
+
+ wxBitmap& GetMinimisedIcon() {return m_minimised_icon;}
+ const wxBitmap& GetMinimisedIcon() const {return m_minimised_icon;}
+ bool IsMinimised() const;
+ bool IsMinimised(wxSize at_size) const;
+ bool IsHovered() const;
+ bool IsExtButtonHovered() const;
+ bool CanAutoMinimise() const;
+
+ bool ShowExpanded();
+ bool HideExpanded();
+
+ void SetArtProvider(wxRibbonArtProvider* art);
+
+ virtual bool Realize();
+ virtual bool Layout();
+ virtual wxSize GetMinSize() const;
+
+ virtual bool IsSizingContinuous() const;
+
+ virtual void AddChild(wxWindowBase *child);
+ virtual void RemoveChild(wxWindowBase *child);
+
+ virtual bool HasExtButton() const;
+
+ wxRibbonPanel* GetExpandedDummy();
+ wxRibbonPanel* GetExpandedPanel();
+
+ // Finds the best width and height given the parent's width and height
+ virtual wxSize GetBestSizeForParentSize(const wxSize& parentSize) const;
+
+ long GetFlags() { return m_flags; }
+
+ void HideIfExpanded();
+
+protected:
+ virtual wxSize DoGetBestSize() const;
+ virtual wxSize GetPanelSizerBestSize() const;
+ wxSize GetPanelSizerMinSize() const;
+ wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+ wxSize GetMinNotMinimisedSize() const;
+
+ virtual wxSize DoGetNextSmallerSize(wxOrientation direction,
+ wxSize relative_to) const;
+ virtual wxSize DoGetNextLargerSize(wxOrientation direction,
+ wxSize relative_to) const;
+
+ void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
+ void OnSize(wxSizeEvent& evt);
+ void OnEraseBackground(wxEraseEvent& evt);
+ void OnPaint(wxPaintEvent& evt);
+ void OnMouseEnter(wxMouseEvent& evt);
+ void OnMouseEnterChild(wxMouseEvent& evt);
+ void OnMouseLeave(wxMouseEvent& evt);
+ void OnMouseLeaveChild(wxMouseEvent& evt);
+ void OnMouseClick(wxMouseEvent& evt);
+ void OnMotion(wxMouseEvent& evt);
+ void OnKillFocus(wxFocusEvent& evt);
+ void OnChildKillFocus(wxFocusEvent& evt);
+
+ void TestPositionForHover(const wxPoint& pos);
+ bool ShouldSendEventToDummy(wxEvent& evt);
+ virtual bool TryAfter(wxEvent& evt);
+
+ void CommonInit(const wxString& label, const wxBitmap& icon, long style);
+ static wxRect GetExpandedPosition(wxRect panel,
+ wxSize expanded_size,
+ wxDirection direction);
+
+ wxBitmap m_minimised_icon;
+ wxBitmap m_minimised_icon_resized;
+ wxSize m_smallest_unminimised_size;
+ wxSize m_minimised_size;
+ wxDirection m_preferred_expand_direction;
+ wxRibbonPanel* m_expanded_dummy;
+ wxRibbonPanel* m_expanded_panel;
+ wxWindow* m_child_with_focus;
+ long m_flags;
+ bool m_minimised;
+ bool m_hovered;
+ bool m_ext_button_hovered;
+ wxRect m_ext_button_rect;
+
+#ifndef SWIG
+ DECLARE_CLASS(wxRibbonPanel)
+ DECLARE_EVENT_TABLE()
+#endif
+};
+
+
+class WXDLLIMPEXP_RIBBON wxRibbonPanelEvent : public wxCommandEvent
+{
+public:
+ wxRibbonPanelEvent(wxEventType command_type = wxEVT_NULL,
+ int win_id = 0,
+ wxRibbonPanel* panel = NULL)
+ : wxCommandEvent(command_type, win_id)
+ , m_panel(panel)
+ {
+ }
+#ifndef SWIG
+ wxRibbonPanelEvent(const wxRibbonPanelEvent& e) : wxCommandEvent(e)
+ {
+ m_panel = e.m_panel;
+ }
+#endif
+ wxEvent *Clone() const { return new wxRibbonPanelEvent(*this); }
+
+ wxRibbonPanel* GetPanel() {return m_panel;}
+ void SetPanel(wxRibbonPanel* panel) {m_panel = panel;}
+
+protected:
+ wxRibbonPanel* m_panel;
+
+#ifndef SWIG
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRibbonPanelEvent)
+#endif
+};
+
+#ifndef SWIG
+
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONPANEL_EXTBUTTON_ACTIVATED, wxRibbonPanelEvent);
+
+typedef void (wxEvtHandler::*wxRibbonPanelEventFunction)(wxRibbonPanelEvent&);
+
+#define wxRibbonPanelEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxRibbonPanelEventFunction, func)
+
+#define EVT_RIBBONPANEL_EXTBUTTON_ACTIVATED(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_RIBBONPANEL_EXTBUTTON_ACTIVATED, winid, wxRibbonPanelEventHandler(fn))
+#else
+
+// wxpython/swig event work
+%constant wxEventType wxEVT_RIBBONPANEL_EXTBUTTON_ACTIVATED;
+
+%pythoncode {
+ EVT_RIBBONPANEL_EXTBUTTON_ACTIVATED = wx.PyEventBinder( wxEVT_RIBBONPANEL_EXTBUTTON_ACTIVATED, 1 )
+}
+#endif
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_RIBBONPANEL_EXTBUTTON_ACTIVATED wxEVT_RIBBONPANEL_EXTBUTTON_ACTIVATED
+
+#endif // wxUSE_RIBBON
+
+#endif // _WX_RIBBON_PANEL_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/ribbon/toolbar.h
+// Purpose: Ribbon-style tool bar
+// Author: Peter Cawley
+// Modified by:
+// Created: 2009-07-06
+// Copyright: (C) Peter Cawley
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+#ifndef _WX_RIBBON_TOOLBAR_H_
+#define _WX_RIBBON_TOOLBAR_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_RIBBON
+
+#include "wx/ribbon/control.h"
+#include "wx/ribbon/art.h"
+
+class wxRibbonToolBarToolBase;
+class wxRibbonToolBarToolGroup;
+WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxRibbonToolBarToolGroup*, wxArrayRibbonToolBarToolGroup, class WXDLLIMPEXP_RIBBON);
+
+enum wxRibbonToolBarToolState
+{
+ wxRIBBON_TOOLBAR_TOOL_FIRST = 1 << 0,
+ wxRIBBON_TOOLBAR_TOOL_LAST = 1 << 1,
+ wxRIBBON_TOOLBAR_TOOL_POSITION_MASK = wxRIBBON_TOOLBAR_TOOL_FIRST | wxRIBBON_TOOLBAR_TOOL_LAST,
+
+ wxRIBBON_TOOLBAR_TOOL_NORMAL_HOVERED = 1 << 3,
+ wxRIBBON_TOOLBAR_TOOL_DROPDOWN_HOVERED = 1 << 4,
+ wxRIBBON_TOOLBAR_TOOL_HOVER_MASK = wxRIBBON_TOOLBAR_TOOL_NORMAL_HOVERED | wxRIBBON_TOOLBAR_TOOL_DROPDOWN_HOVERED,
+ wxRIBBON_TOOLBAR_TOOL_NORMAL_ACTIVE = 1 << 5,
+ wxRIBBON_TOOLBAR_TOOL_DROPDOWN_ACTIVE = 1 << 6,
+ wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK = wxRIBBON_TOOLBAR_TOOL_NORMAL_ACTIVE | wxRIBBON_TOOLBAR_TOOL_DROPDOWN_ACTIVE,
+ wxRIBBON_TOOLBAR_TOOL_DISABLED = 1 << 7,
+ wxRIBBON_TOOLBAR_TOOL_TOGGLED = 1 << 8,
+ wxRIBBON_TOOLBAR_TOOL_STATE_MASK = 0x1F8
+};
+
+
+class WXDLLIMPEXP_RIBBON wxRibbonToolBar : public wxRibbonControl
+{
+public:
+ wxRibbonToolBar();
+
+ wxRibbonToolBar(wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0);
+
+ virtual ~wxRibbonToolBar();
+
+ bool Create(wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0);
+
+ virtual wxRibbonToolBarToolBase* AddTool(
+ int tool_id,
+ const wxBitmap& bitmap,
+ const wxString& help_string,
+ wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL);
+
+ virtual wxRibbonToolBarToolBase* AddDropdownTool(
+ int tool_id,
+ const wxBitmap& bitmap,
+ const wxString& help_string = wxEmptyString);
+
+ virtual wxRibbonToolBarToolBase* AddHybridTool(
+ int tool_id,
+ const wxBitmap& bitmap,
+ const wxString& help_string = wxEmptyString);
+
+ virtual wxRibbonToolBarToolBase* AddToggleTool(
+ int tool_id,
+ const wxBitmap& bitmap,
+ const wxString& help_string = wxEmptyString);
+
+ virtual wxRibbonToolBarToolBase* AddTool(
+ int tool_id,
+ const wxBitmap& bitmap,
+ const wxBitmap& bitmap_disabled = wxNullBitmap,
+ const wxString& help_string = wxEmptyString,
+ wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL,
+ wxObject* client_data = NULL);
+
+ virtual wxRibbonToolBarToolBase* AddSeparator();
+
+ virtual wxRibbonToolBarToolBase* InsertTool(
+ size_t pos,
+ int tool_id,
+ const wxBitmap& bitmap,
+ const wxString& help_string,
+ wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL);
+
+ virtual wxRibbonToolBarToolBase* InsertDropdownTool(
+ size_t pos,
+ int tool_id,
+ const wxBitmap& bitmap,
+ const wxString& help_string = wxEmptyString);
+
+ virtual wxRibbonToolBarToolBase* InsertHybridTool(
+ size_t pos,
+ int tool_id,
+ const wxBitmap& bitmap,
+ const wxString& help_string = wxEmptyString);
+
+ virtual wxRibbonToolBarToolBase* InsertToggleTool(
+ size_t pos,
+ int tool_id,
+ const wxBitmap& bitmap,
+ const wxString& help_string = wxEmptyString);
+
+ virtual wxRibbonToolBarToolBase* InsertTool(
+ size_t pos,
+ int tool_id,
+ const wxBitmap& bitmap,
+ const wxBitmap& bitmap_disabled = wxNullBitmap,
+ const wxString& help_string = wxEmptyString,
+ wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL,
+ wxObject* client_data = NULL);
+
+ virtual wxRibbonToolBarToolBase* InsertSeparator(size_t pos);
+
+ virtual void ClearTools();
+ virtual bool DeleteTool(int tool_id);
+ virtual bool DeleteToolByPos(size_t pos);
+
+ virtual wxRibbonToolBarToolBase* FindById(int tool_id)const;
+ virtual wxRibbonToolBarToolBase* GetToolByPos(size_t pos)const;
+ virtual size_t GetToolCount() const;
+ virtual int GetToolId(const wxRibbonToolBarToolBase* tool)const;
+
+ virtual wxObject* GetToolClientData(int tool_id)const;
+ virtual bool GetToolEnabled(int tool_id)const;
+ virtual wxString GetToolHelpString(int tool_id)const;
+ virtual wxRibbonButtonKind GetToolKind(int tool_id)const;
+ virtual int GetToolPos(int tool_id)const;
+ virtual bool GetToolState(int tool_id)const;
+
+ virtual bool Realize();
+ virtual void SetRows(int nMin, int nMax = -1);
+
+ virtual void SetToolClientData(int tool_id, wxObject* clientData);
+ virtual void SetToolDisabledBitmap(int tool_id, const wxBitmap &bitmap);
+ virtual void SetToolHelpString(int tool_id, const wxString& helpString);
+ virtual void SetToolNormalBitmap(int tool_id, const wxBitmap &bitmap);
+
+ virtual bool IsSizingContinuous() const;
+
+ virtual void EnableTool(int tool_id, bool enable = true);
+ virtual void ToggleTool(int tool_id, bool checked);
+
+ // Finds the best width and height given the parent's width and height
+ virtual wxSize GetBestSizeForParentSize(const wxSize& parentSize) const;
+
+protected:
+ friend class wxRibbonToolBarEvent;
+ virtual wxSize DoGetBestSize() const;
+ wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ void OnEraseBackground(wxEraseEvent& evt);
+ void OnMouseDown(wxMouseEvent& evt);
+ void OnMouseEnter(wxMouseEvent& evt);
+ void OnMouseLeave(wxMouseEvent& evt);
+ void OnMouseMove(wxMouseEvent& evt);
+ void OnMouseUp(wxMouseEvent& evt);
+ void OnPaint(wxPaintEvent& evt);
+ void OnSize(wxSizeEvent& evt);
+
+ virtual wxSize DoGetNextSmallerSize(wxOrientation direction,
+ wxSize relative_to) const;
+ virtual wxSize DoGetNextLargerSize(wxOrientation direction,
+ wxSize relative_to) const;
+
+ void CommonInit(long style);
+ void AppendGroup();
+ wxRibbonToolBarToolGroup* InsertGroup(size_t pos);
+ virtual void UpdateWindowUI(long flags);
+
+ static wxBitmap MakeDisabledBitmap(const wxBitmap& original);
+
+ wxArrayRibbonToolBarToolGroup m_groups;
+ wxRibbonToolBarToolBase* m_hover_tool;
+ wxRibbonToolBarToolBase* m_active_tool;
+ wxSize* m_sizes;
+ int m_nrows_min;
+ int m_nrows_max;
+
+#ifndef SWIG
+ DECLARE_CLASS(wxRibbonToolBar)
+ DECLARE_EVENT_TABLE()
+#endif
+};
+
+
+class WXDLLIMPEXP_RIBBON wxRibbonToolBarEvent : public wxCommandEvent
+{
+public:
+ wxRibbonToolBarEvent(wxEventType command_type = wxEVT_NULL,
+ int win_id = 0,
+ wxRibbonToolBar* bar = NULL)
+ : wxCommandEvent(command_type, win_id)
+ , m_bar(bar)
+ {
+ }
+#ifndef SWIG
+ wxRibbonToolBarEvent(const wxRibbonToolBarEvent& e) : wxCommandEvent(e)
+ {
+ m_bar = e.m_bar;
+ }
+#endif
+ wxEvent *Clone() const { return new wxRibbonToolBarEvent(*this); }
+
+ wxRibbonToolBar* GetBar() {return m_bar;}
+ void SetBar(wxRibbonToolBar* bar) {m_bar = bar;}
+ bool PopupMenu(wxMenu* menu);
+
+protected:
+ wxRibbonToolBar* m_bar;
+
+#ifndef SWIG
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRibbonToolBarEvent)
+#endif
+};
+
+#ifndef SWIG
+
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONTOOLBAR_CLICKED, wxRibbonToolBarEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONTOOLBAR_DROPDOWN_CLICKED, wxRibbonToolBarEvent);
+
+typedef void (wxEvtHandler::*wxRibbonToolBarEventFunction)(wxRibbonToolBarEvent&);
+
+#define wxRibbonToolBarEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxRibbonToolBarEventFunction, func)
+
+#define EVT_RIBBONTOOLBAR_CLICKED(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_RIBBONTOOLBAR_CLICKED, winid, wxRibbonToolBarEventHandler(fn))
+#define EVT_RIBBONTOOLBAR_DROPDOWN_CLICKED(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_RIBBONTOOLBAR_DROPDOWN_CLICKED, winid, wxRibbonToolBarEventHandler(fn))
+#else
+
+// wxpython/swig event work
+%constant wxEventType wxEVT_RIBBONTOOLBAR_CLICKED;
+%constant wxEventType wxEVT_RIBBONTOOLBAR_DROPDOWN_CLICKED;
+
+%pythoncode {
+ EVT_RIBBONTOOLBAR_CLICKED = wx.PyEventBinder( wxEVT_RIBBONTOOLBAR_CLICKED, 1 )
+ EVT_RIBBONTOOLBAR_DROPDOWN_CLICKED = wx.PyEventBinder( wxEVT_RIBBONTOOLBAR_DROPDOWN_CLICKED, 1 )
+}
+#endif
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_RIBBONTOOL_CLICKED wxEVT_RIBBONTOOLBAR_CLICKED
+#define wxEVT_COMMAND_RIBBONTOOL_DROPDOWN_CLICKED wxEVT_RIBBONTOOLBAR_DROPDOWN_CLICKED
+
+#endif // wxUSE_RIBBON
+
+#endif // _WX_RIBBON_TOOLBAR_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richmsgdlg.h
+// Purpose: wxRichMessageDialogBase
+// Author: Rickard Westerlund
+// Created: 2010-07-03
+// Copyright: (c) 2010 wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RICHMSGDLG_H_BASE_
+#define _WX_RICHMSGDLG_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_RICHMSGDLG
+
+#include "wx/msgdlg.h"
+
+// Extends a message dialog with an optional checkbox and user-expandable
+// detailed text.
+class WXDLLIMPEXP_CORE wxRichMessageDialogBase : public wxGenericMessageDialog
+{
+public:
+ wxRichMessageDialogBase( wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ long style )
+ : wxGenericMessageDialog( parent, message, caption, style ),
+ m_detailsExpanderCollapsedLabel( wxGetTranslation("&See details") ),
+ m_detailsExpanderExpandedLabel( wxGetTranslation("&Hide details") ),
+ m_checkBoxValue( false )
+ { }
+
+ void ShowCheckBox(const wxString& checkBoxText, bool checked = false)
+ {
+ m_checkBoxText = checkBoxText;
+ m_checkBoxValue = checked;
+ }
+
+ wxString GetCheckBoxText() const { return m_checkBoxText; }
+
+ void ShowDetailedText(const wxString& detailedText)
+ { m_detailedText = detailedText; }
+
+ wxString GetDetailedText() const { return m_detailedText; }
+
+ virtual bool IsCheckBoxChecked() const { return m_checkBoxValue; }
+
+protected:
+ const wxString m_detailsExpanderCollapsedLabel;
+ const wxString m_detailsExpanderExpandedLabel;
+
+ wxString m_checkBoxText;
+ bool m_checkBoxValue;
+ wxString m_detailedText;
+
+private:
+ void ShowDetails(bool shown);
+
+ wxDECLARE_NO_COPY_CLASS(wxRichMessageDialogBase);
+};
+
+// Always include the generic version as it's currently used as the base class
+// by the MSW native implementation too.
+#include "wx/generic/richmsgdlgg.h"
+
+#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
+ #include "wx/msw/richmsgdlg.h"
+#else
+ class WXDLLIMPEXP_CORE wxRichMessageDialog
+ : public wxGenericRichMessageDialog
+ {
+ public:
+ wxRichMessageDialog( wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ long style )
+ : wxGenericRichMessageDialog( parent, message, caption, style )
+ { }
+
+ private:
+ wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxRichMessageDialog);
+ };
+#endif
+
+#endif // wxUSE_RICHMSGDLG
+
+#endif // _WX_RICHMSGDLG_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtextbackgroundpage.h
+// Purpose:
+// Author: Julian Smart
+// Modified by:
+// Created: 13/11/2010 11:17:25
+// RCS-ID:
+// Copyright: (c) Julian Smart
+// Licence:
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _RICHTEXTBACKGROUNDPAGE_H_
+#define _RICHTEXTBACKGROUNDPAGE_H_
+
+/*!
+ * Includes
+ */
+
+#include "wx/richtext/richtextdialogpage.h"
+
+////@begin includes
+#include "wx/statline.h"
+////@end includes
+
+/*!
+ * Forward declarations
+ */
+
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextColourSwatchCtrl;
+
+/*!
+ * Control identifiers
+ */
+
+////@begin control identifiers
+#define SYMBOL_WXRICHTEXTBACKGROUNDPAGE_STYLE wxTAB_TRAVERSAL
+#define SYMBOL_WXRICHTEXTBACKGROUNDPAGE_TITLE wxEmptyString
+#define SYMBOL_WXRICHTEXTBACKGROUNDPAGE_IDNAME ID_RICHTEXTBACKGROUNDPAGE
+#define SYMBOL_WXRICHTEXTBACKGROUNDPAGE_SIZE wxSize(400, 300)
+#define SYMBOL_WXRICHTEXTBACKGROUNDPAGE_POSITION wxDefaultPosition
+////@end control identifiers
+
+
+/*!
+ * wxRichTextBackgroundPage class declaration
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextBackgroundPage: public wxRichTextDialogPage
+{
+ DECLARE_DYNAMIC_CLASS( wxRichTextBackgroundPage )
+ DECLARE_EVENT_TABLE()
+ DECLARE_HELP_PROVISION()
+
+public:
+ /// Constructors
+ wxRichTextBackgroundPage();
+ wxRichTextBackgroundPage( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_STYLE );
+
+ /// Creation
+ bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_STYLE );
+
+ /// Destructor
+ ~wxRichTextBackgroundPage();
+
+ /// Initialises member variables
+ void Init();
+
+ /// Creates the controls and sizers
+ void CreateControls();
+
+ /// Gets the attributes from the formatting dialog
+ wxRichTextAttr* GetAttributes();
+
+ /// Data transfer
+ virtual bool TransferDataToWindow();
+ virtual bool TransferDataFromWindow();
+
+ /// Respond to colour swatch click
+ void OnColourSwatch(wxCommandEvent& event);
+
+////@begin wxRichTextBackgroundPage event handler declarations
+
+////@end wxRichTextBackgroundPage event handler declarations
+
+////@begin wxRichTextBackgroundPage member function declarations
+
+ /// Retrieves bitmap resources
+ wxBitmap GetBitmapResource( const wxString& name );
+
+ /// Retrieves icon resources
+ wxIcon GetIconResource( const wxString& name );
+////@end wxRichTextBackgroundPage member function declarations
+
+ /// Should we show tooltips?
+ static bool ShowToolTips();
+
+////@begin wxRichTextBackgroundPage member variables
+ wxCheckBox* m_backgroundColourCheckBox;
+ wxRichTextColourSwatchCtrl* m_backgroundColourSwatch;
+ /// Control identifiers
+ enum {
+ ID_RICHTEXTBACKGROUNDPAGE = 10845,
+ ID_RICHTEXT_BACKGROUND_COLOUR_CHECKBOX = 10846,
+ ID_RICHTEXT_BACKGROUND_COLOUR_SWATCH = 10847
+ };
+////@end wxRichTextBackgroundPage member variables
+};
+
+#endif
+ // _RICHTEXTBACKGROUNDPAGE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtextborderspage.h
+// Purpose: A border editing page for the wxRTC formatting dialog.
+// Author: Julian Smart
+// Modified by:
+// Created: 21/10/2010 11:34:24
+// RCS-ID:
+// Copyright: (c) Julian Smart
+// Licence:
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _RICHTEXTBORDERSPAGE_H_
+#define _RICHTEXTBORDERSPAGE_H_
+
+/*!
+ * Includes
+ */
+
+#include "wx/richtext/richtextdialogpage.h"
+
+////@begin includes
+#include "wx/notebook.h"
+#include "wx/statline.h"
+////@end includes
+
+/*!
+ * Forward declarations
+ */
+
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextColourSwatchCtrl;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextBorderPreviewCtrl;
+
+/*!
+ * Control identifiers
+ */
+
+////@begin control identifiers
+#define SYMBOL_WXRICHTEXTBORDERSPAGE_STYLE wxTAB_TRAVERSAL
+#define SYMBOL_WXRICHTEXTBORDERSPAGE_TITLE wxEmptyString
+#define SYMBOL_WXRICHTEXTBORDERSPAGE_IDNAME ID_RICHTEXTBORDERSPAGE
+#define SYMBOL_WXRICHTEXTBORDERSPAGE_SIZE wxSize(400, 300)
+#define SYMBOL_WXRICHTEXTBORDERSPAGE_POSITION wxDefaultPosition
+////@end control identifiers
+
+
+/*!
+ * wxRichTextBordersPage class declaration
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextBordersPage: public wxRichTextDialogPage
+{
+ DECLARE_DYNAMIC_CLASS( wxRichTextBordersPage )
+ DECLARE_EVENT_TABLE()
+ DECLARE_HELP_PROVISION()
+
+public:
+ /// Constructors
+ wxRichTextBordersPage();
+ wxRichTextBordersPage( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTBORDERSPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTBORDERSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBORDERSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBORDERSPAGE_STYLE );
+
+ /// Creation
+ bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTBORDERSPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTBORDERSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBORDERSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBORDERSPAGE_STYLE );
+
+ /// Destructor
+ ~wxRichTextBordersPage();
+
+ /// Initialises member variables
+ void Init();
+
+ /// Creates the controls and sizers
+ void CreateControls();
+
+ /// Gets the attributes from the formatting dialog
+ wxRichTextAttr* GetAttributes();
+
+ /// Data transfer
+ virtual bool TransferDataToWindow();
+ virtual bool TransferDataFromWindow();
+
+ /// Updates the synchronization checkboxes to reflect the state of the attributes
+ void UpdateSyncControls();
+
+ /// Updates the preview
+ void OnCommand(wxCommandEvent& event);
+
+ /// Fill style combo
+ virtual void FillStyleComboBox(wxComboBox* styleComboBox);
+
+ /// Set the border controls
+ static void SetBorderValue(wxTextAttrBorder& border, wxTextCtrl* widthValueCtrl, wxComboBox* widthUnitsCtrl, wxCheckBox* checkBox,
+ wxComboBox* styleCtrl, wxRichTextColourSwatchCtrl* colourCtrl, const wxArrayInt& borderStyles);
+
+ /// Get data from the border controls
+ static void GetBorderValue(wxTextAttrBorder& border, wxTextCtrl* widthValueCtrl, wxComboBox* widthUnitsCtrl, wxCheckBox* checkBox,
+ wxComboBox* styleCtrl, wxRichTextColourSwatchCtrl* colourCtrl, const wxArrayInt& borderStyles);
+
+////@begin wxRichTextBordersPage event handler declarations
+
+ /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXT_BORDER_LEFT_CHECKBOX
+ void OnRichtextBorderCheckboxClick( wxCommandEvent& event );
+
+ /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXT_BORDER_LEFT
+ void OnRichtextBorderLeftValueTextUpdated( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_LEFT
+ void OnRichtextBorderLeftUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXT_BORDER_LEFT_UNITS
+ void OnRichtextBorderLeftUnitsSelected( wxCommandEvent& event );
+
+ /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXT_BORDER_LEFT_STYLE
+ void OnRichtextBorderLeftStyleSelected( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_RIGHT_CHECKBOX
+ void OnRichtextBorderOtherCheckboxUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_RIGHT
+ void OnRichtextBorderRightUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_TOP
+ void OnRichtextBorderTopUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_BOTTOM
+ void OnRichtextBorderBottomUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXT_BORDER_SYNCHRONIZE
+ void OnRichtextBorderSynchronizeClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_SYNCHRONIZE
+ void OnRichtextBorderSynchronizeUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXT_OUTLINE_LEFT
+ void OnRichtextOutlineLeftTextUpdated( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_LEFT
+ void OnRichtextOutlineLeftUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXT_OUTLINE_LEFT_UNITS
+ void OnRichtextOutlineLeftUnitsSelected( wxCommandEvent& event );
+
+ /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXT_OUTLINE_LEFT_STYLE
+ void OnRichtextOutlineLeftStyleSelected( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_RIGHT_CHECKBOX
+ void OnRichtextOutlineOtherCheckboxUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_RIGHT
+ void OnRichtextOutlineRightUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_TOP
+ void OnRichtextOutlineTopUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_BOTTOM
+ void OnRichtextOutlineBottomUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXT_OUTLINE_SYNCHRONIZE
+ void OnRichtextOutlineSynchronizeClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_SYNCHRONIZE
+ void OnRichtextOutlineSynchronizeUpdate( wxUpdateUIEvent& event );
+
+////@end wxRichTextBordersPage event handler declarations
+
+////@begin wxRichTextBordersPage member function declarations
+
+ /// Retrieves bitmap resources
+ wxBitmap GetBitmapResource( const wxString& name );
+
+ /// Retrieves icon resources
+ wxIcon GetIconResource( const wxString& name );
+////@end wxRichTextBordersPage member function declarations
+
+ /// Should we show tooltips?
+ static bool ShowToolTips();
+
+////@begin wxRichTextBordersPage member variables
+ wxCheckBox* m_leftBorderCheckbox;
+ wxTextCtrl* m_leftBorderWidth;
+ wxComboBox* m_leftBorderWidthUnits;
+ wxComboBox* m_leftBorderStyle;
+ wxRichTextColourSwatchCtrl* m_leftBorderColour;
+ wxCheckBox* m_rightBorderCheckbox;
+ wxTextCtrl* m_rightBorderWidth;
+ wxComboBox* m_rightBorderWidthUnits;
+ wxComboBox* m_rightBorderStyle;
+ wxRichTextColourSwatchCtrl* m_rightBorderColour;
+ wxCheckBox* m_topBorderCheckbox;
+ wxTextCtrl* m_topBorderWidth;
+ wxComboBox* m_topBorderWidthUnits;
+ wxComboBox* m_topBorderStyle;
+ wxRichTextColourSwatchCtrl* m_topBorderColour;
+ wxCheckBox* m_bottomBorderCheckbox;
+ wxTextCtrl* m_bottomBorderWidth;
+ wxComboBox* m_bottomBorderWidthUnits;
+ wxComboBox* m_bottomBorderStyle;
+ wxRichTextColourSwatchCtrl* m_bottomBorderColour;
+ wxCheckBox* m_borderSyncCtrl;
+ wxCheckBox* m_leftOutlineCheckbox;
+ wxTextCtrl* m_leftOutlineWidth;
+ wxComboBox* m_leftOutlineWidthUnits;
+ wxComboBox* m_leftOutlineStyle;
+ wxRichTextColourSwatchCtrl* m_leftOutlineColour;
+ wxCheckBox* m_rightOutlineCheckbox;
+ wxTextCtrl* m_rightOutlineWidth;
+ wxComboBox* m_rightOutlineWidthUnits;
+ wxComboBox* m_rightOutlineStyle;
+ wxRichTextColourSwatchCtrl* m_rightOutlineColour;
+ wxCheckBox* m_topOutlineCheckbox;
+ wxTextCtrl* m_topOutlineWidth;
+ wxComboBox* m_topOutlineWidthUnits;
+ wxComboBox* m_topOutlineStyle;
+ wxRichTextColourSwatchCtrl* m_topOutlineColour;
+ wxCheckBox* m_bottomOutlineCheckbox;
+ wxTextCtrl* m_bottomOutlineWidth;
+ wxComboBox* m_bottomOutlineWidthUnits;
+ wxComboBox* m_bottomOutlineStyle;
+ wxRichTextColourSwatchCtrl* m_bottomOutlineColour;
+ wxCheckBox* m_outlineSyncCtrl;
+ wxRichTextBorderPreviewCtrl* m_borderPreviewCtrl;
+ /// Control identifiers
+ enum {
+ ID_RICHTEXTBORDERSPAGE = 10800,
+ ID_RICHTEXTBORDERSPAGE_NOTEBOOK = 10801,
+ ID_RICHTEXTBORDERSPAGE_BORDERS = 10802,
+ ID_RICHTEXT_BORDER_LEFT_CHECKBOX = 10803,
+ ID_RICHTEXT_BORDER_LEFT = 10804,
+ ID_RICHTEXT_BORDER_LEFT_UNITS = 10805,
+ ID_RICHTEXT_BORDER_LEFT_STYLE = 10806,
+ ID_RICHTEXT_BORDER_LEFT_COLOUR = 10807,
+ ID_RICHTEXT_BORDER_RIGHT_CHECKBOX = 10808,
+ ID_RICHTEXT_BORDER_RIGHT = 10809,
+ ID_RICHTEXT_BORDER_RIGHT_UNITS = 10810,
+ ID_RICHTEXT_BORDER_RIGHT_STYLE = 10811,
+ ID_RICHTEXT_BORDER_RIGHT_COLOUR = 10812,
+ ID_RICHTEXT_BORDER_TOP_CHECKBOX = 10813,
+ ID_RICHTEXT_BORDER_TOP = 10814,
+ ID_RICHTEXT_BORDER_TOP_UNITS = 10815,
+ ID_RICHTEXT_BORDER_TOP_STYLE = 10816,
+ ID_RICHTEXT_BORDER_TOP_COLOUR = 10817,
+ ID_RICHTEXT_BORDER_BOTTOM_CHECKBOX = 10818,
+ ID_RICHTEXT_BORDER_BOTTOM = 10819,
+ ID_RICHTEXT_BORDER_BOTTOM_UNITS = 10820,
+ ID_RICHTEXT_BORDER_BOTTOM_STYLE = 10821,
+ ID_RICHTEXT_BORDER_BOTTOM_COLOUR = 10822,
+ ID_RICHTEXT_BORDER_SYNCHRONIZE = 10845,
+ ID_RICHTEXTBORDERSPAGE_OUTLINE = 10823,
+ ID_RICHTEXT_OUTLINE_LEFT_CHECKBOX = 10824,
+ ID_RICHTEXT_OUTLINE_LEFT = 10825,
+ ID_RICHTEXT_OUTLINE_LEFT_UNITS = 10826,
+ ID_RICHTEXT_OUTLINE_LEFT_STYLE = 10827,
+ ID_RICHTEXT_OUTLINE_LEFT_COLOUR = 10828,
+ ID_RICHTEXT_OUTLINE_RIGHT_CHECKBOX = 10829,
+ ID_RICHTEXT_OUTLINE_RIGHT = 10830,
+ ID_RICHTEXT_OUTLINE_RIGHT_UNITS = 10831,
+ ID_RICHTEXT_OUTLINE_RIGHT_STYLE = 10832,
+ ID_RICHTEXT_OUTLINE_RIGHT_COLOUR = 10833,
+ ID_RICHTEXT_OUTLINE_TOP_CHECKBOX = 10834,
+ ID_RICHTEXT_OUTLINE_TOP = 10835,
+ ID_RICHTEXT_OUTLINE_TOP_UNITS = 10836,
+ ID_RICHTEXT_OUTLINE_TOP_STYLE = 10837,
+ ID_RICHTEXT_OUTLINE_TOP_COLOUR = 10838,
+ ID_RICHTEXT_OUTLINE_BOTTOM_CHECKBOX = 10839,
+ ID_RICHTEXT_OUTLINE_BOTTOM = 10840,
+ ID_RICHTEXT_OUTLINE_BOTTOM_UNITS = 10841,
+ ID_RICHTEXT_OUTLINE_BOTTOM_STYLE = 10842,
+ ID_RICHTEXT_OUTLINE_BOTTOM_COLOUR = 10843,
+ ID_RICHTEXT_OUTLINE_SYNCHRONIZE = 10846,
+ ID_RICHTEXT_BORDER_PREVIEW = 10844
+ };
+////@end wxRichTextBordersPage member variables
+
+ wxArrayInt m_borderStyles;
+ wxArrayString m_borderStyleNames;
+ bool m_ignoreUpdates;
+};
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextBorderPreviewCtrl : public wxWindow
+{
+public:
+ wxRichTextBorderPreviewCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, long style = 0);
+
+ void SetAttributes(wxRichTextAttr* attr) { m_attributes = attr; }
+ wxRichTextAttr* GetAttributes() const { return m_attributes; }
+
+private:
+ wxRichTextAttr* m_attributes;
+
+ void OnPaint(wxPaintEvent& event);
+ DECLARE_EVENT_TABLE()
+};
+
+#endif
+ // _RICHTEXTBORDERSPAGE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtextbuffer.h
+// Purpose: Buffer for wxRichTextCtrl
+// Author: Julian Smart
+// Modified by:
+// Created: 2005-09-30
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RICHTEXTBUFFER_H_
+#define _WX_RICHTEXTBUFFER_H_
+
+/*
+
+ Data structures
+ ===============
+
+ Data is represented by a hierarchy of objects, all derived from
+ wxRichTextObject.
+
+ The top of the hierarchy is the buffer, a kind of wxRichTextParagraphLayoutBox.
+ These boxes will allow flexible placement of text boxes on a page, but
+ for now there is a single box representing the document, and this box is
+ a wxRichTextParagraphLayoutBox which contains further wxRichTextParagraph
+ objects, each of which can include text and images.
+
+ Each object maintains a range (start and end position) measured
+ from the start of the main parent box.
+ A paragraph object knows its range, and a text fragment knows its range
+ too. So, a character or image in a page has a position relative to the
+ start of the document, and a character in an embedded text box has
+ a position relative to that text box. For now, we will not be dealing with
+ embedded objects but it's something to bear in mind for later.
+
+ Note that internally, a range (5,5) represents a range of one character.
+ In the public wx[Rich]TextCtrl API, this would be passed to e.g. SetSelection
+ as (5,6). A paragraph with one character might have an internal range of (0, 1)
+ since the end of the paragraph takes up one position.
+
+ Layout
+ ======
+
+ When Layout is called on an object, it is given a size which the object
+ must limit itself to, or one or more flexible directions (vertical
+ or horizontal). So for example a centered paragraph is given the page
+ width to play with (minus any margins), but can extend indefinitely
+ in the vertical direction. The implementation of Layout can then
+ cache the calculated size and position within the parent.
+
+ */
+
+/*!
+ * Includes
+ */
+
+#include "wx/defs.h"
+
+#if wxUSE_RICHTEXT
+
+#include "wx/list.h"
+#include "wx/textctrl.h"
+#include "wx/bitmap.h"
+#include "wx/image.h"
+#include "wx/cmdproc.h"
+#include "wx/txtstrm.h"
+#include "wx/variant.h"
+#include "wx/position.h"
+
+#if wxUSE_DATAOBJ
+#include "wx/dataobj.h"
+#endif
+
+// Compatibility
+//#define wxRichTextAttr wxTextAttr
+#define wxTextAttrEx wxTextAttr
+
+// Setting wxRICHTEXT_USE_OWN_CARET to 1 implements a
+// caret reliably without using wxClientDC in case there
+// are platform-specific problems with the generic caret.
+#if defined(__WXGTK__) || defined(__WXMAC__)
+#define wxRICHTEXT_USE_OWN_CARET 1
+#else
+#define wxRICHTEXT_USE_OWN_CARET 0
+#endif
+
+// Switch off for binary compatibility, on for faster drawing
+// Note: this seems to be buggy (overzealous use of extents) so
+// don't use for now
+#define wxRICHTEXT_USE_OPTIMIZED_LINE_DRAWING 0
+
+// The following two symbols determine whether an output implementation
+// is present. To switch the relevant one on, set wxRICHTEXT_USE_XMLDOCUMENT_OUTPUT in
+// richtextxml.cpp. By default, the faster direct output implementation is used.
+
+// Include the wxXmlDocument implementation for output
+#define wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT 1
+
+// Include the faster, direct implementation for output
+#define wxRICHTEXT_HAVE_DIRECT_OUTPUT 1
+
+/**
+ The line break character that can be embedded in content.
+ */
+
+extern WXDLLIMPEXP_RICHTEXT const wxChar wxRichTextLineBreakChar;
+
+/**
+ File types in wxRichText context.
+ */
+enum wxRichTextFileType
+{
+ wxRICHTEXT_TYPE_ANY = 0,
+ wxRICHTEXT_TYPE_TEXT,
+ wxRICHTEXT_TYPE_XML,
+ wxRICHTEXT_TYPE_HTML,
+ wxRICHTEXT_TYPE_RTF,
+ wxRICHTEXT_TYPE_PDF
+};
+
+/*
+ * Forward declarations
+ */
+
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCtrl;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextObject;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextImage;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextPlainText;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCacheObject;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextObjectList;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextLine;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextParagraph;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextFileHandler;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextDrawingHandler;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextField;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextFieldType;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleSheet;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextListStyleDefinition;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextEvent;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextRenderer;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextBuffer;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextXMLHandler;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextParagraphLayoutBox;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextImageBlock;
+class WXDLLIMPEXP_FWD_XML wxXmlNode;
+class wxRichTextFloatCollector;
+class WXDLLIMPEXP_FWD_BASE wxDataInputStream;
+class WXDLLIMPEXP_FWD_BASE wxDataOutputStream;
+
+/**
+ Flags determining the available space, passed to Layout.
+ */
+
+#define wxRICHTEXT_FIXED_WIDTH 0x01
+#define wxRICHTEXT_FIXED_HEIGHT 0x02
+#define wxRICHTEXT_VARIABLE_WIDTH 0x04
+#define wxRICHTEXT_VARIABLE_HEIGHT 0x08
+
+// Only lay out the part of the buffer that lies within
+// the rect passed to Layout.
+#define wxRICHTEXT_LAYOUT_SPECIFIED_RECT 0x10
+
+/**
+ Flags to pass to Draw
+ */
+
+// Ignore paragraph cache optimization, e.g. for printing purposes
+// where one line may be drawn higher (on the next page) compared
+// with the previous line
+#define wxRICHTEXT_DRAW_IGNORE_CACHE 0x01
+#define wxRICHTEXT_DRAW_SELECTED 0x02
+#define wxRICHTEXT_DRAW_PRINT 0x04
+#define wxRICHTEXT_DRAW_GUIDELINES 0x08
+
+/**
+ Flags returned from hit-testing, or passed to hit-test function.
+ */
+enum wxRichTextHitTestFlags
+{
+ // The point was not on this object
+ wxRICHTEXT_HITTEST_NONE = 0x01,
+
+ // The point was before the position returned from HitTest
+ wxRICHTEXT_HITTEST_BEFORE = 0x02,
+
+ // The point was after the position returned from HitTest
+ wxRICHTEXT_HITTEST_AFTER = 0x04,
+
+ // The point was on the position returned from HitTest
+ wxRICHTEXT_HITTEST_ON = 0x08,
+
+ // The point was on space outside content
+ wxRICHTEXT_HITTEST_OUTSIDE = 0x10,
+
+ // Only do hit-testing at the current level (don't traverse into top-level objects)
+ wxRICHTEXT_HITTEST_NO_NESTED_OBJECTS = 0x20,
+
+ // Ignore floating objects
+ wxRICHTEXT_HITTEST_NO_FLOATING_OBJECTS = 0x40,
+
+ // Don't recurse into objects marked as atomic
+ wxRICHTEXT_HITTEST_HONOUR_ATOMIC = 0x80
+};
+
+/**
+ Flags for GetRangeSize.
+ */
+
+#define wxRICHTEXT_FORMATTED 0x01
+#define wxRICHTEXT_UNFORMATTED 0x02
+#define wxRICHTEXT_CACHE_SIZE 0x04
+#define wxRICHTEXT_HEIGHT_ONLY 0x08
+
+/**
+ Flags for SetStyle/SetListStyle.
+ */
+
+#define wxRICHTEXT_SETSTYLE_NONE 0x00
+
+// Specifies that this operation should be undoable
+#define wxRICHTEXT_SETSTYLE_WITH_UNDO 0x01
+
+// Specifies that the style should not be applied if the
+// combined style at this point is already the style in question.
+#define wxRICHTEXT_SETSTYLE_OPTIMIZE 0x02
+
+// Specifies that the style should only be applied to paragraphs,
+// and not the content. This allows content styling to be
+// preserved independently from that of e.g. a named paragraph style.
+#define wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY 0x04
+
+// Specifies that the style should only be applied to characters,
+// and not the paragraph. This allows content styling to be
+// preserved independently from that of e.g. a named paragraph style.
+#define wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY 0x08
+
+// For SetListStyle only: specifies starting from the given number, otherwise
+// deduces number from existing attributes
+#define wxRICHTEXT_SETSTYLE_RENUMBER 0x10
+
+// For SetListStyle only: specifies the list level for all paragraphs, otherwise
+// the current indentation will be used
+#define wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL 0x20
+
+// Resets the existing style before applying the new style
+#define wxRICHTEXT_SETSTYLE_RESET 0x40
+
+// Removes the given style instead of applying it
+#define wxRICHTEXT_SETSTYLE_REMOVE 0x80
+
+/**
+ Flags for SetProperties.
+ */
+
+#define wxRICHTEXT_SETPROPERTIES_NONE 0x00
+
+// Specifies that this operation should be undoable
+#define wxRICHTEXT_SETPROPERTIES_WITH_UNDO 0x01
+
+// Specifies that the properties should only be applied to paragraphs,
+// and not the content.
+#define wxRICHTEXT_SETPROPERTIES_PARAGRAPHS_ONLY 0x02
+
+// Specifies that the properties should only be applied to characters,
+// and not the paragraph.
+#define wxRICHTEXT_SETPROPERTIES_CHARACTERS_ONLY 0x04
+
+// Resets the existing properties before applying the new properties.
+#define wxRICHTEXT_SETPROPERTIES_RESET 0x08
+
+// Removes the given properties instead of applying them.
+#define wxRICHTEXT_SETPROPERTIES_REMOVE 0x10
+
+/**
+ Flags for object insertion.
+ */
+
+#define wxRICHTEXT_INSERT_NONE 0x00
+#define wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE 0x01
+#define wxRICHTEXT_INSERT_INTERACTIVE 0x02
+
+// A special flag telling the buffer to keep the first paragraph style
+// as-is, when deleting a paragraph marker. In future we might pass a
+// flag to InsertFragment and DeleteRange to indicate the appropriate mode.
+#define wxTEXT_ATTR_KEEP_FIRST_PARA_STYLE 0x20000000
+
+/**
+ Default superscript/subscript font multiplication factor.
+ */
+
+#define wxSCRIPT_MUL_FACTOR 1.5
+
+/**
+ The type for wxTextAttrDimension flags.
+ */
+typedef unsigned short wxTextAttrDimensionFlags;
+
+/**
+ Miscellaneous text box flags
+ */
+enum wxTextBoxAttrFlags
+{
+ wxTEXT_BOX_ATTR_FLOAT = 0x00000001,
+ wxTEXT_BOX_ATTR_CLEAR = 0x00000002,
+ wxTEXT_BOX_ATTR_COLLAPSE_BORDERS = 0x00000004,
+ wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT = 0x00000008,
+ wxTEXT_BOX_ATTR_BOX_STYLE_NAME = 0x00000010
+};
+
+/**
+ Whether a value is present, used in dimension flags.
+ */
+enum wxTextAttrValueFlags
+{
+ wxTEXT_ATTR_VALUE_VALID = 0x1000,
+ wxTEXT_ATTR_VALUE_VALID_MASK = 0x1000
+};
+
+/**
+ Units, included in the dimension value.
+ */
+enum wxTextAttrUnits
+{
+ wxTEXT_ATTR_UNITS_TENTHS_MM = 0x0001,
+ wxTEXT_ATTR_UNITS_PIXELS = 0x0002,
+ wxTEXT_ATTR_UNITS_PERCENTAGE = 0x0004,
+ wxTEXT_ATTR_UNITS_POINTS = 0x0008,
+ wxTEXT_ATTR_UNITS_HUNDREDTHS_POINT = 0x0100,
+
+ wxTEXT_ATTR_UNITS_MASK = 0x010F
+};
+
+/**
+ Position alternatives, included in the dimension flags.
+ */
+enum wxTextBoxAttrPosition
+{
+ wxTEXT_BOX_ATTR_POSITION_STATIC = 0x0000, // Default is static, i.e. as per normal layout
+ wxTEXT_BOX_ATTR_POSITION_RELATIVE = 0x0010, // Relative to the relevant edge
+ wxTEXT_BOX_ATTR_POSITION_ABSOLUTE = 0x0020, // Relative to the parent
+ wxTEXT_BOX_ATTR_POSITION_FIXED = 0x0040, // Relative to the top-level window
+
+ wxTEXT_BOX_ATTR_POSITION_MASK = 0x00F0
+};
+
+/**
+ @class wxTextAttrDimension
+
+ A class representing a rich text dimension, including units and position.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextAttr, wxRichTextCtrl, wxTextAttrDimensions
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxTextAttrDimension
+{
+public:
+ /**
+ Default constructor.
+ */
+ wxTextAttrDimension() { Reset(); }
+ /**
+ Constructor taking value and units flag.
+ */
+ wxTextAttrDimension(int value, wxTextAttrUnits units = wxTEXT_ATTR_UNITS_TENTHS_MM) { m_value = value; m_flags = units|wxTEXT_ATTR_VALUE_VALID; }
+
+ /**
+ Resets the dimension value and flags.
+ */
+ void Reset() { m_value = 0; m_flags = 0; }
+
+ /**
+ Partial equality test. If @a weakTest is @true, attributes of this object do not
+ have to be present if those attributes of @a dim are present. If @a weakTest is
+ @false, the function will fail if an attribute is present in @a dim but not
+ in this object.
+ */
+ bool EqPartial(const wxTextAttrDimension& dim, bool weakTest = true) const;
+
+ /** Apply the dimension, but not those identical to @a compareWith if present.
+ */
+ bool Apply(const wxTextAttrDimension& dim, const wxTextAttrDimension* compareWith = NULL);
+
+ /** Collects the attributes that are common to a range of content, building up a note of
+ which attributes are absent in some objects and which clash in some objects.
+ */
+ void CollectCommonAttributes(const wxTextAttrDimension& attr, wxTextAttrDimension& clashingAttr, wxTextAttrDimension& absentAttr);
+
+ /**
+ Equality operator.
+ */
+ bool operator==(const wxTextAttrDimension& dim) const { return m_value == dim.m_value && m_flags == dim.m_flags; }
+
+ /**
+ Returns the integer value of the dimension.
+ */
+ int GetValue() const { return m_value; }
+
+ /**
+ Returns the floating-pointing value of the dimension in mm.
+
+ */
+ float GetValueMM() const { return float(m_value) / 10.0; }
+
+ /**
+ Sets the value of the dimension in mm.
+ */
+ void SetValueMM(float value) { m_value = (int) ((value * 10.0) + 0.5); m_flags |= wxTEXT_ATTR_VALUE_VALID; }
+
+ /**
+ Sets the integer value of the dimension.
+ */
+ void SetValue(int value) { m_value = value; m_flags |= wxTEXT_ATTR_VALUE_VALID; }
+
+ /**
+ Sets the integer value of the dimension, passing dimension flags.
+ */
+ void SetValue(int value, wxTextAttrDimensionFlags flags) { SetValue(value); m_flags = flags; }
+
+ /**
+ Sets the integer value and units.
+ */
+ void SetValue(int value, wxTextAttrUnits units) { m_value = value; m_flags = units | wxTEXT_ATTR_VALUE_VALID; }
+
+ /**
+ Sets the dimension.
+ */
+ void SetValue(const wxTextAttrDimension& dim) { (*this) = dim; }
+
+ /**
+ Gets the units of the dimension.
+ */
+ wxTextAttrUnits GetUnits() const { return (wxTextAttrUnits) (m_flags & wxTEXT_ATTR_UNITS_MASK); }
+
+ /**
+ Sets the units of the dimension.
+ */
+ void SetUnits(wxTextAttrUnits units) { m_flags &= ~wxTEXT_ATTR_UNITS_MASK; m_flags |= units; }
+
+ /**
+ Gets the position flags.
+ */
+ wxTextBoxAttrPosition GetPosition() const { return (wxTextBoxAttrPosition) (m_flags & wxTEXT_BOX_ATTR_POSITION_MASK); }
+
+ /**
+ Sets the position flags.
+ */
+ void SetPosition(wxTextBoxAttrPosition pos) { m_flags &= ~wxTEXT_BOX_ATTR_POSITION_MASK; m_flags |= pos; }
+
+ /**
+ Returns @true if the dimension is valid.
+ */
+ bool IsValid() const { return (m_flags & wxTEXT_ATTR_VALUE_VALID) != 0; }
+
+ /**
+ Sets the valid flag.
+ */
+ void SetValid(bool b) { m_flags &= ~wxTEXT_ATTR_VALUE_VALID_MASK; m_flags |= (b ? wxTEXT_ATTR_VALUE_VALID : 0); }
+
+ /**
+ Gets the dimension flags.
+ */
+ wxTextAttrDimensionFlags GetFlags() const { return m_flags; }
+
+ /**
+ Sets the dimension flags.
+ */
+ void SetFlags(wxTextAttrDimensionFlags flags) { m_flags = flags; }
+
+ int m_value;
+ wxTextAttrDimensionFlags m_flags;
+};
+
+/**
+ @class wxTextAttrDimensions
+ A class for left, right, top and bottom dimensions.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextAttr, wxRichTextCtrl, wxTextAttrDimension
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxTextAttrDimensions
+{
+public:
+ /**
+ Default constructor.
+ */
+ wxTextAttrDimensions() {}
+
+ /**
+ Resets the value and flags for all dimensions.
+ */
+ void Reset() { m_left.Reset(); m_top.Reset(); m_right.Reset(); m_bottom.Reset(); }
+
+ /**
+ Equality operator.
+ */
+ bool operator==(const wxTextAttrDimensions& dims) const { return m_left == dims.m_left && m_top == dims.m_top && m_right == dims.m_right && m_bottom == dims.m_bottom; }
+
+ /**
+ Partial equality test. If @a weakTest is @true, attributes of this object do not
+ have to be present if those attributes of @a dim sare present. If @a weakTest is
+ @false, the function will fail if an attribute is present in @a dims but not
+ in this object.
+
+ */
+ bool EqPartial(const wxTextAttrDimensions& dims, bool weakTest = true) const;
+
+ /**
+ Apply to 'this', but not if the same as @a compareWith.
+
+ */
+ bool Apply(const wxTextAttrDimensions& dims, const wxTextAttrDimensions* compareWith = NULL);
+
+ /**
+ Collects the attributes that are common to a range of content, building up a note of
+ which attributes are absent in some objects and which clash in some objects.
+
+ */
+ void CollectCommonAttributes(const wxTextAttrDimensions& attr, wxTextAttrDimensions& clashingAttr, wxTextAttrDimensions& absentAttr);
+
+ /**
+ Remove specified attributes from this object.
+ */
+ bool RemoveStyle(const wxTextAttrDimensions& attr);
+
+ /**
+ Gets the left dimension.
+ */
+ const wxTextAttrDimension& GetLeft() const { return m_left; }
+ wxTextAttrDimension& GetLeft() { return m_left; }
+
+ /**
+ Gets the right dimension.
+
+ */
+ const wxTextAttrDimension& GetRight() const { return m_right; }
+ wxTextAttrDimension& GetRight() { return m_right; }
+
+ /**
+ Gets the top dimension.
+
+ */
+ const wxTextAttrDimension& GetTop() const { return m_top; }
+ wxTextAttrDimension& GetTop() { return m_top; }
+
+ /**
+ Gets the bottom dimension.
+
+ */
+ const wxTextAttrDimension& GetBottom() const { return m_bottom; }
+ wxTextAttrDimension& GetBottom() { return m_bottom; }
+
+ /**
+ Are all dimensions valid?
+
+ */
+ bool IsValid() const { return m_left.IsValid() && m_top.IsValid() && m_right.IsValid() && m_bottom.IsValid(); }
+
+ wxTextAttrDimension m_left;
+ wxTextAttrDimension m_top;
+ wxTextAttrDimension m_right;
+ wxTextAttrDimension m_bottom;
+};
+
+/**
+ @class wxTextAttrSize
+ A class for representing width and height.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextAttr, wxRichTextCtrl, wxTextAttrDimension
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxTextAttrSize
+{
+public:
+ /**
+ Default constructor.
+ */
+ wxTextAttrSize() {}
+
+ /**
+ Resets the width and height dimensions.
+ */
+ void Reset() { m_width.Reset(); m_height.Reset(); }
+
+ /**
+ Equality operator.
+ */
+ bool operator==(const wxTextAttrSize& size) const { return m_width == size.m_width && m_height == size.m_height ; }
+
+ /**
+ Partial equality test. If @a weakTest is @true, attributes of this object do not
+ have to be present if those attributes of @a size are present. If @a weakTest is
+ @false, the function will fail if an attribute is present in @a size but not
+ in this object.
+ */
+ bool EqPartial(const wxTextAttrSize& size, bool weakTest = true) const;
+
+ /**
+ Apply to this object, but not if the same as @a compareWith.
+ */
+ bool Apply(const wxTextAttrSize& dims, const wxTextAttrSize* compareWith = NULL);
+
+ /**
+ Collects the attributes that are common to a range of content, building up a note of
+ which attributes are absent in some objects and which clash in some objects.
+ */
+ void CollectCommonAttributes(const wxTextAttrSize& attr, wxTextAttrSize& clashingAttr, wxTextAttrSize& absentAttr);
+
+ /**
+ Removes the specified attributes from this object.
+ */
+ bool RemoveStyle(const wxTextAttrSize& attr);
+
+ /**
+ Returns the width.
+ */
+ wxTextAttrDimension& GetWidth() { return m_width; }
+ const wxTextAttrDimension& GetWidth() const { return m_width; }
+
+ /**
+ Sets the width.
+ */
+ void SetWidth(int value, wxTextAttrDimensionFlags flags) { m_width.SetValue(value, flags); }
+
+ /**
+ Sets the width.
+ */
+ void SetWidth(int value, wxTextAttrUnits units) { m_width.SetValue(value, units); }
+
+ /**
+ Sets the width.
+ */
+ void SetWidth(const wxTextAttrDimension& dim) { m_width.SetValue(dim); }
+
+ /**
+ Gets the height.
+ */
+ wxTextAttrDimension& GetHeight() { return m_height; }
+ const wxTextAttrDimension& GetHeight() const { return m_height; }
+
+ /**
+ Sets the height.
+ */
+ void SetHeight(int value, wxTextAttrDimensionFlags flags) { m_height.SetValue(value, flags); }
+
+ /**
+ Sets the height.
+ */
+ void SetHeight(int value, wxTextAttrUnits units) { m_height.SetValue(value, units); }
+
+ /**
+ Sets the height.
+ */
+ void SetHeight(const wxTextAttrDimension& dim) { m_height.SetValue(dim); }
+
+ /**
+ Is the size valid?
+ */
+ bool IsValid() const { return m_width.IsValid() && m_height.IsValid(); }
+
+ wxTextAttrDimension m_width;
+ wxTextAttrDimension m_height;
+};
+
+/**
+ @class wxTextAttrDimensionConverter
+ A class to make it easier to convert dimensions.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextAttr, wxRichTextCtrl, wxTextAttrDimension
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxTextAttrDimensionConverter
+{
+public:
+ /**
+ Constructor.
+ */
+ wxTextAttrDimensionConverter(wxDC& dc, double scale = 1.0, const wxSize& parentSize = wxDefaultSize);
+ /**
+ Constructor.
+ */
+ wxTextAttrDimensionConverter(int ppi, double scale = 1.0, const wxSize& parentSize = wxDefaultSize);
+
+ /**
+ Gets the pixel size for the given dimension.
+ */
+ int GetPixels(const wxTextAttrDimension& dim, int direction = wxHORIZONTAL) const;
+ /**
+ Gets the mm size for the given dimension.
+ */
+ int GetTenthsMM(const wxTextAttrDimension& dim) const;
+
+ /**
+ Converts tenths of a mm to pixels.
+ */
+ int ConvertTenthsMMToPixels(int units) const;
+ /**
+ Converts pixels to tenths of a mm.
+ */
+ int ConvertPixelsToTenthsMM(int pixels) const;
+
+ /**
+ Sets the scale factor.
+ */
+ void SetScale(double scale) { m_scale = scale; }
+ /**
+ Returns the scale factor.
+ */
+ double GetScale() const { return m_scale; }
+
+ /**
+ Sets the ppi.
+ */
+ void SetPPI(int ppi) { m_ppi = ppi; }
+ /**
+ Returns the ppi.
+ */
+ int GetPPI() const { return m_ppi; }
+
+ /**
+ Sets the parent size.
+ */
+ void SetParentSize(const wxSize& parentSize) { m_parentSize = parentSize; }
+ /**
+ Returns the parent size.
+ */
+ const wxSize& GetParentSize() const { return m_parentSize; }
+
+ int m_ppi;
+ double m_scale;
+ wxSize m_parentSize;
+};
+
+/**
+ Border styles, used with wxTextAttrBorder.
+ */
+enum wxTextAttrBorderStyle
+{
+ wxTEXT_BOX_ATTR_BORDER_NONE = 0,
+ wxTEXT_BOX_ATTR_BORDER_SOLID = 1,
+ wxTEXT_BOX_ATTR_BORDER_DOTTED = 2,
+ wxTEXT_BOX_ATTR_BORDER_DASHED = 3,
+ wxTEXT_BOX_ATTR_BORDER_DOUBLE = 4,
+ wxTEXT_BOX_ATTR_BORDER_GROOVE = 5,
+ wxTEXT_BOX_ATTR_BORDER_RIDGE = 6,
+ wxTEXT_BOX_ATTR_BORDER_INSET = 7,
+ wxTEXT_BOX_ATTR_BORDER_OUTSET = 8
+};
+
+/**
+ Border style presence flags, used with wxTextAttrBorder.
+ */
+enum wxTextAttrBorderFlags
+{
+ wxTEXT_BOX_ATTR_BORDER_STYLE = 0x0001,
+ wxTEXT_BOX_ATTR_BORDER_COLOUR = 0x0002
+};
+
+/**
+ Border width symbols for qualitative widths, used with wxTextAttrBorder.
+ */
+enum wxTextAttrBorderWidth
+{
+ wxTEXT_BOX_ATTR_BORDER_THIN = -1,
+ wxTEXT_BOX_ATTR_BORDER_MEDIUM = -2,
+ wxTEXT_BOX_ATTR_BORDER_THICK = -3
+};
+
+/**
+ Float styles.
+ */
+enum wxTextBoxAttrFloatStyle
+{
+ wxTEXT_BOX_ATTR_FLOAT_NONE = 0,
+ wxTEXT_BOX_ATTR_FLOAT_LEFT = 1,
+ wxTEXT_BOX_ATTR_FLOAT_RIGHT = 2
+};
+
+/**
+ Clear styles.
+ */
+enum wxTextBoxAttrClearStyle
+{
+ wxTEXT_BOX_ATTR_CLEAR_NONE = 0,
+ wxTEXT_BOX_ATTR_CLEAR_LEFT = 1,
+ wxTEXT_BOX_ATTR_CLEAR_RIGHT = 2,
+ wxTEXT_BOX_ATTR_CLEAR_BOTH = 3
+};
+
+/**
+ Collapse mode styles. TODO: can they be switched on per side?
+ */
+enum wxTextBoxAttrCollapseMode
+{
+ wxTEXT_BOX_ATTR_COLLAPSE_NONE = 0,
+ wxTEXT_BOX_ATTR_COLLAPSE_FULL = 1
+};
+
+/**
+ Vertical alignment values.
+ */
+enum wxTextBoxAttrVerticalAlignment
+{
+ wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_NONE = 0,
+ wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_TOP = 1,
+ wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_CENTRE = 2,
+ wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_BOTTOM = 3
+};
+
+/**
+ @class wxTextAttrBorder
+ A class representing a rich text object border.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextAttr, wxRichTextCtrl, wxRichTextAttrBorders
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxTextAttrBorder
+{
+public:
+ /**
+ Default constructor.
+ */
+ wxTextAttrBorder() { Reset(); }
+
+ /**
+ Equality operator.
+ */
+ bool operator==(const wxTextAttrBorder& border) const
+ {
+ return m_flags == border.m_flags && m_borderStyle == border.m_borderStyle &&
+ m_borderColour == border.m_borderColour && m_borderWidth == border.m_borderWidth;
+ }
+
+ /**
+ Resets the border style, colour, width and flags.
+ */
+ void Reset() { m_borderStyle = 0; m_borderColour = 0; m_flags = 0; m_borderWidth.Reset(); }
+
+ /**
+ Partial equality test. If @a weakTest is @true, attributes of this object do not
+ have to be present if those attributes of @a border are present. If @a weakTest is
+ @false, the function will fail if an attribute is present in @a border but not
+ in this object.
+ */
+ bool EqPartial(const wxTextAttrBorder& border, bool weakTest = true) const;
+
+ /**
+ Applies the border to this object, but not if the same as @a compareWith.
+
+ */
+ bool Apply(const wxTextAttrBorder& border, const wxTextAttrBorder* compareWith = NULL);
+
+ /**
+ Removes the specified attributes from this object.
+ */
+ bool RemoveStyle(const wxTextAttrBorder& attr);
+
+ /**
+ Collects the attributes that are common to a range of content, building up a note of
+ which attributes are absent in some objects and which clash in some objects.
+ */
+ void CollectCommonAttributes(const wxTextAttrBorder& attr, wxTextAttrBorder& clashingAttr, wxTextAttrBorder& absentAttr);
+
+ /**
+ Sets the border style.
+ */
+ void SetStyle(int style) { m_borderStyle = style; m_flags |= wxTEXT_BOX_ATTR_BORDER_STYLE; }
+
+ /**
+ Gets the border style.
+
+ */
+ int GetStyle() const { return m_borderStyle; }
+
+ /**
+ Sets the border colour.
+ */
+ void SetColour(unsigned long colour) { m_borderColour = colour; m_flags |= wxTEXT_BOX_ATTR_BORDER_COLOUR; }
+
+ /**
+ Sets the border colour.
+ */
+ void SetColour(const wxColour& colour) { m_borderColour = colour.GetRGB(); m_flags |= wxTEXT_BOX_ATTR_BORDER_COLOUR; }
+
+ /**
+ Gets the colour as a long.
+ */
+ unsigned long GetColourLong() const { return m_borderColour; }
+
+ /**
+ Gets the colour.
+ */
+ wxColour GetColour() const { return wxColour(m_borderColour); }
+
+ /**
+ Gets the border width.
+ */
+ wxTextAttrDimension& GetWidth() { return m_borderWidth; }
+ const wxTextAttrDimension& GetWidth() const { return m_borderWidth; }
+
+ /**
+ Sets the border width.
+ */
+ void SetWidth(const wxTextAttrDimension& width) { m_borderWidth = width; }
+ /**
+ Sets the border width.
+ */
+ void SetWidth(int value, wxTextAttrUnits units = wxTEXT_ATTR_UNITS_TENTHS_MM) { SetWidth(wxTextAttrDimension(value, units)); }
+
+ /**
+ True if the border has a valid style.
+ */
+ bool HasStyle() const { return (m_flags & wxTEXT_BOX_ATTR_BORDER_STYLE) != 0; }
+
+ /**
+ True if the border has a valid colour.
+ */
+ bool HasColour() const { return (m_flags & wxTEXT_BOX_ATTR_BORDER_COLOUR) != 0; }
+
+ /**
+ True if the border has a valid width.
+ */
+ bool HasWidth() const { return m_borderWidth.IsValid(); }
+
+ /**
+ True if the border is valid.
+ */
+ bool IsValid() const { return HasWidth(); }
+
+ /**
+ Set the valid flag for this border.
+ */
+ void MakeValid() { m_borderWidth.SetValid(true); }
+
+ /**
+ True if the border has no attributes set.
+ */
+ bool IsDefault() const { return (m_flags == 0); }
+
+ /**
+ Returns the border flags.
+ */
+ int GetFlags() const { return m_flags; }
+
+ /**
+ Sets the border flags.
+ */
+ void SetFlags(int flags) { m_flags = flags; }
+
+ /**
+ Adds a border flag.
+ */
+ void AddFlag(int flag) { m_flags |= flag; }
+
+ /**
+ Removes a border flag.
+ */
+ void RemoveFlag(int flag) { m_flags &= ~flag; }
+
+ int m_borderStyle;
+ unsigned long m_borderColour;
+ wxTextAttrDimension m_borderWidth;
+ int m_flags;
+};
+
+/**
+ @class wxTextAttrBorders
+ A class representing a rich text object's borders.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextAttr, wxRichTextCtrl, wxRichTextAttrBorder
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxTextAttrBorders
+{
+public:
+ /**
+ Default constructor.
+ */
+ wxTextAttrBorders() { }
+
+ /**
+ Equality operator.
+ */
+ bool operator==(const wxTextAttrBorders& borders) const
+ {
+ return m_left == borders.m_left && m_right == borders.m_right &&
+ m_top == borders.m_top && m_bottom == borders.m_bottom;
+ }
+
+ /**
+ Sets the style of all borders.
+ */
+ void SetStyle(int style);
+
+ /**
+ Sets colour of all borders.
+ */
+ void SetColour(unsigned long colour);
+
+ /**
+ Sets the colour for all borders.
+ */
+ void SetColour(const wxColour& colour);
+
+ /**
+ Sets the width of all borders.
+ */
+ void SetWidth(const wxTextAttrDimension& width);
+
+ /**
+ Sets the width of all borders.
+ */
+ void SetWidth(int value, wxTextAttrUnits units = wxTEXT_ATTR_UNITS_TENTHS_MM) { SetWidth(wxTextAttrDimension(value, units)); }
+
+ /**
+ Resets all borders.
+ */
+ void Reset() { m_left.Reset(); m_right.Reset(); m_top.Reset(); m_bottom.Reset(); }
+
+ /**
+ Partial equality test. If @a weakTest is @true, attributes of this object do not
+ have to be present if those attributes of @a borders are present. If @a weakTest is
+ @false, the function will fail if an attribute is present in @a borders but not
+ in this object.
+ */
+ bool EqPartial(const wxTextAttrBorders& borders, bool weakTest = true) const;
+
+ /**
+ Applies border to this object, but not if the same as @a compareWith.
+ */
+ bool Apply(const wxTextAttrBorders& borders, const wxTextAttrBorders* compareWith = NULL);
+
+ /**
+ Removes the specified attributes from this object.
+ */
+ bool RemoveStyle(const wxTextAttrBorders& attr);
+
+ /**
+ Collects the attributes that are common to a range of content, building up a note of
+ which attributes are absent in some objects and which clash in some objects.
+ */
+ void CollectCommonAttributes(const wxTextAttrBorders& attr, wxTextAttrBorders& clashingAttr, wxTextAttrBorders& absentAttr);
+
+ /**
+ Returns @true if at least one border is valid.
+ */
+ bool IsValid() const { return m_left.IsValid() || m_right.IsValid() || m_top.IsValid() || m_bottom.IsValid(); }
+
+ /**
+ Returns @true if no border attributes were set.
+ */
+ bool IsDefault() const { return m_left.IsDefault() && m_right.IsDefault() && m_top.IsDefault() && m_bottom.IsDefault(); }
+
+ /**
+ Returns the left border.
+ */
+ const wxTextAttrBorder& GetLeft() const { return m_left; }
+ wxTextAttrBorder& GetLeft() { return m_left; }
+
+ /**
+ Returns the right border.
+ */
+ const wxTextAttrBorder& GetRight() const { return m_right; }
+ wxTextAttrBorder& GetRight() { return m_right; }
+
+ /**
+ Returns the top border.
+ */
+ const wxTextAttrBorder& GetTop() const { return m_top; }
+ wxTextAttrBorder& GetTop() { return m_top; }
+
+ /**
+ Returns the bottom border.
+ */
+ const wxTextAttrBorder& GetBottom() const { return m_bottom; }
+ wxTextAttrBorder& GetBottom() { return m_bottom; }
+
+ wxTextAttrBorder m_left, m_right, m_top, m_bottom;
+
+};
+
+/**
+ @class wxTextBoxAttr
+ A class representing the box attributes of a rich text object.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextAttr, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxTextBoxAttr
+{
+public:
+ /**
+ Default constructor.
+ */
+ wxTextBoxAttr() { Init(); }
+
+ /**
+ Copy constructor.
+ */
+ wxTextBoxAttr(const wxTextBoxAttr& attr) { Init(); (*this) = attr; }
+
+ /**
+ Initialises this object.
+ */
+ void Init() { Reset(); }
+
+ /**
+ Resets this object.
+ */
+ void Reset();
+
+ // Copy. Unnecessary since we let it do a binary copy
+ //void Copy(const wxTextBoxAttr& attr);
+
+ // Assignment
+ //void operator= (const wxTextBoxAttr& attr);
+
+ /**
+ Equality test.
+ */
+ bool operator== (const wxTextBoxAttr& attr) const;
+
+ /**
+ Partial equality test, ignoring unset attributes. If @a weakTest is @true, attributes of this object do not
+ have to be present if those attributes of @a attr are present. If @a weakTest is
+ @false, the function will fail if an attribute is present in @a attr but not
+ in this object.
+
+ */
+ bool EqPartial(const wxTextBoxAttr& attr, bool weakTest = true) const;
+
+ /**
+ Merges the given attributes. If @a compareWith is non-NULL, then it will be used
+ to mask out those attributes that are the same in style and @a compareWith, for
+ situations where we don't want to explicitly set inherited attributes.
+ */
+ bool Apply(const wxTextBoxAttr& style, const wxTextBoxAttr* compareWith = NULL);
+
+ /**
+ Collects the attributes that are common to a range of content, building up a note of
+ which attributes are absent in some objects and which clash in some objects.
+ */
+ void CollectCommonAttributes(const wxTextBoxAttr& attr, wxTextBoxAttr& clashingAttr, wxTextBoxAttr& absentAttr);
+
+ /**
+ Removes the specified attributes from this object.
+ */
+ bool RemoveStyle(const wxTextBoxAttr& attr);
+
+ /**
+ Sets the flags.
+ */
+ void SetFlags(int flags) { m_flags = flags; }
+
+ /**
+ Returns the flags.
+ */
+ int GetFlags() const { return m_flags; }
+
+ /**
+ Is this flag present?
+ */
+ bool HasFlag(wxTextBoxAttrFlags flag) const { return (m_flags & flag) != 0; }
+
+ /**
+ Removes this flag.
+ */
+ void RemoveFlag(wxTextBoxAttrFlags flag) { m_flags &= ~flag; }
+
+ /**
+ Adds this flag.
+ */
+ void AddFlag(wxTextBoxAttrFlags flag) { m_flags |= flag; }
+
+ /**
+ Returns @true if no attributes are set.
+ */
+ bool IsDefault() const;
+
+ /**
+ Returns the float mode.
+ */
+ wxTextBoxAttrFloatStyle GetFloatMode() const { return m_floatMode; }
+
+ /**
+ Sets the float mode.
+ */
+ void SetFloatMode(wxTextBoxAttrFloatStyle mode) { m_floatMode = mode; m_flags |= wxTEXT_BOX_ATTR_FLOAT; }
+
+ /**
+ Returns @true if float mode is active.
+ */
+ bool HasFloatMode() const { return HasFlag(wxTEXT_BOX_ATTR_FLOAT); }
+
+ /**
+ Returns @true if this object is floating.
+ */
+ bool IsFloating() const { return HasFloatMode() && GetFloatMode() != wxTEXT_BOX_ATTR_FLOAT_NONE; }
+
+ /**
+ Returns the clear mode - whether to wrap text after object. Currently unimplemented.
+ */
+ wxTextBoxAttrClearStyle GetClearMode() const { return m_clearMode; }
+
+ /**
+ Set the clear mode. Currently unimplemented.
+ */
+ void SetClearMode(wxTextBoxAttrClearStyle mode) { m_clearMode = mode; m_flags |= wxTEXT_BOX_ATTR_CLEAR; }
+
+ /**
+ Returns @true if we have a clear flag.
+ */
+ bool HasClearMode() const { return HasFlag(wxTEXT_BOX_ATTR_CLEAR); }
+
+ /**
+ Returns the collapse mode - whether to collapse borders.
+ */
+ wxTextBoxAttrCollapseMode GetCollapseBorders() const { return m_collapseMode; }
+
+ /**
+ Sets the collapse mode - whether to collapse borders.
+ */
+ void SetCollapseBorders(wxTextBoxAttrCollapseMode collapse) { m_collapseMode = collapse; m_flags |= wxTEXT_BOX_ATTR_COLLAPSE_BORDERS; }
+
+ /**
+ Returns @true if the collapse borders flag is present.
+ */
+ bool HasCollapseBorders() const { return HasFlag(wxTEXT_BOX_ATTR_COLLAPSE_BORDERS); }
+
+ /**
+ Returns the vertical alignment.
+ */
+ wxTextBoxAttrVerticalAlignment GetVerticalAlignment() const { return m_verticalAlignment; }
+
+ /**
+ Sets the vertical alignment.
+ */
+ void SetVerticalAlignment(wxTextBoxAttrVerticalAlignment verticalAlignment) { m_verticalAlignment = verticalAlignment; m_flags |= wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT; }
+
+ /**
+ Returns @true if a vertical alignment flag is present.
+ */
+ bool HasVerticalAlignment() const { return HasFlag(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT); }
+
+ /**
+ Returns the margin values.
+ */
+ wxTextAttrDimensions& GetMargins() { return m_margins; }
+ const wxTextAttrDimensions& GetMargins() const { return m_margins; }
+
+ /**
+ Returns the left margin.
+ */
+ wxTextAttrDimension& GetLeftMargin() { return m_margins.m_left; }
+ const wxTextAttrDimension& GetLeftMargin() const { return m_margins.m_left; }
+
+ /**
+ Returns the right margin.
+ */
+ wxTextAttrDimension& GetRightMargin() { return m_margins.m_right; }
+ const wxTextAttrDimension& GetRightMargin() const { return m_margins.m_right; }
+
+ /**
+ Returns the top margin.
+ */
+ wxTextAttrDimension& GetTopMargin() { return m_margins.m_top; }
+ const wxTextAttrDimension& GetTopMargin() const { return m_margins.m_top; }
+
+ /**
+ Returns the bottom margin.
+ */
+ wxTextAttrDimension& GetBottomMargin() { return m_margins.m_bottom; }
+ const wxTextAttrDimension& GetBottomMargin() const { return m_margins.m_bottom; }
+
+ /**
+ Returns the position.
+ */
+ wxTextAttrDimensions& GetPosition() { return m_position; }
+ const wxTextAttrDimensions& GetPosition() const { return m_position; }
+
+ /**
+ Returns the left position.
+ */
+ wxTextAttrDimension& GetLeft() { return m_position.m_left; }
+ const wxTextAttrDimension& GetLeft() const { return m_position.m_left; }
+
+ /**
+ Returns the right position.
+ */
+ wxTextAttrDimension& GetRight() { return m_position.m_right; }
+ const wxTextAttrDimension& GetRight() const { return m_position.m_right; }
+
+ /**
+ Returns the top position.
+ */
+ wxTextAttrDimension& GetTop() { return m_position.m_top; }
+ const wxTextAttrDimension& GetTop() const { return m_position.m_top; }
+
+ /**
+ Returns the bottom position.
+ */
+ wxTextAttrDimension& GetBottom() { return m_position.m_bottom; }
+ const wxTextAttrDimension& GetBottom() const { return m_position.m_bottom; }
+
+ /**
+ Returns the padding values.
+ */
+ wxTextAttrDimensions& GetPadding() { return m_padding; }
+ const wxTextAttrDimensions& GetPadding() const { return m_padding; }
+
+ /**
+ Returns the left padding value.
+ */
+ wxTextAttrDimension& GetLeftPadding() { return m_padding.m_left; }
+ const wxTextAttrDimension& GetLeftPadding() const { return m_padding.m_left; }
+
+ /**
+ Returns the right padding value.
+ */
+ wxTextAttrDimension& GetRightPadding() { return m_padding.m_right; }
+ const wxTextAttrDimension& GetRightPadding() const { return m_padding.m_right; }
+
+ /**
+ Returns the top padding value.
+ */
+ wxTextAttrDimension& GetTopPadding() { return m_padding.m_top; }
+ const wxTextAttrDimension& GetTopPadding() const { return m_padding.m_top; }
+
+ /**
+ Returns the bottom padding value.
+ */
+ wxTextAttrDimension& GetBottomPadding() { return m_padding.m_bottom; }
+ const wxTextAttrDimension& GetBottomPadding() const { return m_padding.m_bottom; }
+
+ /**
+ Returns the borders.
+ */
+ wxTextAttrBorders& GetBorder() { return m_border; }
+ const wxTextAttrBorders& GetBorder() const { return m_border; }
+
+ /**
+ Returns the left border.
+ */
+ wxTextAttrBorder& GetLeftBorder() { return m_border.m_left; }
+ const wxTextAttrBorder& GetLeftBorder() const { return m_border.m_left; }
+
+ /**
+ Returns the top border.
+ */
+ wxTextAttrBorder& GetTopBorder() { return m_border.m_top; }
+ const wxTextAttrBorder& GetTopBorder() const { return m_border.m_top; }
+
+ /**
+ Returns the right border.
+ */
+ wxTextAttrBorder& GetRightBorder() { return m_border.m_right; }
+ const wxTextAttrBorder& GetRightBorder() const { return m_border.m_right; }
+
+ /**
+ Returns the bottom border.
+ */
+ wxTextAttrBorder& GetBottomBorder() { return m_border.m_bottom; }
+ const wxTextAttrBorder& GetBottomBorder() const { return m_border.m_bottom; }
+
+ /**
+ Returns the outline.
+ */
+ wxTextAttrBorders& GetOutline() { return m_outline; }
+ const wxTextAttrBorders& GetOutline() const { return m_outline; }
+
+ /**
+ Returns the left outline.
+ */
+ wxTextAttrBorder& GetLeftOutline() { return m_outline.m_left; }
+ const wxTextAttrBorder& GetLeftOutline() const { return m_outline.m_left; }
+
+ /**
+ Returns the top outline.
+ */
+ wxTextAttrBorder& GetTopOutline() { return m_outline.m_top; }
+ const wxTextAttrBorder& GetTopOutline() const { return m_outline.m_top; }
+
+ /**
+ Returns the right outline.
+ */
+ wxTextAttrBorder& GetRightOutline() { return m_outline.m_right; }
+ const wxTextAttrBorder& GetRightOutline() const { return m_outline.m_right; }
+
+ /**
+ Returns the bottom outline.
+ */
+ wxTextAttrBorder& GetBottomOutline() { return m_outline.m_bottom; }
+ const wxTextAttrBorder& GetBottomOutline() const { return m_outline.m_bottom; }
+
+ /**
+ Returns the object size.
+ */
+ wxTextAttrSize& GetSize() { return m_size; }
+ const wxTextAttrSize& GetSize() const { return m_size; }
+
+ /**
+ Returns the object minimum size.
+ */
+
+ wxTextAttrSize& GetMinSize() { return m_minSize; }
+ const wxTextAttrSize& GetMinSize() const { return m_minSize; }
+
+ /**
+ Returns the object maximum size.
+ */
+
+ wxTextAttrSize& GetMaxSize() { return m_maxSize; }
+ const wxTextAttrSize& GetMaxSize() const { return m_maxSize; }
+
+ /**
+ Sets the object size.
+ */
+ void SetSize(const wxTextAttrSize& sz) { m_size = sz; }
+
+ /**
+ Sets the object minimum size.
+ */
+ void SetMinSize(const wxTextAttrSize& sz) { m_minSize = sz; }
+
+ /**
+ Sets the object maximum size.
+ */
+ void SetMaxSize(const wxTextAttrSize& sz) { m_maxSize = sz; }
+
+ /**
+ Returns the object width.
+ */
+ wxTextAttrDimension& GetWidth() { return m_size.m_width; }
+ const wxTextAttrDimension& GetWidth() const { return m_size.m_width; }
+
+ /**
+ Returns the object height.
+ */
+ wxTextAttrDimension& GetHeight() { return m_size.m_height; }
+ const wxTextAttrDimension& GetHeight() const { return m_size.m_height; }
+
+ /**
+ Returns the box style name.
+ */
+ const wxString& GetBoxStyleName() const { return m_boxStyleName; }
+
+ /**
+ Sets the box style name.
+ */
+ void SetBoxStyleName(const wxString& name) { m_boxStyleName = name; AddFlag(wxTEXT_BOX_ATTR_BOX_STYLE_NAME); }
+
+ /**
+ Returns @true if the box style name is present.
+ */
+ bool HasBoxStyleName() const { return HasFlag(wxTEXT_BOX_ATTR_BOX_STYLE_NAME); }
+
+public:
+
+ int m_flags;
+
+ wxTextAttrDimensions m_margins;
+ wxTextAttrDimensions m_padding;
+ wxTextAttrDimensions m_position;
+
+ wxTextAttrSize m_size;
+ wxTextAttrSize m_minSize;
+ wxTextAttrSize m_maxSize;
+
+ wxTextAttrBorders m_border;
+ wxTextAttrBorders m_outline;
+
+ wxTextBoxAttrFloatStyle m_floatMode;
+ wxTextBoxAttrClearStyle m_clearMode;
+ wxTextBoxAttrCollapseMode m_collapseMode;
+ wxTextBoxAttrVerticalAlignment m_verticalAlignment;
+ wxString m_boxStyleName;
+};
+
+/**
+ @class wxRichTextAttr
+ A class representing enhanced attributes for rich text objects.
+ This adds a wxTextBoxAttr member to the basic wxTextAttr class.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextAttr, wxTextBoxAttr, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextAttr: public wxTextAttr
+{
+public:
+ /**
+ Constructor taking a wxTextAttr.
+ */
+ wxRichTextAttr(const wxTextAttr& attr) { wxTextAttr::Copy(attr); }
+
+ /**
+ Copy constructor.
+ */
+ wxRichTextAttr(const wxRichTextAttr& attr): wxTextAttr() { Copy(attr); }
+
+ /**
+ Default constructor.
+ */
+ wxRichTextAttr() {}
+
+ /**
+ Copy function.
+ */
+ void Copy(const wxRichTextAttr& attr);
+
+ /**
+ Assignment operator.
+ */
+ void operator=(const wxRichTextAttr& attr) { Copy(attr); }
+
+ /**
+ Assignment operator.
+ */
+ void operator=(const wxTextAttr& attr) { wxTextAttr::Copy(attr); }
+
+ /**
+ Equality test.
+ */
+ bool operator==(const wxRichTextAttr& attr) const;
+
+ /**
+ Partial equality test. If @a weakTest is @true, attributes of this object do not
+ have to be present if those attributes of @a attr are present. If @a weakTest is
+ @false, the function will fail if an attribute is present in @a attr but not
+ in this object.
+ */
+ bool EqPartial(const wxRichTextAttr& attr, bool weakTest = true) const;
+
+ /**
+ Merges the given attributes. If @a compareWith
+ is non-NULL, then it will be used to mask out those attributes that are the same in style
+ and @a compareWith, for situations where we don't want to explicitly set inherited attributes.
+ */
+ bool Apply(const wxRichTextAttr& style, const wxRichTextAttr* compareWith = NULL);
+
+ /**
+ Collects the attributes that are common to a range of content, building up a note of
+ which attributes are absent in some objects and which clash in some objects.
+ */
+ void CollectCommonAttributes(const wxRichTextAttr& attr, wxRichTextAttr& clashingAttr, wxRichTextAttr& absentAttr);
+
+ /**
+ Removes the specified attributes from this object.
+ */
+ bool RemoveStyle(const wxRichTextAttr& attr);
+
+ /**
+ Returns the text box attributes.
+ */
+ wxTextBoxAttr& GetTextBoxAttr() { return m_textBoxAttr; }
+ const wxTextBoxAttr& GetTextBoxAttr() const { return m_textBoxAttr; }
+
+ /**
+ Set the text box attributes.
+ */
+ void SetTextBoxAttr(const wxTextBoxAttr& attr) { m_textBoxAttr = attr; }
+
+ /**
+ Returns @true if no attributes are set.
+ */
+ bool IsDefault() const { return (GetFlags() == 0) && m_textBoxAttr.IsDefault(); }
+
+ wxTextBoxAttr m_textBoxAttr;
+};
+
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxRichTextAttr, wxRichTextAttrArray, WXDLLIMPEXP_RICHTEXT);
+
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxVariant, wxRichTextVariantArray, WXDLLIMPEXP_RICHTEXT);
+
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxRect, wxRichTextRectArray, WXDLLIMPEXP_RICHTEXT);
+
+/**
+ @class wxRichTextProperties
+ A simple property class using wxVariants. This is used to give each rich text object the
+ ability to store custom properties that can be used by the application.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextBuffer, wxRichTextObject, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextProperties: public wxObject
+{
+DECLARE_DYNAMIC_CLASS(wxRichTextProperties)
+public:
+
+ /**
+ Default constructor.
+ */
+ wxRichTextProperties() {}
+
+ /**
+ Copy constructor.
+ */
+ wxRichTextProperties(const wxRichTextProperties& props): wxObject() { Copy(props); }
+
+ /**
+ Assignment operator.
+ */
+ void operator=(const wxRichTextProperties& props) { Copy(props); }
+
+ /**
+ Equality operator.
+ */
+ bool operator==(const wxRichTextProperties& props) const;
+
+ /**
+ Copies from @a props.
+ */
+ void Copy(const wxRichTextProperties& props) { m_properties = props.m_properties; }
+
+ /**
+ Returns the variant at the given index.
+ */
+ const wxVariant& operator[](size_t idx) const { return m_properties[idx]; }
+
+ /**
+ Returns the variant at the given index.
+ */
+ wxVariant& operator[](size_t idx) { return m_properties[idx]; }
+
+ /**
+ Clears the properties.
+ */
+ void Clear() { m_properties.Clear(); }
+
+ /**
+ Returns the array of variants implementing the properties.
+ */
+ const wxRichTextVariantArray& GetProperties() const { return m_properties; }
+
+ /**
+ Returns the array of variants implementing the properties.
+ */
+ wxRichTextVariantArray& GetProperties() { return m_properties; }
+
+ /**
+ Sets the array of variants.
+ */
+ void SetProperties(const wxRichTextVariantArray& props) { m_properties = props; }
+
+ /**
+ Returns all the property names.
+ */
+ wxArrayString GetPropertyNames() const;
+
+ /**
+ Returns a count of the properties.
+ */
+ size_t GetCount() const { return m_properties.GetCount(); }
+
+ /**
+ Returns @true if the given property is found.
+ */
+ bool HasProperty(const wxString& name) const { return Find(name) != -1; }
+
+ /**
+ Finds the given property.
+ */
+ int Find(const wxString& name) const;
+
+ /**
+ Removes the given property.
+ */
+ bool Remove(const wxString& name);
+
+ /**
+ Gets the property variant by name.
+ */
+ const wxVariant& GetProperty(const wxString& name) const;
+
+ /**
+ Finds or creates a property with the given name, returning a pointer to the variant.
+ */
+ wxVariant* FindOrCreateProperty(const wxString& name);
+
+ /**
+ Gets the value of the named property as a string.
+ */
+ wxString GetPropertyString(const wxString& name) const;
+
+ /**
+ Gets the value of the named property as a long integer.
+ */
+ long GetPropertyLong(const wxString& name) const;
+
+ /**
+ Gets the value of the named property as a boolean.
+ */
+ bool GetPropertyBool(const wxString& name) const;
+
+ /**
+ Gets the value of the named property as a double.
+ */
+ double GetPropertyDouble(const wxString& name) const;
+
+ /**
+ Sets the property by passing a variant which contains a name and value.
+ */
+ void SetProperty(const wxVariant& variant);
+
+ /**
+ Sets a property by name and variant.
+ */
+ void SetProperty(const wxString& name, const wxVariant& variant);
+
+ /**
+ Sets a property by name and string value.
+ */
+ void SetProperty(const wxString& name, const wxString& value);
+
+ /**
+ Sets a property by name and wxChar* value.
+ */
+ void SetProperty(const wxString& name, const wxChar* value) { SetProperty(name, wxString(value)); }
+
+ /**
+ Sets property by name and long integer value.
+ */
+ void SetProperty(const wxString& name, long value);
+
+ /**
+ Sets property by name and double value.
+ */
+ void SetProperty(const wxString& name, double value);
+
+ /**
+ Sets property by name and boolean value.
+ */
+ void SetProperty(const wxString& name, bool value);
+
+ /**
+ Removes the given properties from these properties.
+ */
+ void RemoveProperties(const wxRichTextProperties& properties);
+
+ /**
+ Merges the given properties with these properties.
+ */
+ void MergeProperties(const wxRichTextProperties& properties);
+
+protected:
+ wxRichTextVariantArray m_properties;
+};
+
+
+/**
+ @class wxRichTextFontTable
+ Manages quick access to a pool of fonts for rendering rich text.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextBuffer, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextFontTable: public wxObject
+{
+public:
+ /**
+ Default constructor.
+ */
+ wxRichTextFontTable();
+
+ /**
+ Copy constructor.
+ */
+ wxRichTextFontTable(const wxRichTextFontTable& table);
+ virtual ~wxRichTextFontTable();
+
+ /**
+ Returns @true if the font table is valid.
+ */
+ bool IsOk() const { return m_refData != NULL; }
+
+ /**
+ Finds a font for the given attribute object.
+ */
+ wxFont FindFont(const wxRichTextAttr& fontSpec);
+
+ /**
+ Clears the font table.
+ */
+ void Clear();
+
+ /**
+ Assignment operator.
+ */
+ void operator= (const wxRichTextFontTable& table);
+
+ /**
+ Equality operator.
+ */
+ bool operator == (const wxRichTextFontTable& table) const;
+
+ /**
+ Inequality operator.
+ */
+ bool operator != (const wxRichTextFontTable& table) const { return !(*this == table); }
+
+ /**
+ Set the font scale factor.
+ */
+ void SetFontScale(double fontScale);
+
+protected:
+
+ double m_fontScale;
+
+ DECLARE_DYNAMIC_CLASS(wxRichTextFontTable)
+};
+
+/**
+ @class wxRichTextRange
+
+ This stores beginning and end positions for a range of data.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextBuffer, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextRange
+{
+public:
+// Constructors
+
+ /**
+ Default constructor.
+ */
+ wxRichTextRange() { m_start = 0; m_end = 0; }
+
+ /**
+ Constructor taking start and end positions.
+ */
+ wxRichTextRange(long start, long end) { m_start = start; m_end = end; }
+
+ /**
+ Copy constructor.
+ */
+ wxRichTextRange(const wxRichTextRange& range) { m_start = range.m_start; m_end = range.m_end; }
+ ~wxRichTextRange() {}
+
+ /**
+ Assigns @a range to this range.
+ */
+ void operator =(const wxRichTextRange& range) { m_start = range.m_start; m_end = range.m_end; }
+
+ /**
+ Equality operator. Returns @true if @a range is the same as this range.
+ */
+ bool operator ==(const wxRichTextRange& range) const { return (m_start == range.m_start && m_end == range.m_end); }
+
+ /**
+ Inequality operator.
+ */
+ bool operator !=(const wxRichTextRange& range) const { return (m_start != range.m_start || m_end != range.m_end); }
+
+ /**
+ Subtracts a range from this range.
+ */
+ wxRichTextRange operator -(const wxRichTextRange& range) const { return wxRichTextRange(m_start - range.m_start, m_end - range.m_end); }
+
+ /**
+ Adds a range to this range.
+ */
+ wxRichTextRange operator +(const wxRichTextRange& range) const { return wxRichTextRange(m_start + range.m_start, m_end + range.m_end); }
+
+ /**
+ Sets the range start and end positions.
+ */
+ void SetRange(long start, long end) { m_start = start; m_end = end; }
+
+ /**
+ Sets the start position.
+ */
+ void SetStart(long start) { m_start = start; }
+
+ /**
+ Returns the start position.
+ */
+ long GetStart() const { return m_start; }
+
+ /**
+ Sets the end position.
+ */
+ void SetEnd(long end) { m_end = end; }
+
+ /**
+ Gets the end position.
+ */
+ long GetEnd() const { return m_end; }
+
+ /**
+ Returns true if this range is completely outside @a range.
+ */
+ bool IsOutside(const wxRichTextRange& range) const { return range.m_start > m_end || range.m_end < m_start; }
+
+ /**
+ Returns true if this range is completely within @a range.
+ */
+ bool IsWithin(const wxRichTextRange& range) const { return m_start >= range.m_start && m_end <= range.m_end; }
+
+ /**
+ Returns true if @a pos was within the range. Does not match if the range is empty.
+ */
+ bool Contains(long pos) const { return pos >= m_start && pos <= m_end ; }
+
+ /**
+ Limit this range to be within @a range.
+ */
+ bool LimitTo(const wxRichTextRange& range) ;
+
+ /**
+ Gets the length of the range.
+ */
+ long GetLength() const { return m_end - m_start + 1; }
+
+ /**
+ Swaps the start and end.
+ */
+ void Swap() { long tmp = m_start; m_start = m_end; m_end = tmp; }
+
+ /**
+ Converts the API-standard range, whose end is one past the last character in
+ the range, to the internal form, which uses the first and last character
+ positions of the range. In other words, one is subtracted from the end position.
+ (n, n) is the range of a single character.
+ */
+ wxRichTextRange ToInternal() const { return wxRichTextRange(m_start, m_end-1); }
+
+ /**
+ Converts the internal range, which uses the first and last character positions
+ of the range, to the API-standard range, whose end is one past the last
+ character in the range. In other words, one is added to the end position.
+ (n, n+1) is the range of a single character.
+ */
+ wxRichTextRange FromInternal() const { return wxRichTextRange(m_start, m_end+1); }
+
+protected:
+ long m_start;
+ long m_end;
+};
+
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxRichTextRange, wxRichTextRangeArray, WXDLLIMPEXP_RICHTEXT);
+
+#define wxRICHTEXT_ALL wxRichTextRange(-2, -2)
+#define wxRICHTEXT_NONE wxRichTextRange(-1, -1)
+
+#define wxRICHTEXT_NO_SELECTION wxRichTextRange(-2, -2)
+
+/**
+ @class wxRichTextSelection
+
+ Stores selection information. The selection does not have to be contiguous, though currently non-contiguous
+ selections are only supported for a range of table cells (a geometric block of cells can consist
+ of a set of non-contiguous positions).
+
+ The selection consists of an array of ranges, and the container that is the context for the selection. It
+ follows that a single selection object can only represent ranges with the same parent container.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextBuffer, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextSelection
+{
+public:
+ /**
+ Copy constructor.
+ */
+ wxRichTextSelection(const wxRichTextSelection& sel) { Copy(sel); }
+
+ /**
+ Creates a selection from a range and a container.
+ */
+ wxRichTextSelection(const wxRichTextRange& range, wxRichTextParagraphLayoutBox* container) { m_ranges.Add(range); m_container = container; }
+
+ /**
+ Default constructor.
+ */
+ wxRichTextSelection() { Reset(); }
+
+ /**
+ Resets the selection.
+ */
+ void Reset() { m_ranges.Clear(); m_container = NULL; }
+
+ /**
+ Sets the selection.
+ */
+
+ void Set(const wxRichTextRange& range, wxRichTextParagraphLayoutBox* container)
+ { m_ranges.Clear(); m_ranges.Add(range); m_container = container; }
+
+ /**
+ Adds a range to the selection.
+ */
+ void Add(const wxRichTextRange& range)
+ { m_ranges.Add(range); }
+
+ /**
+ Sets the selections from an array of ranges and a container object.
+ */
+ void Set(const wxRichTextRangeArray& ranges, wxRichTextParagraphLayoutBox* container)
+ { m_ranges = ranges; m_container = container; }
+
+ /**
+ Copies from @a sel.
+ */
+ void Copy(const wxRichTextSelection& sel)
+ { m_ranges = sel.m_ranges; m_container = sel.m_container; }
+
+ /**
+ Assignment operator.
+ */
+ void operator=(const wxRichTextSelection& sel) { Copy(sel); }
+
+ /**
+ Equality operator.
+ */
+ bool operator==(const wxRichTextSelection& sel) const;
+
+ /**
+ Index operator.
+ */
+ wxRichTextRange operator[](size_t i) const { return GetRange(i); }
+
+ /**
+ Returns the selection ranges.
+ */
+ wxRichTextRangeArray& GetRanges() { return m_ranges; }
+
+ /**
+ Returns the selection ranges.
+ */
+ const wxRichTextRangeArray& GetRanges() const { return m_ranges; }
+
+ /**
+ Sets the selection ranges.
+ */
+ void SetRanges(const wxRichTextRangeArray& ranges) { m_ranges = ranges; }
+
+ /**
+ Returns the number of ranges in the selection.
+ */
+ size_t GetCount() const { return m_ranges.GetCount(); }
+
+ /**
+ Returns the range at the given index.
+
+ */
+ wxRichTextRange GetRange(size_t i) const { return m_ranges[i]; }
+
+ /**
+ Returns the first range if there is one, otherwise wxRICHTEXT_NO_SELECTION.
+ */
+ wxRichTextRange GetRange() const { return (m_ranges.GetCount() > 0) ? (m_ranges[0]) : wxRICHTEXT_NO_SELECTION; }
+
+ /**
+ Sets a single range.
+ */
+ void SetRange(const wxRichTextRange& range) { m_ranges.Clear(); m_ranges.Add(range); }
+
+ /**
+ Returns the container for which the selection is valid.
+ */
+ wxRichTextParagraphLayoutBox* GetContainer() const { return m_container; }
+
+ /**
+ Sets the container for which the selection is valid.
+ */
+ void SetContainer(wxRichTextParagraphLayoutBox* container) { m_container = container; }
+
+ /**
+ Returns @true if the selection is valid.
+ */
+ bool IsValid() const { return m_ranges.GetCount() > 0 && GetContainer(); }
+
+ /**
+ Returns the selection appropriate to the specified object, if any; returns an empty array if none
+ at the level of the object's container.
+ */
+ wxRichTextRangeArray GetSelectionForObject(wxRichTextObject* obj) const;
+
+ /**
+ Returns @true if the given position is within the selection.
+ */
+ bool WithinSelection(long pos, wxRichTextObject* obj) const;
+
+ /**
+ Returns @true if the given position is within the selection.
+
+ */
+ bool WithinSelection(long pos) const { return WithinSelection(pos, m_ranges); }
+
+ /**
+ Returns @true if the given position is within the selection range.
+ */
+ static bool WithinSelection(long pos, const wxRichTextRangeArray& ranges);
+
+ /**
+ Returns @true if the given range is within the selection range.
+ */
+ static bool WithinSelection(const wxRichTextRange& range, const wxRichTextRangeArray& ranges);
+
+ wxRichTextRangeArray m_ranges;
+ wxRichTextParagraphLayoutBox* m_container;
+};
+
+/**
+ @class wxRichTextDrawingContext
+
+ A class for passing information to drawing and measuring functions.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextBuffer, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextDrawingContext: public wxObject
+{
+ DECLARE_CLASS(wxRichTextDrawingContext)
+public:
+
+ /**
+ Pass the buffer to the context so the context can retrieve information
+ such as virtual attributes.
+ */
+ wxRichTextDrawingContext(wxRichTextBuffer* buffer);
+
+ void Init() { m_buffer = NULL; m_enableVirtualAttributes = true; }
+
+ /**
+ Does this object have virtual attributes?
+ Virtual attributes can be provided for visual cues without
+ affecting the actual styling.
+ */
+ bool HasVirtualAttributes(wxRichTextObject* obj) const;
+
+ /**
+ Returns the virtual attributes for this object.
+ Virtual attributes can be provided for visual cues without
+ affecting the actual styling.
+ */
+ wxRichTextAttr GetVirtualAttributes(wxRichTextObject* obj) const;
+
+ /**
+ Applies any virtual attributes relevant to this object.
+ */
+ bool ApplyVirtualAttributes(wxRichTextAttr& attr, wxRichTextObject* obj) const;
+
+ /**
+ Gets the count for mixed virtual attributes for individual positions within the object.
+ For example, individual characters within a text object may require special highlighting.
+ */
+ int GetVirtualSubobjectAttributesCount(wxRichTextObject* obj) const;
+
+ /**
+ Gets the mixed virtual attributes for individual positions within the object.
+ For example, individual characters within a text object may require special highlighting.
+ The function is passed the count returned by GetVirtualSubobjectAttributesCount.
+ */
+ int GetVirtualSubobjectAttributes(wxRichTextObject* obj, wxArrayInt& positions, wxRichTextAttrArray& attributes) const;
+
+ /**
+ Do we have virtual text for this object? Virtual text allows an application
+ to replace characters in an object for editing and display purposes, for example
+ for highlighting special characters.
+ */
+ bool HasVirtualText(const wxRichTextPlainText* obj) const;
+
+ /**
+ Gets the virtual text for this object.
+ */
+ bool GetVirtualText(const wxRichTextPlainText* obj, wxString& text) const;
+
+ /**
+ Enables virtual attribute processing.
+ */
+
+ void EnableVirtualAttributes(bool b) { m_enableVirtualAttributes = b; }
+
+ /**
+ Returns @true if virtual attribute processing is enabled.
+ */
+
+ bool GetVirtualAttributesEnabled() const { return m_enableVirtualAttributes; }
+
+ wxRichTextBuffer* m_buffer;
+ bool m_enableVirtualAttributes;
+};
+
+/**
+ @class wxRichTextObject
+
+ This is the base for drawable rich text objects.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextBuffer, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextObject: public wxObject
+{
+ DECLARE_CLASS(wxRichTextObject)
+public:
+ /**
+ Constructor, taking an optional parent pointer.
+ */
+ wxRichTextObject(wxRichTextObject* parent = NULL);
+
+ virtual ~wxRichTextObject();
+
+// Overridables
+
+ /**
+ Draw the item, within the given range. Some objects may ignore the range (for
+ example paragraphs) while others must obey it (lines, to implement wrapping)
+ */
+ virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style) = 0;
+
+ /**
+ Lay the item out at the specified position with the given size constraint.
+ Layout must set the cached size. @rect is the available space for the object,
+ and @a parentRect is the container that is used to determine a relative size
+ or position (for example if a text box must be 50% of the parent text box).
+ */
+ virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style) = 0;
+
+ /**
+ Hit-testing: returns a flag indicating hit test details, plus
+ information about position. @a contextObj is returned to specify what object
+ position is relevant to, since otherwise there's an ambiguity.
+ @ obj might not be a child of @a contextObj, since we may be referring to the container itself
+ if we have no hit on a child - for example if we click outside an object.
+
+ The function puts the position in @a textPosition if one is found.
+ @a pt is in logical units (a zero y position is at the beginning of the buffer).
+
+ Pass wxRICHTEXT_HITTEST_NO_NESTED_OBJECTS if you only want to consider objects
+ directly under the object you are calling HitTest on. Otherwise, it will recurse
+ and potentially find a nested object.
+
+ @return One of the ::wxRichTextHitTestFlags values.
+ */
+
+ virtual int HitTest(wxDC& dc, wxRichTextDrawingContext& context, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0);
+
+ /**
+ Finds the absolute position and row height for the given character position.
+ */
+ virtual bool FindPosition(wxDC& WXUNUSED(dc), wxRichTextDrawingContext& WXUNUSED(context), long WXUNUSED(index), wxPoint& WXUNUSED(pt), int* WXUNUSED(height), bool WXUNUSED(forceLineStart)) { return false; }
+
+ /**
+ Returns the best size, i.e. the ideal starting size for this object irrespective
+ of available space. For a short text string, it will be the size that exactly encloses
+ the text. For a longer string, it might use the parent width for example.
+ */
+ virtual wxSize GetBestSize() const { return m_size; }
+
+ /**
+ Returns the object size for the given range. Returns @false if the range
+ is invalid for this object.
+ */
+
+ virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const = 0;
+
+ /**
+ Do a split from @a pos, returning an object containing the second part, and setting
+ the first part in 'this'.
+ */
+ virtual wxRichTextObject* DoSplit(long WXUNUSED(pos)) { return NULL; }
+
+ /**
+ Calculates the range of the object. By default, guess that the object is 1 unit long.
+ */
+ virtual void CalculateRange(long start, long& end) { end = start ; m_range.SetRange(start, end); }
+
+ /**
+ Deletes the given range.
+ */
+ virtual bool DeleteRange(const wxRichTextRange& WXUNUSED(range)) { return false; }
+
+ /**
+ Returns @true if the object is empty.
+ */
+ virtual bool IsEmpty() const { return false; }
+
+ /**
+ Returns @true if this class of object is floatable.
+ */
+ virtual bool IsFloatable() const { return false; }
+
+ /**
+ Returns @true if this object is currently floating.
+ */
+ virtual bool IsFloating() const { return GetAttributes().GetTextBoxAttr().IsFloating(); }
+
+ /**
+ Returns the floating direction.
+ */
+ virtual int GetFloatDirection() const { return GetAttributes().GetTextBoxAttr().GetFloatMode(); }
+
+ /**
+ Returns any text in this object for the given range.
+ */
+ virtual wxString GetTextForRange(const wxRichTextRange& WXUNUSED(range)) const { return wxEmptyString; }
+
+ /**
+ Returns @true if this object can merge itself with the given one.
+ */
+ virtual bool CanMerge(wxRichTextObject* WXUNUSED(object), wxRichTextDrawingContext& WXUNUSED(context)) const { return false; }
+
+ /**
+ Returns @true if this object merged itself with the given one.
+ The calling code will then delete the given object.
+ */
+ virtual bool Merge(wxRichTextObject* WXUNUSED(object), wxRichTextDrawingContext& WXUNUSED(context)) { return false; }
+
+ /**
+ JACS
+ Returns @true if this object can potentially be split, by virtue of having
+ different virtual attributes for individual sub-objects.
+ */
+ virtual bool CanSplit(wxRichTextDrawingContext& WXUNUSED(context)) const { return false; }
+
+ /**
+ Returns the final object in the split objects if this object was split due to differences between sub-object virtual attributes.
+ Returns itself if it was not split.
+ */
+ virtual wxRichTextObject* Split(wxRichTextDrawingContext& WXUNUSED(context)) { return this; }
+
+ /**
+ Dump object data to the given output stream for debugging.
+ */
+ virtual void Dump(wxTextOutputStream& stream);
+
+ /**
+ Returns @true if we can edit the object's properties via a GUI.
+ */
+ virtual bool CanEditProperties() const { return false; }
+
+ /**
+ Edits the object's properties via a GUI.
+ */
+ virtual bool EditProperties(wxWindow* WXUNUSED(parent), wxRichTextBuffer* WXUNUSED(buffer)) { return false; }
+
+ /**
+ Returns the label to be used for the properties context menu item.
+ */
+ virtual wxString GetPropertiesMenuLabel() const { return wxEmptyString; }
+
+ /**
+ Returns @true if objects of this class can accept the focus, i.e. a call to SetFocusObject
+ is possible. For example, containers supporting text, such as a text box object, can accept the focus,
+ but a table can't (set the focus to individual cells instead).
+ */
+ virtual bool AcceptsFocus() const { return false; }
+
+#if wxUSE_XML
+ /**
+ Imports this object from XML.
+ */
+ virtual bool ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* node, wxRichTextXMLHandler* handler, bool* recurse);
+#endif
+
+#if wxRICHTEXT_HAVE_DIRECT_OUTPUT
+ /**
+ Exports this object directly to the given stream, bypassing the creation of a wxXmlNode hierarchy.
+ This method is considerably faster than creating a tree first. However, both versions of ExportXML must be
+ implemented so that if the tree method is made efficient in the future, we can deprecate the
+ more verbose direct output method. Compiled only if wxRICHTEXT_HAVE_DIRECT_OUTPUT is defined (on by default).
+ */
+ virtual bool ExportXML(wxOutputStream& stream, int indent, wxRichTextXMLHandler* handler);
+#endif
+
+#if wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT
+ /**
+ Exports this object to the given parent node, usually creating at least one child node.
+ This method is less efficient than the direct-to-stream method but is retained to allow for
+ switching to this method if we make it more efficient. Compiled only if wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT is defined
+ (on by default).
+ */
+ virtual bool ExportXML(wxXmlNode* parent, wxRichTextXMLHandler* handler);
+#endif
+
+ /**
+ Returns @true if this object takes note of paragraph attributes (text and image objects don't).
+ */
+ virtual bool UsesParagraphAttributes() const { return true; }
+
+ /**
+ Returns the XML node name of this object. This must be overridden for wxXmlNode-base XML export to work.
+ */
+ virtual wxString GetXMLNodeName() const { return wxT("unknown"); }
+
+ /**
+ Invalidates the object at the given range. With no argument, invalidates the whole object.
+ */
+ virtual void Invalidate(const wxRichTextRange& invalidRange = wxRICHTEXT_ALL);
+
+ /**
+ Returns @true if this object can handle the selections of its children, fOr example a table.
+ Required for composite selection handling to work.
+ */
+ virtual bool HandlesChildSelections() const { return false; }
+
+ /**
+ Returns a selection object specifying the selections between start and end character positions.
+ For example, a table would deduce what cells (of range length 1) are selected when dragging across the table.
+ */
+ virtual wxRichTextSelection GetSelection(long WXUNUSED(start), long WXUNUSED(end)) const { return wxRichTextSelection(); }
+
+// Accessors
+
+ /**
+ Gets the cached object size as calculated by Layout.
+ */
+ virtual wxSize GetCachedSize() const { return m_size; }
+
+ /**
+ Sets the cached object size as calculated by Layout.
+ */
+ virtual void SetCachedSize(const wxSize& sz) { m_size = sz; }
+
+ /**
+ Gets the maximum object size as calculated by Layout. This allows
+ us to fit an object to its contents or allocate extra space if required.
+ */
+ virtual wxSize GetMaxSize() const { return m_maxSize; }
+
+ /**
+ Sets the maximum object size as calculated by Layout. This allows
+ us to fit an object to its contents or allocate extra space if required.
+ */
+ virtual void SetMaxSize(const wxSize& sz) { m_maxSize = sz; }
+
+ /**
+ Gets the minimum object size as calculated by Layout. This allows
+ us to constrain an object to its absolute minimum size if necessary.
+ */
+ virtual wxSize GetMinSize() const { return m_minSize; }
+
+ /**
+ Sets the minimum object size as calculated by Layout. This allows
+ us to constrain an object to its absolute minimum size if necessary.
+ */
+ virtual void SetMinSize(const wxSize& sz) { m_minSize = sz; }
+
+ /**
+ Gets the 'natural' size for an object. For an image, it would be the
+ image size.
+ */
+ virtual wxTextAttrSize GetNaturalSize() const { return wxTextAttrSize(); }
+
+ /**
+ Returns the object position in pixels.
+ */
+ virtual wxPoint GetPosition() const { return m_pos; }
+
+ /**
+ Sets the object position in pixels.
+ */
+ virtual void SetPosition(const wxPoint& pos) { m_pos = pos; }
+
+ /**
+ Returns the absolute object position, by traversing up the child/parent hierarchy.
+ TODO: may not be needed, if all object positions are in fact relative to the
+ top of the coordinate space.
+ */
+ virtual wxPoint GetAbsolutePosition() const;
+
+ /**
+ Returns the rectangle enclosing the object.
+ */
+ virtual wxRect GetRect() const { return wxRect(GetPosition(), GetCachedSize()); }
+
+ /**
+ Sets the object's range within its container.
+ */
+ void SetRange(const wxRichTextRange& range) { m_range = range; }
+
+ /**
+ Returns the object's range.
+ */
+ const wxRichTextRange& GetRange() const { return m_range; }
+
+ /**
+ Returns the object's range.
+ */
+ wxRichTextRange& GetRange() { return m_range; }
+
+ /**
+ Set the object's own range, for a top-level object with its own position space.
+ */
+ void SetOwnRange(const wxRichTextRange& range) { m_ownRange = range; }
+
+ /**
+ Returns the object's own range (valid if top-level).
+ */
+ const wxRichTextRange& GetOwnRange() const { return m_ownRange; }
+
+ /**
+ Returns the object's own range (valid if top-level).
+ */
+ wxRichTextRange& GetOwnRange() { return m_ownRange; }
+
+ /**
+ Returns the object's own range only if a top-level object.
+ */
+ wxRichTextRange GetOwnRangeIfTopLevel() const { return IsTopLevel() ? m_ownRange : m_range; }
+
+ /**
+ Returns @true if this object is composite.
+ */
+ virtual bool IsComposite() const { return false; }
+
+ /**
+ Returns @true if no user editing can be done inside the object. This returns @true for simple objects,
+ @false for most composite objects, but @true for fields, which if composite, should not be user-edited.
+ */
+ virtual bool IsAtomic() const { return true; }
+
+ /**
+ Returns a pointer to the parent object.
+ */
+ virtual wxRichTextObject* GetParent() const { return m_parent; }
+
+ /**
+ Sets the pointer to the parent object.
+ */
+ virtual void SetParent(wxRichTextObject* parent) { m_parent = parent; }
+
+ /**
+ Returns the top-level container of this object.
+ May return itself if it's a container; use GetParentContainer to return
+ a different container.
+ */
+ virtual wxRichTextParagraphLayoutBox* GetContainer() const;
+
+ /**
+ Returns the top-level container of this object.
+ Returns a different container than itself, unless there's no parent, in which case it will return NULL.
+ */
+ virtual wxRichTextParagraphLayoutBox* GetParentContainer() const { return GetParent() ? GetParent()->GetContainer() : GetContainer(); }
+
+ /**
+ Set the margin around the object, in pixels.
+ */
+ virtual void SetMargins(int margin);
+
+ /**
+ Set the margin around the object, in pixels.
+ */
+ virtual void SetMargins(int leftMargin, int rightMargin, int topMargin, int bottomMargin);
+
+ /**
+ Returns the left margin of the object, in pixels.
+ */
+ virtual int GetLeftMargin() const;
+
+ /**
+ Returns the right margin of the object, in pixels.
+ */
+ virtual int GetRightMargin() const;
+
+ /**
+ Returns the top margin of the object, in pixels.
+ */
+ virtual int GetTopMargin() const;
+
+ /**
+ Returns the bottom margin of the object, in pixels.
+ */
+ virtual int GetBottomMargin() const;
+
+ /**
+ Calculates the available content space in the given rectangle, given the
+ margins, border and padding specified in the object's attributes.
+ */
+ virtual wxRect GetAvailableContentArea(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& outerRect) const;
+
+ /**
+ Lays out the object first with a given amount of space, and then if no width was specified in attr,
+ lays out the object again using the minimum size. @a availableParentSpace is the maximum space
+ for the object, whereas @a availableContainerSpace is the container with which relative positions and
+ sizes should be computed. For example, a text box whose space has already been constrained
+ in a previous layout pass to @a availableParentSpace, but should have a width of 50% of @a availableContainerSpace.
+ (If these two rects were the same, a 2nd pass could see the object getting too small.)
+ */
+ virtual bool LayoutToBestSize(wxDC& dc, wxRichTextDrawingContext& context, wxRichTextBuffer* buffer,
+ const wxRichTextAttr& parentAttr, const wxRichTextAttr& attr,
+ const wxRect& availableParentSpace, const wxRect& availableContainerSpace, int style);
+
+ /**
+ Adjusts the attributes for virtual attribute provision, collapsed borders, etc.
+ */
+ virtual bool AdjustAttributes(wxRichTextAttr& attr, wxRichTextDrawingContext& context);
+
+ /**
+ Sets the object's attributes.
+ */
+ void SetAttributes(const wxRichTextAttr& attr) { m_attributes = attr; }
+
+ /**
+ Returns the object's attributes.
+ */
+ const wxRichTextAttr& GetAttributes() const { return m_attributes; }
+
+ /**
+ Returns the object's attributes.
+ */
+ wxRichTextAttr& GetAttributes() { return m_attributes; }
+
+ /**
+ Returns the object's properties.
+ */
+ wxRichTextProperties& GetProperties() { return m_properties; }
+
+ /**
+ Returns the object's properties.
+ */
+ const wxRichTextProperties& GetProperties() const { return m_properties; }
+
+ /**
+ Sets the object's properties.
+ */
+ void SetProperties(const wxRichTextProperties& props) { m_properties = props; }
+
+ /**
+ Sets the stored descent value.
+ */
+ void SetDescent(int descent) { m_descent = descent; }
+
+ /**
+ Returns the stored descent value.
+ */
+ int GetDescent() const { return m_descent; }
+
+ /**
+ Returns the containing buffer.
+ */
+ wxRichTextBuffer* GetBuffer() const;
+
+ /**
+ Sets the identifying name for this object as a property using the "name" key.
+ */
+ void SetName(const wxString& name) { m_properties.SetProperty(wxT("name"), name); }
+
+ /**
+ Returns the identifying name for this object from the properties, using the "name" key.
+ */
+ wxString GetName() const { return m_properties.GetPropertyString(wxT("name")); }
+
+ /**
+ Returns @true if this object is top-level, i.e. contains its own paragraphs, such as a text box.
+ */
+ virtual bool IsTopLevel() const { return false; }
+
+ /**
+ Returns @true if the object will be shown, @false otherwise.
+ */
+ bool IsShown() const { return m_show; }
+
+// Operations
+
+ /**
+ Call to show or hide this object. This function does not cause the content to be
+ laid out or redrawn.
+ */
+ virtual void Show(bool show) { m_show = show; }
+
+ /**
+ Clones the object.
+ */
+ virtual wxRichTextObject* Clone() const { return NULL; }
+
+ /**
+ Copies the object.
+ */
+ void Copy(const wxRichTextObject& obj);
+
+ /**
+ Reference-counting allows us to use the same object in multiple
+ lists (not yet used).
+ */
+
+ void Reference() { m_refCount ++; }
+
+ /**
+ Reference-counting allows us to use the same object in multiple
+ lists (not yet used).
+ */
+ void Dereference();
+
+ /**
+ Moves the object recursively, by adding the offset from old to new.
+ */
+ virtual void Move(const wxPoint& pt);
+
+ /**
+ Converts units in tenths of a millimetre to device units.
+ */
+ int ConvertTenthsMMToPixels(wxDC& dc, int units) const;
+
+ /**
+ Converts units in tenths of a millimetre to device units.
+ */
+ static int ConvertTenthsMMToPixels(int ppi, int units, double scale = 1.0);
+
+ /**
+ Convert units in pixels to tenths of a millimetre.
+ */
+ int ConvertPixelsToTenthsMM(wxDC& dc, int pixels) const;
+
+ /**
+ Convert units in pixels to tenths of a millimetre.
+ */
+ static int ConvertPixelsToTenthsMM(int ppi, int pixels, double scale = 1.0);
+
+ /**
+ Draws the borders and background for the given rectangle and attributes.
+ @a boxRect is taken to be the outer margin box, not the box around the content.
+ */
+ static bool DrawBoxAttributes(wxDC& dc, wxRichTextBuffer* buffer, const wxRichTextAttr& attr, const wxRect& boxRect, int flags = 0, wxRichTextObject* obj = NULL);
+
+ /**
+ Draws a border.
+ */
+ static bool DrawBorder(wxDC& dc, wxRichTextBuffer* buffer, const wxTextAttrBorders& attr, const wxRect& rect, int flags = 0);
+
+ /**
+ Returns the various rectangles of the box model in pixels. You can either specify @a contentRect (inner)
+ or @a marginRect (outer), and the other must be the default rectangle (no width or height).
+ Note that the outline doesn't affect the position of the rectangle, it's drawn in whatever space
+ is available.
+ */
+ static bool GetBoxRects(wxDC& dc, wxRichTextBuffer* buffer, const wxRichTextAttr& attr, wxRect& marginRect, wxRect& borderRect, wxRect& contentRect, wxRect& paddingRect, wxRect& outlineRect);
+
+ /**
+ Returns the total margin for the object in pixels, taking into account margin, padding and border size.
+ */
+ static bool GetTotalMargin(wxDC& dc, wxRichTextBuffer* buffer, const wxRichTextAttr& attr, int& leftMargin, int& rightMargin,
+ int& topMargin, int& bottomMargin);
+
+ /**
+ Returns the rectangle which the child has available to it given restrictions specified in the
+ child attribute, e.g. 50% width of the parent, 400 pixels, x position 20% of the parent, etc.
+ availableContainerSpace might be a parent that the cell has to compute its width relative to.
+ E.g. a cell that's 50% of its parent.
+ */
+ static wxRect AdjustAvailableSpace(wxDC& dc, wxRichTextBuffer* buffer, const wxRichTextAttr& parentAttr, const wxRichTextAttr& childAttr,
+ const wxRect& availableParentSpace, const wxRect& availableContainerSpace);
+
+protected:
+ wxSize m_size;
+ wxSize m_maxSize;
+ wxSize m_minSize;
+ wxPoint m_pos;
+ int m_descent; // Descent for this object (if any)
+ int m_refCount;
+ bool m_show;
+ wxRichTextObject* m_parent;
+
+ // The range of this object (start position to end position)
+ wxRichTextRange m_range;
+
+ // The internal range of this object, if it's a top-level object with its own range space
+ wxRichTextRange m_ownRange;
+
+ // Attributes
+ wxRichTextAttr m_attributes;
+
+ // Properties
+ wxRichTextProperties m_properties;
+};
+
+WX_DECLARE_LIST_WITH_DECL( wxRichTextObject, wxRichTextObjectList, class WXDLLIMPEXP_RICHTEXT );
+
+/**
+ @class wxRichTextCompositeObject
+
+ Objects of this class can contain other objects.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextObject, wxRichTextBuffer, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextCompositeObject: public wxRichTextObject
+{
+ DECLARE_CLASS(wxRichTextCompositeObject)
+public:
+// Constructors
+
+ wxRichTextCompositeObject(wxRichTextObject* parent = NULL);
+ virtual ~wxRichTextCompositeObject();
+
+// Overridables
+
+ virtual int HitTest(wxDC& dc, wxRichTextDrawingContext& context, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0);
+
+ virtual bool FindPosition(wxDC& dc, wxRichTextDrawingContext& context, long index, wxPoint& pt, int* height, bool forceLineStart);
+
+ virtual void CalculateRange(long start, long& end);
+
+ virtual bool DeleteRange(const wxRichTextRange& range);
+
+ virtual wxString GetTextForRange(const wxRichTextRange& range) const;
+
+ virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
+
+ virtual void Dump(wxTextOutputStream& stream);
+
+ virtual void Invalidate(const wxRichTextRange& invalidRange = wxRICHTEXT_ALL);
+
+// Accessors
+
+ /**
+ Returns the children.
+ */
+ wxRichTextObjectList& GetChildren() { return m_children; }
+ /**
+ Returns the children.
+ */
+ const wxRichTextObjectList& GetChildren() const { return m_children; }
+
+ /**
+ Returns the number of children.
+ */
+ size_t GetChildCount() const ;
+
+ /**
+ Returns the nth child.
+ */
+ wxRichTextObject* GetChild(size_t n) const ;
+
+ /**
+ Returns @true if this object is composite.
+ */
+ virtual bool IsComposite() const { return true; }
+
+ /**
+ Returns @true if no user editing can be done inside the object. This returns @true for simple objects,
+ @false for most composite objects, but @true for fields, which if composite, should not be user-edited.
+ */
+ virtual bool IsAtomic() const { return false; }
+
+ /**
+ Returns true if the buffer is empty.
+ */
+ virtual bool IsEmpty() const { return GetChildCount() == 0; }
+
+ /**
+ Returns the child object at the given character position.
+ */
+ virtual wxRichTextObject* GetChildAtPosition(long pos) const;
+
+// Operations
+
+ void Copy(const wxRichTextCompositeObject& obj);
+
+ void operator= (const wxRichTextCompositeObject& obj) { Copy(obj); }
+
+ /**
+ Appends a child, returning the position.
+ */
+ size_t AppendChild(wxRichTextObject* child) ;
+
+ /**
+ Inserts the child in front of the given object, or at the beginning.
+ */
+ bool InsertChild(wxRichTextObject* child, wxRichTextObject* inFrontOf) ;
+
+ /**
+ Removes and optionally deletes the specified child.
+ */
+ bool RemoveChild(wxRichTextObject* child, bool deleteChild = false) ;
+
+ /**
+ Deletes all the children.
+ */
+ bool DeleteChildren() ;
+
+ /**
+ Recursively merges all pieces that can be merged.
+ */
+ bool Defragment(wxRichTextDrawingContext& context, const wxRichTextRange& range = wxRICHTEXT_ALL);
+
+ /**
+ Moves the object recursively, by adding the offset from old to new.
+ */
+ virtual void Move(const wxPoint& pt);
+
+protected:
+ wxRichTextObjectList m_children;
+};
+
+/**
+ @class wxRichTextParagraphLayoutBox
+
+ This class knows how to lay out paragraphs.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextCompositeObject, wxRichTextObject, wxRichTextBuffer, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextParagraphLayoutBox: public wxRichTextCompositeObject
+{
+ DECLARE_DYNAMIC_CLASS(wxRichTextParagraphLayoutBox)
+public:
+// Constructors
+
+ wxRichTextParagraphLayoutBox(wxRichTextObject* parent = NULL);
+ wxRichTextParagraphLayoutBox(const wxRichTextParagraphLayoutBox& obj): wxRichTextCompositeObject() { Init(); Copy(obj); }
+ ~wxRichTextParagraphLayoutBox();
+
+// Overridables
+
+ virtual int HitTest(wxDC& dc, wxRichTextDrawingContext& context, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0);
+
+ virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style);
+
+ virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
+
+ virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
+
+ virtual bool DeleteRange(const wxRichTextRange& range);
+
+ virtual wxString GetTextForRange(const wxRichTextRange& range) const;
+
+#if wxUSE_XML
+ virtual bool ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* node, wxRichTextXMLHandler* handler, bool* recurse);
+#endif
+
+#if wxRICHTEXT_HAVE_DIRECT_OUTPUT
+ virtual bool ExportXML(wxOutputStream& stream, int indent, wxRichTextXMLHandler* handler);
+#endif
+
+#if wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT
+ virtual bool ExportXML(wxXmlNode* parent, wxRichTextXMLHandler* handler);
+#endif
+
+ virtual wxString GetXMLNodeName() const { return wxT("paragraphlayout"); }
+
+ virtual bool AcceptsFocus() const { return true; }
+
+// Accessors
+
+ /**
+ Associates a control with the buffer, for operations that for example require refreshing the window.
+ */
+ void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_ctrl = ctrl; }
+
+ /**
+ Returns the associated control.
+ */
+ wxRichTextCtrl* GetRichTextCtrl() const { return m_ctrl; }
+
+ /**
+ Sets a flag indicating whether the last paragraph is partial or complete.
+ */
+ void SetPartialParagraph(bool partialPara) { m_partialParagraph = partialPara; }
+
+ /**
+ Returns a flag indicating whether the last paragraph is partial or complete.
+ */
+ bool GetPartialParagraph() const { return m_partialParagraph; }
+
+ /**
+ Returns the style sheet associated with the overall buffer.
+ */
+ virtual wxRichTextStyleSheet* GetStyleSheet() const;
+
+ virtual bool IsTopLevel() const { return true; }
+
+// Operations
+
+ /**
+ Submits a command to insert paragraphs.
+ */
+ bool InsertParagraphsWithUndo(wxRichTextBuffer* buffer, long pos, const wxRichTextParagraphLayoutBox& paragraphs, wxRichTextCtrl* ctrl, int flags = 0);
+
+ /**
+ Submits a command to insert the given text.
+ */
+ bool InsertTextWithUndo(wxRichTextBuffer* buffer, long pos, const wxString& text, wxRichTextCtrl* ctrl, int flags = 0);
+
+ /**
+ Submits a command to insert the given text.
+ */
+ bool InsertNewlineWithUndo(wxRichTextBuffer* buffer, long pos, wxRichTextCtrl* ctrl, int flags = 0);
+
+ /**
+ Submits a command to insert the given image.
+ */
+ bool InsertImageWithUndo(wxRichTextBuffer* buffer, long pos, const wxRichTextImageBlock& imageBlock,
+ wxRichTextCtrl* ctrl, int flags, const wxRichTextAttr& textAttr);
+
+ /**
+ Submits a command to insert the given field. Field data can be included in properties.
+
+ @see wxRichTextField, wxRichTextFieldType, wxRichTextFieldTypeStandard
+ */
+ wxRichTextField* InsertFieldWithUndo(wxRichTextBuffer* buffer, long pos, const wxString& fieldType,
+ const wxRichTextProperties& properties,
+ wxRichTextCtrl* ctrl, int flags,
+ const wxRichTextAttr& textAttr);
+
+ /**
+ Returns the style that is appropriate for a new paragraph at this position.
+ If the previous paragraph has a paragraph style name, looks up the next-paragraph
+ style.
+ */
+ wxRichTextAttr GetStyleForNewParagraph(wxRichTextBuffer* buffer, long pos, bool caretPosition = false, bool lookUpNewParaStyle=false) const;
+
+ /**
+ Inserts an object.
+ */
+ wxRichTextObject* InsertObjectWithUndo(wxRichTextBuffer* buffer, long pos, wxRichTextObject *object, wxRichTextCtrl* ctrl, int flags = 0);
+
+ /**
+ Submits a command to delete this range.
+ */
+ bool DeleteRangeWithUndo(const wxRichTextRange& range, wxRichTextCtrl* ctrl, wxRichTextBuffer* buffer);
+
+ /**
+ Draws the floating objects in this buffer.
+ */
+ void DrawFloats(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style);
+
+ /**
+ Moves an anchored object to another paragraph.
+ */
+ void MoveAnchoredObjectToParagraph(wxRichTextParagraph* from, wxRichTextParagraph* to, wxRichTextObject* obj);
+
+ /**
+ Initializes the object.
+ */
+ void Init();
+
+ /**
+ Clears all the children.
+ */
+ virtual void Clear();
+
+ /**
+ Clears and initializes with one blank paragraph.
+ */
+ virtual void Reset();
+
+ /**
+ Convenience function to add a paragraph of text.
+ */
+ virtual wxRichTextRange AddParagraph(const wxString& text, wxRichTextAttr* paraStyle = NULL);
+
+ /**
+ Convenience function to add an image.
+ */
+ virtual wxRichTextRange AddImage(const wxImage& image, wxRichTextAttr* paraStyle = NULL);
+
+ /**
+ Adds multiple paragraphs, based on newlines.
+ */
+ virtual wxRichTextRange AddParagraphs(const wxString& text, wxRichTextAttr* paraStyle = NULL);
+
+ /**
+ Returns the line at the given position. If @a caretPosition is true, the position is
+ a caret position, which is normally a smaller number.
+ */
+ virtual wxRichTextLine* GetLineAtPosition(long pos, bool caretPosition = false) const;
+
+ /**
+ Returns the line at the given y pixel position, or the last line.
+ */
+ virtual wxRichTextLine* GetLineAtYPosition(int y) const;
+
+ /**
+ Returns the paragraph at the given character or caret position.
+ */
+ virtual wxRichTextParagraph* GetParagraphAtPosition(long pos, bool caretPosition = false) const;
+
+ /**
+ Returns the line size at the given position.
+ */
+ virtual wxSize GetLineSizeAtPosition(long pos, bool caretPosition = false) const;
+
+ /**
+ Given a position, returns the number of the visible line (potentially many to a paragraph),
+ starting from zero at the start of the buffer. We also have to pass a bool (@a startOfLine)
+ that indicates whether the caret is being shown at the end of the previous line or at the start
+ of the next, since the caret can be shown at two visible positions for the same underlying
+ position.
+ */
+ virtual long GetVisibleLineNumber(long pos, bool caretPosition = false, bool startOfLine = false) const;
+
+ /**
+ Given a line number, returns the corresponding wxRichTextLine object.
+ */
+ virtual wxRichTextLine* GetLineForVisibleLineNumber(long lineNumber) const;
+
+ /**
+ Returns the leaf object in a paragraph at this position.
+ */
+ virtual wxRichTextObject* GetLeafObjectAtPosition(long position) const;
+
+ /**
+ Returns the paragraph by number.
+ */
+ virtual wxRichTextParagraph* GetParagraphAtLine(long paragraphNumber) const;
+
+ /**
+ Returns the paragraph for a given line.
+ */
+ virtual wxRichTextParagraph* GetParagraphForLine(wxRichTextLine* line) const;
+
+ /**
+ Returns the length of the paragraph.
+ */
+ virtual int GetParagraphLength(long paragraphNumber) const;
+
+ /**
+ Returns the number of paragraphs.
+ */
+ virtual int GetParagraphCount() const { return static_cast<int>(GetChildCount()); }
+
+ /**
+ Returns the number of visible lines.
+ */
+ virtual int GetLineCount() const;
+
+ /**
+ Returns the text of the paragraph.
+ */
+ virtual wxString GetParagraphText(long paragraphNumber) const;
+
+ /**
+ Converts zero-based line column and paragraph number to a position.
+ */
+ virtual long XYToPosition(long x, long y) const;
+
+ /**
+ Converts a zero-based position to line column and paragraph number.
+ */
+ virtual bool PositionToXY(long pos, long* x, long* y) const;
+
+ /**
+ Sets the attributes for the given range. Pass flags to determine how the
+ attributes are set.
+
+ The end point of range is specified as the last character position of the span
+ of text. So, for example, to set the style for a character at position 5,
+ use the range (5,5).
+ This differs from the wxRichTextCtrl API, where you would specify (5,6).
+
+ @a flags may contain a bit list of the following values:
+ - wxRICHTEXT_SETSTYLE_NONE: no style flag.
+ - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this operation should be
+ undoable.
+ - wxRICHTEXT_SETSTYLE_OPTIMIZE: specifies that the style should not be applied
+ if the combined style at this point is already the style in question.
+ - wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY: specifies that the style should only be
+ applied to paragraphs, and not the content.
+ This allows content styling to be preserved independently from that
+ of e.g. a named paragraph style.
+ - wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY: specifies that the style should only be
+ applied to characters, and not the paragraph.
+ This allows content styling to be preserved independently from that
+ of e.g. a named paragraph style.
+ - wxRICHTEXT_SETSTYLE_RESET: resets (clears) the existing style before applying
+ the new style.
+ - wxRICHTEXT_SETSTYLE_REMOVE: removes the specified style.
+ Only the style flags are used in this operation.
+ */
+ virtual bool SetStyle(const wxRichTextRange& range, const wxRichTextAttr& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
+
+ /**
+ Sets the attributes for the given object only, for example the box attributes for a text box.
+ */
+ virtual void SetStyle(wxRichTextObject *obj, const wxRichTextAttr& textAttr, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
+
+ /**
+ Returns the combined text attributes for this position.
+
+ This function gets the @e uncombined style - that is, the attributes associated
+ with the paragraph or character content, and not necessarily the combined
+ attributes you see on the screen. To get the combined attributes, use GetStyle().
+ If you specify (any) paragraph attribute in @e style's flags, this function
+ will fetch the paragraph attributes.
+ Otherwise, it will return the character attributes.
+ */
+ virtual bool GetStyle(long position, wxRichTextAttr& style);
+
+ /**
+ Returns the content (uncombined) attributes for this position.
+ */
+ virtual bool GetUncombinedStyle(long position, wxRichTextAttr& style);
+
+ /**
+ Implementation helper for GetStyle. If combineStyles is true, combine base, paragraph and
+ context attributes.
+ */
+ virtual bool DoGetStyle(long position, wxRichTextAttr& style, bool combineStyles = true);
+
+ /**
+ This function gets a style representing the common, combined attributes in the
+ given range.
+ Attributes which have different values within the specified range will not be
+ included the style flags.
+
+ The function is used to get the attributes to display in the formatting dialog:
+ the user can edit the attributes common to the selection, and optionally specify the
+ values of further attributes to be applied uniformly.
+
+ To apply the edited attributes, you can use SetStyle() specifying
+ the wxRICHTEXT_SETSTYLE_OPTIMIZE flag, which will only apply attributes that
+ are different from the @e combined attributes within the range.
+ So, the user edits the effective, displayed attributes for the range,
+ but his choice won't be applied unnecessarily to content. As an example,
+ say the style for a paragraph specifies bold, but the paragraph text doesn't
+ specify a weight.
+ The combined style is bold, and this is what the user will see on-screen and
+ in the formatting dialog. The user now specifies red text, in addition to bold.
+ When applying with SetStyle(), the content font weight attributes won't be
+ changed to bold because this is already specified by the paragraph.
+ However the text colour attributes @e will be changed to show red.
+ */
+ virtual bool GetStyleForRange(const wxRichTextRange& range, wxRichTextAttr& style);
+
+ /**
+ Combines @a style with @a currentStyle for the purpose of summarising the attributes of a range of
+ content.
+ */
+ bool CollectStyle(wxRichTextAttr& currentStyle, const wxRichTextAttr& style, wxRichTextAttr& clashingAttr, wxRichTextAttr& absentAttr);
+
+ //@{
+ /**
+ Sets the list attributes for the given range, passing flags to determine how
+ the attributes are set.
+ Either the style definition or the name of the style definition (in the current
+ sheet) can be passed.
+
+ @a flags is a bit list of the following:
+ - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
+ - wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from
+ @a startFrom, otherwise existing attributes are used.
+ - wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used
+ as the level for all paragraphs, otherwise the current indentation will be used.
+
+ @see NumberList(), PromoteList(), ClearListStyle().
+ */
+ virtual bool SetListStyle(const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
+ virtual bool SetListStyle(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
+ //@}
+
+ /**
+ Clears the list style from the given range, clearing list-related attributes
+ and applying any named paragraph style associated with each paragraph.
+
+ @a flags is a bit list of the following:
+ - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
+
+ @see SetListStyle(), PromoteList(), NumberList()
+ */
+ virtual bool ClearListStyle(const wxRichTextRange& range, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
+
+ //@{
+ /**
+ Numbers the paragraphs in the given range.
+
+ Pass flags to determine how the attributes are set.
+ Either the style definition or the name of the style definition (in the current
+ sheet) can be passed.
+
+ @a flags is a bit list of the following:
+ - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
+ - wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from
+ @a startFrom, otherwise existing attributes are used.
+ - wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used
+ as the level for all paragraphs, otherwise the current indentation will be used.
+
+ @a def can be NULL to indicate that the existing list style should be used.
+
+ @see SetListStyle(), PromoteList(), ClearListStyle()
+ */
+ virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
+ virtual bool NumberList(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
+ //@}
+
+ //@{
+ /**
+ Promotes the list items within the given range.
+ A positive @a promoteBy produces a smaller indent, and a negative number
+ produces a larger indent. Pass flags to determine how the attributes are set.
+ Either the style definition or the name of the style definition (in the current
+ sheet) can be passed.
+
+ @a flags is a bit list of the following:
+ - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
+ - wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from
+ @a startFrom, otherwise existing attributes are used.
+ - wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used
+ as the level for all paragraphs, otherwise the current indentation will be used.
+
+ @see SetListStyle(), SetListStyle(), ClearListStyle()
+ */
+ virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1);
+ virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1);
+ //@}
+
+ /**
+ Helper for NumberList and PromoteList, that does renumbering and promotion simultaneously
+ @a def can be NULL/empty to indicate that the existing list style should be used.
+ */
+ virtual bool DoNumberList(const wxRichTextRange& range, const wxRichTextRange& promotionRange, int promoteBy, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
+
+ /**
+ Fills in the attributes for numbering a paragraph after previousParagraph.
+ */
+ virtual bool FindNextParagraphNumber(wxRichTextParagraph* previousParagraph, wxRichTextAttr& attr) const;
+
+ /**
+ Sets the properties for the given range, passing flags to determine how the
+ attributes are set. You can merge properties or replace them.
+
+ The end point of range is specified as the last character position of the span
+ of text, plus one. So, for example, to set the properties for a character at
+ position 5, use the range (5,6).
+
+ @a flags may contain a bit list of the following values:
+ - wxRICHTEXT_SETPROPERTIES_NONE: no flag.
+ - wxRICHTEXT_SETPROPERTIES_WITH_UNDO: specifies that this operation should be
+ undoable.
+ - wxRICHTEXT_SETPROPERTIES_PARAGRAPHS_ONLY: specifies that the properties should only be
+ applied to paragraphs, and not the content.
+ - wxRICHTEXT_SETPROPERTIES_CHARACTERS_ONLY: specifies that the properties should only be
+ applied to characters, and not the paragraph.
+ - wxRICHTEXT_SETPROPERTIES_RESET: resets (clears) the existing properties before applying
+ the new properties.
+ - wxRICHTEXT_SETPROPERTIES_REMOVE: removes the specified properties.
+ */
+ virtual bool SetProperties(const wxRichTextRange& range, const wxRichTextProperties& properties, int flags = wxRICHTEXT_SETPROPERTIES_WITH_UNDO);
+
+ /**
+ Sets with undo the properties for the given object.
+ */
+ virtual bool SetObjectPropertiesWithUndo(wxRichTextObject& obj, const wxRichTextProperties& properties, wxRichTextObject* objToSet = NULL);
+
+ /**
+ Test if this whole range has character attributes of the specified kind. If any
+ of the attributes are different within the range, the test fails. You
+ can use this to implement, for example, bold button updating. style must have
+ flags indicating which attributes are of interest.
+ */
+ virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const;
+
+ /**
+ Test if this whole range has paragraph attributes of the specified kind. If any
+ of the attributes are different within the range, the test fails. You
+ can use this to implement, for example, centering button updating. style must have
+ flags indicating which attributes are of interest.
+ */
+ virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const;
+
+ virtual wxRichTextObject* Clone() const { return new wxRichTextParagraphLayoutBox(*this); }
+
+ /**
+ Prepares the content just before insertion (or after buffer reset).
+ Currently is only called if undo mode is on.
+ */
+ virtual void PrepareContent(wxRichTextParagraphLayoutBox& container);
+
+ /**
+ Insert fragment into this box at the given position. If partialParagraph is true,
+ it is assumed that the last (or only) paragraph is just a piece of data with no paragraph
+ marker.
+ */
+ virtual bool InsertFragment(long position, wxRichTextParagraphLayoutBox& fragment);
+
+ /**
+ Make a copy of the fragment corresponding to the given range, putting it in @a fragment.
+ */
+ virtual bool CopyFragment(const wxRichTextRange& range, wxRichTextParagraphLayoutBox& fragment);
+
+ /**
+ Apply the style sheet to the buffer, for example if the styles have changed.
+ */
+ virtual bool ApplyStyleSheet(wxRichTextStyleSheet* styleSheet);
+
+ void Copy(const wxRichTextParagraphLayoutBox& obj);
+
+ void operator= (const wxRichTextParagraphLayoutBox& obj) { Copy(obj); }
+
+ /**
+ Calculate ranges.
+ */
+ virtual void UpdateRanges();
+
+ /**
+ Get all the text.
+ */
+ virtual wxString GetText() const;
+
+ /**
+ Sets the default style, affecting the style currently being applied
+ (for example, setting the default style to bold will cause subsequently
+ inserted text to be bold).
+
+ This is not cumulative - setting the default style will replace the previous
+ default style.
+
+ Setting it to a default attribute object makes new content take on the 'basic' style.
+ */
+ virtual bool SetDefaultStyle(const wxRichTextAttr& style);
+
+ /**
+ Returns the current default style, affecting the style currently being applied
+ (for example, setting the default style to bold will cause subsequently
+ inserted text to be bold).
+ */
+ virtual const wxRichTextAttr& GetDefaultStyle() const { return m_defaultAttributes; }
+
+ /**
+ Sets the basic (overall) style. This is the style of the whole
+ buffer before further styles are applied, unlike the default style, which
+ only affects the style currently being applied (for example, setting the default
+ style to bold will cause subsequently inserted text to be bold).
+ */
+ virtual void SetBasicStyle(const wxRichTextAttr& style) { m_attributes = style; }
+
+ /**
+ Returns the basic (overall) style.
+
+ This is the style of the whole buffer before further styles are applied,
+ unlike the default style, which only affects the style currently being
+ applied (for example, setting the default style to bold will cause
+ subsequently inserted text to be bold).
+ */
+ virtual const wxRichTextAttr& GetBasicStyle() const { return m_attributes; }
+
+ /**
+ Invalidates the buffer. With no argument, invalidates whole buffer.
+ */
+ virtual void Invalidate(const wxRichTextRange& invalidRange = wxRICHTEXT_ALL);
+
+ /**
+ Do the (in)validation for this object only.
+ */
+ virtual void DoInvalidate(const wxRichTextRange& invalidRange);
+
+ /**
+ Do the (in)validation both up and down the hierarchy.
+ */
+ virtual void InvalidateHierarchy(const wxRichTextRange& invalidRange = wxRICHTEXT_ALL);
+
+ /**
+ Gather information about floating objects. If untilObj is non-NULL,
+ will stop getting information if the current object is this, since we
+ will collect the rest later.
+ */
+ virtual bool UpdateFloatingObjects(const wxRect& availableRect, wxRichTextObject* untilObj = NULL);
+
+ /**
+ Get invalid range, rounding to entire paragraphs if argument is true.
+ */
+ wxRichTextRange GetInvalidRange(bool wholeParagraphs = false) const;
+
+ /**
+ Returns @true if this object needs layout.
+ */
+ bool IsDirty() const { return m_invalidRange != wxRICHTEXT_NONE; }
+
+ /**
+ Returns the wxRichTextFloatCollector of this object.
+ */
+ wxRichTextFloatCollector* GetFloatCollector() { return m_floatCollector; }
+
+ /**
+ Returns the number of floating objects at this level.
+ */
+ int GetFloatingObjectCount() const;
+
+ /**
+ Returns a list of floating objects.
+ */
+ bool GetFloatingObjects(wxRichTextObjectList& objects) const;
+
+protected:
+ wxRichTextCtrl* m_ctrl;
+ wxRichTextAttr m_defaultAttributes;
+
+ // The invalidated range that will need full layout
+ wxRichTextRange m_invalidRange;
+
+ // Is the last paragraph partial or complete?
+ bool m_partialParagraph;
+
+ // The floating layout state
+ wxRichTextFloatCollector* m_floatCollector;
+};
+
+/**
+ @class wxRichTextBox
+
+ This class implements a floating or inline text box, containing paragraphs.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextParagraphLayoutBox, wxRichTextObject, wxRichTextBuffer, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextBox: public wxRichTextParagraphLayoutBox
+{
+ DECLARE_DYNAMIC_CLASS(wxRichTextBox)
+public:
+// Constructors
+
+ /**
+ Default constructor; optionally pass the parent object.
+ */
+
+ wxRichTextBox(wxRichTextObject* parent = NULL);
+
+ /**
+ Copy constructor.
+ */
+
+ wxRichTextBox(const wxRichTextBox& obj): wxRichTextParagraphLayoutBox() { Copy(obj); }
+
+// Overridables
+
+ virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style);
+
+ virtual wxString GetXMLNodeName() const { return wxT("textbox"); }
+
+ virtual bool CanEditProperties() const { return true; }
+
+ virtual bool EditProperties(wxWindow* parent, wxRichTextBuffer* buffer);
+
+ virtual wxString GetPropertiesMenuLabel() const { return wxGetTranslation("&Box"); }
+
+// Accessors
+
+// Operations
+
+ virtual wxRichTextObject* Clone() const { return new wxRichTextBox(*this); }
+
+ void Copy(const wxRichTextBox& obj);
+
+protected:
+};
+
+/**
+ @class wxRichTextField
+
+ This class implements the general concept of a field, an object that represents
+ additional functionality such as a footnote, a bookmark, a page number, a table
+ of contents, and so on. Extra information (such as a bookmark name) can be stored
+ in the object properties.
+
+ Drawing, layout, and property editing is delegated to classes derived
+ from wxRichTextFieldType, such as instances of wxRichTextFieldTypeStandard; this makes
+ the use of fields an efficient method of introducing extra functionality, since
+ most of the information required to draw a field (such as a bitmap) is kept centrally
+ in a single field type definition.
+
+ The FieldType property, accessed by SetFieldType/GetFieldType, is used to retrieve
+ the field type definition. So be careful not to overwrite this property.
+
+ wxRichTextField is derived from wxRichTextParagraphLayoutBox, which means that it
+ can contain its own read-only content, refreshed when the application calls the UpdateField
+ function. Whether a field is treated as a composite or a single graphic is determined
+ by the field type definition. If using wxRichTextFieldTypeStandard, passing the display
+ type wxRICHTEXT_FIELD_STYLE_COMPOSITE to the field type definition causes the field
+ to behave like a composite; the other display styles display a simple graphic.
+ When implementing a composite field, you will still need to derive from wxRichTextFieldTypeStandard
+ or wxRichTextFieldType, if only to implement UpdateField to refresh the field content
+ appropriately. wxRichTextFieldTypeStandard is only one possible implementation, but
+ covers common needs especially for simple, static fields using text or a bitmap.
+
+ Register field types on application initialisation with the static function
+ wxRichTextBuffer::AddFieldType. They will be deleted automatically on
+ application exit.
+
+ An application can write a field to a control with wxRichTextCtrl::WriteField,
+ taking a field type, the properties for the field, and optional attributes.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextFieldTypeStandard, wxRichTextFieldType, wxRichTextParagraphLayoutBox, wxRichTextProperties, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextField: public wxRichTextParagraphLayoutBox
+{
+ DECLARE_DYNAMIC_CLASS(wxRichTextField)
+public:
+// Constructors
+
+ /**
+ Default constructor; optionally pass the parent object.
+ */
+
+ wxRichTextField(const wxString& fieldType = wxEmptyString, wxRichTextObject* parent = NULL);
+
+ /**
+ Copy constructor.
+ */
+
+ wxRichTextField(const wxRichTextField& obj): wxRichTextParagraphLayoutBox() { Copy(obj); }
+
+// Overridables
+
+ virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style);
+
+ virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
+
+ virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
+
+ virtual wxString GetXMLNodeName() const { return wxT("field"); }
+
+ virtual bool CanEditProperties() const;
+
+ virtual bool EditProperties(wxWindow* parent, wxRichTextBuffer* buffer);
+
+ virtual wxString GetPropertiesMenuLabel() const;
+
+ virtual bool AcceptsFocus() const { return false; }
+
+ virtual void CalculateRange(long start, long& end);
+
+ /**
+ If a field has children, we don't want the user to be able to edit it.
+ */
+ virtual bool IsAtomic() const { return true; }
+
+ virtual bool IsEmpty() const { return false; }
+
+ virtual bool IsTopLevel() const;
+
+// Accessors
+
+ void SetFieldType(const wxString& fieldType) { GetProperties().SetProperty(wxT("FieldType"), fieldType); }
+ wxString GetFieldType() const { return GetProperties().GetPropertyString(wxT("FieldType")); }
+
+// Operations
+
+ /**
+ Update the field; delegated to the associated field type. This would typically expand the field to its value,
+ if this is a dynamically changing and/or composite field.
+ */
+ virtual bool UpdateField(wxRichTextBuffer* buffer);
+
+ virtual wxRichTextObject* Clone() const { return new wxRichTextField(*this); }
+
+ void Copy(const wxRichTextField& obj);
+
+protected:
+};
+
+/**
+ @class wxRichTextFieldType
+
+ The base class for custom field types. Each type definition handles one
+ field type. Override functions to provide drawing, layout, updating and
+ property editing functionality for a field.
+
+ Register field types on application initialisation with the static function
+ wxRichTextBuffer::AddFieldType. They will be deleted automatically on
+ application exit.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextFieldTypeStandard, wxRichTextField, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextFieldType: public wxObject
+{
+ DECLARE_CLASS(wxRichTextFieldType)
+public:
+ /**
+ Creates a field type definition.
+ */
+ wxRichTextFieldType(const wxString& name = wxEmptyString)
+ : m_name(name)
+ { }
+
+ /**
+ Copy constructor.
+ */
+ wxRichTextFieldType(const wxRichTextFieldType& fieldType)
+ : wxObject(fieldType)
+ { Copy(fieldType); }
+
+ void Copy(const wxRichTextFieldType& fieldType) { m_name = fieldType.m_name; }
+
+ /**
+ Draw the item, within the given range. Some objects may ignore the range (for
+ example paragraphs) while others must obey it (lines, to implement wrapping)
+ */
+ virtual bool Draw(wxRichTextField* obj, wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style) = 0;
+
+ /**
+ Lay the item out at the specified position with the given size constraint.
+ Layout must set the cached size. @rect is the available space for the object,
+ and @a parentRect is the container that is used to determine a relative size
+ or position (for example if a text box must be 50% of the parent text box).
+ */
+ virtual bool Layout(wxRichTextField* obj, wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style) = 0;
+
+ /**
+ Returns the object size for the given range. Returns @false if the range
+ is invalid for this object.
+ */
+ virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const = 0;
+
+ /**
+ Returns @true if we can edit the object's properties via a GUI.
+ */
+ virtual bool CanEditProperties(wxRichTextField* WXUNUSED(obj)) const { return false; }
+
+ /**
+ Edits the object's properties via a GUI.
+ */
+ virtual bool EditProperties(wxRichTextField* WXUNUSED(obj), wxWindow* WXUNUSED(parent), wxRichTextBuffer* WXUNUSED(buffer)) { return false; }
+
+ /**
+ Returns the label to be used for the properties context menu item.
+ */
+ virtual wxString GetPropertiesMenuLabel(wxRichTextField* WXUNUSED(obj)) const { return wxEmptyString; }
+
+ /**
+ Update the field. This would typically expand the field to its value,
+ if this is a dynamically changing and/or composite field.
+ */
+ virtual bool UpdateField(wxRichTextBuffer* WXUNUSED(buffer), wxRichTextField* WXUNUSED(obj)) { return false; }
+
+ /**
+ Returns @true if this object is top-level, i.e. contains its own paragraphs, such as a text box.
+ */
+ virtual bool IsTopLevel(wxRichTextField* WXUNUSED(obj)) const { return true; }
+
+ /**
+ Sets the field type name. There should be a unique name per field type object.
+ */
+ void SetName(const wxString& name) { m_name = name; }
+
+ /**
+ Returns the field type name. There should be a unique name per field type object.
+ */
+ wxString GetName() const { return m_name; }
+
+protected:
+
+ wxString m_name;
+};
+
+WX_DECLARE_STRING_HASH_MAP(wxRichTextFieldType*, wxRichTextFieldTypeHashMap);
+
+/**
+ @class wxRichTextFieldTypeStandard
+
+ A field type that can handle fields with text or bitmap labels, with a small range
+ of styles for implementing rectangular fields and fields that can be used for start
+ and end tags.
+
+ The border, text and background colours can be customised; the default is
+ white text on a black background.
+
+ The following display styles can be used.
+
+ @beginStyleTable
+ @style{wxRICHTEXT_FIELD_STYLE_COMPOSITE}
+ Creates a composite field; you will probably need to derive a new class to implement UpdateField.
+ @style{wxRICHTEXT_FIELD_STYLE_RECTANGLE}
+ Shows a rounded rectangle background.
+ @style{wxRICHTEXT_FIELD_STYLE_NO_BORDER}
+ Suppresses the background and border; mostly used with a bitmap label.
+ @style{wxRICHTEXT_FIELD_STYLE_START_TAG}
+ Shows a start tag background, with the pointy end facing right.
+ @style{wxRICHTEXT_FIELD_STYLE_END_TAG}
+ Shows an end tag background, with the pointy end facing left.
+ @endStyleTable
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextFieldType, wxRichTextField, wxRichTextBuffer, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextFieldTypeStandard: public wxRichTextFieldType
+{
+ DECLARE_CLASS(wxRichTextFieldTypeStandard)
+public:
+
+ // Display style types
+ enum { wxRICHTEXT_FIELD_STYLE_COMPOSITE = 0x01,
+ wxRICHTEXT_FIELD_STYLE_RECTANGLE = 0x02,
+ wxRICHTEXT_FIELD_STYLE_NO_BORDER = 0x04,
+ wxRICHTEXT_FIELD_STYLE_START_TAG = 0x08,
+ wxRICHTEXT_FIELD_STYLE_END_TAG = 0x10
+ };
+
+ /**
+ Constructor, creating a field type definition with a text label.
+
+ @param parent
+ The name of the type definition. This must be unique, and is the type
+ name used when adding a field to a control.
+ @param label
+ The text label to be shown on the field.
+ @param displayStyle
+ The display style: one of wxRICHTEXT_FIELD_STYLE_RECTANGLE,
+ wxRICHTEXT_FIELD_STYLE_NO_BORDER, wxRICHTEXT_FIELD_STYLE_START_TAG,
+ wxRICHTEXT_FIELD_STYLE_END_TAG.
+
+ */
+ wxRichTextFieldTypeStandard(const wxString& name, const wxString& label, int displayStyle = wxRICHTEXT_FIELD_STYLE_RECTANGLE);
+
+ /**
+ Constructor, creating a field type definition with a bitmap label.
+
+ @param parent
+ The name of the type definition. This must be unique, and is the type
+ name used when adding a field to a control.
+ @param label
+ The bitmap label to be shown on the field.
+ @param displayStyle
+ The display style: one of wxRICHTEXT_FIELD_STYLE_RECTANGLE,
+ wxRICHTEXT_FIELD_STYLE_NO_BORDER, wxRICHTEXT_FIELD_STYLE_START_TAG,
+ wxRICHTEXT_FIELD_STYLE_END_TAG.
+
+ */
+ wxRichTextFieldTypeStandard(const wxString& name, const wxBitmap& bitmap, int displayStyle = wxRICHTEXT_FIELD_STYLE_NO_BORDER);
+
+ /**
+ The default constructor.
+
+ */
+ wxRichTextFieldTypeStandard() { Init(); }
+
+ /**
+ The copy constructor.
+
+ */
+ wxRichTextFieldTypeStandard(const wxRichTextFieldTypeStandard& field)
+ : wxRichTextFieldType(field)
+ { Copy(field); }
+
+ /**
+ Initialises the object.
+ */
+ void Init();
+
+ /**
+ Copies the object.
+ */
+ void Copy(const wxRichTextFieldTypeStandard& field);
+
+ /**
+ The assignment operator.
+ */
+ void operator=(const wxRichTextFieldTypeStandard& field) { Copy(field); }
+
+ /**
+ Draw the item, within the given range. Some objects may ignore the range (for
+ example paragraphs) while others must obey it (lines, to implement wrapping)
+ */
+ virtual bool Draw(wxRichTextField* obj, wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style);
+
+ /**
+ Lay the item out at the specified position with the given size constraint.
+ Layout must set the cached size. @rect is the available space for the object,
+ and @a parentRect is the container that is used to determine a relative size
+ or position (for example if a text box must be 50% of the parent text box).
+ */
+ virtual bool Layout(wxRichTextField* obj, wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
+
+ /**
+ Returns the object size for the given range. Returns @false if the range
+ is invalid for this object.
+ */
+ virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
+
+ /**
+ Get the size of the field, given the label, font size, and so on.
+ */
+ wxSize GetSize(wxRichTextField* obj, wxDC& dc, wxRichTextDrawingContext& context, int style) const;
+
+ /**
+ Returns @true if the display type is wxRICHTEXT_FIELD_STYLE_COMPOSITE, @false otherwise.
+ */
+ virtual bool IsTopLevel(wxRichTextField* WXUNUSED(obj)) const { return (GetDisplayStyle() & wxRICHTEXT_FIELD_STYLE_COMPOSITE) != 0; }
+
+ /**
+ Sets the text label for fields of this type.
+ */
+ void SetLabel(const wxString& label) { m_label = label; }
+
+ /**
+ Returns the text label for fields of this type.
+ */
+ const wxString& GetLabel() const { return m_label; }
+
+ /**
+ Sets the bitmap label for fields of this type.
+ */
+ void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
+
+ /**
+ Gets the bitmap label for fields of this type.
+ */
+ const wxBitmap& GetBitmap() const { return m_bitmap; }
+
+ /**
+ Gets the display style for fields of this type.
+ */
+ int GetDisplayStyle() const { return m_displayStyle; }
+
+ /**
+ Sets the display style for fields of this type.
+ */
+ void SetDisplayStyle(int displayStyle) { m_displayStyle = displayStyle; }
+
+ /**
+ Gets the font used for drawing the text label.
+ */
+ const wxFont& GetFont() const { return m_font; }
+
+ /**
+ Sets the font used for drawing the text label.
+ */
+ void SetFont(const wxFont& font) { m_font = font; }
+
+ /**
+ Gets the colour used for drawing the text label.
+ */
+ const wxColour& GetTextColour() const { return m_textColour; }
+
+ /**
+ Sets the colour used for drawing the text label.
+ */
+ void SetTextColour(const wxColour& colour) { m_textColour = colour; }
+
+ /**
+ Gets the colour used for drawing the field border.
+ */
+ const wxColour& GetBorderColour() const { return m_borderColour; }
+
+ /**
+ Sets the colour used for drawing the field border.
+ */
+ void SetBorderColour(const wxColour& colour) { m_borderColour = colour; }
+
+ /**
+ Gets the colour used for drawing the field background.
+ */
+ const wxColour& GetBackgroundColour() const { return m_backgroundColour; }
+
+ /**
+ Sets the colour used for drawing the field background.
+ */
+ void SetBackgroundColour(const wxColour& colour) { m_backgroundColour = colour; }
+
+ /**
+ Sets the vertical padding (the distance between the border and the text).
+ */
+ void SetVerticalPadding(int padding) { m_verticalPadding = padding; }
+
+ /**
+ Gets the vertical padding (the distance between the border and the text).
+ */
+ int GetVerticalPadding() const { return m_verticalPadding; }
+
+ /**
+ Sets the horizontal padding (the distance between the border and the text).
+ */
+ void SetHorizontalPadding(int padding) { m_horizontalPadding = padding; }
+
+ /**
+ Sets the horizontal padding (the distance between the border and the text).
+ */
+ int GetHorizontalPadding() const { return m_horizontalPadding; }
+
+ /**
+ Sets the horizontal margin surrounding the field object.
+ */
+ void SetHorizontalMargin(int margin) { m_horizontalMargin = margin; }
+
+ /**
+ Gets the horizontal margin surrounding the field object.
+ */
+ int GetHorizontalMargin() const { return m_horizontalMargin; }
+
+ /**
+ Sets the vertical margin surrounding the field object.
+ */
+ void SetVerticalMargin(int margin) { m_verticalMargin = margin; }
+
+ /**
+ Gets the vertical margin surrounding the field object.
+ */
+ int GetVerticalMargin() const { return m_verticalMargin; }
+
+protected:
+
+ wxString m_label;
+ int m_displayStyle;
+ wxFont m_font;
+ wxColour m_textColour;
+ wxColour m_borderColour;
+ wxColour m_backgroundColour;
+ int m_verticalPadding;
+ int m_horizontalPadding;
+ int m_horizontalMargin;
+ int m_verticalMargin;
+ wxBitmap m_bitmap;
+};
+
+/**
+ @class wxRichTextLine
+
+ This object represents a line in a paragraph, and stores
+ offsets from the start of the paragraph representing the
+ start and end positions of the line.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextBuffer, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextLine
+{
+public:
+// Constructors
+
+ wxRichTextLine(wxRichTextParagraph* parent);
+ wxRichTextLine(const wxRichTextLine& obj) { Init( NULL); Copy(obj); }
+ virtual ~wxRichTextLine() {}
+
+// Overridables
+
+// Accessors
+
+ /**
+ Sets the range associated with this line.
+ */
+ void SetRange(const wxRichTextRange& range) { m_range = range; }
+ /**
+ Sets the range associated with this line.
+ */
+ void SetRange(long from, long to) { m_range = wxRichTextRange(from, to); }
+
+ /**
+ Returns the parent paragraph.
+ */
+ wxRichTextParagraph* GetParent() { return m_parent; }
+
+ /**
+ Returns the range.
+ */
+ const wxRichTextRange& GetRange() const { return m_range; }
+ /**
+ Returns the range.
+ */
+ wxRichTextRange& GetRange() { return m_range; }
+
+ /**
+ Returns the absolute range.
+ */
+ wxRichTextRange GetAbsoluteRange() const;
+
+ /**
+ Returns the line size as calculated by Layout.
+ */
+ virtual wxSize GetSize() const { return m_size; }
+
+ /**
+ Sets the line size as calculated by Layout.
+ */
+ virtual void SetSize(const wxSize& sz) { m_size = sz; }
+
+ /**
+ Returns the object position relative to the parent.
+ */
+ virtual wxPoint GetPosition() const { return m_pos; }
+
+ /**
+ Sets the object position relative to the parent.
+ */
+ virtual void SetPosition(const wxPoint& pos) { m_pos = pos; }
+
+ /**
+ Returns the absolute object position.
+ */
+ virtual wxPoint GetAbsolutePosition() const;
+
+ /**
+ Returns the rectangle enclosing the line.
+ */
+ virtual wxRect GetRect() const { return wxRect(GetAbsolutePosition(), GetSize()); }
+
+ /**
+ Sets the stored descent.
+ */
+ void SetDescent(int descent) { m_descent = descent; }
+
+ /**
+ Returns the stored descent.
+ */
+ int GetDescent() const { return m_descent; }
+
+#if wxRICHTEXT_USE_OPTIMIZED_LINE_DRAWING
+ wxArrayInt& GetObjectSizes() { return m_objectSizes; }
+ const wxArrayInt& GetObjectSizes() const { return m_objectSizes; }
+#endif
+
+// Operations
+
+ /**
+ Initialises the object.
+ */
+ void Init(wxRichTextParagraph* parent);
+
+ /**
+ Copies from @a obj.
+ */
+ void Copy(const wxRichTextLine& obj);
+
+ virtual wxRichTextLine* Clone() const { return new wxRichTextLine(*this); }
+
+protected:
+
+ // The range of the line (start position to end position)
+ // This is relative to the parent paragraph.
+ wxRichTextRange m_range;
+
+ // Size and position measured relative to top of paragraph
+ wxPoint m_pos;
+ wxSize m_size;
+
+ // Maximum descent for this line (location of text baseline)
+ int m_descent;
+
+ // The parent object
+ wxRichTextParagraph* m_parent;
+
+#if wxRICHTEXT_USE_OPTIMIZED_LINE_DRAWING
+ wxArrayInt m_objectSizes;
+#endif
+};
+
+WX_DECLARE_LIST_WITH_DECL( wxRichTextLine, wxRichTextLineList , class WXDLLIMPEXP_RICHTEXT );
+
+/**
+ @class wxRichTextParagraph
+
+ This object represents a single paragraph containing various objects such as text content, images, and further paragraph layout objects.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextBuffer, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextParagraph: public wxRichTextCompositeObject
+{
+ DECLARE_DYNAMIC_CLASS(wxRichTextParagraph)
+public:
+// Constructors
+
+ /**
+ Constructor taking a parent and style.
+ */
+ wxRichTextParagraph(wxRichTextObject* parent = NULL, wxRichTextAttr* style = NULL);
+ /**
+ Constructor taking a text string, a parent and paragraph and character attributes.
+ */
+ wxRichTextParagraph(const wxString& text, wxRichTextObject* parent = NULL, wxRichTextAttr* paraStyle = NULL, wxRichTextAttr* charStyle = NULL);
+ virtual ~wxRichTextParagraph();
+ wxRichTextParagraph(const wxRichTextParagraph& obj): wxRichTextCompositeObject() { Copy(obj); }
+
+// Overridables
+
+ virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style);
+
+ virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
+
+ virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
+
+ virtual bool FindPosition(wxDC& dc, wxRichTextDrawingContext& context, long index, wxPoint& pt, int* height, bool forceLineStart);
+
+ virtual int HitTest(wxDC& dc, wxRichTextDrawingContext& context, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0);
+
+ virtual void CalculateRange(long start, long& end);
+
+ virtual wxString GetXMLNodeName() const { return wxT("paragraph"); }
+
+// Accessors
+
+ /**
+ Returns the cached lines.
+ */
+ wxRichTextLineList& GetLines() { return m_cachedLines; }
+
+// Operations
+
+ /**
+ Copies the object.
+ */
+ void Copy(const wxRichTextParagraph& obj);
+
+ virtual wxRichTextObject* Clone() const { return new wxRichTextParagraph(*this); }
+
+ /**
+ Clears the cached lines.
+ */
+ void ClearLines();
+
+// Implementation
+
+ /**
+ Applies paragraph styles such as centering to the wrapped lines.
+ */
+ virtual void ApplyParagraphStyle(wxRichTextLine* line, const wxRichTextAttr& attr, const wxRect& rect, wxDC& dc);
+
+ /**
+ Inserts text at the given position.
+ */
+ virtual bool InsertText(long pos, const wxString& text);
+
+ /**
+ Splits an object at this position if necessary, and returns
+ the previous object, or NULL if inserting at the beginning.
+ */
+ virtual wxRichTextObject* SplitAt(long pos, wxRichTextObject** previousObject = NULL);
+
+ /**
+ Moves content to a list from this point.
+ */
+ virtual void MoveToList(wxRichTextObject* obj, wxList& list);
+
+ /**
+ Adds content back from a list.
+ */
+ virtual void MoveFromList(wxList& list);
+
+ /**
+ Returns the plain text searching from the start or end of the range.
+ The resulting string may be shorter than the range given.
+ */
+ bool GetContiguousPlainText(wxString& text, const wxRichTextRange& range, bool fromStart = true);
+
+ /**
+ Finds a suitable wrap position. @a wrapPosition is the last position in the line to the left
+ of the split.
+ */
+ bool FindWrapPosition(const wxRichTextRange& range, wxDC& dc, wxRichTextDrawingContext& context, int availableSpace, long& wrapPosition, wxArrayInt* partialExtents);
+
+ /**
+ Finds the object at the given position.
+ */
+ wxRichTextObject* FindObjectAtPosition(long position);
+
+ /**
+ Returns the bullet text for this paragraph.
+ */
+ wxString GetBulletText();
+
+ /**
+ Allocates or reuses a line object.
+ */
+ wxRichTextLine* AllocateLine(int pos);
+
+ /**
+ Clears remaining unused line objects, if any.
+ */
+ bool ClearUnusedLines(int lineCount);
+
+ /**
+ Returns combined attributes of the base style, paragraph style and character style. We use this to dynamically
+ retrieve the actual style.
+ */
+ wxRichTextAttr GetCombinedAttributes(const wxRichTextAttr& contentStyle, bool includingBoxAttr = false) const;
+
+ /**
+ Returns the combined attributes of the base style and paragraph style.
+ */
+ wxRichTextAttr GetCombinedAttributes(bool includingBoxAttr = false) const;
+
+ /**
+ Returns the first position from pos that has a line break character.
+ */
+ long GetFirstLineBreakPosition(long pos);
+
+ /**
+ Creates a default tabstop array.
+ */
+ static void InitDefaultTabs();
+
+ /**
+ Clears the default tabstop array.
+ */
+ static void ClearDefaultTabs();
+
+ /**
+ Returns the default tabstop array.
+ */
+ static const wxArrayInt& GetDefaultTabs() { return sm_defaultTabs; }
+
+ /**
+ Lays out the floating objects.
+ */
+ void LayoutFloat(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style, wxRichTextFloatCollector* floatCollector);
+
+protected:
+
+ // The lines that make up the wrapped paragraph
+ wxRichTextLineList m_cachedLines;
+
+ // Default tabstops
+ static wxArrayInt sm_defaultTabs;
+
+friend class wxRichTextFloatCollector;
+};
+
+/**
+ @class wxRichTextPlainText
+
+ This object represents a single piece of text.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextBuffer, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextPlainText: public wxRichTextObject
+{
+ DECLARE_DYNAMIC_CLASS(wxRichTextPlainText)
+public:
+// Constructors
+
+ /**
+ Constructor.
+ */
+ wxRichTextPlainText(const wxString& text = wxEmptyString, wxRichTextObject* parent = NULL, wxRichTextAttr* style = NULL);
+
+ /**
+ Copy constructor.
+ */
+ wxRichTextPlainText(const wxRichTextPlainText& obj): wxRichTextObject() { Copy(obj); }
+
+// Overridables
+
+ virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style);
+
+ virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
+
+ virtual bool AdjustAttributes(wxRichTextAttr& attr, wxRichTextDrawingContext& context);
+
+ virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
+
+ virtual wxString GetTextForRange(const wxRichTextRange& range) const;
+
+ virtual wxRichTextObject* DoSplit(long pos);
+
+ virtual void CalculateRange(long start, long& end);
+
+ virtual bool DeleteRange(const wxRichTextRange& range);
+
+ virtual bool IsEmpty() const { return m_text.empty(); }
+
+ virtual bool CanMerge(wxRichTextObject* object, wxRichTextDrawingContext& context) const;
+
+ virtual bool Merge(wxRichTextObject* object, wxRichTextDrawingContext& context);
+
+ virtual void Dump(wxTextOutputStream& stream);
+
+ virtual bool CanSplit(wxRichTextDrawingContext& context) const;
+
+ virtual wxRichTextObject* Split(wxRichTextDrawingContext& context);
+
+ /**
+ Get the first position from pos that has a line break character.
+ */
+ long GetFirstLineBreakPosition(long pos);
+
+ /// Does this object take note of paragraph attributes? Text and image objects don't.
+ virtual bool UsesParagraphAttributes() const { return false; }
+
+#if wxUSE_XML
+ virtual bool ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* node, wxRichTextXMLHandler* handler, bool* recurse);
+#endif
+
+#if wxRICHTEXT_HAVE_DIRECT_OUTPUT
+ virtual bool ExportXML(wxOutputStream& stream, int indent, wxRichTextXMLHandler* handler);
+#endif
+
+#if wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT
+ virtual bool ExportXML(wxXmlNode* parent, wxRichTextXMLHandler* handler);
+#endif
+
+ virtual wxString GetXMLNodeName() const { return wxT("text"); }
+
+// Accessors
+
+ /**
+ Returns the text.
+ */
+ const wxString& GetText() const { return m_text; }
+
+ /**
+ Sets the text.
+ */
+ void SetText(const wxString& text) { m_text = text; }
+
+// Operations
+
+ // Copies the text object,
+ void Copy(const wxRichTextPlainText& obj);
+
+ // Clones the text object.
+ virtual wxRichTextObject* Clone() const { return new wxRichTextPlainText(*this); }
+
+private:
+ bool DrawTabbedString(wxDC& dc, const wxRichTextAttr& attr, const wxRect& rect, wxString& str, wxCoord& x, wxCoord& y, bool selected);
+
+protected:
+ wxString m_text;
+};
+
+/**
+ @class wxRichTextImageBlock
+
+ This class stores information about an image, in binary in-memory form.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextBuffer, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextImageBlock: public wxObject
+{
+public:
+ /**
+ Constructor.
+ */
+ wxRichTextImageBlock();
+
+ /**
+ Copy constructor.
+ */
+ wxRichTextImageBlock(const wxRichTextImageBlock& block);
+ virtual ~wxRichTextImageBlock();
+
+ /**
+ Initialises the block.
+ */
+ void Init();
+
+ /**
+ Clears the block.
+ */
+
+ void Clear();
+
+ /**
+ Load the original image into a memory block.
+ If the image is not a JPEG, we must convert it into a JPEG
+ to conserve space.
+ If it's not a JPEG we can make use of @a image, already scaled, so we don't have to
+ load the image a second time.
+ */
+ virtual bool MakeImageBlock(const wxString& filename, wxBitmapType imageType,
+ wxImage& image, bool convertToJPEG = true);
+
+ /**
+ Make an image block from the wxImage in the given
+ format.
+ */
+ virtual bool MakeImageBlock(wxImage& image, wxBitmapType imageType, int quality = 80);
+
+ /**
+ Uses a const wxImage for efficiency, but can't set quality (only relevant for JPEG)
+ */
+ virtual bool MakeImageBlockDefaultQuality(const wxImage& image, wxBitmapType imageType);
+
+ /**
+ Makes the image block.
+ */
+ virtual bool DoMakeImageBlock(const wxImage& image, wxBitmapType imageType);
+
+ /**
+ Writes the block to a file.
+ */
+ bool Write(const wxString& filename);
+
+ /**
+ Writes the data in hex to a stream.
+ */
+ bool WriteHex(wxOutputStream& stream);
+
+ /**
+ Reads the data in hex from a stream.
+ */
+ bool ReadHex(wxInputStream& stream, int length, wxBitmapType imageType);
+
+ /**
+ Copy from @a block.
+ */
+ void Copy(const wxRichTextImageBlock& block);
+
+ // Load a wxImage from the block
+ /**
+ */
+ bool Load(wxImage& image);
+
+// Operators
+
+ /**
+ Assignment operation.
+ */
+ void operator=(const wxRichTextImageBlock& block);
+
+// Accessors
+
+ /**
+ Returns the raw data.
+ */
+ unsigned char* GetData() const { return m_data; }
+
+ /**
+ Returns the data size in bytes.
+ */
+ size_t GetDataSize() const { return m_dataSize; }
+
+ /**
+ Returns the image type.
+ */
+ wxBitmapType GetImageType() const { return m_imageType; }
+
+ /**
+ */
+ void SetData(unsigned char* image) { m_data = image; }
+
+ /**
+ Sets the data size.
+ */
+ void SetDataSize(size_t size) { m_dataSize = size; }
+
+ /**
+ Sets the image type.
+ */
+ void SetImageType(wxBitmapType imageType) { m_imageType = imageType; }
+
+ /**
+ Returns @true if the data is non-NULL.
+ */
+ bool IsOk() const { return GetData() != NULL; }
+ bool Ok() const { return IsOk(); }
+
+ /**
+ Gets the extension for the block's type.
+ */
+ wxString GetExtension() const;
+
+/// Implementation
+
+ /**
+ Allocates and reads from a stream as a block of memory.
+ */
+ static unsigned char* ReadBlock(wxInputStream& stream, size_t size);
+
+ /**
+ Allocates and reads from a file as a block of memory.
+ */
+ static unsigned char* ReadBlock(const wxString& filename, size_t size);
+
+ /**
+ Writes a memory block to stream.
+ */
+ static bool WriteBlock(wxOutputStream& stream, unsigned char* block, size_t size);
+
+ /**
+ Writes a memory block to a file.
+ */
+ static bool WriteBlock(const wxString& filename, unsigned char* block, size_t size);
+
+protected:
+ // Size in bytes of the image stored.
+ // This is in the raw, original form such as a JPEG file.
+ unsigned char* m_data;
+ size_t m_dataSize;
+ wxBitmapType m_imageType;
+};
+
+/**
+ @class wxRichTextImage
+
+ This class implements a graphic object.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextBuffer, wxRichTextCtrl, wxRichTextImageBlock
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextImage: public wxRichTextObject
+{
+ DECLARE_DYNAMIC_CLASS(wxRichTextImage)
+public:
+// Constructors
+
+ /**
+ Default constructor.
+ */
+ wxRichTextImage(wxRichTextObject* parent = NULL): wxRichTextObject(parent) { Init(); }
+
+ /**
+ Creates a wxRichTextImage from a wxImage.
+ */
+ wxRichTextImage(const wxImage& image, wxRichTextObject* parent = NULL, wxRichTextAttr* charStyle = NULL);
+
+ /**
+ Creates a wxRichTextImage from an image block.
+ */
+ wxRichTextImage(const wxRichTextImageBlock& imageBlock, wxRichTextObject* parent = NULL, wxRichTextAttr* charStyle = NULL);
+
+ /**
+ Copy constructor.
+ */
+ wxRichTextImage(const wxRichTextImage& obj): wxRichTextObject(obj) { Copy(obj); }
+
+ /**
+ Destructor.
+ */
+ ~wxRichTextImage();
+
+ /**
+ Initialisation.
+ */
+ void Init();
+
+// Overridables
+
+ virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style);
+
+ virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
+
+ virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
+
+ /**
+ Returns the 'natural' size for this object - the image size.
+ */
+ virtual wxTextAttrSize GetNaturalSize() const;
+
+ virtual bool IsEmpty() const { return false; /* !m_imageBlock.IsOk(); */ }
+
+ virtual bool CanEditProperties() const { return true; }
+
+ virtual bool EditProperties(wxWindow* parent, wxRichTextBuffer* buffer);
+
+ virtual wxString GetPropertiesMenuLabel() const { return wxGetTranslation("&Picture"); }
+
+ virtual bool UsesParagraphAttributes() const { return false; }
+
+#if wxUSE_XML
+ virtual bool ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* node, wxRichTextXMLHandler* handler, bool* recurse);
+#endif
+
+#if wxRICHTEXT_HAVE_DIRECT_OUTPUT
+ virtual bool ExportXML(wxOutputStream& stream, int indent, wxRichTextXMLHandler* handler);
+#endif
+
+#if wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT
+ virtual bool ExportXML(wxXmlNode* parent, wxRichTextXMLHandler* handler);
+#endif
+
+ // Images can be floatable (optionally).
+ virtual bool IsFloatable() const { return true; }
+
+ virtual wxString GetXMLNodeName() const { return wxT("image"); }
+
+// Accessors
+
+ /**
+ Returns the image cache (a scaled bitmap).
+ */
+ const wxBitmap& GetImageCache() const { return m_imageCache; }
+
+ /**
+ Sets the image cache.
+ */
+ void SetImageCache(const wxBitmap& bitmap) { m_imageCache = bitmap; m_originalImageSize = wxSize(bitmap.GetWidth(), bitmap.GetHeight()); }
+
+ /**
+ Resets the image cache.
+ */
+ void ResetImageCache() { m_imageCache = wxNullBitmap; m_originalImageSize = wxSize(-1, -1); }
+
+ /**
+ Returns the image block containing the raw data.
+ */
+ wxRichTextImageBlock& GetImageBlock() { return m_imageBlock; }
+
+// Operations
+
+ /**
+ Copies the image object.
+ */
+ void Copy(const wxRichTextImage& obj);
+
+ /**
+ Clones the image object.
+ */
+ virtual wxRichTextObject* Clone() const { return new wxRichTextImage(*this); }
+
+ /**
+ Creates a cached image at the required size.
+ */
+ virtual bool LoadImageCache(wxDC& dc, bool resetCache = false, const wxSize& parentSize = wxDefaultSize);
+
+ /**
+ Gets the original image size.
+ */
+ wxSize GetOriginalImageSize() const { return m_originalImageSize; }
+
+ /**
+ Sets the original image size.
+ */
+ void SetOriginalImageSize(const wxSize& sz) { m_originalImageSize = sz; }
+
+protected:
+ wxRichTextImageBlock m_imageBlock;
+ wxBitmap m_imageCache;
+ wxSize m_originalImageSize;
+};
+
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCommand;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextAction;
+
+/**
+ @class wxRichTextBuffer
+
+ This is a kind of paragraph layout box, used to represent the whole buffer.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextParagraphLayoutBox, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextBuffer: public wxRichTextParagraphLayoutBox
+{
+ DECLARE_DYNAMIC_CLASS(wxRichTextBuffer)
+public:
+// Constructors
+
+ /**
+ Default constructor.
+ */
+ wxRichTextBuffer() { Init(); }
+
+ /**
+ Copy constructor.
+ */
+ wxRichTextBuffer(const wxRichTextBuffer& obj): wxRichTextParagraphLayoutBox() { Init(); Copy(obj); }
+
+ virtual ~wxRichTextBuffer() ;
+
+// Accessors
+
+ /**
+ Returns the command processor.
+ A text buffer always creates its own command processor when it is initialized.
+ */
+ wxCommandProcessor* GetCommandProcessor() const { return m_commandProcessor; }
+
+ /**
+ Sets style sheet, if any. This will allow the application to use named character and paragraph
+ styles found in the style sheet.
+
+ Neither the buffer nor the control owns the style sheet so must be deleted by the application.
+ */
+ void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { m_styleSheet = styleSheet; }
+
+ /**
+ Returns the style sheet.
+ */
+ virtual wxRichTextStyleSheet* GetStyleSheet() const { return m_styleSheet; }
+
+ /**
+ Sets the style sheet and sends a notification of the change.
+ */
+ bool SetStyleSheetAndNotify(wxRichTextStyleSheet* sheet);
+
+ /**
+ Pushes the style sheet to the top of the style sheet stack.
+ */
+ bool PushStyleSheet(wxRichTextStyleSheet* styleSheet);
+
+ /**
+ Pops the style sheet from the top of the style sheet stack.
+ */
+ wxRichTextStyleSheet* PopStyleSheet();
+
+ /**
+ Returns the table storing fonts, for quick access and font reuse.
+ */
+ wxRichTextFontTable& GetFontTable() { return m_fontTable; }
+
+ /**
+ Returns the table storing fonts, for quick access and font reuse.
+ */
+ const wxRichTextFontTable& GetFontTable() const { return m_fontTable; }
+
+ /**
+ Sets table storing fonts, for quick access and font reuse.
+ */
+ void SetFontTable(const wxRichTextFontTable& table) { m_fontTable = table; }
+
+ /**
+ Sets the scale factor for displaying fonts, for example for more comfortable
+ editing.
+ */
+ void SetFontScale(double fontScale);
+
+ /**
+ Returns the scale factor for displaying fonts, for example for more comfortable
+ editing.
+ */
+ double GetFontScale() const { return m_fontScale; }
+
+ /**
+ Sets the scale factor for displaying certain dimensions such as indentation and
+ inter-paragraph spacing. This can be useful when editing in a small control
+ where you still want legible text, but a minimum of wasted white space.
+ */
+ void SetDimensionScale(double dimScale);
+
+ /**
+ Returns the scale factor for displaying certain dimensions such as indentation
+ and inter-paragraph spacing.
+ */
+ double GetDimensionScale() const { return m_dimensionScale; }
+
+// Operations
+
+ /**
+ Initialisation.
+ */
+ void Init();
+
+ /**
+ Clears the buffer, adds an empty paragraph, and clears the command processor.
+ */
+ virtual void ResetAndClearCommands();
+
+#if wxUSE_FFILE && wxUSE_STREAMS
+ //@{
+ /**
+ Loads content from a file.
+ Not all handlers will implement file loading.
+ */
+ virtual bool LoadFile(const wxString& filename, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY);
+ //@}
+
+ //@{
+ /**
+ Saves content to a file.
+ Not all handlers will implement file saving.
+ */
+ virtual bool SaveFile(const wxString& filename, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY);
+ //@}
+#endif // wxUSE_FFILE
+
+#if wxUSE_STREAMS
+ //@{
+ /**
+ Loads content from a stream.
+ Not all handlers will implement loading from a stream.
+ */
+ virtual bool LoadFile(wxInputStream& stream, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY);
+ //@}
+
+ //@{
+ /**
+ Saves content to a stream.
+ Not all handlers will implement saving to a stream.
+ */
+ virtual bool SaveFile(wxOutputStream& stream, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY);
+ //@}
+#endif // wxUSE_STREAMS
+
+ /**
+ Sets the handler flags, controlling loading and saving.
+ */
+ void SetHandlerFlags(int flags) { m_handlerFlags = flags; }
+
+ /**
+ Gets the handler flags, controlling loading and saving.
+ */
+ int GetHandlerFlags() const { return m_handlerFlags; }
+
+ /**
+ Convenience function to add a paragraph of text.
+ */
+ virtual wxRichTextRange AddParagraph(const wxString& text, wxRichTextAttr* paraStyle = NULL) { Modify(); return wxRichTextParagraphLayoutBox::AddParagraph(text, paraStyle); }
+
+ /**
+ Begin collapsing undo/redo commands. Note that this may not work properly
+ if combining commands that delete or insert content, changing ranges for
+ subsequent actions.
+
+ @a cmdName should be the name of the combined command that will appear
+ next to Undo and Redo in the edit menu.
+ */
+ virtual bool BeginBatchUndo(const wxString& cmdName);
+
+ /**
+ End collapsing undo/redo commands.
+ */
+ virtual bool EndBatchUndo();
+
+ /**
+ Returns @true if we are collapsing commands.
+ */
+ virtual bool BatchingUndo() const { return m_batchedCommandDepth > 0; }
+
+ /**
+ Submit the action immediately, or delay according to whether collapsing is on.
+ */
+ virtual bool SubmitAction(wxRichTextAction* action);
+
+ /**
+ Returns the collapsed command.
+ */
+ virtual wxRichTextCommand* GetBatchedCommand() const { return m_batchedCommand; }
+
+ /**
+ Begin suppressing undo/redo commands. The way undo is suppressed may be implemented
+ differently by each command. If not dealt with by a command implementation, then
+ it will be implemented automatically by not storing the command in the undo history
+ when the action is submitted to the command processor.
+ */
+ virtual bool BeginSuppressUndo();
+
+ /**
+ End suppressing undo/redo commands.
+ */
+ virtual bool EndSuppressUndo();
+
+ /**
+ Are we suppressing undo??
+ */
+ virtual bool SuppressingUndo() const { return m_suppressUndo > 0; }
+
+ /**
+ Copy the range to the clipboard.
+ */
+ virtual bool CopyToClipboard(const wxRichTextRange& range);
+
+ /**
+ Paste the clipboard content to the buffer.
+ */
+ virtual bool PasteFromClipboard(long position);
+
+ /**
+ Returns @true if we can paste from the clipboard.
+ */
+ virtual bool CanPasteFromClipboard() const;
+
+ /**
+ Begin using a style.
+ */
+ virtual bool BeginStyle(const wxRichTextAttr& style);
+
+ /**
+ End the style.
+ */
+ virtual bool EndStyle();
+
+ /**
+ End all styles.
+ */
+ virtual bool EndAllStyles();
+
+ /**
+ Clears the style stack.
+ */
+ virtual void ClearStyleStack();
+
+ /**
+ Returns the size of the style stack, for example to check correct nesting.
+ */
+ virtual size_t GetStyleStackSize() const { return m_attributeStack.GetCount(); }
+
+ /**
+ Begins using bold.
+ */
+ bool BeginBold();
+
+ /**
+ Ends using bold.
+ */
+ bool EndBold() { return EndStyle(); }
+
+ /**
+ Begins using italic.
+ */
+ bool BeginItalic();
+
+ /**
+ Ends using italic.
+ */
+ bool EndItalic() { return EndStyle(); }
+
+ /**
+ Begins using underline.
+ */
+ bool BeginUnderline();
+
+ /**
+ Ends using underline.
+ */
+ bool EndUnderline() { return EndStyle(); }
+
+ /**
+ Begins using point size.
+ */
+ bool BeginFontSize(int pointSize);
+
+ /**
+ Ends using point size.
+ */
+ bool EndFontSize() { return EndStyle(); }
+
+ /**
+ Begins using this font.
+ */
+ bool BeginFont(const wxFont& font);
+
+ /**
+ Ends using a font.
+ */
+ bool EndFont() { return EndStyle(); }
+
+ /**
+ Begins using this colour.
+ */
+ bool BeginTextColour(const wxColour& colour);
+
+ /**
+ Ends using a colour.
+ */
+ bool EndTextColour() { return EndStyle(); }
+
+ /**
+ Begins using alignment.
+ */
+ bool BeginAlignment(wxTextAttrAlignment alignment);
+
+ /**
+ Ends alignment.
+ */
+ bool EndAlignment() { return EndStyle(); }
+
+ /**
+ Begins using @a leftIndent for the left indent, and optionally @a leftSubIndent for
+ the sub-indent. Both are expressed in tenths of a millimetre.
+
+ The sub-indent is an offset from the left of the paragraph, and is used for all
+ but the first line in a paragraph. A positive value will cause the first line to appear
+ to the left of the subsequent lines, and a negative value will cause the first line to be
+ indented relative to the subsequent lines.
+ */
+ bool BeginLeftIndent(int leftIndent, int leftSubIndent = 0);
+
+ /**
+ Ends left indent.
+ */
+ bool EndLeftIndent() { return EndStyle(); }
+
+ /**
+ Begins a right indent, specified in tenths of a millimetre.
+ */
+ bool BeginRightIndent(int rightIndent);
+
+ /**
+ Ends right indent.
+ */
+ bool EndRightIndent() { return EndStyle(); }
+
+ /**
+ Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing
+ in tenths of a millimetre.
+ */
+ bool BeginParagraphSpacing(int before, int after);
+
+ /**
+ Ends paragraph spacing.
+ */
+ bool EndParagraphSpacing() { return EndStyle(); }
+
+ /**
+ Begins line spacing using the specified value. @e spacing is a multiple, where
+ 10 means single-spacing, 15 means 1.5 spacing, and 20 means double spacing.
+
+ The ::wxTextAttrLineSpacing enumeration values are defined for convenience.
+ */
+ bool BeginLineSpacing(int lineSpacing);
+
+ /**
+ Ends line spacing.
+ */
+ bool EndLineSpacing() { return EndStyle(); }
+
+ /**
+ Begins numbered bullet.
+
+ This call will be needed for each item in the list, and the
+ application should take care of incrementing the numbering.
+
+ @a bulletNumber is a number, usually starting with 1.
+ @a leftIndent and @a leftSubIndent are values in tenths of a millimetre.
+ @a bulletStyle is a bitlist of the following values:
+
+ wxRichTextBuffer uses indentation to render a bulleted item.
+ The left indent is the distance between the margin and the bullet.
+ The content of the paragraph, including the first line, starts
+ at leftMargin + leftSubIndent.
+ So the distance between the left edge of the bullet and the
+ left of the actual paragraph is leftSubIndent.
+ */
+ bool BeginNumberedBullet(int bulletNumber, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_ARABIC|wxTEXT_ATTR_BULLET_STYLE_PERIOD);
+
+ /**
+ Ends numbered bullet.
+ */
+ bool EndNumberedBullet() { return EndStyle(); }
+
+ /**
+ Begins applying a symbol bullet, using a character from the current font.
+
+ See BeginNumberedBullet() for an explanation of how indentation is used
+ to render the bulleted paragraph.
+ */
+ bool BeginSymbolBullet(const wxString& symbol, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL);
+
+ /**
+ Ends symbol bullet.
+ */
+ bool EndSymbolBullet() { return EndStyle(); }
+
+ /**
+ Begins applying a standard bullet, using one of the standard bullet names
+ (currently @c standard/circle or @c standard/square.
+
+ See BeginNumberedBullet() for an explanation of how indentation is used to
+ render the bulleted paragraph.
+ */
+ bool BeginStandardBullet(const wxString& bulletName, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_STANDARD);
+
+ /**
+ Ends standard bullet.
+ */
+ bool EndStandardBullet() { return EndStyle(); }
+
+ /**
+ Begins named character style.
+ */
+ bool BeginCharacterStyle(const wxString& characterStyle);
+
+ /**
+ Ends named character style.
+ */
+ bool EndCharacterStyle() { return EndStyle(); }
+
+ /**
+ Begins named paragraph style.
+ */
+ bool BeginParagraphStyle(const wxString& paragraphStyle);
+
+ /**
+ Ends named character style.
+ */
+ bool EndParagraphStyle() { return EndStyle(); }
+
+ /**
+ Begins named list style.
+
+ Optionally, you can also pass a level and a number.
+ */
+ bool BeginListStyle(const wxString& listStyle, int level = 1, int number = 1);
+
+ /**
+ Ends named character style.
+ */
+ bool EndListStyle() { return EndStyle(); }
+
+ /**
+ Begins applying wxTEXT_ATTR_URL to the content.
+
+ Pass a URL and optionally, a character style to apply, since it is common
+ to mark a URL with a familiar style such as blue text with underlining.
+ */
+ bool BeginURL(const wxString& url, const wxString& characterStyle = wxEmptyString);
+
+ /**
+ Ends URL.
+ */
+ bool EndURL() { return EndStyle(); }
+
+// Event handling
+
+ /**
+ Adds an event handler.
+
+ A buffer associated with a control has the control as the only event handler,
+ but the application is free to add more if further notification is required.
+ All handlers are notified of an event originating from the buffer, such as
+ the replacement of a style sheet during loading.
+
+ The buffer never deletes any of the event handlers, unless RemoveEventHandler()
+ is called with @true as the second argument.
+ */
+ bool AddEventHandler(wxEvtHandler* handler);
+
+ /**
+ Removes an event handler from the buffer's list of handlers, deleting the
+ object if @a deleteHandler is @true.
+ */
+ bool RemoveEventHandler(wxEvtHandler* handler, bool deleteHandler = false);
+
+ /**
+ Clear event handlers.
+ */
+ void ClearEventHandlers();
+
+ /**
+ Send event to event handlers. If sendToAll is true, will send to all event handlers,
+ otherwise will stop at the first successful one.
+ */
+ bool SendEvent(wxEvent& event, bool sendToAll = true);
+
+// Implementation
+
+ virtual int HitTest(wxDC& dc, wxRichTextDrawingContext& context, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0);
+
+ /**
+ Copies the buffer.
+ */
+ void Copy(const wxRichTextBuffer& obj);
+
+ /**
+ Assignment operator.
+ */
+ void operator= (const wxRichTextBuffer& obj) { Copy(obj); }
+
+ /**
+ Clones the buffer.
+ */
+ virtual wxRichTextObject* Clone() const { return new wxRichTextBuffer(*this); }
+
+ /**
+ Submits a command to insert paragraphs.
+ */
+ bool InsertParagraphsWithUndo(long pos, const wxRichTextParagraphLayoutBox& paragraphs, wxRichTextCtrl* ctrl, int flags = 0);
+
+ /**
+ Submits a command to insert the given text.
+ */
+ bool InsertTextWithUndo(long pos, const wxString& text, wxRichTextCtrl* ctrl, int flags = 0);
+
+ /**
+ Submits a command to insert a newline.
+ */
+ bool InsertNewlineWithUndo(long pos, wxRichTextCtrl* ctrl, int flags = 0);
+
+ /**
+ Submits a command to insert the given image.
+ */
+ bool InsertImageWithUndo(long pos, const wxRichTextImageBlock& imageBlock, wxRichTextCtrl* ctrl, int flags = 0,
+ const wxRichTextAttr& textAttr = wxRichTextAttr());
+
+ /**
+ Submits a command to insert an object.
+ */
+ wxRichTextObject* InsertObjectWithUndo(long pos, wxRichTextObject *object, wxRichTextCtrl* ctrl, int flags);
+
+ /**
+ Submits a command to delete this range.
+ */
+ bool DeleteRangeWithUndo(const wxRichTextRange& range, wxRichTextCtrl* ctrl);
+
+ /**
+ Mark modified.
+ */
+ void Modify(bool modify = true) { m_modified = modify; }
+
+ /**
+ Returns @true if the buffer was modified.
+ */
+ bool IsModified() const { return m_modified; }
+
+ //@{
+ /**
+ Dumps contents of buffer for debugging purposes.
+ */
+ virtual void Dump();
+ virtual void Dump(wxTextOutputStream& stream) { wxRichTextParagraphLayoutBox::Dump(stream); }
+ //@}
+
+ /**
+ Returns the file handlers.
+ */
+ static wxList& GetHandlers() { return sm_handlers; }
+
+ /**
+ Adds a file handler to the end.
+ */
+ static void AddHandler(wxRichTextFileHandler *handler);
+
+ /**
+ Inserts a file handler at the front.
+ */
+ static void InsertHandler(wxRichTextFileHandler *handler);
+
+ /**
+ Removes a file handler.
+ */
+ static bool RemoveHandler(const wxString& name);
+
+ /**
+ Finds a file handler by name.
+ */
+ static wxRichTextFileHandler *FindHandler(const wxString& name);
+
+ /**
+ Finds a file handler by extension and type.
+ */
+ static wxRichTextFileHandler *FindHandler(const wxString& extension, wxRichTextFileType imageType);
+
+ /**
+ Finds a handler by filename or, if supplied, type.
+ */
+ static wxRichTextFileHandler *FindHandlerFilenameOrType(const wxString& filename,
+ wxRichTextFileType imageType);
+
+ /**
+ Finds a handler by type.
+ */
+ static wxRichTextFileHandler *FindHandler(wxRichTextFileType imageType);
+
+ /**
+ Gets a wildcard incorporating all visible handlers. If @a types is present,
+ it will be filled with the file type corresponding to each filter. This can be
+ used to determine the type to pass to LoadFile given a selected filter.
+ */
+ static wxString GetExtWildcard(bool combine = false, bool save = false, wxArrayInt* types = NULL);
+
+ /**
+ Clean up file handlers.
+ */
+ static void CleanUpHandlers();
+
+ /**
+ Initialise the standard file handlers.
+ Currently, only the plain text loading/saving handler is initialised by default.
+ */
+ static void InitStandardHandlers();
+
+ /**
+ Returns the drawing handlers.
+ */
+ static wxList& GetDrawingHandlers() { return sm_drawingHandlers; }
+
+ /**
+ Adds a drawing handler to the end.
+ */
+ static void AddDrawingHandler(wxRichTextDrawingHandler *handler);
+
+ /**
+ Inserts a drawing handler at the front.
+ */
+ static void InsertDrawingHandler(wxRichTextDrawingHandler *handler);
+
+ /**
+ Removes a drawing handler.
+ */
+ static bool RemoveDrawingHandler(const wxString& name);
+
+ /**
+ Finds a drawing handler by name.
+ */
+ static wxRichTextDrawingHandler *FindDrawingHandler(const wxString& name);
+
+ /**
+ Clean up drawing handlers.
+ */
+ static void CleanUpDrawingHandlers();
+
+ /**
+ Returns the field types.
+ */
+ static wxRichTextFieldTypeHashMap& GetFieldTypes() { return sm_fieldTypes; }
+
+ /**
+ Adds a field type.
+
+ @see RemoveFieldType(), FindFieldType(), wxRichTextField, wxRichTextFieldType, wxRichTextFieldTypeStandard
+
+ */
+ static void AddFieldType(wxRichTextFieldType *fieldType);
+
+ /**
+ Removes a field type by name.
+
+ @see AddFieldType(), FindFieldType(), wxRichTextField, wxRichTextFieldType, wxRichTextFieldTypeStandard
+ */
+ static bool RemoveFieldType(const wxString& name);
+
+ /**
+ Finds a field type by name.
+
+ @see RemoveFieldType(), AddFieldType(), wxRichTextField, wxRichTextFieldType, wxRichTextFieldTypeStandard
+ */
+ static wxRichTextFieldType *FindFieldType(const wxString& name);
+
+ /**
+ Cleans up field types.
+ */
+ static void CleanUpFieldTypes();
+
+ /**
+ Returns the renderer object.
+ */
+ static wxRichTextRenderer* GetRenderer() { return sm_renderer; }
+
+ /**
+ Sets @a renderer as the object to be used to render certain aspects of the
+ content, such as bullets.
+
+ You can override default rendering by deriving a new class from
+ wxRichTextRenderer or wxRichTextStdRenderer, overriding one or more
+ virtual functions, and setting an instance of the class using this function.
+ */
+ static void SetRenderer(wxRichTextRenderer* renderer);
+
+ /**
+ Returns the minimum margin between bullet and paragraph in 10ths of a mm.
+ */
+ static int GetBulletRightMargin() { return sm_bulletRightMargin; }
+
+ /**
+ Sets the minimum margin between bullet and paragraph in 10ths of a mm.
+ */
+ static void SetBulletRightMargin(int margin) { sm_bulletRightMargin = margin; }
+
+ /**
+ Returns the factor to multiply by character height to get a reasonable bullet size.
+ */
+ static float GetBulletProportion() { return sm_bulletProportion; }
+
+ /**
+ Sets the factor to multiply by character height to get a reasonable bullet size.
+ */
+ static void SetBulletProportion(float prop) { sm_bulletProportion = prop; }
+
+ /**
+ Returns the scale factor for calculating dimensions.
+ */
+ double GetScale() const { return m_scale; }
+
+ /**
+ Sets the scale factor for calculating dimensions.
+ */
+ void SetScale(double scale) { m_scale = scale; }
+
+ /**
+ Sets the floating layout mode. Pass @false to speed up editing by not performing
+ floating layout. This setting affects all buffers.
+
+ */
+ static void SetFloatingLayoutMode(bool mode) { sm_floatingLayoutMode = mode; }
+
+ /**
+ Returns the floating layout mode. The default is @true, where objects
+ are laid out according to their floating status.
+ */
+ static bool GetFloatingLayoutMode() { return sm_floatingLayoutMode; }
+
+protected:
+
+ /// Command processor
+ wxCommandProcessor* m_commandProcessor;
+
+ /// Table storing fonts
+ wxRichTextFontTable m_fontTable;
+
+ /// Has been modified?
+ bool m_modified;
+
+ /// Collapsed command stack
+ int m_batchedCommandDepth;
+
+ /// Name for collapsed command
+ wxString m_batchedCommandsName;
+
+ /// Current collapsed command accumulating actions
+ wxRichTextCommand* m_batchedCommand;
+
+ /// Whether to suppress undo
+ int m_suppressUndo;
+
+ /// Style sheet, if any
+ wxRichTextStyleSheet* m_styleSheet;
+
+ /// List of event handlers that will be notified of events
+ wxList m_eventHandlers;
+
+ /// Stack of attributes for convenience functions
+ wxList m_attributeStack;
+
+ /// Flags to be passed to handlers
+ int m_handlerFlags;
+
+ /// File handlers
+ static wxList sm_handlers;
+
+ /// Drawing handlers
+ static wxList sm_drawingHandlers;
+
+ /// Field types
+ static wxRichTextFieldTypeHashMap sm_fieldTypes;
+
+ /// Renderer
+ static wxRichTextRenderer* sm_renderer;
+
+ /// Minimum margin between bullet and paragraph in 10ths of a mm
+ static int sm_bulletRightMargin;
+
+ /// Factor to multiply by character height to get a reasonable bullet size
+ static float sm_bulletProportion;
+
+ /// Floating layout mode, @true by default
+ static bool sm_floatingLayoutMode;
+
+ /// Scaling factor in use: needed to calculate correct dimensions when printing
+ double m_scale;
+
+ /// Font scale for adjusting the text size when editing
+ double m_fontScale;
+
+ /// Dimension scale for reducing redundant whitespace when editing
+ double m_dimensionScale;
+};
+
+/**
+ @class wxRichTextCell
+
+ wxRichTextCell is the cell in a table.
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextCell: public wxRichTextBox
+{
+ DECLARE_DYNAMIC_CLASS(wxRichTextCell)
+public:
+// Constructors
+
+ /**
+ Default constructor; optionally pass the parent object.
+ */
+
+ wxRichTextCell(wxRichTextObject* parent = NULL);
+
+ /**
+ Copy constructor.
+ */
+
+ wxRichTextCell(const wxRichTextCell& obj): wxRichTextBox() { Copy(obj); }
+
+// Overridables
+
+ virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style);
+
+ virtual int HitTest(wxDC& dc, wxRichTextDrawingContext& context, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0);
+
+ virtual bool AdjustAttributes(wxRichTextAttr& attr, wxRichTextDrawingContext& context);
+
+ virtual wxString GetXMLNodeName() const { return wxT("cell"); }
+
+ virtual bool CanEditProperties() const { return true; }
+
+ virtual bool EditProperties(wxWindow* parent, wxRichTextBuffer* buffer);
+
+ virtual wxString GetPropertiesMenuLabel() const { return wxGetTranslation("&Cell"); }
+
+// Accessors
+
+ int GetColSpan() const;
+
+ void SetColSpan(long span) { GetProperties().SetProperty(wxT("colspan"), span); }
+
+ int GetRowSpan() const;
+
+ void SetRowSpan(long span) { GetProperties().SetProperty(wxT("rowspan"), span); }
+
+// Operations
+
+ virtual wxRichTextObject* Clone() const { return new wxRichTextCell(*this); }
+
+ void Copy(const wxRichTextCell& obj);
+
+protected:
+};
+
+/**
+ @class wxRichTextTable
+
+ wxRichTextTable represents a table with arbitrary columns and rows.
+ */
+
+WX_DEFINE_ARRAY_PTR(wxRichTextObject*, wxRichTextObjectPtrArray);
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxRichTextObjectPtrArray, wxRichTextObjectPtrArrayArray, WXDLLIMPEXP_RICHTEXT);
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextTable: public wxRichTextBox
+{
+ DECLARE_DYNAMIC_CLASS(wxRichTextTable)
+public:
+
+// Constructors
+
+ /**
+ Default constructor; optionally pass the parent object.
+ */
+
+ wxRichTextTable(wxRichTextObject* parent = NULL);
+
+ /**
+ Copy constructor.
+ */
+
+ wxRichTextTable(const wxRichTextTable& obj): wxRichTextBox() { Copy(obj); }
+
+// Overridables
+
+ virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style);
+
+ virtual int HitTest(wxDC& dc, wxRichTextDrawingContext& context, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0);
+
+ virtual bool AdjustAttributes(wxRichTextAttr& attr, wxRichTextDrawingContext& context);
+
+ virtual wxString GetXMLNodeName() const { return wxT("table"); }
+
+ virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style);
+
+ virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const;
+
+ virtual bool DeleteRange(const wxRichTextRange& range);
+
+ virtual wxString GetTextForRange(const wxRichTextRange& range) const;
+
+#if wxUSE_XML
+ virtual bool ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* node, wxRichTextXMLHandler* handler, bool* recurse);
+#endif
+
+#if wxRICHTEXT_HAVE_DIRECT_OUTPUT
+ virtual bool ExportXML(wxOutputStream& stream, int indent, wxRichTextXMLHandler* handler);
+#endif
+
+#if wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT
+ virtual bool ExportXML(wxXmlNode* parent, wxRichTextXMLHandler* handler);
+#endif
+
+ virtual bool FindPosition(wxDC& dc, wxRichTextDrawingContext& context, long index, wxPoint& pt, int* height, bool forceLineStart);
+
+ virtual void CalculateRange(long start, long& end);
+
+ // Can this object handle the selections of its children? FOr example, a table.
+ virtual bool HandlesChildSelections() const { return true; }
+
+ /// Returns a selection object specifying the selections between start and end character positions.
+ /// For example, a table would deduce what cells (of range length 1) are selected when dragging across the table.
+ virtual wxRichTextSelection GetSelection(long start, long end) const;
+
+ virtual bool CanEditProperties() const { return true; }
+
+ virtual bool EditProperties(wxWindow* parent, wxRichTextBuffer* buffer);
+
+ virtual wxString GetPropertiesMenuLabel() const { return wxGetTranslation("&Table"); }
+
+ // Returns true if objects of this class can accept the focus, i.e. a call to SetFocusObject
+ // is possible. For example, containers supporting text, such as a text box object, can accept the focus,
+ // but a table can't (set the focus to individual cells instead).
+ virtual bool AcceptsFocus() const { return false; }
+
+// Accessors
+
+ /**
+ Returns the cells array.
+ */
+ const wxRichTextObjectPtrArrayArray& GetCells() const { return m_cells; }
+
+ /**
+ Returns the cells array.
+ */
+ wxRichTextObjectPtrArrayArray& GetCells() { return m_cells; }
+
+ /**
+ Returns the row count.
+ */
+ int GetRowCount() const { return m_rowCount; }
+
+ /**
+ Sets the row count.
+ */
+ void SetRowCount(int count) { m_rowCount = count; }
+
+ /**
+ Returns the column count.
+ */
+ int GetColumnCount() const { return m_colCount; }
+
+ /**
+ Sets the column count.
+ */
+ void SetColumnCount(int count) { m_colCount = count; }
+
+ /**
+ Returns the cell at the given row/column position.
+ */
+ virtual wxRichTextCell* GetCell(int row, int col) const;
+
+ /**
+ Returns the cell at the given character position (in the range of the table).
+ */
+ virtual wxRichTextCell* GetCell(long pos) const;
+
+ /**
+ Returns the row/column for a given character position.
+ */
+ virtual bool GetCellRowColumnPosition(long pos, int& row, int& col) const;
+
+ /**
+ Returns the coordinates of the cell with keyboard focus, or (-1,-1) if none.
+ */
+ virtual wxPosition GetFocusedCell() const;
+
+// Operations
+
+ /**
+ Clears the table.
+ */
+
+ virtual void ClearTable();
+
+ /**
+ Creates a table of the given dimensions.
+ */
+
+ virtual bool CreateTable(int rows, int cols);
+
+ /**
+ Sets the attributes for the cells specified by the selection.
+ */
+
+ virtual bool SetCellStyle(const wxRichTextSelection& selection, const wxRichTextAttr& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
+
+ /**
+ Deletes rows from the given row position.
+ */
+
+ virtual bool DeleteRows(int startRow, int noRows = 1);
+
+ /**
+ Deletes columns from the given column position.
+ */
+
+ virtual bool DeleteColumns(int startCol, int noCols = 1);
+
+ /**
+ Adds rows from the given row position.
+ */
+
+ virtual bool AddRows(int startRow, int noRows = 1, const wxRichTextAttr& attr = wxRichTextAttr());
+
+ /**
+ Adds columns from the given column position.
+ */
+
+ virtual bool AddColumns(int startCol, int noCols = 1, const wxRichTextAttr& attr = wxRichTextAttr());
+
+ // Makes a clone of this object.
+ virtual wxRichTextObject* Clone() const { return new wxRichTextTable(*this); }
+
+ // Copies this object.
+ void Copy(const wxRichTextTable& obj);
+
+protected:
+
+ int m_rowCount;
+ int m_colCount;
+
+ // An array of rows, each of which is a wxRichTextObjectPtrArray containing
+ // the cell objects. The cell objects are also children of this object.
+ // Problem: if boxes are immediate children of a box, this will cause problems
+ // with wxRichTextParagraphLayoutBox functions (and functions elsewhere) that
+ // expect to find just paragraphs. May have to adjust the way we handle the
+ // hierarchy to accept non-paragraph objects in a paragraph layout box.
+ // We'll be overriding much wxRichTextParagraphLayoutBox functionality so this
+ // may not be such a problem. Perhaps the table should derive from a different
+ // class?
+ wxRichTextObjectPtrArrayArray m_cells;
+};
+
+/** @class wxRichTextTableBlock
+
+ Stores the coordinates for a block of cells.
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextTableBlock
+{
+public:
+ wxRichTextTableBlock() { Init(); }
+ wxRichTextTableBlock(int colStart, int colEnd, int rowStart, int rowEnd)
+ { Init(); m_colStart = colStart; m_colEnd = colEnd; m_rowStart = rowStart; m_rowEnd = rowEnd; }
+ wxRichTextTableBlock(const wxRichTextTableBlock& block) { Copy(block); }
+
+ void Init() { m_colStart = 0; m_colEnd = 0; m_rowStart = 0; m_rowEnd = 0; }
+
+ void Copy(const wxRichTextTableBlock& block)
+ {
+ m_colStart = block.m_colStart; m_colEnd = block.m_colEnd; m_rowStart = block.m_rowStart; m_rowEnd = block.m_rowEnd;
+ }
+ void operator=(const wxRichTextTableBlock& block) { Copy(block); }
+ bool operator==(const wxRichTextTableBlock& block)
+ { return m_colStart == block.m_colStart && m_colEnd == block.m_colEnd && m_rowStart == block.m_rowStart && m_rowEnd == block.m_rowEnd; }
+
+ /// Computes the block given a table (perhaps about to be edited) and a rich text control
+ /// that may have a selection. If no selection, the whole table is used. If just the whole content
+ /// of one cell is selected, this cell only is used. If the cell contents is not selected and
+ /// requireCellSelection is @false, the focused cell will count as a selected cell.
+ bool ComputeBlockForSelection(wxRichTextTable* table, wxRichTextCtrl* ctrl, bool requireCellSelection = true);
+
+ /// Does this block represent the whole table?
+ bool IsWholeTable(wxRichTextTable* table) const;
+
+ /// Returns the cell focused in the table, if any
+ static wxRichTextCell* GetFocusedCell(wxRichTextCtrl* ctrl);
+
+ int& ColStart() { return m_colStart; }
+ int ColStart() const { return m_colStart; }
+
+ int& ColEnd() { return m_colEnd; }
+ int ColEnd() const { return m_colEnd; }
+
+ int& RowStart() { return m_rowStart; }
+ int RowStart() const { return m_rowStart; }
+
+ int& RowEnd() { return m_rowEnd; }
+ int RowEnd() const { return m_rowEnd; }
+
+ int m_colStart, m_colEnd, m_rowStart, m_rowEnd;
+};
+
+/**
+ The command identifiers for Do/Undo.
+*/
+
+enum wxRichTextCommandId
+{
+ wxRICHTEXT_INSERT,
+ wxRICHTEXT_DELETE,
+ wxRICHTEXT_CHANGE_ATTRIBUTES,
+ wxRICHTEXT_CHANGE_STYLE,
+ wxRICHTEXT_CHANGE_PROPERTIES,
+ wxRICHTEXT_CHANGE_OBJECT
+};
+
+/**
+ @class wxRichTextObjectAddress
+
+ A class for specifying an object anywhere in an object hierarchy,
+ without using a pointer, necessary since wxRTC commands may delete
+ and recreate sub-objects so physical object addresses change. An array
+ of positions (one per hierarchy level) is used.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextCommand
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextObjectAddress
+{
+public:
+ /**
+ Creates the address given a container and an object.
+ */
+ wxRichTextObjectAddress(wxRichTextParagraphLayoutBox* topLevelContainer, wxRichTextObject* obj) { Create(topLevelContainer, obj); }
+ /**
+ */
+ wxRichTextObjectAddress() { Init(); }
+ /**
+ */
+ wxRichTextObjectAddress(const wxRichTextObjectAddress& address) { Copy(address); }
+
+ void Init() {}
+
+ /**
+ Copies the address.
+ */
+ void Copy(const wxRichTextObjectAddress& address) { m_address = address.m_address; }
+
+ /**
+ Assignment operator.
+ */
+ void operator=(const wxRichTextObjectAddress& address) { Copy(address); }
+
+ /**
+ Returns the object specified by the address, given a top level container.
+ */
+ wxRichTextObject* GetObject(wxRichTextParagraphLayoutBox* topLevelContainer) const;
+
+ /**
+ Creates the address given a container and an object.
+ */
+ bool Create(wxRichTextParagraphLayoutBox* topLevelContainer, wxRichTextObject* obj);
+
+ /**
+ Returns the array of integers representing the object address.
+ */
+ wxArrayInt& GetAddress() { return m_address; }
+
+ /**
+ Returns the array of integers representing the object address.
+ */
+ const wxArrayInt& GetAddress() const { return m_address; }
+
+ /**
+ Sets the address from an array of integers.
+ */
+ void SetAddress(const wxArrayInt& address) { m_address = address; }
+
+protected:
+
+ wxArrayInt m_address;
+};
+
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextAction;
+
+/**
+ @class wxRichTextCommand
+
+ Implements a command on the undo/redo stack. A wxRichTextCommand object contains one or more wxRichTextAction
+ objects, allowing aggregation of a number of operations into one command.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextAction
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextCommand: public wxCommand
+{
+public:
+ /**
+ Constructor for one action.
+ */
+ wxRichTextCommand(const wxString& name, wxRichTextCommandId id, wxRichTextBuffer* buffer,
+ wxRichTextParagraphLayoutBox* container, wxRichTextCtrl* ctrl, bool ignoreFirstTime = false);
+
+ /**
+ Constructor for multiple actions.
+ */
+ wxRichTextCommand(const wxString& name);
+
+ virtual ~wxRichTextCommand();
+
+ /**
+ Performs the command.
+ */
+ bool Do();
+
+ /**
+ Undoes the command.
+ */
+ bool Undo();
+
+ /**
+ Adds an action to the action list.
+ */
+ void AddAction(wxRichTextAction* action);
+
+ /**
+ Clears the action list.
+ */
+ void ClearActions();
+
+ /**
+ Returns the action list.
+ */
+ wxList& GetActions() { return m_actions; }
+
+protected:
+
+ wxList m_actions;
+};
+
+/**
+ @class wxRichTextAction
+
+ Implements a part of a command.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextCommand
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextAction: public wxObject
+{
+public:
+ /**
+ Constructor. @a buffer is the top-level buffer, while @a container is the object within
+ which the action is taking place. In the simplest case, they are the same.
+ */
+ wxRichTextAction(wxRichTextCommand* cmd, const wxString& name, wxRichTextCommandId id,
+ wxRichTextBuffer* buffer, wxRichTextParagraphLayoutBox* container,
+ wxRichTextCtrl* ctrl, bool ignoreFirstTime = false);
+
+ virtual ~wxRichTextAction();
+
+ /**
+ Performs the action.
+ */
+ bool Do();
+
+ /**
+ Undoes the action.
+ */
+ bool Undo();
+
+ /**
+ Updates the control appearance, optimizing if possible given information from the call to Layout.
+ */
+ void UpdateAppearance(long caretPosition, bool sendUpdateEvent = false,
+ wxArrayInt* optimizationLineCharPositions = NULL, wxArrayInt* optimizationLineYPositions = NULL, bool isDoCmd = true);
+
+ /**
+ Replaces the buffer paragraphs with the given fragment.
+ */
+ void ApplyParagraphs(const wxRichTextParagraphLayoutBox& fragment);
+
+ /**
+ Returns the new fragments.
+ */
+ wxRichTextParagraphLayoutBox& GetNewParagraphs() { return m_newParagraphs; }
+
+ /**
+ Returns the old fragments.
+ */
+ wxRichTextParagraphLayoutBox& GetOldParagraphs() { return m_oldParagraphs; }
+
+ /**
+ Returns the attributes, for single-object commands.
+ */
+ wxRichTextAttr& GetAttributes() { return m_attributes; }
+
+ /**
+ Returns the object to replace the one at the position defined by the container address
+ and the action's range start position.
+ */
+ wxRichTextObject* GetObject() const { return m_object; }
+
+ /**
+ Stores the object to replace the one at the position defined by the container address
+ without making an address for it (cf SetObject() and MakeObject()).
+ */
+ void StoreObject(wxRichTextObject* obj) { m_object = obj; }
+
+ /**
+ Sets the object to replace the one at the position defined by the container address
+ and the action's range start position.
+ */
+ void SetObject(wxRichTextObject* obj) { m_object = obj; m_objectAddress.Create(m_buffer, m_object); }
+
+ /**
+ Makes an address from the given object.
+ */
+ void MakeObject(wxRichTextObject* obj) { m_objectAddress.Create(m_buffer, obj); }
+
+ /**
+ Sets the existing and new objects, for use with wxRICHTEXT_CHANGE_OBJECT.
+ */
+ void SetOldAndNewObjects(wxRichTextObject* oldObj, wxRichTextObject* newObj) { SetObject(oldObj); StoreObject(newObj); }
+
+ /**
+ Calculate arrays for refresh optimization.
+ */
+ void CalculateRefreshOptimizations(wxArrayInt& optimizationLineCharPositions, wxArrayInt& optimizationLineYPositions);
+
+ /**
+ Sets the position used for e.g. insertion.
+ */
+ void SetPosition(long pos) { m_position = pos; }
+
+ /**
+ Returns the position used for e.g. insertion.
+ */
+ long GetPosition() const { return m_position; }
+
+ /**
+ Sets the range for e.g. deletion.
+ */
+ void SetRange(const wxRichTextRange& range) { m_range = range; }
+
+ /**
+ Returns the range for e.g. deletion.
+ */
+ const wxRichTextRange& GetRange() const { return m_range; }
+
+ /**
+ Returns the address (nested position) of the container within the buffer being manipulated.
+ */
+ wxRichTextObjectAddress& GetContainerAddress() { return m_containerAddress; }
+
+ /**
+ Returns the address (nested position) of the container within the buffer being manipulated.
+ */
+ const wxRichTextObjectAddress& GetContainerAddress() const { return m_containerAddress; }
+
+ /**
+ Sets the address (nested position) of the container within the buffer being manipulated.
+ */
+ void SetContainerAddress(const wxRichTextObjectAddress& address) { m_containerAddress = address; }
+
+ /**
+ Sets the address (nested position) of the container within the buffer being manipulated.
+ */
+ void SetContainerAddress(wxRichTextParagraphLayoutBox* container, wxRichTextObject* obj) { m_containerAddress.Create(container, obj); }
+
+ /**
+ Returns the container that this action refers to, using the container address and top-level buffer.
+ */
+ wxRichTextParagraphLayoutBox* GetContainer() const;
+
+ /**
+ Returns the action name.
+ */
+ const wxString& GetName() const { return m_name; }
+
+ /**
+ Instructs the first Do() command should be skipped as it's already been applied.
+ */
+ void SetIgnoreFirstTime(bool b) { m_ignoreThis = b; }
+
+ /**
+ Returns true if the first Do() command should be skipped as it's already been applied.
+ */
+ bool GetIgnoreFirstTime() const { return m_ignoreThis; }
+
+protected:
+ // Action name
+ wxString m_name;
+
+ // Buffer
+ wxRichTextBuffer* m_buffer;
+
+ // The address (nested position) of the container being manipulated.
+ // This is necessary because objects are deleted, and we can't
+ // therefore store actual pointers.
+ wxRichTextObjectAddress m_containerAddress;
+
+ // Control
+ wxRichTextCtrl* m_ctrl;
+
+ // Stores the new paragraphs
+ wxRichTextParagraphLayoutBox m_newParagraphs;
+
+ // Stores the old paragraphs
+ wxRichTextParagraphLayoutBox m_oldParagraphs;
+
+ // Stores an object to replace the one at the position
+ // defined by the container address and the action's range start position.
+ wxRichTextObject* m_object;
+
+ // Stores the attributes
+ wxRichTextAttr m_attributes;
+
+ // The address of the object being manipulated (used for changing an individual object or its attributes)
+ wxRichTextObjectAddress m_objectAddress;
+
+ // Stores the old attributes
+ // wxRichTextAttr m_oldAttributes;
+
+ // The affected range
+ wxRichTextRange m_range;
+
+ // The insertion point for this command
+ long m_position;
+
+ // Ignore 1st 'Do' operation because we already did it
+ bool m_ignoreThis;
+
+ // The command identifier
+ wxRichTextCommandId m_cmdId;
+};
+
+/*!
+ * Handler flags
+ */
+
+// Include style sheet when loading and saving
+#define wxRICHTEXT_HANDLER_INCLUDE_STYLESHEET 0x0001
+
+// Save images to memory file system in HTML handler
+#define wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY 0x0010
+
+// Save images to files in HTML handler
+#define wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_FILES 0x0020
+
+// Save images as inline base64 data in HTML handler
+#define wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_BASE64 0x0040
+
+// Don't write header and footer (or BODY), so we can include the fragment
+// in a larger document
+#define wxRICHTEXT_HANDLER_NO_HEADER_FOOTER 0x0080
+
+// Convert the more common face names to names that will work on the current platform
+// in a larger document
+#define wxRICHTEXT_HANDLER_CONVERT_FACENAMES 0x0100
+
+/**
+ @class wxRichTextFileHandler
+
+ The base class for file handlers.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextBuffer, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextFileHandler: public wxObject
+{
+ DECLARE_CLASS(wxRichTextFileHandler)
+public:
+ /**
+ Creates a file handler object.
+ */
+ wxRichTextFileHandler(const wxString& name = wxEmptyString, const wxString& ext = wxEmptyString, int type = 0)
+ : m_name(name), m_extension(ext), m_type(type), m_flags(0), m_visible(true)
+ { }
+
+#if wxUSE_STREAMS
+ /**
+ Loads the buffer from a stream.
+ Not all handlers will implement file loading.
+ */
+ bool LoadFile(wxRichTextBuffer *buffer, wxInputStream& stream)
+ { return DoLoadFile(buffer, stream); }
+
+ /**
+ Saves the buffer to a stream.
+ Not all handlers will implement file saving.
+ */
+ bool SaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream)
+ { return DoSaveFile(buffer, stream); }
+#endif
+
+#if wxUSE_FFILE && wxUSE_STREAMS
+ /**
+ Loads the buffer from a file.
+ */
+ virtual bool LoadFile(wxRichTextBuffer *buffer, const wxString& filename);
+
+ /**
+ Saves the buffer to a file.
+ */
+ virtual bool SaveFile(wxRichTextBuffer *buffer, const wxString& filename);
+#endif // wxUSE_STREAMS && wxUSE_STREAMS
+
+ /**
+ Returns @true if we handle this filename (if using files). By default, checks the extension.
+ */
+ virtual bool CanHandle(const wxString& filename) const;
+
+ /**
+ Returns @true if we can save using this handler.
+ */
+ virtual bool CanSave() const { return false; }
+
+ /**
+ Returns @true if we can load using this handler.
+ */
+ virtual bool CanLoad() const { return false; }
+
+ /**
+ Returns @true if this handler should be visible to the user.
+ */
+ virtual bool IsVisible() const { return m_visible; }
+
+ /**
+ Sets whether the handler should be visible to the user (via the application's
+ load and save dialogs).
+ */
+ virtual void SetVisible(bool visible) { m_visible = visible; }
+
+ /**
+ Sets the name of the handler.
+ */
+ void SetName(const wxString& name) { m_name = name; }
+
+ /**
+ Returns the name of the handler.
+ */
+ wxString GetName() const { return m_name; }
+
+ /**
+ Sets the default extension to recognise.
+ */
+ void SetExtension(const wxString& ext) { m_extension = ext; }
+
+ /**
+ Returns the default extension to recognise.
+ */
+ wxString GetExtension() const { return m_extension; }
+
+ /**
+ Sets the handler type.
+ */
+ void SetType(int type) { m_type = type; }
+
+ /**
+ Returns the handler type.
+ */
+ int GetType() const { return m_type; }
+
+ /**
+ Sets flags that change the behaviour of loading or saving.
+ See the documentation for each handler class to see what flags are relevant
+ for each handler.
+
+ You call this function directly if you are using a file handler explicitly
+ (without going through the text control or buffer LoadFile/SaveFile API).
+ Or, you can call the control or buffer's SetHandlerFlags function to set
+ the flags that will be used for subsequent load and save operations.
+ */
+ void SetFlags(int flags) { m_flags = flags; }
+
+ /**
+ Returns flags controlling how loading and saving is done.
+ */
+ int GetFlags() const { return m_flags; }
+
+ /**
+ Sets the encoding to use when saving a file. If empty, a suitable encoding is chosen.
+ */
+ void SetEncoding(const wxString& encoding) { m_encoding = encoding; }
+
+ /**
+ Returns the encoding to use when saving a file. If empty, a suitable encoding is chosen.
+ */
+ const wxString& GetEncoding() const { return m_encoding; }
+
+protected:
+
+#if wxUSE_STREAMS
+ /**
+ Override to load content from @a stream into @a buffer.
+ */
+ virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream) = 0;
+
+ /**
+ Override to save content to @a stream from @a buffer.
+ */
+ virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream) = 0;
+#endif
+
+ wxString m_name;
+ wxString m_encoding;
+ wxString m_extension;
+ int m_type;
+ int m_flags;
+ bool m_visible;
+};
+
+/**
+ @class wxRichTextPlainTextHandler
+
+ Implements saving a buffer to plain text.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextFileHandler, wxRichTextBuffer, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextPlainTextHandler: public wxRichTextFileHandler
+{
+ DECLARE_CLASS(wxRichTextPlainTextHandler)
+public:
+ wxRichTextPlainTextHandler(const wxString& name = wxT("Text"),
+ const wxString& ext = wxT("txt"),
+ wxRichTextFileType type = wxRICHTEXT_TYPE_TEXT)
+ : wxRichTextFileHandler(name, ext, type)
+ { }
+
+ // Can we save using this handler?
+ virtual bool CanSave() const { return true; }
+
+ // Can we load using this handler?
+ virtual bool CanLoad() const { return true; }
+
+protected:
+
+#if wxUSE_STREAMS
+ virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream);
+ virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream);
+#endif
+
+};
+
+/**
+ @class wxRichTextDrawingHandler
+
+ The base class for custom drawing handlers.
+ Currently, drawing handlers can provide virtual attributes.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextBuffer, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextDrawingHandler: public wxObject
+{
+ DECLARE_CLASS(wxRichTextDrawingHandler)
+public:
+ /**
+ Creates a drawing handler object.
+ */
+ wxRichTextDrawingHandler(const wxString& name = wxEmptyString)
+ : m_name(name)
+ { }
+
+ /**
+ Returns @true if this object has virtual attributes that we can provide.
+ */
+ virtual bool HasVirtualAttributes(wxRichTextObject* obj) const = 0;
+
+ /**
+ Provides virtual attributes that we can provide.
+ */
+ virtual bool GetVirtualAttributes(wxRichTextAttr& attr, wxRichTextObject* obj) const = 0;
+
+ /**
+ Gets the count for mixed virtual attributes for individual positions within the object.
+ For example, individual characters within a text object may require special highlighting.
+ */
+ virtual int GetVirtualSubobjectAttributesCount(wxRichTextObject* obj) const = 0;
+
+ /**
+ Gets the mixed virtual attributes for individual positions within the object.
+ For example, individual characters within a text object may require special highlighting.
+ Returns the number of virtual attributes found.
+ */
+ virtual int GetVirtualSubobjectAttributes(wxRichTextObject* obj, wxArrayInt& positions, wxRichTextAttrArray& attributes) const = 0;
+
+ /**
+ Do we have virtual text for this object? Virtual text allows an application
+ to replace characters in an object for editing and display purposes, for example
+ for highlighting special characters.
+ */
+ virtual bool HasVirtualText(const wxRichTextPlainText* obj) const = 0;
+
+ /**
+ Gets the virtual text for this object.
+ */
+ virtual bool GetVirtualText(const wxRichTextPlainText* obj, wxString& text) const = 0;
+
+ /**
+ Sets the name of the handler.
+ */
+ void SetName(const wxString& name) { m_name = name; }
+
+ /**
+ Returns the name of the handler.
+ */
+ wxString GetName() const { return m_name; }
+
+protected:
+
+ wxString m_name;
+};
+
+#if wxUSE_DATAOBJ
+
+/**
+ @class wxRichTextBufferDataObject
+
+ Implements a rich text data object for clipboard transfer.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxDataObjectSimple, wxRichTextBuffer, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextBufferDataObject: public wxDataObjectSimple
+{
+public:
+ /**
+ The constructor doesn't copy the pointer, so it shouldn't go away while this object
+ is alive.
+ */
+ wxRichTextBufferDataObject(wxRichTextBuffer* richTextBuffer = NULL);
+ virtual ~wxRichTextBufferDataObject();
+
+ /**
+ After a call to this function, the buffer is owned by the caller and it
+ is responsible for deleting it.
+ */
+ wxRichTextBuffer* GetRichTextBuffer();
+
+ /**
+ Returns the id for the new data format.
+ */
+ static const wxChar* GetRichTextBufferFormatId() { return ms_richTextBufferFormatId; }
+
+ // base class pure virtuals
+
+ virtual wxDataFormat GetPreferredFormat(Direction dir) const;
+ virtual size_t GetDataSize() const;
+ virtual bool GetDataHere(void *pBuf) const;
+ virtual bool SetData(size_t len, const void *buf);
+
+ // prevent warnings
+
+ virtual size_t GetDataSize(const wxDataFormat&) const { return GetDataSize(); }
+ virtual bool GetDataHere(const wxDataFormat&, void *buf) const { return GetDataHere(buf); }
+ virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) { return SetData(len, buf); }
+
+private:
+ wxDataFormat m_formatRichTextBuffer; // our custom format
+ wxRichTextBuffer* m_richTextBuffer; // our data
+ static const wxChar* ms_richTextBufferFormatId; // our format id
+};
+
+#endif
+
+/**
+ @class wxRichTextRenderer
+
+ This class isolates some common drawing functionality.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextBuffer, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextRenderer: public wxObject
+{
+public:
+ /**
+ Constructor.
+ */
+ wxRichTextRenderer() {}
+ virtual ~wxRichTextRenderer() {}
+
+ /**
+ Draws a standard bullet, as specified by the value of GetBulletName. This function should be overridden.
+ */
+ virtual bool DrawStandardBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxRichTextAttr& attr, const wxRect& rect) = 0;
+
+ /**
+ Draws a bullet that can be described by text, such as numbered or symbol bullets. This function should be overridden.
+ */
+ virtual bool DrawTextBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxRichTextAttr& attr, const wxRect& rect, const wxString& text) = 0;
+
+ /**
+ Draws a bitmap bullet, where the bullet bitmap is specified by the value of GetBulletName. This function should be overridden.
+ */
+ virtual bool DrawBitmapBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxRichTextAttr& attr, const wxRect& rect) = 0;
+
+ /**
+ Enumerate the standard bullet names currently supported. This function should be overridden.
+ */
+ virtual bool EnumerateStandardBulletNames(wxArrayString& bulletNames) = 0;
+};
+
+/**
+ @class wxRichTextStdRenderer
+
+ The standard renderer for drawing bullets.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextRenderer, wxRichTextBuffer, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextStdRenderer: public wxRichTextRenderer
+{
+public:
+ /**
+ Constructor.
+ */
+ wxRichTextStdRenderer() {}
+
+ // Draw a standard bullet, as specified by the value of GetBulletName
+ virtual bool DrawStandardBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxRichTextAttr& attr, const wxRect& rect);
+
+ // Draw a bullet that can be described by text, such as numbered or symbol bullets
+ virtual bool DrawTextBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxRichTextAttr& attr, const wxRect& rect, const wxString& text);
+
+ // Draw a bitmap bullet, where the bullet bitmap is specified by the value of GetBulletName
+ virtual bool DrawBitmapBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxRichTextAttr& attr, const wxRect& rect);
+
+ // Enumerate the standard bullet names currently supported
+ virtual bool EnumerateStandardBulletNames(wxArrayString& bulletNames);
+};
+
+/*!
+ * Utilities
+ *
+ */
+
+inline bool wxRichTextHasStyle(int flags, int style)
+{
+ return ((flags & style) == style);
+}
+
+/// Compare two attribute objects
+WXDLLIMPEXP_RICHTEXT bool wxTextAttrEq(const wxRichTextAttr& attr1, const wxRichTextAttr& attr2);
+WXDLLIMPEXP_RICHTEXT bool wxTextAttrEq(const wxRichTextAttr& attr1, const wxRichTextAttr& attr2);
+
+/// Apply one style to another
+WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxRichTextAttr& destStyle, const wxRichTextAttr& style, wxRichTextAttr* compareWith = NULL);
+
+// Remove attributes
+WXDLLIMPEXP_RICHTEXT bool wxRichTextRemoveStyle(wxRichTextAttr& destStyle, const wxRichTextAttr& style);
+
+/// Combine two bitlists
+WXDLLIMPEXP_RICHTEXT bool wxRichTextCombineBitlists(int& valueA, int valueB, int& flagsA, int flagsB);
+
+/// Compare two bitlists
+WXDLLIMPEXP_RICHTEXT bool wxRichTextBitlistsEqPartial(int valueA, int valueB, int flags);
+
+/// Split into paragraph and character styles
+WXDLLIMPEXP_RICHTEXT bool wxRichTextSplitParaCharStyles(const wxRichTextAttr& style, wxRichTextAttr& parStyle, wxRichTextAttr& charStyle);
+
+/// Compare tabs
+WXDLLIMPEXP_RICHTEXT bool wxRichTextTabsEq(const wxArrayInt& tabs1, const wxArrayInt& tabs2);
+
+/// Convert a decimal to Roman numerals
+WXDLLIMPEXP_RICHTEXT wxString wxRichTextDecimalToRoman(long n);
+
+// Collects the attributes that are common to a range of content, building up a note of
+// which attributes are absent in some objects and which clash in some objects.
+WXDLLIMPEXP_RICHTEXT void wxTextAttrCollectCommonAttributes(wxTextAttr& currentStyle, const wxTextAttr& attr, wxTextAttr& clashingAttr, wxTextAttr& absentAttr);
+
+WXDLLIMPEXP_RICHTEXT void wxRichTextModuleInit();
+
+#endif
+ // wxUSE_RICHTEXT
+
+#endif
+ // _WX_RICHTEXTBUFFER_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtextbulletspage.h
+// Purpose:
+// Author: Julian Smart
+// Modified by:
+// Created: 10/4/2006 10:32:31 AM
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _RICHTEXTBULLETSPAGE_H_
+#define _RICHTEXTBULLETSPAGE_H_
+
+/*!
+ * Includes
+ */
+
+#include "wx/richtext/richtextdialogpage.h"
+#include "wx/spinbutt.h" // for wxSpinEvent
+
+/*!
+ * Forward declarations
+ */
+
+////@begin forward declarations
+class wxSpinCtrl;
+class wxRichTextCtrl;
+////@end forward declarations
+
+/*!
+ * Control identifiers
+ */
+
+////@begin control identifiers
+#define SYMBOL_WXRICHTEXTBULLETSPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL
+#define SYMBOL_WXRICHTEXTBULLETSPAGE_TITLE wxEmptyString
+#define SYMBOL_WXRICHTEXTBULLETSPAGE_IDNAME ID_RICHTEXTBULLETSPAGE
+#define SYMBOL_WXRICHTEXTBULLETSPAGE_SIZE wxSize(400, 300)
+#define SYMBOL_WXRICHTEXTBULLETSPAGE_POSITION wxDefaultPosition
+////@end control identifiers
+
+/*!
+ * wxRichTextBulletsPage class declaration
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextBulletsPage: public wxRichTextDialogPage
+{
+ DECLARE_DYNAMIC_CLASS( wxRichTextBulletsPage )
+ DECLARE_EVENT_TABLE()
+ DECLARE_HELP_PROVISION()
+
+public:
+ /// Constructors
+ wxRichTextBulletsPage( );
+ wxRichTextBulletsPage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTBULLETSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBULLETSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBULLETSPAGE_STYLE );
+
+ /// Creation
+ bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTBULLETSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBULLETSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBULLETSPAGE_STYLE );
+
+ /// Initialise members
+ void Init();
+
+ /// Creates the controls and sizers
+ void CreateControls();
+
+ /// Updates the bullets preview
+ void UpdatePreview();
+
+ /// Transfer data from/to window
+ virtual bool TransferDataFromWindow();
+ virtual bool TransferDataToWindow();
+
+ /// Gets the attributes associated with the main formatting dialog
+ wxRichTextAttr* GetAttributes();
+
+ /// Update for symbol-related controls
+ void OnSymbolUpdate( wxUpdateUIEvent& event );
+
+ /// Update for number-related controls
+ void OnNumberUpdate( wxUpdateUIEvent& event );
+
+ /// Update for standard bullet-related controls
+ void OnStandardBulletUpdate( wxUpdateUIEvent& event );
+
+////@begin wxRichTextBulletsPage event handler declarations
+
+ /// wxEVT_LISTBOX event handler for ID_RICHTEXTBULLETSPAGE_STYLELISTBOX
+ void OnStylelistboxSelected( wxCommandEvent& event );
+
+ /// wxEVT_CHECKBOX event handler for ID_RICHTEXTBULLETSPAGE_PERIODCTRL
+ void OnPeriodctrlClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_PERIODCTRL
+ void OnPeriodctrlUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_CHECKBOX event handler for ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL
+ void OnParenthesesctrlClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL
+ void OnParenthesesctrlUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_CHECKBOX event handler for ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL
+ void OnRightParenthesisCtrlClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL
+ void OnRightParenthesisCtrlUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_COMBOBOX event handler for ID_RICHTEXTBULLETSPAGE_BULLETALIGNMENTCTRL
+ void OnBulletAlignmentCtrlSelected( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC
+ void OnSymbolstaticUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_COMBOBOX event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
+ void OnSymbolctrlSelected( wxCommandEvent& event );
+
+ /// wxEVT_TEXT event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
+ void OnSymbolctrlUpdated( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
+ void OnSymbolctrlUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_BUTTON event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
+ void OnChooseSymbolClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
+ void OnChooseSymbolUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_COMBOBOX event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
+ void OnSymbolfontctrlSelected( wxCommandEvent& event );
+
+ /// wxEVT_TEXT event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
+ void OnSymbolfontctrlUpdated( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
+ void OnSymbolfontctrlUIUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NAMESTATIC
+ void OnNamestaticUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_COMBOBOX event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL
+ void OnNamectrlSelected( wxCommandEvent& event );
+
+ /// wxEVT_TEXT event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL
+ void OnNamectrlUpdated( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL
+ void OnNamectrlUIUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC
+ void OnNumberstaticUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_SPINCTRL event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
+ void OnNumberctrlUpdated( wxSpinEvent& event );
+
+ /// wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
+ void OnNumberctrlUp( wxSpinEvent& event );
+
+ /// wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
+ void OnNumberctrlDown( wxSpinEvent& event );
+
+ /// wxEVT_TEXT event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
+ void OnNumberctrlTextUpdated( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
+ void OnNumberctrlUpdate( wxUpdateUIEvent& event );
+
+////@end wxRichTextBulletsPage event handler declarations
+
+////@begin wxRichTextBulletsPage member function declarations
+
+ /// Retrieves bitmap resources
+ wxBitmap GetBitmapResource( const wxString& name );
+
+ /// Retrieves icon resources
+ wxIcon GetIconResource( const wxString& name );
+////@end wxRichTextBulletsPage member function declarations
+
+ /// Should we show tooltips?
+ static bool ShowToolTips();
+
+////@begin wxRichTextBulletsPage member variables
+ wxListBox* m_styleListBox;
+ wxCheckBox* m_periodCtrl;
+ wxCheckBox* m_parenthesesCtrl;
+ wxCheckBox* m_rightParenthesisCtrl;
+ wxComboBox* m_bulletAlignmentCtrl;
+ wxComboBox* m_symbolCtrl;
+ wxComboBox* m_symbolFontCtrl;
+ wxComboBox* m_bulletNameCtrl;
+ wxSpinCtrl* m_numberCtrl;
+ wxRichTextCtrl* m_previewCtrl;
+ /// Control identifiers
+ enum {
+ ID_RICHTEXTBULLETSPAGE = 10300,
+ ID_RICHTEXTBULLETSPAGE_STYLELISTBOX = 10305,
+ ID_RICHTEXTBULLETSPAGE_PERIODCTRL = 10313,
+ ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL = 10311,
+ ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL = 10306,
+ ID_RICHTEXTBULLETSPAGE_BULLETALIGNMENTCTRL = 10315,
+ ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC = 10301,
+ ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL = 10307,
+ ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL = 10308,
+ ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL = 10309,
+ ID_RICHTEXTBULLETSPAGE_NAMESTATIC = 10303,
+ ID_RICHTEXTBULLETSPAGE_NAMECTRL = 10304,
+ ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC = 10302,
+ ID_RICHTEXTBULLETSPAGE_NUMBERCTRL = 10310,
+ ID_RICHTEXTBULLETSPAGE_PREVIEW_CTRL = 10314
+ };
+////@end wxRichTextBulletsPage member variables
+
+ bool m_hasBulletStyle;
+ bool m_hasBulletNumber;
+ bool m_hasBulletSymbol;
+ bool m_dontUpdate;
+};
+
+#endif
+ // _RICHTEXTBULLETSPAGE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtextctrl.h
+// Purpose: A rich edit control
+// Author: Julian Smart
+// Modified by:
+// Created: 2005-09-30
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RICHTEXTCTRL_H_
+#define _WX_RICHTEXTCTRL_H_
+
+#include "wx/richtext/richtextbuffer.h"
+
+#if wxUSE_RICHTEXT
+
+#include "wx/scrolwin.h"
+#include "wx/caret.h"
+
+#include "wx/textctrl.h"
+
+#if wxUSE_DRAG_AND_DROP
+#include "wx/dnd.h"
+#endif
+
+#if !defined(__WXGTK__) && !defined(__WXMAC__)
+#define wxRICHTEXT_BUFFERED_PAINTING 1
+#else
+#define wxRICHTEXT_BUFFERED_PAINTING 0
+#endif
+
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleDefinition;
+
+/*
+ * Styles and flags
+ */
+
+/**
+ Styles
+*/
+
+#define wxRE_READONLY 0x0010
+#define wxRE_MULTILINE 0x0020
+#define wxRE_CENTRE_CARET 0x8000
+#define wxRE_CENTER_CARET wxRE_CENTRE_CARET
+
+/**
+ Flags
+*/
+
+#define wxRICHTEXT_SHIFT_DOWN 0x01
+#define wxRICHTEXT_CTRL_DOWN 0x02
+#define wxRICHTEXT_ALT_DOWN 0x04
+
+/**
+ Extra flags
+*/
+
+// Don't draw guide lines around boxes and tables
+#define wxRICHTEXT_EX_NO_GUIDELINES 0x00000100
+
+
+/*
+ Defaults
+*/
+
+#define wxRICHTEXT_DEFAULT_OVERALL_SIZE wxSize(-1, -1)
+#define wxRICHTEXT_DEFAULT_IMAGE_SIZE wxSize(80, 80)
+#define wxRICHTEXT_DEFAULT_SPACING 3
+#define wxRICHTEXT_DEFAULT_MARGIN 3
+#define wxRICHTEXT_DEFAULT_UNFOCUSSED_BACKGROUND wxColour(175, 175, 175)
+#define wxRICHTEXT_DEFAULT_FOCUSSED_BACKGROUND wxColour(140, 140, 140)
+#define wxRICHTEXT_DEFAULT_UNSELECTED_BACKGROUND wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)
+#define wxRICHTEXT_DEFAULT_TYPE_COLOUR wxColour(0, 0, 200)
+#define wxRICHTEXT_DEFAULT_FOCUS_RECT_COLOUR wxColour(100, 80, 80)
+#define wxRICHTEXT_DEFAULT_CARET_WIDTH 2
+// Minimum buffer size before delayed layout kicks in
+#define wxRICHTEXT_DEFAULT_DELAYED_LAYOUT_THRESHOLD 20000
+// Milliseconds before layout occurs after resize
+#define wxRICHTEXT_DEFAULT_LAYOUT_INTERVAL 50
+
+/* Identifiers
+ */
+#define wxID_RICHTEXT_PROPERTIES1 (wxID_HIGHEST + 1)
+#define wxID_RICHTEXT_PROPERTIES2 (wxID_HIGHEST + 2)
+#define wxID_RICHTEXT_PROPERTIES3 (wxID_HIGHEST + 3)
+
+/*
+ Normal selection occurs initially and as user drags within one container.
+ Common ancestor selection occurs when the user starts dragging across containers
+ that have a common ancestor, for example the cells in a table.
+ */
+
+enum wxRichTextCtrlSelectionState
+{
+ wxRichTextCtrlSelectionState_Normal,
+ wxRichTextCtrlSelectionState_CommonAncestor
+};
+
+/**
+ @class wxRichTextContextMenuPropertiesInfo
+
+ wxRichTextContextMenuPropertiesInfo keeps track of objects that appear in the context menu,
+ whose properties are available to be edited.
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextContextMenuPropertiesInfo
+{
+public:
+ /**
+ Constructor.
+ */
+ wxRichTextContextMenuPropertiesInfo() { Init(); }
+
+// Operations
+
+ /**
+ Initialisation.
+ */
+ void Init() {}
+
+ /**
+ Adds an item.
+ */
+ bool AddItem(const wxString& label, wxRichTextObject* obj);
+
+ /**
+ Returns the number of menu items that were added.
+ */
+ int AddMenuItems(wxMenu* menu, int startCmd = wxID_RICHTEXT_PROPERTIES1) const;
+
+ /**
+ Adds appropriate menu items for the current container and clicked on object
+ (and container's parent, if appropriate).
+ */
+ int AddItems(wxRichTextCtrl* ctrl, wxRichTextObject* container, wxRichTextObject* obj);
+
+ /**
+ Clears the items.
+ */
+ void Clear() { m_objects.Clear(); m_labels.Clear(); }
+
+// Accessors
+
+ /**
+ Returns the nth label.
+ */
+ wxString GetLabel(int n) const { return m_labels[n]; }
+
+ /**
+ Returns the nth object.
+ */
+ wxRichTextObject* GetObject(int n) const { return m_objects[n]; }
+
+ /**
+ Returns the array of objects.
+ */
+ wxRichTextObjectPtrArray& GetObjects() { return m_objects; }
+
+ /**
+ Returns the array of objects.
+ */
+ const wxRichTextObjectPtrArray& GetObjects() const { return m_objects; }
+
+ /**
+ Returns the array of labels.
+ */
+ wxArrayString& GetLabels() { return m_labels; }
+
+ /**
+ Returns the array of labels.
+ */
+ const wxArrayString& GetLabels() const { return m_labels; }
+
+ /**
+ Returns the number of items.
+ */
+ int GetCount() const { return m_objects.GetCount(); }
+
+ wxRichTextObjectPtrArray m_objects;
+ wxArrayString m_labels;
+};
+
+/**
+ @class wxRichTextCtrl
+
+ wxRichTextCtrl provides a generic, ground-up implementation of a text control
+ capable of showing multiple styles and images.
+
+ wxRichTextCtrl sends notification events: see wxRichTextEvent.
+
+ It also sends the standard wxTextCtrl events @c wxEVT_TEXT_ENTER and
+ @c wxEVT_TEXT, and wxTextUrlEvent when URL content is clicked.
+
+ For more information, see the @ref overview_richtextctrl.
+
+ @beginStyleTable
+ @style{wxRE_CENTRE_CARET}
+ The control will try to keep the caret line centred vertically while editing.
+ wxRE_CENTER_CARET is a synonym for this style.
+ @style{wxRE_MULTILINE}
+ The control will be multiline (mandatory).
+ @style{wxRE_READONLY}
+ The control will not be editable.
+ @endStyleTable
+
+ @library{wxrichtext}
+ @category{richtext}
+ @appearance{richtextctrl.png}
+
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextCtrl : public wxControl,
+ public wxTextCtrlIface,
+ public wxScrollHelper
+{
+ DECLARE_DYNAMIC_CLASS( wxRichTextCtrl )
+ DECLARE_EVENT_TABLE()
+
+public:
+// Constructors
+
+ /**
+ Default constructor.
+ */
+ wxRichTextCtrl( );
+
+ /**
+ Constructor, creating and showing a rich text control.
+
+ @param parent
+ Parent window. Must not be @NULL.
+ @param id
+ Window identifier. The value @c wxID_ANY indicates a default value.
+ @param value
+ Default string.
+ @param pos
+ Window position.
+ @param size
+ Window size.
+ @param style
+ Window style.
+ @param validator
+ Window validator.
+ @param name
+ Window name.
+
+ @see Create(), wxValidator
+ */
+ wxRichTextCtrl( wxWindow* parent, wxWindowID id = -1, const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+ long style = wxRE_MULTILINE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr);
+
+ /**
+ Destructor.
+ */
+ virtual ~wxRichTextCtrl( );
+
+// Operations
+
+ /**
+ Creates the underlying window.
+ */
+ bool Create( wxWindow* parent, wxWindowID id = -1, const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+ long style = wxRE_MULTILINE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr );
+
+ /**
+ Initialises the members of the control.
+ */
+ void Init();
+
+// Accessors
+
+ /**
+ Gets the text for the given range.
+ The end point of range is specified as the last character position of
+ the span of text, plus one.
+ */
+ virtual wxString GetRange(long from, long to) const;
+
+ /**
+ Returns the length of the specified line in characters.
+ */
+ virtual int GetLineLength(long lineNo) const ;
+
+ /**
+ Returns the text for the given line.
+ */
+ virtual wxString GetLineText(long lineNo) const ;
+
+ /**
+ Returns the number of lines in the buffer.
+ */
+ virtual int GetNumberOfLines() const ;
+
+ /**
+ Returns @true if the buffer has been modified.
+ */
+ virtual bool IsModified() const ;
+
+ /**
+ Returns @true if the control is editable.
+ */
+ virtual bool IsEditable() const ;
+
+ /**
+ Returns @true if the control is single-line.
+ Currently wxRichTextCtrl does not support single-line editing.
+ */
+ bool IsSingleLine() const { return !HasFlag(wxRE_MULTILINE); }
+
+ /**
+ Returns @true if the control is multiline.
+ */
+ bool IsMultiLine() const { return !IsSingleLine(); }
+
+ //@{
+ /**
+ Returns the range of the current selection.
+ The end point of range is specified as the last character position of the span
+ of text, plus one.
+ If the return values @a from and @a to are the same, there is no selection.
+ */
+ virtual void GetSelection(long* from, long* to) const;
+ const wxRichTextSelection& GetSelection() const { return m_selection; }
+ wxRichTextSelection& GetSelection() { return m_selection; }
+ //@}
+
+ /**
+ Returns the text within the current selection range, if any.
+ */
+ virtual wxString GetStringSelection() const;
+
+ /**
+ Gets the current filename associated with the control.
+ */
+ wxString GetFilename() const { return m_filename; }
+
+ /**
+ Sets the current filename.
+ */
+ void SetFilename(const wxString& filename) { m_filename = filename; }
+
+ /**
+ Sets the size of the buffer beyond which layout is delayed during resizing.
+ This optimizes sizing for large buffers. The default is 20000.
+ */
+ void SetDelayedLayoutThreshold(long threshold) { m_delayedLayoutThreshold = threshold; }
+
+ /**
+ Gets the size of the buffer beyond which layout is delayed during resizing.
+ This optimizes sizing for large buffers. The default is 20000.
+ */
+ long GetDelayedLayoutThreshold() const { return m_delayedLayoutThreshold; }
+
+ /**
+ Gets the flag indicating that full layout is required.
+ */
+ bool GetFullLayoutRequired() const { return m_fullLayoutRequired; }
+
+ /**
+ Sets the flag indicating that full layout is required.
+ */
+ void SetFullLayoutRequired(bool b) { m_fullLayoutRequired = b; }
+
+ /**
+ Returns the last time full layout was performed.
+ */
+ wxLongLong GetFullLayoutTime() const { return m_fullLayoutTime; }
+
+ /**
+ Sets the last time full layout was performed.
+ */
+ void SetFullLayoutTime(wxLongLong t) { m_fullLayoutTime = t; }
+
+ /**
+ Returns the position that should be shown when full (delayed) layout is performed.
+ */
+ long GetFullLayoutSavedPosition() const { return m_fullLayoutSavedPosition; }
+
+ /**
+ Sets the position that should be shown when full (delayed) layout is performed.
+ */
+ void SetFullLayoutSavedPosition(long p) { m_fullLayoutSavedPosition = p; }
+
+ /**
+ Forces any pending layout due to delayed, partial layout when the control
+ was resized.
+ */
+ void ForceDelayedLayout();
+
+ /**
+ Sets the text (normal) cursor.
+ */
+ void SetTextCursor(const wxCursor& cursor ) { m_textCursor = cursor; }
+
+ /**
+ Returns the text (normal) cursor.
+ */
+ wxCursor GetTextCursor() const { return m_textCursor; }
+
+ /**
+ Sets the cursor to be used over URLs.
+ */
+ void SetURLCursor(const wxCursor& cursor ) { m_urlCursor = cursor; }
+
+ /**
+ Returns the cursor to be used over URLs.
+ */
+ wxCursor GetURLCursor() const { return m_urlCursor; }
+
+ /**
+ Returns @true if we are showing the caret position at the start of a line
+ instead of at the end of the previous one.
+ */
+ bool GetCaretAtLineStart() const { return m_caretAtLineStart; }
+
+ /**
+ Sets a flag to remember that we are showing the caret position at the start of a line
+ instead of at the end of the previous one.
+ */
+ void SetCaretAtLineStart(bool atStart) { m_caretAtLineStart = atStart; }
+
+ /**
+ Returns @true if we are dragging a selection.
+ */
+ bool GetDragging() const { return m_dragging; }
+
+ /**
+ Sets a flag to remember if we are dragging a selection.
+ */
+ void SetDragging(bool dragging) { m_dragging = dragging; }
+
+#if wxUSE_DRAG_AND_DROP
+ /**
+ Are we trying to start Drag'n'Drop?
+ */
+ bool GetPreDrag() const { return m_preDrag; }
+
+ /**
+ Set if we're trying to start Drag'n'Drop
+ */
+ void SetPreDrag(bool pd) { m_preDrag = pd; }
+
+ /**
+ Get the possible Drag'n'Drop start point
+ */
+ const wxPoint GetDragStartPoint() const { return m_dragStartPoint; }
+
+ /**
+ Set the possible Drag'n'Drop start point
+ */
+ void SetDragStartPoint(wxPoint sp) { m_dragStartPoint = sp; }
+
+#if wxUSE_DATETIME
+ /**
+ Get the possible Drag'n'Drop start time
+ */
+ const wxDateTime GetDragStartTime() const { return m_dragStartTime; }
+
+ /**
+ Set the possible Drag'n'Drop start time
+ */
+ void SetDragStartTime(wxDateTime st) { m_dragStartTime = st; }
+#endif // wxUSE_DATETIME
+
+#endif // wxUSE_DRAG_AND_DROP
+
+#if wxRICHTEXT_BUFFERED_PAINTING
+ //@{
+ /**
+ Returns the buffer bitmap if using buffered painting.
+ */
+ const wxBitmap& GetBufferBitmap() const { return m_bufferBitmap; }
+ wxBitmap& GetBufferBitmap() { return m_bufferBitmap; }
+ //@}
+#endif
+
+ /**
+ Returns the current context menu.
+ */
+ wxMenu* GetContextMenu() const { return m_contextMenu; }
+
+ /**
+ Sets the current context menu.
+ */
+ void SetContextMenu(wxMenu* menu);
+
+ /**
+ Returns an anchor so we know how to extend the selection.
+ It's a caret position since it's between two characters.
+ */
+ long GetSelectionAnchor() const { return m_selectionAnchor; }
+
+ /**
+ Sets an anchor so we know how to extend the selection.
+ It's a caret position since it's between two characters.
+ */
+ void SetSelectionAnchor(long anchor) { m_selectionAnchor = anchor; }
+
+ /**
+ Returns the anchor object if selecting multiple containers.
+ */
+ wxRichTextObject* GetSelectionAnchorObject() const { return m_selectionAnchorObject; }
+
+ /**
+ Sets the anchor object if selecting multiple containers.
+ */
+ void SetSelectionAnchorObject(wxRichTextObject* anchor) { m_selectionAnchorObject = anchor; }
+
+ //@{
+ /**
+ Returns an object that stores information about context menu property item(s),
+ in order to communicate between the context menu event handler and the code
+ that responds to it. The wxRichTextContextMenuPropertiesInfo stores one
+ item for each object that could respond to a property-editing event. If
+ objects are nested, several might be editable.
+ */
+ wxRichTextContextMenuPropertiesInfo& GetContextMenuPropertiesInfo() { return m_contextMenuPropertiesInfo; }
+ const wxRichTextContextMenuPropertiesInfo& GetContextMenuPropertiesInfo() const { return m_contextMenuPropertiesInfo; }
+ //@}
+
+ /**
+ Returns the wxRichTextObject object that currently has the editing focus.
+ If there are no composite objects, this will be the top-level buffer.
+ */
+ wxRichTextParagraphLayoutBox* GetFocusObject() const { return m_focusObject; }
+
+ /**
+ Sets m_focusObject without making any alterations.
+ */
+ void StoreFocusObject(wxRichTextParagraphLayoutBox* obj) { m_focusObject = obj; }
+
+ /**
+ Sets the wxRichTextObject object that currently has the editing focus.
+ */
+ bool SetFocusObject(wxRichTextParagraphLayoutBox* obj, bool setCaretPosition = true);
+
+// Operations
+
+ /**
+ Invalidates the whole buffer to trigger painting later.
+ */
+ void Invalidate() { GetBuffer().Invalidate(wxRICHTEXT_ALL); }
+
+ /**
+ Clears the buffer content, leaving a single empty paragraph. Cannot be undone.
+ */
+ virtual void Clear();
+
+ /**
+ Replaces the content in the specified range with the string specified by
+ @a value.
+ */
+ virtual void Replace(long from, long to, const wxString& value);
+
+ /**
+ Removes the content in the specified range.
+ */
+ virtual void Remove(long from, long to);
+
+#ifdef DOXYGEN
+ /**
+ Loads content into the control's buffer using the given type.
+
+ If the specified type is wxRICHTEXT_TYPE_ANY, the type is deduced from
+ the filename extension.
+
+ This function looks for a suitable wxRichTextFileHandler object.
+ */
+ bool LoadFile(const wxString& file,
+ int type = wxRICHTEXT_TYPE_ANY);
+#endif
+
+#if wxUSE_FFILE && wxUSE_STREAMS
+ /**
+ Helper function for LoadFile(). Loads content into the control's buffer using the given type.
+
+ If the specified type is wxRICHTEXT_TYPE_ANY, the type is deduced from
+ the filename extension.
+
+ This function looks for a suitable wxRichTextFileHandler object.
+ */
+ virtual bool DoLoadFile(const wxString& file, int fileType);
+#endif // wxUSE_FFILE && wxUSE_STREAMS
+
+#ifdef DOXYGEN
+ /**
+ Saves the buffer content using the given type.
+
+ If the specified type is wxRICHTEXT_TYPE_ANY, the type is deduced from
+ the filename extension.
+
+ This function looks for a suitable wxRichTextFileHandler object.
+ */
+ bool SaveFile(const wxString& file = wxEmptyString,
+ int type = wxRICHTEXT_TYPE_ANY);
+#endif
+
+#if wxUSE_FFILE && wxUSE_STREAMS
+ /**
+ Helper function for SaveFile(). Saves the buffer content using the given type.
+
+ If the specified type is wxRICHTEXT_TYPE_ANY, the type is deduced from
+ the filename extension.
+
+ This function looks for a suitable wxRichTextFileHandler object.
+ */
+ virtual bool DoSaveFile(const wxString& file = wxEmptyString,
+ int fileType = wxRICHTEXT_TYPE_ANY);
+#endif // wxUSE_FFILE && wxUSE_STREAMS
+
+ /**
+ Sets flags that change the behaviour of loading or saving.
+
+ See the documentation for each handler class to see what flags are
+ relevant for each handler.
+ */
+ void SetHandlerFlags(int flags) { GetBuffer().SetHandlerFlags(flags); }
+
+ /**
+ Returns flags that change the behaviour of loading or saving.
+ See the documentation for each handler class to see what flags are
+ relevant for each handler.
+ */
+ int GetHandlerFlags() const { return GetBuffer().GetHandlerFlags(); }
+
+ /**
+ Marks the buffer as modified.
+ */
+ virtual void MarkDirty();
+
+ /**
+ Sets the buffer's modified status to @false, and clears the buffer's command
+ history.
+ */
+ virtual void DiscardEdits();
+
+ /**
+ Sets the maximum number of characters that may be entered in a single line
+ text control. For compatibility only; currently does nothing.
+ */
+ virtual void SetMaxLength(unsigned long WXUNUSED(len)) { }
+
+ /**
+ Writes text at the current position.
+ */
+ virtual void WriteText(const wxString& text);
+
+ /**
+ Sets the insertion point to the end of the buffer and writes the text.
+ */
+ virtual void AppendText(const wxString& text);
+
+ //@{
+ /**
+ Gets the attributes at the given position.
+ This function gets the combined style - that is, the style you see on the
+ screen as a result of combining base style, paragraph style and character
+ style attributes.
+
+ To get the character or paragraph style alone, use GetUncombinedStyle().
+
+ @beginWxPerlOnly
+ In wxPerl this method is implemented as GetStyle(@a position)
+ returning a 2-element list (ok, attr).
+ @endWxPerlOnly
+ */
+ virtual bool GetStyle(long position, wxTextAttr& style);
+ virtual bool GetStyle(long position, wxRichTextAttr& style);
+ virtual bool GetStyle(long position, wxRichTextAttr& style, wxRichTextParagraphLayoutBox* container);
+ //@}
+
+ //@{
+ /**
+ Sets the attributes for the given range.
+ The end point of range is specified as the last character position of the span
+ of text, plus one.
+
+ So, for example, to set the style for a character at position 5, use the range
+ (5,6).
+ */
+ virtual bool SetStyle(long start, long end, const wxTextAttr& style);
+ virtual bool SetStyle(long start, long end, const wxRichTextAttr& style);
+ virtual bool SetStyle(const wxRichTextRange& range, const wxTextAttr& style);
+ virtual bool SetStyle(const wxRichTextRange& range, const wxRichTextAttr& style);
+ //@}
+
+ /**
+ Sets the attributes for a single object
+ */
+ virtual void SetStyle(wxRichTextObject *obj, const wxRichTextAttr& textAttr, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
+
+ //@{
+ /**
+ Gets the attributes common to the specified range.
+ Attributes that differ in value within the range will not be included
+ in @a style flags.
+
+ @beginWxPerlOnly
+ In wxPerl this method is implemented as GetStyleForRange(@a position)
+ returning a 2-element list (ok, attr).
+ @endWxPerlOnly
+ */
+ virtual bool GetStyleForRange(const wxRichTextRange& range, wxTextAttr& style);
+ virtual bool GetStyleForRange(const wxRichTextRange& range, wxRichTextAttr& style);
+ virtual bool GetStyleForRange(const wxRichTextRange& range, wxRichTextAttr& style, wxRichTextParagraphLayoutBox* container);
+ //@}
+
+ /**
+ Sets the attributes for the given range, passing flags to determine how the
+ attributes are set.
+
+ The end point of range is specified as the last character position of the span
+ of text, plus one. So, for example, to set the style for a character at
+ position 5, use the range (5,6).
+
+ @a flags may contain a bit list of the following values:
+ - wxRICHTEXT_SETSTYLE_NONE: no style flag.
+ - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this operation should be
+ undoable.
+ - wxRICHTEXT_SETSTYLE_OPTIMIZE: specifies that the style should not be applied
+ if the combined style at this point is already the style in question.
+ - wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY: specifies that the style should only be
+ applied to paragraphs, and not the content.
+ This allows content styling to be preserved independently from that
+ of e.g. a named paragraph style.
+ - wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY: specifies that the style should only be
+ applied to characters, and not the paragraph.
+ This allows content styling to be preserved independently from that
+ of e.g. a named paragraph style.
+ - wxRICHTEXT_SETSTYLE_RESET: resets (clears) the existing style before applying
+ the new style.
+ - wxRICHTEXT_SETSTYLE_REMOVE: removes the specified style. Only the style flags
+ are used in this operation.
+ */
+ virtual bool SetStyleEx(const wxRichTextRange& range, const wxRichTextAttr& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
+
+ //@{
+ /**
+ Gets the attributes at the given position.
+ This function gets the @e uncombined style - that is, the attributes associated
+ with the paragraph or character content, and not necessarily the combined
+ attributes you see on the screen.
+ To get the combined attributes, use GetStyle().
+
+ If you specify (any) paragraph attribute in @e style's flags, this function
+ will fetch the paragraph attributes.
+ Otherwise, it will return the character attributes.
+
+ @beginWxPerlOnly
+ In wxPerl this method is implemented as GetUncombinedStyle(@a position)
+ returning a 2-element list (ok, attr).
+ @endWxPerlOnly
+ */
+ virtual bool GetUncombinedStyle(long position, wxRichTextAttr& style);
+ virtual bool GetUncombinedStyle(long position, wxRichTextAttr& style, wxRichTextParagraphLayoutBox* container);
+ //@}
+
+ //@{
+ /**
+ Sets the current default style, which can be used to change how subsequently
+ inserted text is displayed.
+ */
+ virtual bool SetDefaultStyle(const wxTextAttr& style);
+ virtual bool SetDefaultStyle(const wxRichTextAttr& style);
+ //@}
+
+ /**
+ Returns the current default style, which can be used to change how subsequently
+ inserted text is displayed.
+ */
+ virtual const wxRichTextAttr& GetDefaultStyleEx() const;
+
+ //virtual const wxTextAttr& GetDefaultStyle() const;
+
+ //@{
+ /**
+ Sets the list attributes for the given range, passing flags to determine how
+ the attributes are set.
+
+ Either the style definition or the name of the style definition (in the current
+ sheet) can be passed.
+ @a flags is a bit list of the following:
+ - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
+ - wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from
+ @a startFrom, otherwise existing attributes are used.
+ - wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used
+ as the level for all paragraphs, otherwise the current indentation will be used.
+
+ @see NumberList(), PromoteList(), ClearListStyle().
+ */
+ virtual bool SetListStyle(const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
+ virtual bool SetListStyle(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
+ //@}
+
+ /**
+ Clears the list style from the given range, clearing list-related attributes
+ and applying any named paragraph style associated with each paragraph.
+
+ @a flags is a bit list of the following:
+ - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
+
+ @see SetListStyle(), PromoteList(), NumberList().
+ */
+ virtual bool ClearListStyle(const wxRichTextRange& range, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
+
+ //@{
+ /**
+ Numbers the paragraphs in the given range.
+ Pass flags to determine how the attributes are set.
+
+ Either the style definition or the name of the style definition (in the current
+ sheet) can be passed.
+
+ @a flags is a bit list of the following:
+ - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
+ - wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from
+ @a startFrom, otherwise existing attributes are used.
+ - wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used
+ as the level for all paragraphs, otherwise the current indentation will be used.
+
+ @see SetListStyle(), PromoteList(), ClearListStyle().
+ */
+ virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
+ virtual bool NumberList(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
+ //@}
+
+ //@{
+ /**
+ Promotes or demotes the paragraphs in the given range.
+ A positive @a promoteBy produces a smaller indent, and a negative number
+ produces a larger indent. Pass flags to determine how the attributes are set.
+ Either the style definition or the name of the style definition (in the current
+ sheet) can be passed.
+
+ @a flags is a bit list of the following:
+ - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
+ - wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from
+ @a startFrom, otherwise existing attributes are used.
+ - wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used
+ as the level for all paragraphs, otherwise the current indentation will be used.
+
+ @see SetListStyle(), @see SetListStyle(), ClearListStyle().
+ */
+ virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1);
+ virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1);
+ //@}
+
+ /**
+ Sets the properties for the given range, passing flags to determine how the
+ attributes are set. You can merge properties or replace them.
+
+ The end point of range is specified as the last character position of the span
+ of text, plus one. So, for example, to set the properties for a character at
+ position 5, use the range (5,6).
+
+ @a flags may contain a bit list of the following values:
+ - wxRICHTEXT_SETSPROPERTIES_NONE: no flag.
+ - wxRICHTEXT_SETPROPERTIES_WITH_UNDO: specifies that this operation should be
+ undoable.
+ - wxRICHTEXT_SETPROPERTIES_PARAGRAPHS_ONLY: specifies that the properties should only be
+ applied to paragraphs, and not the content.
+ - wxRICHTEXT_SETPROPERTIES_CHARACTERS_ONLY: specifies that the properties should only be
+ applied to characters, and not the paragraph.
+ - wxRICHTEXT_SETPROPERTIES_RESET: resets (clears) the existing properties before applying
+ the new properties.
+ - wxRICHTEXT_SETPROPERTIES_REMOVE: removes the specified properties.
+ */
+ virtual bool SetProperties(const wxRichTextRange& range, const wxRichTextProperties& properties, int flags = wxRICHTEXT_SETPROPERTIES_WITH_UNDO);
+
+ /**
+ Deletes the content within the given range.
+ */
+ virtual bool Delete(const wxRichTextRange& range);
+
+ /**
+ Translates from column and line number to position.
+ */
+ virtual long XYToPosition(long x, long y) const;
+
+ /**
+ Converts a text position to zero-based column and line numbers.
+ */
+ virtual bool PositionToXY(long pos, long *x, long *y) const;
+
+ /**
+ Scrolls the buffer so that the given position is in view.
+ */
+ virtual void ShowPosition(long pos);
+
+ //@{
+ /**
+ Finds the character at the given position in pixels.
+ @a pt is in device coords (not adjusted for the client area origin nor for
+ scrolling).
+ */
+ virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const;
+ virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
+ wxTextCoord *col,
+ wxTextCoord *row) const;
+
+ /**
+ Finds the container at the given point, which is in screen coordinates.
+ */
+ wxRichTextParagraphLayoutBox* FindContainerAtPoint(const wxPoint pt, long& position, int& hit, wxRichTextObject* hitObj, int flags = 0);
+ //@}
+
+#if wxUSE_DRAG_AND_DROP
+ /**
+ Does the 'drop' of Drag'n'Drop.
+ */
+ void OnDrop(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxDragResult def, wxDataObject* DataObj);
+#endif
+
+// Clipboard operations
+
+ /**
+ Copies the selected content (if any) to the clipboard.
+ */
+ virtual void Copy();
+
+ /**
+ Copies the selected content (if any) to the clipboard and deletes the selection.
+ This is undoable.
+ */
+ virtual void Cut();
+
+ /**
+ Pastes content from the clipboard to the buffer.
+ */
+ virtual void Paste();
+
+ /**
+ Deletes the content in the selection, if any. This is undoable.
+ */
+ virtual void DeleteSelection();
+
+ /**
+ Returns @true if selected content can be copied to the clipboard.
+ */
+ virtual bool CanCopy() const;
+
+ /**
+ Returns @true if selected content can be copied to the clipboard and deleted.
+ */
+ virtual bool CanCut() const;
+
+ /**
+ Returns @true if the clipboard content can be pasted to the buffer.
+ */
+ virtual bool CanPaste() const;
+
+ /**
+ Returns @true if selected content can be deleted.
+ */
+ virtual bool CanDeleteSelection() const;
+
+ /**
+ Undoes the command at the top of the command history, if there is one.
+ */
+ virtual void Undo();
+
+ /**
+ Redoes the current command.
+ */
+ virtual void Redo();
+
+ /**
+ Returns @true if there is a command in the command history that can be undone.
+ */
+ virtual bool CanUndo() const;
+
+ /**
+ Returns @true if there is a command in the command history that can be redone.
+ */
+ virtual bool CanRedo() const;
+
+ /**
+ Sets the insertion point and causes the current editing style to be taken from
+ the new position (unlike wxRichTextCtrl::SetCaretPosition).
+ */
+ virtual void SetInsertionPoint(long pos);
+
+ /**
+ Sets the insertion point to the end of the text control.
+ */
+ virtual void SetInsertionPointEnd();
+
+ /**
+ Returns the current insertion point.
+ */
+ virtual long GetInsertionPoint() const;
+
+ /**
+ Returns the last position in the buffer.
+ */
+ virtual wxTextPos GetLastPosition() const;
+
+ //@{
+ /**
+ Sets the selection to the given range.
+ The end point of range is specified as the last character position of the span
+ of text, plus one.
+
+ So, for example, to set the selection for a character at position 5, use the
+ range (5,6).
+ */
+ virtual void SetSelection(long from, long to);
+ void SetSelection(const wxRichTextSelection& sel) { m_selection = sel; }
+ //@}
+
+ /**
+ Makes the control editable, or not.
+ */
+ virtual void SetEditable(bool editable);
+
+ /**
+ Returns @true if there is a selection and the object containing the selection
+ was the same as the current focus object.
+ */
+ virtual bool HasSelection() const;
+
+ /**
+ Returns @true if there was a selection, whether or not the current focus object
+ is the same as the selection's container object.
+ */
+ virtual bool HasUnfocusedSelection() const;
+
+ //@{
+ /**
+ Write a bitmap or image at the current insertion point.
+ Supply an optional type to use for internal and file storage of the raw data.
+ */
+ virtual bool WriteImage(const wxImage& image, wxBitmapType bitmapType = wxBITMAP_TYPE_PNG,
+ const wxRichTextAttr& textAttr = wxRichTextAttr());
+
+ virtual bool WriteImage(const wxBitmap& bitmap, wxBitmapType bitmapType = wxBITMAP_TYPE_PNG,
+ const wxRichTextAttr& textAttr = wxRichTextAttr());
+ //@}
+
+ /**
+ Loads an image from a file and writes it at the current insertion point.
+ */
+ virtual bool WriteImage(const wxString& filename, wxBitmapType bitmapType,
+ const wxRichTextAttr& textAttr = wxRichTextAttr());
+
+ /**
+ Writes an image block at the current insertion point.
+ */
+ virtual bool WriteImage(const wxRichTextImageBlock& imageBlock,
+ const wxRichTextAttr& textAttr = wxRichTextAttr());
+
+ /**
+ Write a text box at the current insertion point, returning the text box.
+ You can then call SetFocusObject() to set the focus to the new object.
+ */
+ virtual wxRichTextBox* WriteTextBox(const wxRichTextAttr& textAttr = wxRichTextAttr());
+
+ /**
+ Writes a field at the current insertion point.
+
+ @param fieldType
+ The field type, matching an existing field type definition.
+ @param properties
+ Extra data for the field.
+ @param textAttr
+ Optional attributes.
+
+ @see wxRichTextField, wxRichTextFieldType, wxRichTextFieldTypeStandard
+ */
+ virtual wxRichTextField* WriteField(const wxString& fieldType, const wxRichTextProperties& properties,
+ const wxRichTextAttr& textAttr = wxRichTextAttr());
+
+ /**
+ Write a table at the current insertion point, returning the table.
+ You can then call SetFocusObject() to set the focus to the new object.
+ */
+ virtual wxRichTextTable* WriteTable(int rows, int cols, const wxRichTextAttr& tableAttr = wxRichTextAttr(), const wxRichTextAttr& cellAttr = wxRichTextAttr());
+
+ /**
+ Inserts a new paragraph at the current insertion point. @see LineBreak().
+ */
+ virtual bool Newline();
+
+ /**
+ Inserts a line break at the current insertion point.
+
+ A line break forces wrapping within a paragraph, and can be introduced by
+ using this function, by appending the wxChar value @b wxRichTextLineBreakChar
+ to text content, or by typing Shift-Return.
+ */
+ virtual bool LineBreak();
+
+ /**
+ Sets the basic (overall) style.
+
+ This is the style of the whole buffer before further styles are applied,
+ unlike the default style, which only affects the style currently being
+ applied (for example, setting the default style to bold will cause
+ subsequently inserted text to be bold).
+ */
+ virtual void SetBasicStyle(const wxRichTextAttr& style) { GetBuffer().SetBasicStyle(style); }
+
+ /**
+ Gets the basic (overall) style.
+
+ This is the style of the whole buffer before further styles are applied,
+ unlike the default style, which only affects the style currently being
+ applied (for example, setting the default style to bold will cause
+ subsequently inserted text to be bold).
+ */
+ virtual const wxRichTextAttr& GetBasicStyle() const { return GetBuffer().GetBasicStyle(); }
+
+ /**
+ Begins applying a style.
+ */
+ virtual bool BeginStyle(const wxRichTextAttr& style) { return GetBuffer().BeginStyle(style); }
+
+ /**
+ Ends the current style.
+ */
+ virtual bool EndStyle() { return GetBuffer().EndStyle(); }
+
+ /**
+ Ends application of all styles in the current style stack.
+ */
+ virtual bool EndAllStyles() { return GetBuffer().EndAllStyles(); }
+
+ /**
+ Begins using bold.
+ */
+ bool BeginBold() { return GetBuffer().BeginBold(); }
+
+ /**
+ Ends using bold.
+ */
+ bool EndBold() { return GetBuffer().EndBold(); }
+
+ /**
+ Begins using italic.
+ */
+ bool BeginItalic() { return GetBuffer().BeginItalic(); }
+
+ /**
+ Ends using italic.
+ */
+ bool EndItalic() { return GetBuffer().EndItalic(); }
+
+ /**
+ Begins using underlining.
+ */
+ bool BeginUnderline() { return GetBuffer().BeginUnderline(); }
+
+ /**
+ End applying underlining.
+ */
+ bool EndUnderline() { return GetBuffer().EndUnderline(); }
+
+ /**
+ Begins using the given point size.
+ */
+ bool BeginFontSize(int pointSize) { return GetBuffer().BeginFontSize(pointSize); }
+
+ /**
+ Ends using a point size.
+ */
+ bool EndFontSize() { return GetBuffer().EndFontSize(); }
+
+ /**
+ Begins using this font.
+ */
+ bool BeginFont(const wxFont& font) { return GetBuffer().BeginFont(font); }
+
+ /**
+ Ends using a font.
+ */
+ bool EndFont() { return GetBuffer().EndFont(); }
+
+ /**
+ Begins using this colour.
+ */
+ bool BeginTextColour(const wxColour& colour) { return GetBuffer().BeginTextColour(colour); }
+
+ /**
+ Ends applying a text colour.
+ */
+ bool EndTextColour() { return GetBuffer().EndTextColour(); }
+
+ /**
+ Begins using alignment.
+ For alignment values, see wxTextAttr.
+ */
+ bool BeginAlignment(wxTextAttrAlignment alignment) { return GetBuffer().BeginAlignment(alignment); }
+
+ /**
+ Ends alignment.
+ */
+ bool EndAlignment() { return GetBuffer().EndAlignment(); }
+
+ /**
+ Begins applying a left indent and subindent in tenths of a millimetre.
+ The subindent is an offset from the left edge of the paragraph, and is
+ used for all but the first line in a paragraph. A positive value will
+ cause the first line to appear to the left of the subsequent lines, and
+ a negative value will cause the first line to be indented to the right
+ of the subsequent lines.
+
+ wxRichTextBuffer uses indentation to render a bulleted item. The
+ content of the paragraph, including the first line, starts at the
+ @a leftIndent plus the @a leftSubIndent.
+
+ @param leftIndent
+ The distance between the margin and the bullet.
+ @param leftSubIndent
+ The distance between the left edge of the bullet and the left edge
+ of the actual paragraph.
+ */
+ bool BeginLeftIndent(int leftIndent, int leftSubIndent = 0) { return GetBuffer().BeginLeftIndent(leftIndent, leftSubIndent); }
+
+ /**
+ Ends left indent.
+ */
+ bool EndLeftIndent() { return GetBuffer().EndLeftIndent(); }
+
+ /**
+ Begins a right indent, specified in tenths of a millimetre.
+ */
+ bool BeginRightIndent(int rightIndent) { return GetBuffer().BeginRightIndent(rightIndent); }
+
+ /**
+ Ends right indent.
+ */
+ bool EndRightIndent() { return GetBuffer().EndRightIndent(); }
+
+ /**
+ Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing
+ in tenths of a millimetre.
+ */
+ bool BeginParagraphSpacing(int before, int after) { return GetBuffer().BeginParagraphSpacing(before, after); }
+
+ /**
+ Ends paragraph spacing.
+ */
+ bool EndParagraphSpacing() { return GetBuffer().EndParagraphSpacing(); }
+
+ /**
+ Begins appling line spacing. @e spacing is a multiple, where 10 means
+ single-spacing, 15 means 1.5 spacing, and 20 means double spacing.
+
+ The ::wxTextAttrLineSpacing constants are defined for convenience.
+ */
+ bool BeginLineSpacing(int lineSpacing) { return GetBuffer().BeginLineSpacing(lineSpacing); }
+
+ /**
+ Ends line spacing.
+ */
+ bool EndLineSpacing() { return GetBuffer().EndLineSpacing(); }
+
+ /**
+ Begins a numbered bullet.
+
+ This call will be needed for each item in the list, and the
+ application should take care of incrementing the numbering.
+
+ @a bulletNumber is a number, usually starting with 1.
+ @a leftIndent and @a leftSubIndent are values in tenths of a millimetre.
+ @a bulletStyle is a bitlist of the ::wxTextAttrBulletStyle values.
+
+ wxRichTextBuffer uses indentation to render a bulleted item.
+ The left indent is the distance between the margin and the bullet.
+ The content of the paragraph, including the first line, starts
+ at leftMargin + leftSubIndent.
+ So the distance between the left edge of the bullet and the
+ left of the actual paragraph is leftSubIndent.
+ */
+ bool BeginNumberedBullet(int bulletNumber, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_ARABIC|wxTEXT_ATTR_BULLET_STYLE_PERIOD)
+ { return GetBuffer().BeginNumberedBullet(bulletNumber, leftIndent, leftSubIndent, bulletStyle); }
+
+ /**
+ Ends application of a numbered bullet.
+ */
+ bool EndNumberedBullet() { return GetBuffer().EndNumberedBullet(); }
+
+ /**
+ Begins applying a symbol bullet, using a character from the current font.
+ See BeginNumberedBullet() for an explanation of how indentation is used
+ to render the bulleted paragraph.
+ */
+ bool BeginSymbolBullet(const wxString& symbol, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL)
+ { return GetBuffer().BeginSymbolBullet(symbol, leftIndent, leftSubIndent, bulletStyle); }
+
+ /**
+ Ends applying a symbol bullet.
+ */
+ bool EndSymbolBullet() { return GetBuffer().EndSymbolBullet(); }
+
+ /**
+ Begins applying a symbol bullet.
+ */
+ bool BeginStandardBullet(const wxString& bulletName, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_STANDARD)
+ { return GetBuffer().BeginStandardBullet(bulletName, leftIndent, leftSubIndent, bulletStyle); }
+
+ /**
+ Begins applying a standard bullet.
+ */
+ bool EndStandardBullet() { return GetBuffer().EndStandardBullet(); }
+
+ /**
+ Begins using the named character style.
+ */
+ bool BeginCharacterStyle(const wxString& characterStyle) { return GetBuffer().BeginCharacterStyle(characterStyle); }
+
+ /**
+ Ends application of a named character style.
+ */
+ bool EndCharacterStyle() { return GetBuffer().EndCharacterStyle(); }
+
+ /**
+ Begins applying the named paragraph style.
+ */
+ bool BeginParagraphStyle(const wxString& paragraphStyle) { return GetBuffer().BeginParagraphStyle(paragraphStyle); }
+
+ /**
+ Ends application of a named paragraph style.
+ */
+ bool EndParagraphStyle() { return GetBuffer().EndParagraphStyle(); }
+
+ /**
+ Begins using a specified list style.
+ Optionally, you can also pass a level and a number.
+ */
+ bool BeginListStyle(const wxString& listStyle, int level = 1, int number = 1) { return GetBuffer().BeginListStyle(listStyle, level, number); }
+
+ /**
+ Ends using a specified list style.
+ */
+ bool EndListStyle() { return GetBuffer().EndListStyle(); }
+
+ /**
+ Begins applying wxTEXT_ATTR_URL to the content.
+
+ Pass a URL and optionally, a character style to apply, since it is common
+ to mark a URL with a familiar style such as blue text with underlining.
+ */
+ bool BeginURL(const wxString& url, const wxString& characterStyle = wxEmptyString) { return GetBuffer().BeginURL(url, characterStyle); }
+
+ /**
+ Ends applying a URL.
+ */
+ bool EndURL() { return GetBuffer().EndURL(); }
+
+ /**
+ Sets the default style to the style under the cursor.
+ */
+ bool SetDefaultStyleToCursorStyle();
+
+ /**
+ Cancels any selection.
+ */
+ virtual void SelectNone();
+
+ /**
+ Selects the word at the given character position.
+ */
+ virtual bool SelectWord(long position);
+
+ /**
+ Returns the selection range in character positions. -1, -1 means no selection.
+
+ The range is in API convention, i.e. a single character selection is denoted
+ by (n, n+1)
+ */
+ wxRichTextRange GetSelectionRange() const;
+
+ /**
+ Sets the selection to the given range.
+ The end point of range is specified as the last character position of the span
+ of text, plus one.
+
+ So, for example, to set the selection for a character at position 5, use the
+ range (5,6).
+ */
+ void SetSelectionRange(const wxRichTextRange& range);
+
+ /**
+ Returns the selection range in character positions. -2, -2 means no selection
+ -1, -1 means select everything.
+ The range is in internal format, i.e. a single character selection is denoted
+ by (n, n)
+ */
+ wxRichTextRange GetInternalSelectionRange() const { return m_selection.GetRange(); }
+
+ /**
+ Sets the selection range in character positions. -2, -2 means no selection
+ -1, -1 means select everything.
+ The range is in internal format, i.e. a single character selection is denoted
+ by (n, n)
+ */
+ void SetInternalSelectionRange(const wxRichTextRange& range) { m_selection.Set(range, GetFocusObject()); }
+
+ /**
+ Adds a new paragraph of text to the end of the buffer.
+ */
+ virtual wxRichTextRange AddParagraph(const wxString& text);
+
+ /**
+ Adds an image to the control's buffer.
+ */
+ virtual wxRichTextRange AddImage(const wxImage& image);
+
+ /**
+ Lays out the buffer, which must be done before certain operations, such as
+ setting the caret position.
+ This function should not normally be required by the application.
+ */
+ virtual bool LayoutContent(bool onlyVisibleRect = false);
+
+ /**
+ Move the caret to the given character position.
+
+ Please note that this does not update the current editing style
+ from the new position; to do that, call wxRichTextCtrl::SetInsertionPoint instead.
+ */
+ virtual bool MoveCaret(long pos, bool showAtLineStart = false, wxRichTextParagraphLayoutBox* container = NULL);
+
+ /**
+ Moves right.
+ */
+ virtual bool MoveRight(int noPositions = 1, int flags = 0);
+
+ /**
+ Moves left.
+ */
+ virtual bool MoveLeft(int noPositions = 1, int flags = 0);
+
+ /**
+ Moves to the start of the paragraph.
+ */
+ virtual bool MoveUp(int noLines = 1, int flags = 0);
+
+ /**
+ Moves the caret down.
+ */
+ virtual bool MoveDown(int noLines = 1, int flags = 0);
+
+ /**
+ Moves to the end of the line.
+ */
+ virtual bool MoveToLineEnd(int flags = 0);
+
+ /**
+ Moves to the start of the line.
+ */
+ virtual bool MoveToLineStart(int flags = 0);
+
+ /**
+ Moves to the end of the paragraph.
+ */
+ virtual bool MoveToParagraphEnd(int flags = 0);
+
+ /**
+ Moves to the start of the paragraph.
+ */
+ virtual bool MoveToParagraphStart(int flags = 0);
+
+ /**
+ Moves to the start of the buffer.
+ */
+ virtual bool MoveHome(int flags = 0);
+
+ /**
+ Moves to the end of the buffer.
+ */
+ virtual bool MoveEnd(int flags = 0);
+
+ /**
+ Moves one or more pages up.
+ */
+ virtual bool PageUp(int noPages = 1, int flags = 0);
+
+ /**
+ Moves one or more pages down.
+ */
+ virtual bool PageDown(int noPages = 1, int flags = 0);
+
+ /**
+ Moves a number of words to the left.
+ */
+ virtual bool WordLeft(int noPages = 1, int flags = 0);
+
+ /**
+ Move a nuber of words to the right.
+ */
+ virtual bool WordRight(int noPages = 1, int flags = 0);
+
+ //@{
+ /**
+ Returns the buffer associated with the control.
+ */
+ wxRichTextBuffer& GetBuffer() { return m_buffer; }
+ const wxRichTextBuffer& GetBuffer() const { return m_buffer; }
+ //@}
+
+ /**
+ Starts batching undo history for commands.
+ */
+ virtual bool BeginBatchUndo(const wxString& cmdName) { return m_buffer.BeginBatchUndo(cmdName); }
+
+ /**
+ Ends batching undo command history.
+ */
+ virtual bool EndBatchUndo() { return m_buffer.EndBatchUndo(); }
+
+ /**
+ Returns @true if undo commands are being batched.
+ */
+ virtual bool BatchingUndo() const { return m_buffer.BatchingUndo(); }
+
+ /**
+ Starts suppressing undo history for commands.
+ */
+ virtual bool BeginSuppressUndo() { return m_buffer.BeginSuppressUndo(); }
+
+ /**
+ Ends suppressing undo command history.
+ */
+ virtual bool EndSuppressUndo() { return m_buffer.EndSuppressUndo(); }
+
+ /**
+ Returns @true if undo history suppression is on.
+ */
+ virtual bool SuppressingUndo() const { return m_buffer.SuppressingUndo(); }
+
+ /**
+ Test if this whole range has character attributes of the specified kind.
+ If any of the attributes are different within the range, the test fails.
+
+ You can use this to implement, for example, bold button updating.
+ @a style must have flags indicating which attributes are of interest.
+ */
+ virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const
+ {
+ return GetFocusObject()->HasCharacterAttributes(range.ToInternal(), style);
+ }
+
+ /**
+ Test if this whole range has paragraph attributes of the specified kind.
+ If any of the attributes are different within the range, the test fails.
+ You can use this to implement, for example, centering button updating.
+ @a style must have flags indicating which attributes are of interest.
+ */
+ virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const
+ {
+ return GetFocusObject()->HasParagraphAttributes(range.ToInternal(), style);
+ }
+
+ /**
+ Returns @true if all of the selection, or the content at the caret position, is bold.
+ */
+ virtual bool IsSelectionBold();
+
+ /**
+ Returns @true if all of the selection, or the content at the caret position, is italic.
+ */
+ virtual bool IsSelectionItalics();
+
+ /**
+ Returns @true if all of the selection, or the content at the caret position, is underlined.
+ */
+ virtual bool IsSelectionUnderlined();
+
+ /**
+ Returns @true if all of the selection, or the content at the current caret position, has the supplied wxTextAttrEffects flag(s).
+ */
+ virtual bool DoesSelectionHaveTextEffectFlag(int flag);
+
+ /**
+ Returns @true if all of the selection, or the content at the caret position, is aligned according to the specified flag.
+ */
+ virtual bool IsSelectionAligned(wxTextAttrAlignment alignment);
+
+ /**
+ Apples bold to the selection or default style (undoable).
+ */
+ virtual bool ApplyBoldToSelection();
+
+ /**
+ Applies italic to the selection or default style (undoable).
+ */
+ virtual bool ApplyItalicToSelection();
+
+ /**
+ Applies underline to the selection or default style (undoable).
+ */
+ virtual bool ApplyUnderlineToSelection();
+
+ /**
+ Applies one or more wxTextAttrEffects flags to the selection (undoable).
+ If there is no selection, it is applied to the default style.
+ */
+ virtual bool ApplyTextEffectToSelection(int flags);
+
+ /**
+ Applies the given alignment to the selection or the default style (undoable).
+ For alignment values, see wxTextAttr.
+ */
+ virtual bool ApplyAlignmentToSelection(wxTextAttrAlignment alignment);
+
+ /**
+ Applies the style sheet to the buffer, matching paragraph styles in the sheet
+ against named styles in the buffer.
+
+ This might be useful if the styles have changed.
+ If @a sheet is @NULL, the sheet set with SetStyleSheet() is used.
+ Currently this applies paragraph styles only.
+ */
+ virtual bool ApplyStyle(wxRichTextStyleDefinition* def);
+
+ /**
+ Sets the style sheet associated with the control.
+ A style sheet allows named character and paragraph styles to be applied.
+ */
+ void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { GetBuffer().SetStyleSheet(styleSheet); }
+
+ /**
+ Returns the style sheet associated with the control, if any.
+ A style sheet allows named character and paragraph styles to be applied.
+ */
+ wxRichTextStyleSheet* GetStyleSheet() const { return GetBuffer().GetStyleSheet(); }
+
+ /**
+ Push the style sheet to top of stack.
+ */
+ bool PushStyleSheet(wxRichTextStyleSheet* styleSheet) { return GetBuffer().PushStyleSheet(styleSheet); }
+
+ /**
+ Pops the style sheet from top of stack.
+ */
+ wxRichTextStyleSheet* PopStyleSheet() { return GetBuffer().PopStyleSheet(); }
+
+ /**
+ Applies the style sheet to the buffer, for example if the styles have changed.
+ */
+ bool ApplyStyleSheet(wxRichTextStyleSheet* styleSheet = NULL);
+
+ /**
+ Shows the given context menu, optionally adding appropriate property-editing commands for the current position in the object hierarchy.
+ */
+ virtual bool ShowContextMenu(wxMenu* menu, const wxPoint& pt, bool addPropertyCommands = true);
+
+ /**
+ Prepares the context menu, optionally adding appropriate property-editing commands.
+ Returns the number of property commands added.
+ */
+ virtual int PrepareContextMenu(wxMenu* menu, const wxPoint& pt, bool addPropertyCommands = true);
+
+ /**
+ Returns @true if we can edit the object's properties via a GUI.
+ */
+ virtual bool CanEditProperties(wxRichTextObject* obj) const { return obj->CanEditProperties(); }
+
+ /**
+ Edits the object's properties via a GUI.
+ */
+ virtual bool EditProperties(wxRichTextObject* obj, wxWindow* parent) { return obj->EditProperties(parent, & GetBuffer()); }
+
+ /**
+ Gets the object's properties menu label.
+ */
+ virtual wxString GetPropertiesMenuLabel(wxRichTextObject* obj) { return obj->GetPropertiesMenuLabel(); }
+
+ /**
+ Prepares the content just before insertion (or after buffer reset). Called by the same function in wxRichTextBuffer.
+ Currently is only called if undo mode is on.
+ */
+ virtual void PrepareContent(wxRichTextParagraphLayoutBox& WXUNUSED(container)) {}
+
+ /**
+ Can we delete this range?
+ Sends an event to the control.
+ */
+ virtual bool CanDeleteRange(wxRichTextParagraphLayoutBox& container, const wxRichTextRange& range) const;
+
+ /**
+ Can we insert content at this position?
+ Sends an event to the control.
+ */
+ virtual bool CanInsertContent(wxRichTextParagraphLayoutBox& container, long pos) const;
+
+ /**
+ Enable or disable the vertical scrollbar.
+ */
+ virtual void EnableVerticalScrollbar(bool enable);
+
+ /**
+ Returns @true if the vertical scrollbar is enabled.
+ */
+ virtual bool GetVerticalScrollbarEnabled() const { return m_verticalScrollbarEnabled; }
+
+ /**
+ Sets the scale factor for displaying fonts, for example for more comfortable
+ editing.
+ */
+ void SetFontScale(double fontScale, bool refresh = false);
+
+ /**
+ Returns the scale factor for displaying fonts, for example for more comfortable
+ editing.
+ */
+ double GetFontScale() const { return GetBuffer().GetFontScale(); }
+
+ /**
+ Sets the scale factor for displaying certain dimensions such as indentation and
+ inter-paragraph spacing. This can be useful when editing in a small control
+ where you still want legible text, but a minimum of wasted white space.
+ */
+ void SetDimensionScale(double dimScale, bool refresh = false);
+
+ /**
+ Returns the scale factor for displaying certain dimensions such as indentation
+ and inter-paragraph spacing.
+ */
+ double GetDimensionScale() const { return GetBuffer().GetDimensionScale(); }
+
+ /**
+ Sets an overall scale factor for displaying and editing the content.
+ */
+ void SetScale(double scale, bool refresh = false);
+
+ /**
+ Returns an overall scale factor for displaying and editing the content.
+ */
+ double GetScale() const { return m_scale; }
+
+ /**
+ Returns an unscaled point.
+ */
+ wxPoint GetUnscaledPoint(const wxPoint& pt) const;
+
+ /**
+ Returns a scaled point.
+ */
+ wxPoint GetScaledPoint(const wxPoint& pt) const;
+
+ /**
+ Returns an unscaled size.
+ */
+ wxSize GetUnscaledSize(const wxSize& sz) const;
+
+ /**
+ Returns a scaled size.
+ */
+ wxSize GetScaledSize(const wxSize& sz) const;
+
+ /**
+ Returns an unscaled rectangle.
+ */
+ wxRect GetUnscaledRect(const wxRect& rect) const;
+
+ /**
+ Returns a scaled rectangle.
+ */
+ wxRect GetScaledRect(const wxRect& rect) const;
+
+ /**
+ Returns @true if this control can use virtual attributes and virtual text.
+ The default is @false.
+ */
+ bool GetVirtualAttributesEnabled() const { return m_useVirtualAttributes; }
+
+ /**
+ Pass @true to let the control use virtual attributes.
+ The default is @false.
+ */
+ void EnableVirtualAttributes(bool b) { m_useVirtualAttributes = b; }
+
+// Command handlers
+
+ /**
+ Sends the event to the control.
+ */
+ void Command(wxCommandEvent& event);
+
+ /**
+ Loads the first dropped file.
+ */
+ void OnDropFiles(wxDropFilesEvent& event);
+
+ void OnCaptureLost(wxMouseCaptureLostEvent& event);
+ void OnSysColourChanged(wxSysColourChangedEvent& event);
+
+ /**
+ Standard handler for the wxID_CUT command.
+ */
+ void OnCut(wxCommandEvent& event);
+
+ /**
+ Standard handler for the wxID_COPY command.
+ */
+ void OnCopy(wxCommandEvent& event);
+
+ /**
+ Standard handler for the wxID_PASTE command.
+ */
+ void OnPaste(wxCommandEvent& event);
+
+ /**
+ Standard handler for the wxID_UNDO command.
+ */
+ void OnUndo(wxCommandEvent& event);
+
+ /**
+ Standard handler for the wxID_REDO command.
+ */
+ void OnRedo(wxCommandEvent& event);
+
+ /**
+ Standard handler for the wxID_SELECTALL command.
+ */
+ void OnSelectAll(wxCommandEvent& event);
+
+ /**
+ Standard handler for property commands.
+ */
+ void OnProperties(wxCommandEvent& event);
+
+ /**
+ Standard handler for the wxID_CLEAR command.
+ */
+ void OnClear(wxCommandEvent& event);
+
+ /**
+ Standard update handler for the wxID_CUT command.
+ */
+ void OnUpdateCut(wxUpdateUIEvent& event);
+
+ /**
+ Standard update handler for the wxID_COPY command.
+ */
+ void OnUpdateCopy(wxUpdateUIEvent& event);
+
+ /**
+ Standard update handler for the wxID_PASTE command.
+ */
+ void OnUpdatePaste(wxUpdateUIEvent& event);
+
+ /**
+ Standard update handler for the wxID_UNDO command.
+ */
+ void OnUpdateUndo(wxUpdateUIEvent& event);
+
+ /**
+ Standard update handler for the wxID_REDO command.
+ */
+ void OnUpdateRedo(wxUpdateUIEvent& event);
+
+ /**
+ Standard update handler for the wxID_SELECTALL command.
+ */
+ void OnUpdateSelectAll(wxUpdateUIEvent& event);
+
+ /**
+ Standard update handler for property commands.
+ */
+
+ void OnUpdateProperties(wxUpdateUIEvent& event);
+
+ /**
+ Standard update handler for the wxID_CLEAR command.
+ */
+ void OnUpdateClear(wxUpdateUIEvent& event);
+
+ /**
+ Shows a standard context menu with undo, redo, cut, copy, paste, clear, and
+ select all commands.
+ */
+ void OnContextMenu(wxContextMenuEvent& event);
+
+// Event handlers
+
+ // Painting
+ void OnPaint(wxPaintEvent& event);
+ void OnEraseBackground(wxEraseEvent& event);
+
+ // Left-click
+ void OnLeftClick(wxMouseEvent& event);
+
+ // Left-up
+ void OnLeftUp(wxMouseEvent& event);
+
+ // Motion
+ void OnMoveMouse(wxMouseEvent& event);
+
+ // Left-double-click
+ void OnLeftDClick(wxMouseEvent& event);
+
+ // Middle-click
+ void OnMiddleClick(wxMouseEvent& event);
+
+ // Right-click
+ void OnRightClick(wxMouseEvent& event);
+
+ // Key press
+ void OnChar(wxKeyEvent& event);
+
+ // Sizing
+ void OnSize(wxSizeEvent& event);
+
+ // Setting/losing focus
+ void OnSetFocus(wxFocusEvent& event);
+ void OnKillFocus(wxFocusEvent& event);
+
+ // Idle-time processing
+ void OnIdle(wxIdleEvent& event);
+
+ // Scrolling
+ void OnScroll(wxScrollWinEvent& event);
+
+ /**
+ Sets the font, and also the basic and default attributes
+ (see wxRichTextCtrl::SetDefaultStyle).
+ */
+ virtual bool SetFont(const wxFont& font);
+
+ /**
+ A helper function setting up scrollbars, for example after a resize.
+ */
+ virtual void SetupScrollbars(bool atTop = false);
+
+ /**
+ Helper function implementing keyboard navigation.
+ */
+ virtual bool KeyboardNavigate(int keyCode, int flags);
+
+ /**
+ Paints the background.
+ */
+ virtual void PaintBackground(wxDC& dc);
+
+ /**
+ Other user defined painting after everything else (i.e. all text) is painted.
+
+ @since 2.9.1
+ */
+ virtual void PaintAboveContent(wxDC& WXUNUSED(dc)) {}
+
+#if wxRICHTEXT_BUFFERED_PAINTING
+ /**
+ Recreates the buffer bitmap if necessary.
+ */
+ virtual bool RecreateBuffer(const wxSize& size = wxDefaultSize);
+#endif
+
+ // Write text
+ virtual void DoWriteText(const wxString& value, int flags = 0);
+
+ // Should we inherit colours?
+ virtual bool ShouldInheritColours() const { return false; }
+
+ /**
+ Internal function to position the visible caret according to the current caret
+ position.
+ */
+ virtual void PositionCaret(wxRichTextParagraphLayoutBox* container = NULL);
+
+ /**
+ Helper function for extending the selection, returning @true if the selection
+ was changed. Selections are in caret positions.
+ */
+ virtual bool ExtendSelection(long oldPosition, long newPosition, int flags);
+
+ /**
+ Scrolls @a position into view. This function takes a caret position.
+ */
+ virtual bool ScrollIntoView(long position, int keyCode);
+
+ /**
+ Refreshes the area affected by a selection change.
+ */
+ bool RefreshForSelectionChange(const wxRichTextSelection& oldSelection, const wxRichTextSelection& newSelection);
+
+ /**
+ Sets the caret position.
+
+ The caret position is the character position just before the caret.
+ A value of -1 means the caret is at the start of the buffer.
+ Please note that this does not update the current editing style
+ from the new position or cause the actual caret to be refreshed; to do that,
+ call wxRichTextCtrl::SetInsertionPoint instead.
+ */
+ void SetCaretPosition(long position, bool showAtLineStart = false) ;
+
+ /**
+ Returns the current caret position.
+ */
+ long GetCaretPosition() const { return m_caretPosition; }
+
+ /**
+ The adjusted caret position is the character position adjusted to take
+ into account whether we're at the start of a paragraph, in which case
+ style information should be taken from the next position, not current one.
+ */
+ long GetAdjustedCaretPosition(long caretPos) const;
+
+ /**
+ Move the caret one visual step forward: this may mean setting a flag
+ and keeping the same position if we're going from the end of one line
+ to the start of the next, which may be the exact same caret position.
+ */
+ void MoveCaretForward(long oldPosition) ;
+
+ /**
+ Move the caret one visual step forward: this may mean setting a flag
+ and keeping the same position if we're going from the end of one line
+ to the start of the next, which may be the exact same caret position.
+ */
+ void MoveCaretBack(long oldPosition) ;
+
+ /**
+ Returns the caret height and position for the given character position.
+ If container is null, the current focus object will be used.
+
+ @beginWxPerlOnly
+ In wxPerl this method is implemented as
+ GetCaretPositionForIndex(@a position) returning a
+ 2-element list (ok, rect).
+ @endWxPerlOnly
+ */
+ bool GetCaretPositionForIndex(long position, wxRect& rect, wxRichTextParagraphLayoutBox* container = NULL);
+
+ /**
+ Internal helper function returning the line for the visible caret position.
+ If the caret is shown at the very end of the line, it means the next character
+ is actually on the following line.
+ So this function gets the line we're expecting to find if this is the case.
+ */
+ wxRichTextLine* GetVisibleLineForCaretPosition(long caretPosition) const;
+
+ /**
+ Gets the command processor associated with the control's buffer.
+ */
+ wxCommandProcessor* GetCommandProcessor() const { return GetBuffer().GetCommandProcessor(); }
+
+ /**
+ Deletes content if there is a selection, e.g. when pressing a key.
+ Returns the new caret position in @e newPos, or leaves it if there
+ was no action. This is undoable.
+
+ @beginWxPerlOnly
+ In wxPerl this method takes no arguments and returns a 2-element
+ list (ok, newPos).
+ @endWxPerlOnly
+ */
+ bool DeleteSelectedContent(long* newPos= NULL);
+
+ /**
+ Transforms logical (unscrolled) position to physical window position.
+ */
+ wxPoint GetPhysicalPoint(const wxPoint& ptLogical) const;
+
+ /**
+ Transforms physical window position to logical (unscrolled) position.
+ */
+ wxPoint GetLogicalPoint(const wxPoint& ptPhysical) const;
+
+ /**
+ Helper function for finding the caret position for the next word.
+ Direction is 1 (forward) or -1 (backwards).
+ */
+ virtual long FindNextWordPosition(int direction = 1) const;
+
+ /**
+ Returns @true if the given position is visible on the screen.
+ */
+ bool IsPositionVisible(long pos) const;
+
+ /**
+ Returns the first visible position in the current view.
+ */
+ long GetFirstVisiblePosition() const;
+
+ /**
+ Returns the caret position since the default formatting was changed. As
+ soon as this position changes, we no longer reflect the default style
+ in the UI. A value of -2 means that we should only reflect the style of the
+ content under the caret.
+ */
+ long GetCaretPositionForDefaultStyle() const { return m_caretPositionForDefaultStyle; }
+
+ /**
+ Set the caret position for the default style that the user is selecting.
+ */
+ void SetCaretPositionForDefaultStyle(long pos) { m_caretPositionForDefaultStyle = pos; }
+
+ /**
+ Returns @true if the user has recently set the default style without moving
+ the caret, and therefore the UI needs to reflect the default style and not
+ the style at the caret.
+
+ Below is an example of code that uses this function to determine whether the UI
+ should show that the current style is bold.
+
+ @see SetAndShowDefaultStyle().
+ */
+ bool IsDefaultStyleShowing() const { return m_caretPositionForDefaultStyle != -2; }
+
+ /**
+ Sets @a attr as the default style and tells the control that the UI should
+ reflect this attribute until the user moves the caret.
+
+ @see IsDefaultStyleShowing().
+ */
+ void SetAndShowDefaultStyle(const wxRichTextAttr& attr)
+ {
+ SetDefaultStyle(attr);
+ SetCaretPositionForDefaultStyle(GetCaretPosition());
+ }
+
+ /**
+ Returns the first visible point in the window.
+ */
+ wxPoint GetFirstVisiblePoint() const;
+
+#ifdef DOXYGEN
+ /**
+ Returns the content of the entire control as a string.
+ */
+ virtual wxString GetValue() const;
+
+ /**
+ Replaces existing content with the given text.
+ */
+ virtual void SetValue(const wxString& value);
+
+ /**
+ Call this function to prevent refresh and allow fast updates, and then Thaw() to
+ refresh the control.
+ */
+ void Freeze();
+
+ /**
+ Call this function to end a Freeze and refresh the display.
+ */
+ void Thaw();
+
+ /**
+ Returns @true if Freeze has been called without a Thaw.
+ */
+ bool IsFrozen() const;
+
+#endif
+
+// Implementation
+
+ /**
+ Processes the back key.
+ */
+ virtual bool ProcessBackKey(wxKeyEvent& event, int flags);
+
+ /**
+ Given a character position at which there is a list style, find the range
+ encompassing the same list style by looking backwards and forwards.
+ */
+ virtual wxRichTextRange FindRangeForList(long pos, bool& isNumberedList);
+
+ /**
+ Sets up the caret for the given position and container, after a mouse click.
+ */
+ bool SetCaretPositionAfterClick(wxRichTextParagraphLayoutBox* container, long position, int hitTestFlags, bool extendSelection = false);
+
+ /**
+ Find the caret position for the combination of hit-test flags and character position.
+ Returns the caret position and also an indication of where to place the caret (caretLineStart)
+ since this is ambiguous (same position used for end of line and start of next).
+ */
+ long FindCaretPositionForCharacterPosition(long position, int hitTestFlags, wxRichTextParagraphLayoutBox* container,
+ bool& caretLineStart);
+
+ /**
+ Processes mouse movement in order to change the cursor
+ */
+ virtual bool ProcessMouseMovement(wxRichTextParagraphLayoutBox* container, wxRichTextObject* obj, long position, const wxPoint& pos);
+
+ /**
+ Font names take a long time to retrieve, so cache them (on demand).
+ */
+ static const wxArrayString& GetAvailableFontNames();
+
+ /**
+ Clears the cache of available font names.
+ */
+ static void ClearAvailableFontNames();
+
+ WX_FORWARD_TO_SCROLL_HELPER()
+
+ // implement wxTextEntry methods
+ virtual wxString DoGetValue() const;
+
+protected:
+ // implement the wxTextEntry pure virtual method
+ virtual wxWindow *GetEditableWindow() { return this; }
+
+ // margins functions
+ virtual bool DoSetMargins(const wxPoint& pt);
+ virtual wxPoint DoGetMargins() const;
+
+ // FIXME: this does not work, it allows this code to compile but will fail
+ // during run-time
+#ifndef __WXUNIVERSAL__
+#ifdef __WXMSW__
+ virtual WXHWND GetEditHWND() const { return GetHWND(); }
+#endif
+#ifdef __WXMOTIF__
+ virtual WXWidget GetTextWidget() const { return NULL; }
+#endif
+#ifdef __WXGTK20__
+ virtual GtkEditable *GetEditable() const { return NULL; }
+ virtual GtkEntry *GetEntry() const { return NULL; }
+#endif
+#endif // !__WXUNIVERSAL__
+
+// Overrides
+protected:
+
+ /**
+ Currently this simply returns @c wxSize(10, 10).
+ */
+ virtual wxSize DoGetBestSize() const ;
+
+ virtual void DoSetValue(const wxString& value, int flags = 0);
+
+ virtual void DoThaw();
+
+
+// Data members
+protected:
+#if wxRICHTEXT_BUFFERED_PAINTING
+ /// Buffer bitmap
+ wxBitmap m_bufferBitmap;
+#endif
+
+ /// Text buffer
+ wxRichTextBuffer m_buffer;
+
+ wxMenu* m_contextMenu;
+
+ /// Caret position (1 less than the character position, so -1 is the
+ /// first caret position).
+ long m_caretPosition;
+
+ /// Caret position when the default formatting has been changed. As
+ /// soon as this position changes, we no longer reflect the default style
+ /// in the UI.
+ long m_caretPositionForDefaultStyle;
+
+ /// Selection range in character positions. -2, -2 means no selection.
+ wxRichTextSelection m_selection;
+
+ wxRichTextCtrlSelectionState m_selectionState;
+
+ /// Anchor so we know how to extend the selection
+ /// It's a caret position since it's between two characters.
+ long m_selectionAnchor;
+
+ /// Anchor object if selecting multiple container objects, such as grid cells.
+ wxRichTextObject* m_selectionAnchorObject;
+
+ /// Are we editable?
+ bool m_editable;
+
+ /// Can we use virtual attributes and virtual text?
+ bool m_useVirtualAttributes;
+
+ /// Is the vertical scrollbar enabled?
+ bool m_verticalScrollbarEnabled;
+
+ /// Are we showing the caret position at the start of a line
+ /// instead of at the end of the previous one?
+ bool m_caretAtLineStart;
+
+ /// Are we dragging (i.e. extending) a selection?
+ bool m_dragging;
+
+#if wxUSE_DRAG_AND_DROP
+ /// Are we trying to start Drag'n'Drop?
+ bool m_preDrag;
+
+ /// Initial position when starting Drag'n'Drop
+ wxPoint m_dragStartPoint;
+
+#if wxUSE_DATETIME
+ /// Initial time when starting Drag'n'Drop
+ wxDateTime m_dragStartTime;
+#endif // wxUSE_DATETIME
+#endif // wxUSE_DRAG_AND_DROP
+
+ /// Do we need full layout in idle?
+ bool m_fullLayoutRequired;
+ wxLongLong m_fullLayoutTime;
+ long m_fullLayoutSavedPosition;
+
+ /// Threshold for doing delayed layout
+ long m_delayedLayoutThreshold;
+
+ /// Cursors
+ wxCursor m_textCursor;
+ wxCursor m_urlCursor;
+
+ static wxArrayString sm_availableFontNames;
+
+ wxRichTextContextMenuPropertiesInfo m_contextMenuPropertiesInfo;
+
+ /// The object that currently has the editing focus
+ wxRichTextParagraphLayoutBox* m_focusObject;
+
+ /// An overall scale factor
+ double m_scale;
+};
+
+#if wxUSE_DRAG_AND_DROP
+class WXDLLIMPEXP_RICHTEXT wxRichTextDropSource : public wxDropSource
+{
+public:
+ wxRichTextDropSource(wxDataObject& data, wxRichTextCtrl* tc)
+ : wxDropSource(data, tc), m_rtc(tc) {}
+
+protected:
+ bool GiveFeedback(wxDragResult effect);
+
+ wxRichTextCtrl* m_rtc;
+};
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextDropTarget : public wxDropTarget
+{
+public:
+ wxRichTextDropTarget(wxRichTextCtrl* tc)
+ : wxDropTarget(new wxRichTextBufferDataObject(new wxRichTextBuffer)), m_rtc(tc) {}
+
+ virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def)
+ {
+ if ( !GetData() )
+ return wxDragNone;
+ m_rtc->OnDrop(x, y, def, m_dataObject);
+ return def;
+ }
+
+protected:
+ wxRichTextCtrl* m_rtc;
+};
+#endif // wxUSE_DRAG_AND_DROP
+
+/**
+ @class wxRichTextEvent
+
+ This is the event class for wxRichTextCtrl notifications.
+
+ @beginEventTable{wxRichTextEvent}
+ @event{EVT_RICHTEXT_LEFT_CLICK(id, func)}
+ Process a @c wxEVT_RICHTEXT_LEFT_CLICK event, generated when the user
+ releases the left mouse button over an object.
+ @event{EVT_RICHTEXT_RIGHT_CLICK(id, func)}
+ Process a @c wxEVT_RICHTEXT_RIGHT_CLICK event, generated when the user
+ releases the right mouse button over an object.
+ @event{EVT_RICHTEXT_MIDDLE_CLICK(id, func)}
+ Process a @c wxEVT_RICHTEXT_MIDDLE_CLICK event, generated when the user
+ releases the middle mouse button over an object.
+ @event{EVT_RICHTEXT_LEFT_DCLICK(id, func)}
+ Process a @c wxEVT_RICHTEXT_LEFT_DCLICK event, generated when the user
+ double-clicks an object.
+ @event{EVT_RICHTEXT_RETURN(id, func)}
+ Process a @c wxEVT_RICHTEXT_RETURN event, generated when the user
+ presses the return key. Valid event functions: GetFlags, GetPosition.
+ @event{EVT_RICHTEXT_CHARACTER(id, func)}
+ Process a @c wxEVT_RICHTEXT_CHARACTER event, generated when the user
+ presses a character key. Valid event functions: GetFlags, GetPosition, GetCharacter.
+ @event{EVT_RICHTEXT_CONSUMING_CHARACTER(id, func)}
+ Process a @c wxEVT_RICHTEXT_CONSUMING_CHARACTER event, generated when the user
+ presses a character key but before it is processed and inserted into the control.
+ Call Veto to prevent normal processing. Valid event functions: GetFlags, GetPosition,
+ GetCharacter, Veto.
+ @event{EVT_RICHTEXT_DELETE(id, func)}
+ Process a @c wxEVT_RICHTEXT_DELETE event, generated when the user
+ presses the backspace or delete key. Valid event functions: GetFlags, GetPosition.
+ @event{EVT_RICHTEXT_STYLE_CHANGED(id, func)}
+ Process a @c wxEVT_RICHTEXT_STYLE_CHANGED event, generated when
+ styling has been applied to the control. Valid event functions: GetPosition, GetRange.
+ @event{EVT_RICHTEXT_STYLESHEET_CHANGED(id, func)}
+ Process a @c wxEVT_RICHTEXT_STYLESHEET_CHANGING event, generated
+ when the control's stylesheet has changed, for example the user added,
+ edited or deleted a style. Valid event functions: GetRange, GetPosition.
+ @event{EVT_RICHTEXT_STYLESHEET_REPLACING(id, func)}
+ Process a @c wxEVT_RICHTEXT_STYLESHEET_REPLACING event, generated
+ when the control's stylesheet is about to be replaced, for example when
+ a file is loaded into the control.
+ Valid event functions: Veto, GetOldStyleSheet, GetNewStyleSheet.
+ @event{EVT_RICHTEXT_STYLESHEET_REPLACED(id, func)}
+ Process a @c wxEVT_RICHTEXT_STYLESHEET_REPLACED event, generated
+ when the control's stylesheet has been replaced, for example when a file
+ is loaded into the control.
+ Valid event functions: GetOldStyleSheet, GetNewStyleSheet.
+ @event{EVT_RICHTEXT_PROPERTIES_CHANGED(id, func)}
+ Process a @c wxEVT_RICHTEXT_PROPERTIES_CHANGED event, generated when
+ properties have been applied to the control. Valid event functions: GetPosition, GetRange.
+ @event{EVT_RICHTEXT_CONTENT_INSERTED(id, func)}
+ Process a @c wxEVT_RICHTEXT_CONTENT_INSERTED event, generated when
+ content has been inserted into the control.
+ Valid event functions: GetPosition, GetRange.
+ @event{EVT_RICHTEXT_CONTENT_DELETED(id, func)}
+ Process a @c wxEVT_RICHTEXT_CONTENT_DELETED event, generated when
+ content has been deleted from the control.
+ Valid event functions: GetPosition, GetRange.
+ @event{EVT_RICHTEXT_BUFFER_RESET(id, func)}
+ Process a @c wxEVT_RICHTEXT_BUFFER_RESET event, generated when the
+ buffer has been reset by deleting all content.
+ You can use this to set a default style for the first new paragraph.
+ @event{EVT_RICHTEXT_SELECTION_CHANGED(id, func)}
+ Process a @c wxEVT_RICHTEXT_SELECTION_CHANGED event, generated when the
+ selection range has changed.
+ @event{EVT_RICHTEXT_FOCUS_OBJECT_CHANGED(id, func)}
+ Process a @c wxEVT_RICHTEXT_FOCUS_OBJECT_CHANGED event, generated when the
+ current focus object has changed.
+ @endEventTable
+
+ @library{wxrichtext}
+ @category{events,richtext}
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextEvent : public wxNotifyEvent
+{
+public:
+ /**
+ Constructor.
+
+ @param commandType
+ The type of the event.
+ @param id
+ Window identifier. The value @c wxID_ANY indicates a default value.
+ */
+ wxRichTextEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
+ : wxNotifyEvent(commandType, winid),
+ m_flags(0), m_position(-1), m_oldStyleSheet(NULL), m_newStyleSheet(NULL),
+ m_char((wxChar) 0), m_container(NULL), m_oldContainer(NULL)
+ { }
+
+ /**
+ Copy constructor.
+ */
+ wxRichTextEvent(const wxRichTextEvent& event)
+ : wxNotifyEvent(event),
+ m_flags(event.m_flags), m_position(-1),
+ m_oldStyleSheet(event.m_oldStyleSheet), m_newStyleSheet(event.m_newStyleSheet),
+ m_char((wxChar) 0), m_container(event.m_container), m_oldContainer(event.m_oldContainer)
+ { }
+
+ /**
+ Returns the buffer position at which the event occured.
+ */
+ long GetPosition() const { return m_position; }
+
+ /**
+ Sets the buffer position variable.
+ */
+ void SetPosition(long pos) { m_position = pos; }
+
+ /**
+ Returns flags indicating modifier keys pressed.
+
+ Possible values are @c wxRICHTEXT_CTRL_DOWN, @c wxRICHTEXT_SHIFT_DOWN, and @c wxRICHTEXT_ALT_DOWN.
+ */
+ int GetFlags() const { return m_flags; }
+
+ /**
+ Sets flags indicating modifier keys pressed.
+
+ Possible values are @c wxRICHTEXT_CTRL_DOWN, @c wxRICHTEXT_SHIFT_DOWN, and @c wxRICHTEXT_ALT_DOWN.
+ */
+ void SetFlags(int flags) { m_flags = flags; }
+
+ /**
+ Returns the old style sheet.
+
+ Can be used in a @c wxEVT_RICHTEXT_STYLESHEET_CHANGING or
+ @c wxEVT_RICHTEXT_STYLESHEET_CHANGED event handler.
+ */
+ wxRichTextStyleSheet* GetOldStyleSheet() const { return m_oldStyleSheet; }
+
+ /**
+ Sets the old style sheet variable.
+ */
+ void SetOldStyleSheet(wxRichTextStyleSheet* sheet) { m_oldStyleSheet = sheet; }
+
+ /**
+ Returns the new style sheet.
+
+ Can be used in a @c wxEVT_RICHTEXT_STYLESHEET_CHANGING or
+ @c wxEVT_RICHTEXT_STYLESHEET_CHANGED event handler.
+ */
+ wxRichTextStyleSheet* GetNewStyleSheet() const { return m_newStyleSheet; }
+
+ /**
+ Sets the new style sheet variable.
+ */
+ void SetNewStyleSheet(wxRichTextStyleSheet* sheet) { m_newStyleSheet = sheet; }
+
+ /**
+ Gets the range for the current operation.
+ */
+ const wxRichTextRange& GetRange() const { return m_range; }
+
+ /**
+ Sets the range variable.
+ */
+ void SetRange(const wxRichTextRange& range) { m_range = range; }
+
+ /**
+ Returns the character pressed, within a @c wxEVT_RICHTEXT_CHARACTER event.
+ */
+ wxChar GetCharacter() const { return m_char; }
+
+ /**
+ Sets the character variable.
+ */
+ void SetCharacter(wxChar ch) { m_char = ch; }
+
+ /**
+ Returns the container for which the event is relevant.
+ */
+ wxRichTextParagraphLayoutBox* GetContainer() const { return m_container; }
+
+ /**
+ Sets the container for which the event is relevant.
+ */
+ void SetContainer(wxRichTextParagraphLayoutBox* container) { m_container = container; }
+
+ /**
+ Returns the old container, for a focus change event.
+ */
+ wxRichTextParagraphLayoutBox* GetOldContainer() const { return m_oldContainer; }
+
+ /**
+ Sets the old container, for a focus change event.
+ */
+ void SetOldContainer(wxRichTextParagraphLayoutBox* container) { m_oldContainer = container; }
+
+ virtual wxEvent *Clone() const { return new wxRichTextEvent(*this); }
+
+protected:
+ int m_flags;
+ long m_position;
+ wxRichTextStyleSheet* m_oldStyleSheet;
+ wxRichTextStyleSheet* m_newStyleSheet;
+ wxRichTextRange m_range;
+ wxChar m_char;
+ wxRichTextParagraphLayoutBox* m_container;
+ wxRichTextParagraphLayoutBox* m_oldContainer;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRichTextEvent)
+};
+
+/*!
+ * wxRichTextCtrl events
+ */
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_LEFT_CLICK, wxRichTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_RIGHT_CLICK, wxRichTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_MIDDLE_CLICK, wxRichTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_LEFT_DCLICK, wxRichTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_RETURN, wxRichTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_CHARACTER, wxRichTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_CONSUMING_CHARACTER, wxRichTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_DELETE, wxRichTextEvent );
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_STYLESHEET_CHANGING, wxRichTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_STYLESHEET_CHANGED, wxRichTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_STYLESHEET_REPLACING, wxRichTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_STYLESHEET_REPLACED, wxRichTextEvent );
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_CONTENT_INSERTED, wxRichTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_CONTENT_DELETED, wxRichTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_STYLE_CHANGED, wxRichTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_PROPERTIES_CHANGED, wxRichTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_SELECTION_CHANGED, wxRichTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_BUFFER_RESET, wxRichTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_FOCUS_OBJECT_CHANGED, wxRichTextEvent );
+
+typedef void (wxEvtHandler::*wxRichTextEventFunction)(wxRichTextEvent&);
+
+#define wxRichTextEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxRichTextEventFunction, func)
+
+#define EVT_RICHTEXT_LEFT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_LEFT_CLICK, id, -1, wxRichTextEventHandler( fn ), NULL ),
+#define EVT_RICHTEXT_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_RIGHT_CLICK, id, -1, wxRichTextEventHandler( fn ), NULL ),
+#define EVT_RICHTEXT_MIDDLE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_MIDDLE_CLICK, id, -1, wxRichTextEventHandler( fn ), NULL ),
+#define EVT_RICHTEXT_LEFT_DCLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_LEFT_DCLICK, id, -1, wxRichTextEventHandler( fn ), NULL ),
+#define EVT_RICHTEXT_RETURN(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_RETURN, id, -1, wxRichTextEventHandler( fn ), NULL ),
+#define EVT_RICHTEXT_CHARACTER(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_CHARACTER, id, -1, wxRichTextEventHandler( fn ), NULL ),
+#define EVT_RICHTEXT_CONSUMING_CHARACTER(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_CONSUMING_CHARACTER, id, -1, wxRichTextEventHandler( fn ), NULL ),
+#define EVT_RICHTEXT_DELETE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_DELETE, id, -1, wxRichTextEventHandler( fn ), NULL ),
+
+#define EVT_RICHTEXT_STYLESHEET_CHANGING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_STYLESHEET_CHANGING, id, -1, wxRichTextEventHandler( fn ), NULL ),
+#define EVT_RICHTEXT_STYLESHEET_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_STYLESHEET_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ),
+#define EVT_RICHTEXT_STYLESHEET_REPLACING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_STYLESHEET_REPLACING, id, -1, wxRichTextEventHandler( fn ), NULL ),
+#define EVT_RICHTEXT_STYLESHEET_REPLACED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_STYLESHEET_REPLACED, id, -1, wxRichTextEventHandler( fn ), NULL ),
+
+#define EVT_RICHTEXT_CONTENT_INSERTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_CONTENT_INSERTED, id, -1, wxRichTextEventHandler( fn ), NULL ),
+#define EVT_RICHTEXT_CONTENT_DELETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_CONTENT_DELETED, id, -1, wxRichTextEventHandler( fn ), NULL ),
+#define EVT_RICHTEXT_STYLE_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_STYLE_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ),
+#define EVT_RICHTEXT_PROPERTIES_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_PROPERTIES_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ),
+#define EVT_RICHTEXT_SELECTION_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_SELECTION_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ),
+#define EVT_RICHTEXT_BUFFER_RESET(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_BUFFER_RESET, id, -1, wxRichTextEventHandler( fn ), NULL ),
+#define EVT_RICHTEXT_FOCUS_OBJECT_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_FOCUS_OBJECT_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ),
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_RICHTEXT_LEFT_CLICK wxEVT_RICHTEXT_LEFT_CLICK
+#define wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK wxEVT_RICHTEXT_RIGHT_CLICK
+#define wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK wxEVT_RICHTEXT_MIDDLE_CLICK
+#define wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK wxEVT_RICHTEXT_LEFT_DCLICK
+#define wxEVT_COMMAND_RICHTEXT_RETURN wxEVT_RICHTEXT_RETURN
+#define wxEVT_COMMAND_RICHTEXT_CHARACTER wxEVT_RICHTEXT_CHARACTER
+#define wxEVT_COMMAND_RICHTEXT_DELETE wxEVT_RICHTEXT_DELETE
+#define wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING wxEVT_RICHTEXT_STYLESHEET_CHANGING
+#define wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED wxEVT_RICHTEXT_STYLESHEET_CHANGED
+#define wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING wxEVT_RICHTEXT_STYLESHEET_REPLACING
+#define wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED wxEVT_RICHTEXT_STYLESHEET_REPLACED
+#define wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED wxEVT_RICHTEXT_CONTENT_INSERTED
+#define wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED wxEVT_RICHTEXT_CONTENT_DELETED
+#define wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED wxEVT_RICHTEXT_STYLE_CHANGED
+#define wxEVT_COMMAND_RICHTEXT_PROPERTIES_CHANGED wxEVT_RICHTEXT_PROPERTIES_CHANGED
+#define wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED wxEVT_RICHTEXT_SELECTION_CHANGED
+#define wxEVT_COMMAND_RICHTEXT_BUFFER_RESET wxEVT_RICHTEXT_BUFFER_RESET
+#define wxEVT_COMMAND_RICHTEXT_FOCUS_OBJECT_CHANGED wxEVT_RICHTEXT_FOCUS_OBJECT_CHANGED
+
+#endif
+ // wxUSE_RICHTEXT
+
+#endif
+ // _WX_RICHTEXTCTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtextdialogpage.h
+// Purpose: Formatting dialog page base class for wxRTC
+// Author: Julian Smart
+// Modified by:
+// Created: 2010-11-14
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RICHTEXTDIALOGPAGE_H_
+#define _WX_RICHTEXTDIALOGPAGE_H_
+
+#if wxUSE_RICHTEXT
+
+#include "wx/panel.h"
+#include "wx/richtext/richtextuicustomization.h"
+
+/**
+ @class wxRichTextDialogPage
+ The base class for formatting dialog pages.
+ **/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextDialogPage: public wxPanel
+{
+public:
+ DECLARE_CLASS(wxRichTextDialogPage)
+ wxRichTextDialogPage() {}
+ wxRichTextDialogPage(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0)
+ {
+ Create(parent, id, pos, size, style);
+ }
+
+ DECLARE_BASE_CLASS_HELP_PROVISION()
+};
+
+#endif
+ // wxUSE_RICHTEXT
+
+#endif
+ // _WX_RICHTEXTDIALOGPAGE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtextfontpage.h
+// Purpose: Font page for wxRichTextFormattingDialog
+// Author: Julian Smart
+// Modified by:
+// Created: 2006-10-02
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _RICHTEXTFONTPAGE_H_
+#define _RICHTEXTFONTPAGE_H_
+
+/*!
+ * Includes
+ */
+
+#include "wx/richtext/richtextdialogpage.h"
+
+////@begin includes
+#include "wx/spinbutt.h"
+////@end includes
+
+/*!
+ * Forward declarations
+ */
+
+////@begin forward declarations
+class wxSpinButton;
+class wxBoxSizer;
+class wxRichTextFontListBox;
+class wxRichTextColourSwatchCtrl;
+class wxRichTextFontPreviewCtrl;
+////@end forward declarations
+
+/*!
+ * Control identifiers
+ */
+
+////@begin control identifiers
+#define SYMBOL_WXRICHTEXTFONTPAGE_STYLE wxTAB_TRAVERSAL
+#define SYMBOL_WXRICHTEXTFONTPAGE_TITLE wxEmptyString
+#define SYMBOL_WXRICHTEXTFONTPAGE_IDNAME ID_RICHTEXTFONTPAGE
+#define SYMBOL_WXRICHTEXTFONTPAGE_SIZE wxSize(200, 100)
+#define SYMBOL_WXRICHTEXTFONTPAGE_POSITION wxDefaultPosition
+////@end control identifiers
+
+/*!
+ * wxRichTextFontPage class declaration
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextFontPage: public wxRichTextDialogPage
+{
+ DECLARE_DYNAMIC_CLASS( wxRichTextFontPage )
+ DECLARE_EVENT_TABLE()
+ DECLARE_HELP_PROVISION()
+
+public:
+ /// Constructors
+ wxRichTextFontPage( );
+ wxRichTextFontPage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTFONTPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTFONTPAGE_SIZE, long style = SYMBOL_WXRICHTEXTFONTPAGE_STYLE );
+
+ /// Initialise members
+ void Init();
+
+ /// Creation
+ bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTFONTPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTFONTPAGE_SIZE, long style = SYMBOL_WXRICHTEXTFONTPAGE_STYLE );
+
+ /// Creates the controls and sizers
+ void CreateControls();
+
+ /// Transfer data from/to window
+ virtual bool TransferDataFromWindow();
+ virtual bool TransferDataToWindow();
+
+ /// Updates the font preview
+ void UpdatePreview();
+
+ void OnFaceListBoxSelected( wxCommandEvent& event );
+ void OnColourClicked( wxCommandEvent& event );
+
+ /// Gets the attributes associated with the main formatting dialog
+ wxRichTextAttr* GetAttributes();
+
+////@begin wxRichTextFontPage event handler declarations
+
+ /// wxEVT_IDLE event handler for ID_RICHTEXTFONTPAGE
+ void OnIdle( wxIdleEvent& event );
+
+ /// wxEVT_TEXT event handler for ID_RICHTEXTFONTPAGE_FACETEXTCTRL
+ void OnFaceTextCtrlUpdated( wxCommandEvent& event );
+
+ /// wxEVT_TEXT event handler for ID_RICHTEXTFONTPAGE_SIZETEXTCTRL
+ void OnSizeTextCtrlUpdated( wxCommandEvent& event );
+
+ /// wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTFONTPAGE_SPINBUTTONS
+ void OnRichtextfontpageSpinbuttonsUp( wxSpinEvent& event );
+
+ /// wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTFONTPAGE_SPINBUTTONS
+ void OnRichtextfontpageSpinbuttonsDown( wxSpinEvent& event );
+
+ /// wxEVT_CHOICE event handler for ID_RICHTEXTFONTPAGE_SIZE_UNITS
+ void OnRichtextfontpageSizeUnitsSelected( wxCommandEvent& event );
+
+ /// wxEVT_LISTBOX event handler for ID_RICHTEXTFONTPAGE_SIZELISTBOX
+ void OnSizeListBoxSelected( wxCommandEvent& event );
+
+ /// wxEVT_COMBOBOX event handler for ID_RICHTEXTFONTPAGE_STYLECTRL
+ void OnStyleCtrlSelected( wxCommandEvent& event );
+
+ /// wxEVT_COMBOBOX event handler for ID_RICHTEXTFONTPAGE_WEIGHTCTRL
+ void OnWeightCtrlSelected( wxCommandEvent& event );
+
+ /// wxEVT_COMBOBOX event handler for ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL
+ void OnUnderliningCtrlSelected( wxCommandEvent& event );
+
+ /// wxEVT_CHECKBOX event handler for ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL
+ void OnStrikethroughctrlClick( wxCommandEvent& event );
+
+ /// wxEVT_CHECKBOX event handler for ID_RICHTEXTFONTPAGE_CAPSCTRL
+ void OnCapsctrlClick( wxCommandEvent& event );
+
+ /// wxEVT_CHECKBOX event handler for ID_RICHTEXTFONTPAGE_SUPERSCRIPT
+ void OnRichtextfontpageSuperscriptClick( wxCommandEvent& event );
+
+ /// wxEVT_CHECKBOX event handler for ID_RICHTEXTFONTPAGE_SUBSCRIPT
+ void OnRichtextfontpageSubscriptClick( wxCommandEvent& event );
+
+////@end wxRichTextFontPage event handler declarations
+
+////@begin wxRichTextFontPage member function declarations
+
+ /// Retrieves bitmap resources
+ wxBitmap GetBitmapResource( const wxString& name );
+
+ /// Retrieves icon resources
+ wxIcon GetIconResource( const wxString& name );
+////@end wxRichTextFontPage member function declarations
+
+ /// Should we show tooltips?
+ static bool ShowToolTips();
+
+////@begin wxRichTextFontPage member variables
+ wxTextCtrl* m_faceTextCtrl;
+ wxTextCtrl* m_sizeTextCtrl;
+ wxSpinButton* m_fontSizeSpinButtons;
+ wxChoice* m_sizeUnitsCtrl;
+ wxBoxSizer* m_fontListBoxParent;
+ wxRichTextFontListBox* m_faceListBox;
+ wxListBox* m_sizeListBox;
+ wxComboBox* m_styleCtrl;
+ wxComboBox* m_weightCtrl;
+ wxComboBox* m_underliningCtrl;
+ wxCheckBox* m_textColourLabel;
+ wxRichTextColourSwatchCtrl* m_colourCtrl;
+ wxCheckBox* m_bgColourLabel;
+ wxRichTextColourSwatchCtrl* m_bgColourCtrl;
+ wxCheckBox* m_strikethroughCtrl;
+ wxCheckBox* m_capitalsCtrl;
+ wxCheckBox* m_smallCapitalsCtrl;
+ wxCheckBox* m_superscriptCtrl;
+ wxCheckBox* m_subscriptCtrl;
+ wxRichTextFontPreviewCtrl* m_previewCtrl;
+ /// Control identifiers
+ enum {
+ ID_RICHTEXTFONTPAGE = 10000,
+ ID_RICHTEXTFONTPAGE_FACETEXTCTRL = 10001,
+ ID_RICHTEXTFONTPAGE_SIZETEXTCTRL = 10002,
+ ID_RICHTEXTFONTPAGE_SPINBUTTONS = 10003,
+ ID_RICHTEXTFONTPAGE_SIZE_UNITS = 10004,
+ ID_RICHTEXTFONTPAGE_FACELISTBOX = 10005,
+ ID_RICHTEXTFONTPAGE_SIZELISTBOX = 10006,
+ ID_RICHTEXTFONTPAGE_STYLECTRL = 10007,
+ ID_RICHTEXTFONTPAGE_WEIGHTCTRL = 10008,
+ ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL = 10009,
+ ID_RICHTEXTFONTPAGE_COLOURCTRL_LABEL = 10010,
+ ID_RICHTEXTFONTPAGE_COLOURCTRL = 10011,
+ ID_RICHTEXTFONTPAGE_BGCOLOURCTRL_LABEL = 10012,
+ ID_RICHTEXTFONTPAGE_BGCOLOURCTRL = 10013,
+ ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL = 10014,
+ ID_RICHTEXTFONTPAGE_CAPSCTRL = 10015,
+ ID_RICHTEXTFONTPAGE_SMALLCAPSCTRL = 10016,
+ ID_RICHTEXTFONTPAGE_SUPERSCRIPT = 10017,
+ ID_RICHTEXTFONTPAGE_SUBSCRIPT = 10018,
+ ID_RICHTEXTFONTPAGE_PREVIEWCTRL = 10019
+ };
+////@end wxRichTextFontPage member variables
+
+ bool m_dontUpdate;
+ bool m_colourPresent;
+ bool m_bgColourPresent;
+};
+
+#endif
+ // _RICHTEXTFONTPAGE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtextformatdlg.h
+// Purpose: Formatting dialog for wxRichTextCtrl
+// Author: Julian Smart
+// Modified by:
+// Created: 2006-10-01
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RICHTEXTFORMATDLG_H_
+#define _WX_RICHTEXTFORMATDLG_H_
+
+/*!
+ * Includes
+ */
+
+#include "wx/defs.h"
+
+#if wxUSE_RICHTEXT
+
+#include "wx/propdlg.h"
+#include "wx/bookctrl.h"
+#include "wx/withimages.h"
+
+#if wxUSE_HTML
+#include "wx/htmllbox.h"
+#endif
+
+#include "wx/richtext/richtextbuffer.h"
+#include "wx/richtext/richtextstyles.h"
+#include "wx/richtext/richtextuicustomization.h"
+
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextFormattingDialog;
+class WXDLLIMPEXP_FWD_CORE wxComboBox;
+class WXDLLIMPEXP_FWD_CORE wxCheckBox;
+
+/*!
+ * Flags determining the pages and buttons to be created in the dialog
+ */
+
+#define wxRICHTEXT_FORMAT_STYLE_EDITOR 0x0001
+#define wxRICHTEXT_FORMAT_FONT 0x0002
+#define wxRICHTEXT_FORMAT_TABS 0x0004
+#define wxRICHTEXT_FORMAT_BULLETS 0x0008
+#define wxRICHTEXT_FORMAT_INDENTS_SPACING 0x0010
+#define wxRICHTEXT_FORMAT_LIST_STYLE 0x0020
+#define wxRICHTEXT_FORMAT_MARGINS 0x0040
+#define wxRICHTEXT_FORMAT_SIZE 0x0080
+#define wxRICHTEXT_FORMAT_BORDERS 0x0100
+#define wxRICHTEXT_FORMAT_BACKGROUND 0x0200
+
+#define wxRICHTEXT_FORMAT_HELP_BUTTON 0x1000
+
+/*!
+ * Indices for bullet styles in list control
+ */
+
+enum {
+ wxRICHTEXT_BULLETINDEX_NONE = 0,
+ wxRICHTEXT_BULLETINDEX_ARABIC,
+ wxRICHTEXT_BULLETINDEX_UPPER_CASE,
+ wxRICHTEXT_BULLETINDEX_LOWER_CASE,
+ wxRICHTEXT_BULLETINDEX_UPPER_CASE_ROMAN,
+ wxRICHTEXT_BULLETINDEX_LOWER_CASE_ROMAN,
+ wxRICHTEXT_BULLETINDEX_OUTLINE,
+ wxRICHTEXT_BULLETINDEX_SYMBOL,
+ wxRICHTEXT_BULLETINDEX_BITMAP,
+ wxRICHTEXT_BULLETINDEX_STANDARD
+};
+
+/*!
+ * Shorthand for common combinations of pages
+ */
+
+#define wxRICHTEXT_FORMAT_PARAGRAPH (wxRICHTEXT_FORMAT_INDENTS_SPACING | wxRICHTEXT_FORMAT_BULLETS | wxRICHTEXT_FORMAT_TABS | wxRICHTEXT_FORMAT_FONT)
+#define wxRICHTEXT_FORMAT_CHARACTER (wxRICHTEXT_FORMAT_FONT)
+#define wxRICHTEXT_FORMAT_STYLE (wxRICHTEXT_FORMAT_PARAGRAPH | wxRICHTEXT_FORMAT_STYLE_EDITOR)
+
+/*!
+ * Factory for formatting dialog
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextFormattingDialogFactory: public wxObject
+{
+public:
+ wxRichTextFormattingDialogFactory() {}
+ virtual ~wxRichTextFormattingDialogFactory() {}
+
+// Overridables
+
+ /// Create all pages, under the dialog's book control, also calling AddPage
+ virtual bool CreatePages(long pages, wxRichTextFormattingDialog* dialog);
+
+ /// Create a page, given a page identifier
+ virtual wxPanel* CreatePage(int page, wxString& title, wxRichTextFormattingDialog* dialog);
+
+ /// Enumerate all available page identifiers
+ virtual int GetPageId(int i) const;
+
+ /// Get the number of available page identifiers
+ virtual int GetPageIdCount() const;
+
+ /// Get the image index for the given page identifier
+ virtual int GetPageImage(int WXUNUSED(id)) const { return -1; }
+
+ /// Invoke help for the dialog
+ virtual bool ShowHelp(int page, wxRichTextFormattingDialog* dialog);
+
+ /// Set the sheet style, called at the start of wxRichTextFormattingDialog::Create
+ virtual bool SetSheetStyle(wxRichTextFormattingDialog* dialog);
+
+ /// Create the main dialog buttons
+ virtual bool CreateButtons(wxRichTextFormattingDialog* dialog);
+};
+
+/*!
+ * Formatting dialog for a wxRichTextCtrl
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextFormattingDialog: public wxPropertySheetDialog,
+ public wxWithImages
+{
+DECLARE_CLASS(wxRichTextFormattingDialog)
+DECLARE_HELP_PROVISION()
+
+public:
+ enum { Option_AllowPixelFontSize = 0x0001 };
+
+ wxRichTextFormattingDialog() { Init(); }
+
+ wxRichTextFormattingDialog(long flags, wxWindow* parent, const wxString& title = wxGetTranslation(wxT("Formatting")), wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE)
+ {
+ Init();
+ Create(flags, parent, title, id, pos, sz, style);
+ }
+
+ ~wxRichTextFormattingDialog();
+
+ void Init();
+
+ bool Create(long flags, wxWindow* parent, const wxString& title = wxGetTranslation(wxT("Formatting")), wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE);
+
+ /// Get attributes from the given range
+ virtual bool GetStyle(wxRichTextCtrl* ctrl, const wxRichTextRange& range);
+
+ /// Set the attributes and optionally update the display
+ virtual bool SetStyle(const wxRichTextAttr& style, bool update = true);
+
+ /// Set the style definition and optionally update the display
+ virtual bool SetStyleDefinition(const wxRichTextStyleDefinition& styleDef, wxRichTextStyleSheet* sheet, bool update = true);
+
+ /// Get the style definition, if any
+ virtual wxRichTextStyleDefinition* GetStyleDefinition() const { return m_styleDefinition; }
+
+ /// Get the style sheet, if any
+ virtual wxRichTextStyleSheet* GetStyleSheet() const { return m_styleSheet; }
+
+ /// Update the display
+ virtual bool UpdateDisplay();
+
+ /// Apply attributes to the given range
+ virtual bool ApplyStyle(wxRichTextCtrl* ctrl, const wxRichTextRange& range, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE);
+
+ /// Apply attributes to the object being edited, if any
+ virtual bool ApplyStyle(wxRichTextCtrl* ctrl, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
+
+ /// Gets and sets the attributes
+ const wxRichTextAttr& GetAttributes() const { return m_attributes; }
+ wxRichTextAttr& GetAttributes() { return m_attributes; }
+ void SetAttributes(const wxRichTextAttr& attr) { m_attributes = attr; }
+
+ /// Sets the dialog options, determining what the interface presents to the user.
+ /// Currently the only option is Option_AllowPixelFontSize.
+ void SetOptions(int options) { m_options = options; }
+
+ /// Gets the dialog options, determining what the interface presents to the user.
+ /// Currently the only option is Option_AllowPixelFontSize.
+ int GetOptions() const { return m_options; }
+
+ /// Returns @true if the given option is present.
+ bool HasOption(int option) const { return (m_options & option) != 0; }
+
+ /// If editing the attributes for a particular object, such as an image,
+ /// set the object so the code can initialize attributes such as size correctly.
+ wxRichTextObject* GetObject() const { return m_object; }
+ void SetObject(wxRichTextObject* obj) { m_object = obj; }
+
+ /// Transfers the data and from to the window
+ virtual bool TransferDataToWindow();
+ virtual bool TransferDataFromWindow();
+
+ /// Apply the styles when a different tab is selected, so the previews are
+ /// up to date
+ void OnTabChanged(wxBookCtrlEvent& event);
+
+ /// Respond to help command
+ void OnHelp(wxCommandEvent& event);
+ void OnUpdateHelp(wxUpdateUIEvent& event);
+
+ /// Get/set formatting factory object
+ static void SetFormattingDialogFactory(wxRichTextFormattingDialogFactory* factory);
+ static wxRichTextFormattingDialogFactory* GetFormattingDialogFactory() { return ms_FormattingDialogFactory; }
+
+ /// Helper for pages to get the top-level dialog
+ static wxRichTextFormattingDialog* GetDialog(wxWindow* win);
+
+ /// Helper for pages to get the attributes
+ static wxRichTextAttr* GetDialogAttributes(wxWindow* win);
+
+ /// Helper for pages to get the reset attributes
+ static wxRichTextAttr* GetDialogResetAttributes(wxWindow* win);
+
+ /// Helper for pages to get the style
+ static wxRichTextStyleDefinition* GetDialogStyleDefinition(wxWindow* win);
+
+ /// Should we show tooltips?
+ static bool ShowToolTips() { return sm_showToolTips; }
+
+ /// Determines whether tooltips will be shown
+ static void SetShowToolTips(bool show) { sm_showToolTips = show; }
+
+ /// Set the dimension into the value and units controls. Optionally pass units to
+ /// specify the ordering of units in the combobox.
+ static void SetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox, wxArrayInt* units = NULL);
+
+ /// Get the dimension from the value and units controls Optionally pass units to
+ /// specify the ordering of units in the combobox.
+ static void GetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox, wxArrayInt* units = NULL);
+
+ /// Convert from a string to a dimension integer.
+ static bool ConvertFromString(const wxString& str, int& ret, int unit);
+
+ /// Map book control page index to our page id
+ void AddPageId(int id) { m_pageIds.Add(id); }
+
+ /// Find a page by class
+ wxWindow* FindPage(wxClassInfo* info) const;
+
+protected:
+
+ wxRichTextAttr m_attributes;
+ wxRichTextStyleDefinition* m_styleDefinition;
+ wxRichTextStyleSheet* m_styleSheet;
+ wxRichTextObject* m_object;
+ wxArrayInt m_pageIds; // mapping of book control indexes to page ids
+ int m_options; // UI options
+
+ static wxRichTextFormattingDialogFactory* ms_FormattingDialogFactory;
+ static bool sm_showToolTips;
+
+DECLARE_EVENT_TABLE()
+};
+
+//-----------------------------------------------------------------------------
+// helper class - wxRichTextFontPreviewCtrl
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextFontPreviewCtrl : public wxWindow
+{
+public:
+ wxRichTextFontPreviewCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, long style = 0);
+
+ void SetTextEffects(int effects) { m_textEffects = effects; }
+ int GetTextEffects() const { return m_textEffects; }
+
+private:
+ int m_textEffects;
+
+ void OnPaint(wxPaintEvent& event);
+ DECLARE_EVENT_TABLE()
+};
+
+/*
+ * A control for displaying a small preview of a colour or bitmap
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextColourSwatchCtrl: public wxControl
+{
+ DECLARE_CLASS(wxRichTextColourSwatchCtrl)
+public:
+ wxRichTextColourSwatchCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0);
+ ~wxRichTextColourSwatchCtrl();
+
+ void OnMouseEvent(wxMouseEvent& event);
+
+ void SetColour(const wxColour& colour) { m_colour = colour; SetBackgroundColour(m_colour); }
+
+ wxColour& GetColour() { return m_colour; }
+
+ virtual wxSize DoGetBestSize() const { return GetSize(); }
+
+protected:
+ wxColour m_colour;
+
+DECLARE_EVENT_TABLE()
+};
+
+/*!
+ * wxRichTextFontListBox class declaration
+ * A listbox to display fonts.
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextFontListBox: public wxHtmlListBox
+{
+ DECLARE_CLASS(wxRichTextFontListBox)
+ DECLARE_EVENT_TABLE()
+
+public:
+ wxRichTextFontListBox()
+ {
+ Init();
+ }
+ wxRichTextFontListBox(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0);
+ virtual ~wxRichTextFontListBox();
+
+ void Init()
+ {
+ }
+
+ bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0);
+
+ /// Creates a suitable HTML fragment for a font
+ wxString CreateHTML(const wxString& facename) const;
+
+ /// Get font name for index
+ wxString GetFaceName(size_t i) const ;
+
+ /// Set selection for string, returning the index.
+ int SetFaceNameSelection(const wxString& name);
+
+ /// Updates the font list
+ void UpdateFonts();
+
+ /// Does this face name exist?
+ bool HasFaceName(const wxString& faceName) const { return m_faceNames.Index(faceName) != wxNOT_FOUND; }
+
+ /// Returns the array of face names
+ const wxArrayString& GetFaceNames() const { return m_faceNames; }
+
+protected:
+ /// Returns the HTML for this item
+ virtual wxString OnGetItem(size_t n) const;
+
+private:
+
+ wxArrayString m_faceNames;
+};
+
+#endif
+ // wxUSE_RICHTEXT
+
+#endif
+ // _WX_RICHTEXTFORMATDLG_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtexthtml.h
+// Purpose: HTML I/O for wxRichTextCtrl
+// Author: Julian Smart
+// Modified by:
+// Created: 2005-09-30
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RICHTEXTHTML_H_
+#define _WX_RICHTEXTHTML_H_
+
+/*!
+ * Includes
+ */
+
+#include "wx/richtext/richtextbuffer.h"
+
+// Use CSS styles where applicable, otherwise use non-CSS workarounds
+#define wxRICHTEXT_HANDLER_USE_CSS 0x1000
+
+/*!
+ * wxRichTextHTMLHandler
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextHTMLHandler: public wxRichTextFileHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxRichTextHTMLHandler)
+public:
+ wxRichTextHTMLHandler(const wxString& name = wxT("HTML"), const wxString& ext = wxT("html"), int type = wxRICHTEXT_TYPE_HTML);
+
+ /// Can we save using this handler?
+ virtual bool CanSave() const { return true; }
+
+ /// Can we load using this handler?
+ virtual bool CanLoad() const { return false; }
+
+ /// Can we handle this filename (if using files)? By default, checks the extension.
+ virtual bool CanHandle(const wxString& filename) const;
+
+// Accessors and operations unique to this handler
+
+ /// Set and get the list of image locations generated by the last operation
+ void SetTemporaryImageLocations(const wxArrayString& locations) { m_imageLocations = locations; }
+ const wxArrayString& GetTemporaryImageLocations() const { return m_imageLocations; }
+
+ /// Clear the image locations generated by the last operation
+ void ClearTemporaryImageLocations() { m_imageLocations.Clear(); }
+
+ /// Delete the in-memory or temporary files generated by the last operation
+ bool DeleteTemporaryImages();
+
+ /// Delete the in-memory or temporary files generated by the last operation. This is a static
+ /// function that can be used to delete the saved locations from an earlier operation,
+ /// for example after the user has viewed the HTML file.
+ static bool DeleteTemporaryImages(int flags, const wxArrayString& imageLocations);
+
+ /// Reset the file counter, in case, for example, the same names are required each time
+ static void SetFileCounter(int counter) { sm_fileCounter = counter; }
+
+ /// Set and get the directory for storing temporary files. If empty, the system
+ /// temporary directory will be used.
+ void SetTempDir(const wxString& tempDir) { m_tempDir = tempDir; }
+ const wxString& GetTempDir() const { return m_tempDir; }
+
+ /// Set and get mapping from point size to HTML font size. There should be 7 elements,
+ /// one for each HTML font size, each element specifying the maximum point size for that
+ /// HTML font size. E.g. 8, 10, 13, 17, 22, 29, 100
+ void SetFontSizeMapping(const wxArrayInt& fontSizeMapping) { m_fontSizeMapping = fontSizeMapping; }
+ wxArrayInt GetFontSizeMapping() const { return m_fontSizeMapping; }
+
+protected:
+
+// Implementation
+
+#if wxUSE_STREAMS
+ virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream);
+ virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream);
+
+ /// Output character formatting
+ void BeginCharacterFormatting(const wxRichTextAttr& currentStyle, const wxRichTextAttr& thisStyle, const wxRichTextAttr& paraStyle, wxTextOutputStream& stream );
+ void EndCharacterFormatting(const wxRichTextAttr& currentStyle, const wxRichTextAttr& thisStyle, const wxRichTextAttr& paraStyle, wxTextOutputStream& stream );
+
+ /// Output paragraph formatting
+ void BeginParagraphFormatting(const wxRichTextAttr& currentStyle, const wxRichTextAttr& thisStyle, wxTextOutputStream& stream);
+ void EndParagraphFormatting(const wxRichTextAttr& currentStyle, const wxRichTextAttr& thisStyle, wxTextOutputStream& stream);
+
+ /// Output font tag
+ void OutputFont(const wxRichTextAttr& style, wxTextOutputStream& stream);
+
+ /// Closes lists to level (-1 means close all)
+ void CloseLists(int level, wxTextOutputStream& str);
+
+ /// Writes an image to its base64 equivalent, or to the memory filesystem, or to a file
+ void WriteImage(wxRichTextImage* image, wxOutputStream& stream);
+
+ /// Converts from pt to size property compatible height
+ long PtToSize(long size);
+
+ /// Typical base64 encoder
+ wxChar* b64enc(unsigned char* input, size_t in_len);
+
+ /// Gets the mime type of the given wxBITMAP_TYPE
+ const wxChar* GetMimeType(int imageType);
+
+ /// Gets the html equivalent of the specified value
+ wxString GetAlignment(const wxRichTextAttr& thisStyle);
+
+ /// Generates array for indentations
+ wxString SymbolicIndent(long indent);
+
+ /// Finds the html equivalent of the specified bullet
+ int TypeOfList(const wxRichTextAttr& thisStyle, wxString& tag);
+#endif
+
+// Data members
+
+ wxRichTextBuffer* m_buffer;
+
+ /// Indentation values of the table tags
+ wxArrayInt m_indents;
+
+ /// Stack of list types: 0 = ol, 1 = ul
+ wxArrayInt m_listTypes;
+
+ /// Is there any opened font tag?
+ bool m_font;
+
+ /// Are we in a table?
+ bool m_inTable;
+
+ /// A list of the image files or in-memory images created by the last operation.
+ wxArrayString m_imageLocations;
+
+ /// A location for the temporary files
+ wxString m_tempDir;
+
+ /// A mapping from point size to HTML font size
+ wxArrayInt m_fontSizeMapping;
+
+ /// A counter for generating filenames
+ static int sm_fileCounter;
+};
+
+#endif
+ // _WX_RICHTEXTXML_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtextimagedlg.h
+// Purpose:
+// Author: Mingquan Yang
+// Modified by: Julian Smart
+// Created: Wed 02 Jun 2010 11:27:23 CST
+// RCS-ID:
+// Copyright: (c) Mingquan Yang, Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#include "wx/dialog.h"
+
+#ifndef _RICHTEXTIMAGEDLG_H_
+#define _RICHTEXTIMAGEDLG_H_
+
+/*!
+ * Forward declarations
+ */
+
+class WXDLLIMPEXP_FWD_CORE wxButton;
+class WXDLLIMPEXP_FWD_CORE wxComboBox;
+class WXDLLIMPEXP_FWD_CORE wxCheckBox;
+class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
+
+/*!
+ * Includes
+ */
+
+#include "wx/richtext/richtextbuffer.h"
+#include "wx/richtext/richtextformatdlg.h"
+
+/*!
+ * Control identifiers
+ */
+
+#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL
+#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_TITLE wxGetTranslation("Object Properties")
+#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_IDNAME ID_RICHTEXTOBJECTPROPERTIESDIALOG
+#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_SIZE wxSize(400, 300)
+#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_POSITION wxDefaultPosition
+
+/*!
+ * wxRichTextObjectPropertiesDialog class declaration
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextObjectPropertiesDialog: public wxRichTextFormattingDialog
+{
+ DECLARE_DYNAMIC_CLASS( wxRichTextObjectPropertiesDialog )
+ DECLARE_EVENT_TABLE()
+
+public:
+ /// Constructors
+ wxRichTextObjectPropertiesDialog();
+ wxRichTextObjectPropertiesDialog( wxRichTextObject* obj, wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_IDNAME, const wxString& caption = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_STYLE );
+
+ /// Creation
+ bool Create( wxRichTextObject* obj, wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_IDNAME, const wxString& caption = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_STYLE );
+
+ /// Destructor
+ ~wxRichTextObjectPropertiesDialog();
+
+ /// Initialises member variables
+ void Init();
+
+ /// Creates the controls and sizers
+ void CreateControls();
+
+////@begin wxRichTextObjectPropertiesDialog event handler declarations
+
+////@end wxRichTextObjectPropertiesDialog event handler declarations
+
+////@begin wxRichTextObjectPropertiesDialog member function declarations
+
+ /// Retrieves bitmap resources
+ wxBitmap GetBitmapResource( const wxString& name );
+
+ /// Retrieves icon resources
+ wxIcon GetIconResource( const wxString& name );
+////@end wxRichTextObjectPropertiesDialog member function declarations
+
+ /// Should we show tooltips?
+ static bool ShowToolTips();
+
+////@begin wxRichTextObjectPropertiesDialog member variables
+ /// Control identifiers
+ enum {
+ ID_RICHTEXTOBJECTPROPERTIESDIALOG = 10650
+ };
+////@end wxRichTextObjectPropertiesDialog member variables
+};
+
+#endif
+ // _RICHTEXTIMAGEDLG_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtextindentspage.h
+// Purpose:
+// Author: Julian Smart
+// Modified by:
+// Created: 10/3/2006 2:28:21 PM
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _RICHTEXTINDENTSPAGE_H_
+#define _RICHTEXTINDENTSPAGE_H_
+
+/*!
+ * Includes
+ */
+
+#include "wx/richtext/richtextdialogpage.h"
+
+////@begin includes
+#include "wx/statline.h"
+////@end includes
+
+/*!
+ * Forward declarations
+ */
+
+////@begin forward declarations
+class wxRichTextCtrl;
+////@end forward declarations
+
+/*!
+ * Control identifiers
+ */
+
+////@begin control identifiers
+#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL
+#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_TITLE wxEmptyString
+#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_IDNAME ID_RICHTEXTINDENTSSPACINGPAGE
+#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_SIZE wxSize(400, 300)
+#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_POSITION wxDefaultPosition
+////@end control identifiers
+
+/*!
+ * wxRichTextIndentsSpacingPage class declaration
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextIndentsSpacingPage: public wxRichTextDialogPage
+{
+ DECLARE_DYNAMIC_CLASS( wxRichTextIndentsSpacingPage )
+ DECLARE_EVENT_TABLE()
+ DECLARE_HELP_PROVISION()
+
+public:
+ /// Constructors
+ wxRichTextIndentsSpacingPage( );
+ wxRichTextIndentsSpacingPage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_SIZE, long style = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_STYLE );
+
+ /// Creation
+ bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_SIZE, long style = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_STYLE );
+
+ /// Initialise members
+ void Init();
+
+ /// Creates the controls and sizers
+ void CreateControls();
+
+ /// Transfer data from/to window
+ virtual bool TransferDataFromWindow();
+ virtual bool TransferDataToWindow();
+
+ /// Updates the paragraph preview
+ void UpdatePreview();
+
+ /// Gets the attributes associated with the main formatting dialog
+ wxRichTextAttr* GetAttributes();
+
+////@begin wxRichTextIndentsSpacingPage event handler declarations
+
+ /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_LEFT
+ void OnAlignmentLeftSelected( wxCommandEvent& event );
+
+ /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_RIGHT
+ void OnAlignmentRightSelected( wxCommandEvent& event );
+
+ /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_JUSTIFIED
+ void OnAlignmentJustifiedSelected( wxCommandEvent& event );
+
+ /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_CENTRED
+ void OnAlignmentCentredSelected( wxCommandEvent& event );
+
+ /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_INDETERMINATE
+ void OnAlignmentIndeterminateSelected( wxCommandEvent& event );
+
+ /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT
+ void OnIndentLeftUpdated( wxCommandEvent& event );
+
+ /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST
+ void OnIndentLeftFirstUpdated( wxCommandEvent& event );
+
+ /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT
+ void OnIndentRightUpdated( wxCommandEvent& event );
+
+ /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL
+ void OnRichtextOutlinelevelSelected( wxCommandEvent& event );
+
+ /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE
+ void OnSpacingBeforeUpdated( wxCommandEvent& event );
+
+ /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER
+ void OnSpacingAfterUpdated( wxCommandEvent& event );
+
+ /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_LINE
+ void OnSpacingLineSelected( wxCommandEvent& event );
+
+////@end wxRichTextIndentsSpacingPage event handler declarations
+
+////@begin wxRichTextIndentsSpacingPage member function declarations
+
+ /// Retrieves bitmap resources
+ wxBitmap GetBitmapResource( const wxString& name );
+
+ /// Retrieves icon resources
+ wxIcon GetIconResource( const wxString& name );
+////@end wxRichTextIndentsSpacingPage member function declarations
+
+ /// Should we show tooltips?
+ static bool ShowToolTips();
+
+////@begin wxRichTextIndentsSpacingPage member variables
+ wxRadioButton* m_alignmentLeft;
+ wxRadioButton* m_alignmentRight;
+ wxRadioButton* m_alignmentJustified;
+ wxRadioButton* m_alignmentCentred;
+ wxRadioButton* m_alignmentIndeterminate;
+ wxTextCtrl* m_indentLeft;
+ wxTextCtrl* m_indentLeftFirst;
+ wxTextCtrl* m_indentRight;
+ wxComboBox* m_outlineLevelCtrl;
+ wxTextCtrl* m_spacingBefore;
+ wxTextCtrl* m_spacingAfter;
+ wxComboBox* m_spacingLine;
+ wxCheckBox* m_pageBreakCtrl;
+ wxRichTextCtrl* m_previewCtrl;
+ /// Control identifiers
+ enum {
+ ID_RICHTEXTINDENTSSPACINGPAGE = 10100,
+ ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_LEFT = 10102,
+ ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_RIGHT = 10110,
+ ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_JUSTIFIED = 10111,
+ ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_CENTRED = 10112,
+ ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_INDETERMINATE = 10101,
+ ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT = 10103,
+ ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST = 10104,
+ ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT = 10113,
+ ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL = 10105,
+ ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE = 10114,
+ ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER = 10116,
+ ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_LINE = 10115,
+ ID_RICHTEXTINDENTSSPACINGPAGE_PAGEBREAK = 10106,
+ ID_RICHTEXTINDENTSSPACINGPAGE_PREVIEW_CTRL = 10109
+ };
+////@end wxRichTextIndentsSpacingPage member variables
+
+ bool m_dontUpdate;
+};
+
+#endif
+ // _RICHTEXTINDENTSPAGE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtextliststylepage.h
+// Purpose:
+// Author: Julian Smart
+// Modified by:
+// Created: 10/18/2006 11:36:37 AM
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _RICHTEXTLISTSTYLEPAGE_H_
+#define _RICHTEXTLISTSTYLEPAGE_H_
+
+/*!
+ * Includes
+ */
+
+#include "wx/richtext/richtextdialogpage.h"
+
+////@begin includes
+#include "wx/spinctrl.h"
+#include "wx/notebook.h"
+#include "wx/statline.h"
+////@end includes
+
+/*!
+ * Control identifiers
+ */
+
+////@begin control identifiers
+#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL
+#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_TITLE wxEmptyString
+#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_IDNAME ID_RICHTEXTLISTSTYLEPAGE
+#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_SIZE wxSize(400, 300)
+#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_POSITION wxDefaultPosition
+////@end control identifiers
+
+/*!
+ * wxRichTextListStylePage class declaration
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextListStylePage: public wxRichTextDialogPage
+{
+ DECLARE_DYNAMIC_CLASS( wxRichTextListStylePage )
+ DECLARE_EVENT_TABLE()
+ DECLARE_HELP_PROVISION()
+
+public:
+ /// Constructors
+ wxRichTextListStylePage( );
+ wxRichTextListStylePage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_STYLE );
+
+ /// Creation
+ bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_STYLE );
+
+ /// Initialises member variables
+ void Init();
+
+ /// Creates the controls and sizers
+ void CreateControls();
+
+ /// Updates the bullets preview
+ void UpdatePreview();
+
+ /// Transfer data from/to window
+ virtual bool TransferDataFromWindow();
+ virtual bool TransferDataToWindow();
+
+ /// Get attributes for selected level
+ wxRichTextAttr* GetAttributesForSelection();
+
+ /// Update for symbol-related controls
+ void OnSymbolUpdate( wxUpdateUIEvent& event );
+
+ /// Update for number-related controls
+ void OnNumberUpdate( wxUpdateUIEvent& event );
+
+ /// Update for standard bullet-related controls
+ void OnStandardBulletUpdate( wxUpdateUIEvent& event );
+
+ /// Just transfer to the window
+ void DoTransferDataToWindow();
+
+ /// Transfer from the window and preview
+ void TransferAndPreview();
+
+////@begin wxRichTextListStylePage event handler declarations
+
+ /// wxEVT_SPINCTRL event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
+ void OnLevelUpdated( wxSpinEvent& event );
+
+ /// wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
+ void OnLevelUp( wxSpinEvent& event );
+
+ /// wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
+ void OnLevelDown( wxSpinEvent& event );
+
+ /// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
+ void OnLevelTextUpdated( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
+ void OnLevelUIUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_BUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT
+ void OnChooseFontClick( wxCommandEvent& event );
+
+ /// wxEVT_LISTBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX
+ void OnStylelistboxSelected( wxCommandEvent& event );
+
+ /// wxEVT_CHECKBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
+ void OnPeriodctrlClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
+ void OnPeriodctrlUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_CHECKBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL
+ void OnParenthesesctrlClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL
+ void OnParenthesesctrlUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_CHECKBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL
+ void OnRightParenthesisCtrlClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL
+ void OnRightParenthesisCtrlUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_COMBOBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL
+ void OnBulletAlignmentCtrlSelected( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC
+ void OnSymbolstaticUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_COMBOBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL
+ void OnSymbolctrlSelected( wxCommandEvent& event );
+
+ /// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL
+ void OnSymbolctrlUpdated( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL
+ void OnSymbolctrlUIUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_BUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL
+ void OnChooseSymbolClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL
+ void OnChooseSymbolUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_COMBOBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
+ void OnSymbolfontctrlSelected( wxCommandEvent& event );
+
+ /// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
+ void OnSymbolfontctrlUpdated( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
+ void OnSymbolfontctrlUIUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC
+ void OnNamestaticUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_COMBOBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
+ void OnNamectrlSelected( wxCommandEvent& event );
+
+ /// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
+ void OnNamectrlUpdated( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
+ void OnNamectrlUIUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_RADIOBUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT
+ void OnRichtextliststylepageAlignleftSelected( wxCommandEvent& event );
+
+ /// wxEVT_RADIOBUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT
+ void OnRichtextliststylepageAlignrightSelected( wxCommandEvent& event );
+
+ /// wxEVT_RADIOBUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED
+ void OnRichtextliststylepageJustifiedSelected( wxCommandEvent& event );
+
+ /// wxEVT_RADIOBUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_CENTERED
+ void OnRichtextliststylepageCenteredSelected( wxCommandEvent& event );
+
+ /// wxEVT_RADIOBUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE
+ void OnRichtextliststylepageAlignindeterminateSelected( wxCommandEvent& event );
+
+ /// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT
+ void OnIndentLeftUpdated( wxCommandEvent& event );
+
+ /// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE
+ void OnIndentFirstLineUpdated( wxCommandEvent& event );
+
+ /// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT
+ void OnIndentRightUpdated( wxCommandEvent& event );
+
+ /// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE
+ void OnSpacingBeforeUpdated( wxCommandEvent& event );
+
+ /// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER
+ void OnSpacingAfterUpdated( wxCommandEvent& event );
+
+ /// wxEVT_COMBOBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_LINESPACING
+ void OnLineSpacingSelected( wxCommandEvent& event );
+
+////@end wxRichTextListStylePage event handler declarations
+
+////@begin wxRichTextListStylePage member function declarations
+
+ /// Retrieves bitmap resources
+ wxBitmap GetBitmapResource( const wxString& name );
+
+ /// Retrieves icon resources
+ wxIcon GetIconResource( const wxString& name );
+////@end wxRichTextListStylePage member function declarations
+
+ /// Should we show tooltips?
+ static bool ShowToolTips();
+
+////@begin wxRichTextListStylePage member variables
+ wxSpinCtrl* m_levelCtrl;
+ wxListBox* m_styleListBox;
+ wxCheckBox* m_periodCtrl;
+ wxCheckBox* m_parenthesesCtrl;
+ wxCheckBox* m_rightParenthesisCtrl;
+ wxComboBox* m_bulletAlignmentCtrl;
+ wxComboBox* m_symbolCtrl;
+ wxComboBox* m_symbolFontCtrl;
+ wxComboBox* m_bulletNameCtrl;
+ wxRadioButton* m_alignmentLeft;
+ wxRadioButton* m_alignmentRight;
+ wxRadioButton* m_alignmentJustified;
+ wxRadioButton* m_alignmentCentred;
+ wxRadioButton* m_alignmentIndeterminate;
+ wxTextCtrl* m_indentLeft;
+ wxTextCtrl* m_indentLeftFirst;
+ wxTextCtrl* m_indentRight;
+ wxTextCtrl* m_spacingBefore;
+ wxTextCtrl* m_spacingAfter;
+ wxComboBox* m_spacingLine;
+ wxRichTextCtrl* m_previewCtrl;
+ /// Control identifiers
+ enum {
+ ID_RICHTEXTLISTSTYLEPAGE = 10616,
+ ID_RICHTEXTLISTSTYLEPAGE_LEVEL = 10617,
+ ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT = 10604,
+ ID_RICHTEXTLISTSTYLEPAGE_NOTEBOOK = 10618,
+ ID_RICHTEXTLISTSTYLEPAGE_BULLETS = 10619,
+ ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX = 10620,
+ ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL = 10627,
+ ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL = 10626,
+ ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL = 10602,
+ ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL = 10603,
+ ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC = 10621,
+ ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL = 10622,
+ ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL = 10623,
+ ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL = 10625,
+ ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC = 10600,
+ ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL = 10601,
+ ID_RICHTEXTLISTSTYLEPAGE_SPACING = 10628,
+ ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT = 10629,
+ ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT = 10630,
+ ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED = 10631,
+ ID_RICHTEXTLISTSTYLEPAGE_CENTERED = 10632,
+ ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE = 10633,
+ ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT = 10634,
+ ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE = 10635,
+ ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT = 10636,
+ ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE = 10637,
+ ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER = 10638,
+ ID_RICHTEXTLISTSTYLEPAGE_LINESPACING = 10639,
+ ID_RICHTEXTLISTSTYLEPAGE_RICHTEXTCTRL = 10640
+ };
+////@end wxRichTextListStylePage member variables
+
+ bool m_dontUpdate;
+ int m_currentLevel;
+};
+
+#endif
+ // _RICHTEXTLISTSTYLEPAGE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtextmarginspage.h
+// Purpose:
+// Author: Julian Smart
+// Modified by:
+// Created: 20/10/2010 10:27:34
+// RCS-ID:
+// Copyright: (c) Julian Smart
+// Licence:
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _RICHTEXTMARGINSPAGE_H_
+#define _RICHTEXTMARGINSPAGE_H_
+
+
+/*!
+ * Includes
+ */
+
+#include "wx/richtext/richtextdialogpage.h"
+
+////@begin includes
+#include "wx/statline.h"
+////@end includes
+
+/*!
+ * Forward declarations
+ */
+
+////@begin forward declarations
+////@end forward declarations
+
+/*!
+ * Control identifiers
+ */
+
+////@begin control identifiers
+#define SYMBOL_WXRICHTEXTMARGINSPAGE_STYLE wxTAB_TRAVERSAL
+#define SYMBOL_WXRICHTEXTMARGINSPAGE_TITLE wxEmptyString
+#define SYMBOL_WXRICHTEXTMARGINSPAGE_IDNAME ID_WXRICHTEXTMARGINSPAGE
+#define SYMBOL_WXRICHTEXTMARGINSPAGE_SIZE wxSize(400, 300)
+#define SYMBOL_WXRICHTEXTMARGINSPAGE_POSITION wxDefaultPosition
+////@end control identifiers
+
+
+/*!
+ * wxRichTextMarginsPage class declaration
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextMarginsPage: public wxRichTextDialogPage
+{
+ DECLARE_DYNAMIC_CLASS( wxRichTextMarginsPage )
+ DECLARE_EVENT_TABLE()
+ DECLARE_HELP_PROVISION()
+
+public:
+ /// Constructors
+ wxRichTextMarginsPage();
+ wxRichTextMarginsPage( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTMARGINSPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTMARGINSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTMARGINSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTMARGINSPAGE_STYLE );
+
+ /// Creation
+ bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTMARGINSPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTMARGINSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTMARGINSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTMARGINSPAGE_STYLE );
+
+ /// Destructor
+ ~wxRichTextMarginsPage();
+
+ /// Initialises member variables
+ void Init();
+
+ /// Creates the controls and sizers
+ void CreateControls();
+
+ /// Gets the attributes from the formatting dialog
+ wxRichTextAttr* GetAttributes();
+
+ /// Data transfer
+ virtual bool TransferDataToWindow();
+ virtual bool TransferDataFromWindow();
+
+////@begin wxRichTextMarginsPage event handler declarations
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT_MARGIN
+ void OnRichtextLeftMarginUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT_MARGIN
+ void OnRichtextRightMarginUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_TOP_MARGIN
+ void OnRichtextTopMarginUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM_MARGIN
+ void OnRichtextBottomMarginUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT_PADDING
+ void OnRichtextLeftPaddingUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT_PADDING
+ void OnRichtextRightPaddingUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_TOP_PADDING
+ void OnRichtextTopPaddingUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM_PADDING
+ void OnRichtextBottomPaddingUpdate( wxUpdateUIEvent& event );
+
+////@end wxRichTextMarginsPage event handler declarations
+
+////@begin wxRichTextMarginsPage member function declarations
+
+ /// Retrieves bitmap resources
+ wxBitmap GetBitmapResource( const wxString& name );
+
+ /// Retrieves icon resources
+ wxIcon GetIconResource( const wxString& name );
+////@end wxRichTextMarginsPage member function declarations
+
+ /// Should we show tooltips?
+ static bool ShowToolTips();
+
+////@begin wxRichTextMarginsPage member variables
+ wxCheckBox* m_leftMarginCheckbox;
+ wxTextCtrl* m_marginLeft;
+ wxComboBox* m_unitsMarginLeft;
+ wxCheckBox* m_rightMarginCheckbox;
+ wxTextCtrl* m_marginRight;
+ wxComboBox* m_unitsMarginRight;
+ wxCheckBox* m_topMarginCheckbox;
+ wxTextCtrl* m_marginTop;
+ wxComboBox* m_unitsMarginTop;
+ wxCheckBox* m_bottomMarginCheckbox;
+ wxTextCtrl* m_marginBottom;
+ wxComboBox* m_unitsMarginBottom;
+ wxCheckBox* m_leftPaddingCheckbox;
+ wxTextCtrl* m_paddingLeft;
+ wxComboBox* m_unitsPaddingLeft;
+ wxCheckBox* m_rightPaddingCheckbox;
+ wxTextCtrl* m_paddingRight;
+ wxComboBox* m_unitsPaddingRight;
+ wxCheckBox* m_topPaddingCheckbox;
+ wxTextCtrl* m_paddingTop;
+ wxComboBox* m_unitsPaddingTop;
+ wxCheckBox* m_bottomPaddingCheckbox;
+ wxTextCtrl* m_paddingBottom;
+ wxComboBox* m_unitsPaddingBottom;
+ /// Control identifiers
+ enum {
+ ID_WXRICHTEXTMARGINSPAGE = 10750,
+ ID_RICHTEXT_LEFT_MARGIN_CHECKBOX = 10751,
+ ID_RICHTEXT_LEFT_MARGIN = 10752,
+ ID_RICHTEXT_LEFT_MARGIN_UNITS = 10753,
+ ID_RICHTEXT_RIGHT_MARGIN_CHECKBOX = 10754,
+ ID_RICHTEXT_RIGHT_MARGIN = 10755,
+ ID_RICHTEXT_RIGHT_MARGIN_UNITS = 10756,
+ ID_RICHTEXT_TOP_MARGIN_CHECKBOX = 10757,
+ ID_RICHTEXT_TOP_MARGIN = 10758,
+ ID_RICHTEXT_TOP_MARGIN_UNITS = 10759,
+ ID_RICHTEXT_BOTTOM_MARGIN_CHECKBOX = 10760,
+ ID_RICHTEXT_BOTTOM_MARGIN = 10761,
+ ID_RICHTEXT_BOTTOM_MARGIN_UNITS = 10762,
+ ID_RICHTEXT_LEFT_PADDING_CHECKBOX = 10763,
+ ID_RICHTEXT_LEFT_PADDING = 10764,
+ ID_RICHTEXT_LEFT_PADDING_UNITS = 10765,
+ ID_RICHTEXT_RIGHT_PADDING_CHECKBOX = 10766,
+ ID_RICHTEXT_RIGHT_PADDING = 10767,
+ ID_RICHTEXT_RIGHT_PADDING_UNITS = 10768,
+ ID_RICHTEXT_TOP_PADDING_CHECKBOX = 10769,
+ ID_RICHTEXT_TOP_PADDING = 10770,
+ ID_RICHTEXT_TOP_PADDING_UNITS = 10771,
+ ID_RICHTEXT_BOTTOM_PADDING_CHECKBOX = 10772,
+ ID_RICHTEXT_BOTTOM_PADDING = 10773,
+ ID_RICHTEXT_BOTTOM_PADDING_UNITS = 10774
+ };
+////@end wxRichTextMarginsPage member variables
+
+ bool m_ignoreUpdates;
+};
+
+#endif
+ // _RICHTEXTMARGINSPAGE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtextprint.h
+// Purpose: Rich text printing classes
+// Author: Julian Smart
+// Created: 2006-10-23
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RICHTEXTPRINT_H_
+#define _WX_RICHTEXTPRINT_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_RICHTEXT & wxUSE_PRINTING_ARCHITECTURE
+
+#include "wx/richtext/richtextbuffer.h"
+
+#include "wx/print.h"
+#include "wx/printdlg.h"
+
+#define wxRICHTEXT_PRINT_MAX_PAGES 99999
+
+// Header/footer page identifiers
+enum wxRichTextOddEvenPage {
+ wxRICHTEXT_PAGE_ODD,
+ wxRICHTEXT_PAGE_EVEN,
+ wxRICHTEXT_PAGE_ALL
+};
+
+// Header/footer text locations
+enum wxRichTextPageLocation {
+ wxRICHTEXT_PAGE_LEFT,
+ wxRICHTEXT_PAGE_CENTRE,
+ wxRICHTEXT_PAGE_RIGHT
+};
+
+/*!
+ * Header/footer data
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextHeaderFooterData: public wxObject
+{
+public:
+ wxRichTextHeaderFooterData() { Init(); }
+ wxRichTextHeaderFooterData(const wxRichTextHeaderFooterData& data): wxObject() { Copy(data); }
+
+ /// Initialise
+ void Init() { m_headerMargin = 20; m_footerMargin = 20; m_showOnFirstPage = true; }
+
+ /// Copy
+ void Copy(const wxRichTextHeaderFooterData& data);
+
+ /// Assignment
+ void operator= (const wxRichTextHeaderFooterData& data) { Copy(data); }
+
+ /// Set/get header text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT
+ void SetHeaderText(const wxString& text, wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE);
+ wxString GetHeaderText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const;
+
+ /// Set/get footer text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT
+ void SetFooterText(const wxString& text, wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE);
+ wxString GetFooterText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const;
+
+ /// Set/get text
+ void SetText(const wxString& text, int headerFooter, wxRichTextOddEvenPage page, wxRichTextPageLocation location);
+ wxString GetText(int headerFooter, wxRichTextOddEvenPage page, wxRichTextPageLocation location) const;
+
+ /// Set/get margins between text and header or footer, in tenths of a millimeter
+ void SetMargins(int headerMargin, int footerMargin) { m_headerMargin = headerMargin; m_footerMargin = footerMargin; }
+ int GetHeaderMargin() const { return m_headerMargin; }
+ int GetFooterMargin() const { return m_footerMargin; }
+
+ /// Set/get whether to show header or footer on first page
+ void SetShowOnFirstPage(bool showOnFirstPage) { m_showOnFirstPage = showOnFirstPage; }
+ bool GetShowOnFirstPage() const { return m_showOnFirstPage; }
+
+ /// Clear all text
+ void Clear();
+
+ /// Set/get font
+ void SetFont(const wxFont& font) { m_font = font; }
+ const wxFont& GetFont() const { return m_font; }
+
+ /// Set/get colour
+ void SetTextColour(const wxColour& col) { m_colour = col; }
+ const wxColour& GetTextColour() const { return m_colour; }
+
+ DECLARE_CLASS(wxRichTextHeaderFooterData)
+
+private:
+
+ // Strings for left, centre, right, top, bottom, odd, even
+ wxString m_text[12];
+ wxFont m_font;
+ wxColour m_colour;
+ int m_headerMargin;
+ int m_footerMargin;
+ bool m_showOnFirstPage;
+};
+
+/*!
+ * wxRichTextPrintout
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextPrintout : public wxPrintout
+{
+public:
+ wxRichTextPrintout(const wxString& title = wxGetTranslation("Printout"));
+ virtual ~wxRichTextPrintout();
+
+ /// The buffer to print
+ void SetRichTextBuffer(wxRichTextBuffer* buffer) { m_richTextBuffer = buffer; }
+ wxRichTextBuffer* GetRichTextBuffer() const { return m_richTextBuffer; }
+
+ /// Set/get header/footer data
+ void SetHeaderFooterData(const wxRichTextHeaderFooterData& data) { m_headerFooterData = data; }
+ const wxRichTextHeaderFooterData& GetHeaderFooterData() const { return m_headerFooterData; }
+
+ /// Sets margins in 10ths of millimetre. Defaults to 1 inch for margins.
+ void SetMargins(int top = 254, int bottom = 254, int left = 254, int right = 254);
+
+ /// Calculate scaling and rectangles, setting the device context scaling
+ void CalculateScaling(wxDC* dc, wxRect& textRect, wxRect& headerRect, wxRect& footerRect);
+
+ // wxPrintout virtual functions
+ virtual bool OnPrintPage(int page);
+ virtual bool HasPage(int page);
+ virtual void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo);
+ virtual bool OnBeginDocument(int startPage, int endPage);
+ virtual void OnPreparePrinting();
+
+private:
+
+ /// Renders one page into dc
+ void RenderPage(wxDC *dc, int page);
+
+ /// Substitute keywords
+ static bool SubstituteKeywords(wxString& str, const wxString& title, int pageNum, int pageCount);
+
+private:
+
+ wxRichTextBuffer* m_richTextBuffer;
+ int m_numPages;
+ wxArrayInt m_pageBreaksStart;
+ wxArrayInt m_pageBreaksEnd;
+ wxArrayInt m_pageYOffsets;
+ int m_marginLeft, m_marginTop, m_marginRight, m_marginBottom;
+
+ wxRichTextHeaderFooterData m_headerFooterData;
+
+ wxDECLARE_NO_COPY_CLASS(wxRichTextPrintout);
+};
+
+/*
+ *! wxRichTextPrinting
+ * A simple interface to perform wxRichTextBuffer printing.
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextPrinting : public wxObject
+{
+public:
+ wxRichTextPrinting(const wxString& name = wxGetTranslation("Printing"), wxWindow *parentWindow = NULL);
+ virtual ~wxRichTextPrinting();
+
+ /// Preview the file or buffer
+#if wxUSE_FFILE && wxUSE_STREAMS
+ bool PreviewFile(const wxString& richTextFile);
+#endif
+ bool PreviewBuffer(const wxRichTextBuffer& buffer);
+
+ /// Print the file or buffer
+#if wxUSE_FFILE && wxUSE_STREAMS
+ bool PrintFile(const wxString& richTextFile, bool showPrintDialog = true);
+#endif
+ bool PrintBuffer(const wxRichTextBuffer& buffer, bool showPrintDialog = true);
+
+ /// Shows page setup dialog
+ void PageSetup();
+
+ /// Set/get header/footer data
+ void SetHeaderFooterData(const wxRichTextHeaderFooterData& data) { m_headerFooterData = data; }
+ const wxRichTextHeaderFooterData& GetHeaderFooterData() const { return m_headerFooterData; }
+
+ /// Set/get header text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT
+ void SetHeaderText(const wxString& text, wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE);
+ wxString GetHeaderText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const;
+
+ /// Set/get footer text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT
+ void SetFooterText(const wxString& text, wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE);
+ wxString GetFooterText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const;
+
+ /// Show header/footer on first page, or not
+ void SetShowOnFirstPage(bool show) { m_headerFooterData.SetShowOnFirstPage(show); }
+
+ /// Set the font
+ void SetHeaderFooterFont(const wxFont& font) { m_headerFooterData.SetFont(font); }
+
+ /// Set the colour
+ void SetHeaderFooterTextColour(const wxColour& font) { m_headerFooterData.SetTextColour(font); }
+
+ /// Get print and page setup data
+ wxPrintData *GetPrintData();
+ wxPageSetupDialogData *GetPageSetupData() { return m_pageSetupData; }
+
+ /// Set print and page setup data
+ void SetPrintData(const wxPrintData& printData);
+ void SetPageSetupData(const wxPageSetupDialogData& pageSetupData);
+
+ /// Set the rich text buffer pointer, deleting the existing object if present
+ void SetRichTextBufferPreview(wxRichTextBuffer* buf);
+ wxRichTextBuffer* GetRichTextBufferPreview() const { return m_richTextBufferPreview; }
+
+ void SetRichTextBufferPrinting(wxRichTextBuffer* buf);
+ wxRichTextBuffer* GetRichTextBufferPrinting() const { return m_richTextBufferPrinting; }
+
+ /// Set/get the parent window
+ void SetParentWindow(wxWindow* parent) { m_parentWindow = parent; }
+ wxWindow* GetParentWindow() const { return m_parentWindow; }
+
+ /// Set/get the title
+ void SetTitle(const wxString& title) { m_title = title; }
+ const wxString& GetTitle() const { return m_title; }
+
+ /// Set/get the preview rect
+ void SetPreviewRect(const wxRect& rect) { m_previewRect = rect; }
+ const wxRect& GetPreviewRect() const { return m_previewRect; }
+
+protected:
+ virtual wxRichTextPrintout *CreatePrintout();
+ virtual bool DoPreview(wxRichTextPrintout *printout1, wxRichTextPrintout *printout2);
+ virtual bool DoPrint(wxRichTextPrintout *printout, bool showPrintDialog);
+
+private:
+ wxPrintData* m_printData;
+ wxPageSetupDialogData* m_pageSetupData;
+
+ wxRichTextHeaderFooterData m_headerFooterData;
+ wxString m_title;
+ wxWindow* m_parentWindow;
+ wxRichTextBuffer* m_richTextBufferPreview;
+ wxRichTextBuffer* m_richTextBufferPrinting;
+ wxRect m_previewRect;
+
+ wxDECLARE_NO_COPY_CLASS(wxRichTextPrinting);
+};
+
+#endif // wxUSE_RICHTEXT & wxUSE_PRINTING_ARCHITECTURE
+
+#endif // _WX_RICHTEXTPRINT_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtextsizepage.h
+// Purpose:
+// Author: Julian Smart
+// Modified by:
+// Created: 20/10/2010 10:23:24
+// RCS-ID:
+// Copyright: (c) Julian Smart
+// Licence:
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _RICHTEXTSIZEPAGE_H_
+#define _RICHTEXTSIZEPAGE_H_
+
+/*!
+ * Includes
+ */
+
+#include "wx/richtext/richtextdialogpage.h"
+#include "wx/sizer.h"
+
+////@begin includes
+#include "wx/statline.h"
+#include "wx/valgen.h"
+////@end includes
+#include "wx/stattext.h"
+
+/*!
+ * Forward declarations
+ */
+
+
+/*!
+ * Control identifiers
+ */
+
+////@begin control identifiers
+#define SYMBOL_WXRICHTEXTSIZEPAGE_STYLE wxTAB_TRAVERSAL
+#define SYMBOL_WXRICHTEXTSIZEPAGE_TITLE wxEmptyString
+#define SYMBOL_WXRICHTEXTSIZEPAGE_IDNAME ID_WXRICHTEXTSIZEPAGE
+#define SYMBOL_WXRICHTEXTSIZEPAGE_SIZE wxSize(400, 300)
+#define SYMBOL_WXRICHTEXTSIZEPAGE_POSITION wxDefaultPosition
+////@end control identifiers
+
+
+/*!
+ * wxRichTextSizePage class declaration
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextSizePage: public wxRichTextDialogPage
+{
+ DECLARE_DYNAMIC_CLASS( wxRichTextSizePage )
+ DECLARE_EVENT_TABLE()
+ DECLARE_HELP_PROVISION()
+
+public:
+ /// Constructors
+ wxRichTextSizePage();
+ wxRichTextSizePage( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTSIZEPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTSIZEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSIZEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTSIZEPAGE_STYLE );
+
+ /// Creation
+ bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTSIZEPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTSIZEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSIZEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTSIZEPAGE_STYLE );
+
+ /// Destructor
+ ~wxRichTextSizePage();
+
+ /// Initialises member variables
+ void Init();
+
+ /// Creates the controls and sizers
+ void CreateControls();
+
+ /// Gets the attributes from the formatting dialog
+ wxRichTextAttr* GetAttributes();
+
+ /// Data transfer
+ virtual bool TransferDataToWindow();
+ virtual bool TransferDataFromWindow();
+
+ /// Show/hide position controls
+ static void ShowPositionControls(bool show) { sm_showPositionControls = show; }
+
+ /// Show/hide minimum and maximum size controls
+ static void ShowMinMaxSizeControls(bool show) { sm_showMinMaxSizeControls = show; }
+
+ /// Show/hide position mode controls
+ static void ShowPositionModeControls(bool show) { sm_showPositionModeControls = show; }
+
+ /// Show/hide right/bottom position controls
+ static void ShowRightBottomPositionControls(bool show) { sm_showRightBottomPositionControls = show; }
+
+ /// Show/hide floating and alignment controls
+ static void ShowFloatingAndAlignmentControls(bool show) { sm_showFloatingAndAlignmentControls = show; }
+
+ /// Show/hide floating controls
+ static void ShowFloatingControls(bool show) { sm_showFloatingControls = show; }
+
+ /// Show/hide alignment controls
+ static void ShowAlignmentControls(bool show) { sm_showAlignmentControls = show; }
+
+ /// Enable the position and size units
+ static void EnablePositionAndSizeUnits(bool enable) { sm_enablePositionAndSizeUnits = enable; }
+
+ /// Enable the checkboxes for position and size
+ static void EnablePositionAndSizeCheckboxes(bool enable) { sm_enablePositionAndSizeCheckboxes = enable; }
+
+////@begin wxRichTextSizePage event handler declarations
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX
+ void OnRichtextVerticalAlignmentComboboxUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_WIDTH
+ void OnRichtextWidthUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_UNITS_W
+ void OnRichtextWidthUnitsUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_HEIGHT
+ void OnRichtextHeightUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_UNITS_H
+ void OnRichtextHeightUnitsUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_WIDTH
+ void OnRichtextMinWidthUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_HEIGHT
+ void OnRichtextMinHeightUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_WIDTH
+ void OnRichtextMaxWidthUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_HEIGHT
+ void OnRichtextMaxHeightUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT
+ void OnRichtextLeftUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT_UNITS
+ void OnRichtextLeftUnitsUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_TOP
+ void OnRichtextTopUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_TOP_UNITS
+ void OnRichtextTopUnitsUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT
+ void OnRichtextRightUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT_UNITS
+ void OnRichtextRightUnitsUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM
+ void OnRichtextBottomUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM_UNITS
+ void OnRichtextBottomUnitsUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_PARA_UP
+ void OnRichtextParaUpClick( wxCommandEvent& event );
+
+ /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_PARA_DOWN
+ void OnRichtextParaDownClick( wxCommandEvent& event );
+
+////@end wxRichTextSizePage event handler declarations
+
+////@begin wxRichTextSizePage member function declarations
+
+ int GetPositionMode() const { return m_positionMode ; }
+ void SetPositionMode(int value) { m_positionMode = value ; }
+
+ /// Retrieves bitmap resources
+ wxBitmap GetBitmapResource( const wxString& name );
+
+ /// Retrieves icon resources
+ wxIcon GetIconResource( const wxString& name );
+////@end wxRichTextSizePage member function declarations
+
+ /// Should we show tooltips?
+ static bool ShowToolTips();
+
+////@begin wxRichTextSizePage member variables
+ wxBoxSizer* m_parentSizer;
+ wxBoxSizer* m_floatingAlignmentSizer;
+ wxBoxSizer* m_floatingSizer;
+ wxChoice* m_float;
+ wxBoxSizer* m_alignmentSizer;
+ wxCheckBox* m_verticalAlignmentCheckbox;
+ wxChoice* m_verticalAlignmentComboBox;
+ wxFlexGridSizer* m_sizeSizer;
+ wxBoxSizer* m_widthSizer;
+ wxCheckBox* m_widthCheckbox;
+ wxStaticText* m_widthLabel;
+ wxTextCtrl* m_width;
+ wxComboBox* m_unitsW;
+ wxBoxSizer* m_heightSizer;
+ wxCheckBox* m_heightCheckbox;
+ wxStaticText* m_heightLabel;
+ wxTextCtrl* m_height;
+ wxComboBox* m_unitsH;
+ wxCheckBox* m_minWidthCheckbox;
+ wxBoxSizer* m_minWidthSizer;
+ wxTextCtrl* m_minWidth;
+ wxComboBox* m_unitsMinW;
+ wxCheckBox* m_minHeightCheckbox;
+ wxBoxSizer* m_minHeightSizer;
+ wxTextCtrl* m_minHeight;
+ wxComboBox* m_unitsMinH;
+ wxCheckBox* m_maxWidthCheckbox;
+ wxBoxSizer* m_maxWidthSizer;
+ wxTextCtrl* m_maxWidth;
+ wxComboBox* m_unitsMaxW;
+ wxCheckBox* m_maxHeightCheckbox;
+ wxBoxSizer* m_maxHeightSizer;
+ wxTextCtrl* m_maxHeight;
+ wxComboBox* m_unitsMaxH;
+ wxBoxSizer* m_positionControls;
+ wxBoxSizer* m_moveObjectParentSizer;
+ wxBoxSizer* m_positionModeSizer;
+ wxChoice* m_positionModeCtrl;
+ wxFlexGridSizer* m_positionGridSizer;
+ wxBoxSizer* m_leftSizer;
+ wxCheckBox* m_positionLeftCheckbox;
+ wxStaticText* m_leftLabel;
+ wxTextCtrl* m_left;
+ wxComboBox* m_unitsLeft;
+ wxBoxSizer* m_topSizer;
+ wxCheckBox* m_positionTopCheckbox;
+ wxStaticText* m_topLabel;
+ wxTextCtrl* m_top;
+ wxComboBox* m_unitsTop;
+ wxBoxSizer* m_rightSizer;
+ wxCheckBox* m_positionRightCheckbox;
+ wxStaticText* m_rightLabel;
+ wxBoxSizer* m_rightPositionSizer;
+ wxTextCtrl* m_right;
+ wxComboBox* m_unitsRight;
+ wxBoxSizer* m_bottomSizer;
+ wxCheckBox* m_positionBottomCheckbox;
+ wxStaticText* m_bottomLabel;
+ wxBoxSizer* m_bottomPositionSizer;
+ wxTextCtrl* m_bottom;
+ wxComboBox* m_unitsBottom;
+ wxBoxSizer* m_moveObjectSizer;
+ int m_positionMode;
+ /// Control identifiers
+ enum {
+ ID_WXRICHTEXTSIZEPAGE = 10700,
+ ID_RICHTEXT_FLOATING_MODE = 10701,
+ ID_RICHTEXT_VERTICAL_ALIGNMENT_CHECKBOX = 10708,
+ ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX = 10709,
+ ID_RICHTEXT_WIDTH_CHECKBOX = 10702,
+ ID_RICHTEXT_WIDTH = 10703,
+ ID_RICHTEXT_UNITS_W = 10704,
+ ID_RICHTEXT_HEIGHT_CHECKBOX = 10705,
+ ID_RICHTEXT_HEIGHT = 10706,
+ ID_RICHTEXT_UNITS_H = 10707,
+ ID_RICHTEXT_MIN_WIDTH_CHECKBOX = 10715,
+ ID_RICHTEXT_MIN_WIDTH = 10716,
+ ID_RICHTEXT_UNITS_MIN_W = 10717,
+ ID_RICHTEXT_MIN_HEIGHT_CHECKBOX = 10718,
+ ID_RICHTEXT_MIN_HEIGHT = 10719,
+ ID_RICHTEXT_UNITS_MIN_H = 10720,
+ ID_RICHTEXT_MAX_WIDTH_CHECKBOX = 10721,
+ ID_RICHTEXT_MAX_WIDTH = 10722,
+ ID_RICHTEXT_UNITS_MAX_W = 10723,
+ ID_RICHTEXT_MAX_HEIGHT_CHECKBOX = 10724,
+ ID_RICHTEXT_MAX_HEIGHT = 10725,
+ ID_RICHTEXT_UNITS_MAX_H = 10726,
+ ID_RICHTEXT_POSITION_MODE = 10735,
+ ID_RICHTEXT_LEFT_CHECKBOX = 10710,
+ ID_RICHTEXT_LEFT = 10711,
+ ID_RICHTEXT_LEFT_UNITS = 10712,
+ ID_RICHTEXT_TOP_CHECKBOX = 10710,
+ ID_RICHTEXT_TOP = 10728,
+ ID_RICHTEXT_TOP_UNITS = 10729,
+ ID_RICHTEXT_RIGHT_CHECKBOX = 10727,
+ ID_RICHTEXT_RIGHT = 10730,
+ ID_RICHTEXT_RIGHT_UNITS = 10731,
+ ID_RICHTEXT_BOTTOM_CHECKBOX = 10732,
+ ID_RICHTEXT_BOTTOM = 10733,
+ ID_RICHTEXT_BOTTOM_UNITS = 10734,
+ ID_RICHTEXT_PARA_UP = 10713,
+ ID_RICHTEXT_PARA_DOWN = 10714
+ };
+////@end wxRichTextSizePage member variables
+
+ static bool sm_showFloatingControls;
+ static bool sm_showPositionControls;
+ static bool sm_showMinMaxSizeControls;
+ static bool sm_showPositionModeControls;
+ static bool sm_showRightBottomPositionControls;
+ static bool sm_showAlignmentControls;
+ static bool sm_showFloatingAndAlignmentControls;
+ static bool sm_enablePositionAndSizeUnits;
+ static bool sm_enablePositionAndSizeCheckboxes;
+};
+
+#endif
+ // _RICHTEXTSIZEPAGE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtextstyledlg.h
+// Purpose:
+// Author: Julian Smart
+// Modified by:
+// Created: 10/5/2006 12:05:31 PM
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _RICHTEXTSTYLEDLG_H_
+#define _RICHTEXTSTYLEDLG_H_
+
+/*!
+ * Includes
+ */
+
+#include "wx/richtext/richtextuicustomization.h"
+
+////@begin includes
+////@end includes
+
+#include "wx/richtext/richtextbuffer.h"
+#include "wx/richtext/richtextstyles.h"
+#include "wx/richtext/richtextctrl.h"
+
+/*!
+ * Forward declarations
+ */
+
+////@begin forward declarations
+class wxBoxSizer;
+class wxRichTextStyleListCtrl;
+class wxRichTextCtrl;
+class wxStdDialogButtonSizer;
+////@end forward declarations
+
+class WXDLLIMPEXP_FWD_CORE wxButton;
+class WXDLLIMPEXP_FWD_CORE wxCheckBox;
+
+/*!
+ * Control identifiers
+ */
+
+#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
+#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE wxGetTranslation("Style Organiser")
+#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_IDNAME ID_RICHTEXTSTYLEORGANISERDIALOG
+#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE wxSize(400, 300)
+#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION wxDefaultPosition
+
+/*!
+ * Flags for specifying permitted operations
+ */
+
+#define wxRICHTEXT_ORGANISER_DELETE_STYLES 0x0001
+#define wxRICHTEXT_ORGANISER_CREATE_STYLES 0x0002
+#define wxRICHTEXT_ORGANISER_APPLY_STYLES 0x0004
+#define wxRICHTEXT_ORGANISER_EDIT_STYLES 0x0008
+#define wxRICHTEXT_ORGANISER_RENAME_STYLES 0x0010
+#define wxRICHTEXT_ORGANISER_OK_CANCEL 0x0020
+#define wxRICHTEXT_ORGANISER_RENUMBER 0x0040
+
+// The permitted style types to show
+#define wxRICHTEXT_ORGANISER_SHOW_CHARACTER 0x0100
+#define wxRICHTEXT_ORGANISER_SHOW_PARAGRAPH 0x0200
+#define wxRICHTEXT_ORGANISER_SHOW_LIST 0x0400
+#define wxRICHTEXT_ORGANISER_SHOW_BOX 0x0800
+#define wxRICHTEXT_ORGANISER_SHOW_ALL 0x1000
+
+// Common combinations
+#define wxRICHTEXT_ORGANISER_ORGANISE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_DELETE_STYLES|wxRICHTEXT_ORGANISER_CREATE_STYLES|wxRICHTEXT_ORGANISER_APPLY_STYLES|wxRICHTEXT_ORGANISER_EDIT_STYLES|wxRICHTEXT_ORGANISER_RENAME_STYLES)
+#define wxRICHTEXT_ORGANISER_BROWSE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_OK_CANCEL)
+#define wxRICHTEXT_ORGANISER_BROWSE_NUMBERING (wxRICHTEXT_ORGANISER_SHOW_LIST|wxRICHTEXT_ORGANISER_OK_CANCEL|wxRICHTEXT_ORGANISER_RENUMBER)
+
+/*!
+ * wxRichTextStyleOrganiserDialog class declaration
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextStyleOrganiserDialog: public wxDialog
+{
+ DECLARE_DYNAMIC_CLASS( wxRichTextStyleOrganiserDialog )
+ DECLARE_EVENT_TABLE()
+ DECLARE_HELP_PROVISION()
+
+public:
+ /// Constructors
+ wxRichTextStyleOrganiserDialog( );
+ wxRichTextStyleOrganiserDialog( int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl, wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE );
+
+ /// Creation
+ bool Create( int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl, wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE );
+
+ /// Creates the controls and sizers
+ void CreateControls();
+
+ /// Initialise member variables
+ void Init();
+
+ /// Transfer data from/to window
+ virtual bool TransferDataFromWindow();
+ virtual bool TransferDataToWindow();
+
+ /// Set/get style sheet
+ void SetStyleSheet(wxRichTextStyleSheet* sheet) { m_richTextStyleSheet = sheet; }
+ wxRichTextStyleSheet* GetStyleSheet() const { return m_richTextStyleSheet; }
+
+ /// Set/get control
+ void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_richTextCtrl = ctrl; }
+ wxRichTextCtrl* GetRichTextCtrl() const { return m_richTextCtrl; }
+
+ /// Set/get flags
+ void SetFlags(int flags) { m_flags = flags; }
+ int GetFlags() const { return m_flags; }
+
+ /// Show preview for given or selected preview
+ void ShowPreview(int sel = -1);
+
+ /// Clears the preview
+ void ClearPreview();
+
+ /// List selection
+ void OnListSelection(wxCommandEvent& event);
+
+ /// Get/set restart numbering boolean
+ bool GetRestartNumbering() const { return m_restartNumbering; }
+ void SetRestartNumbering(bool restartNumbering) { m_restartNumbering = restartNumbering; }
+
+ /// Get selected style name or definition
+ wxString GetSelectedStyle() const;
+ wxRichTextStyleDefinition* GetSelectedStyleDefinition() const;
+
+ /// Apply the style
+ bool ApplyStyle(wxRichTextCtrl* ctrl = NULL);
+
+ /// Should we show tooltips?
+ static bool ShowToolTips() { return sm_showToolTips; }
+
+ /// Determines whether tooltips will be shown
+ static void SetShowToolTips(bool show) { sm_showToolTips = show; }
+
+////@begin wxRichTextStyleOrganiserDialog event handler declarations
+
+ /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR
+ void OnNewCharClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR
+ void OnNewCharUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA
+ void OnNewParaClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA
+ void OnNewParaUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST
+ void OnNewListClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST
+ void OnNewListUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX
+ void OnNewBoxClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX
+ void OnNewBoxUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
+ void OnApplyClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
+ void OnApplyUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
+ void OnRenameClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
+ void OnRenameUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
+ void OnEditClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
+ void OnEditUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
+ void OnDeleteClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
+ void OnDeleteUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_BUTTON event handler for wxID_HELP
+ void OnHelpClick( wxCommandEvent& event );
+
+////@end wxRichTextStyleOrganiserDialog event handler declarations
+
+////@begin wxRichTextStyleOrganiserDialog member function declarations
+
+ /// Retrieves bitmap resources
+ wxBitmap GetBitmapResource( const wxString& name );
+
+ /// Retrieves icon resources
+ wxIcon GetIconResource( const wxString& name );
+////@end wxRichTextStyleOrganiserDialog member function declarations
+
+////@begin wxRichTextStyleOrganiserDialog member variables
+ wxBoxSizer* m_innerSizer;
+ wxBoxSizer* m_buttonSizerParent;
+ wxRichTextStyleListCtrl* m_stylesListBox;
+ wxRichTextCtrl* m_previewCtrl;
+ wxBoxSizer* m_buttonSizer;
+ wxButton* m_newCharacter;
+ wxButton* m_newParagraph;
+ wxButton* m_newList;
+ wxButton* m_newBox;
+ wxButton* m_applyStyle;
+ wxButton* m_renameStyle;
+ wxButton* m_editStyle;
+ wxButton* m_deleteStyle;
+ wxButton* m_closeButton;
+ wxBoxSizer* m_bottomButtonSizer;
+ wxCheckBox* m_restartNumberingCtrl;
+ wxStdDialogButtonSizer* m_stdButtonSizer;
+ wxButton* m_okButton;
+ wxButton* m_cancelButton;
+ /// Control identifiers
+ enum {
+ ID_RICHTEXTSTYLEORGANISERDIALOG = 10500,
+ ID_RICHTEXTSTYLEORGANISERDIALOG_STYLES = 10501,
+ ID_RICHTEXTSTYLEORGANISERDIALOG_CURRENT_STYLE = 10510,
+ ID_RICHTEXTSTYLEORGANISERDIALOG_PREVIEW = 10509,
+ ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR = 10504,
+ ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA = 10505,
+ ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST = 10508,
+ ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX = 10512,
+ ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY = 10503,
+ ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME = 10502,
+ ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT = 10506,
+ ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE = 10507,
+ ID_RICHTEXTSTYLEORGANISERDIALOG_RESTART_NUMBERING = 10511
+ };
+////@end wxRichTextStyleOrganiserDialog member variables
+
+private:
+
+ wxRichTextCtrl* m_richTextCtrl;
+ wxRichTextStyleSheet* m_richTextStyleSheet;
+
+ bool m_dontUpdate;
+ int m_flags;
+ static bool sm_showToolTips;
+ bool m_restartNumbering;
+};
+
+#endif
+ // _RICHTEXTSTYLEDLG_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtextstylepage.h
+// Purpose:
+// Author: Julian Smart
+// Modified by:
+// Created: 10/5/2006 11:34:55 AM
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _RICHTEXTSTYLEPAGE_H_
+#define _RICHTEXTSTYLEPAGE_H_
+
+#include "wx/richtext/richtextdialogpage.h"
+
+/*!
+ * Control identifiers
+ */
+
+////@begin control identifiers
+#define SYMBOL_WXRICHTEXTSTYLEPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL
+#define SYMBOL_WXRICHTEXTSTYLEPAGE_TITLE wxEmptyString
+#define SYMBOL_WXRICHTEXTSTYLEPAGE_IDNAME ID_RICHTEXTSTYLEPAGE
+#define SYMBOL_WXRICHTEXTSTYLEPAGE_SIZE wxSize(400, 300)
+#define SYMBOL_WXRICHTEXTSTYLEPAGE_POSITION wxDefaultPosition
+////@end control identifiers
+
+/*!
+ * wxRichTextStylePage class declaration
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextStylePage: public wxRichTextDialogPage
+{
+ DECLARE_DYNAMIC_CLASS( wxRichTextStylePage )
+ DECLARE_EVENT_TABLE()
+ DECLARE_HELP_PROVISION()
+
+public:
+ /// Constructors
+ wxRichTextStylePage( );
+ wxRichTextStylePage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEPAGE_STYLE );
+
+ /// Creation
+ bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEPAGE_STYLE );
+
+ /// Initialise members
+ void Init();
+
+ /// Creates the controls and sizers
+ void CreateControls();
+
+ /// Transfer data from/to window
+ virtual bool TransferDataFromWindow();
+ virtual bool TransferDataToWindow();
+
+ /// Gets the attributes associated with the main formatting dialog
+ wxRichTextAttr* GetAttributes();
+
+////@begin wxRichTextStylePage event handler declarations
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEPAGE_NEXT_STYLE
+ void OnNextStyleUpdate( wxUpdateUIEvent& event );
+
+////@end wxRichTextStylePage event handler declarations
+
+////@begin wxRichTextStylePage member function declarations
+
+ /// Retrieves bitmap resources
+ wxBitmap GetBitmapResource( const wxString& name );
+
+ /// Retrieves icon resources
+ wxIcon GetIconResource( const wxString& name );
+////@end wxRichTextStylePage member function declarations
+
+ /// Should we show tooltips?
+ static bool ShowToolTips();
+
+////@begin wxRichTextStylePage member variables
+ wxTextCtrl* m_styleName;
+ wxComboBox* m_basedOn;
+ wxComboBox* m_nextStyle;
+ /// Control identifiers
+ enum {
+ ID_RICHTEXTSTYLEPAGE = 10403,
+ ID_RICHTEXTSTYLEPAGE_STYLE_NAME = 10404,
+ ID_RICHTEXTSTYLEPAGE_BASED_ON = 10405,
+ ID_RICHTEXTSTYLEPAGE_NEXT_STYLE = 10406
+ };
+////@end wxRichTextStylePage member variables
+};
+
+#endif
+ // _RICHTEXTSTYLEPAGE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtextstyles.h
+// Purpose: Style management for wxRichTextCtrl
+// Author: Julian Smart
+// Modified by:
+// Created: 2005-09-30
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RICHTEXTSTYLES_H_
+#define _WX_RICHTEXTSTYLES_H_
+
+/*!
+ * Includes
+ */
+
+#include "wx/defs.h"
+
+#if wxUSE_RICHTEXT
+
+#include "wx/richtext/richtextbuffer.h"
+
+#if wxUSE_HTML
+#include "wx/htmllbox.h"
+#endif
+
+#if wxUSE_COMBOCTRL
+#include "wx/combo.h"
+#endif
+
+#include "wx/choice.h"
+
+/*!
+ * Forward declarations
+ */
+
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCtrl;
+class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextBuffer;
+
+/*!
+ * wxRichTextStyleDefinition class declaration
+ * A base class for paragraph and character styles.
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextStyleDefinition: public wxObject
+{
+ DECLARE_CLASS(wxRichTextStyleDefinition)
+public:
+
+ /// Copy constructors
+ wxRichTextStyleDefinition(const wxRichTextStyleDefinition& def)
+ : wxObject()
+ {
+ Init();
+ Copy(def);
+ }
+
+ /// Default constructor
+ wxRichTextStyleDefinition(const wxString& name = wxEmptyString) { Init(); m_name = name; }
+
+ /// Destructor
+ virtual ~wxRichTextStyleDefinition() {}
+
+ /// Initialises members
+ void Init() {}
+
+ /// Copies from def
+ void Copy(const wxRichTextStyleDefinition& def);
+
+ /// Equality test
+ bool Eq(const wxRichTextStyleDefinition& def) const;
+
+ /// Assignment operator
+ void operator =(const wxRichTextStyleDefinition& def) { Copy(def); }
+
+ /// Equality operator
+ bool operator ==(const wxRichTextStyleDefinition& def) const { return Eq(def); }
+
+ /// Override to clone the object
+ virtual wxRichTextStyleDefinition* Clone() const = 0;
+
+ /// Sets and gets the name of the style
+ void SetName(const wxString& name) { m_name = name; }
+ const wxString& GetName() const { return m_name; }
+
+ /// Sets and gets the style description
+ void SetDescription(const wxString& descr) { m_description = descr; }
+ const wxString& GetDescription() const { return m_description; }
+
+ /// Sets and gets the name of the style that this style is based on
+ void SetBaseStyle(const wxString& name) { m_baseStyle = name; }
+ const wxString& GetBaseStyle() const { return m_baseStyle; }
+
+ /// Sets and gets the style
+ void SetStyle(const wxRichTextAttr& style) { m_style = style; }
+ const wxRichTextAttr& GetStyle() const { return m_style; }
+ wxRichTextAttr& GetStyle() { return m_style; }
+
+ /// Gets the style combined with the base style
+ virtual wxRichTextAttr GetStyleMergedWithBase(const wxRichTextStyleSheet* sheet) const;
+
+ /**
+ Returns the definition's properties.
+ */
+ wxRichTextProperties& GetProperties() { return m_properties; }
+
+ /**
+ Returns the definition's properties.
+ */
+ const wxRichTextProperties& GetProperties() const { return m_properties; }
+
+ /**
+ Sets the definition's properties.
+ */
+ void SetProperties(const wxRichTextProperties& props) { m_properties = props; }
+
+protected:
+ wxString m_name;
+ wxString m_baseStyle;
+ wxString m_description;
+ wxRichTextAttr m_style;
+ wxRichTextProperties m_properties;
+};
+
+/*!
+ * wxRichTextCharacterStyleDefinition class declaration
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextCharacterStyleDefinition: public wxRichTextStyleDefinition
+{
+ DECLARE_DYNAMIC_CLASS(wxRichTextCharacterStyleDefinition)
+public:
+
+ /// Copy constructor
+ wxRichTextCharacterStyleDefinition(const wxRichTextCharacterStyleDefinition& def): wxRichTextStyleDefinition(def) {}
+
+ /// Default constructor
+ wxRichTextCharacterStyleDefinition(const wxString& name = wxEmptyString):
+ wxRichTextStyleDefinition(name) {}
+
+ /// Destructor
+ virtual ~wxRichTextCharacterStyleDefinition() {}
+
+ /// Clones the object
+ virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextCharacterStyleDefinition(*this); }
+
+protected:
+};
+
+/*!
+ * wxRichTextParagraphStyleDefinition class declaration
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextParagraphStyleDefinition: public wxRichTextStyleDefinition
+{
+ DECLARE_DYNAMIC_CLASS(wxRichTextParagraphStyleDefinition)
+public:
+
+ /// Copy constructor
+ wxRichTextParagraphStyleDefinition(const wxRichTextParagraphStyleDefinition& def): wxRichTextStyleDefinition(def) { m_nextStyle = def.m_nextStyle; }
+
+ /// Default constructor
+ wxRichTextParagraphStyleDefinition(const wxString& name = wxEmptyString):
+ wxRichTextStyleDefinition(name) {}
+
+ // Destructor
+ virtual ~wxRichTextParagraphStyleDefinition() {}
+
+ /// Sets and gets the next style
+ void SetNextStyle(const wxString& name) { m_nextStyle = name; }
+ const wxString& GetNextStyle() const { return m_nextStyle; }
+
+ /// Copies from def
+ void Copy(const wxRichTextParagraphStyleDefinition& def);
+
+ /// Assignment operator
+ void operator =(const wxRichTextParagraphStyleDefinition& def) { Copy(def); }
+
+ /// Equality operator
+ bool operator ==(const wxRichTextParagraphStyleDefinition& def) const;
+
+ /// Clones the object
+ virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextParagraphStyleDefinition(*this); }
+
+protected:
+
+ /// The next style to use when adding a paragraph after this style.
+ wxString m_nextStyle;
+};
+
+/*!
+ * wxRichTextListStyleDefinition class declaration
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextListStyleDefinition: public wxRichTextParagraphStyleDefinition
+{
+ DECLARE_DYNAMIC_CLASS(wxRichTextListStyleDefinition)
+public:
+
+ /// Copy constructor
+ wxRichTextListStyleDefinition(const wxRichTextListStyleDefinition& def): wxRichTextParagraphStyleDefinition(def) { Init(); Copy(def); }
+
+ /// Default constructor
+ wxRichTextListStyleDefinition(const wxString& name = wxEmptyString):
+ wxRichTextParagraphStyleDefinition(name) { Init(); }
+
+ /// Destructor
+ virtual ~wxRichTextListStyleDefinition() {}
+
+ /// Copies from def
+ void Copy(const wxRichTextListStyleDefinition& def);
+
+ /// Assignment operator
+ void operator =(const wxRichTextListStyleDefinition& def) { Copy(def); }
+
+ /// Equality operator
+ bool operator ==(const wxRichTextListStyleDefinition& def) const;
+
+ /// Clones the object
+ virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextListStyleDefinition(*this); }
+
+ /// Sets/gets the attributes for the given level
+ void SetLevelAttributes(int i, const wxRichTextAttr& attr);
+ wxRichTextAttr* GetLevelAttributes(int i);
+ const wxRichTextAttr* GetLevelAttributes(int i) const;
+
+ /// Convenience function for setting the major attributes for a list level specification
+ void SetAttributes(int i, int leftIndent, int leftSubIndent, int bulletStyle, const wxString& bulletSymbol = wxEmptyString);
+
+ /// Finds the level corresponding to the given indentation
+ int FindLevelForIndent(int indent) const;
+
+ /// Combine the base and list style with a paragraph style, using the given indent (from which
+ /// an appropriate level is found)
+ wxRichTextAttr CombineWithParagraphStyle(int indent, const wxRichTextAttr& paraStyle, wxRichTextStyleSheet* styleSheet = NULL);
+
+ /// Combine the base and list style, using the given indent (from which
+ /// an appropriate level is found)
+ wxRichTextAttr GetCombinedStyle(int indent, wxRichTextStyleSheet* styleSheet = NULL);
+
+ /// Combine the base and list style, using the given level from which
+ /// an appropriate level is found)
+ wxRichTextAttr GetCombinedStyleForLevel(int level, wxRichTextStyleSheet* styleSheet = NULL);
+
+ /// Gets the number of available levels
+ int GetLevelCount() const { return 10; }
+
+ /// Is this a numbered list?
+ bool IsNumbered(int i) const;
+
+protected:
+
+ /// The styles for each level (up to 10)
+ wxRichTextAttr m_levelStyles[10];
+};
+
+/*!
+ * wxRichTextBoxStyleDefinition class declaration, for box attributes in objects such as wxRichTextBox.
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextBoxStyleDefinition: public wxRichTextStyleDefinition
+{
+ DECLARE_DYNAMIC_CLASS(wxRichTextBoxStyleDefinition)
+public:
+
+ /// Copy constructor
+ wxRichTextBoxStyleDefinition(const wxRichTextBoxStyleDefinition& def): wxRichTextStyleDefinition(def) { Copy(def); }
+
+ /// Default constructor
+ wxRichTextBoxStyleDefinition(const wxString& name = wxEmptyString):
+ wxRichTextStyleDefinition(name) {}
+
+ // Destructor
+ virtual ~wxRichTextBoxStyleDefinition() {}
+
+ /// Copies from def
+ void Copy(const wxRichTextBoxStyleDefinition& def);
+
+ /// Assignment operator
+ void operator =(const wxRichTextBoxStyleDefinition& def) { Copy(def); }
+
+ /// Equality operator
+ bool operator ==(const wxRichTextBoxStyleDefinition& def) const;
+
+ /// Clones the object
+ virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextBoxStyleDefinition(*this); }
+
+protected:
+};
+
+/*!
+ * The style sheet
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextStyleSheet: public wxObject
+{
+ DECLARE_CLASS( wxRichTextStyleSheet )
+
+public:
+ /// Constructors
+ wxRichTextStyleSheet(const wxRichTextStyleSheet& sheet)
+ : wxObject()
+ {
+ Init();
+ Copy(sheet);
+ }
+ wxRichTextStyleSheet() { Init(); }
+ virtual ~wxRichTextStyleSheet();
+
+ /// Initialisation
+ void Init();
+
+ /// Copy
+ void Copy(const wxRichTextStyleSheet& sheet);
+
+ /// Assignment
+ void operator=(const wxRichTextStyleSheet& sheet) { Copy(sheet); }
+
+ /// Equality
+ bool operator==(const wxRichTextStyleSheet& sheet) const;
+
+ /// Add a definition to the character style list
+ bool AddCharacterStyle(wxRichTextCharacterStyleDefinition* def);
+
+ /// Add a definition to the paragraph style list
+ bool AddParagraphStyle(wxRichTextParagraphStyleDefinition* def);
+
+ /// Add a definition to the list style list
+ bool AddListStyle(wxRichTextListStyleDefinition* def);
+
+ /// Add a definition to the box style list
+ bool AddBoxStyle(wxRichTextBoxStyleDefinition* def);
+
+ /// Add a definition to the appropriate style list
+ bool AddStyle(wxRichTextStyleDefinition* def);
+
+ /// Remove a character style
+ bool RemoveCharacterStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_characterStyleDefinitions, def, deleteStyle); }
+
+ /// Remove a paragraph style
+ bool RemoveParagraphStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_paragraphStyleDefinitions, def, deleteStyle); }
+
+ /// Remove a list style
+ bool RemoveListStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_listStyleDefinitions, def, deleteStyle); }
+
+ /// Remove a box style
+ bool RemoveBoxStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_boxStyleDefinitions, def, deleteStyle); }
+
+ /// Remove a style
+ bool RemoveStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false);
+
+ /// Find a character definition by name
+ wxRichTextCharacterStyleDefinition* FindCharacterStyle(const wxString& name, bool recurse = true) const { return (wxRichTextCharacterStyleDefinition*) FindStyle(m_characterStyleDefinitions, name, recurse); }
+
+ /// Find a paragraph definition by name
+ wxRichTextParagraphStyleDefinition* FindParagraphStyle(const wxString& name, bool recurse = true) const { return (wxRichTextParagraphStyleDefinition*) FindStyle(m_paragraphStyleDefinitions, name, recurse); }
+
+ /// Find a list definition by name
+ wxRichTextListStyleDefinition* FindListStyle(const wxString& name, bool recurse = true) const { return (wxRichTextListStyleDefinition*) FindStyle(m_listStyleDefinitions, name, recurse); }
+
+ /// Find a box definition by name
+ wxRichTextBoxStyleDefinition* FindBoxStyle(const wxString& name, bool recurse = true) const { return (wxRichTextBoxStyleDefinition*) FindStyle(m_boxStyleDefinitions, name, recurse); }
+
+ /// Find any definition by name
+ wxRichTextStyleDefinition* FindStyle(const wxString& name, bool recurse = true) const;
+
+ /// Return the number of character styles
+ size_t GetCharacterStyleCount() const { return m_characterStyleDefinitions.GetCount(); }
+
+ /// Return the number of paragraph styles
+ size_t GetParagraphStyleCount() const { return m_paragraphStyleDefinitions.GetCount(); }
+
+ /// Return the number of list styles
+ size_t GetListStyleCount() const { return m_listStyleDefinitions.GetCount(); }
+
+ /// Return the number of box styles
+ size_t GetBoxStyleCount() const { return m_boxStyleDefinitions.GetCount(); }
+
+ /// Return the nth character style
+ wxRichTextCharacterStyleDefinition* GetCharacterStyle(size_t n) const { return (wxRichTextCharacterStyleDefinition*) m_characterStyleDefinitions.Item(n)->GetData(); }
+
+ /// Return the nth paragraph style
+ wxRichTextParagraphStyleDefinition* GetParagraphStyle(size_t n) const { return (wxRichTextParagraphStyleDefinition*) m_paragraphStyleDefinitions.Item(n)->GetData(); }
+
+ /// Return the nth list style
+ wxRichTextListStyleDefinition* GetListStyle(size_t n) const { return (wxRichTextListStyleDefinition*) m_listStyleDefinitions.Item(n)->GetData(); }
+
+ /// Return the nth box style
+ wxRichTextBoxStyleDefinition* GetBoxStyle(size_t n) const { return (wxRichTextBoxStyleDefinition*) m_boxStyleDefinitions.Item(n)->GetData(); }
+
+ /// Delete all styles
+ void DeleteStyles();
+
+ /// Insert into list of style sheets
+ bool InsertSheet(wxRichTextStyleSheet* before);
+
+ /// Append to list of style sheets
+ bool AppendSheet(wxRichTextStyleSheet* after);
+
+ /// Unlink from the list of style sheets
+ void Unlink();
+
+ /// Get/set next sheet
+ wxRichTextStyleSheet* GetNextSheet() const { return m_nextSheet; }
+ void SetNextSheet(wxRichTextStyleSheet* sheet) { m_nextSheet = sheet; }
+
+ /// Get/set previous sheet
+ wxRichTextStyleSheet* GetPreviousSheet() const { return m_previousSheet; }
+ void SetPreviousSheet(wxRichTextStyleSheet* sheet) { m_previousSheet = sheet; }
+
+ /// Sets and gets the name of the style sheet
+ void SetName(const wxString& name) { m_name = name; }
+ const wxString& GetName() const { return m_name; }
+
+ /// Sets and gets the style description
+ void SetDescription(const wxString& descr) { m_description = descr; }
+ const wxString& GetDescription() const { return m_description; }
+
+ /**
+ Returns the sheet's properties.
+ */
+ wxRichTextProperties& GetProperties() { return m_properties; }
+
+ /**
+ Returns the sheet's properties.
+ */
+ const wxRichTextProperties& GetProperties() const { return m_properties; }
+
+ /**
+ Sets the sheet's properties.
+ */
+ void SetProperties(const wxRichTextProperties& props) { m_properties = props; }
+
+/// Implementation
+
+ /// Add a definition to one of the style lists
+ bool AddStyle(wxList& list, wxRichTextStyleDefinition* def);
+
+ /// Remove a style
+ bool RemoveStyle(wxList& list, wxRichTextStyleDefinition* def, bool deleteStyle);
+
+ /// Find a definition by name
+ wxRichTextStyleDefinition* FindStyle(const wxList& list, const wxString& name, bool recurse = true) const;
+
+protected:
+
+ wxString m_description;
+ wxString m_name;
+
+ wxList m_characterStyleDefinitions;
+ wxList m_paragraphStyleDefinitions;
+ wxList m_listStyleDefinitions;
+ wxList m_boxStyleDefinitions;
+
+ wxRichTextStyleSheet* m_previousSheet;
+ wxRichTextStyleSheet* m_nextSheet;
+ wxRichTextProperties m_properties;
+};
+
+#if wxUSE_HTML
+/*!
+ * wxRichTextStyleListBox class declaration
+ * A listbox to display styles.
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListBox: public wxHtmlListBox
+{
+ DECLARE_CLASS(wxRichTextStyleListBox)
+ DECLARE_EVENT_TABLE()
+
+public:
+ /// Which type of style definition is currently showing?
+ enum wxRichTextStyleType
+ {
+ wxRICHTEXT_STYLE_ALL,
+ wxRICHTEXT_STYLE_PARAGRAPH,
+ wxRICHTEXT_STYLE_CHARACTER,
+ wxRICHTEXT_STYLE_LIST,
+ wxRICHTEXT_STYLE_BOX
+ };
+
+ wxRichTextStyleListBox()
+ {
+ Init();
+ }
+ wxRichTextStyleListBox(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0);
+ virtual ~wxRichTextStyleListBox();
+
+ void Init()
+ {
+ m_styleSheet = NULL;
+ m_richTextCtrl = NULL;
+ m_applyOnSelection = false;
+ m_styleType = wxRICHTEXT_STYLE_PARAGRAPH;
+ m_autoSetSelection = true;
+ }
+
+ bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0);
+
+ /// Creates a suitable HTML fragment for a definition
+ wxString CreateHTML(wxRichTextStyleDefinition* def) const;
+
+ /// Associates the control with a style sheet
+ void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { m_styleSheet = styleSheet; }
+ wxRichTextStyleSheet* GetStyleSheet() const { return m_styleSheet; }
+
+ /// Associates the control with a wxRichTextCtrl
+ void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_richTextCtrl = ctrl; }
+ wxRichTextCtrl* GetRichTextCtrl() const { return m_richTextCtrl; }
+
+ /// Get style for index
+ wxRichTextStyleDefinition* GetStyle(size_t i) const ;
+
+ /// Get index for style name
+ int GetIndexForStyle(const wxString& name) const ;
+
+ /// Set selection for string, returning the index.
+ int SetStyleSelection(const wxString& name);
+
+ /// Updates the list
+ void UpdateStyles();
+
+ /// Apply the style
+ void ApplyStyle(int i);
+
+ /// Left click
+ void OnLeftDown(wxMouseEvent& event);
+
+ /// Left double-click
+ void OnLeftDoubleClick(wxMouseEvent& event);
+
+ /// Auto-select from style under caret in idle time
+ void OnIdle(wxIdleEvent& event);
+
+ /// Convert units in tends of a millimetre to device units
+ int ConvertTenthsMMToPixels(wxDC& dc, int units) const;
+
+ /// Can we set the selection based on the editor caret position?
+ /// Need to override this if being used in a combobox popup
+ virtual bool CanAutoSetSelection() { return m_autoSetSelection; }
+ virtual void SetAutoSetSelection(bool autoSet) { m_autoSetSelection = autoSet; }
+
+ /// Set whether the style should be applied as soon as the item is selected (the default)
+ void SetApplyOnSelection(bool applyOnSel) { m_applyOnSelection = applyOnSel; }
+ bool GetApplyOnSelection() const { return m_applyOnSelection; }
+
+ /// Set the style type to display
+ void SetStyleType(wxRichTextStyleType styleType) { m_styleType = styleType; UpdateStyles(); }
+ wxRichTextStyleType GetStyleType() const { return m_styleType; }
+
+ /// Helper for listbox and combo control
+ static wxString GetStyleToShowInIdleTime(wxRichTextCtrl* ctrl, wxRichTextStyleType styleType);
+
+protected:
+ /// Returns the HTML for this item
+ virtual wxString OnGetItem(size_t n) const;
+
+private:
+
+ wxRichTextStyleSheet* m_styleSheet;
+ wxRichTextCtrl* m_richTextCtrl;
+ bool m_applyOnSelection; // if true, applies style on selection
+ wxRichTextStyleType m_styleType; // style type to display
+ bool m_autoSetSelection;
+ wxArrayString m_styleNames;
+};
+
+/*!
+ * wxRichTextStyleListCtrl class declaration
+ * This is a container for the list control plus a combobox to switch between
+ * style types.
+ */
+
+#define wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR 0x1000
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListCtrl: public wxControl
+{
+ DECLARE_CLASS(wxRichTextStyleListCtrl)
+ DECLARE_EVENT_TABLE()
+
+public:
+
+ /// Constructors
+ wxRichTextStyleListCtrl()
+ {
+ Init();
+ }
+
+ wxRichTextStyleListCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0);
+
+ /// Constructors
+ virtual ~wxRichTextStyleListCtrl();
+
+ /// Member initialisation
+ void Init()
+ {
+ m_styleListBox = NULL;
+ m_styleChoice = NULL;
+ m_dontUpdate = false;
+ }
+
+ /// Creates the windows
+ bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0);
+
+ /// Updates the style list box
+ void UpdateStyles();
+
+ /// Associates the control with a style sheet
+ void SetStyleSheet(wxRichTextStyleSheet* styleSheet);
+ wxRichTextStyleSheet* GetStyleSheet() const;
+
+ /// Associates the control with a wxRichTextCtrl
+ void SetRichTextCtrl(wxRichTextCtrl* ctrl);
+ wxRichTextCtrl* GetRichTextCtrl() const;
+
+ /// Set/get the style type to display
+ void SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType);
+ wxRichTextStyleListBox::wxRichTextStyleType GetStyleType() const;
+
+ /// Get the choice index for style type
+ int StyleTypeToIndex(wxRichTextStyleListBox::wxRichTextStyleType styleType);
+
+ /// Get the style type for choice index
+ wxRichTextStyleListBox::wxRichTextStyleType StyleIndexToType(int i);
+
+ /// Get the listbox
+ wxRichTextStyleListBox* GetStyleListBox() const { return m_styleListBox; }
+
+ /// Get the choice
+ wxChoice* GetStyleChoice() const { return m_styleChoice; }
+
+ /// React to style type choice
+ void OnChooseType(wxCommandEvent& event);
+
+ /// Lay out the controls
+ void OnSize(wxSizeEvent& event);
+
+private:
+
+ wxRichTextStyleListBox* m_styleListBox;
+ wxChoice* m_styleChoice;
+ bool m_dontUpdate;
+};
+
+#if wxUSE_COMBOCTRL
+
+/*!
+ * Style drop-down for a wxComboCtrl
+ */
+
+class wxRichTextStyleComboPopup : public wxRichTextStyleListBox, public wxComboPopup
+{
+public:
+ virtual void Init()
+ {
+ m_itemHere = -1; // hot item in list
+ m_value = -1;
+ }
+
+ virtual bool Create( wxWindow* parent );
+
+ virtual wxWindow *GetControl() { return this; }
+
+ virtual void SetStringValue( const wxString& s );
+
+ virtual wxString GetStringValue() const;
+
+ /// Can we set the selection based on the editor caret position?
+ // virtual bool CanAutoSetSelection() { return ((m_combo == NULL) || !m_combo->IsPopupShown()); }
+ virtual bool CanAutoSetSelection() { return false; }
+
+ //
+ // Popup event handlers
+ //
+
+ // Mouse hot-tracking
+ void OnMouseMove(wxMouseEvent& event);
+
+ // On mouse left, set the value and close the popup
+ void OnMouseClick(wxMouseEvent& WXUNUSED(event));
+
+protected:
+
+ int m_itemHere; // hot item in popup
+ int m_value;
+
+private:
+ DECLARE_EVENT_TABLE()
+};
+
+/*!
+ * wxRichTextStyleComboCtrl
+ * A combo for applying styles.
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextStyleComboCtrl: public wxComboCtrl
+{
+ DECLARE_CLASS(wxRichTextStyleComboCtrl)
+ DECLARE_EVENT_TABLE()
+
+public:
+ wxRichTextStyleComboCtrl()
+ {
+ Init();
+ }
+
+ wxRichTextStyleComboCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = wxCB_READONLY)
+ {
+ Init();
+ Create(parent, id, pos, size, style);
+ }
+
+ virtual ~wxRichTextStyleComboCtrl() {}
+
+ void Init()
+ {
+ m_stylePopup = NULL;
+ }
+
+ bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0);
+
+ /// Updates the list
+ void UpdateStyles() { m_stylePopup->UpdateStyles(); }
+
+ /// Associates the control with a style sheet
+ void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { m_stylePopup->SetStyleSheet(styleSheet); }
+ wxRichTextStyleSheet* GetStyleSheet() const { return m_stylePopup->GetStyleSheet(); }
+
+ /// Associates the control with a wxRichTextCtrl
+ void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_stylePopup->SetRichTextCtrl(ctrl); }
+ wxRichTextCtrl* GetRichTextCtrl() const { return m_stylePopup->GetRichTextCtrl(); }
+
+ /// Gets the style popup
+ wxRichTextStyleComboPopup* GetStylePopup() const { return m_stylePopup; }
+
+ /// Auto-select from style under caret in idle time
+ void OnIdle(wxIdleEvent& event);
+
+protected:
+ wxRichTextStyleComboPopup* m_stylePopup;
+};
+
+#endif
+ // wxUSE_COMBOCTRL
+
+#endif
+ // wxUSE_HTML
+
+#endif
+ // wxUSE_RICHTEXT
+
+#endif
+ // _WX_RICHTEXTSTYLES_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtextsymboldlg.h
+// Purpose:
+// Author: Julian Smart
+// Modified by:
+// Created: 10/5/2006 3:11:58 PM
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _RICHTEXTSYMBOLDLG_H_
+#define _RICHTEXTSYMBOLDLG_H_
+
+/*!
+ * Includes
+ */
+
+#include "wx/richtext/richtextuicustomization.h"
+#include "wx/dialog.h"
+#include "wx/vscroll.h"
+
+/*!
+ * Forward declarations
+ */
+
+class WXDLLIMPEXP_FWD_CORE wxStaticText;
+class WXDLLIMPEXP_FWD_CORE wxComboBox;
+class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
+
+////@begin forward declarations
+class wxSymbolListCtrl;
+class wxStdDialogButtonSizer;
+////@end forward declarations
+
+// __UNICODE__ is a symbol used by DialogBlocks-generated code.
+#ifndef __UNICODE__
+#if wxUSE_UNICODE
+#define __UNICODE__
+#endif
+#endif
+
+/*!
+ * Symbols
+ */
+
+#define SYMBOL_WXSYMBOLPICKERDIALOG_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxCLOSE_BOX)
+#define SYMBOL_WXSYMBOLPICKERDIALOG_TITLE wxGetTranslation("Symbols")
+#define SYMBOL_WXSYMBOLPICKERDIALOG_IDNAME ID_SYMBOLPICKERDIALOG
+#define SYMBOL_WXSYMBOLPICKERDIALOG_SIZE wxSize(400, 300)
+#define SYMBOL_WXSYMBOLPICKERDIALOG_POSITION wxDefaultPosition
+
+/*!
+ * wxSymbolPickerDialog class declaration
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxSymbolPickerDialog: public wxDialog
+{
+ DECLARE_DYNAMIC_CLASS( wxSymbolPickerDialog )
+ DECLARE_EVENT_TABLE()
+ DECLARE_HELP_PROVISION()
+
+public:
+ /// Constructors
+ wxSymbolPickerDialog( );
+ wxSymbolPickerDialog( const wxString& symbol, const wxString& fontName, const wxString& normalTextFont,
+ wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXSYMBOLPICKERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXSYMBOLPICKERDIALOG_POSITION, const wxSize& size = SYMBOL_WXSYMBOLPICKERDIALOG_SIZE, long style = SYMBOL_WXSYMBOLPICKERDIALOG_STYLE );
+
+ /// Creation
+ bool Create( const wxString& symbol, const wxString& fontName, const wxString& normalTextFont,
+ wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXSYMBOLPICKERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXSYMBOLPICKERDIALOG_POSITION, const wxSize& size = SYMBOL_WXSYMBOLPICKERDIALOG_SIZE, long style = SYMBOL_WXSYMBOLPICKERDIALOG_STYLE );
+
+ /// Initialises members variables
+ void Init();
+
+ /// Creates the controls and sizers
+ void CreateControls();
+
+ /// Update the display
+ void UpdateSymbolDisplay(bool updateSymbolList = true, bool showAtSubset = true);
+
+ /// Respond to symbol selection
+ void OnSymbolSelected( wxCommandEvent& event );
+
+ /// Set Unicode mode
+ void SetUnicodeMode(bool unicodeMode);
+
+ /// Show at the current subset selection
+ void ShowAtSubset();
+
+ /// Get the selected symbol character
+ int GetSymbolChar() const;
+
+ /// Is there a selection?
+ bool HasSelection() const { return !m_symbol.IsEmpty(); }
+
+ /// Specifying normal text?
+ bool UseNormalFont() const { return m_fontName.IsEmpty(); }
+
+ /// Should we show tooltips?
+ static bool ShowToolTips() { return sm_showToolTips; }
+
+ /// Determines whether tooltips will be shown
+ static void SetShowToolTips(bool show) { sm_showToolTips = show; }
+
+ /// Data transfer
+ virtual bool TransferDataToWindow();
+
+////@begin wxSymbolPickerDialog event handler declarations
+
+ /// wxEVT_COMBOBOX event handler for ID_SYMBOLPICKERDIALOG_FONT
+ void OnFontCtrlSelected( wxCommandEvent& event );
+
+#if defined(__UNICODE__)
+ /// wxEVT_COMBOBOX event handler for ID_SYMBOLPICKERDIALOG_SUBSET
+ void OnSubsetSelected( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_SYMBOLPICKERDIALOG_SUBSET
+ void OnSymbolpickerdialogSubsetUpdate( wxUpdateUIEvent& event );
+
+#endif
+#if defined(__UNICODE__)
+ /// wxEVT_COMBOBOX event handler for ID_SYMBOLPICKERDIALOG_FROM
+ void OnFromUnicodeSelected( wxCommandEvent& event );
+
+#endif
+ /// wxEVT_UPDATE_UI event handler for wxID_OK
+ void OnOkUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_BUTTON event handler for wxID_HELP
+ void OnHelpClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for wxID_HELP
+ void OnHelpUpdate( wxUpdateUIEvent& event );
+
+////@end wxSymbolPickerDialog event handler declarations
+
+////@begin wxSymbolPickerDialog member function declarations
+
+ wxString GetFontName() const { return m_fontName ; }
+ void SetFontName(wxString value) { m_fontName = value ; }
+
+ bool GetFromUnicode() const { return m_fromUnicode ; }
+ void SetFromUnicode(bool value) { m_fromUnicode = value ; }
+
+ wxString GetNormalTextFontName() const { return m_normalTextFontName ; }
+ void SetNormalTextFontName(wxString value) { m_normalTextFontName = value ; }
+
+ wxString GetSymbol() const { return m_symbol ; }
+ void SetSymbol(wxString value) { m_symbol = value ; }
+
+ /// Retrieves bitmap resources
+ wxBitmap GetBitmapResource( const wxString& name );
+
+ /// Retrieves icon resources
+ wxIcon GetIconResource( const wxString& name );
+////@end wxSymbolPickerDialog member function declarations
+
+////@begin wxSymbolPickerDialog member variables
+ wxComboBox* m_fontCtrl;
+#if defined(__UNICODE__)
+ wxComboBox* m_subsetCtrl;
+#endif
+ wxSymbolListCtrl* m_symbolsCtrl;
+ wxStaticText* m_symbolStaticCtrl;
+ wxTextCtrl* m_characterCodeCtrl;
+#if defined(__UNICODE__)
+ wxComboBox* m_fromUnicodeCtrl;
+#endif
+ wxStdDialogButtonSizer* m_stdButtonSizer;
+ wxString m_fontName;
+ bool m_fromUnicode;
+ wxString m_normalTextFontName;
+ wxString m_symbol;
+ /// Control identifiers
+ enum {
+ ID_SYMBOLPICKERDIALOG = 10600,
+ ID_SYMBOLPICKERDIALOG_FONT = 10602,
+ ID_SYMBOLPICKERDIALOG_SUBSET = 10605,
+ ID_SYMBOLPICKERDIALOG_LISTCTRL = 10608,
+ ID_SYMBOLPICKERDIALOG_CHARACTERCODE = 10601,
+ ID_SYMBOLPICKERDIALOG_FROM = 10603
+ };
+////@end wxSymbolPickerDialog member variables
+
+ bool m_dontUpdate;
+ static bool sm_showToolTips;
+};
+
+/*!
+ * The scrolling symbol list.
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxSymbolListCtrl : public wxVScrolledWindow
+{
+public:
+ // constructors and such
+ // ---------------------
+
+ // default constructor, you must call Create() later
+ wxSymbolListCtrl() { Init(); }
+
+ // normal constructor which calls Create() internally
+ wxSymbolListCtrl(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxPanelNameStr)
+ {
+ Init();
+
+ (void)Create(parent, id, pos, size, style, name);
+ }
+
+ // really creates the control and sets the initial number of items in it
+ // (which may be changed later with SetItemCount())
+ //
+ // returns true on success or false if the control couldn't be created
+ bool Create(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxPanelNameStr);
+
+ // dtor does some internal cleanup
+ virtual ~wxSymbolListCtrl();
+
+
+ // accessors
+ // ---------
+
+ // set the current font
+ virtual bool SetFont(const wxFont& font);
+
+ // set Unicode/ASCII mode
+ void SetUnicodeMode(bool unicodeMode);
+
+ // get the index of the currently selected item or wxNOT_FOUND if there is no selection
+ int GetSelection() const;
+
+ // is this item selected?
+ bool IsSelected(int item) const;
+
+ // is this item the current one?
+ bool IsCurrentItem(int item) const { return item == m_current; }
+
+ // get the margins around each cell
+ wxPoint GetMargins() const { return m_ptMargins; }
+
+ // get the background colour of selected cells
+ const wxColour& GetSelectionBackground() const { return m_colBgSel; }
+
+ // operations
+ // ----------
+
+ // set the selection to the specified item, if it is wxNOT_FOUND the
+ // selection is unset
+ void SetSelection(int selection);
+
+ // make this item visible
+ void EnsureVisible(int item);
+
+ // set the margins: horizontal margin is the distance between the window
+ // border and the item contents while vertical margin is half of the
+ // distance between items
+ //
+ // by default both margins are 0
+ void SetMargins(const wxPoint& pt);
+ void SetMargins(wxCoord x, wxCoord y) { SetMargins(wxPoint(x, y)); }
+
+ // set the cell size
+ void SetCellSize(const wxSize& sz) { m_cellSize = sz; }
+ const wxSize& GetCellSize() const { return m_cellSize; }
+
+ // change the background colour of the selected cells
+ void SetSelectionBackground(const wxColour& col);
+
+ virtual wxVisualAttributes GetDefaultAttributes() const
+ {
+ return GetClassDefaultAttributes(GetWindowVariant());
+ }
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ // Get min/max symbol values
+ int GetMinSymbolValue() const { return m_minSymbolValue; }
+ int GetMaxSymbolValue() const { return m_maxSymbolValue; }
+
+ // Respond to size change
+ void OnSize(wxSizeEvent& event);
+
+protected:
+
+ // draws a line of symbols
+ virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const;
+
+ // gets the line height
+ virtual wxCoord OnGetRowHeight(size_t line) const;
+
+ // event handlers
+ void OnPaint(wxPaintEvent& event);
+ void OnKeyDown(wxKeyEvent& event);
+ void OnLeftDown(wxMouseEvent& event);
+ void OnLeftDClick(wxMouseEvent& event);
+
+ // common part of all ctors
+ void Init();
+
+ // send the wxEVT_LISTBOX event
+ void SendSelectedEvent();
+
+ // change the current item (in single selection listbox it also implicitly
+ // changes the selection); current may be wxNOT_FOUND in which case there
+ // will be no current item any more
+ //
+ // return true if the current item changed, false otherwise
+ bool DoSetCurrent(int current);
+
+ // flags for DoHandleItemClick
+ enum
+ {
+ ItemClick_Shift = 1, // item shift-clicked
+ ItemClick_Ctrl = 2, // ctrl
+ ItemClick_Kbd = 4 // item selected from keyboard
+ };
+
+ // common part of keyboard and mouse handling processing code
+ void DoHandleItemClick(int item, int flags);
+
+ // calculate line number from symbol value
+ int SymbolValueToLineNumber(int item);
+
+ // initialise control from current min/max values
+ void SetupCtrl(bool scrollToSelection = true);
+
+ // hit testing
+ int HitTest(const wxPoint& pt);
+
+private:
+ // the current item or wxNOT_FOUND
+ int m_current;
+
+ // margins
+ wxPoint m_ptMargins;
+
+ // the selection bg colour
+ wxColour m_colBgSel;
+
+ // double buffer
+ wxBitmap* m_doubleBuffer;
+
+ // cell size
+ wxSize m_cellSize;
+
+ // minimum and maximum symbol value
+ int m_minSymbolValue;
+
+ // minimum and maximum symbol value
+ int m_maxSymbolValue;
+
+ // number of items per line
+ int m_symbolsPerLine;
+
+ // Unicode/ASCII mode
+ bool m_unicodeMode;
+
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxSymbolListCtrl);
+ DECLARE_ABSTRACT_CLASS(wxSymbolListCtrl)
+};
+
+#endif
+ // _RICHTEXTSYMBOLDLG_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtexttabspage.h
+// Purpose:
+// Author: Julian Smart
+// Modified by:
+// Created: 10/4/2006 8:03:20 AM
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _RICHTEXTTABSPAGE_H_
+#define _RICHTEXTTABSPAGE_H_
+
+/*!
+ * Includes
+ */
+
+#include "wx/richtext/richtextdialogpage.h"
+
+////@begin includes
+////@end includes
+
+/*!
+ * Forward declarations
+ */
+
+////@begin forward declarations
+////@end forward declarations
+
+/*!
+ * Control identifiers
+ */
+
+////@begin control identifiers
+#define SYMBOL_WXRICHTEXTTABSPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL
+#define SYMBOL_WXRICHTEXTTABSPAGE_TITLE wxEmptyString
+#define SYMBOL_WXRICHTEXTTABSPAGE_IDNAME ID_RICHTEXTTABSPAGE
+#define SYMBOL_WXRICHTEXTTABSPAGE_SIZE wxSize(400, 300)
+#define SYMBOL_WXRICHTEXTTABSPAGE_POSITION wxDefaultPosition
+////@end control identifiers
+
+/*!
+ * wxRichTextTabsPage class declaration
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextTabsPage: public wxRichTextDialogPage
+{
+ DECLARE_DYNAMIC_CLASS( wxRichTextTabsPage )
+ DECLARE_EVENT_TABLE()
+ DECLARE_HELP_PROVISION()
+
+public:
+ /// Constructors
+ wxRichTextTabsPage( );
+ wxRichTextTabsPage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTTABSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTTABSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTTABSPAGE_STYLE );
+
+ /// Creation
+ bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTTABSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTTABSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTTABSPAGE_STYLE );
+
+ /// Creates the controls and sizers
+ void CreateControls();
+
+ /// Initialise members
+ void Init();
+
+ /// Transfer data from/to window
+ virtual bool TransferDataFromWindow();
+ virtual bool TransferDataToWindow();
+
+ /// Sorts the tab array
+ virtual void SortTabs();
+
+ /// Gets the attributes associated with the main formatting dialog
+ wxRichTextAttr* GetAttributes();
+
+////@begin wxRichTextTabsPage event handler declarations
+
+ /// wxEVT_LISTBOX event handler for ID_RICHTEXTTABSPAGE_TABLIST
+ void OnTablistSelected( wxCommandEvent& event );
+
+ /// wxEVT_BUTTON event handler for ID_RICHTEXTTABSPAGE_NEW_TAB
+ void OnNewTabClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTTABSPAGE_NEW_TAB
+ void OnNewTabUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_BUTTON event handler for ID_RICHTEXTTABSPAGE_DELETE_TAB
+ void OnDeleteTabClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTTABSPAGE_DELETE_TAB
+ void OnDeleteTabUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_BUTTON event handler for ID_RICHTEXTTABSPAGE_DELETE_ALL_TABS
+ void OnDeleteAllTabsClick( wxCommandEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTTABSPAGE_DELETE_ALL_TABS
+ void OnDeleteAllTabsUpdate( wxUpdateUIEvent& event );
+
+////@end wxRichTextTabsPage event handler declarations
+
+////@begin wxRichTextTabsPage member function declarations
+
+ /// Retrieves bitmap resources
+ wxBitmap GetBitmapResource( const wxString& name );
+
+ /// Retrieves icon resources
+ wxIcon GetIconResource( const wxString& name );
+////@end wxRichTextTabsPage member function declarations
+
+ /// Should we show tooltips?
+ static bool ShowToolTips();
+
+////@begin wxRichTextTabsPage member variables
+ wxTextCtrl* m_tabEditCtrl;
+ wxListBox* m_tabListCtrl;
+ /// Control identifiers
+ enum {
+ ID_RICHTEXTTABSPAGE = 10200,
+ ID_RICHTEXTTABSPAGE_TABEDIT = 10213,
+ ID_RICHTEXTTABSPAGE_TABLIST = 10214,
+ ID_RICHTEXTTABSPAGE_NEW_TAB = 10201,
+ ID_RICHTEXTTABSPAGE_DELETE_TAB = 10202,
+ ID_RICHTEXTTABSPAGE_DELETE_ALL_TABS = 10203
+ };
+////@end wxRichTextTabsPage member variables
+
+ bool m_tabsPresent;
+};
+
+#endif
+ // _RICHTEXTTABSPAGE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtextuicustomization.h
+// Purpose: UI customization base class for wxRTC
+// Author: Julian Smart
+// Modified by:
+// Created: 2010-11-14
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RICHTEXTUICUSTOMIZATION_H_
+#define _WX_RICHTEXTUICUSTOMIZATION_H_
+
+#if wxUSE_RICHTEXT
+
+#include "wx/window.h"
+
+/**
+ @class wxRichTextUICustomization
+ The base class for functionality to plug in to various rich text control dialogs,
+ currently allowing the application to respond to Help button clicks without the
+ need to derive new dialog classes.
+
+ The application will typically have calls like this in its initialisation:
+
+ wxRichTextFormattingDialog::GetHelpInfo().SetHelpId(ID_HELP_FORMATTINGDIALOG);
+ wxRichTextFormattingDialog::GetHelpInfo().SetUICustomization(& wxGetApp().GetRichTextUICustomization());
+ wxRichTextBordersPage::GetHelpInfo().SetHelpId(ID_HELP_BORDERSPAGE);
+
+ Only the wxRichTextFormattingDialog class needs to have its customization object and help id set,
+ though the application set them for individual pages if it wants.
+ **/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextUICustomization
+{
+public:
+ wxRichTextUICustomization() {}
+ virtual ~wxRichTextUICustomization() {}
+
+ /// Show the help given the current active window, and a help topic id.
+ virtual bool ShowHelp(wxWindow* win, long id) = 0;
+};
+
+/**
+ @class wxRichTextHelpInfo
+ This class is used as a static member of dialogs, to store the help topic for the dialog
+ and also the customization object that will allow help to be shown appropriately for the application.
+ **/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextHelpInfo
+{
+public:
+ wxRichTextHelpInfo()
+ {
+ m_helpTopic = -1;
+ m_uiCustomization = NULL;
+ }
+ virtual ~wxRichTextHelpInfo() {}
+
+ virtual bool ShowHelp(wxWindow* win)
+ {
+ if ( !m_uiCustomization || m_helpTopic == -1 )
+ return false;
+
+ return m_uiCustomization->ShowHelp(win, m_helpTopic);
+ }
+
+ /// Get the help topic identifier.
+ long GetHelpId() const { return m_helpTopic; }
+
+ /// Set the help topic identifier.
+ void SetHelpId(long id) { m_helpTopic = id; }
+
+ /// Get the UI customization object.
+ wxRichTextUICustomization* GetUICustomization() const { return m_uiCustomization; }
+
+ /// Set the UI customization object.
+ void SetUICustomization(wxRichTextUICustomization* customization) { m_uiCustomization = customization; }
+
+ /// Is there a valid help topic id?
+ bool HasHelpId() const { return m_helpTopic != -1; }
+
+ /// Is there a valid customization object?
+ bool HasUICustomization() const { return m_uiCustomization != NULL; }
+
+protected:
+ wxRichTextUICustomization* m_uiCustomization;
+ long m_helpTopic;
+};
+
+/// Add this to the base class of dialogs
+
+#define DECLARE_BASE_CLASS_HELP_PROVISION() \
+ virtual long GetHelpId() const = 0; \
+ virtual wxRichTextUICustomization* GetUICustomization() const = 0; \
+ virtual bool ShowHelp(wxWindow* win) = 0;
+
+/// A macro to make it easy to add help topic provision and UI customization
+/// to a class. Optionally, add virtual functions to a base class
+/// using DECLARE_BASE_CLASS_HELP_PROVISION. This means that the formatting dialog
+/// can obtain help topics from its individual pages without needing
+/// to know in advance what page classes are being used, allowing for extension
+/// of the formatting dialog.
+
+#define DECLARE_HELP_PROVISION() \
+ virtual long GetHelpId() const { return sm_helpInfo.GetHelpId(); } \
+ virtual void SetHelpId(long id) { sm_helpInfo.SetHelpId(id); } \
+ virtual wxRichTextUICustomization* GetUICustomization() const { return sm_helpInfo.GetUICustomization(); } \
+ virtual void SetUICustomization(wxRichTextUICustomization* customization) { sm_helpInfo.SetUICustomization(customization); } \
+ virtual bool ShowHelp(wxWindow* win) { return sm_helpInfo.ShowHelp(win); } \
+public: \
+ static wxRichTextHelpInfo& GetHelpInfo() { return sm_helpInfo; }\
+protected: \
+ static wxRichTextHelpInfo sm_helpInfo; \
+public:
+
+/// Add this to the implementation file for each dialog that needs help provision.
+
+#define IMPLEMENT_HELP_PROVISION(theClass) \
+ wxRichTextHelpInfo theClass::sm_helpInfo;
+
+#endif
+ // wxUSE_RICHTEXT
+
+#endif
+ // _WX_RICHTEXTUICUSTOMIZATION_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtext/richtextxml.h
+// Purpose: XML and HTML I/O for wxRichTextCtrl
+// Author: Julian Smart
+// Modified by:
+// Created: 2005-09-30
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RICHTEXTXML_H_
+#define _WX_RICHTEXTXML_H_
+
+/*!
+ * Includes
+ */
+
+#include "wx/hashmap.h"
+#include "wx/richtext/richtextbuffer.h"
+#include "wx/richtext/richtextstyles.h"
+
+#if wxUSE_RICHTEXT && wxUSE_XML
+
+/*!
+ @class wxRichTextXMLHelper
+ A utility class to help with XML import/export, that can be used outside
+ saving a buffer if needed.
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextXMLHelper: public wxObject
+{
+public:
+ wxRichTextXMLHelper() { Init(); }
+ wxRichTextXMLHelper(const wxString& enc) { Init(); SetupForSaving(enc); }
+ ~wxRichTextXMLHelper();
+
+ void Init();
+
+ void SetupForSaving(const wxString& enc);
+
+ void Clear();
+
+ void SetFileEncoding(const wxString& encoding) { m_fileEncoding = encoding; }
+ const wxString& GetFileEncoding() const { return m_fileEncoding; }
+
+ // Convert a colour to a 6-digit hex string
+ static wxString ColourToHexString(const wxColour& col);
+
+ // Convert 6-digit hex string to a colour
+ static wxColour HexStringToColour(const wxString& hex);
+
+ static wxString MakeString(const int& v) { return wxString::Format(wxT("%d"), v); }
+ static wxString MakeString(const long& v) { return wxString::Format(wxT("%ld"), v); }
+ static wxString MakeString(const double& v) { return wxString::Format(wxT("%.2f"), (float) v); }
+ static wxString MakeString(const wxString& s) { return s; }
+ static wxString MakeString(const wxColour& col) { return wxT("#") + ColourToHexString(col); }
+
+ static bool HasParam(wxXmlNode* node, const wxString& param);
+ static wxXmlNode *GetParamNode(wxXmlNode* node, const wxString& param);
+ static wxString GetNodeContent(wxXmlNode *node);
+ static wxString GetParamValue(wxXmlNode *node, const wxString& param);
+ static wxString GetText(wxXmlNode *node, const wxString& param = wxEmptyString);
+ static wxXmlNode* FindNode(wxXmlNode* node, const wxString& name);
+
+ static wxString AttributeToXML(const wxString& str);
+
+ static bool RichTextFixFaceName(wxString& facename);
+ static long ColourStringToLong(const wxString& colStr);
+ static wxTextAttrDimension ParseDimension(const wxString& dimStr);
+
+ // Make a string from the given property. This can be overridden for custom variants.
+ virtual wxString MakeStringFromProperty(const wxVariant& var);
+
+ // Create a proprty from the string read from the XML file.
+ virtual wxVariant MakePropertyFromString(const wxString& name, const wxString& value, const wxString& type);
+
+ // Import properties
+ virtual bool ImportProperties(wxRichTextProperties& properties, wxXmlNode* node);
+
+ virtual bool ImportStyle(wxRichTextAttr& attr, wxXmlNode* node, bool isPara = false);
+ virtual bool ImportStyleDefinition(wxRichTextStyleSheet* sheet, wxXmlNode* node);
+
+ // Get flags, as per handler flags
+ int GetFlags() const { return m_flags; }
+ void SetFlags(int flags) { m_flags = flags; }
+
+#if wxRICHTEXT_HAVE_DIRECT_OUTPUT
+ // write string to output
+ static void OutputString(wxOutputStream& stream, const wxString& str,
+ wxMBConv *convMem, wxMBConv *convFile);
+
+ static void OutputIndentation(wxOutputStream& stream, int indent);
+
+ // Same as above, but create entities first.
+ // Translates '<' to "<", '>' to ">" and '&' to "&"
+ static void OutputStringEnt(wxOutputStream& stream, const wxString& str,
+ wxMBConv *convMem, wxMBConv *convFile);
+
+ void OutputString(wxOutputStream& stream, const wxString& str);
+ void OutputStringEnt(wxOutputStream& stream, const wxString& str);
+
+ static void AddString(wxString& str, const int& v) { str << wxString::Format(wxT("%d"), v); }
+ static void AddString(wxString& str, const long& v) { str << wxString::Format(wxT("%ld"), v); }
+ static void AddString(wxString& str, const double& v) { str << wxString::Format(wxT("%.2f"), (float) v); }
+ static void AddString(wxString& str, const wxChar* s) { str << s; }
+ static void AddString(wxString& str, const wxString& s) { str << s; }
+ static void AddString(wxString& str, const wxColour& col) { str << wxT("#") << ColourToHexString(col); }
+
+ static void AddAttribute(wxString& str, const wxString& name, const int& v);
+ static void AddAttribute(wxString& str, const wxString& name, const long& v);
+ static void AddAttribute(wxString& str, const wxString& name, const double& v);
+ static void AddAttribute(wxString& str, const wxString& name, const wxChar* s);
+ static void AddAttribute(wxString& str, const wxString& name, const wxString& s);
+ static void AddAttribute(wxString& str, const wxString& name, const wxColour& col);
+ static void AddAttribute(wxString& str, const wxString& name, const wxTextAttrDimension& dim);
+ static void AddAttribute(wxString& str, const wxString& rootName, const wxTextAttrDimensions& dims);
+ static void AddAttribute(wxString& str, const wxString& rootName, const wxTextAttrBorder& border);
+ static void AddAttribute(wxString& str, const wxString& rootName, const wxTextAttrBorders& borders);
+
+ /// Create a string containing style attributes
+ static wxString AddAttributes(const wxRichTextAttr& attr, bool isPara = false);
+ virtual bool ExportStyleDefinition(wxOutputStream& stream, wxRichTextStyleDefinition* def, int level);
+
+ virtual bool WriteProperties(wxOutputStream& stream, const wxRichTextProperties& properties, int level);
+#endif
+
+#if wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT
+ static void AddAttribute(wxXmlNode* node, const wxString& name, const int& v);
+ static void AddAttribute(wxXmlNode* node, const wxString& name, const long& v);
+ static void AddAttribute(wxXmlNode* node, const wxString& name, const double& v);
+ static void AddAttribute(wxXmlNode* node, const wxString& name, const wxString& s);
+ static void AddAttribute(wxXmlNode* node, const wxString& name, const wxColour& col);
+ static void AddAttribute(wxXmlNode* node, const wxString& name, const wxTextAttrDimension& dim);
+ static void AddAttribute(wxXmlNode* node, const wxString& rootName, const wxTextAttrDimensions& dims);
+ static void AddAttribute(wxXmlNode* node, const wxString& rootName, const wxTextAttrBorder& border);
+ static void AddAttribute(wxXmlNode* node, const wxString& rootName, const wxTextAttrBorders& borders);
+
+ static bool AddAttributes(wxXmlNode* node, wxRichTextAttr& attr, bool isPara = false);
+
+ virtual bool ExportStyleDefinition(wxXmlNode* parent, wxRichTextStyleDefinition* def);
+
+ // Write the properties
+ virtual bool WriteProperties(wxXmlNode* node, const wxRichTextProperties& properties);
+#endif
+
+public:
+
+#if wxRICHTEXT_HAVE_DIRECT_OUTPUT
+ // Used during saving
+ wxMBConv* m_convMem;
+ wxMBConv* m_convFile;
+ bool m_deleteConvFile;
+#endif
+
+ wxString m_fileEncoding;
+ int m_flags;
+};
+
+/*!
+ @class wxRichTextXMLHandler
+
+ Implements XML loading and saving. Two methods of saving are included:
+ writing directly to a text stream, and populating an wxXmlDocument
+ before writing it. The former method is considerably faster, so we favour
+ that one, even though the code is a little less elegant.
+ */
+
+class WXDLLIMPEXP_FWD_XML wxXmlNode;
+class WXDLLIMPEXP_FWD_XML wxXmlDocument;
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextXMLHandler: public wxRichTextFileHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxRichTextXMLHandler)
+public:
+ wxRichTextXMLHandler(const wxString& name = wxT("XML"), const wxString& ext = wxT("xml"), int type = wxRICHTEXT_TYPE_XML)
+ : wxRichTextFileHandler(name, ext, type)
+ { Init(); }
+
+ void Init();
+
+#if wxUSE_STREAMS
+
+#if wxRICHTEXT_HAVE_DIRECT_OUTPUT
+ /// Recursively export an object
+ bool ExportXML(wxOutputStream& stream, wxRichTextObject& obj, int level);
+#endif
+
+#if wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT
+ bool ExportXML(wxXmlNode* parent, wxRichTextObject& obj);
+#endif
+
+ /// Recursively import an object
+ bool ImportXML(wxRichTextBuffer* buffer, wxRichTextObject* obj, wxXmlNode* node);
+#endif
+
+ /// Creates an object given an XML element name
+ virtual wxRichTextObject* CreateObjectForXMLName(wxRichTextObject* parent, const wxString& name) const;
+
+ /// Can we save using this handler?
+ virtual bool CanSave() const { return true; }
+
+ /// Can we load using this handler?
+ virtual bool CanLoad() const { return true; }
+
+ /// Returns the XML helper object, implementing functionality
+ /// that can be reused elsewhere.
+ wxRichTextXMLHelper& GetHelper() { return m_helper; }
+
+// Implementation
+
+ /**
+ Call with XML node name, C++ class name so that wxRTC can read in the node.
+ If you add a custom object, call this.
+ */
+ static void RegisterNodeName(const wxString& nodeName, const wxString& className) { sm_nodeNameToClassMap[nodeName] = className; }
+
+ /**
+ Cleans up the mapping between node name and C++ class.
+ */
+ static void ClearNodeToClassMap() { sm_nodeNameToClassMap.clear(); }
+
+protected:
+#if wxUSE_STREAMS
+ virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream);
+ virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream);
+#endif
+
+ wxRichTextXMLHelper m_helper;
+
+ static wxStringToStringHashMap sm_nodeNameToClassMap;
+};
+
+#endif
+ // wxUSE_RICHTEXT && wxUSE_XML
+
+#endif
+ // _WX_RICHTEXTXML_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/richtooltip.h
+// Purpose: Declaration of wxRichToolTip class.
+// Author: Vadim Zeitlin
+// Created: 2011-10-07
+// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RICHTOOLTIP_H_
+#define _WX_RICHTOOLTIP_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_RICHTOOLTIP
+
+#include "wx/colour.h"
+
+class WXDLLIMPEXP_FWD_CORE wxFont;
+class WXDLLIMPEXP_FWD_CORE wxIcon;
+class WXDLLIMPEXP_FWD_CORE wxWindow;
+
+class wxRichToolTipImpl;
+
+// This enum describes the kind of the tip shown which combines both the tip
+// position and appearance because the two are related (when the tip is
+// positioned asymmetrically, a right handed triangle is used but an
+// equilateral one when it's in the middle of a side).
+//
+// Automatic selects the tip appearance best suited for the current platform
+// and the position best suited for the window the tooltip is shown for, i.e.
+// chosen in such a way that the tooltip is always fully on screen.
+//
+// Other values describe the position of the tooltip itself, not the window it
+// relates to. E.g. wxTipKind_Top places the tip on the top of the tooltip and
+// so the tooltip itself is located beneath its associated window.
+enum wxTipKind
+{
+ wxTipKind_None,
+ wxTipKind_TopLeft,
+ wxTipKind_Top,
+ wxTipKind_TopRight,
+ wxTipKind_BottomLeft,
+ wxTipKind_Bottom,
+ wxTipKind_BottomRight,
+ wxTipKind_Auto
+};
+
+// ----------------------------------------------------------------------------
+// wxRichToolTip: a customizable but not necessarily native tooltip.
+// ----------------------------------------------------------------------------
+
+// Notice that this class does not inherit from wxWindow.
+class WXDLLIMPEXP_ADV wxRichToolTip
+{
+public:
+ // Ctor must specify the tooltip title and main message, additional
+ // attributes can be set later.
+ wxRichToolTip(const wxString& title, const wxString& message);
+
+ // Set the background colour: if two colours are specified, the background
+ // is drawn using a gradient from top to bottom, otherwise a single solid
+ // colour is used.
+ void SetBackgroundColour(const wxColour& col,
+ const wxColour& colEnd = wxColour());
+
+ // Set the small icon to show: either one of the standard information/
+ // warning/error ones (the question icon doesn't make sense for a tooltip)
+ // or a custom icon.
+ void SetIcon(int icon = wxICON_INFORMATION);
+ void SetIcon(const wxIcon& icon);
+
+ // Set timeout after which the tooltip should disappear, in milliseconds.
+ // By default the tooltip is hidden after system-dependent interval of time
+ // elapses but this method can be used to change this or also disable
+ // hiding the tooltip automatically entirely by passing 0 in this parameter
+ // (but doing this can result in native version not being used).
+ // Optionally specify a show delay.
+ void SetTimeout(unsigned milliseconds, unsigned millisecondsShowdelay = 0);
+
+ // Choose the tip kind, possibly none. By default the tip is positioned
+ // automatically, as if wxTipKind_Auto was used.
+ void SetTipKind(wxTipKind tipKind);
+
+ // Set the title text font. By default it's emphasized using the font style
+ // or colour appropriate for the current platform.
+ void SetTitleFont(const wxFont& font);
+
+ // Show the tooltip for the given window and optionally a specified area.
+ void ShowFor(wxWindow* win, const wxRect* rect = NULL);
+
+ // Non-virtual dtor as this class is not supposed to be derived from.
+ ~wxRichToolTip();
+
+private:
+ wxRichToolTipImpl* const m_impl;
+
+ wxDECLARE_NO_COPY_CLASS(wxRichToolTip);
+};
+
+#endif // wxUSE_RICHTOOLTIP
+
+#endif // _WX_RICHTOOLTIP_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/rtti.h
+// Purpose: old RTTI macros (use XTI when possible instead)
+// Author: Julian Smart
+// Modified by: Ron Lee
+// Created: 01/02/97
+// Copyright: (c) 1997 Julian Smart
+// (c) 2001 Ron Lee <ron@debian.org>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_RTTIH__
+#define _WX_RTTIH__
+
+#if !wxUSE_EXTENDED_RTTI // XTI system is meant to replace these macros
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/memory.h"
+
+// ----------------------------------------------------------------------------
+// forward declarations
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_BASE wxObject;
+class WXDLLIMPEXP_FWD_BASE wxString;
+class WXDLLIMPEXP_FWD_BASE wxClassInfo;
+class WXDLLIMPEXP_FWD_BASE wxHashTable;
+class WXDLLIMPEXP_FWD_BASE wxObject;
+class WXDLLIMPEXP_FWD_BASE wxPluginLibrary;
+class WXDLLIMPEXP_FWD_BASE wxHashTable_Node;
+
+// ----------------------------------------------------------------------------
+// wxClassInfo
+// ----------------------------------------------------------------------------
+
+typedef wxObject *(*wxObjectConstructorFn)(void);
+
+class WXDLLIMPEXP_BASE wxClassInfo
+{
+ friend class WXDLLIMPEXP_FWD_BASE wxObject;
+ friend WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name);
+public:
+ wxClassInfo( const wxChar *className,
+ const wxClassInfo *baseInfo1,
+ const wxClassInfo *baseInfo2,
+ int size,
+ wxObjectConstructorFn ctor )
+ : m_className(className)
+ , m_objectSize(size)
+ , m_objectConstructor(ctor)
+ , m_baseInfo1(baseInfo1)
+ , m_baseInfo2(baseInfo2)
+ , m_next(sm_first)
+ {
+ sm_first = this;
+ Register();
+ }
+
+ ~wxClassInfo();
+
+ wxObject *CreateObject() const
+ { return m_objectConstructor ? (*m_objectConstructor)() : 0; }
+ bool IsDynamic() const { return (NULL != m_objectConstructor); }
+
+ const wxChar *GetClassName() const { return m_className; }
+ const wxChar *GetBaseClassName1() const
+ { return m_baseInfo1 ? m_baseInfo1->GetClassName() : NULL; }
+ const wxChar *GetBaseClassName2() const
+ { return m_baseInfo2 ? m_baseInfo2->GetClassName() : NULL; }
+ const wxClassInfo *GetBaseClass1() const { return m_baseInfo1; }
+ const wxClassInfo *GetBaseClass2() const { return m_baseInfo2; }
+ int GetSize() const { return m_objectSize; }
+
+ wxObjectConstructorFn GetConstructor() const
+ { return m_objectConstructor; }
+ static const wxClassInfo *GetFirst() { return sm_first; }
+ const wxClassInfo *GetNext() const { return m_next; }
+ static wxClassInfo *FindClass(const wxString& className);
+
+ // Climb upwards through inheritance hierarchy.
+ // Dual inheritance is catered for.
+
+ bool IsKindOf(const wxClassInfo *info) const
+ {
+ return info != 0 &&
+ ( info == this ||
+ ( m_baseInfo1 && m_baseInfo1->IsKindOf(info) ) ||
+ ( m_baseInfo2 && m_baseInfo2->IsKindOf(info) ) );
+ }
+
+ wxDECLARE_CLASS_INFO_ITERATORS();
+
+private:
+ const wxChar *m_className;
+ int m_objectSize;
+ wxObjectConstructorFn m_objectConstructor;
+
+ // Pointers to base wxClassInfos
+
+ const wxClassInfo *m_baseInfo1;
+ const wxClassInfo *m_baseInfo2;
+
+ // class info object live in a linked list:
+ // pointers to its head and the next element in it
+
+ static wxClassInfo *sm_first;
+ wxClassInfo *m_next;
+
+ static wxHashTable *sm_classTable;
+
+protected:
+ // registers the class
+ void Register();
+ void Unregister();
+
+ wxDECLARE_NO_COPY_CLASS(wxClassInfo);
+};
+
+WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name);
+
+// ----------------------------------------------------------------------------
+// Dynamic class macros
+// ----------------------------------------------------------------------------
+
+#define wxDECLARE_ABSTRACT_CLASS(name) \
+ public: \
+ static wxClassInfo ms_classInfo; \
+ virtual wxClassInfo *GetClassInfo() const
+
+#define wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \
+ wxDECLARE_NO_ASSIGN_CLASS(name); \
+ wxDECLARE_DYNAMIC_CLASS(name)
+
+#define wxDECLARE_DYNAMIC_CLASS_NO_COPY(name) \
+ wxDECLARE_NO_COPY_CLASS(name); \
+ wxDECLARE_DYNAMIC_CLASS(name)
+
+#define wxDECLARE_DYNAMIC_CLASS(name) \
+ wxDECLARE_ABSTRACT_CLASS(name); \
+ static wxObject* wxCreateObject()
+
+#define wxDECLARE_CLASS(name) \
+ wxDECLARE_ABSTRACT_CLASS(name)
+
+
+// common part of the macros below
+#define wxIMPLEMENT_CLASS_COMMON(name, basename, baseclsinfo2, func) \
+ wxClassInfo name::ms_classInfo(wxT(#name), \
+ &basename::ms_classInfo, \
+ baseclsinfo2, \
+ (int) sizeof(name), \
+ func); \
+ \
+ wxClassInfo *name::GetClassInfo() const \
+ { return &name::ms_classInfo; }
+
+#define wxIMPLEMENT_CLASS_COMMON1(name, basename, func) \
+ wxIMPLEMENT_CLASS_COMMON(name, basename, NULL, func)
+
+#define wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, func) \
+ wxIMPLEMENT_CLASS_COMMON(name, basename1, &basename2::ms_classInfo, func)
+
+// -----------------------------------
+// for concrete classes
+// -----------------------------------
+
+ // Single inheritance with one base class
+#define wxIMPLEMENT_DYNAMIC_CLASS(name, basename) \
+ wxIMPLEMENT_CLASS_COMMON1(name, basename, name::wxCreateObject) \
+ wxObject* name::wxCreateObject() \
+ { return new name; }
+
+ // Multiple inheritance with two base classes
+#define wxIMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) \
+ wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, \
+ name::wxCreateObject) \
+ wxObject* name::wxCreateObject() \
+ { return new name; }
+
+// -----------------------------------
+// for abstract classes
+// -----------------------------------
+
+ // Single inheritance with one base class
+#define wxIMPLEMENT_ABSTRACT_CLASS(name, basename) \
+ wxIMPLEMENT_CLASS_COMMON1(name, basename, NULL)
+
+ // Multiple inheritance with two base classes
+#define wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \
+ wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, NULL)
+
+// -----------------------------------
+// XTI-compatible macros
+// -----------------------------------
+
+#include "wx/flags.h"
+
+// these macros only do something when wxUSE_EXTENDED_RTTI=1
+// (and in that case they are defined by xti.h); however to avoid
+// to be forced to wrap these macros (in user's source files) with
+//
+// #if wxUSE_EXTENDED_RTTI
+// ...
+// #endif
+//
+// blocks, we define them here as empty.
+
+#define wxEMPTY_PARAMETER_VALUE /**/
+
+#define wxBEGIN_ENUM( e ) wxEMPTY_PARAMETER_VALUE
+#define wxENUM_MEMBER( v ) wxEMPTY_PARAMETER_VALUE
+#define wxEND_ENUM( e ) wxEMPTY_PARAMETER_VALUE
+
+#define wxIMPLEMENT_SET_STREAMING(SetName,e) wxEMPTY_PARAMETER_VALUE
+
+#define wxBEGIN_FLAGS( e ) wxEMPTY_PARAMETER_VALUE
+#define wxFLAGS_MEMBER( v ) wxEMPTY_PARAMETER_VALUE
+#define wxEND_FLAGS( e ) wxEMPTY_PARAMETER_VALUE
+
+#define wxCOLLECTION_TYPE_INFO( element, collection ) wxEMPTY_PARAMETER_VALUE
+
+#define wxHANDLER(name,eventClassType) wxEMPTY_PARAMETER_VALUE
+#define wxBEGIN_HANDLERS_TABLE(theClass) wxEMPTY_PARAMETER_VALUE
+#define wxEND_HANDLERS_TABLE() wxEMPTY_PARAMETER_VALUE
+
+#define wxIMPLEMENT_DYNAMIC_CLASS_XTI( name, basename, unit ) \
+ wxIMPLEMENT_DYNAMIC_CLASS( name, basename )
+#define wxIMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK( name, basename, unit, callback ) \
+ wxIMPLEMENT_DYNAMIC_CLASS( name, basename )
+
+#define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI( name, basename, unit ) \
+ wxIMPLEMENT_DYNAMIC_CLASS( name, basename)
+
+#define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( name, basename, \
+ unit, toString, \
+ fromString ) wxEMPTY_PARAMETER_VALUE
+#define wxIMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_NO_BASE_XTI( name, unit ) wxEMPTY_PARAMETER_VALUE
+#define wxIMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_XTI( name, basename, unit ) wxEMPTY_PARAMETER_VALUE
+
+#define wxIMPLEMENT_DYNAMIC_CLASS2_XTI( name, basename, basename2, unit) wxIMPLEMENT_DYNAMIC_CLASS2( name, basename, basename2 )
+
+#define wxCONSTRUCTOR_0(klass) \
+ wxEMPTY_PARAMETER_VALUE
+#define wxCONSTRUCTOR_DUMMY(klass) \
+ wxEMPTY_PARAMETER_VALUE
+#define wxDIRECT_CONSTRUCTOR_0(klass) \
+ wxEMPTY_PARAMETER_VALUE
+#define wxCONSTRUCTOR_1(klass,t0,v0) \
+ wxEMPTY_PARAMETER_VALUE
+#define wxDIRECT_CONSTRUCTOR_1(klass,t0,v0) \
+ wxEMPTY_PARAMETER_VALUE
+#define wxCONSTRUCTOR_2(klass,t0,v0,t1,v1) \
+ wxEMPTY_PARAMETER_VALUE
+#define wxDIRECT_CONSTRUCTOR_2(klass,t0,v0,t1,v1) \
+ wxEMPTY_PARAMETER_VALUE
+#define wxCONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \
+ wxEMPTY_PARAMETER_VALUE
+#define wxDIRECT_CONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \
+ wxEMPTY_PARAMETER_VALUE
+#define wxCONSTRUCTOR_4(klass,t0,v0,t1,v1,t2,v2,t3,v3) \
+ wxEMPTY_PARAMETER_VALUE
+#define wxDIRECT_CONSTRUCTOR_4(klass,t0,v0,t1,v1,t2,v2,t3,v3) \
+ wxEMPTY_PARAMETER_VALUE
+#define wxCONSTRUCTOR_5(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \
+ wxEMPTY_PARAMETER_VALUE
+#define wxDIRECT_CONSTRUCTOR_5(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \
+ wxEMPTY_PARAMETER_VALUE
+#define wxCONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \
+ wxEMPTY_PARAMETER_VALUE
+#define wxDIRECT_CONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \
+ wxEMPTY_PARAMETER_VALUE
+#define wxCONSTRUCTOR_7(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \
+ wxEMPTY_PARAMETER_VALUE
+#define wxDIRECT_CONSTRUCTOR_7(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \
+ wxEMPTY_PARAMETER_VALUE
+#define wxCONSTRUCTOR_8(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \
+ wxEMPTY_PARAMETER_VALUE
+#define wxDIRECT_CONSTRUCTOR_8(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \
+ wxEMPTY_PARAMETER_VALUE
+
+#define wxSETTER( property, Klass, valueType, setterMethod ) wxEMPTY_PARAMETER_VALUE
+#define wxGETTER( property, Klass, valueType, gettermethod ) wxEMPTY_PARAMETER_VALUE
+#define wxADDER( property, Klass, valueType, addermethod ) wxEMPTY_PARAMETER_VALUE
+#define wxCOLLECTION_GETTER( property, Klass, valueType, gettermethod ) wxEMPTY_PARAMETER_VALUE
+
+#define wxBEGIN_PROPERTIES_TABLE(theClass) wxEMPTY_PARAMETER_VALUE
+#define wxEND_PROPERTIES_TABLE() wxEMPTY_PARAMETER_VALUE
+#define wxHIDE_PROPERTY( pname ) wxEMPTY_PARAMETER_VALUE
+
+#define wxPROPERTY( pname, type, setter, getter, defaultValue, flags, help, group) \
+ wxEMPTY_PARAMETER_VALUE
+
+#define wxPROPERTY_FLAGS( pname, flags, type, setter, getter,defaultValue, \
+ pflags, help, group) wxEMPTY_PARAMETER_VALUE
+
+#define wxREADONLY_PROPERTY( pname, type, getter,defaultValue, flags, help, group) \
+ wxGETTER( pname, class_t, type, getter ) wxEMPTY_PARAMETER_VALUE
+
+#define wxREADONLY_PROPERTY_FLAGS( pname, flags, type, getter,defaultValue, \
+ pflags, help, group) wxEMPTY_PARAMETER_VALUE
+
+#define wxPROPERTY_COLLECTION( pname, colltype, addelemtype, adder, getter, \
+ flags, help, group ) wxEMPTY_PARAMETER_VALUE
+
+#define wxREADONLY_PROPERTY_COLLECTION( pname, colltype, addelemtype, getter, \
+ flags, help, group) wxEMPTY_PARAMETER_VALUE
+#define wxEVENT_PROPERTY( name, eventType, eventClass ) wxEMPTY_PARAMETER_VALUE
+
+#define wxEVENT_RANGE_PROPERTY( name, eventType, lastEventType, eventClass ) wxEMPTY_PARAMETER_VALUE
+
+#define wxIMPLEMENT_PROPERTY(name, type) wxEMPTY_PARAMETER_VALUE
+
+#define wxEMPTY_HANDLERS_TABLE(name) wxEMPTY_PARAMETER_VALUE
+
+#endif // !wxUSE_EXTENDED_RTTI
+#endif // _WX_RTTIH__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/sashwin.h
+// Purpose: Base header for wxSashWindow
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SASHWIN_H_BASE_
+#define _WX_SASHWIN_H_BASE_
+
+#include "wx/generic/sashwin.h"
+
+#endif
+ // _WX_SASHWIN_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/sckaddr.h
+// Purpose: Network address classes
+// Author: Guilhem Lavaux
+// Modified by: Vadim Zeitlin to switch to wxSockAddressImpl implementation
+// Created: 26/04/1997
+// Copyright: (c) 1997, 1998 Guilhem Lavaux
+// (c) 2008, 2009 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SCKADDR_H_
+#define _WX_SCKADDR_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_SOCKETS
+
+#include "wx/string.h"
+
+class wxSockAddressImpl;
+
+// forward declare it instead of including the system headers defining it which
+// can bring in <windows.h> under Windows which we don't want to include from
+// public wx headers
+struct sockaddr;
+
+// Any socket address kind
+class WXDLLIMPEXP_NET wxSockAddress : public wxObject
+{
+public:
+ enum Family
+ {
+ NONE,
+ IPV4,
+ IPV6,
+ UNIX
+ };
+
+ wxSockAddress();
+ wxSockAddress(const wxSockAddress& other);
+ virtual ~wxSockAddress();
+
+ wxSockAddress& operator=(const wxSockAddress& other);
+
+ virtual void Clear();
+ virtual Family Type() = 0;
+
+ // accessors for the low level address represented by this object
+ const sockaddr *GetAddressData() const;
+ int GetAddressDataLen() const;
+
+ // we need to be able to create copies of the addresses polymorphically
+ // (i.e. without knowing the exact address class)
+ virtual wxSockAddress *Clone() const = 0;
+
+
+ // implementation only, don't use
+ const wxSockAddressImpl& GetAddress() const { return *m_impl; }
+ void SetAddress(const wxSockAddressImpl& address);
+
+protected:
+ wxSockAddressImpl *m_impl;
+
+private:
+ void Init();
+ DECLARE_ABSTRACT_CLASS(wxSockAddress)
+};
+
+// An IP address (either IPv4 or IPv6)
+class WXDLLIMPEXP_NET wxIPaddress : public wxSockAddress
+{
+public:
+ wxIPaddress() : wxSockAddress() { }
+ wxIPaddress(const wxIPaddress& other)
+ : wxSockAddress(other),
+ m_origHostname(other.m_origHostname)
+ {
+ }
+
+ bool operator==(const wxIPaddress& addr) const;
+
+ bool Hostname(const wxString& name);
+ bool Service(const wxString& name);
+ bool Service(unsigned short port);
+
+ bool LocalHost();
+ virtual bool IsLocalHost() const = 0;
+
+ bool AnyAddress();
+
+ virtual wxString IPAddress() const = 0;
+
+ wxString Hostname() const;
+ unsigned short Service() const;
+
+ wxString OrigHostname() const { return m_origHostname; }
+
+protected:
+ // get m_impl initialized to the right family if it hadn't been done yet
+ wxSockAddressImpl& GetImpl();
+ const wxSockAddressImpl& GetImpl() const
+ {
+ return const_cast<wxIPaddress *>(this)->GetImpl();
+ }
+
+ // host name originally passed to Hostname()
+ wxString m_origHostname;
+
+private:
+ // create the wxSockAddressImpl object of the correct family if it's
+ // currently uninitialized
+ virtual void DoInitImpl() = 0;
+
+
+ DECLARE_ABSTRACT_CLASS(wxIPaddress)
+};
+
+// An IPv4 address
+class WXDLLIMPEXP_NET wxIPV4address : public wxIPaddress
+{
+public:
+ wxIPV4address() : wxIPaddress() { }
+ wxIPV4address(const wxIPV4address& other) : wxIPaddress(other) { }
+
+ // implement wxSockAddress pure virtuals:
+ virtual Family Type() { return IPV4; }
+ virtual wxSockAddress *Clone() const { return new wxIPV4address(*this); }
+
+
+ // implement wxIPaddress pure virtuals:
+ virtual bool IsLocalHost() const;
+
+ virtual wxString IPAddress() const;
+
+
+ // IPv4-specific methods:
+ bool Hostname(unsigned long addr);
+
+ // make base class methods hidden by our overload visible
+ //
+ // FIXME-VC6: replace this with "using IPAddress::Hostname" (not supported
+ // by VC6) when support for it is dropped
+ wxString Hostname() const { return wxIPaddress::Hostname(); }
+ bool Hostname(const wxString& name) { return wxIPaddress::Hostname(name); }
+
+ bool BroadcastAddress();
+
+private:
+ virtual void DoInitImpl();
+
+ DECLARE_DYNAMIC_CLASS(wxIPV4address)
+};
+
+
+#if wxUSE_IPV6
+
+// An IPv6 address
+class WXDLLIMPEXP_NET wxIPV6address : public wxIPaddress
+{
+public:
+ wxIPV6address() : wxIPaddress() { }
+ wxIPV6address(const wxIPV6address& other) : wxIPaddress(other) { }
+
+ // implement wxSockAddress pure virtuals:
+ virtual Family Type() { return IPV6; }
+ virtual wxSockAddress *Clone() const { return new wxIPV6address(*this); }
+
+
+ // implement wxIPaddress pure virtuals:
+ virtual bool IsLocalHost() const;
+
+ virtual wxString IPAddress() const;
+
+ // IPv6-specific methods:
+ bool Hostname(unsigned char addr[16]);
+
+ using wxIPaddress::Hostname;
+
+private:
+ virtual void DoInitImpl();
+
+ DECLARE_DYNAMIC_CLASS(wxIPV6address)
+};
+
+#endif // wxUSE_IPV6
+
+// Unix domain sockets are only available under, well, Unix
+#if defined(__UNIX__) && !defined(__WINDOWS__) && !defined(__WINE__)
+ #define wxHAS_UNIX_DOMAIN_SOCKETS
+#endif
+
+#ifdef wxHAS_UNIX_DOMAIN_SOCKETS
+
+// A Unix domain socket address
+class WXDLLIMPEXP_NET wxUNIXaddress : public wxSockAddress
+{
+public:
+ wxUNIXaddress() : wxSockAddress() { }
+ wxUNIXaddress(const wxUNIXaddress& other) : wxSockAddress(other) { }
+
+ void Filename(const wxString& name);
+ wxString Filename() const;
+
+ virtual Family Type() { return UNIX; }
+ virtual wxSockAddress *Clone() const { return new wxUNIXaddress(*this); }
+
+private:
+ wxSockAddressImpl& GetUNIX();
+ const wxSockAddressImpl& GetUNIX() const
+ {
+ return const_cast<wxUNIXaddress *>(this)->GetUNIX();
+ }
+
+ DECLARE_DYNAMIC_CLASS(wxUNIXaddress)
+};
+
+#endif // wxHAS_UNIX_DOMAIN_SOCKETS
+
+#endif // wxUSE_SOCKETS
+
+#endif // _WX_SCKADDR_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/sckipc.h
+// Purpose: Interprocess communication implementation (wxSocket version)
+// Author: Julian Smart
+// Modified by: Guilhem Lavaux (big rewrite) May 1997, 1998
+// Guillermo Rodriguez (updated for wxSocket v2) Jan 2000
+// (callbacks deprecated) Mar 2000
+// Created: 1993
+// Copyright: (c) Julian Smart 1993
+// (c) Guilhem Lavaux 1997, 1998
+// (c) 2000 Guillermo Rodriguez <guille@iies.es>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SCKIPC_H
+#define _WX_SCKIPC_H
+
+#include "wx/defs.h"
+
+#if wxUSE_SOCKETS && wxUSE_IPC
+
+#include "wx/ipcbase.h"
+#include "wx/socket.h"
+#include "wx/sckstrm.h"
+#include "wx/datstrm.h"
+
+/*
+ * Mini-DDE implementation
+
+ Most transactions involve a topic name and an item name (choose these
+ as befits your application).
+
+ A client can:
+
+ - ask the server to execute commands (data) associated with a topic
+ - request data from server by topic and item
+ - poke data into the server
+ - ask the server to start an advice loop on topic/item
+ - ask the server to stop an advice loop
+
+ A server can:
+
+ - respond to execute, request, poke and advice start/stop
+ - send advise data to client
+
+ Note that this limits the server in the ways it can send data to the
+ client, i.e. it can't send unsolicited information.
+ *
+ */
+
+class WXDLLIMPEXP_FWD_NET wxTCPServer;
+class WXDLLIMPEXP_FWD_NET wxTCPClient;
+
+class wxIPCSocketStreams;
+
+class WXDLLIMPEXP_NET wxTCPConnection : public wxConnectionBase
+{
+public:
+ wxTCPConnection() { Init(); }
+ wxTCPConnection(void *buffer, size_t size)
+ : wxConnectionBase(buffer, size)
+ {
+ Init();
+ }
+
+ virtual ~wxTCPConnection();
+
+ // implement base class pure virtual methods
+ virtual const void *Request(const wxString& item,
+ size_t *size = NULL,
+ wxIPCFormat format = wxIPC_TEXT);
+ virtual bool StartAdvise(const wxString& item);
+ virtual bool StopAdvise(const wxString& item);
+ virtual bool Disconnect(void);
+
+ // Will be used in the future to enable the compression but does nothing
+ // for now.
+ void Compress(bool on);
+
+
+protected:
+ virtual bool DoExecute(const void *data, size_t size, wxIPCFormat format);
+ virtual bool DoPoke(const wxString& item, const void *data, size_t size,
+ wxIPCFormat format);
+ virtual bool DoAdvise(const wxString& item, const void *data, size_t size,
+ wxIPCFormat format);
+
+
+ // notice that all the members below are only initialized once the
+ // connection is made, i.e. in MakeConnection() for the client objects and
+ // after OnAcceptConnection() in the server ones
+
+ // the underlying socket (wxSocketClient for IPC client and wxSocketServer
+ // for IPC server)
+ wxSocketBase *m_sock;
+
+ // various streams that we use
+ wxIPCSocketStreams *m_streams;
+
+ // the topic of this connection
+ wxString m_topic;
+
+private:
+ // common part of both ctors
+ void Init();
+
+ friend class wxTCPServer;
+ friend class wxTCPClient;
+ friend class wxTCPEventHandler;
+
+ wxDECLARE_NO_COPY_CLASS(wxTCPConnection);
+ DECLARE_DYNAMIC_CLASS(wxTCPConnection)
+};
+
+class WXDLLIMPEXP_NET wxTCPServer : public wxServerBase
+{
+public:
+ wxTCPServer();
+ virtual ~wxTCPServer();
+
+ // Returns false on error (e.g. port number is already in use)
+ virtual bool Create(const wxString& serverName);
+
+ virtual wxConnectionBase *OnAcceptConnection(const wxString& topic);
+
+protected:
+ wxSocketServer *m_server;
+
+#ifdef __UNIX_LIKE__
+ // the name of the file associated to the Unix domain socket, may be empty
+ wxString m_filename;
+#endif // __UNIX_LIKE__
+
+ wxDECLARE_NO_COPY_CLASS(wxTCPServer);
+ DECLARE_DYNAMIC_CLASS(wxTCPServer)
+};
+
+class WXDLLIMPEXP_NET wxTCPClient : public wxClientBase
+{
+public:
+ wxTCPClient();
+
+ virtual bool ValidHost(const wxString& host);
+
+ // Call this to make a connection. Returns NULL if cannot.
+ virtual wxConnectionBase *MakeConnection(const wxString& host,
+ const wxString& server,
+ const wxString& topic);
+
+ // Callbacks to CLIENT - override at will
+ virtual wxConnectionBase *OnMakeConnection();
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxTCPClient)
+};
+
+#endif // wxUSE_SOCKETS && wxUSE_IPC
+
+#endif // _WX_SCKIPC_H
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/sckstrm.h
+// Purpose: wxSocket*Stream
+// Author: Guilhem Lavaux
+// Modified by:
+// Created: 17/07/97
+// Copyright: (c)
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+#ifndef __SCK_STREAM_H__
+#define __SCK_STREAM_H__
+
+#include "wx/stream.h"
+
+#if wxUSE_SOCKETS && wxUSE_STREAMS
+
+#include "wx/socket.h"
+
+class WXDLLIMPEXP_NET wxSocketOutputStream : public wxOutputStream
+{
+public:
+ wxSocketOutputStream(wxSocketBase& s);
+ virtual ~wxSocketOutputStream();
+
+protected:
+ wxSocketBase *m_o_socket;
+
+ size_t OnSysWrite(const void *buffer, size_t bufsize);
+
+ // socket streams are both un-seekable and size-less streams:
+ wxFileOffset OnSysTell() const
+ { return wxInvalidOffset; }
+ wxFileOffset OnSysSeek(wxFileOffset WXUNUSED(pos), wxSeekMode WXUNUSED(mode))
+ { return wxInvalidOffset; }
+
+ wxDECLARE_NO_COPY_CLASS(wxSocketOutputStream);
+};
+
+class WXDLLIMPEXP_NET wxSocketInputStream : public wxInputStream
+{
+public:
+ wxSocketInputStream(wxSocketBase& s);
+ virtual ~wxSocketInputStream();
+
+protected:
+ wxSocketBase *m_i_socket;
+
+ size_t OnSysRead(void *buffer, size_t bufsize);
+
+ // socket streams are both un-seekable and size-less streams:
+
+ wxFileOffset OnSysTell() const
+ { return wxInvalidOffset; }
+ wxFileOffset OnSysSeek(wxFileOffset WXUNUSED(pos), wxSeekMode WXUNUSED(mode))
+ { return wxInvalidOffset; }
+
+ wxDECLARE_NO_COPY_CLASS(wxSocketInputStream);
+};
+
+class WXDLLIMPEXP_NET wxSocketStream : public wxSocketInputStream,
+ public wxSocketOutputStream
+{
+public:
+ wxSocketStream(wxSocketBase& s);
+ virtual ~wxSocketStream();
+
+ wxDECLARE_NO_COPY_CLASS(wxSocketStream);
+};
+
+#endif
+ // wxUSE_SOCKETS && wxUSE_STREAMS
+
+#endif
+ // __SCK_STREAM_H__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/scopedarray.h
+// Purpose: scoped smart pointer class
+// Author: Vadim Zeitlin
+// Created: 2009-02-03
+// Copyright: (c) Jesse Lovelace and original Boost authors (see below)
+// (c) 2009 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SCOPED_ARRAY_H_
+#define _WX_SCOPED_ARRAY_H_
+
+#include "wx/defs.h"
+#include "wx/checkeddelete.h"
+
+// ----------------------------------------------------------------------------
+// wxScopedArray: A scoped array
+// ----------------------------------------------------------------------------
+
+template <class T>
+class wxScopedArray
+{
+public:
+ typedef T element_type;
+
+ wxEXPLICIT wxScopedArray(T * array = NULL) : m_array(array) { }
+
+ ~wxScopedArray() { delete [] m_array; }
+
+ // test for pointer validity: defining conversion to unspecified_bool_type
+ // and not more obvious bool to avoid implicit conversions to integer types
+ typedef T *(wxScopedArray<T>::*unspecified_bool_type)() const;
+ operator unspecified_bool_type() const
+ {
+ return m_array ? &wxScopedArray<T>::get : NULL;
+ }
+
+ void reset(T *array = NULL)
+ {
+ if ( array != m_array )
+ {
+ delete [] m_array;
+ m_array = array;
+ }
+ }
+
+ T& operator[](size_t n) const { return m_array[n]; }
+
+ T *get() const { return m_array; }
+
+ void swap(wxScopedArray &other)
+ {
+ T * const tmp = other.m_array;
+ other.m_array = m_array;
+ m_array = tmp;
+ }
+
+private:
+ T *m_array;
+
+ DECLARE_NO_COPY_TEMPLATE_CLASS(wxScopedArray, T)
+};
+
+// ----------------------------------------------------------------------------
+// old macro based implementation
+// ----------------------------------------------------------------------------
+
+// the same but for arrays instead of simple pointers
+#define wxDECLARE_SCOPED_ARRAY(T, name)\
+class name \
+{ \
+private: \
+ T * m_ptr; \
+ name(name const &); \
+ name & operator=(name const &); \
+ \
+public: \
+ wxEXPLICIT name(T * p = NULL) : m_ptr(p) \
+ {} \
+ \
+ ~name(); \
+ void reset(T * p = NULL); \
+ \
+ T & operator[](long int i) const\
+ { \
+ wxASSERT(m_ptr != NULL); \
+ wxASSERT(i >= 0); \
+ return m_ptr[i]; \
+ } \
+ \
+ T * get() const \
+ { \
+ return m_ptr; \
+ } \
+ \
+ void swap(name & ot) \
+ { \
+ T * tmp = ot.m_ptr; \
+ ot.m_ptr = m_ptr; \
+ m_ptr = tmp; \
+ } \
+};
+
+#define wxDEFINE_SCOPED_ARRAY(T, name) \
+name::~name() \
+{ \
+ wxCHECKED_DELETE_ARRAY(m_ptr); \
+} \
+void name::reset(T * p){ \
+ if (m_ptr != p) \
+ { \
+ wxCHECKED_DELETE_ARRAY(m_ptr); \
+ m_ptr = p; \
+ } \
+}
+
+#endif // _WX_SCOPED_ARRAY_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/scopedptr.h
+// Purpose: scoped smart pointer class
+// Author: Jesse Lovelace <jllovela@eos.ncsu.edu>
+// Created: 06/01/02
+// Copyright: (c) Jesse Lovelace and original Boost authors (see below)
+// (c) 2009 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// This class closely follows the implementation of the boost
+// library scoped_ptr and is an adaption for c++ macro's in
+// the wxWidgets project. The original authors of the boost
+// scoped_ptr are given below with their respective copyrights.
+
+// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
+// Copyright (c) 2001, 2002 Peter Dimov
+//
+// Permission to copy, use, modify, sell and distribute this software
+// is granted provided this copyright notice appears in all copies.
+// This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+//
+// See http://www.boost.org/libs/smart_ptr/scoped_ptr.htm for documentation.
+//
+
+#ifndef _WX_SCOPED_PTR_H_
+#define _WX_SCOPED_PTR_H_
+
+#include "wx/defs.h"
+#include "wx/checkeddelete.h"
+
+// ----------------------------------------------------------------------------
+// wxScopedPtr: A scoped pointer
+// ----------------------------------------------------------------------------
+
+template <class T>
+class wxScopedPtr
+{
+public:
+ typedef T element_type;
+
+ wxEXPLICIT wxScopedPtr(T * ptr = NULL) : m_ptr(ptr) { }
+
+ ~wxScopedPtr() { wxCHECKED_DELETE(m_ptr); }
+
+ // test for pointer validity: defining conversion to unspecified_bool_type
+ // and not more obvious bool to avoid implicit conversions to integer types
+#ifdef __BORLANDC__
+ // this compiler is too dumb to use unspecified_bool_type operator in tests
+ // of the form "if ( !ptr )"
+ typedef bool unspecified_bool_type;
+#else
+ typedef T *(wxScopedPtr<T>::*unspecified_bool_type)() const;
+#endif // __BORLANDC__
+ operator unspecified_bool_type() const
+ {
+ return m_ptr ? &wxScopedPtr<T>::get : NULL;
+ }
+
+ void reset(T * ptr = NULL)
+ {
+ if ( ptr != m_ptr )
+ {
+ wxCHECKED_DELETE(m_ptr);
+ m_ptr = ptr;
+ }
+ }
+
+ T *release()
+ {
+ T *ptr = m_ptr;
+ m_ptr = NULL;
+ return ptr;
+ }
+
+ T & operator*() const
+ {
+ wxASSERT(m_ptr != NULL);
+ return *m_ptr;
+ }
+
+ T * operator->() const
+ {
+ wxASSERT(m_ptr != NULL);
+ return m_ptr;
+ }
+
+ T * get() const
+ {
+ return m_ptr;
+ }
+
+ void swap(wxScopedPtr& other)
+ {
+ T * const tmp = other.m_ptr;
+ other.m_ptr = m_ptr;
+ m_ptr = tmp;
+ }
+
+private:
+ T * m_ptr;
+
+ DECLARE_NO_COPY_TEMPLATE_CLASS(wxScopedPtr, T)
+};
+
+// ----------------------------------------------------------------------------
+// old macro based implementation
+// ----------------------------------------------------------------------------
+
+/* The type being used *must* be complete at the time
+ that wxDEFINE_SCOPED_* is called or a compiler error will result.
+ This is because the class checks for the completeness of the type
+ being used. */
+
+#define wxDECLARE_SCOPED_PTR(T, name) \
+class name \
+{ \
+private: \
+ T * m_ptr; \
+ \
+ name(name const &); \
+ name & operator=(name const &); \
+ \
+public: \
+ wxEXPLICIT name(T * ptr = NULL) \
+ : m_ptr(ptr) { } \
+ \
+ ~name(); \
+ \
+ void reset(T * ptr = NULL); \
+ \
+ T *release() \
+ { \
+ T *ptr = m_ptr; \
+ m_ptr = NULL; \
+ return ptr; \
+ } \
+ \
+ T & operator*() const \
+ { \
+ wxASSERT(m_ptr != NULL); \
+ return *m_ptr; \
+ } \
+ \
+ T * operator->() const \
+ { \
+ wxASSERT(m_ptr != NULL); \
+ return m_ptr; \
+ } \
+ \
+ T * get() const \
+ { \
+ return m_ptr; \
+ } \
+ \
+ void swap(name & ot) \
+ { \
+ T * tmp = ot.m_ptr; \
+ ot.m_ptr = m_ptr; \
+ m_ptr = tmp; \
+ } \
+};
+
+#define wxDEFINE_SCOPED_PTR(T, name)\
+void name::reset(T * ptr) \
+{ \
+ if (m_ptr != ptr) \
+ { \
+ wxCHECKED_DELETE(m_ptr); \
+ m_ptr = ptr; \
+ } \
+} \
+name::~name() \
+{ \
+ wxCHECKED_DELETE(m_ptr); \
+}
+
+// this macro can be used for the most common case when you want to declare and
+// define the scoped pointer at the same time and want to use the standard
+// naming convention: auto pointer to Foo is called FooPtr
+#define wxDEFINE_SCOPED_PTR_TYPE(T) \
+ wxDECLARE_SCOPED_PTR(T, T ## Ptr) \
+ wxDEFINE_SCOPED_PTR(T, T ## Ptr)
+
+// ----------------------------------------------------------------------------
+// "Tied" scoped pointer: same as normal one but also sets the value of
+// some other variable to the pointer value
+// ----------------------------------------------------------------------------
+
+#define wxDEFINE_TIED_SCOPED_PTR_TYPE(T) \
+ wxDEFINE_SCOPED_PTR_TYPE(T) \
+ class T ## TiedPtr : public T ## Ptr \
+ { \
+ public: \
+ T ## TiedPtr(T **pp, T *p) \
+ : T ## Ptr(p), m_pp(pp) \
+ { \
+ m_pOld = *pp; \
+ *pp = p; \
+ } \
+ \
+ ~ T ## TiedPtr() \
+ { \
+ *m_pp = m_pOld; \
+ } \
+ \
+ private: \
+ T **m_pp; \
+ T *m_pOld; \
+ };
+
+#endif // _WX_SCOPED_PTR_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/scopeguard.h
+// Purpose: declares wxwxScopeGuard and related macros
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 03.07.2003
+// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+/*
+ Acknowledgements: this header is heavily based on (well, almost the exact
+ copy of) ScopeGuard.h by Andrei Alexandrescu and Petru Marginean published
+ in December 2000 issue of C/C++ Users Journal.
+ http://www.cuj.com/documents/cujcexp1812alexandr/
+ */
+
+#ifndef _WX_SCOPEGUARD_H_
+#define _WX_SCOPEGUARD_H_
+
+#include "wx/defs.h"
+
+#include "wx/except.h"
+
+// ----------------------------------------------------------------------------
+// helpers
+// ----------------------------------------------------------------------------
+
+#ifdef __WATCOMC__
+
+// WATCOM-FIXME: C++ of Open Watcom 1.3 doesn't like OnScopeExit() created
+// through template so it must be workarounded with dedicated inlined macro.
+// For compatibility with Watcom compilers wxPrivate::OnScopeExit must be
+// replaced with wxPrivateOnScopeExit but in user code (for everyone who
+// doesn't care about OW compatibility) wxPrivate::OnScopeExit still works.
+
+#define wxPrivateOnScopeExit(guard) \
+ { \
+ if ( !(guard).WasDismissed() ) \
+ { \
+ wxTRY \
+ { \
+ (guard).Execute(); \
+ } \
+ wxCATCH_ALL(;) \
+ } \
+ }
+
+#define wxPrivateUse(n) wxUnusedVar(n)
+
+#else
+
+namespace wxPrivate
+{
+ // in the original implementation this was a member template function of
+ // ScopeGuardImplBase but gcc 2.8 which is still used for OS/2 doesn't
+ // support member templates and so we must make it global
+ template <class ScopeGuardImpl>
+ void OnScopeExit(ScopeGuardImpl& guard)
+ {
+ if ( !guard.WasDismissed() )
+ {
+ // we're called from ScopeGuardImpl dtor and so we must not throw
+ wxTRY
+ {
+ guard.Execute();
+ }
+ wxCATCH_ALL(;) // do nothing, just eat the exception
+ }
+ }
+
+ // just to avoid the warning about unused variables
+ template <class T>
+ void Use(const T& WXUNUSED(t))
+ {
+ }
+} // namespace wxPrivate
+
+#define wxPrivateOnScopeExit(n) wxPrivate::OnScopeExit(n)
+#define wxPrivateUse(n) wxPrivate::Use(n)
+
+#endif
+
+// ============================================================================
+// wxScopeGuard for functions and functors
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxScopeGuardImplBase: used by wxScopeGuardImpl[0..N] below
+// ----------------------------------------------------------------------------
+
+class wxScopeGuardImplBase
+{
+public:
+ wxScopeGuardImplBase() : m_wasDismissed(false) { }
+
+ wxScopeGuardImplBase(const wxScopeGuardImplBase& other)
+ : m_wasDismissed(other.m_wasDismissed)
+ {
+ other.Dismiss();
+ }
+
+ void Dismiss() const { m_wasDismissed = true; }
+
+ // for OnScopeExit() only (we can't make it friend, unfortunately)!
+ bool WasDismissed() const { return m_wasDismissed; }
+
+protected:
+ ~wxScopeGuardImplBase() { }
+
+ // must be mutable for copy ctor to work
+ mutable bool m_wasDismissed;
+
+private:
+ wxScopeGuardImplBase& operator=(const wxScopeGuardImplBase&);
+};
+
+// wxScopeGuard is just a reference, see the explanation in CUJ article
+typedef const wxScopeGuardImplBase& wxScopeGuard;
+
+// ----------------------------------------------------------------------------
+// wxScopeGuardImpl0: scope guard for actions without parameters
+// ----------------------------------------------------------------------------
+
+template <class F>
+class wxScopeGuardImpl0 : public wxScopeGuardImplBase
+{
+public:
+ static wxScopeGuardImpl0<F> MakeGuard(F fun)
+ {
+ return wxScopeGuardImpl0<F>(fun);
+ }
+
+ ~wxScopeGuardImpl0() { wxPrivateOnScopeExit(*this); }
+
+ void Execute() { m_fun(); }
+
+protected:
+ wxScopeGuardImpl0(F fun) : m_fun(fun) { }
+
+ F m_fun;
+
+ wxScopeGuardImpl0& operator=(const wxScopeGuardImpl0&);
+};
+
+template <class F>
+inline wxScopeGuardImpl0<F> wxMakeGuard(F fun)
+{
+ return wxScopeGuardImpl0<F>::MakeGuard(fun);
+}
+
+// ----------------------------------------------------------------------------
+// wxScopeGuardImpl1: scope guard for actions with 1 parameter
+// ----------------------------------------------------------------------------
+
+template <class F, class P1>
+class wxScopeGuardImpl1 : public wxScopeGuardImplBase
+{
+public:
+ static wxScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1)
+ {
+ return wxScopeGuardImpl1<F, P1>(fun, p1);
+ }
+
+ ~wxScopeGuardImpl1() { wxPrivateOnScopeExit(* this); }
+
+ void Execute() { m_fun(m_p1); }
+
+protected:
+ wxScopeGuardImpl1(F fun, P1 p1) : m_fun(fun), m_p1(p1) { }
+
+ F m_fun;
+ const P1 m_p1;
+
+ wxScopeGuardImpl1& operator=(const wxScopeGuardImpl1&);
+};
+
+template <class F, class P1>
+inline wxScopeGuardImpl1<F, P1> wxMakeGuard(F fun, P1 p1)
+{
+ return wxScopeGuardImpl1<F, P1>::MakeGuard(fun, p1);
+}
+
+// ----------------------------------------------------------------------------
+// wxScopeGuardImpl2: scope guard for actions with 2 parameters
+// ----------------------------------------------------------------------------
+
+template <class F, class P1, class P2>
+class wxScopeGuardImpl2 : public wxScopeGuardImplBase
+{
+public:
+ static wxScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2)
+ {
+ return wxScopeGuardImpl2<F, P1, P2>(fun, p1, p2);
+ }
+
+ ~wxScopeGuardImpl2() { wxPrivateOnScopeExit(*this); }
+
+ void Execute() { m_fun(m_p1, m_p2); }
+
+protected:
+ wxScopeGuardImpl2(F fun, P1 p1, P2 p2) : m_fun(fun), m_p1(p1), m_p2(p2) { }
+
+ F m_fun;
+ const P1 m_p1;
+ const P2 m_p2;
+
+ wxScopeGuardImpl2& operator=(const wxScopeGuardImpl2&);
+};
+
+template <class F, class P1, class P2>
+inline wxScopeGuardImpl2<F, P1, P2> wxMakeGuard(F fun, P1 p1, P2 p2)
+{
+ return wxScopeGuardImpl2<F, P1, P2>::MakeGuard(fun, p1, p2);
+}
+
+// ----------------------------------------------------------------------------
+// wxScopeGuardImpl3: scope guard for actions with 3 parameters
+// ----------------------------------------------------------------------------
+
+template <class F, class P1, class P2, class P3>
+class wxScopeGuardImpl3 : public wxScopeGuardImplBase
+{
+public:
+ static wxScopeGuardImpl3<F, P1, P2, P3> MakeGuard(F fun, P1 p1, P2 p2, P3 p3)
+ {
+ return wxScopeGuardImpl3<F, P1, P2, P3>(fun, p1, p2, p3);
+ }
+
+ ~wxScopeGuardImpl3() { wxPrivateOnScopeExit(*this); }
+
+ void Execute() { m_fun(m_p1, m_p2, m_p3); }
+
+protected:
+ wxScopeGuardImpl3(F fun, P1 p1, P2 p2, P3 p3)
+ : m_fun(fun), m_p1(p1), m_p2(p2), m_p3(p3) { }
+
+ F m_fun;
+ const P1 m_p1;
+ const P2 m_p2;
+ const P3 m_p3;
+
+ wxScopeGuardImpl3& operator=(const wxScopeGuardImpl3&);
+};
+
+template <class F, class P1, class P2, class P3>
+inline wxScopeGuardImpl3<F, P1, P2, P3> wxMakeGuard(F fun, P1 p1, P2 p2, P3 p3)
+{
+ return wxScopeGuardImpl3<F, P1, P2, P3>::MakeGuard(fun, p1, p2, p3);
+}
+
+// ============================================================================
+// wxScopeGuards for object methods
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxObjScopeGuardImpl0
+// ----------------------------------------------------------------------------
+
+template <class Obj, class MemFun>
+class wxObjScopeGuardImpl0 : public wxScopeGuardImplBase
+{
+public:
+ static wxObjScopeGuardImpl0<Obj, MemFun>
+ MakeObjGuard(Obj& obj, MemFun memFun)
+ {
+ return wxObjScopeGuardImpl0<Obj, MemFun>(obj, memFun);
+ }
+
+ ~wxObjScopeGuardImpl0() { wxPrivateOnScopeExit(*this); }
+
+ void Execute() { (m_obj.*m_memfun)(); }
+
+protected:
+ wxObjScopeGuardImpl0(Obj& obj, MemFun memFun)
+ : m_obj(obj), m_memfun(memFun) { }
+
+ Obj& m_obj;
+ MemFun m_memfun;
+};
+
+template <class Obj, class MemFun>
+inline wxObjScopeGuardImpl0<Obj, MemFun> wxMakeObjGuard(Obj& obj, MemFun memFun)
+{
+ return wxObjScopeGuardImpl0<Obj, MemFun>::MakeObjGuard(obj, memFun);
+}
+
+template <class Obj, class MemFun, class P1>
+class wxObjScopeGuardImpl1 : public wxScopeGuardImplBase
+{
+public:
+ static wxObjScopeGuardImpl1<Obj, MemFun, P1>
+ MakeObjGuard(Obj& obj, MemFun memFun, P1 p1)
+ {
+ return wxObjScopeGuardImpl1<Obj, MemFun, P1>(obj, memFun, p1);
+ }
+
+ ~wxObjScopeGuardImpl1() { wxPrivateOnScopeExit(*this); }
+
+ void Execute() { (m_obj.*m_memfun)(m_p1); }
+
+protected:
+ wxObjScopeGuardImpl1(Obj& obj, MemFun memFun, P1 p1)
+ : m_obj(obj), m_memfun(memFun), m_p1(p1) { }
+
+ Obj& m_obj;
+ MemFun m_memfun;
+ const P1 m_p1;
+};
+
+template <class Obj, class MemFun, class P1>
+inline wxObjScopeGuardImpl1<Obj, MemFun, P1>
+wxMakeObjGuard(Obj& obj, MemFun memFun, P1 p1)
+{
+ return wxObjScopeGuardImpl1<Obj, MemFun, P1>::MakeObjGuard(obj, memFun, p1);
+}
+
+template <class Obj, class MemFun, class P1, class P2>
+class wxObjScopeGuardImpl2 : public wxScopeGuardImplBase
+{
+public:
+ static wxObjScopeGuardImpl2<Obj, MemFun, P1, P2>
+ MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2)
+ {
+ return wxObjScopeGuardImpl2<Obj, MemFun, P1, P2>(obj, memFun, p1, p2);
+ }
+
+ ~wxObjScopeGuardImpl2() { wxPrivateOnScopeExit(*this); }
+
+ void Execute() { (m_obj.*m_memfun)(m_p1, m_p2); }
+
+protected:
+ wxObjScopeGuardImpl2(Obj& obj, MemFun memFun, P1 p1, P2 p2)
+ : m_obj(obj), m_memfun(memFun), m_p1(p1), m_p2(p2) { }
+
+ Obj& m_obj;
+ MemFun m_memfun;
+ const P1 m_p1;
+ const P2 m_p2;
+};
+
+template <class Obj, class MemFun, class P1, class P2>
+inline wxObjScopeGuardImpl2<Obj, MemFun, P1, P2>
+wxMakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2)
+{
+ return wxObjScopeGuardImpl2<Obj, MemFun, P1, P2>::
+ MakeObjGuard(obj, memFun, p1, p2);
+}
+
+template <class Obj, class MemFun, class P1, class P2, class P3>
+class wxObjScopeGuardImpl3 : public wxScopeGuardImplBase
+{
+public:
+ static wxObjScopeGuardImpl3<Obj, MemFun, P1, P2, P3>
+ MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2, P3 p3)
+ {
+ return wxObjScopeGuardImpl3<Obj, MemFun, P1, P2, P3>(obj, memFun, p1, p2, p3);
+ }
+
+ ~wxObjScopeGuardImpl3() { wxPrivateOnScopeExit(*this); }
+
+ void Execute() { (m_obj.*m_memfun)(m_p1, m_p2, m_p3); }
+
+protected:
+ wxObjScopeGuardImpl3(Obj& obj, MemFun memFun, P1 p1, P2 p2, P3 p3)
+ : m_obj(obj), m_memfun(memFun), m_p1(p1), m_p2(p2), m_p3(p3) { }
+
+ Obj& m_obj;
+ MemFun m_memfun;
+ const P1 m_p1;
+ const P2 m_p2;
+ const P3 m_p3;
+};
+
+template <class Obj, class MemFun, class P1, class P2, class P3>
+inline wxObjScopeGuardImpl3<Obj, MemFun, P1, P2, P3>
+wxMakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2, P3 p3)
+{
+ return wxObjScopeGuardImpl3<Obj, MemFun, P1, P2, P3>::
+ MakeObjGuard(obj, memFun, p1, p2, p3);
+}
+
+// ----------------------------------------------------------------------------
+// wxVariableSetter: use the same technique as for wxScopeGuard to allow
+// setting a variable to some value on block exit
+// ----------------------------------------------------------------------------
+
+namespace wxPrivate
+{
+
+// empty class just to be able to define a reference to it
+class VariableSetterBase : public wxScopeGuardImplBase { };
+
+typedef const VariableSetterBase& VariableSetter;
+
+template <typename T, typename U>
+class VariableSetterImpl : public VariableSetterBase
+{
+public:
+ VariableSetterImpl(T& var, U value)
+ : m_var(var),
+ m_value(value)
+ {
+ }
+
+ ~VariableSetterImpl() { wxPrivateOnScopeExit(*this); }
+
+ void Execute() { m_var = m_value; }
+
+private:
+ T& m_var;
+ const U m_value;
+
+ // suppress the warning about assignment operator not being generated
+ VariableSetterImpl<T, U>& operator=(const VariableSetterImpl<T, U>&);
+};
+
+template <typename T>
+class VariableNullerImpl : public VariableSetterBase
+{
+public:
+ VariableNullerImpl(T& var)
+ : m_var(var)
+ {
+ }
+
+ ~VariableNullerImpl() { wxPrivateOnScopeExit(*this); }
+
+ void Execute() { m_var = NULL; }
+
+private:
+ T& m_var;
+
+ VariableNullerImpl<T>& operator=(const VariableNullerImpl<T>&);
+};
+
+} // namespace wxPrivate
+
+template <typename T, typename U>
+inline
+wxPrivate::VariableSetterImpl<T, U> wxMakeVarSetter(T& var, U value)
+{
+ return wxPrivate::VariableSetterImpl<T, U>(var, value);
+}
+
+// calling wxMakeVarSetter(ptr, NULL) doesn't work because U is deduced to be
+// "int" and subsequent assignment of "U" to "T *" fails, so provide a special
+// function for this special case
+template <typename T>
+inline
+wxPrivate::VariableNullerImpl<T> wxMakeVarNuller(T& var)
+{
+ return wxPrivate::VariableNullerImpl<T>(var);
+}
+
+// ============================================================================
+// macros for declaring unnamed scoped guards (which can't be dismissed)
+// ============================================================================
+
+// NB: the original code has a single (and much nicer) ON_BLOCK_EXIT macro
+// but this results in compiler warnings about unused variables and I
+// didn't find a way to work around this other than by having different
+// macros with different names or using a less natural syntax for passing
+// the arguments (e.g. as Boost preprocessor sequences, which would mean
+// having to write wxON_BLOCK_EXIT(fwrite, (buf)(size)(n)(fp)) instead of
+// wxON_BLOCK_EXIT4(fwrite, buf, size, n, fp)).
+
+#define wxGuardName wxMAKE_UNIQUE_NAME(wxScopeGuard)
+
+#define wxON_BLOCK_EXIT0_IMPL(n, f) \
+ wxScopeGuard n = wxMakeGuard(f); \
+ wxPrivateUse(n)
+#define wxON_BLOCK_EXIT0(f) \
+ wxON_BLOCK_EXIT0_IMPL(wxGuardName, f)
+
+#define wxON_BLOCK_EXIT_OBJ0_IMPL(n, o, m) \
+ wxScopeGuard n = wxMakeObjGuard(o, m); \
+ wxPrivateUse(n)
+#define wxON_BLOCK_EXIT_OBJ0(o, m) \
+ wxON_BLOCK_EXIT_OBJ0_IMPL(wxGuardName, o, &m)
+
+#define wxON_BLOCK_EXIT_THIS0(m) \
+ wxON_BLOCK_EXIT_OBJ0(*this, m)
+
+
+#define wxON_BLOCK_EXIT1_IMPL(n, f, p1) \
+ wxScopeGuard n = wxMakeGuard(f, p1); \
+ wxPrivateUse(n)
+#define wxON_BLOCK_EXIT1(f, p1) \
+ wxON_BLOCK_EXIT1_IMPL(wxGuardName, f, p1)
+
+#define wxON_BLOCK_EXIT_OBJ1_IMPL(n, o, m, p1) \
+ wxScopeGuard n = wxMakeObjGuard(o, m, p1); \
+ wxPrivateUse(n)
+#define wxON_BLOCK_EXIT_OBJ1(o, m, p1) \
+ wxON_BLOCK_EXIT_OBJ1_IMPL(wxGuardName, o, &m, p1)
+
+#define wxON_BLOCK_EXIT_THIS1(m, p1) \
+ wxON_BLOCK_EXIT_OBJ1(*this, m, p1)
+
+
+#define wxON_BLOCK_EXIT2_IMPL(n, f, p1, p2) \
+ wxScopeGuard n = wxMakeGuard(f, p1, p2); \
+ wxPrivateUse(n)
+#define wxON_BLOCK_EXIT2(f, p1, p2) \
+ wxON_BLOCK_EXIT2_IMPL(wxGuardName, f, p1, p2)
+
+#define wxON_BLOCK_EXIT_OBJ2_IMPL(n, o, m, p1, p2) \
+ wxScopeGuard n = wxMakeObjGuard(o, m, p1, p2); \
+ wxPrivateUse(n)
+#define wxON_BLOCK_EXIT_OBJ2(o, m, p1, p2) \
+ wxON_BLOCK_EXIT_OBJ2_IMPL(wxGuardName, o, &m, p1, p2)
+
+#define wxON_BLOCK_EXIT_THIS2(m, p1, p2) \
+ wxON_BLOCK_EXIT_OBJ2(*this, m, p1, p2)
+
+
+#define wxON_BLOCK_EXIT3_IMPL(n, f, p1, p2, p3) \
+ wxScopeGuard n = wxMakeGuard(f, p1, p2, p3); \
+ wxPrivateUse(n)
+#define wxON_BLOCK_EXIT3(f, p1, p2, p3) \
+ wxON_BLOCK_EXIT3_IMPL(wxGuardName, f, p1, p2, p3)
+
+#define wxON_BLOCK_EXIT_OBJ3_IMPL(n, o, m, p1, p2, p3) \
+ wxScopeGuard n = wxMakeObjGuard(o, m, p1, p2, p3); \
+ wxPrivateUse(n)
+#define wxON_BLOCK_EXIT_OBJ3(o, m, p1, p2, p3) \
+ wxON_BLOCK_EXIT_OBJ3_IMPL(wxGuardName, o, &m, p1, p2, p3)
+
+#define wxON_BLOCK_EXIT_THIS3(m, p1, p2, p3) \
+ wxON_BLOCK_EXIT_OBJ3(*this, m, p1, p2, p3)
+
+
+#define wxSetterName wxMAKE_UNIQUE_NAME(wxVarSetter)
+
+#define wxON_BLOCK_EXIT_SET_IMPL(n, var, value) \
+ wxPrivate::VariableSetter n = wxMakeVarSetter(var, value); \
+ wxPrivateUse(n)
+
+#define wxON_BLOCK_EXIT_SET(var, value) \
+ wxON_BLOCK_EXIT_SET_IMPL(wxSetterName, var, value)
+
+#define wxON_BLOCK_EXIT_NULL_IMPL(n, var) \
+ wxPrivate::VariableSetter n = wxMakeVarNuller(var); \
+ wxPrivateUse(n)
+
+#define wxON_BLOCK_EXIT_NULL(ptr) \
+ wxON_BLOCK_EXIT_NULL_IMPL(wxSetterName, ptr)
+
+#endif // _WX_SCOPEGUARD_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/scrolbar.h
+// Purpose: wxScrollBar base header
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SCROLBAR_H_BASE_
+#define _WX_SCROLBAR_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_SCROLLBAR
+
+#include "wx/control.h"
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxScrollBarNameStr[];
+
+// ----------------------------------------------------------------------------
+// wxScrollBar: a scroll bar control
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxScrollBarBase : public wxControl
+{
+public:
+ wxScrollBarBase() { }
+
+ /*
+ Derived classes should provide the following method and ctor with the
+ same parameters:
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSB_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxScrollBarNameStr);
+ */
+
+ // accessors
+ virtual int GetThumbPosition() const = 0;
+ virtual int GetThumbSize() const = 0;
+ virtual int GetPageSize() const = 0;
+ virtual int GetRange() const = 0;
+
+ bool IsVertical() const { return (m_windowStyle & wxVERTICAL) != 0; }
+
+ // operations
+ virtual void SetThumbPosition(int viewStart) = 0;
+ virtual void SetScrollbar(int position, int thumbSize,
+ int range, int pageSize,
+ bool refresh = true) = 0;
+
+ // implementation-only
+ bool IsNeeded() const { return GetRange() > GetThumbSize(); }
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxScrollBarBase);
+};
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/scrolbar.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/scrolbar.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/scrolbar.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/scrolbar.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/scrolbar.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/scrolbar.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/scrolbar.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/scrolbar.h"
+#endif
+
+#endif // wxUSE_SCROLLBAR
+
+#endif
+ // _WX_SCROLBAR_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/scrolwin.h
+// Purpose: wxScrolledWindow, wxScrolledControl and wxScrollHelper
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 30.08.00
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SCROLWIN_H_BASE_
+#define _WX_SCROLWIN_H_BASE_
+
+#include "wx/panel.h"
+
+class WXDLLIMPEXP_FWD_CORE wxScrollHelperEvtHandler;
+class WXDLLIMPEXP_FWD_BASE wxTimer;
+
+// default scrolled window style: scroll in both directions
+#define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL)
+
+// values for the second argument of wxScrollHelper::ShowScrollbars()
+enum wxScrollbarVisibility
+{
+ wxSHOW_SB_NEVER = -1, // never show the scrollbar at all
+ wxSHOW_SB_DEFAULT, // show scrollbar only if it is needed
+ wxSHOW_SB_ALWAYS // always show scrollbar, even if not needed
+};
+
+// ----------------------------------------------------------------------------
+// The hierarchy of scrolling classes is a bit complicated because we want to
+// put as much functionality as possible in a mix-in class not deriving from
+// wxWindow so that other classes could derive from the same base class on all
+// platforms irrespectively of whether they are native controls (and hence
+// don't use our scrolling) or not.
+//
+// So we have
+//
+// wxAnyScrollHelperBase
+// |
+// |
+// \|/
+// wxScrollHelperBase
+// |
+// |
+// \|/
+// wxWindow wxScrollHelper
+// | \ / /
+// | \ / /
+// | _| |_ /
+// | wxScrolledWindow /
+// | /
+// \|/ /
+// wxControl /
+// \ /
+// \ /
+// _| |_
+// wxScrolledControl
+//
+// ----------------------------------------------------------------------------
+
+// This class allows reusing some of wxScrollHelperBase functionality in
+// wxVarScrollHelperBase in wx/vscroll.h without duplicating its code.
+class WXDLLIMPEXP_CORE wxAnyScrollHelperBase
+{
+public:
+ wxEXPLICIT wxAnyScrollHelperBase(wxWindow* win);
+ virtual ~wxAnyScrollHelperBase() {}
+
+ // Disable use of keyboard keys for scrolling. By default cursor movement
+ // keys (including Home, End, Page Up and Down) are used to scroll the
+ // window appropriately. If the derived class uses these keys for something
+ // else, e.g. changing the currently selected item, this function can be
+ // used to disable this behaviour as it's not only not necessary then but
+ // can actually be actively harmful if another object forwards a keyboard
+ // event corresponding to one of the above keys to us using
+ // ProcessWindowEvent() because the event will always be processed which
+ // can be undesirable.
+ void DisableKeyboardScrolling() { m_kbdScrollingEnabled = false; }
+
+ // Override this function to draw the graphic (or just process EVT_PAINT)
+ virtual void OnDraw(wxDC& WXUNUSED(dc)) { }
+
+ // change the DC origin according to the scroll position.
+ virtual void DoPrepareDC(wxDC& dc) = 0;
+
+ // Simple accessor for the window that is really being scrolled.
+ wxWindow *GetTargetWindow() const { return m_targetWindow; }
+
+
+ // The methods called from the window event handlers.
+ void HandleOnChar(wxKeyEvent& event);
+ void HandleOnPaint(wxPaintEvent& event);
+
+protected:
+ // the window that receives the scroll events and the window to actually
+ // scroll, respectively
+ wxWindow *m_win,
+ *m_targetWindow;
+
+ // whether cursor keys should scroll the window
+ bool m_kbdScrollingEnabled;
+};
+
+// This is the class containing the guts of (uniform) scrolling logic.
+class WXDLLIMPEXP_CORE wxScrollHelperBase : public wxAnyScrollHelperBase
+{
+public:
+ // ctor must be given the associated window
+ wxScrollHelperBase(wxWindow *winToScroll);
+ virtual ~wxScrollHelperBase();
+
+ // configure the scrolling
+ virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
+ int noUnitsX, int noUnitsY,
+ int xPos = 0, int yPos = 0,
+ bool noRefresh = false );
+
+ // scroll to the given (in logical coords) position
+ //
+ // notice that for backwards compatibility reasons Scroll() is virtual as
+ // the existing code could override it but new code should override
+ // DoScroll() instead
+ virtual void Scroll(int x, int y) { DoScroll(x, y); }
+ virtual void Scroll(const wxPoint& pt) { DoScroll(pt.x, pt.y); }
+
+ // get/set the page size for this orientation (wxVERTICAL/wxHORIZONTAL)
+ int GetScrollPageSize(int orient) const;
+ void SetScrollPageSize(int orient, int pageSize);
+
+ // get the number of lines the window can scroll,
+ // returns 0 if no scrollbars are there.
+ int GetScrollLines( int orient ) const;
+
+ // Set the x, y scrolling increments.
+ void SetScrollRate( int xstep, int ystep );
+
+ // get the size of one logical unit in physical ones
+ void GetScrollPixelsPerUnit(int *pixelsPerUnitX, int *pixelsPerUnitY) const;
+
+ // Set scrollbar visibility: it is possible to show scrollbar only if it is
+ // needed (i.e. if our virtual size is greater than the current size of the
+ // associated window), always (as wxALWAYS_SHOW_SB style does) or never (in
+ // which case you should provide some other way to scroll the window as the
+ // user wouldn't be able to do it at all)
+ void ShowScrollbars(wxScrollbarVisibility horz, wxScrollbarVisibility vert)
+ {
+ DoShowScrollbars(horz, vert);
+ }
+
+ // Test whether the specified scrollbar is shown.
+ virtual bool IsScrollbarShown(int orient) const = 0;
+
+ // Enable/disable Windows scrolling in either direction. If true, wxWidgets
+ // scrolls the canvas and only a bit of the canvas is invalidated; no
+ // Clear() is necessary. If false, the whole canvas is invalidated and a
+ // Clear() is necessary. Disable for when the scroll increment is used to
+ // actually scroll a non-constant distance
+ //
+ // Notice that calling this method with a false argument doesn't disable
+ // scrolling the window in this direction, it just changes the mechanism by
+ // which it is implemented to not use wxWindow::ScrollWindow().
+ virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
+
+ // Get the view start
+ void GetViewStart(int *x, int *y) const { DoGetViewStart(x, y); }
+
+ wxPoint GetViewStart() const
+ {
+ wxPoint pt;
+ DoGetViewStart(&pt.x, &pt.y);
+ return pt;
+ }
+
+ // Set the scale factor, used in PrepareDC
+ void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; }
+ double GetScaleX() const { return m_scaleX; }
+ double GetScaleY() const { return m_scaleY; }
+
+ // translate between scrolled and unscrolled coordinates
+ void CalcScrolledPosition(int x, int y, int *xx, int *yy) const
+ { DoCalcScrolledPosition(x, y, xx, yy); }
+ wxPoint CalcScrolledPosition(const wxPoint& pt) const
+ {
+ wxPoint p2;
+ DoCalcScrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
+ return p2;
+ }
+
+ void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
+ { DoCalcUnscrolledPosition(x, y, xx, yy); }
+ wxPoint CalcUnscrolledPosition(const wxPoint& pt) const
+ {
+ wxPoint p2;
+ DoCalcUnscrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
+ return p2;
+ }
+
+ void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const;
+ void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
+
+ // Adjust the scrollbars
+ virtual void AdjustScrollbars() = 0;
+
+ // Calculate scroll increment
+ int CalcScrollInc(wxScrollWinEvent& event);
+
+ // Normally the wxScrolledWindow will scroll itself, but in some rare
+ // occasions you might want it to scroll [part of] another window (e.g. a
+ // child of it in order to scroll only a portion the area between the
+ // scrollbars (spreadsheet: only cell area will move).
+ void SetTargetWindow(wxWindow *target);
+
+ void SetTargetRect(const wxRect& rect) { m_rectToScroll = rect; }
+ wxRect GetTargetRect() const { return m_rectToScroll; }
+
+ virtual void DoPrepareDC(wxDC& dc);
+
+ // are we generating the autoscroll events?
+ bool IsAutoScrolling() const { return m_timerAutoScroll != NULL; }
+
+ // stop generating the scroll events when mouse is held outside the window
+ void StopAutoScrolling();
+
+ // this method can be overridden in a derived class to forbid sending the
+ // auto scroll events - note that unlike StopAutoScrolling() it doesn't
+ // stop the timer, so it will be called repeatedly and will typically
+ // return different values depending on the current mouse position
+ //
+ // the base class version just returns true
+ virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const;
+
+ // the methods to be called from the window event handlers
+ void HandleOnScroll(wxScrollWinEvent& event);
+ void HandleOnSize(wxSizeEvent& event);
+ void HandleOnMouseEnter(wxMouseEvent& event);
+ void HandleOnMouseLeave(wxMouseEvent& event);
+#if wxUSE_MOUSEWHEEL
+ void HandleOnMouseWheel(wxMouseEvent& event);
+#endif // wxUSE_MOUSEWHEEL
+ void HandleOnChildFocus(wxChildFocusEvent& event);
+
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED(
+ void OnScroll(wxScrollWinEvent& event) { HandleOnScroll(event); }
+ )
+#endif // WXWIN_COMPATIBILITY_2_8
+
+protected:
+ // get pointer to our scroll rect if we use it or NULL
+ const wxRect *GetScrollRect() const
+ {
+ return m_rectToScroll.width != 0 ? &m_rectToScroll : NULL;
+ }
+
+ // get the size of the target window
+ wxSize GetTargetSize() const
+ {
+ return m_rectToScroll.width != 0 ? m_rectToScroll.GetSize()
+ : m_targetWindow->GetClientSize();
+ }
+
+ void GetTargetSize(int *w, int *h) const
+ {
+ wxSize size = GetTargetSize();
+ if ( w )
+ *w = size.x;
+ if ( h )
+ *h = size.y;
+ }
+
+ // implementation of public methods with the same name
+ virtual void DoGetViewStart(int *x, int *y) const;
+ virtual void DoScroll(int x, int y) = 0;
+ virtual void DoShowScrollbars(wxScrollbarVisibility horz,
+ wxScrollbarVisibility vert) = 0;
+
+ // implementations of various wxWindow virtual methods which should be
+ // forwarded to us (this can be done by WX_FORWARD_TO_SCROLL_HELPER())
+ bool ScrollLayout();
+ void ScrollDoSetVirtualSize(int x, int y);
+ wxSize ScrollGetBestVirtualSize() const;
+
+ // change just the target window (unlike SetWindow which changes m_win as
+ // well)
+ void DoSetTargetWindow(wxWindow *target);
+
+ // delete the event handler we installed
+ void DeleteEvtHandler();
+
+ // this function should be overridden to return the size available for
+ // m_targetWindow inside m_win of the given size
+ //
+ // the default implementation is only good for m_targetWindow == m_win
+ // case, if we're scrolling a subwindow you must override this method
+ virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size)
+ {
+ // returning just size from here is wrong but it was decided that it is
+ // not wrong enough to break the existing code (which doesn't override
+ // this recently added function at all) by adding this assert
+ //
+ // wxASSERT_MSG( m_targetWindow == m_win, "must be overridden" );
+
+ return size;
+ }
+
+
+ double m_scaleX;
+ double m_scaleY;
+
+ wxRect m_rectToScroll;
+
+ wxTimer *m_timerAutoScroll;
+
+ // The number of pixels to scroll in horizontal and vertical directions
+ // respectively.
+ //
+ // If 0, means that the scrolling in the given direction is disabled.
+ int m_xScrollPixelsPerLine;
+ int m_yScrollPixelsPerLine;
+ int m_xScrollPosition;
+ int m_yScrollPosition;
+ int m_xScrollLines;
+ int m_yScrollLines;
+ int m_xScrollLinesPerPage;
+ int m_yScrollLinesPerPage;
+
+ bool m_xScrollingEnabled;
+ bool m_yScrollingEnabled;
+
+#if wxUSE_MOUSEWHEEL
+ int m_wheelRotation;
+#endif // wxUSE_MOUSEWHEEL
+
+ wxScrollHelperEvtHandler *m_handler;
+
+ wxDECLARE_NO_COPY_CLASS(wxScrollHelperBase);
+};
+
+// this macro can be used in a wxScrollHelper-derived class to forward wxWindow
+// methods to corresponding wxScrollHelper methods
+#define WX_FORWARD_TO_SCROLL_HELPER() \
+public: \
+ virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); } \
+ virtual bool Layout() { return ScrollLayout(); } \
+ virtual bool CanScroll(int orient) const \
+ { return IsScrollbarShown(orient); } \
+ virtual void DoSetVirtualSize(int x, int y) \
+ { ScrollDoSetVirtualSize(x, y); } \
+ virtual wxSize GetBestVirtualSize() const \
+ { return ScrollGetBestVirtualSize(); }
+
+// include the declaration of the real wxScrollHelper
+#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
+ #include "wx/gtk/scrolwin.h"
+#elif defined(__WXGTK__) && !defined(__WXUNIVERSAL__)
+ #include "wx/gtk1/scrolwin.h"
+#else
+ #define wxHAS_GENERIC_SCROLLWIN
+ #include "wx/generic/scrolwin.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// wxScrolled<T>: a wxWindow which knows how to scroll
+// ----------------------------------------------------------------------------
+
+// helper class for wxScrolled<T> below
+struct WXDLLIMPEXP_CORE wxScrolledT_Helper
+{
+ static wxSize FilterBestSize(const wxWindow *win,
+ const wxScrollHelper *helper,
+ const wxSize& origBest);
+#ifdef __WXMSW__
+ static WXLRESULT FilterMSWWindowProc(WXUINT nMsg, WXLRESULT origResult);
+#endif
+};
+
+// Scrollable window base on window type T. This used to be wxScrolledWindow,
+// but wxScrolledWindow includes wxControlContainer functionality and that's
+// not always desirable.
+template<class T>
+class wxScrolled : public T,
+ public wxScrollHelper,
+ private wxScrolledT_Helper
+{
+public:
+ wxScrolled() : wxScrollHelper(this) { }
+ wxScrolled(wxWindow *parent,
+ wxWindowID winid = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxScrolledWindowStyle,
+ const wxString& name = wxPanelNameStr)
+ : wxScrollHelper(this)
+ {
+ Create(parent, winid, pos, size, style, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID winid,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxScrolledWindowStyle,
+ const wxString& name = wxPanelNameStr)
+ {
+ m_targetWindow = this;
+
+#ifdef __WXMAC__
+ this->MacSetClipChildren(true);
+#endif
+
+ // by default, we're scrollable in both directions (but if one of the
+ // styles is specified explicitly, we shouldn't add the other one
+ // automatically)
+ if ( !(style & (wxHSCROLL | wxVSCROLL)) )
+ style |= wxHSCROLL | wxVSCROLL;
+
+#ifdef __WXOSX__
+ bool retval = T::Create(parent, winid, pos, size, style, name);
+ if ( retval && (style & wxALWAYS_SHOW_SB) )
+ ShowScrollbars(wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS);
+ return retval;
+#else
+ if ( style & wxALWAYS_SHOW_SB )
+ ShowScrollbars(wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS);
+
+ return T::Create(parent, winid, pos, size, style, name);
+#endif
+ }
+
+#ifdef __WXMSW__
+ // we need to return a special WM_GETDLGCODE value to process just the
+ // arrows but let the other navigation characters through
+ virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
+ {
+ return FilterMSWWindowProc(nMsg, T::MSWWindowProc(nMsg, wParam, lParam));
+ }
+
+ // Take into account the scroll origin.
+ virtual void MSWAdjustBrushOrg(int* xOrg, int* yOrg) const
+ {
+ CalcUnscrolledPosition(*xOrg, *yOrg, xOrg, yOrg);
+ }
+#endif // __WXMSW__
+
+ WX_FORWARD_TO_SCROLL_HELPER()
+
+protected:
+ virtual wxSize DoGetBestSize() const
+ {
+ return FilterBestSize(this, this, T::DoGetBestSize());
+ }
+
+private:
+ // VC++ 6 gives warning for the declaration of template member function
+ // without definition
+#ifndef __VISUALC6__
+ wxDECLARE_NO_COPY_CLASS(wxScrolled);
+#endif
+};
+
+#ifdef __VISUALC6__
+ // disable the warning about non dll-interface class used as base for
+ // dll-interface class: it's harmless in this case
+ #pragma warning(push)
+ #pragma warning(disable:4275)
+#endif
+
+// for compatibility with existing code, we provide wxScrolledWindow
+// "typedef" for wxScrolled<wxPanel>. It's not a real typedef because we
+// want wxScrolledWindow to show in wxRTTI information (the class is widely
+// used and likelihood of its wxRTTI information being used too is high):
+class WXDLLIMPEXP_CORE wxScrolledWindow : public wxScrolled<wxPanel>
+{
+public:
+ wxScrolledWindow() : wxScrolled<wxPanel>() {}
+ wxScrolledWindow(wxWindow *parent,
+ wxWindowID winid = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxScrolledWindowStyle,
+ const wxString& name = wxPanelNameStr)
+ : wxScrolled<wxPanel>(parent, winid, pos, size, style, name) {}
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxScrolledWindow)
+};
+
+typedef wxScrolled<wxWindow> wxScrolledCanvas;
+
+#ifdef __VISUALC6__
+ #pragma warning(pop)
+#endif
+
+#endif // _WX_SCROLWIN_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/selstore.h
+// Purpose: wxSelectionStore stores selected items in a control
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 08.06.03 (extracted from src/generic/listctrl.cpp)
+// Copyright: (c) 2000-2003 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SELSTORE_H_
+#define _WX_SELSTORE_H_
+
+#include "wx/dynarray.h"
+
+// ----------------------------------------------------------------------------
+// wxSelectedIndices is just a sorted array of indices
+// ----------------------------------------------------------------------------
+
+inline int CMPFUNC_CONV wxUIntCmp(unsigned n1, unsigned n2)
+{
+ return (int)(n1 - n2);
+}
+
+WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_INT(unsigned, wxUIntCmp, wxSelectedIndices);
+
+// ----------------------------------------------------------------------------
+// wxSelectionStore is used to store the selected items in the virtual
+// controls, i.e. it is well suited for storing even when the control contains
+// a huge (practically infinite) number of items.
+//
+// Of course, internally it still has to store the selected items somehow (as
+// an array currently) but the advantage is that it can handle the selection
+// of all items (common operation) efficiently and that it could be made even
+// smarter in the future (e.g. store the selections as an array of ranges +
+// individual items) without changing its API.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSelectionStore
+{
+public:
+ wxSelectionStore() : m_itemsSel(wxUIntCmp) { Init(); }
+
+ // set the total number of items we handle
+ void SetItemCount(unsigned count);
+
+ // special case of SetItemCount(0)
+ void Clear() { m_itemsSel.Clear(); m_count = 0; m_defaultState = false; }
+
+ // must be called when a new item is inserted/added
+ void OnItemAdd(unsigned WXUNUSED(item)) { wxFAIL_MSG( wxT("TODO") ); }
+
+ // must be called when an item is deleted
+ void OnItemDelete(unsigned item);
+
+ // select one item, use SelectRange() insted if possible!
+ //
+ // returns true if the items selection really changed
+ bool SelectItem(unsigned item, bool select = true);
+
+ // select the range of items (inclusive)
+ //
+ // return true and fill the itemsChanged array with the indices of items
+ // which have changed state if "few" of them did, otherwise return false
+ // (meaning that too many items changed state to bother counting them
+ // individually)
+ bool SelectRange(unsigned itemFrom, unsigned itemTo,
+ bool select = true,
+ wxArrayInt *itemsChanged = NULL);
+
+ // return true if the given item is selected
+ bool IsSelected(unsigned item) const;
+
+ // return the total number of selected items
+ unsigned GetSelectedCount() const
+ {
+ return m_defaultState ? m_count - m_itemsSel.GetCount()
+ : m_itemsSel.GetCount();
+ }
+
+private:
+ // (re)init
+ void Init() { m_count = 0; m_defaultState = false; }
+
+ // the total number of items we handle
+ unsigned m_count;
+
+ // the default state: normally, false (i.e. off) but maybe set to true if
+ // there are more selected items than non selected ones - this allows to
+ // handle selection of all items efficiently
+ bool m_defaultState;
+
+ // the array of items whose selection state is different from default
+ wxSelectedIndices m_itemsSel;
+
+ wxDECLARE_NO_COPY_CLASS(wxSelectionStore);
+};
+
+#endif // _WX_SELSTORE_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/settings.h
+// Purpose: wxSystemSettings class
+// Author: Julian Smart
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SETTINGS_H_BASE_
+#define _WX_SETTINGS_H_BASE_
+
+#include "wx/colour.h"
+#include "wx/font.h"
+
+class WXDLLIMPEXP_FWD_CORE wxWindow;
+
+// possible values for wxSystemSettings::GetFont() parameter
+//
+// NB: wxMSW assumes that they have the same values as the parameters of
+// Windows GetStockObject() API, don't change the values!
+enum wxSystemFont
+{
+ wxSYS_OEM_FIXED_FONT = 10,
+ wxSYS_ANSI_FIXED_FONT,
+ wxSYS_ANSI_VAR_FONT,
+ wxSYS_SYSTEM_FONT,
+ wxSYS_DEVICE_DEFAULT_FONT,
+
+ // don't use: this is here just to make the values of enum elements
+ // coincide with the corresponding MSW constants
+ wxSYS_DEFAULT_PALETTE,
+
+ // don't use: MSDN says that this is a stock object provided only
+ // for compatibility with 16-bit Windows versions earlier than 3.0!
+ wxSYS_SYSTEM_FIXED_FONT,
+
+ wxSYS_DEFAULT_GUI_FONT,
+
+ // this was just a temporary aberration, do not use it any more
+ wxSYS_ICONTITLE_FONT = wxSYS_DEFAULT_GUI_FONT
+};
+
+// possible values for wxSystemSettings::GetColour() parameter
+//
+// NB: wxMSW assumes that they have the same values as the parameters of
+// Windows GetSysColor() API, don't change the values!
+enum wxSystemColour
+{
+ wxSYS_COLOUR_SCROLLBAR,
+ wxSYS_COLOUR_DESKTOP,
+ wxSYS_COLOUR_ACTIVECAPTION,
+ wxSYS_COLOUR_INACTIVECAPTION,
+ wxSYS_COLOUR_MENU,
+ wxSYS_COLOUR_WINDOW,
+ wxSYS_COLOUR_WINDOWFRAME,
+ wxSYS_COLOUR_MENUTEXT,
+ wxSYS_COLOUR_WINDOWTEXT,
+ wxSYS_COLOUR_CAPTIONTEXT,
+ wxSYS_COLOUR_ACTIVEBORDER,
+ wxSYS_COLOUR_INACTIVEBORDER,
+ wxSYS_COLOUR_APPWORKSPACE,
+ wxSYS_COLOUR_HIGHLIGHT,
+ wxSYS_COLOUR_HIGHLIGHTTEXT,
+ wxSYS_COLOUR_BTNFACE,
+ wxSYS_COLOUR_BTNSHADOW,
+ wxSYS_COLOUR_GRAYTEXT,
+ wxSYS_COLOUR_BTNTEXT,
+ wxSYS_COLOUR_INACTIVECAPTIONTEXT,
+ wxSYS_COLOUR_BTNHIGHLIGHT,
+ wxSYS_COLOUR_3DDKSHADOW,
+ wxSYS_COLOUR_3DLIGHT,
+ wxSYS_COLOUR_INFOTEXT,
+ wxSYS_COLOUR_INFOBK,
+ wxSYS_COLOUR_LISTBOX,
+ wxSYS_COLOUR_HOTLIGHT,
+ wxSYS_COLOUR_GRADIENTACTIVECAPTION,
+ wxSYS_COLOUR_GRADIENTINACTIVECAPTION,
+ wxSYS_COLOUR_MENUHILIGHT,
+ wxSYS_COLOUR_MENUBAR,
+ wxSYS_COLOUR_LISTBOXTEXT,
+ wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT,
+
+ wxSYS_COLOUR_MAX,
+
+ // synonyms
+ wxSYS_COLOUR_BACKGROUND = wxSYS_COLOUR_DESKTOP,
+ wxSYS_COLOUR_3DFACE = wxSYS_COLOUR_BTNFACE,
+ wxSYS_COLOUR_3DSHADOW = wxSYS_COLOUR_BTNSHADOW,
+ wxSYS_COLOUR_BTNHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
+ wxSYS_COLOUR_3DHIGHLIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
+ wxSYS_COLOUR_3DHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
+ wxSYS_COLOUR_FRAMEBK = wxSYS_COLOUR_BTNFACE
+};
+
+// possible values for wxSystemSettings::GetMetric() index parameter
+//
+// NB: update the conversion table in msw/settings.cpp if you change the values
+// of the elements of this enum
+enum wxSystemMetric
+{
+ wxSYS_MOUSE_BUTTONS = 1,
+ wxSYS_BORDER_X,
+ wxSYS_BORDER_Y,
+ wxSYS_CURSOR_X,
+ wxSYS_CURSOR_Y,
+ wxSYS_DCLICK_X,
+ wxSYS_DCLICK_Y,
+ wxSYS_DRAG_X,
+ wxSYS_DRAG_Y,
+ wxSYS_EDGE_X,
+ wxSYS_EDGE_Y,
+ wxSYS_HSCROLL_ARROW_X,
+ wxSYS_HSCROLL_ARROW_Y,
+ wxSYS_HTHUMB_X,
+ wxSYS_ICON_X,
+ wxSYS_ICON_Y,
+ wxSYS_ICONSPACING_X,
+ wxSYS_ICONSPACING_Y,
+ wxSYS_WINDOWMIN_X,
+ wxSYS_WINDOWMIN_Y,
+ wxSYS_SCREEN_X,
+ wxSYS_SCREEN_Y,
+ wxSYS_FRAMESIZE_X,
+ wxSYS_FRAMESIZE_Y,
+ wxSYS_SMALLICON_X,
+ wxSYS_SMALLICON_Y,
+ wxSYS_HSCROLL_Y,
+ wxSYS_VSCROLL_X,
+ wxSYS_VSCROLL_ARROW_X,
+ wxSYS_VSCROLL_ARROW_Y,
+ wxSYS_VTHUMB_Y,
+ wxSYS_CAPTION_Y,
+ wxSYS_MENU_Y,
+ wxSYS_NETWORK_PRESENT,
+ wxSYS_PENWINDOWS_PRESENT,
+ wxSYS_SHOW_SOUNDS,
+ wxSYS_SWAP_BUTTONS,
+ wxSYS_DCLICK_MSEC
+};
+
+// possible values for wxSystemSettings::HasFeature() parameter
+enum wxSystemFeature
+{
+ wxSYS_CAN_DRAW_FRAME_DECORATIONS = 1,
+ wxSYS_CAN_ICONIZE_FRAME,
+ wxSYS_TABLET_PRESENT
+};
+
+// values for different screen designs
+enum wxSystemScreenType
+{
+ wxSYS_SCREEN_NONE = 0, // not yet defined
+
+ wxSYS_SCREEN_TINY, // <
+ wxSYS_SCREEN_PDA, // >= 320x240
+ wxSYS_SCREEN_SMALL, // >= 640x480
+ wxSYS_SCREEN_DESKTOP // >= 800x600
+};
+
+// ----------------------------------------------------------------------------
+// wxSystemSettingsNative: defines the API for wxSystemSettings class
+// ----------------------------------------------------------------------------
+
+// this is a namespace rather than a class: it has only non virtual static
+// functions
+//
+// also note that the methods are implemented in the platform-specific source
+// files (i.e. this is not a real base class as we can't override its virtual
+// functions because it doesn't have any)
+
+class WXDLLIMPEXP_CORE wxSystemSettingsNative
+{
+public:
+ // get a standard system colour
+ static wxColour GetColour(wxSystemColour index);
+
+ // get a standard system font
+ static wxFont GetFont(wxSystemFont index);
+
+ // get a system-dependent metric
+ static int GetMetric(wxSystemMetric index, wxWindow * win = NULL);
+
+ // return true if the port has certain feature
+ static bool HasFeature(wxSystemFeature index);
+};
+
+// ----------------------------------------------------------------------------
+// include the declaration of the real platform-dependent class
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSystemSettings : public wxSystemSettingsNative
+{
+public:
+#ifdef __WXUNIVERSAL__
+ // in wxUniversal we want to use the theme standard colours instead of the
+ // system ones, otherwise wxSystemSettings is just the same as
+ // wxSystemSettingsNative
+ static wxColour GetColour(wxSystemColour index);
+
+ // some metrics are toolkit-dependent and provided by wxUniv, some are
+ // lowlevel
+ static int GetMetric(wxSystemMetric index, wxWindow *win = NULL);
+#endif // __WXUNIVERSAL__
+
+ // Get system screen design (desktop, pda, ..) used for
+ // laying out various dialogs.
+ static wxSystemScreenType GetScreenType();
+
+ // Override default.
+ static void SetScreenType( wxSystemScreenType screen );
+
+ // Value
+ static wxSystemScreenType ms_screen;
+
+};
+
+#endif
+ // _WX_SETTINGS_H_BASE_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/sharedptr.h
+// Purpose: Shared pointer based on the counted_ptr<> template, which
+// is in the public domain
+// Author: Robert Roebling, Yonat Sharon
+// Copyright: Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SHAREDPTR_H_
+#define _WX_SHAREDPTR_H_
+
+#include "wx/defs.h"
+#include "wx/atomic.h"
+
+// ----------------------------------------------------------------------------
+// wxSharedPtr: A smart pointer with non-intrusive reference counting.
+// ----------------------------------------------------------------------------
+
+template <class T>
+class wxSharedPtr
+{
+public:
+ typedef T element_type;
+
+ wxEXPLICIT wxSharedPtr( T* ptr = NULL )
+ : m_ref(NULL)
+ {
+ if (ptr)
+ m_ref = new reftype(ptr);
+ }
+
+ template<typename Deleter>
+ wxEXPLICIT wxSharedPtr(T* ptr, Deleter d)
+ : m_ref(NULL)
+ {
+ if (ptr)
+ m_ref = new reftype_with_deleter<Deleter>(ptr, d);
+ }
+
+ ~wxSharedPtr() { Release(); }
+ wxSharedPtr(const wxSharedPtr& tocopy) { Acquire(tocopy.m_ref); }
+
+ wxSharedPtr& operator=( const wxSharedPtr& tocopy )
+ {
+ if (this != &tocopy)
+ {
+ Release();
+ Acquire(tocopy.m_ref);
+ }
+ return *this;
+ }
+
+ wxSharedPtr& operator=( T* ptr )
+ {
+ if (get() != ptr)
+ {
+ Release();
+ if (ptr)
+ m_ref = new reftype(ptr);
+ }
+ return *this;
+ }
+
+ // test for pointer validity: defining conversion to unspecified_bool_type
+ // and not more obvious bool to avoid implicit conversions to integer types
+ typedef T *(wxSharedPtr<T>::*unspecified_bool_type)() const;
+ operator unspecified_bool_type() const
+ {
+ if (m_ref && m_ref->m_ptr)
+ return &wxSharedPtr<T>::get;
+ else
+ return NULL;
+ }
+
+ T& operator*() const
+ {
+ wxASSERT(m_ref != NULL);
+ wxASSERT(m_ref->m_ptr != NULL);
+ return *(m_ref->m_ptr);
+ }
+
+ T* operator->() const
+ {
+ wxASSERT(m_ref != NULL);
+ wxASSERT(m_ref->m_ptr != NULL);
+ return m_ref->m_ptr;
+ }
+
+ T* get() const
+ {
+ return m_ref ? m_ref->m_ptr : NULL;
+ }
+
+ void reset( T* ptr = NULL )
+ {
+ Release();
+ if (ptr)
+ m_ref = new reftype(ptr);
+ }
+
+ template<typename Deleter>
+ void reset(T* ptr, Deleter d)
+ {
+ Release();
+ if (ptr)
+ m_ref = new reftype_with_deleter<Deleter>(ptr, d);
+ }
+
+ bool unique() const { return (m_ref ? m_ref->m_count == 1 : true); }
+ long use_count() const { return (m_ref ? (long)m_ref->m_count : 0); }
+
+private:
+
+ struct reftype
+ {
+ reftype(T* ptr) : m_ptr(ptr), m_count(1) {}
+ virtual ~reftype() {}
+ virtual void delete_ptr() { delete m_ptr; }
+
+ T* m_ptr;
+ wxAtomicInt m_count;
+ };
+
+ template<typename Deleter>
+ struct reftype_with_deleter : public reftype
+ {
+ reftype_with_deleter(T* ptr, Deleter d) : reftype(ptr), m_deleter(d) {}
+ virtual void delete_ptr() { m_deleter(this->m_ptr); }
+
+ Deleter m_deleter;
+ };
+
+ reftype* m_ref;
+
+ void Acquire(reftype* ref)
+ {
+ m_ref = ref;
+ if (ref)
+ wxAtomicInc( ref->m_count );
+ }
+
+ void Release()
+ {
+ if (m_ref)
+ {
+ if (!wxAtomicDec( m_ref->m_count ))
+ {
+ m_ref->delete_ptr();
+ delete m_ref;
+ }
+ m_ref = NULL;
+ }
+ }
+};
+
+template <class T, class U>
+bool operator == (wxSharedPtr<T> const &a, wxSharedPtr<U> const &b )
+{
+ return a.get() == b.get();
+}
+
+template <class T, class U>
+bool operator != (wxSharedPtr<T> const &a, wxSharedPtr<U> const &b )
+{
+ return a.get() != b.get();
+}
+
+#endif // _WX_SHAREDPTR_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/simplebook.h
+// Purpose: wxBookCtrlBase-derived class without any controller.
+// Author: Vadim Zeitlin
+// Created: 2012-08-21
+// Copyright: (c) 2012 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SIMPLEBOOK_H_
+#define _WX_SIMPLEBOOK_H_
+
+#include "wx/bookctrl.h"
+
+#if wxUSE_BOOKCTRL
+
+#include "wx/vector.h"
+
+// ----------------------------------------------------------------------------
+// wxSimplebook: a book control without any user-actionable controller.
+// ----------------------------------------------------------------------------
+
+// NB: This class doesn't use DLL export declaration as it's fully inline.
+
+class wxSimplebook : public wxBookCtrlBase
+{
+public:
+ wxSimplebook()
+ {
+ Init();
+ }
+
+ wxSimplebook(wxWindow *parent,
+ wxWindowID winid = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxEmptyString)
+ : wxBookCtrlBase(parent, winid, pos, size, style | wxBK_TOP, name)
+ {
+ Init();
+ }
+
+
+ // Methods specific to this class.
+
+ // A method allowing to add a new page without any label (which is unused
+ // by this control) and show it immediately.
+ bool ShowNewPage(wxWindow* page)
+ {
+ return AddPage(page, wxString(), true /* select it */);
+ }
+
+
+ // Set effect to use for showing/hiding pages.
+ void SetEffects(wxShowEffect showEffect, wxShowEffect hideEffect)
+ {
+ m_showEffect = showEffect;
+ m_hideEffect = hideEffect;
+ }
+
+ // Or the same effect for both of them.
+ void SetEffect(wxShowEffect effect)
+ {
+ SetEffects(effect, effect);
+ }
+
+ // And the same for time outs.
+ void SetEffectsTimeouts(unsigned showTimeout, unsigned hideTimeout)
+ {
+ m_showTimeout = showTimeout;
+ m_hideTimeout = hideTimeout;
+ }
+
+ void SetEffectTimeout(unsigned timeout)
+ {
+ SetEffectsTimeouts(timeout, timeout);
+ }
+
+
+ // Implement base class pure virtual methods.
+
+ // Page management
+ virtual bool InsertPage(size_t n,
+ wxWindow *page,
+ const wxString& text,
+ bool bSelect = false,
+ int imageId = NO_IMAGE)
+ {
+ if ( !wxBookCtrlBase::InsertPage(n, page, text, bSelect, imageId) )
+ return false;
+
+ m_pageTexts.insert(m_pageTexts.begin() + n, text);
+
+ if ( !DoSetSelectionAfterInsertion(n, bSelect) )
+ page->Hide();
+
+ return true;
+ }
+
+ virtual int SetSelection(size_t n)
+ {
+ return DoSetSelection(n, SetSelection_SendEvent);
+ }
+
+ virtual int ChangeSelection(size_t n)
+ {
+ return DoSetSelection(n);
+ }
+
+ // Neither labels nor images are supported but we still store the labels
+ // just in case the user code attaches some importance to them.
+ virtual bool SetPageText(size_t n, const wxString& strText)
+ {
+ wxCHECK_MSG( n < GetPageCount(), false, wxS("Invalid page") );
+
+ m_pageTexts[n] = strText;
+
+ return true;
+ }
+
+ virtual wxString GetPageText(size_t n) const
+ {
+ wxCHECK_MSG( n < GetPageCount(), wxString(), wxS("Invalid page") );
+
+ return m_pageTexts[n];
+ }
+
+ virtual bool SetPageImage(size_t WXUNUSED(n), int WXUNUSED(imageId))
+ {
+ return false;
+ }
+
+ virtual int GetPageImage(size_t WXUNUSED(n)) const
+ {
+ return NO_IMAGE;
+ }
+
+protected:
+ virtual void UpdateSelectedPage(size_t newsel)
+ {
+ m_selection = newsel;
+ }
+
+ virtual wxBookCtrlEvent* CreatePageChangingEvent() const
+ {
+ return new wxBookCtrlEvent(wxEVT_BOOKCTRL_PAGE_CHANGING,
+ GetId());
+ }
+
+ virtual void MakeChangedEvent(wxBookCtrlEvent& event)
+ {
+ event.SetEventType(wxEVT_BOOKCTRL_PAGE_CHANGED);
+ }
+
+ virtual wxWindow *DoRemovePage(size_t page)
+ {
+ wxWindow* const win = wxBookCtrlBase::DoRemovePage(page);
+ if ( win )
+ {
+ m_pageTexts.erase(m_pageTexts.begin() + page);
+
+ DoSetSelectionAfterRemoval(page);
+ }
+
+ return win;
+ }
+
+ virtual void DoSize()
+ {
+ wxWindow* const page = GetCurrentPage();
+ if ( page )
+ page->SetSize(GetPageRect());
+ }
+
+ virtual void DoShowPage(wxWindow* page, bool show)
+ {
+ if ( show )
+ page->ShowWithEffect(m_showEffect, m_showTimeout);
+ else
+ page->HideWithEffect(m_hideEffect, m_hideTimeout);
+ }
+
+private:
+ void Init()
+ {
+ // We don't need any border as we don't have anything to separate the
+ // page contents from.
+ SetInternalBorder(0);
+
+ // No effects by default.
+ m_showEffect =
+ m_hideEffect = wxSHOW_EFFECT_NONE;
+
+ m_showTimeout =
+ m_hideTimeout = 0;
+ }
+
+ wxVector<wxString> m_pageTexts;
+
+ wxShowEffect m_showEffect,
+ m_hideEffect;
+
+ unsigned m_showTimeout,
+ m_hideTimeout;
+
+ wxDECLARE_NO_COPY_CLASS(wxSimplebook);
+};
+
+#endif // wxUSE_BOOKCTRL
+
+#endif // _WX_SIMPLEBOOK_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/sizer.h
+// Purpose: provide wxSizer class for layout
+// Author: Robert Roebling and Robin Dunn
+// Modified by: Ron Lee, Vadim Zeitlin (wxSizerFlags)
+// Created:
+// Copyright: (c) Robin Dunn, Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __WXSIZER_H__
+#define __WXSIZER_H__
+
+#include "wx/defs.h"
+
+#include "wx/window.h"
+
+//---------------------------------------------------------------------------
+// classes
+//---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxButton;
+class WXDLLIMPEXP_FWD_CORE wxBoxSizer;
+class WXDLLIMPEXP_FWD_CORE wxSizerItem;
+class WXDLLIMPEXP_FWD_CORE wxSizer;
+
+#ifndef wxUSE_BORDER_BY_DEFAULT
+ #ifdef __SMARTPHONE__
+ // no borders by default on limited size screen
+ #define wxUSE_BORDER_BY_DEFAULT 0
+ #else
+ #define wxUSE_BORDER_BY_DEFAULT 1
+ #endif
+#endif
+
+// ----------------------------------------------------------------------------
+// wxSizerFlags: flags used for an item in the sizer
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSizerFlags
+{
+public:
+ // construct the flags object initialized with the given proportion (0 by
+ // default)
+ wxSizerFlags(int proportion = 0) : m_proportion(proportion)
+ {
+ m_flags = 0;
+ m_borderInPixels = 0;
+ }
+
+ // setters for all sizer flags, they all return the object itself so that
+ // calls to them can be chained
+
+ wxSizerFlags& Proportion(int proportion)
+ {
+ m_proportion = proportion;
+ return *this;
+ }
+
+ wxSizerFlags& Expand()
+ {
+ m_flags |= wxEXPAND;
+ return *this;
+ }
+
+ // notice that Align() replaces the current alignment flags, use specific
+ // methods below such as Top(), Left() &c if you want to set just the
+ // vertical or horizontal alignment
+ wxSizerFlags& Align(int alignment) // combination of wxAlignment values
+ {
+ m_flags &= ~wxALIGN_MASK;
+ m_flags |= alignment;
+
+ return *this;
+ }
+
+ // some shortcuts for Align()
+ wxSizerFlags& Centre() { return Align(wxALIGN_CENTRE); }
+ wxSizerFlags& Center() { return Centre(); }
+
+ wxSizerFlags& Top()
+ {
+ m_flags &= ~(wxALIGN_BOTTOM | wxALIGN_CENTRE_VERTICAL);
+ return *this;
+ }
+
+ wxSizerFlags& Left()
+ {
+ m_flags &= ~(wxALIGN_RIGHT | wxALIGN_CENTRE_HORIZONTAL);
+ return *this;
+ }
+
+ wxSizerFlags& Right()
+ {
+ m_flags = (m_flags & ~wxALIGN_CENTRE_HORIZONTAL) | wxALIGN_RIGHT;
+ return *this;
+ }
+
+ wxSizerFlags& Bottom()
+ {
+ m_flags = (m_flags & ~wxALIGN_CENTRE_VERTICAL) | wxALIGN_BOTTOM;
+ return *this;
+ }
+
+
+ // default border size used by Border() below
+ static int GetDefaultBorder()
+ {
+#if wxUSE_BORDER_BY_DEFAULT
+ #ifdef __WXGTK20__
+ // GNOME HIG says to use 6px as the base unit:
+ // http://library.gnome.org/devel/hig-book/stable/design-window.html.en
+ return 6;
+ #else
+ // FIXME: default border size shouldn't be hardcoded and at the very
+ // least they should depend on the current font size
+ return 5;
+ #endif
+#else
+ return 0;
+#endif
+ }
+
+
+ wxSizerFlags& Border(int direction, int borderInPixels)
+ {
+ wxCHECK_MSG( !(direction & ~wxALL), *this,
+ wxS("direction must be a combination of wxDirection ")
+ wxS("enum values.") );
+
+ m_flags &= ~wxALL;
+ m_flags |= direction;
+
+ m_borderInPixels = borderInPixels;
+
+ return *this;
+ }
+
+ wxSizerFlags& Border(int direction = wxALL)
+ {
+#if wxUSE_BORDER_BY_DEFAULT
+ return Border(direction, GetDefaultBorder());
+#else
+ // no borders by default on limited size screen
+ wxUnusedVar(direction);
+
+ return *this;
+#endif
+ }
+
+ wxSizerFlags& DoubleBorder(int direction = wxALL)
+ {
+#if wxUSE_BORDER_BY_DEFAULT
+ return Border(direction, 2*GetDefaultBorder());
+#else
+ wxUnusedVar(direction);
+
+ return *this;
+#endif
+ }
+
+ wxSizerFlags& TripleBorder(int direction = wxALL)
+ {
+#if wxUSE_BORDER_BY_DEFAULT
+ return Border(direction, 3*GetDefaultBorder());
+#else
+ wxUnusedVar(direction);
+
+ return *this;
+#endif
+ }
+
+ wxSizerFlags& HorzBorder()
+ {
+#if wxUSE_BORDER_BY_DEFAULT
+ return Border(wxLEFT | wxRIGHT, GetDefaultBorder());
+#else
+ return *this;
+#endif
+ }
+
+ wxSizerFlags& DoubleHorzBorder()
+ {
+#if wxUSE_BORDER_BY_DEFAULT
+ return Border(wxLEFT | wxRIGHT, 2*GetDefaultBorder());
+#else
+ return *this;
+#endif
+ }
+
+ // setters for the others flags
+ wxSizerFlags& Shaped()
+ {
+ m_flags |= wxSHAPED;
+
+ return *this;
+ }
+
+ wxSizerFlags& FixedMinSize()
+ {
+ m_flags |= wxFIXED_MINSIZE;
+
+ return *this;
+ }
+
+ // makes the item ignore window's visibility status
+ wxSizerFlags& ReserveSpaceEvenIfHidden()
+ {
+ m_flags |= wxRESERVE_SPACE_EVEN_IF_HIDDEN;
+ return *this;
+ }
+
+ // accessors for wxSizer only
+ int GetProportion() const { return m_proportion; }
+ int GetFlags() const { return m_flags; }
+ int GetBorderInPixels() const { return m_borderInPixels; }
+
+private:
+ int m_proportion;
+ int m_flags;
+ int m_borderInPixels;
+};
+
+
+// ----------------------------------------------------------------------------
+// wxSizerSpacer: used by wxSizerItem to represent a spacer
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSizerSpacer
+{
+public:
+ wxSizerSpacer(const wxSize& size) : m_size(size), m_isShown(true) { }
+
+ void SetSize(const wxSize& size) { m_size = size; }
+ const wxSize& GetSize() const { return m_size; }
+
+ void Show(bool show) { m_isShown = show; }
+ bool IsShown() const { return m_isShown; }
+
+private:
+ // the size, in pixel
+ wxSize m_size;
+
+ // is the spacer currently shown?
+ bool m_isShown;
+};
+
+// ----------------------------------------------------------------------------
+// wxSizerItem
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSizerItem : public wxObject
+{
+public:
+ // window
+ wxSizerItem( wxWindow *window,
+ int proportion=0,
+ int flag=0,
+ int border=0,
+ wxObject* userData=NULL );
+
+ // window with flags
+ wxSizerItem(wxWindow *window, const wxSizerFlags& flags)
+ {
+ Init(flags);
+
+ DoSetWindow(window);
+ }
+
+ // subsizer
+ wxSizerItem( wxSizer *sizer,
+ int proportion=0,
+ int flag=0,
+ int border=0,
+ wxObject* userData=NULL );
+
+ // sizer with flags
+ wxSizerItem(wxSizer *sizer, const wxSizerFlags& flags)
+ {
+ Init(flags);
+
+ DoSetSizer(sizer);
+ }
+
+ // spacer
+ wxSizerItem( int width,
+ int height,
+ int proportion=0,
+ int flag=0,
+ int border=0,
+ wxObject* userData=NULL);
+
+ // spacer with flags
+ wxSizerItem(int width, int height, const wxSizerFlags& flags)
+ {
+ Init(flags);
+
+ DoSetSpacer(wxSize(width, height));
+ }
+
+ wxSizerItem();
+ virtual ~wxSizerItem();
+
+ virtual void DeleteWindows();
+
+ // Enable deleting the SizerItem without destroying the contained sizer.
+ void DetachSizer() { m_sizer = NULL; }
+
+ virtual wxSize GetSize() const;
+ virtual wxSize CalcMin();
+ virtual void SetDimension( const wxPoint& pos, const wxSize& size );
+
+ wxSize GetMinSize() const
+ { return m_minSize; }
+ wxSize GetMinSizeWithBorder() const;
+
+ wxSize GetMaxSize() const
+ { return IsWindow() ? m_window->GetMaxSize() : wxDefaultSize; }
+ wxSize GetMaxSizeWithBorder() const;
+
+ void SetMinSize(const wxSize& size)
+ {
+ if ( IsWindow() )
+ m_window->SetMinSize(size);
+ m_minSize = size;
+ }
+ void SetMinSize( int x, int y )
+ { SetMinSize(wxSize(x, y)); }
+ void SetInitSize( int x, int y )
+ { SetMinSize(wxSize(x, y)); }
+
+ // if either of dimensions is zero, ratio is assumed to be 1
+ // to avoid "divide by zero" errors
+ void SetRatio(int width, int height)
+ { m_ratio = (width && height) ? ((float) width / (float) height) : 1; }
+ void SetRatio(const wxSize& size)
+ { SetRatio(size.x, size.y); }
+ void SetRatio(float ratio)
+ { m_ratio = ratio; }
+ float GetRatio() const
+ { return m_ratio; }
+
+ virtual wxRect GetRect() { return m_rect; }
+
+ // set a sizer item id (different from a window id, all sizer items,
+ // including spacers, can have an associated id)
+ void SetId(int id) { m_id = id; }
+ int GetId() const { return m_id; }
+
+ bool IsWindow() const { return m_kind == Item_Window; }
+ bool IsSizer() const { return m_kind == Item_Sizer; }
+ bool IsSpacer() const { return m_kind == Item_Spacer; }
+
+#if WXWIN_COMPATIBILITY_2_6
+ // Deprecated in 2.6, use {G,S}etProportion instead.
+ wxDEPRECATED( void SetOption( int option ) );
+ wxDEPRECATED( int GetOption() const );
+#endif // WXWIN_COMPATIBILITY_2_6
+
+ void SetProportion( int proportion )
+ { m_proportion = proportion; }
+ int GetProportion() const
+ { return m_proportion; }
+ void SetFlag( int flag )
+ { m_flag = flag; }
+ int GetFlag() const
+ { return m_flag; }
+ void SetBorder( int border )
+ { m_border = border; }
+ int GetBorder() const
+ { return m_border; }
+
+ wxWindow *GetWindow() const
+ { return m_kind == Item_Window ? m_window : NULL; }
+ wxSizer *GetSizer() const
+ { return m_kind == Item_Sizer ? m_sizer : NULL; }
+ wxSize GetSpacer() const;
+
+ // This function behaves obviously for the windows and spacers but for the
+ // sizers it returns true if any sizer element is shown and only returns
+ // false if all of them are hidden. Also, it always returns true if
+ // wxRESERVE_SPACE_EVEN_IF_HIDDEN flag was used.
+ bool IsShown() const;
+
+ void Show(bool show);
+
+ void SetUserData(wxObject* userData)
+ { delete m_userData; m_userData = userData; }
+ wxObject* GetUserData() const
+ { return m_userData; }
+ wxPoint GetPosition() const
+ { return m_pos; }
+
+ // Called once the first component of an item has been decided. This is
+ // used in algorithms that depend on knowing the size in one direction
+ // before the min size in the other direction can be known.
+ // Returns true if it made use of the information (and min size was changed).
+ bool InformFirstDirection( int direction, int size, int availableOtherDir=-1 );
+
+ // these functions delete the current contents of the item if it's a sizer
+ // or a spacer but not if it is a window
+ void AssignWindow(wxWindow *window)
+ {
+ Free();
+ DoSetWindow(window);
+ }
+
+ void AssignSizer(wxSizer *sizer)
+ {
+ Free();
+ DoSetSizer(sizer);
+ }
+
+ void AssignSpacer(const wxSize& size)
+ {
+ Free();
+ DoSetSpacer(size);
+ }
+
+ void AssignSpacer(int w, int h) { AssignSpacer(wxSize(w, h)); }
+
+#if WXWIN_COMPATIBILITY_2_8
+ // these functions do not free the old sizer/spacer and so can easily
+ // provoke the memory leaks and so shouldn't be used, use Assign() instead
+ wxDEPRECATED( void SetWindow(wxWindow *window) );
+ wxDEPRECATED( void SetSizer(wxSizer *sizer) );
+ wxDEPRECATED( void SetSpacer(const wxSize& size) );
+ wxDEPRECATED( void SetSpacer(int width, int height) );
+#endif // WXWIN_COMPATIBILITY_2_8
+
+protected:
+ // common part of several ctors
+ void Init() { m_userData = NULL; m_kind = Item_None; }
+
+ // common part of ctors taking wxSizerFlags
+ void Init(const wxSizerFlags& flags);
+
+ // free current contents
+ void Free();
+
+ // common parts of Set/AssignXXX()
+ void DoSetWindow(wxWindow *window);
+ void DoSetSizer(wxSizer *sizer);
+ void DoSetSpacer(const wxSize& size);
+
+ // Add the border specified for this item to the given size
+ // if it's != wxDefaultSize, just return wxDefaultSize otherwise.
+ wxSize AddBorderToSize(const wxSize& size) const;
+
+ // discriminated union: depending on m_kind one of the fields is valid
+ enum
+ {
+ Item_None,
+ Item_Window,
+ Item_Sizer,
+ Item_Spacer,
+ Item_Max
+ } m_kind;
+ union
+ {
+ wxWindow *m_window;
+ wxSizer *m_sizer;
+ wxSizerSpacer *m_spacer;
+ };
+
+ wxPoint m_pos;
+ wxSize m_minSize;
+ int m_proportion;
+ int m_border;
+ int m_flag;
+ int m_id;
+
+ // on screen rectangle of this item (not including borders)
+ wxRect m_rect;
+
+ // Aspect ratio can always be calculated from m_size,
+ // but this would cause precision loss when the window
+ // is shrunk. It is safer to preserve the initial value.
+ float m_ratio;
+
+ wxObject *m_userData;
+
+private:
+ DECLARE_CLASS(wxSizerItem)
+ wxDECLARE_NO_COPY_CLASS(wxSizerItem);
+};
+
+WX_DECLARE_EXPORTED_LIST( wxSizerItem, wxSizerItemList );
+
+
+//---------------------------------------------------------------------------
+// wxSizer
+//---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSizer: public wxObject, public wxClientDataContainer
+{
+public:
+ wxSizer() { m_containingWindow = NULL; }
+ virtual ~wxSizer();
+
+ // methods for adding elements to the sizer: there are Add/Insert/Prepend
+ // overloads for each of window/sizer/spacer/wxSizerItem
+ wxSizerItem* Add(wxWindow *window,
+ int proportion = 0,
+ int flag = 0,
+ int border = 0,
+ wxObject* userData = NULL);
+ wxSizerItem* Add(wxSizer *sizer,
+ int proportion = 0,
+ int flag = 0,
+ int border = 0,
+ wxObject* userData = NULL);
+ wxSizerItem* Add(int width,
+ int height,
+ int proportion = 0,
+ int flag = 0,
+ int border = 0,
+ wxObject* userData = NULL);
+ wxSizerItem* Add( wxWindow *window, const wxSizerFlags& flags);
+ wxSizerItem* Add( wxSizer *sizer, const wxSizerFlags& flags);
+ wxSizerItem* Add( int width, int height, const wxSizerFlags& flags);
+ wxSizerItem* Add( wxSizerItem *item);
+
+ virtual wxSizerItem *AddSpacer(int size);
+ wxSizerItem* AddStretchSpacer(int prop = 1);
+
+ wxSizerItem* Insert(size_t index,
+ wxWindow *window,
+ int proportion = 0,
+ int flag = 0,
+ int border = 0,
+ wxObject* userData = NULL);
+ wxSizerItem* Insert(size_t index,
+ wxSizer *sizer,
+ int proportion = 0,
+ int flag = 0,
+ int border = 0,
+ wxObject* userData = NULL);
+ wxSizerItem* Insert(size_t index,
+ int width,
+ int height,
+ int proportion = 0,
+ int flag = 0,
+ int border = 0,
+ wxObject* userData = NULL);
+ wxSizerItem* Insert(size_t index,
+ wxWindow *window,
+ const wxSizerFlags& flags);
+ wxSizerItem* Insert(size_t index,
+ wxSizer *sizer,
+ const wxSizerFlags& flags);
+ wxSizerItem* Insert(size_t index,
+ int width,
+ int height,
+ const wxSizerFlags& flags);
+
+ // NB: do _not_ override this function in the derived classes, this one is
+ // virtual for compatibility reasons only to allow old code overriding
+ // it to continue to work, override DoInsert() instead in the new code
+ virtual wxSizerItem* Insert(size_t index, wxSizerItem *item);
+
+ wxSizerItem* InsertSpacer(size_t index, int size);
+ wxSizerItem* InsertStretchSpacer(size_t index, int prop = 1);
+
+ wxSizerItem* Prepend(wxWindow *window,
+ int proportion = 0,
+ int flag = 0,
+ int border = 0,
+ wxObject* userData = NULL);
+ wxSizerItem* Prepend(wxSizer *sizer,
+ int proportion = 0,
+ int flag = 0,
+ int border = 0,
+ wxObject* userData = NULL);
+ wxSizerItem* Prepend(int width,
+ int height,
+ int proportion = 0,
+ int flag = 0,
+ int border = 0,
+ wxObject* userData = NULL);
+ wxSizerItem* Prepend(wxWindow *window, const wxSizerFlags& flags);
+ wxSizerItem* Prepend(wxSizer *sizer, const wxSizerFlags& flags);
+ wxSizerItem* Prepend(int width, int height, const wxSizerFlags& flags);
+ wxSizerItem* Prepend(wxSizerItem *item);
+
+ wxSizerItem* PrependSpacer(int size);
+ wxSizerItem* PrependStretchSpacer(int prop = 1);
+
+ // set (or possibly unset if window is NULL) or get the window this sizer
+ // is used in
+ void SetContainingWindow(wxWindow *window);
+ wxWindow *GetContainingWindow() const { return m_containingWindow; }
+
+#if WXWIN_COMPATIBILITY_2_6
+ // Deprecated in 2.6 since historically it does not delete the window,
+ // use Detach instead.
+ wxDEPRECATED( virtual bool Remove( wxWindow *window ) );
+#endif // WXWIN_COMPATIBILITY_2_6
+
+ virtual bool Remove( wxSizer *sizer );
+ virtual bool Remove( int index );
+
+ virtual bool Detach( wxWindow *window );
+ virtual bool Detach( wxSizer *sizer );
+ virtual bool Detach( int index );
+
+ virtual bool Replace( wxWindow *oldwin, wxWindow *newwin, bool recursive = false );
+ virtual bool Replace( wxSizer *oldsz, wxSizer *newsz, bool recursive = false );
+ virtual bool Replace( size_t index, wxSizerItem *newitem );
+
+ virtual void Clear( bool delete_windows = false );
+ virtual void DeleteWindows();
+
+ // Inform sizer about the first direction that has been decided (by parent item)
+ // Returns true if it made use of the information (and recalculated min size)
+ virtual bool InformFirstDirection( int WXUNUSED(direction), int WXUNUSED(size), int WXUNUSED(availableOtherDir) )
+ { return false; }
+
+ void SetMinSize( int width, int height )
+ { DoSetMinSize( width, height ); }
+ void SetMinSize( const wxSize& size )
+ { DoSetMinSize( size.x, size.y ); }
+
+ // Searches recursively
+ bool SetItemMinSize( wxWindow *window, int width, int height )
+ { return DoSetItemMinSize( window, width, height ); }
+ bool SetItemMinSize( wxWindow *window, const wxSize& size )
+ { return DoSetItemMinSize( window, size.x, size.y ); }
+
+ // Searches recursively
+ bool SetItemMinSize( wxSizer *sizer, int width, int height )
+ { return DoSetItemMinSize( sizer, width, height ); }
+ bool SetItemMinSize( wxSizer *sizer, const wxSize& size )
+ { return DoSetItemMinSize( sizer, size.x, size.y ); }
+
+ bool SetItemMinSize( size_t index, int width, int height )
+ { return DoSetItemMinSize( index, width, height ); }
+ bool SetItemMinSize( size_t index, const wxSize& size )
+ { return DoSetItemMinSize( index, size.x, size.y ); }
+
+ wxSize GetSize() const
+ { return m_size; }
+ wxPoint GetPosition() const
+ { return m_position; }
+
+ // Calculate the minimal size or return m_minSize if bigger.
+ wxSize GetMinSize();
+
+ // These virtual functions are used by the layout algorithm: first
+ // CalcMin() is called to calculate the minimal size of the sizer and
+ // prepare for laying it out and then RecalcSizes() is called to really
+ // update all the sizer items
+ virtual wxSize CalcMin() = 0;
+ virtual void RecalcSizes() = 0;
+
+ virtual void Layout();
+
+ wxSize ComputeFittingClientSize(wxWindow *window);
+ wxSize ComputeFittingWindowSize(wxWindow *window);
+
+ wxSize Fit( wxWindow *window );
+ void FitInside( wxWindow *window );
+ void SetSizeHints( wxWindow *window );
+#if WXWIN_COMPATIBILITY_2_8
+ // This only calls FitInside() since 2.9
+ wxDEPRECATED( void SetVirtualSizeHints( wxWindow *window ) );
+#endif
+
+ wxSizerItemList& GetChildren()
+ { return m_children; }
+ const wxSizerItemList& GetChildren() const
+ { return m_children; }
+
+ void SetDimension(const wxPoint& pos, const wxSize& size)
+ {
+ m_position = pos;
+ m_size = size;
+ Layout();
+
+ // This call is required for wxWrapSizer to be able to calculate its
+ // minimal size correctly.
+ InformFirstDirection(wxHORIZONTAL, size.x, size.y);
+ }
+ void SetDimension(int x, int y, int width, int height)
+ { SetDimension(wxPoint(x, y), wxSize(width, height)); }
+
+ size_t GetItemCount() const { return m_children.GetCount(); }
+ bool IsEmpty() const { return m_children.IsEmpty(); }
+
+ wxSizerItem* GetItem( wxWindow *window, bool recursive = false );
+ wxSizerItem* GetItem( wxSizer *sizer, bool recursive = false );
+ wxSizerItem* GetItem( size_t index );
+ wxSizerItem* GetItemById( int id, bool recursive = false );
+
+ // Manage whether individual scene items are considered
+ // in the layout calculations or not.
+ bool Show( wxWindow *window, bool show = true, bool recursive = false );
+ bool Show( wxSizer *sizer, bool show = true, bool recursive = false );
+ bool Show( size_t index, bool show = true );
+
+ bool Hide( wxSizer *sizer, bool recursive = false )
+ { return Show( sizer, false, recursive ); }
+ bool Hide( wxWindow *window, bool recursive = false )
+ { return Show( window, false, recursive ); }
+ bool Hide( size_t index )
+ { return Show( index, false ); }
+
+ bool IsShown( wxWindow *window ) const;
+ bool IsShown( wxSizer *sizer ) const;
+ bool IsShown( size_t index ) const;
+
+ // Recursively call wxWindow::Show () on all sizer items.
+ virtual void ShowItems (bool show);
+
+ void Show(bool show) { ShowItems(show); }
+
+ // This is the ShowItems() counterpart and returns true if any of the sizer
+ // items are shown.
+ virtual bool AreAnyItemsShown() const;
+
+protected:
+ wxSize m_size;
+ wxSize m_minSize;
+ wxPoint m_position;
+ wxSizerItemList m_children;
+
+ // the window this sizer is used in, can be NULL
+ wxWindow *m_containingWindow;
+
+ wxSize GetMaxClientSize( wxWindow *window ) const;
+ wxSize GetMinClientSize( wxWindow *window );
+ wxSize VirtualFitSize( wxWindow *window );
+
+ virtual void DoSetMinSize( int width, int height );
+ virtual bool DoSetItemMinSize( wxWindow *window, int width, int height );
+ virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height );
+ virtual bool DoSetItemMinSize( size_t index, int width, int height );
+
+ // insert a new item into m_children at given index and return the item
+ // itself
+ virtual wxSizerItem* DoInsert(size_t index, wxSizerItem *item);
+
+private:
+ DECLARE_CLASS(wxSizer)
+};
+
+//---------------------------------------------------------------------------
+// wxGridSizer
+//---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxGridSizer: public wxSizer
+{
+public:
+ // ctors specifying the number of columns only: number of rows will be
+ // deduced automatically depending on the number of sizer elements
+ wxGridSizer( int cols, int vgap, int hgap );
+ wxGridSizer( int cols, const wxSize& gap = wxSize(0, 0) );
+
+ // ctors specifying the number of rows and columns
+ wxGridSizer( int rows, int cols, int vgap, int hgap );
+ wxGridSizer( int rows, int cols, const wxSize& gap );
+
+ virtual void RecalcSizes();
+ virtual wxSize CalcMin();
+
+ void SetCols( int cols )
+ {
+ wxASSERT_MSG( cols >= 0, "Number of columns must be non-negative");
+ m_cols = cols;
+ }
+
+ void SetRows( int rows )
+ {
+ wxASSERT_MSG( rows >= 0, "Number of rows must be non-negative");
+ m_rows = rows;
+ }
+
+ void SetVGap( int gap ) { m_vgap = gap; }
+ void SetHGap( int gap ) { m_hgap = gap; }
+ int GetCols() const { return m_cols; }
+ int GetRows() const { return m_rows; }
+ int GetVGap() const { return m_vgap; }
+ int GetHGap() const { return m_hgap; }
+
+ int GetEffectiveColsCount() const { return m_cols ? m_cols : CalcCols(); }
+ int GetEffectiveRowsCount() const { return m_rows ? m_rows : CalcRows(); }
+
+ // return the number of total items and the number of columns and rows
+ // (for internal use only)
+ int CalcRowsCols(int& rows, int& cols) const;
+
+protected:
+ // the number of rows/columns in the sizer, if 0 then it is determined
+ // dynamically depending on the total number of items
+ int m_rows;
+ int m_cols;
+
+ // gaps between rows and columns
+ int m_vgap;
+ int m_hgap;
+
+ virtual wxSizerItem *DoInsert(size_t index, wxSizerItem *item);
+
+ void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h );
+
+ // returns the number of columns/rows needed for the current total number
+ // of children (and the fixed number of rows/columns)
+ int CalcCols() const
+ {
+ wxCHECK_MSG
+ (
+ m_rows, 0,
+ "Can't calculate number of cols if number of rows is not specified"
+ );
+
+ return int(m_children.GetCount() + m_rows - 1) / m_rows;
+ }
+
+ int CalcRows() const
+ {
+ wxCHECK_MSG
+ (
+ m_cols, 0,
+ "Can't calculate number of cols if number of rows is not specified"
+ );
+
+ return int(m_children.GetCount() + m_cols - 1) / m_cols;
+ }
+
+private:
+ DECLARE_CLASS(wxGridSizer)
+};
+
+//---------------------------------------------------------------------------
+// wxFlexGridSizer
+//---------------------------------------------------------------------------
+
+// values which define the behaviour for resizing wxFlexGridSizer cells in the
+// "non-flexible" direction
+enum wxFlexSizerGrowMode
+{
+ // don't resize the cells in non-flexible direction at all
+ wxFLEX_GROWMODE_NONE,
+
+ // uniformly resize only the specified ones (default)
+ wxFLEX_GROWMODE_SPECIFIED,
+
+ // uniformly resize all cells
+ wxFLEX_GROWMODE_ALL
+};
+
+class WXDLLIMPEXP_CORE wxFlexGridSizer: public wxGridSizer
+{
+public:
+ // ctors specifying the number of columns only: number of rows will be
+ // deduced automatically depending on the number of sizer elements
+ wxFlexGridSizer( int cols, int vgap, int hgap );
+ wxFlexGridSizer( int cols, const wxSize& gap = wxSize(0, 0) );
+
+ // ctors specifying the number of rows and columns
+ wxFlexGridSizer( int rows, int cols, int vgap, int hgap );
+ wxFlexGridSizer( int rows, int cols, const wxSize& gap );
+
+ // dtor
+ virtual ~wxFlexGridSizer();
+
+ // set the rows/columns which will grow (the others will remain of the
+ // constant initial size)
+ void AddGrowableRow( size_t idx, int proportion = 0 );
+ void RemoveGrowableRow( size_t idx );
+ void AddGrowableCol( size_t idx, int proportion = 0 );
+ void RemoveGrowableCol( size_t idx );
+
+ bool IsRowGrowable( size_t idx );
+ bool IsColGrowable( size_t idx );
+
+ // the sizer cells may grow in both directions, not grow at all or only
+ // grow in one direction but not the other
+
+ // the direction may be wxVERTICAL, wxHORIZONTAL or wxBOTH (default)
+ void SetFlexibleDirection(int direction) { m_flexDirection = direction; }
+ int GetFlexibleDirection() const { return m_flexDirection; }
+
+ // note that the grow mode only applies to the direction which is not
+ // flexible
+ void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode) { m_growMode = mode; }
+ wxFlexSizerGrowMode GetNonFlexibleGrowMode() const { return m_growMode; }
+
+ // Read-only access to the row heights and col widths arrays
+ const wxArrayInt& GetRowHeights() const { return m_rowHeights; }
+ const wxArrayInt& GetColWidths() const { return m_colWidths; }
+
+ // implementation
+ virtual void RecalcSizes();
+ virtual wxSize CalcMin();
+
+protected:
+ void AdjustForFlexDirection();
+ void AdjustForGrowables(const wxSize& sz);
+ void FindWidthsAndHeights(int nrows, int ncols);
+
+ // the heights/widths of all rows/columns
+ wxArrayInt m_rowHeights,
+ m_colWidths;
+
+ // indices of the growable columns and rows
+ wxArrayInt m_growableRows,
+ m_growableCols;
+
+ // proportion values of the corresponding growable rows and columns
+ wxArrayInt m_growableRowsProportions,
+ m_growableColsProportions;
+
+ // parameters describing whether the growable cells should be resized in
+ // both directions or only one
+ int m_flexDirection;
+ wxFlexSizerGrowMode m_growMode;
+
+ // saves CalcMin result to optimize RecalcSizes
+ wxSize m_calculatedMinSize;
+
+private:
+ DECLARE_CLASS(wxFlexGridSizer)
+ wxDECLARE_NO_COPY_CLASS(wxFlexGridSizer);
+};
+
+//---------------------------------------------------------------------------
+// wxBoxSizer
+//---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxBoxSizer: public wxSizer
+{
+public:
+ wxBoxSizer(int orient)
+ {
+ m_orient = orient;
+ m_totalProportion = 0;
+
+ wxASSERT_MSG( m_orient == wxHORIZONTAL || m_orient == wxVERTICAL,
+ wxT("invalid value for wxBoxSizer orientation") );
+ }
+
+ virtual wxSizerItem *AddSpacer(int size);
+
+ int GetOrientation() const { return m_orient; }
+
+ bool IsVertical() const { return m_orient == wxVERTICAL; }
+
+ void SetOrientation(int orient) { m_orient = orient; }
+
+ // implementation of our resizing logic
+ virtual wxSize CalcMin();
+ virtual void RecalcSizes();
+
+protected:
+ // helpers for our code: this returns the component of the given wxSize in
+ // the direction of the sizer and in the other direction, respectively
+ int GetSizeInMajorDir(const wxSize& sz) const
+ {
+ return m_orient == wxHORIZONTAL ? sz.x : sz.y;
+ }
+
+ int& SizeInMajorDir(wxSize& sz)
+ {
+ return m_orient == wxHORIZONTAL ? sz.x : sz.y;
+ }
+
+ int& PosInMajorDir(wxPoint& pt)
+ {
+ return m_orient == wxHORIZONTAL ? pt.x : pt.y;
+ }
+
+ int GetSizeInMinorDir(const wxSize& sz) const
+ {
+ return m_orient == wxHORIZONTAL ? sz.y : sz.x;
+ }
+
+ int& SizeInMinorDir(wxSize& sz)
+ {
+ return m_orient == wxHORIZONTAL ? sz.y : sz.x;
+ }
+
+ int& PosInMinorDir(wxPoint& pt)
+ {
+ return m_orient == wxHORIZONTAL ? pt.y : pt.x;
+ }
+
+ // another helper: creates wxSize from major and minor components
+ wxSize SizeFromMajorMinor(int major, int minor) const
+ {
+ if ( m_orient == wxHORIZONTAL )
+ {
+ return wxSize(major, minor);
+ }
+ else // wxVERTICAL
+ {
+ return wxSize(minor, major);
+ }
+ }
+
+
+ // either wxHORIZONTAL or wxVERTICAL
+ int m_orient;
+
+ // the sum of proportion of all of our elements
+ int m_totalProportion;
+
+ // the minimal size needed for this sizer as calculated by the last call to
+ // our CalcMin()
+ wxSize m_minSize;
+
+private:
+ DECLARE_CLASS(wxBoxSizer)
+};
+
+//---------------------------------------------------------------------------
+// wxStaticBoxSizer
+//---------------------------------------------------------------------------
+
+#if wxUSE_STATBOX
+
+class WXDLLIMPEXP_FWD_CORE wxStaticBox;
+
+class WXDLLIMPEXP_CORE wxStaticBoxSizer: public wxBoxSizer
+{
+public:
+ wxStaticBoxSizer(wxStaticBox *box, int orient);
+ wxStaticBoxSizer(int orient, wxWindow *win, const wxString& label = wxEmptyString);
+ virtual ~wxStaticBoxSizer();
+
+ void RecalcSizes();
+ wxSize CalcMin();
+
+ wxStaticBox *GetStaticBox() const
+ { return m_staticBox; }
+
+ // override to hide/show the static box as well
+ virtual void ShowItems (bool show);
+ virtual bool AreAnyItemsShown() const;
+
+ virtual bool Detach( wxWindow *window );
+ virtual bool Detach( wxSizer *sizer ) { return wxBoxSizer::Detach(sizer); }
+ virtual bool Detach( int index ) { return wxBoxSizer::Detach(index); }
+
+protected:
+ wxStaticBox *m_staticBox;
+
+private:
+ DECLARE_CLASS(wxStaticBoxSizer)
+ wxDECLARE_NO_COPY_CLASS(wxStaticBoxSizer);
+};
+
+#endif // wxUSE_STATBOX
+
+//---------------------------------------------------------------------------
+// wxStdDialogButtonSizer
+//---------------------------------------------------------------------------
+
+#if wxUSE_BUTTON
+
+class WXDLLIMPEXP_CORE wxStdDialogButtonSizer: public wxBoxSizer
+{
+public:
+ // Constructor just creates a new wxBoxSizer, not much else.
+ // Box sizer orientation is automatically determined here:
+ // vertical for PDAs, horizontal for everything else?
+ wxStdDialogButtonSizer();
+
+ // Checks button ID against system IDs and sets one of the pointers below
+ // to this button. Does not do any sizer-related things here.
+ void AddButton(wxButton *button);
+
+ // Use these if no standard ID can/should be used
+ void SetAffirmativeButton( wxButton *button );
+ void SetNegativeButton( wxButton *button );
+ void SetCancelButton( wxButton *button );
+
+ // All platform-specific code here, checks which buttons exist and add
+ // them to the sizer accordingly.
+ // Note - one potential hack on Mac we could use here,
+ // if m_buttonAffirmative is wxID_SAVE then ensure wxID_SAVE
+ // is set to _("Save") and m_buttonNegative is set to _("Don't Save")
+ // I wouldn't add any other hacks like that into here,
+ // but this one I can see being useful.
+ void Realize();
+
+ wxButton *GetAffirmativeButton() const { return m_buttonAffirmative; }
+ wxButton *GetApplyButton() const { return m_buttonApply; }
+ wxButton *GetNegativeButton() const { return m_buttonNegative; }
+ wxButton *GetCancelButton() const { return m_buttonCancel; }
+ wxButton *GetHelpButton() const { return m_buttonHelp; }
+
+protected:
+ wxButton *m_buttonAffirmative; // wxID_OK, wxID_YES, wxID_SAVE go here
+ wxButton *m_buttonApply; // wxID_APPLY
+ wxButton *m_buttonNegative; // wxID_NO
+ wxButton *m_buttonCancel; // wxID_CANCEL, wxID_CLOSE
+ wxButton *m_buttonHelp; // wxID_HELP, wxID_CONTEXT_HELP
+
+private:
+ DECLARE_CLASS(wxStdDialogButtonSizer)
+ wxDECLARE_NO_COPY_CLASS(wxStdDialogButtonSizer);
+};
+
+#endif // wxUSE_BUTTON
+
+
+// ----------------------------------------------------------------------------
+// inline functions implementation
+// ----------------------------------------------------------------------------
+
+#if WXWIN_COMPATIBILITY_2_8
+
+inline void wxSizerItem::SetWindow(wxWindow *window)
+{
+ DoSetWindow(window);
+}
+
+inline void wxSizerItem::SetSizer(wxSizer *sizer)
+{
+ DoSetSizer(sizer);
+}
+
+inline void wxSizerItem::SetSpacer(const wxSize& size)
+{
+ DoSetSpacer(size);
+}
+
+inline void wxSizerItem::SetSpacer(int width, int height)
+{
+ DoSetSpacer(wxSize(width, height));
+}
+
+#endif // WXWIN_COMPATIBILITY_2_8
+
+inline wxSizerItem*
+wxSizer::Insert(size_t index, wxSizerItem *item)
+{
+ return DoInsert(index, item);
+}
+
+
+inline wxSizerItem*
+wxSizer::Add( wxSizerItem *item )
+{
+ return Insert( m_children.GetCount(), item );
+}
+
+inline wxSizerItem*
+wxSizer::Add( wxWindow *window, int proportion, int flag, int border, wxObject* userData )
+{
+ return Add( new wxSizerItem( window, proportion, flag, border, userData ) );
+}
+
+inline wxSizerItem*
+wxSizer::Add( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData )
+{
+ return Add( new wxSizerItem( sizer, proportion, flag, border, userData ) );
+}
+
+inline wxSizerItem*
+wxSizer::Add( int width, int height, int proportion, int flag, int border, wxObject* userData )
+{
+ return Add( new wxSizerItem( width, height, proportion, flag, border, userData ) );
+}
+
+inline wxSizerItem*
+wxSizer::Add( wxWindow *window, const wxSizerFlags& flags )
+{
+ return Add( new wxSizerItem(window, flags) );
+}
+
+inline wxSizerItem*
+wxSizer::Add( wxSizer *sizer, const wxSizerFlags& flags )
+{
+ return Add( new wxSizerItem(sizer, flags) );
+}
+
+inline wxSizerItem*
+wxSizer::Add( int width, int height, const wxSizerFlags& flags )
+{
+ return Add( new wxSizerItem(width, height, flags) );
+}
+
+inline wxSizerItem*
+wxSizer::AddSpacer(int size)
+{
+ return Add(size, size);
+}
+
+inline wxSizerItem*
+wxSizer::AddStretchSpacer(int prop)
+{
+ return Add(0, 0, prop);
+}
+
+inline wxSizerItem*
+wxSizer::Prepend( wxSizerItem *item )
+{
+ return Insert( 0, item );
+}
+
+inline wxSizerItem*
+wxSizer::Prepend( wxWindow *window, int proportion, int flag, int border, wxObject* userData )
+{
+ return Prepend( new wxSizerItem( window, proportion, flag, border, userData ) );
+}
+
+inline wxSizerItem*
+wxSizer::Prepend( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData )
+{
+ return Prepend( new wxSizerItem( sizer, proportion, flag, border, userData ) );
+}
+
+inline wxSizerItem*
+wxSizer::Prepend( int width, int height, int proportion, int flag, int border, wxObject* userData )
+{
+ return Prepend( new wxSizerItem( width, height, proportion, flag, border, userData ) );
+}
+
+inline wxSizerItem*
+wxSizer::PrependSpacer(int size)
+{
+ return Prepend(size, size);
+}
+
+inline wxSizerItem*
+wxSizer::PrependStretchSpacer(int prop)
+{
+ return Prepend(0, 0, prop);
+}
+
+inline wxSizerItem*
+wxSizer::Prepend( wxWindow *window, const wxSizerFlags& flags )
+{
+ return Prepend( new wxSizerItem(window, flags) );
+}
+
+inline wxSizerItem*
+wxSizer::Prepend( wxSizer *sizer, const wxSizerFlags& flags )
+{
+ return Prepend( new wxSizerItem(sizer, flags) );
+}
+
+inline wxSizerItem*
+wxSizer::Prepend( int width, int height, const wxSizerFlags& flags )
+{
+ return Prepend( new wxSizerItem(width, height, flags) );
+}
+
+inline wxSizerItem*
+wxSizer::Insert( size_t index,
+ wxWindow *window,
+ int proportion,
+ int flag,
+ int border,
+ wxObject* userData )
+{
+ return Insert( index, new wxSizerItem( window, proportion, flag, border, userData ) );
+}
+
+inline wxSizerItem*
+wxSizer::Insert( size_t index,
+ wxSizer *sizer,
+ int proportion,
+ int flag,
+ int border,
+ wxObject* userData )
+{
+ return Insert( index, new wxSizerItem( sizer, proportion, flag, border, userData ) );
+}
+
+inline wxSizerItem*
+wxSizer::Insert( size_t index,
+ int width,
+ int height,
+ int proportion,
+ int flag,
+ int border,
+ wxObject* userData )
+{
+ return Insert( index, new wxSizerItem( width, height, proportion, flag, border, userData ) );
+}
+
+inline wxSizerItem*
+wxSizer::Insert( size_t index, wxWindow *window, const wxSizerFlags& flags )
+{
+ return Insert( index, new wxSizerItem(window, flags) );
+}
+
+inline wxSizerItem*
+wxSizer::Insert( size_t index, wxSizer *sizer, const wxSizerFlags& flags )
+{
+ return Insert( index, new wxSizerItem(sizer, flags) );
+}
+
+inline wxSizerItem*
+wxSizer::Insert( size_t index, int width, int height, const wxSizerFlags& flags )
+{
+ return Insert( index, new wxSizerItem(width, height, flags) );
+}
+
+inline wxSizerItem*
+wxSizer::InsertSpacer(size_t index, int size)
+{
+ return Insert(index, size, size);
+}
+
+inline wxSizerItem*
+wxSizer::InsertStretchSpacer(size_t index, int prop)
+{
+ return Insert(index, 0, 0, prop);
+}
+
+#endif // __WXSIZER_H__
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/slider.h
+// Purpose: wxSlider interface
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 09.02.01
+// Copyright: (c) 1996-2001 Vadim Zeitlin
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SLIDER_H_BASE_
+#define _WX_SLIDER_H_BASE_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_SLIDER
+
+#include "wx/control.h"
+
+// ----------------------------------------------------------------------------
+// wxSlider flags
+// ----------------------------------------------------------------------------
+
+#define wxSL_HORIZONTAL wxHORIZONTAL /* 0x0004 */
+#define wxSL_VERTICAL wxVERTICAL /* 0x0008 */
+
+#define wxSL_TICKS 0x0010
+#define wxSL_AUTOTICKS wxSL_TICKS // we don't support manual ticks
+#define wxSL_LEFT 0x0040
+#define wxSL_TOP 0x0080
+#define wxSL_RIGHT 0x0100
+#define wxSL_BOTTOM 0x0200
+#define wxSL_BOTH 0x0400
+#define wxSL_SELRANGE 0x0800
+#define wxSL_INVERSE 0x1000
+#define wxSL_MIN_MAX_LABELS 0x2000
+#define wxSL_VALUE_LABEL 0x4000
+#define wxSL_LABELS (wxSL_MIN_MAX_LABELS|wxSL_VALUE_LABEL)
+
+#if WXWIN_COMPATIBILITY_2_6
+ // obsolete
+ #define wxSL_NOTIFY_DRAG 0x0000
+#endif // WXWIN_COMPATIBILITY_2_6
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxSliderNameStr[];
+
+// ----------------------------------------------------------------------------
+// wxSliderBase: define wxSlider interface
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSliderBase : public wxControl
+{
+public:
+ /* the ctor of the derived class should have the following form:
+
+ wxSlider(wxWindow *parent,
+ wxWindowID id,
+ int value, int minValue, int maxValue,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSL_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxSliderNameStr);
+ */
+ wxSliderBase() { }
+
+ // get/set the current slider value (should be in range)
+ virtual int GetValue() const = 0;
+ virtual void SetValue(int value) = 0;
+
+ // retrieve/change the range
+ virtual void SetRange(int minValue, int maxValue) = 0;
+ virtual int GetMin() const = 0;
+ virtual int GetMax() const = 0;
+ void SetMin( int minValue ) { SetRange( minValue , GetMax() ) ; }
+ void SetMax( int maxValue ) { SetRange( GetMin() , maxValue ) ; }
+
+ // the line/page size is the increment by which the slider moves when
+ // cursor arrow key/page up or down are pressed (clicking the mouse is like
+ // pressing PageUp/Down) and are by default set to 1 and 1/10 of the range
+ virtual void SetLineSize(int lineSize) = 0;
+ virtual void SetPageSize(int pageSize) = 0;
+ virtual int GetLineSize() const = 0;
+ virtual int GetPageSize() const = 0;
+
+ // these methods get/set the length of the slider pointer in pixels
+ virtual void SetThumbLength(int lenPixels) = 0;
+ virtual int GetThumbLength() const = 0;
+
+ // warning: most of subsequent methods are currently only implemented in
+ // wxMSW under Win95 and are silently ignored on other platforms
+
+ void SetTickFreq(int freq) { DoSetTickFreq(freq); }
+ virtual int GetTickFreq() const { return 0; }
+ virtual void ClearTicks() { }
+ virtual void SetTick(int WXUNUSED(tickPos)) { }
+
+ virtual void ClearSel() { }
+ virtual int GetSelEnd() const { return GetMin(); }
+ virtual int GetSelStart() const { return GetMax(); }
+ virtual void SetSelection(int WXUNUSED(min), int WXUNUSED(max)) { }
+
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED_INLINE( void SetTickFreq(int freq, int), DoSetTickFreq(freq); )
+#endif
+
+protected:
+ // Platform-specific implementation of SetTickFreq
+ virtual void DoSetTickFreq(int WXUNUSED(freq)) { /* unsupported by default */ }
+
+ // choose the default border for this window
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ // adjust value according to wxSL_INVERSE style
+ virtual int ValueInvertOrNot(int value) const
+ {
+ if (HasFlag(wxSL_INVERSE))
+ return (GetMax() + GetMin()) - value;
+ else
+ return value;
+ }
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxSliderBase);
+};
+
+// ----------------------------------------------------------------------------
+// include the real class declaration
+// ----------------------------------------------------------------------------
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/slider.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/slider.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/slider.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/slider.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/slider.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/slider.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/slider.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/slider.h"
+#endif
+
+#endif // wxUSE_SLIDER
+
+#endif
+ // _WX_SLIDER_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/snglinst.h
+// Purpose: wxSingleInstanceChecker can be used to restrict the number of
+// simultaneously running copies of a program to one
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 08.06.01
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SNGLINST_H_
+#define _WX_SNGLINST_H_
+
+#if wxUSE_SNGLINST_CHECKER
+
+#include "wx/app.h"
+#include "wx/utils.h"
+
+// ----------------------------------------------------------------------------
+// wxSingleInstanceChecker
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxSingleInstanceChecker
+{
+public:
+ // default ctor, use Create() after it
+ wxSingleInstanceChecker() { Init(); }
+
+ // like Create() but no error checking (dangerous!)
+ wxSingleInstanceChecker(const wxString& name,
+ const wxString& path = wxEmptyString)
+ {
+ Init();
+ Create(name, path);
+ }
+
+ // notice that calling Create() is optional now, if you don't do it before
+ // calling IsAnotherRunning(), CreateDefault() is used automatically
+ //
+ // name it is used as the mutex name under Win32 and the lock file name
+ // under Unix so it should be as unique as possible and must be non-empty
+ //
+ // path is optional and is ignored under Win32 and used as the directory to
+ // create the lock file in under Unix (default is wxGetHomeDir())
+ //
+ // returns false if initialization failed, it doesn't mean that another
+ // instance is running - use IsAnotherRunning() to check it
+ bool Create(const wxString& name, const wxString& path = wxEmptyString);
+
+ // use the default name, which is a combination of wxTheApp->GetAppName()
+ // and wxGetUserId() for mutex/lock file
+ //
+ // this is called implicitly by IsAnotherRunning() if the checker hadn't
+ // been created until then
+ bool CreateDefault()
+ {
+ wxCHECK_MSG( wxTheApp, false, "must have application instance" );
+ return Create(wxTheApp->GetAppName() + '-' + wxGetUserId());
+ }
+
+ // is another copy of this program already running?
+ bool IsAnotherRunning() const
+ {
+ if ( !m_impl )
+ {
+ if ( !const_cast<wxSingleInstanceChecker *>(this)->CreateDefault() )
+ {
+ // if creation failed, return false as it's better to not
+ // prevent this instance from starting up if there is an error
+ return false;
+ }
+ }
+
+ return DoIsAnotherRunning();
+ }
+
+ // dtor is not virtual, this class is not meant to be used polymorphically
+ ~wxSingleInstanceChecker();
+
+private:
+ // common part of all ctors
+ void Init() { m_impl = NULL; }
+
+ // do check if another instance is running, called only if m_impl != NULL
+ bool DoIsAnotherRunning() const;
+
+ // the implementation details (platform specific)
+ class WXDLLIMPEXP_FWD_BASE wxSingleInstanceCheckerImpl *m_impl;
+
+ wxDECLARE_NO_COPY_CLASS(wxSingleInstanceChecker);
+};
+
+#endif // wxUSE_SNGLINST_CHECKER
+
+#endif // _WX_SNGLINST_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/socket.h
+// Purpose: Socket handling classes
+// Authors: Guilhem Lavaux, Guillermo Rodriguez Garcia
+// Modified by:
+// Created: April 1997
+// Copyright: (c) Guilhem Lavaux
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SOCKET_H_
+#define _WX_SOCKET_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_SOCKETS
+
+// ---------------------------------------------------------------------------
+// wxSocket headers
+// ---------------------------------------------------------------------------
+
+#include "wx/event.h"
+#include "wx/sckaddr.h"
+#include "wx/list.h"
+
+class wxSocketImpl;
+
+// ------------------------------------------------------------------------
+// Types and constants
+// ------------------------------------------------------------------------
+
+// Define the type of native sockets.
+#if defined(__WINDOWS__)
+ // Although socket descriptors are still 32 bit values, even under Win64,
+ // the socket type is 64 bit there.
+ typedef wxUIntPtr wxSOCKET_T;
+#else
+ typedef int wxSOCKET_T;
+#endif
+
+
+// Types of different socket notifications or events.
+//
+// NB: the values here should be consecutive and start with 0 as they are
+// used to construct the wxSOCKET_XXX_FLAG bit mask values below
+enum wxSocketNotify
+{
+ wxSOCKET_INPUT,
+ wxSOCKET_OUTPUT,
+ wxSOCKET_CONNECTION,
+ wxSOCKET_LOST
+};
+
+enum
+{
+ wxSOCKET_INPUT_FLAG = 1 << wxSOCKET_INPUT,
+ wxSOCKET_OUTPUT_FLAG = 1 << wxSOCKET_OUTPUT,
+ wxSOCKET_CONNECTION_FLAG = 1 << wxSOCKET_CONNECTION,
+ wxSOCKET_LOST_FLAG = 1 << wxSOCKET_LOST
+};
+
+// this is a combination of the bit masks defined above
+typedef int wxSocketEventFlags;
+
+enum wxSocketError
+{
+ wxSOCKET_NOERROR = 0,
+ wxSOCKET_INVOP,
+ wxSOCKET_IOERR,
+ wxSOCKET_INVADDR,
+ wxSOCKET_INVSOCK,
+ wxSOCKET_NOHOST,
+ wxSOCKET_INVPORT,
+ wxSOCKET_WOULDBLOCK,
+ wxSOCKET_TIMEDOUT,
+ wxSOCKET_MEMERR,
+ wxSOCKET_OPTERR
+};
+
+// socket options/flags bit masks
+enum
+{
+ wxSOCKET_NONE = 0x0000,
+ wxSOCKET_NOWAIT_READ = 0x0001,
+ wxSOCKET_NOWAIT_WRITE = 0x0002,
+ wxSOCKET_NOWAIT = wxSOCKET_NOWAIT_READ | wxSOCKET_NOWAIT_WRITE,
+ wxSOCKET_WAITALL_READ = 0x0004,
+ wxSOCKET_WAITALL_WRITE = 0x0008,
+ wxSOCKET_WAITALL = wxSOCKET_WAITALL_READ | wxSOCKET_WAITALL_WRITE,
+ wxSOCKET_BLOCK = 0x0010,
+ wxSOCKET_REUSEADDR = 0x0020,
+ wxSOCKET_BROADCAST = 0x0040,
+ wxSOCKET_NOBIND = 0x0080
+};
+
+typedef int wxSocketFlags;
+
+// socket kind values (badly defined, don't use)
+enum wxSocketType
+{
+ wxSOCKET_UNINIT,
+ wxSOCKET_CLIENT,
+ wxSOCKET_SERVER,
+ wxSOCKET_BASE,
+ wxSOCKET_DATAGRAM
+};
+
+
+// event
+class WXDLLIMPEXP_FWD_NET wxSocketEvent;
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_NET, wxEVT_SOCKET, wxSocketEvent);
+
+// --------------------------------------------------------------------------
+// wxSocketBase
+// --------------------------------------------------------------------------
+
+class WXDLLIMPEXP_NET wxSocketBase : public wxObject
+{
+public:
+ // Public interface
+ // ----------------
+
+ // ctors and dtors
+ wxSocketBase();
+ wxSocketBase(wxSocketFlags flags, wxSocketType type);
+ virtual ~wxSocketBase();
+ void Init();
+ bool Destroy();
+
+ // state
+ bool Ok() const { return IsOk(); }
+ bool IsOk() const { return m_impl != NULL; }
+ bool Error() const { return LastError() != wxSOCKET_NOERROR; }
+ bool IsClosed() const { return m_closed; }
+ bool IsConnected() const { return m_connected; }
+ bool IsData() { return WaitForRead(0, 0); }
+ bool IsDisconnected() const { return !IsConnected(); }
+ wxUint32 LastCount() const { return m_lcount; }
+ wxUint32 LastReadCount() const { return m_lcount_read; }
+ wxUint32 LastWriteCount() const { return m_lcount_write; }
+ wxSocketError LastError() const;
+ void SaveState();
+ void RestoreState();
+
+ // addresses
+ virtual bool GetLocal(wxSockAddress& addr_man) const;
+ virtual bool GetPeer(wxSockAddress& addr_man) const;
+ virtual bool SetLocal(const wxIPV4address& local);
+
+ // base IO
+ virtual bool Close();
+ void ShutdownOutput();
+ wxSocketBase& Discard();
+ wxSocketBase& Peek(void* buffer, wxUint32 nbytes);
+ wxSocketBase& Read(void* buffer, wxUint32 nbytes);
+ wxSocketBase& ReadMsg(void *buffer, wxUint32 nbytes);
+ wxSocketBase& Unread(const void *buffer, wxUint32 nbytes);
+ wxSocketBase& Write(const void *buffer, wxUint32 nbytes);
+ wxSocketBase& WriteMsg(const void *buffer, wxUint32 nbytes);
+
+ // all Wait() functions wait until their condition is satisfied or the
+ // timeout expires; if seconds == -1 (default) then m_timeout value is used
+ //
+ // it is also possible to call InterruptWait() to cancel any current Wait()
+
+ // wait for anything at all to happen with this socket
+ bool Wait(long seconds = -1, long milliseconds = 0);
+
+ // wait until we can read from or write to the socket without blocking
+ // (notice that this does not mean that the operation will succeed but only
+ // that it will return immediately)
+ bool WaitForRead(long seconds = -1, long milliseconds = 0);
+ bool WaitForWrite(long seconds = -1, long milliseconds = 0);
+
+ // wait until the connection is terminated
+ bool WaitForLost(long seconds = -1, long milliseconds = 0);
+
+ void InterruptWait() { m_interrupt = true; }
+
+
+ wxSocketFlags GetFlags() const { return m_flags; }
+ void SetFlags(wxSocketFlags flags);
+ virtual void SetTimeout(long seconds);
+ long GetTimeout() const { return m_timeout; }
+
+ bool GetOption(int level, int optname, void *optval, int *optlen);
+ bool SetOption(int level, int optname, const void *optval, int optlen);
+ wxUint32 GetLastIOSize() const { return m_lcount; }
+ wxUint32 GetLastIOReadSize() const { return m_lcount_read; }
+ wxUint32 GetLastIOWriteSize() const { return m_lcount_write; }
+
+ // event handling
+ void *GetClientData() const { return m_clientData; }
+ void SetClientData(void *data) { m_clientData = data; }
+ void SetEventHandler(wxEvtHandler& handler, int id = wxID_ANY);
+ void SetNotify(wxSocketEventFlags flags);
+ void Notify(bool notify);
+
+ // Get the underlying socket descriptor.
+ wxSOCKET_T GetSocket() const;
+
+ // initialize/shutdown the sockets (done automatically so there is no need
+ // to call these functions usually)
+ //
+ // should always be called from the main thread only so one of the cases
+ // where they should indeed be called explicitly is when the first wxSocket
+ // object in the application is created in a different thread
+ static bool Initialize();
+ static void Shutdown();
+
+ // check if wxSocket had been already initialized
+ //
+ // notice that this function should be only called from the main thread as
+ // otherwise it is inherently unsafe because Initialize/Shutdown() may be
+ // called concurrently with it in the main thread
+ static bool IsInitialized();
+
+ // Implementation from now on
+ // --------------------------
+
+ // do not use, should be private (called from wxSocketImpl only)
+ void OnRequest(wxSocketNotify notify);
+
+ // do not use, not documented nor supported
+ bool IsNoWait() const { return ((m_flags & wxSOCKET_NOWAIT) != 0); }
+ wxSocketType GetType() const { return m_type; }
+
+private:
+ friend class wxSocketClient;
+ friend class wxSocketServer;
+ friend class wxDatagramSocket;
+
+ // low level IO
+ wxUint32 DoRead(void* buffer, wxUint32 nbytes);
+ wxUint32 DoWrite(const void *buffer, wxUint32 nbytes);
+
+ // wait until the given flags are set for this socket or the given timeout
+ // (or m_timeout) expires
+ //
+ // notice that wxSOCKET_LOST_FLAG is always taken into account and the
+ // function returns -1 if the connection was lost; otherwise it returns
+ // true if any of the events specified by flags argument happened or false
+ // if the timeout expired
+ int DoWait(long timeout, wxSocketEventFlags flags);
+
+ // a helper calling DoWait() using the same convention as the public
+ // WaitForXXX() functions use, i.e. use our timeout if seconds == -1 or the
+ // specified timeout otherwise
+ int DoWait(long seconds, long milliseconds, wxSocketEventFlags flags);
+
+ // another helper calling DoWait() using our m_timeout
+ int DoWaitWithTimeout(wxSocketEventFlags flags)
+ {
+ return DoWait(m_timeout*1000, flags);
+ }
+
+ // pushback buffer
+ void Pushback(const void *buffer, wxUint32 size);
+ wxUint32 GetPushback(void *buffer, wxUint32 size, bool peek);
+
+ // store the given error as the LastError()
+ void SetError(wxSocketError error);
+
+private:
+ // socket
+ wxSocketImpl *m_impl; // port-specific implementation
+ wxSocketType m_type; // wxSocket type
+
+ // state
+ wxSocketFlags m_flags; // wxSocket flags
+ bool m_connected; // connected?
+ bool m_establishing; // establishing connection?
+ bool m_reading; // busy reading?
+ bool m_writing; // busy writing?
+ bool m_closed; // was the other end closed?
+ wxUint32 m_lcount; // last IO transaction size
+ wxUint32 m_lcount_read; // last IO transaction size of Read() direction.
+ wxUint32 m_lcount_write; // last IO transaction size of Write() direction.
+ unsigned long m_timeout; // IO timeout value in seconds
+ // (TODO: remove, wxSocketImpl has it too)
+ wxList m_states; // stack of states (TODO: remove!)
+ bool m_interrupt; // interrupt ongoing wait operations?
+ bool m_beingDeleted; // marked for delayed deletion?
+ wxIPV4address m_localAddress; // bind to local address?
+
+ // pushback buffer
+ void *m_unread; // pushback buffer
+ wxUint32 m_unrd_size; // pushback buffer size
+ wxUint32 m_unrd_cur; // pushback pointer (index into buffer)
+
+ // events
+ int m_id; // socket id
+ wxEvtHandler *m_handler; // event handler
+ void *m_clientData; // client data for events
+ bool m_notify; // notify events to users?
+ wxSocketEventFlags m_eventmask; // which events to notify?
+ wxSocketEventFlags m_eventsgot; // collects events received in OnRequest()
+
+
+ friend class wxSocketReadGuard;
+ friend class wxSocketWriteGuard;
+
+ wxDECLARE_NO_COPY_CLASS(wxSocketBase);
+ DECLARE_CLASS(wxSocketBase)
+};
+
+
+// --------------------------------------------------------------------------
+// wxSocketServer
+// --------------------------------------------------------------------------
+
+class WXDLLIMPEXP_NET wxSocketServer : public wxSocketBase
+{
+public:
+ wxSocketServer(const wxSockAddress& addr,
+ wxSocketFlags flags = wxSOCKET_NONE);
+
+ wxSocketBase* Accept(bool wait = true);
+ bool AcceptWith(wxSocketBase& socket, bool wait = true);
+
+ bool WaitForAccept(long seconds = -1, long milliseconds = 0);
+
+ wxDECLARE_NO_COPY_CLASS(wxSocketServer);
+ DECLARE_CLASS(wxSocketServer)
+};
+
+
+// --------------------------------------------------------------------------
+// wxSocketClient
+// --------------------------------------------------------------------------
+
+class WXDLLIMPEXP_NET wxSocketClient : public wxSocketBase
+{
+public:
+ wxSocketClient(wxSocketFlags flags = wxSOCKET_NONE);
+
+ virtual bool Connect(const wxSockAddress& addr, bool wait = true);
+ bool Connect(const wxSockAddress& addr,
+ const wxSockAddress& local,
+ bool wait = true);
+
+ bool WaitOnConnect(long seconds = -1, long milliseconds = 0);
+
+ // Sets initial socket buffer sizes using the SO_SNDBUF and SO_RCVBUF
+ // options before calling connect (either one can be -1 to leave it
+ // unchanged)
+ void SetInitialSocketBuffers(int recv, int send)
+ {
+ m_initialRecvBufferSize = recv;
+ m_initialSendBufferSize = send;
+ }
+
+private:
+ virtual bool DoConnect(const wxSockAddress& addr,
+ const wxSockAddress* local,
+ bool wait = true);
+
+ // buffer sizes, -1 if unset and defaults should be used
+ int m_initialRecvBufferSize;
+ int m_initialSendBufferSize;
+
+ wxDECLARE_NO_COPY_CLASS(wxSocketClient);
+ DECLARE_CLASS(wxSocketClient)
+};
+
+
+// --------------------------------------------------------------------------
+// wxDatagramSocket
+// --------------------------------------------------------------------------
+
+// WARNING: still in alpha stage
+
+class WXDLLIMPEXP_NET wxDatagramSocket : public wxSocketBase
+{
+public:
+ wxDatagramSocket(const wxSockAddress& addr,
+ wxSocketFlags flags = wxSOCKET_NONE);
+
+ wxDatagramSocket& RecvFrom(wxSockAddress& addr,
+ void *buf,
+ wxUint32 nBytes);
+ wxDatagramSocket& SendTo(const wxSockAddress& addr,
+ const void* buf,
+ wxUint32 nBytes);
+
+ /* TODO:
+ bool Connect(wxSockAddress& addr);
+ */
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxDatagramSocket);
+ DECLARE_CLASS(wxDatagramSocket)
+};
+
+
+// --------------------------------------------------------------------------
+// wxSocketEvent
+// --------------------------------------------------------------------------
+
+class WXDLLIMPEXP_NET wxSocketEvent : public wxEvent
+{
+public:
+ wxSocketEvent(int id = 0)
+ : wxEvent(id, wxEVT_SOCKET)
+ {
+ }
+
+ wxSocketNotify GetSocketEvent() const { return m_event; }
+ wxSocketBase *GetSocket() const
+ { return (wxSocketBase *) GetEventObject(); }
+ void *GetClientData() const { return m_clientData; }
+
+ virtual wxEvent *Clone() const { return new wxSocketEvent(*this); }
+ virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_SOCKET; }
+
+public:
+ wxSocketNotify m_event;
+ void *m_clientData;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSocketEvent)
+};
+
+
+typedef void (wxEvtHandler::*wxSocketEventFunction)(wxSocketEvent&);
+
+#define wxSocketEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxSocketEventFunction, func)
+
+#define EVT_SOCKET(id, func) \
+ wx__DECLARE_EVT1(wxEVT_SOCKET, id, wxSocketEventHandler(func))
+
+#endif // wxUSE_SOCKETS
+
+#endif // _WX_SOCKET_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/sound.h
+// Purpose: wxSoundBase class
+// Author: Vaclav Slavik
+// Modified by:
+// Created: 2004/02/01
+// Copyright: (c) 2004, Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SOUND_H_BASE_
+#define _WX_SOUND_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_SOUND
+
+#include "wx/object.h"
+
+// ----------------------------------------------------------------------------
+// wxSoundBase: common wxSound code and interface
+// ----------------------------------------------------------------------------
+
+// Flags for wxSound::Play
+
+// NB: We can't use enum with some compilers, because they keep reporting
+// nonexistent ambiguities between Play(unsigned) and static Play(const
+// wxString&, unsigned).
+#define wxSOUND_SYNC ((unsigned)0)
+#define wxSOUND_ASYNC ((unsigned)1)
+#define wxSOUND_LOOP ((unsigned)2)
+
+// Base class for wxSound implementations
+class WXDLLIMPEXP_ADV wxSoundBase : public wxObject
+{
+public:
+ // Play the sound:
+ bool Play(unsigned flags = wxSOUND_ASYNC) const
+ {
+ wxASSERT_MSG( (flags & wxSOUND_LOOP) == 0 ||
+ (flags & wxSOUND_ASYNC) != 0,
+ wxT("sound can only be looped asynchronously") );
+ return DoPlay(flags);
+ }
+
+ // Plays sound from filename:
+ static bool Play(const wxString& filename, unsigned flags = wxSOUND_ASYNC);
+
+protected:
+ virtual bool DoPlay(unsigned flags) const = 0;
+};
+
+// ----------------------------------------------------------------------------
+// wxSound class implementation
+// ----------------------------------------------------------------------------
+
+#if defined(__WINDOWS__)
+ #include "wx/msw/sound.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/sound.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/sound.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/sound.h"
+#elif defined(__UNIX__)
+ #include "wx/unix/sound.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// wxSoundBase methods
+// ----------------------------------------------------------------------------
+
+inline bool wxSoundBase::Play(const wxString& filename, unsigned flags)
+{
+ wxSound snd(filename);
+ return snd.IsOk() ? snd.Play(flags) : false;
+}
+
+#endif // wxUSE_SOUND
+
+#endif // _WX_SOUND_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/spinbutt.h
+// Purpose: wxSpinButtonBase class
+// Author: Julian Smart, Vadim Zeitlin
+// Modified by:
+// Created: 23.07.99
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SPINBUTT_H_BASE_
+#define _WX_SPINBUTT_H_BASE_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_SPINBTN
+
+#include "wx/control.h"
+#include "wx/event.h"
+#include "wx/range.h"
+
+#define wxSPIN_BUTTON_NAME wxT("wxSpinButton")
+
+// ----------------------------------------------------------------------------
+// The wxSpinButton is like a small scrollbar than is often placed next
+// to a text control.
+//
+// Styles:
+// wxSP_HORIZONTAL: horizontal spin button
+// wxSP_VERTICAL: vertical spin button (the default)
+// wxSP_ARROW_KEYS: arrow keys increment/decrement value
+// wxSP_WRAP: value wraps at either end
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSpinButtonBase : public wxControl
+{
+public:
+ // ctor initializes the range with the default (0..100) values
+ wxSpinButtonBase() { m_min = 0; m_max = 100; }
+
+ // accessors
+ virtual int GetValue() const = 0;
+ virtual int GetMin() const { return m_min; }
+ virtual int GetMax() const { return m_max; }
+ wxRange GetRange() const { return wxRange( GetMin(), GetMax() );}
+
+ // operations
+ virtual void SetValue(int val) = 0;
+ virtual void SetMin(int minVal) { SetRange ( minVal , m_max ) ; }
+ virtual void SetMax(int maxVal) { SetRange ( m_min , maxVal ) ; }
+ virtual void SetRange(int minVal, int maxVal)
+ {
+ m_min = minVal;
+ m_max = maxVal;
+ }
+ void SetRange( const wxRange& range) { SetRange( range.GetMin(), range.GetMax()); }
+
+ // is this spin button vertically oriented?
+ bool IsVertical() const { return (m_windowStyle & wxSP_VERTICAL) != 0; }
+
+protected:
+ // the range value
+ int m_min;
+ int m_max;
+
+ wxDECLARE_NO_COPY_CLASS(wxSpinButtonBase);
+};
+
+// ----------------------------------------------------------------------------
+// include the declaration of the real class
+// ----------------------------------------------------------------------------
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/spinbutt.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/spinbutt.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/spinbutt.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/spinbutt.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/spinbutt.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/spinbutt.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/spinbutt.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/spinbutt.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// the wxSpinButton event
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSpinEvent : public wxNotifyEvent
+{
+public:
+ wxSpinEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
+ : wxNotifyEvent(commandType, winid)
+ {
+ }
+
+ wxSpinEvent(const wxSpinEvent& event) : wxNotifyEvent(event) {}
+
+ // get the current value of the control
+ int GetValue() const { return m_commandInt; }
+ void SetValue(int value) { m_commandInt = value; }
+
+ int GetPosition() const { return m_commandInt; }
+ void SetPosition(int pos) { m_commandInt = pos; }
+
+ virtual wxEvent *Clone() const { return new wxSpinEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSpinEvent)
+};
+
+typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
+
+#define wxSpinEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxSpinEventFunction, func)
+
+// macros for handling spin events: notice that we must use the real values of
+// the event type constants and not their references (wxEVT_SPIN[_UP/DOWN])
+// here as otherwise the event tables could end up with non-initialized
+// (because of undefined initialization order of the globals defined in
+// different translation units) references in them
+#define EVT_SPIN_UP(winid, func) \
+ wx__DECLARE_EVT1(wxEVT_SPIN_UP, winid, wxSpinEventHandler(func))
+#define EVT_SPIN_DOWN(winid, func) \
+ wx__DECLARE_EVT1(wxEVT_SPIN_DOWN, winid, wxSpinEventHandler(func))
+#define EVT_SPIN(winid, func) \
+ wx__DECLARE_EVT1(wxEVT_SPIN, winid, wxSpinEventHandler(func))
+
+#endif // wxUSE_SPINBTN
+
+#endif
+ // _WX_SPINBUTT_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/spinctrl.h
+// Purpose: wxSpinCtrlBase class
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 22.07.99
+// Copyright: (c) Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SPINCTRL_H_
+#define _WX_SPINCTRL_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_SPINCTRL
+
+#include "wx/spinbutt.h" // should make wxSpinEvent visible to the app
+
+// Events
+class WXDLLIMPEXP_FWD_CORE wxSpinDoubleEvent;
+
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SPINCTRL, wxSpinEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SPINCTRLDOUBLE, wxSpinDoubleEvent);
+
+// ----------------------------------------------------------------------------
+// A spin ctrl is a text control with a spin button which is usually used to
+// prompt the user for a numeric input.
+// There are two kinds for number types T=integer or T=double.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSpinCtrlBase : public wxControl
+{
+public:
+ wxSpinCtrlBase() {}
+
+ // accessor functions that derived classes are expected to have
+ // T GetValue() const
+ // T GetMin() const
+ // T GetMax() const
+ // T GetIncrement() const
+ virtual bool GetSnapToTicks() const = 0;
+ // unsigned GetDigits() const - wxSpinCtrlDouble only
+
+ // operation functions that derived classes are expected to have
+ virtual void SetValue(const wxString& value) = 0;
+ // void SetValue(T val)
+ // void SetRange(T minVal, T maxVal)
+ // void SetIncrement(T inc)
+ virtual void SetSnapToTicks(bool snap_to_ticks) = 0;
+ // void SetDigits(unsigned digits) - wxSpinCtrlDouble only
+
+ // The base for numbers display, e.g. 10 or 16.
+ virtual int GetBase() const = 0;
+ virtual bool SetBase(int base) = 0;
+
+ // Select text in the textctrl
+ virtual void SetSelection(long from, long to) = 0;
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxSpinCtrlBase);
+};
+
+// ----------------------------------------------------------------------------
+// wxSpinDoubleEvent - a wxSpinEvent for double valued controls
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSpinDoubleEvent : public wxNotifyEvent
+{
+public:
+ wxSpinDoubleEvent(wxEventType commandType = wxEVT_NULL, int winid = 0,
+ double value = 0)
+ : wxNotifyEvent(commandType, winid), m_value(value)
+ {
+ }
+
+ wxSpinDoubleEvent(const wxSpinDoubleEvent& event)
+ : wxNotifyEvent(event), m_value(event.GetValue())
+ {
+ }
+
+ double GetValue() const { return m_value; }
+ void SetValue(double value) { m_value = value; }
+
+ virtual wxEvent *Clone() const { return new wxSpinDoubleEvent(*this); }
+
+protected:
+ double m_value;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSpinDoubleEvent)
+};
+
+// ----------------------------------------------------------------------------
+// wxSpinDoubleEvent event type, see also wxSpinEvent in wx/spinbutt.h
+// ----------------------------------------------------------------------------
+
+typedef void (wxEvtHandler::*wxSpinDoubleEventFunction)(wxSpinDoubleEvent&);
+
+#define wxSpinDoubleEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxSpinDoubleEventFunction, func)
+
+// macros for handling spinctrl events
+
+#define EVT_SPINCTRL(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_SPINCTRL, id, wxSpinEventHandler(fn))
+
+#define EVT_SPINCTRLDOUBLE(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_SPINCTRLDOUBLE, id, wxSpinDoubleEventHandler(fn))
+
+// ----------------------------------------------------------------------------
+// include the platform-dependent class implementation
+// ----------------------------------------------------------------------------
+
+// we may have a native wxSpinCtrl implementation, native wxSpinCtrl and
+// wxSpinCtrlDouble implementations or neither, define the appropriate symbols
+// and include the generic version if necessary to provide the missing class(es)
+
+#if defined(__WXUNIVERSAL__)
+ // nothing, use generic controls
+#elif defined(__WXMSW__)
+ #define wxHAS_NATIVE_SPINCTRL
+ #include "wx/msw/spinctrl.h"
+#elif defined(__WXPM__)
+ #define wxHAS_NATIVE_SPINCTRL
+ #include "wx/os2/spinctrl.h"
+#elif defined(__WXGTK20__)
+ #define wxHAS_NATIVE_SPINCTRL
+ #define wxHAS_NATIVE_SPINCTRLDOUBLE
+ #include "wx/gtk/spinctrl.h"
+#elif defined(__WXGTK__)
+ #define wxHAS_NATIVE_SPINCTRL
+ #include "wx/gtk1/spinctrl.h"
+#endif // platform
+
+#if !defined(wxHAS_NATIVE_SPINCTRL) || !defined(wxHAS_NATIVE_SPINCTRLDOUBLE)
+ #include "wx/generic/spinctlg.h"
+#endif
+
+namespace wxPrivate
+{
+
+// This is an internal helper function currently used by all ports: return the
+// string containing hexadecimal representation of the given number.
+extern wxString wxSpinCtrlFormatAsHex(long val, long maxVal);
+
+} // namespace wxPrivate
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_SPINCTRL_UPDATED wxEVT_SPINCTRL
+#define wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED wxEVT_SPINCTRLDOUBLE
+
+#endif // wxUSE_SPINCTRL
+
+#endif // _WX_SPINCTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/splash.h
+// Purpose: Base header for wxSplashScreen
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SPLASH_H_BASE_
+#define _WX_SPLASH_H_BASE_
+
+#include "wx/generic/splash.h"
+
+#endif
+ // _WX_SPLASH_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/splitter.h
+// Purpose: Base header for wxSplitterWindow
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SPLITTER_H_BASE_
+#define _WX_SPLITTER_H_BASE_
+
+#include "wx/event.h"
+
+// ----------------------------------------------------------------------------
+// wxSplitterWindow flags
+// ----------------------------------------------------------------------------
+
+#define wxSP_NOBORDER 0x0000
+#define wxSP_THIN_SASH 0x0000 // NB: the default is 3D sash
+#define wxSP_NOSASH 0x0010
+#define wxSP_PERMIT_UNSPLIT 0x0040
+#define wxSP_LIVE_UPDATE 0x0080
+#define wxSP_3DSASH 0x0100
+#define wxSP_3DBORDER 0x0200
+#define wxSP_NO_XP_THEME 0x0400
+#define wxSP_BORDER wxSP_3DBORDER
+#define wxSP_3D (wxSP_3DBORDER | wxSP_3DSASH)
+
+#if WXWIN_COMPATIBILITY_2_6
+ // obsolete styles, don't do anything
+ #define wxSP_SASH_AQUA 0
+ #define wxSP_FULLSASH 0
+#endif // WXWIN_COMPATIBILITY_2_6
+
+class WXDLLIMPEXP_FWD_CORE wxSplitterEvent;
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_SPLITTER_SASH_POS_CHANGED, wxSplitterEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_SPLITTER_SASH_POS_CHANGING, wxSplitterEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_SPLITTER_DOUBLECLICKED, wxSplitterEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_SPLITTER_UNSPLIT, wxSplitterEvent );
+
+#include "wx/generic/splitter.h"
+
+#endif // _WX_SPLITTER_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/srchctrl.h
+// Purpose: wxSearchCtrlBase class
+// Author: Vince Harron
+// Created: 2006-02-18
+// Copyright: (c) Vince Harron
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SEARCHCTRL_H_BASE_
+#define _WX_SEARCHCTRL_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_SEARCHCTRL
+
+#include "wx/textctrl.h"
+
+#if !defined(__WXUNIVERSAL__) && defined(__WXMAC__)
+ // search control was introduced in Mac OS X 10.3 Panther
+ #define wxUSE_NATIVE_SEARCH_CONTROL 1
+
+ #define wxSearchCtrlBaseBaseClass wxTextCtrl
+#else
+ // no native version, use the generic one
+ #define wxUSE_NATIVE_SEARCH_CONTROL 0
+
+ #include "wx/compositewin.h"
+ #include "wx/containr.h"
+
+ class WXDLLIMPEXP_CORE wxSearchCtrlBaseBaseClass
+ : public wxCompositeWindow< wxNavigationEnabled<wxControl> >,
+ public wxTextCtrlIface
+ {
+ };
+#endif
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxSearchCtrlNameStr[];
+
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SEARCHCTRL_CANCEL_BTN, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SEARCHCTRL_SEARCH_BTN, wxCommandEvent);
+
+// ----------------------------------------------------------------------------
+// a search ctrl is a text control with a search button and a cancel button
+// it is based on the MacOSX 10.3 control HISearchFieldCreate
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxSearchCtrlBase : public wxSearchCtrlBaseBaseClass
+{
+public:
+ wxSearchCtrlBase() { }
+ virtual ~wxSearchCtrlBase() { }
+
+ // search control
+#if wxUSE_MENUS
+ virtual void SetMenu(wxMenu *menu) = 0;
+ virtual wxMenu *GetMenu() = 0;
+#endif // wxUSE_MENUS
+
+ // get/set options
+ virtual void ShowSearchButton( bool show ) = 0;
+ virtual bool IsSearchButtonVisible() const = 0;
+
+ virtual void ShowCancelButton( bool show ) = 0;
+ virtual bool IsCancelButtonVisible() const = 0;
+
+private:
+ // implement wxTextEntry pure virtual method
+ virtual wxWindow *GetEditableWindow() { return this; }
+};
+
+
+// include the platform-dependent class implementation
+#if wxUSE_NATIVE_SEARCH_CONTROL
+ #if defined(__WXMAC__)
+ #include "wx/osx/srchctrl.h"
+ #endif
+#else
+ #include "wx/generic/srchctlg.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// macros for handling search events
+// ----------------------------------------------------------------------------
+
+#define EVT_SEARCHCTRL_CANCEL_BTN(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_SEARCHCTRL_CANCEL_BTN, id, wxCommandEventHandler(fn))
+
+#define EVT_SEARCHCTRL_SEARCH_BTN(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_SEARCHCTRL_SEARCH_BTN, id, wxCommandEventHandler(fn))
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN wxEVT_SEARCHCTRL_CANCEL_BTN
+#define wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN wxEVT_SEARCHCTRL_SEARCH_BTN
+
+#endif // wxUSE_SEARCHCTRL
+
+#endif // _WX_SEARCHCTRL_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/sstream.h
+// Purpose: string-based streams
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 2004-09-19
+// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SSTREAM_H_
+#define _WX_SSTREAM_H_
+
+#include "wx/stream.h"
+
+#if wxUSE_STREAMS
+
+// ----------------------------------------------------------------------------
+// wxStringInputStream is a stream reading from the given (fixed size) string
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxStringInputStream : public wxInputStream
+{
+public:
+ // ctor associates the stream with the given string which makes a copy of
+ // it
+ wxStringInputStream(const wxString& s);
+
+ virtual wxFileOffset GetLength() const;
+ virtual bool IsSeekable() const { return true; }
+
+protected:
+ virtual wxFileOffset OnSysSeek(wxFileOffset ofs, wxSeekMode mode);
+ virtual wxFileOffset OnSysTell() const;
+ virtual size_t OnSysRead(void *buffer, size_t size);
+
+private:
+ // the string that was passed in the ctor
+ wxString m_str;
+
+ // the buffer we're reading from
+ wxCharBuffer m_buf;
+
+ // length of the buffer we're reading from
+ size_t m_len;
+
+ // position in the stream in bytes, *not* in chars
+ size_t m_pos;
+
+ wxDECLARE_NO_COPY_CLASS(wxStringInputStream);
+};
+
+// ----------------------------------------------------------------------------
+// wxStringOutputStream writes data to the given string, expanding it as needed
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxStringOutputStream : public wxOutputStream
+{
+public:
+ // The stream will write data either to the provided string or to an
+ // internal string which can be retrieved using GetString()
+ //
+ // Note that the conversion object should have the life time greater than
+ // this stream.
+ wxStringOutputStream(wxString *pString = NULL,
+ wxMBConv& conv = wxConvUTF8)
+ : m_conv(conv)
+#if wxUSE_UNICODE
+ , m_unconv(0)
+#endif // wxUSE_UNICODE
+ {
+ m_str = pString ? pString : &m_strInternal;
+ m_pos = m_str->length() / sizeof(wxChar);
+ }
+
+ // get the string containing current output
+ const wxString& GetString() const { return *m_str; }
+
+ virtual bool IsSeekable() const { return true; }
+
+protected:
+ virtual wxFileOffset OnSysTell() const;
+ virtual size_t OnSysWrite(const void *buffer, size_t size);
+
+private:
+ // internal string, not used if caller provided his own string
+ wxString m_strInternal;
+
+ // pointer given by the caller or just pointer to m_strInternal
+ wxString *m_str;
+
+ // position in the stream in bytes, *not* in chars
+ size_t m_pos;
+
+ // converter to use: notice that with the default UTF-8 one the input
+ // stream must contain valid UTF-8 data, use wxConvISO8859_1 to work with
+ // arbitrary 8 bit data
+ wxMBConv& m_conv;
+
+#if wxUSE_UNICODE
+ // unconverted data from the last call to OnSysWrite()
+ wxMemoryBuffer m_unconv;
+#endif // wxUSE_UNICODE
+
+ wxDECLARE_NO_COPY_CLASS(wxStringOutputStream);
+};
+
+#endif // wxUSE_STREAMS
+
+#endif // _WX_SSTREAM_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/stack.h
+// Purpose: STL stack clone
+// Author: Lindsay Mathieson, Vadim Zeitlin
+// Created: 30.07.2001
+// Copyright: (c) 2001 Lindsay Mathieson <lindsay@mathieson.org> (WX_DECLARE_STACK)
+// 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_STACK_H_
+#define _WX_STACK_H_
+
+#include "wx/vector.h"
+
+#if wxUSE_STD_CONTAINERS
+
+#include <stack>
+#define wxStack std::stack
+
+#else // !wxUSE_STD_CONTAINERS
+
+// Notice that unlike std::stack, wxStack currently always uses wxVector and
+// can't be used with any other underlying container type.
+//
+// Another difference is that comparison operators between stacks are not
+// implemented (but they should be, see 23.2.3.3 of ISO/IEC 14882:1998).
+
+template <typename T>
+class wxStack
+{
+public:
+ typedef wxVector<T> container_type;
+ typedef typename container_type::size_type size_type;
+ typedef typename container_type::value_type value_type;
+
+ wxStack() { }
+ explicit wxStack(const container_type& cont) : m_cont(cont) { }
+
+ // Default copy ctor, assignment operator and dtor are ok.
+
+
+ bool empty() const { return m_cont.empty(); }
+ size_type size() const { return m_cont.size(); }
+
+ value_type& top() { return m_cont.back(); }
+ const value_type& top() const { return m_cont.back(); }
+
+ void push(const value_type& val) { m_cont.push_back(val); }
+ void pop() { m_cont.pop_back(); }
+
+private:
+ container_type m_cont;
+};
+
+#endif // wxUSE_STD_CONTAINERS/!wxUSE_STD_CONTAINERS
+
+
+// Deprecated macro-based class for compatibility only, don't use any more.
+#define WX_DECLARE_STACK(obj, cls) \
+class cls : public wxVector<obj> \
+{\
+public:\
+ void push(const obj& o)\
+ {\
+ push_back(o); \
+ };\
+\
+ void pop()\
+ {\
+ pop_back(); \
+ };\
+\
+ obj& top()\
+ {\
+ return at(size() - 1);\
+ };\
+ const obj& top() const\
+ {\
+ return at(size() - 1); \
+ };\
+}
+
+#endif // _WX_STACK_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/stackwalk.h
+// Purpose: wxStackWalker and related classes, common part
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 2005-01-07
+// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_STACKWALK_H_
+#define _WX_STACKWALK_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_STACKWALKER
+
+class WXDLLIMPEXP_FWD_BASE wxStackFrame;
+
+#define wxSTACKWALKER_MAX_DEPTH (200)
+
+// ----------------------------------------------------------------------------
+// wxStackFrame: a single stack level
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxStackFrameBase
+{
+private:
+ // put this inline function here so that it is defined before use
+ wxStackFrameBase *ConstCast() const
+ { return const_cast<wxStackFrameBase *>(this); }
+
+public:
+ wxStackFrameBase(size_t level, void *address = NULL)
+ {
+ m_level = level;
+
+ m_line =
+ m_offset = 0;
+
+ m_address = address;
+ }
+
+ // get the level of this frame (deepest/innermost one is 0)
+ size_t GetLevel() const { return m_level; }
+
+ // return the address of this frame
+ void *GetAddress() const { return m_address; }
+
+
+ // return the unmangled (if possible) name of the function containing this
+ // frame
+ wxString GetName() const { ConstCast()->OnGetName(); return m_name; }
+
+ // return the instruction pointer offset from the start of the function
+ size_t GetOffset() const { ConstCast()->OnGetName(); return m_offset; }
+
+ // get the module this function belongs to (not always available)
+ wxString GetModule() const { ConstCast()->OnGetName(); return m_module; }
+
+
+ // return true if we have the filename and line number for this frame
+ bool HasSourceLocation() const { return !GetFileName().empty(); }
+
+ // return the name of the file containing this frame, empty if
+ // unavailable (typically because debug info is missing)
+ wxString GetFileName() const
+ { ConstCast()->OnGetLocation(); return m_filename; }
+
+ // return the line number of this frame, 0 if unavailable
+ size_t GetLine() const { ConstCast()->OnGetLocation(); return m_line; }
+
+
+ // return the number of parameters of this function (may return 0 if we
+ // can't retrieve the parameters info even although the function does have
+ // parameters)
+ virtual size_t GetParamCount() const { return 0; }
+
+ // get the name, type and value (in text form) of the given parameter
+ //
+ // any pointer may be NULL
+ //
+ // return true if at least some values could be retrieved
+ virtual bool GetParam(size_t WXUNUSED(n),
+ wxString * WXUNUSED(type),
+ wxString * WXUNUSED(name),
+ wxString * WXUNUSED(value)) const
+ {
+ return false;
+ }
+
+
+ // although this class is not supposed to be used polymorphically, give it
+ // a virtual dtor to silence compiler warnings
+ virtual ~wxStackFrameBase() { }
+
+protected:
+ // hooks for derived classes to initialize some fields on demand
+ virtual void OnGetName() { }
+ virtual void OnGetLocation() { }
+
+
+ // fields are protected, not private, so that OnGetXXX() could modify them
+ // directly
+ size_t m_level;
+
+ wxString m_name,
+ m_module,
+ m_filename;
+
+ size_t m_line;
+
+ void *m_address;
+ size_t m_offset;
+};
+
+// ----------------------------------------------------------------------------
+// wxStackWalker: class for enumerating stack frames
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxStackWalkerBase
+{
+public:
+ // ctor does nothing, use Walk() to walk the stack
+ wxStackWalkerBase() { }
+
+ // dtor does nothing neither but should be virtual
+ virtual ~wxStackWalkerBase() { }
+
+ // enumerate stack frames from the current location, skipping the initial
+ // number of them (this can be useful when Walk() is called from some known
+ // location and you don't want to see the first few frames anyhow; also
+ // notice that Walk() frame itself is not included if skip >= 1)
+ virtual void Walk(size_t skip = 1, size_t maxDepth = wxSTACKWALKER_MAX_DEPTH) = 0;
+
+#if wxUSE_ON_FATAL_EXCEPTION
+ // enumerate stack frames from the location of uncaught exception
+ //
+ // this version can only be called from wxApp::OnFatalException()
+ virtual void WalkFromException(size_t maxDepth = wxSTACKWALKER_MAX_DEPTH) = 0;
+#endif // wxUSE_ON_FATAL_EXCEPTION
+
+protected:
+ // this function must be overrided to process the given frame
+ virtual void OnStackFrame(const wxStackFrame& frame) = 0;
+};
+
+#ifdef __WINDOWS__
+ #include "wx/msw/stackwalk.h"
+#elif defined(__UNIX__)
+ #include "wx/unix/stackwalk.h"
+#else
+ #error "wxStackWalker is not supported, set wxUSE_STACKWALKER to 0"
+#endif
+
+#endif // wxUSE_STACKWALKER
+
+#endif // _WX_STACKWALK_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/statbmp.h
+// Purpose: wxStaticBitmap class interface
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 25.08.00
+// Copyright: (c) 2000 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_STATBMP_H_BASE_
+#define _WX_STATBMP_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_STATBMP
+
+#include "wx/control.h"
+#include "wx/bitmap.h"
+#include "wx/icon.h"
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticBitmapNameStr[];
+
+// a control showing an icon or a bitmap
+class WXDLLIMPEXP_CORE wxStaticBitmapBase : public wxControl
+{
+public:
+ wxStaticBitmapBase() { }
+ virtual ~wxStaticBitmapBase();
+
+ // our interface
+ virtual void SetIcon(const wxIcon& icon) = 0;
+ virtual void SetBitmap(const wxBitmap& bitmap) = 0;
+ virtual wxBitmap GetBitmap() const = 0;
+ virtual wxIcon GetIcon() const /* = 0 -- should be pure virtual */
+ {
+ // stub it out here for now as not all ports implement it (but they
+ // should)
+ return wxIcon();
+ }
+
+ // overridden base class virtuals
+ virtual bool AcceptsFocus() const { return false; }
+ virtual bool HasTransparentBackground() { return true; }
+
+protected:
+ // choose the default border for this window
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ virtual wxSize DoGetBestSize() const;
+
+ wxDECLARE_NO_COPY_CLASS(wxStaticBitmapBase);
+};
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/statbmp.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/statbmp.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/statbmp.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/statbmp.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/statbmp.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/statbmp.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/statbmp.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/statbmp.h"
+#endif
+
+#endif // wxUSE_STATBMP
+
+#endif
+ // _WX_STATBMP_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/statbox.h
+// Purpose: wxStaticBox base header
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_STATBOX_H_BASE_
+#define _WX_STATBOX_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_STATBOX
+
+#include "wx/control.h"
+#include "wx/containr.h"
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticBoxNameStr[];
+
+// ----------------------------------------------------------------------------
+// wxStaticBox: a grouping box with a label
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxStaticBoxBase : public wxNavigationEnabled<wxControl>
+{
+public:
+ wxStaticBoxBase();
+
+ // overridden base class virtuals
+ virtual bool HasTransparentBackground() { return true; }
+
+ // implementation only: this is used by wxStaticBoxSizer to account for the
+ // need for extra space taken by the static box
+ //
+ // the top border is the margin at the top (where the title is),
+ // borderOther is the margin on all other sides
+ virtual void GetBordersForSizer(int *borderTop, int *borderOther) const
+ {
+ const int BORDER = 5; // FIXME: hardcoded value
+
+ *borderTop = GetLabel().empty() ? BORDER : GetCharHeight();
+ *borderOther = BORDER;
+ }
+
+protected:
+ // choose the default border for this window
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ wxDECLARE_NO_COPY_CLASS(wxStaticBoxBase);
+};
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/statbox.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/statbox.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/statbox.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/statbox.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/statbox.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/statbox.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/statbox.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/statbox.h"
+#endif
+
+#endif // wxUSE_STATBOX
+
+#endif
+ // _WX_STATBOX_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/statline.h
+// Purpose: wxStaticLine class interface
+// Author: Vadim Zeitlin
+// Created: 28.06.99
+// Copyright: (c) 1999 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_STATLINE_H_BASE_
+#define _WX_STATLINE_H_BASE_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// this defines wxUSE_STATLINE
+#include "wx/defs.h"
+
+#if wxUSE_STATLINE
+
+// the base class declaration
+#include "wx/control.h"
+
+// ----------------------------------------------------------------------------
+// global variables
+// ----------------------------------------------------------------------------
+
+// the default name for objects of class wxStaticLine
+extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticLineNameStr[];
+
+// ----------------------------------------------------------------------------
+// wxStaticLine - a line in a dialog
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxStaticLineBase : public wxControl
+{
+public:
+ // constructor
+ wxStaticLineBase() { }
+
+ // is the line vertical?
+ bool IsVertical() const { return (GetWindowStyle() & wxLI_VERTICAL) != 0; }
+
+ // get the default size for the "lesser" dimension of the static line
+ static int GetDefaultSize() { return 2; }
+
+ // overridden base class virtuals
+ virtual bool AcceptsFocus() const { return false; }
+
+protected:
+ // choose the default border for this window
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ // set the right size for the right dimension
+ wxSize AdjustSize(const wxSize& size) const
+ {
+ wxSize sizeReal(size);
+ if ( IsVertical() )
+ {
+ if ( size.x == wxDefaultCoord )
+ sizeReal.x = GetDefaultSize();
+ }
+ else
+ {
+ if ( size.y == wxDefaultCoord )
+ sizeReal.y = GetDefaultSize();
+ }
+
+ return sizeReal;
+ }
+
+ virtual wxSize DoGetBestSize() const
+ {
+ return AdjustSize(wxDefaultSize);
+ }
+
+ wxDECLARE_NO_COPY_CLASS(wxStaticLineBase);
+};
+
+// ----------------------------------------------------------------------------
+// now include the actual class declaration
+// ----------------------------------------------------------------------------
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/statline.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/statline.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/statline.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/statline.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/statline.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/statline.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/statline.h"
+#else // use generic implementation for all other platforms
+ #include "wx/generic/statline.h"
+#endif
+
+#endif // wxUSE_STATLINE
+
+#endif // _WX_STATLINE_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/stattext.h
+// Purpose: wxStaticText base header
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_STATTEXT_H_BASE_
+#define _WX_STATTEXT_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_STATTEXT
+
+#include "wx/control.h"
+
+/*
+ * wxStaticText flags
+ */
+#define wxST_NO_AUTORESIZE 0x0001
+// free 0x0002 bit
+#define wxST_ELLIPSIZE_START 0x0004
+#define wxST_ELLIPSIZE_MIDDLE 0x0008
+#define wxST_ELLIPSIZE_END 0x0010
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticTextNameStr[];
+
+class WXDLLIMPEXP_CORE wxStaticTextBase : public wxControl
+{
+public:
+ wxStaticTextBase() { }
+
+ // wrap the text of the control so that no line is longer than the given
+ // width (if possible: this function won't break words)
+ // This function will modify the value returned by GetLabel()!
+ void Wrap(int width);
+
+ // overridden base virtuals
+ virtual bool AcceptsFocus() const { return false; }
+ virtual bool HasTransparentBackground() { return true; }
+
+ bool IsEllipsized() const
+ {
+ return HasFlag(wxST_ELLIPSIZE_START) ||
+ HasFlag(wxST_ELLIPSIZE_MIDDLE) ||
+ HasFlag(wxST_ELLIPSIZE_END);
+ }
+
+protected: // functions required for wxST_ELLIPSIZE_* support
+
+ // choose the default border for this window
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ // Calls Ellipsize() on the real label if necessary. Unlike GetLabelText(),
+ // keeps the mnemonics instead of removing them.
+ virtual wxString GetEllipsizedLabel() const;
+
+ // Replaces parts of the string with ellipsis according to the ellipsize
+ // style. Shouldn't be called if we don't have any.
+ wxString Ellipsize(const wxString& label) const;
+
+ // to be called when updating the size of the static text:
+ // updates the label redoing ellipsization calculations
+ void UpdateLabel();
+
+ // These functions are platform-specific and must be overridden in ports
+ // which do not natively support ellipsization and they must be implemented
+ // in a way so that the m_labelOrig member of wxControl is not touched:
+
+ // returns the real label currently displayed inside the control.
+ virtual wxString DoGetLabel() const { return wxEmptyString; }
+
+ // sets the real label currently displayed inside the control,
+ // _without_ invalidating the size. The text passed is always markup-free
+ // but may contain the mnemonic characters.
+ virtual void DoSetLabel(const wxString& WXUNUSED(str)) { }
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxStaticTextBase);
+};
+
+// see wx/generic/stattextg.h for the explanation
+#ifndef wxNO_PORT_STATTEXT_INCLUDE
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/stattext.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/stattext.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/stattext.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/stattext.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/stattext.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/stattext.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/stattext.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/stattext.h"
+#endif
+
+#endif // !wxNO_PORT_STATTEXT_INCLUDE
+
+#endif // wxUSE_STATTEXT
+
+#endif // _WX_STATTEXT_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/statusbr.h
+// Purpose: wxStatusBar class interface
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 05.02.00
+// Copyright: (c) Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_STATUSBR_H_BASE_
+#define _WX_STATUSBR_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_STATUSBAR
+
+#include "wx/control.h"
+#include "wx/list.h"
+#include "wx/dynarray.h"
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusBarNameStr[];
+
+// ----------------------------------------------------------------------------
+// wxStatusBar constants
+// ----------------------------------------------------------------------------
+
+// wxStatusBar styles
+#define wxSTB_SIZEGRIP 0x0010
+#define wxSTB_SHOW_TIPS 0x0020
+
+#define wxSTB_ELLIPSIZE_START 0x0040
+#define wxSTB_ELLIPSIZE_MIDDLE 0x0080
+#define wxSTB_ELLIPSIZE_END 0x0100
+
+#define wxSTB_DEFAULT_STYLE (wxSTB_SIZEGRIP|wxSTB_ELLIPSIZE_END|wxSTB_SHOW_TIPS|wxFULL_REPAINT_ON_RESIZE)
+
+
+// old compat style name:
+#define wxST_SIZEGRIP wxSTB_SIZEGRIP
+
+
+// style flags for wxStatusBar fields
+#define wxSB_NORMAL 0x0000
+#define wxSB_FLAT 0x0001
+#define wxSB_RAISED 0x0002
+#define wxSB_SUNKEN 0x0003
+
+// ----------------------------------------------------------------------------
+// wxStatusBarPane: an helper for wxStatusBar
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxStatusBarPane
+{
+public:
+ wxStatusBarPane(int style = wxSB_NORMAL, int width = 0)
+ : m_nStyle(style), m_nWidth(width)
+ { m_bEllipsized = false; }
+
+ int GetWidth() const { return m_nWidth; }
+ int GetStyle() const { return m_nStyle; }
+ wxString GetText() const { return m_text; }
+
+
+ // implementation-only from now on
+ // -------------------------------
+
+ bool IsEllipsized() const
+ { return m_bEllipsized; }
+ void SetIsEllipsized(bool isEllipsized) { m_bEllipsized = isEllipsized; }
+
+ void SetWidth(int width) { m_nWidth = width; }
+ void SetStyle(int style) { m_nStyle = style; }
+
+ // set text, return true if it changed or false if it was already set to
+ // this value
+ bool SetText(const wxString& text);
+
+ // save the existing text on top of our stack and make the new text
+ // current; return true if the text really changed
+ bool PushText(const wxString& text);
+
+ // restore the message saved by the last call to Push() (unless it was
+ // changed by an intervening call to SetText()) and return true if we
+ // really restored anything
+ bool PopText();
+
+private:
+ int m_nStyle;
+ int m_nWidth; // may be negative, indicating a variable-width field
+ wxString m_text;
+
+ // the array used to keep the previous values of this pane after a
+ // PushStatusText() call, its top element is the value to restore after the
+ // next PopStatusText() call while the currently shown value is always in
+ // m_text
+ wxArrayString m_arrStack;
+
+ // is the currently shown value shown with ellipsis in the status bar?
+ bool m_bEllipsized;
+};
+
+WX_DECLARE_EXPORTED_OBJARRAY(wxStatusBarPane, wxStatusBarPaneArray);
+
+// ----------------------------------------------------------------------------
+// wxStatusBar: a window near the bottom of the frame used for status info
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxStatusBarBase : public wxControl
+{
+public:
+ wxStatusBarBase();
+
+ virtual ~wxStatusBarBase();
+
+ // field count
+ // -----------
+
+ // set the number of fields and call SetStatusWidths(widths) if widths are
+ // given
+ virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
+ int GetFieldsCount() const { return (int)m_panes.GetCount(); }
+
+ // field text
+ // ----------
+
+ // just change or get the currently shown text
+ void SetStatusText(const wxString& text, int number = 0);
+ wxString GetStatusText(int number = 0) const;
+
+ // change the currently shown text to the new one and save the current
+ // value to be restored by the next call to PopStatusText()
+ void PushStatusText(const wxString& text, int number = 0);
+ void PopStatusText(int number = 0);
+
+ // fields widths
+ // -------------
+
+ // set status field widths as absolute numbers: positive widths mean that
+ // the field has the specified absolute width, negative widths are
+ // interpreted as the sizer options, i.e. the extra space (total space
+ // minus the sum of fixed width fields) is divided between the fields with
+ // negative width according to the abs value of the width (field with width
+ // -2 grows twice as much as one with width -1 &c)
+ virtual void SetStatusWidths(int n, const int widths[]);
+
+ int GetStatusWidth(int n) const
+ { return m_panes[n].GetWidth(); }
+
+ // field styles
+ // ------------
+
+ // Set the field border style to one of wxSB_XXX values.
+ virtual void SetStatusStyles(int n, const int styles[]);
+
+ int GetStatusStyle(int n) const
+ { return m_panes[n].GetStyle(); }
+
+ // geometry
+ // --------
+
+ // Get the position and size of the field's internal bounding rectangle
+ virtual bool GetFieldRect(int i, wxRect& rect) const = 0;
+
+ // sets the minimal vertical size of the status bar
+ virtual void SetMinHeight(int height) = 0;
+
+ // get the dimensions of the horizontal and vertical borders
+ virtual int GetBorderX() const = 0;
+ virtual int GetBorderY() const = 0;
+
+ wxSize GetBorders() const
+ { return wxSize(GetBorderX(), GetBorderY()); }
+
+ // miscellaneous
+ // -------------
+
+ const wxStatusBarPane& GetField(int n) const
+ { return m_panes[n]; }
+
+ // wxWindow overrides:
+
+ // don't want status bars to accept the focus at all
+ virtual bool AcceptsFocus() const { return false; }
+
+ // the client size of a toplevel window doesn't include the status bar
+ virtual bool CanBeOutsideClientArea() const { return true; }
+
+protected:
+ // called after the status bar pane text changed and should update its
+ // display
+ virtual void DoUpdateStatusText(int number) = 0;
+
+
+ // wxWindow overrides:
+
+#if wxUSE_TOOLTIPS
+ virtual void DoSetToolTip( wxToolTip *tip )
+ {
+ wxASSERT_MSG(!HasFlag(wxSTB_SHOW_TIPS),
+ "Do not set tooltip(s) manually when using wxSTB_SHOW_TIPS!");
+ wxWindow::DoSetToolTip(tip);
+ }
+#endif // wxUSE_TOOLTIPS
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+
+ // internal helpers & data:
+
+ // calculate the real field widths for the given total available size
+ wxArrayInt CalculateAbsWidths(wxCoord widthTotal) const;
+
+ // should be called to remember if the pane text is currently being show
+ // ellipsized or not
+ void SetEllipsizedFlag(int n, bool isEllipsized);
+
+
+ // the array with the pane infos:
+ wxStatusBarPaneArray m_panes;
+
+ // if true overrides the width info of the wxStatusBarPanes
+ bool m_bSameWidthForAllPanes;
+
+ wxDECLARE_NO_COPY_CLASS(wxStatusBarBase);
+};
+
+// ----------------------------------------------------------------------------
+// include the actual wxStatusBar class declaration
+// ----------------------------------------------------------------------------
+
+#if defined(__WXUNIVERSAL__)
+ #define wxStatusBarUniv wxStatusBar
+ #include "wx/univ/statusbr.h"
+#elif defined(__WXMSW__) && wxUSE_NATIVE_STATUSBAR
+ #include "wx/msw/statusbar.h"
+#elif defined(__WXMAC__)
+ #define wxStatusBarMac wxStatusBar
+ #include "wx/generic/statusbr.h"
+ #include "wx/osx/statusbr.h"
+#else
+ #define wxStatusBarGeneric wxStatusBar
+ #include "wx/generic/statusbr.h"
+#endif
+
+#endif // wxUSE_STATUSBAR
+
+#endif
+ // _WX_STATUSBR_H_BASE_
--- /dev/null
+////////////////////////////////////////////////////////////////////////////
+// Name: wx/stc/stc.h
+// Purpose: A wxWidgets implementation of Scintilla. This class is the
+// one meant to be used directly by wx applications. It does not
+// derive directly from the Scintilla classes, and in fact there
+// is no mention of Scintilla classes at all in this header.
+// This class delegates all method calls and events to the
+// Scintilla objects and so forth. This allows the use of
+// Scintilla without polluting the namespace with all the
+// classes and itentifiers from Scintilla.
+//
+// Author: Robin Dunn
+//
+// Created: 13-Jan-2000
+// Copyright: (c) 2000 by Total Control Software
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+/*
+ IMPORTANT: include/wx/stc/stc.h is generated by src/stc/gen_iface.py from
+ src/stc/stc.h.in, don't edit stc.h file as your changes will be
+ lost after the next regeneration, edit stc.h.in and rerun the
+ gen_iface.py script instead!
+
+ Parts of this file generated by the script are found in between
+ the special "{{{" and "}}}" markers, the rest of it is copied
+ verbatim from src.h.in.
+ */
+
+#ifndef _WX_STC_STC_H_
+#define _WX_STC_STC_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_STC
+
+#include "wx/control.h"
+#include "wx/dnd.h"
+#include "wx/stopwatch.h"
+#include "wx/versioninfo.h"
+
+#include "wx/textentry.h"
+#if wxUSE_TEXTCTRL
+ #include "wx/textctrl.h"
+#endif // wxUSE_TEXTCTRL
+
+class WXDLLIMPEXP_FWD_CORE wxScrollBar;
+
+// SWIG can't handle "#if" type of conditionals, only "#ifdef"
+#ifdef SWIG
+#define STC_USE_DND 1
+#else
+#if wxUSE_DRAG_AND_DROP
+#define STC_USE_DND 1
+#endif
+#endif
+
+//----------------------------------------------------------------------
+// STC constants generated section {{{
+
+#define wxSTC_INVALID_POSITION -1
+
+/// Define start of Scintilla messages to be greater than all Windows edit (EM_*) messages
+/// as many EM_ messages can be used although that use is deprecated.
+#define wxSTC_START 2000
+#define wxSTC_OPTIONAL_START 3000
+#define wxSTC_LEXER_START 4000
+#define wxSTC_WS_INVISIBLE 0
+#define wxSTC_WS_VISIBLEALWAYS 1
+#define wxSTC_WS_VISIBLEAFTERINDENT 2
+#define wxSTC_EOL_CRLF 0
+#define wxSTC_EOL_CR 1
+#define wxSTC_EOL_LF 2
+
+/// The SC_CP_UTF8 value can be used to enter Unicode mode.
+/// This is the same value as CP_UTF8 in Windows
+#define wxSTC_CP_UTF8 65001
+#define wxSTC_MARKER_MAX 31
+#define wxSTC_MARK_CIRCLE 0
+#define wxSTC_MARK_ROUNDRECT 1
+#define wxSTC_MARK_ARROW 2
+#define wxSTC_MARK_SMALLRECT 3
+#define wxSTC_MARK_SHORTARROW 4
+#define wxSTC_MARK_EMPTY 5
+#define wxSTC_MARK_ARROWDOWN 6
+#define wxSTC_MARK_MINUS 7
+#define wxSTC_MARK_PLUS 8
+
+/// Shapes used for outlining column.
+#define wxSTC_MARK_VLINE 9
+#define wxSTC_MARK_LCORNER 10
+#define wxSTC_MARK_TCORNER 11
+#define wxSTC_MARK_BOXPLUS 12
+#define wxSTC_MARK_BOXPLUSCONNECTED 13
+#define wxSTC_MARK_BOXMINUS 14
+#define wxSTC_MARK_BOXMINUSCONNECTED 15
+#define wxSTC_MARK_LCORNERCURVE 16
+#define wxSTC_MARK_TCORNERCURVE 17
+#define wxSTC_MARK_CIRCLEPLUS 18
+#define wxSTC_MARK_CIRCLEPLUSCONNECTED 19
+#define wxSTC_MARK_CIRCLEMINUS 20
+#define wxSTC_MARK_CIRCLEMINUSCONNECTED 21
+
+/// Invisible mark that only sets the line background colour.
+#define wxSTC_MARK_BACKGROUND 22
+#define wxSTC_MARK_DOTDOTDOT 23
+#define wxSTC_MARK_ARROWS 24
+#define wxSTC_MARK_PIXMAP 25
+#define wxSTC_MARK_FULLRECT 26
+#define wxSTC_MARK_LEFTRECT 27
+#define wxSTC_MARK_AVAILABLE 28
+#define wxSTC_MARK_UNDERLINE 29
+#define wxSTC_MARK_RGBAIMAGE 30
+#define wxSTC_MARK_CHARACTER 10000
+
+/// Markers used for outlining column.
+#define wxSTC_MARKNUM_FOLDEREND 25
+#define wxSTC_MARKNUM_FOLDEROPENMID 26
+#define wxSTC_MARKNUM_FOLDERMIDTAIL 27
+#define wxSTC_MARKNUM_FOLDERTAIL 28
+#define wxSTC_MARKNUM_FOLDERSUB 29
+#define wxSTC_MARKNUM_FOLDER 30
+#define wxSTC_MARKNUM_FOLDEROPEN 31
+#define wxSTC_MASK_FOLDERS 0xFE000000
+#define wxSTC_MARGIN_SYMBOL 0
+#define wxSTC_MARGIN_NUMBER 1
+#define wxSTC_MARGIN_BACK 2
+#define wxSTC_MARGIN_FORE 3
+#define wxSTC_MARGIN_TEXT 4
+#define wxSTC_MARGIN_RTEXT 5
+
+/// Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles.
+/// Style 39 is for future use.
+#define wxSTC_STYLE_DEFAULT 32
+#define wxSTC_STYLE_LINENUMBER 33
+#define wxSTC_STYLE_BRACELIGHT 34
+#define wxSTC_STYLE_BRACEBAD 35
+#define wxSTC_STYLE_CONTROLCHAR 36
+#define wxSTC_STYLE_INDENTGUIDE 37
+#define wxSTC_STYLE_CALLTIP 38
+#define wxSTC_STYLE_LASTPREDEFINED 39
+#define wxSTC_STYLE_MAX 255
+
+/// Character set identifiers are used in StyleSetCharacterSet.
+/// The values are the same as the Windows *_CHARSET values.
+#define wxSTC_CHARSET_ANSI 0
+#define wxSTC_CHARSET_DEFAULT 1
+#define wxSTC_CHARSET_BALTIC 186
+#define wxSTC_CHARSET_CHINESEBIG5 136
+#define wxSTC_CHARSET_EASTEUROPE 238
+#define wxSTC_CHARSET_GB2312 134
+#define wxSTC_CHARSET_GREEK 161
+#define wxSTC_CHARSET_HANGUL 129
+#define wxSTC_CHARSET_MAC 77
+#define wxSTC_CHARSET_OEM 255
+#define wxSTC_CHARSET_RUSSIAN 204
+#define wxSTC_CHARSET_CYRILLIC 1251
+#define wxSTC_CHARSET_SHIFTJIS 128
+#define wxSTC_CHARSET_SYMBOL 2
+#define wxSTC_CHARSET_TURKISH 162
+#define wxSTC_CHARSET_JOHAB 130
+#define wxSTC_CHARSET_HEBREW 177
+#define wxSTC_CHARSET_ARABIC 178
+#define wxSTC_CHARSET_VIETNAMESE 163
+#define wxSTC_CHARSET_THAI 222
+#define wxSTC_CHARSET_8859_15 1000
+#define wxSTC_CASE_MIXED 0
+#define wxSTC_CASE_UPPER 1
+#define wxSTC_CASE_LOWER 2
+#define wxSTC_FONT_SIZE_MULTIPLIER 100
+#define wxSTC_WEIGHT_NORMAL 400
+#define wxSTC_WEIGHT_SEMIBOLD 600
+#define wxSTC_WEIGHT_BOLD 700
+
+/// Indicator style enumeration and some constants
+#define wxSTC_INDIC_PLAIN 0
+#define wxSTC_INDIC_SQUIGGLE 1
+#define wxSTC_INDIC_TT 2
+#define wxSTC_INDIC_DIAGONAL 3
+#define wxSTC_INDIC_STRIKE 4
+#define wxSTC_INDIC_HIDDEN 5
+#define wxSTC_INDIC_BOX 6
+#define wxSTC_INDIC_ROUNDBOX 7
+#define wxSTC_INDIC_STRAIGHTBOX 8
+#define wxSTC_INDIC_DASH 9
+#define wxSTC_INDIC_DOTS 10
+#define wxSTC_INDIC_SQUIGGLELOW 11
+#define wxSTC_INDIC_DOTBOX 12
+#define wxSTC_INDIC_MAX 31
+#define wxSTC_INDIC_CONTAINER 8
+#define wxSTC_INDIC0_MASK 0x20
+#define wxSTC_INDIC1_MASK 0x40
+#define wxSTC_INDIC2_MASK 0x80
+#define wxSTC_INDICS_MASK 0xE0
+#define wxSTC_IV_NONE 0
+#define wxSTC_IV_REAL 1
+#define wxSTC_IV_LOOKFORWARD 2
+#define wxSTC_IV_LOOKBOTH 3
+
+/// PrintColourMode - use same colours as screen.
+#define wxSTC_PRINT_NORMAL 0
+
+/// PrintColourMode - invert the light value of each style for printing.
+#define wxSTC_PRINT_INVERTLIGHT 1
+
+/// PrintColourMode - force black text on white background for printing.
+#define wxSTC_PRINT_BLACKONWHITE 2
+
+/// PrintColourMode - text stays coloured, but all background is forced to be white for printing.
+#define wxSTC_PRINT_COLOURONWHITE 3
+
+/// PrintColourMode - only the default-background is forced to be white for printing.
+#define wxSTC_PRINT_COLOURONWHITEDEFAULTBG 4
+#define wxSTC_FIND_WHOLEWORD 2
+#define wxSTC_FIND_MATCHCASE 4
+#define wxSTC_FIND_WORDSTART 0x00100000
+#define wxSTC_FIND_REGEXP 0x00200000
+#define wxSTC_FIND_POSIX 0x00400000
+#define wxSTC_FOLDLEVELBASE 0x400
+#define wxSTC_FOLDLEVELWHITEFLAG 0x1000
+#define wxSTC_FOLDLEVELHEADERFLAG 0x2000
+#define wxSTC_FOLDLEVELNUMBERMASK 0x0FFF
+#define wxSTC_FOLDFLAG_LINEBEFORE_EXPANDED 0x0002
+#define wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED 0x0004
+#define wxSTC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008
+#define wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010
+#define wxSTC_FOLDFLAG_LEVELNUMBERS 0x0040
+#define wxSTC_TIME_FOREVER 10000000
+#define wxSTC_WRAP_NONE 0
+#define wxSTC_WRAP_WORD 1
+#define wxSTC_WRAP_CHAR 2
+#define wxSTC_WRAPVISUALFLAG_NONE 0x0000
+#define wxSTC_WRAPVISUALFLAG_END 0x0001
+#define wxSTC_WRAPVISUALFLAG_START 0x0002
+#define wxSTC_WRAPVISUALFLAG_MARGIN 0x0004
+#define wxSTC_WRAPVISUALFLAGLOC_DEFAULT 0x0000
+#define wxSTC_WRAPVISUALFLAGLOC_END_BY_TEXT 0x0001
+#define wxSTC_WRAPVISUALFLAGLOC_START_BY_TEXT 0x0002
+#define wxSTC_WRAPINDENT_FIXED 0
+#define wxSTC_WRAPINDENT_SAME 1
+#define wxSTC_WRAPINDENT_INDENT 2
+#define wxSTC_CACHE_NONE 0
+#define wxSTC_CACHE_CARET 1
+#define wxSTC_CACHE_PAGE 2
+#define wxSTC_CACHE_DOCUMENT 3
+
+/// Control font anti-aliasing.
+#define wxSTC_EFF_QUALITY_MASK 0xF
+#define wxSTC_EFF_QUALITY_DEFAULT 0
+#define wxSTC_EFF_QUALITY_NON_ANTIALIASED 1
+#define wxSTC_EFF_QUALITY_ANTIALIASED 2
+#define wxSTC_EFF_QUALITY_LCD_OPTIMIZED 3
+#define wxSTC_MULTIPASTE_ONCE 0
+#define wxSTC_MULTIPASTE_EACH 1
+#define wxSTC_EDGE_NONE 0
+#define wxSTC_EDGE_LINE 1
+#define wxSTC_EDGE_BACKGROUND 2
+#define wxSTC_STATUS_OK 0
+#define wxSTC_STATUS_FAILURE 1
+#define wxSTC_STATUS_BADALLOC 2
+#define wxSTC_CURSORNORMAL -1
+#define wxSTC_CURSORARROW 2
+#define wxSTC_CURSORWAIT 4
+#define wxSTC_CURSORREVERSEARROW 7
+
+/// Constants for use with SetVisiblePolicy, similar to SetCaretPolicy.
+#define wxSTC_VISIBLE_SLOP 0x01
+#define wxSTC_VISIBLE_STRICT 0x04
+
+/// Caret policy, used by SetXCaretPolicy and SetYCaretPolicy.
+/// If CARET_SLOP is set, we can define a slop value: caretSlop.
+/// This value defines an unwanted zone (UZ) where the caret is... unwanted.
+/// This zone is defined as a number of pixels near the vertical margins,
+/// and as a number of lines near the horizontal margins.
+/// By keeping the caret away from the edges, it is seen within its context,
+/// so it is likely that the identifier that the caret is on can be completely seen,
+/// and that the current line is seen with some of the lines following it which are
+/// often dependent on that line.
+#define wxSTC_CARET_SLOP 0x01
+
+/// If CARET_STRICT is set, the policy is enforced... strictly.
+/// The caret is centred on the display if slop is not set,
+/// and cannot go in the UZ if slop is set.
+#define wxSTC_CARET_STRICT 0x04
+
+/// If CARET_JUMPS is set, the display is moved more energetically
+/// so the caret can move in the same direction longer before the policy is applied again.
+#define wxSTC_CARET_JUMPS 0x10
+
+/// If CARET_EVEN is not set, instead of having symmetrical UZs,
+/// the left and bottom UZs are extended up to right and top UZs respectively.
+/// This way, we favour the displaying of useful information: the begining of lines,
+/// where most code reside, and the lines after the caret, eg. the body of a function.
+#define wxSTC_CARET_EVEN 0x08
+#define wxSTC_SEL_STREAM 0
+#define wxSTC_SEL_RECTANGLE 1
+#define wxSTC_SEL_LINES 2
+#define wxSTC_SEL_THIN 3
+#define wxSTC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE 0
+#define wxSTC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1
+#define wxSTC_CARETSTICKY_OFF 0
+#define wxSTC_CARETSTICKY_ON 1
+#define wxSTC_CARETSTICKY_WHITESPACE 2
+#define wxSTC_ALPHA_TRANSPARENT 0
+#define wxSTC_ALPHA_OPAQUE 255
+#define wxSTC_ALPHA_NOALPHA 256
+#define wxSTC_CARETSTYLE_INVISIBLE 0
+#define wxSTC_CARETSTYLE_LINE 1
+#define wxSTC_CARETSTYLE_BLOCK 2
+#define wxSTC_MARGINOPTION_NONE 0
+#define wxSTC_MARGINOPTION_SUBLINESELECT 1
+#define wxSTC_ANNOTATION_HIDDEN 0
+#define wxSTC_ANNOTATION_STANDARD 1
+#define wxSTC_ANNOTATION_BOXED 2
+#define wxSTC_UNDO_MAY_COALESCE 1
+#define wxSTC_SCVS_NONE 0
+#define wxSTC_SCVS_RECTANGULARSELECTION 1
+#define wxSTC_SCVS_USERACCESSIBLE 2
+#define wxSTC_TECHNOLOGY_DEFAULT 0
+#define wxSTC_TECHNOLOGY_DIRECTWRITE 1
+
+/// Maximum value of keywordSet parameter of SetKeyWords.
+#define wxSTC_KEYWORDSET_MAX 8
+#define wxSTC_TYPE_BOOLEAN 0
+#define wxSTC_TYPE_INTEGER 1
+#define wxSTC_TYPE_STRING 2
+
+/// Notifications
+/// Type of modification and the action which caused the modification.
+/// These are defined as a bit mask to make it easy to specify which notifications are wanted.
+/// One bit is set from each of SC_MOD_* and SC_PERFORMED_*.
+#define wxSTC_MOD_INSERTTEXT 0x1
+#define wxSTC_MOD_DELETETEXT 0x2
+#define wxSTC_MOD_CHANGESTYLE 0x4
+#define wxSTC_MOD_CHANGEFOLD 0x8
+#define wxSTC_PERFORMED_USER 0x10
+#define wxSTC_PERFORMED_UNDO 0x20
+#define wxSTC_PERFORMED_REDO 0x40
+#define wxSTC_MULTISTEPUNDOREDO 0x80
+#define wxSTC_LASTSTEPINUNDOREDO 0x100
+#define wxSTC_MOD_CHANGEMARKER 0x200
+#define wxSTC_MOD_BEFOREINSERT 0x400
+#define wxSTC_MOD_BEFOREDELETE 0x800
+#define wxSTC_MULTILINEUNDOREDO 0x1000
+#define wxSTC_STARTACTION 0x2000
+#define wxSTC_MOD_CHANGEINDICATOR 0x4000
+#define wxSTC_MOD_CHANGELINESTATE 0x8000
+#define wxSTC_MOD_CHANGEMARGIN 0x10000
+#define wxSTC_MOD_CHANGEANNOTATION 0x20000
+#define wxSTC_MOD_CONTAINER 0x40000
+#define wxSTC_MOD_LEXERSTATE 0x80000
+#define wxSTC_MODEVENTMASKALL 0xFFFFF
+#define wxSTC_UPDATE_CONTENT 0x1
+#define wxSTC_UPDATE_SELECTION 0x2
+#define wxSTC_UPDATE_V_SCROLL 0x4
+#define wxSTC_UPDATE_H_SCROLL 0x8
+
+/// Symbolic key codes and modifier flags.
+/// ASCII and other printable characters below 256.
+/// Extended keys above 300.
+#define wxSTC_KEY_DOWN 300
+#define wxSTC_KEY_UP 301
+#define wxSTC_KEY_LEFT 302
+#define wxSTC_KEY_RIGHT 303
+#define wxSTC_KEY_HOME 304
+#define wxSTC_KEY_END 305
+#define wxSTC_KEY_PRIOR 306
+#define wxSTC_KEY_NEXT 307
+#define wxSTC_KEY_DELETE 308
+#define wxSTC_KEY_INSERT 309
+#define wxSTC_KEY_ESCAPE 7
+#define wxSTC_KEY_BACK 8
+#define wxSTC_KEY_TAB 9
+#define wxSTC_KEY_RETURN 13
+#define wxSTC_KEY_ADD 310
+#define wxSTC_KEY_SUBTRACT 311
+#define wxSTC_KEY_DIVIDE 312
+#define wxSTC_KEY_WIN 313
+#define wxSTC_KEY_RWIN 314
+#define wxSTC_KEY_MENU 315
+#define wxSTC_SCMOD_NORM 0
+#define wxSTC_SCMOD_SHIFT 1
+#define wxSTC_SCMOD_CTRL 2
+#define wxSTC_SCMOD_ALT 4
+#define wxSTC_SCMOD_SUPER 8
+#define wxSTC_SCMOD_META 16
+
+/// For SciLexer.h
+#define wxSTC_LEX_CONTAINER 0
+#define wxSTC_LEX_NULL 1
+#define wxSTC_LEX_PYTHON 2
+#define wxSTC_LEX_CPP 3
+#define wxSTC_LEX_HTML 4
+#define wxSTC_LEX_XML 5
+#define wxSTC_LEX_PERL 6
+#define wxSTC_LEX_SQL 7
+#define wxSTC_LEX_VB 8
+#define wxSTC_LEX_PROPERTIES 9
+#define wxSTC_LEX_ERRORLIST 10
+#define wxSTC_LEX_MAKEFILE 11
+#define wxSTC_LEX_BATCH 12
+#define wxSTC_LEX_XCODE 13
+#define wxSTC_LEX_LATEX 14
+#define wxSTC_LEX_LUA 15
+#define wxSTC_LEX_DIFF 16
+#define wxSTC_LEX_CONF 17
+#define wxSTC_LEX_PASCAL 18
+#define wxSTC_LEX_AVE 19
+#define wxSTC_LEX_ADA 20
+#define wxSTC_LEX_LISP 21
+#define wxSTC_LEX_RUBY 22
+#define wxSTC_LEX_EIFFEL 23
+#define wxSTC_LEX_EIFFELKW 24
+#define wxSTC_LEX_TCL 25
+#define wxSTC_LEX_NNCRONTAB 26
+#define wxSTC_LEX_BULLANT 27
+#define wxSTC_LEX_VBSCRIPT 28
+#define wxSTC_LEX_BAAN 31
+#define wxSTC_LEX_MATLAB 32
+#define wxSTC_LEX_SCRIPTOL 33
+#define wxSTC_LEX_ASM 34
+#define wxSTC_LEX_CPPNOCASE 35
+#define wxSTC_LEX_FORTRAN 36
+#define wxSTC_LEX_F77 37
+#define wxSTC_LEX_CSS 38
+#define wxSTC_LEX_POV 39
+#define wxSTC_LEX_LOUT 40
+#define wxSTC_LEX_ESCRIPT 41
+#define wxSTC_LEX_PS 42
+#define wxSTC_LEX_NSIS 43
+#define wxSTC_LEX_MMIXAL 44
+#define wxSTC_LEX_CLW 45
+#define wxSTC_LEX_CLWNOCASE 46
+#define wxSTC_LEX_LOT 47
+#define wxSTC_LEX_YAML 48
+#define wxSTC_LEX_TEX 49
+#define wxSTC_LEX_METAPOST 50
+#define wxSTC_LEX_POWERBASIC 51
+#define wxSTC_LEX_FORTH 52
+#define wxSTC_LEX_ERLANG 53
+#define wxSTC_LEX_OCTAVE 54
+#define wxSTC_LEX_MSSQL 55
+#define wxSTC_LEX_VERILOG 56
+#define wxSTC_LEX_KIX 57
+#define wxSTC_LEX_GUI4CLI 58
+#define wxSTC_LEX_SPECMAN 59
+#define wxSTC_LEX_AU3 60
+#define wxSTC_LEX_APDL 61
+#define wxSTC_LEX_BASH 62
+#define wxSTC_LEX_ASN1 63
+#define wxSTC_LEX_VHDL 64
+#define wxSTC_LEX_CAML 65
+#define wxSTC_LEX_BLITZBASIC 66
+#define wxSTC_LEX_PUREBASIC 67
+#define wxSTC_LEX_HASKELL 68
+#define wxSTC_LEX_PHPSCRIPT 69
+#define wxSTC_LEX_TADS3 70
+#define wxSTC_LEX_REBOL 71
+#define wxSTC_LEX_SMALLTALK 72
+#define wxSTC_LEX_FLAGSHIP 73
+#define wxSTC_LEX_CSOUND 74
+#define wxSTC_LEX_FREEBASIC 75
+#define wxSTC_LEX_INNOSETUP 76
+#define wxSTC_LEX_OPAL 77
+#define wxSTC_LEX_SPICE 78
+#define wxSTC_LEX_D 79
+#define wxSTC_LEX_CMAKE 80
+#define wxSTC_LEX_GAP 81
+#define wxSTC_LEX_PLM 82
+#define wxSTC_LEX_PROGRESS 83
+#define wxSTC_LEX_ABAQUS 84
+#define wxSTC_LEX_ASYMPTOTE 85
+#define wxSTC_LEX_R 86
+#define wxSTC_LEX_MAGIK 87
+#define wxSTC_LEX_POWERSHELL 88
+#define wxSTC_LEX_MYSQL 89
+#define wxSTC_LEX_PO 90
+#define wxSTC_LEX_TAL 91
+#define wxSTC_LEX_COBOL 92
+#define wxSTC_LEX_TACL 93
+#define wxSTC_LEX_SORCUS 94
+#define wxSTC_LEX_POWERPRO 95
+#define wxSTC_LEX_NIMROD 96
+#define wxSTC_LEX_SML 97
+#define wxSTC_LEX_MARKDOWN 98
+#define wxSTC_LEX_TXT2TAGS 99
+#define wxSTC_LEX_A68K 100
+#define wxSTC_LEX_MODULA 101
+#define wxSTC_LEX_COFFEESCRIPT 102
+#define wxSTC_LEX_TCMD 103
+#define wxSTC_LEX_AVS 104
+#define wxSTC_LEX_ECL 105
+#define wxSTC_LEX_OSCRIPT 106
+#define wxSTC_LEX_VISUALPROLOG 107
+
+/// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
+/// value assigned in sequence from SCLEX_AUTOMATIC+1.
+#define wxSTC_LEX_AUTOMATIC 1000
+
+/// Lexical states for SCLEX_PYTHON
+#define wxSTC_P_DEFAULT 0
+#define wxSTC_P_COMMENTLINE 1
+#define wxSTC_P_NUMBER 2
+#define wxSTC_P_STRING 3
+#define wxSTC_P_CHARACTER 4
+#define wxSTC_P_WORD 5
+#define wxSTC_P_TRIPLE 6
+#define wxSTC_P_TRIPLEDOUBLE 7
+#define wxSTC_P_CLASSNAME 8
+#define wxSTC_P_DEFNAME 9
+#define wxSTC_P_OPERATOR 10
+#define wxSTC_P_IDENTIFIER 11
+#define wxSTC_P_COMMENTBLOCK 12
+#define wxSTC_P_STRINGEOL 13
+#define wxSTC_P_WORD2 14
+#define wxSTC_P_DECORATOR 15
+
+/// Lexical states for SCLEX_CPP
+#define wxSTC_C_DEFAULT 0
+#define wxSTC_C_COMMENT 1
+#define wxSTC_C_COMMENTLINE 2
+#define wxSTC_C_COMMENTDOC 3
+#define wxSTC_C_NUMBER 4
+#define wxSTC_C_WORD 5
+#define wxSTC_C_STRING 6
+#define wxSTC_C_CHARACTER 7
+#define wxSTC_C_UUID 8
+#define wxSTC_C_PREPROCESSOR 9
+#define wxSTC_C_OPERATOR 10
+#define wxSTC_C_IDENTIFIER 11
+#define wxSTC_C_STRINGEOL 12
+#define wxSTC_C_VERBATIM 13
+#define wxSTC_C_REGEX 14
+#define wxSTC_C_COMMENTLINEDOC 15
+#define wxSTC_C_WORD2 16
+#define wxSTC_C_COMMENTDOCKEYWORD 17
+#define wxSTC_C_COMMENTDOCKEYWORDERROR 18
+#define wxSTC_C_GLOBALCLASS 19
+#define wxSTC_C_STRINGRAW 20
+#define wxSTC_C_TRIPLEVERBATIM 21
+#define wxSTC_C_HASHQUOTEDSTRING 22
+#define wxSTC_C_PREPROCESSORCOMMENT 23
+
+/// Lexical states for SCLEX_D
+#define wxSTC_D_DEFAULT 0
+#define wxSTC_D_COMMENT 1
+#define wxSTC_D_COMMENTLINE 2
+#define wxSTC_D_COMMENTDOC 3
+#define wxSTC_D_COMMENTNESTED 4
+#define wxSTC_D_NUMBER 5
+#define wxSTC_D_WORD 6
+#define wxSTC_D_WORD2 7
+#define wxSTC_D_WORD3 8
+#define wxSTC_D_TYPEDEF 9
+#define wxSTC_D_STRING 10
+#define wxSTC_D_STRINGEOL 11
+#define wxSTC_D_CHARACTER 12
+#define wxSTC_D_OPERATOR 13
+#define wxSTC_D_IDENTIFIER 14
+#define wxSTC_D_COMMENTLINEDOC 15
+#define wxSTC_D_COMMENTDOCKEYWORD 16
+#define wxSTC_D_COMMENTDOCKEYWORDERROR 17
+#define wxSTC_D_STRINGB 18
+#define wxSTC_D_STRINGR 19
+#define wxSTC_D_WORD5 20
+#define wxSTC_D_WORD6 21
+#define wxSTC_D_WORD7 22
+
+/// Lexical states for SCLEX_TCL
+#define wxSTC_TCL_DEFAULT 0
+#define wxSTC_TCL_COMMENT 1
+#define wxSTC_TCL_COMMENTLINE 2
+#define wxSTC_TCL_NUMBER 3
+#define wxSTC_TCL_WORD_IN_QUOTE 4
+#define wxSTC_TCL_IN_QUOTE 5
+#define wxSTC_TCL_OPERATOR 6
+#define wxSTC_TCL_IDENTIFIER 7
+#define wxSTC_TCL_SUBSTITUTION 8
+#define wxSTC_TCL_SUB_BRACE 9
+#define wxSTC_TCL_MODIFIER 10
+#define wxSTC_TCL_EXPAND 11
+#define wxSTC_TCL_WORD 12
+#define wxSTC_TCL_WORD2 13
+#define wxSTC_TCL_WORD3 14
+#define wxSTC_TCL_WORD4 15
+#define wxSTC_TCL_WORD5 16
+#define wxSTC_TCL_WORD6 17
+#define wxSTC_TCL_WORD7 18
+#define wxSTC_TCL_WORD8 19
+#define wxSTC_TCL_COMMENT_BOX 20
+#define wxSTC_TCL_BLOCK_COMMENT 21
+
+/// Lexical states for SCLEX_HTML, SCLEX_XML
+#define wxSTC_H_DEFAULT 0
+#define wxSTC_H_TAG 1
+#define wxSTC_H_TAGUNKNOWN 2
+#define wxSTC_H_ATTRIBUTE 3
+#define wxSTC_H_ATTRIBUTEUNKNOWN 4
+#define wxSTC_H_NUMBER 5
+#define wxSTC_H_DOUBLESTRING 6
+#define wxSTC_H_SINGLESTRING 7
+#define wxSTC_H_OTHER 8
+#define wxSTC_H_COMMENT 9
+#define wxSTC_H_ENTITY 10
+
+/// XML and ASP
+#define wxSTC_H_TAGEND 11
+#define wxSTC_H_XMLSTART 12
+#define wxSTC_H_XMLEND 13
+#define wxSTC_H_SCRIPT 14
+#define wxSTC_H_ASP 15
+#define wxSTC_H_ASPAT 16
+#define wxSTC_H_CDATA 17
+#define wxSTC_H_QUESTION 18
+
+/// More HTML
+#define wxSTC_H_VALUE 19
+
+/// X-Code
+#define wxSTC_H_XCCOMMENT 20
+
+/// SGML
+#define wxSTC_H_SGML_DEFAULT 21
+#define wxSTC_H_SGML_COMMAND 22
+#define wxSTC_H_SGML_1ST_PARAM 23
+#define wxSTC_H_SGML_DOUBLESTRING 24
+#define wxSTC_H_SGML_SIMPLESTRING 25
+#define wxSTC_H_SGML_ERROR 26
+#define wxSTC_H_SGML_SPECIAL 27
+#define wxSTC_H_SGML_ENTITY 28
+#define wxSTC_H_SGML_COMMENT 29
+#define wxSTC_H_SGML_1ST_PARAM_COMMENT 30
+#define wxSTC_H_SGML_BLOCK_DEFAULT 31
+
+/// Embedded Javascript
+#define wxSTC_HJ_START 40
+#define wxSTC_HJ_DEFAULT 41
+#define wxSTC_HJ_COMMENT 42
+#define wxSTC_HJ_COMMENTLINE 43
+#define wxSTC_HJ_COMMENTDOC 44
+#define wxSTC_HJ_NUMBER 45
+#define wxSTC_HJ_WORD 46
+#define wxSTC_HJ_KEYWORD 47
+#define wxSTC_HJ_DOUBLESTRING 48
+#define wxSTC_HJ_SINGLESTRING 49
+#define wxSTC_HJ_SYMBOLS 50
+#define wxSTC_HJ_STRINGEOL 51
+#define wxSTC_HJ_REGEX 52
+
+/// ASP Javascript
+#define wxSTC_HJA_START 55
+#define wxSTC_HJA_DEFAULT 56
+#define wxSTC_HJA_COMMENT 57
+#define wxSTC_HJA_COMMENTLINE 58
+#define wxSTC_HJA_COMMENTDOC 59
+#define wxSTC_HJA_NUMBER 60
+#define wxSTC_HJA_WORD 61
+#define wxSTC_HJA_KEYWORD 62
+#define wxSTC_HJA_DOUBLESTRING 63
+#define wxSTC_HJA_SINGLESTRING 64
+#define wxSTC_HJA_SYMBOLS 65
+#define wxSTC_HJA_STRINGEOL 66
+#define wxSTC_HJA_REGEX 67
+
+/// Embedded VBScript
+#define wxSTC_HB_START 70
+#define wxSTC_HB_DEFAULT 71
+#define wxSTC_HB_COMMENTLINE 72
+#define wxSTC_HB_NUMBER 73
+#define wxSTC_HB_WORD 74
+#define wxSTC_HB_STRING 75
+#define wxSTC_HB_IDENTIFIER 76
+#define wxSTC_HB_STRINGEOL 77
+
+/// ASP VBScript
+#define wxSTC_HBA_START 80
+#define wxSTC_HBA_DEFAULT 81
+#define wxSTC_HBA_COMMENTLINE 82
+#define wxSTC_HBA_NUMBER 83
+#define wxSTC_HBA_WORD 84
+#define wxSTC_HBA_STRING 85
+#define wxSTC_HBA_IDENTIFIER 86
+#define wxSTC_HBA_STRINGEOL 87
+
+/// Embedded Python
+#define wxSTC_HP_START 90
+#define wxSTC_HP_DEFAULT 91
+#define wxSTC_HP_COMMENTLINE 92
+#define wxSTC_HP_NUMBER 93
+#define wxSTC_HP_STRING 94
+#define wxSTC_HP_CHARACTER 95
+#define wxSTC_HP_WORD 96
+#define wxSTC_HP_TRIPLE 97
+#define wxSTC_HP_TRIPLEDOUBLE 98
+#define wxSTC_HP_CLASSNAME 99
+#define wxSTC_HP_DEFNAME 100
+#define wxSTC_HP_OPERATOR 101
+#define wxSTC_HP_IDENTIFIER 102
+
+/// PHP
+#define wxSTC_HPHP_COMPLEX_VARIABLE 104
+
+/// ASP Python
+#define wxSTC_HPA_START 105
+#define wxSTC_HPA_DEFAULT 106
+#define wxSTC_HPA_COMMENTLINE 107
+#define wxSTC_HPA_NUMBER 108
+#define wxSTC_HPA_STRING 109
+#define wxSTC_HPA_CHARACTER 110
+#define wxSTC_HPA_WORD 111
+#define wxSTC_HPA_TRIPLE 112
+#define wxSTC_HPA_TRIPLEDOUBLE 113
+#define wxSTC_HPA_CLASSNAME 114
+#define wxSTC_HPA_DEFNAME 115
+#define wxSTC_HPA_OPERATOR 116
+#define wxSTC_HPA_IDENTIFIER 117
+
+/// PHP
+#define wxSTC_HPHP_DEFAULT 118
+#define wxSTC_HPHP_HSTRING 119
+#define wxSTC_HPHP_SIMPLESTRING 120
+#define wxSTC_HPHP_WORD 121
+#define wxSTC_HPHP_NUMBER 122
+#define wxSTC_HPHP_VARIABLE 123
+#define wxSTC_HPHP_COMMENT 124
+#define wxSTC_HPHP_COMMENTLINE 125
+#define wxSTC_HPHP_HSTRING_VARIABLE 126
+#define wxSTC_HPHP_OPERATOR 127
+
+/// Lexical states for SCLEX_PERL
+#define wxSTC_PL_DEFAULT 0
+#define wxSTC_PL_ERROR 1
+#define wxSTC_PL_COMMENTLINE 2
+#define wxSTC_PL_POD 3
+#define wxSTC_PL_NUMBER 4
+#define wxSTC_PL_WORD 5
+#define wxSTC_PL_STRING 6
+#define wxSTC_PL_CHARACTER 7
+#define wxSTC_PL_PUNCTUATION 8
+#define wxSTC_PL_PREPROCESSOR 9
+#define wxSTC_PL_OPERATOR 10
+#define wxSTC_PL_IDENTIFIER 11
+#define wxSTC_PL_SCALAR 12
+#define wxSTC_PL_ARRAY 13
+#define wxSTC_PL_HASH 14
+#define wxSTC_PL_SYMBOLTABLE 15
+#define wxSTC_PL_VARIABLE_INDEXER 16
+#define wxSTC_PL_REGEX 17
+#define wxSTC_PL_REGSUBST 18
+#define wxSTC_PL_LONGQUOTE 19
+#define wxSTC_PL_BACKTICKS 20
+#define wxSTC_PL_DATASECTION 21
+#define wxSTC_PL_HERE_DELIM 22
+#define wxSTC_PL_HERE_Q 23
+#define wxSTC_PL_HERE_QQ 24
+#define wxSTC_PL_HERE_QX 25
+#define wxSTC_PL_STRING_Q 26
+#define wxSTC_PL_STRING_QQ 27
+#define wxSTC_PL_STRING_QX 28
+#define wxSTC_PL_STRING_QR 29
+#define wxSTC_PL_STRING_QW 30
+#define wxSTC_PL_POD_VERB 31
+#define wxSTC_PL_SUB_PROTOTYPE 40
+#define wxSTC_PL_FORMAT_IDENT 41
+#define wxSTC_PL_FORMAT 42
+#define wxSTC_PL_STRING_VAR 43
+#define wxSTC_PL_XLAT 44
+#define wxSTC_PL_REGEX_VAR 54
+#define wxSTC_PL_REGSUBST_VAR 55
+#define wxSTC_PL_BACKTICKS_VAR 57
+#define wxSTC_PL_HERE_QQ_VAR 61
+#define wxSTC_PL_HERE_QX_VAR 62
+#define wxSTC_PL_STRING_QQ_VAR 64
+#define wxSTC_PL_STRING_QX_VAR 65
+#define wxSTC_PL_STRING_QR_VAR 66
+
+/// Lexical states for SCLEX_RUBY
+#define wxSTC_RB_DEFAULT 0
+#define wxSTC_RB_ERROR 1
+#define wxSTC_RB_COMMENTLINE 2
+#define wxSTC_RB_POD 3
+#define wxSTC_RB_NUMBER 4
+#define wxSTC_RB_WORD 5
+#define wxSTC_RB_STRING 6
+#define wxSTC_RB_CHARACTER 7
+#define wxSTC_RB_CLASSNAME 8
+#define wxSTC_RB_DEFNAME 9
+#define wxSTC_RB_OPERATOR 10
+#define wxSTC_RB_IDENTIFIER 11
+#define wxSTC_RB_REGEX 12
+#define wxSTC_RB_GLOBAL 13
+#define wxSTC_RB_SYMBOL 14
+#define wxSTC_RB_MODULE_NAME 15
+#define wxSTC_RB_INSTANCE_VAR 16
+#define wxSTC_RB_CLASS_VAR 17
+#define wxSTC_RB_BACKTICKS 18
+#define wxSTC_RB_DATASECTION 19
+#define wxSTC_RB_HERE_DELIM 20
+#define wxSTC_RB_HERE_Q 21
+#define wxSTC_RB_HERE_QQ 22
+#define wxSTC_RB_HERE_QX 23
+#define wxSTC_RB_STRING_Q 24
+#define wxSTC_RB_STRING_QQ 25
+#define wxSTC_RB_STRING_QX 26
+#define wxSTC_RB_STRING_QR 27
+#define wxSTC_RB_STRING_QW 28
+#define wxSTC_RB_WORD_DEMOTED 29
+#define wxSTC_RB_STDIN 30
+#define wxSTC_RB_STDOUT 31
+#define wxSTC_RB_STDERR 40
+#define wxSTC_RB_UPPER_BOUND 41
+
+/// Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC
+#define wxSTC_B_DEFAULT 0
+#define wxSTC_B_COMMENT 1
+#define wxSTC_B_NUMBER 2
+#define wxSTC_B_KEYWORD 3
+#define wxSTC_B_STRING 4
+#define wxSTC_B_PREPROCESSOR 5
+#define wxSTC_B_OPERATOR 6
+#define wxSTC_B_IDENTIFIER 7
+#define wxSTC_B_DATE 8
+#define wxSTC_B_STRINGEOL 9
+#define wxSTC_B_KEYWORD2 10
+#define wxSTC_B_KEYWORD3 11
+#define wxSTC_B_KEYWORD4 12
+#define wxSTC_B_CONSTANT 13
+#define wxSTC_B_ASM 14
+#define wxSTC_B_LABEL 15
+#define wxSTC_B_ERROR 16
+#define wxSTC_B_HEXNUMBER 17
+#define wxSTC_B_BINNUMBER 18
+
+/// Lexical states for SCLEX_PROPERTIES
+#define wxSTC_PROPS_DEFAULT 0
+#define wxSTC_PROPS_COMMENT 1
+#define wxSTC_PROPS_SECTION 2
+#define wxSTC_PROPS_ASSIGNMENT 3
+#define wxSTC_PROPS_DEFVAL 4
+#define wxSTC_PROPS_KEY 5
+
+/// Lexical states for SCLEX_LATEX
+#define wxSTC_L_DEFAULT 0
+#define wxSTC_L_COMMAND 1
+#define wxSTC_L_TAG 2
+#define wxSTC_L_MATH 3
+#define wxSTC_L_COMMENT 4
+#define wxSTC_L_TAG2 5
+#define wxSTC_L_MATH2 6
+#define wxSTC_L_COMMENT2 7
+#define wxSTC_L_VERBATIM 8
+#define wxSTC_L_SHORTCMD 9
+#define wxSTC_L_SPECIAL 10
+#define wxSTC_L_CMDOPT 11
+#define wxSTC_L_ERROR 12
+
+/// Lexical states for SCLEX_LUA
+#define wxSTC_LUA_DEFAULT 0
+#define wxSTC_LUA_COMMENT 1
+#define wxSTC_LUA_COMMENTLINE 2
+#define wxSTC_LUA_COMMENTDOC 3
+#define wxSTC_LUA_NUMBER 4
+#define wxSTC_LUA_WORD 5
+#define wxSTC_LUA_STRING 6
+#define wxSTC_LUA_CHARACTER 7
+#define wxSTC_LUA_LITERALSTRING 8
+#define wxSTC_LUA_PREPROCESSOR 9
+#define wxSTC_LUA_OPERATOR 10
+#define wxSTC_LUA_IDENTIFIER 11
+#define wxSTC_LUA_STRINGEOL 12
+#define wxSTC_LUA_WORD2 13
+#define wxSTC_LUA_WORD3 14
+#define wxSTC_LUA_WORD4 15
+#define wxSTC_LUA_WORD5 16
+#define wxSTC_LUA_WORD6 17
+#define wxSTC_LUA_WORD7 18
+#define wxSTC_LUA_WORD8 19
+#define wxSTC_LUA_LABEL 20
+
+/// Lexical states for SCLEX_ERRORLIST
+#define wxSTC_ERR_DEFAULT 0
+#define wxSTC_ERR_PYTHON 1
+#define wxSTC_ERR_GCC 2
+#define wxSTC_ERR_MS 3
+#define wxSTC_ERR_CMD 4
+#define wxSTC_ERR_BORLAND 5
+#define wxSTC_ERR_PERL 6
+#define wxSTC_ERR_NET 7
+#define wxSTC_ERR_LUA 8
+#define wxSTC_ERR_CTAG 9
+#define wxSTC_ERR_DIFF_CHANGED 10
+#define wxSTC_ERR_DIFF_ADDITION 11
+#define wxSTC_ERR_DIFF_DELETION 12
+#define wxSTC_ERR_DIFF_MESSAGE 13
+#define wxSTC_ERR_PHP 14
+#define wxSTC_ERR_ELF 15
+#define wxSTC_ERR_IFC 16
+#define wxSTC_ERR_IFORT 17
+#define wxSTC_ERR_ABSF 18
+#define wxSTC_ERR_TIDY 19
+#define wxSTC_ERR_JAVA_STACK 20
+#define wxSTC_ERR_VALUE 21
+
+/// Lexical states for SCLEX_BATCH
+#define wxSTC_BAT_DEFAULT 0
+#define wxSTC_BAT_COMMENT 1
+#define wxSTC_BAT_WORD 2
+#define wxSTC_BAT_LABEL 3
+#define wxSTC_BAT_HIDE 4
+#define wxSTC_BAT_COMMAND 5
+#define wxSTC_BAT_IDENTIFIER 6
+#define wxSTC_BAT_OPERATOR 7
+
+/// Lexical states for SCLEX_TCMD
+#define wxSTC_TCMD_DEFAULT 0
+#define wxSTC_TCMD_COMMENT 1
+#define wxSTC_TCMD_WORD 2
+#define wxSTC_TCMD_LABEL 3
+#define wxSTC_TCMD_HIDE 4
+#define wxSTC_TCMD_COMMAND 5
+#define wxSTC_TCMD_IDENTIFIER 6
+#define wxSTC_TCMD_OPERATOR 7
+#define wxSTC_TCMD_ENVIRONMENT 8
+#define wxSTC_TCMD_EXPANSION 9
+#define wxSTC_TCMD_CLABEL 10
+
+/// Lexical states for SCLEX_MAKEFILE
+#define wxSTC_MAKE_DEFAULT 0
+#define wxSTC_MAKE_COMMENT 1
+#define wxSTC_MAKE_PREPROCESSOR 2
+#define wxSTC_MAKE_IDENTIFIER 3
+#define wxSTC_MAKE_OPERATOR 4
+#define wxSTC_MAKE_TARGET 5
+#define wxSTC_MAKE_IDEOL 9
+
+/// Lexical states for SCLEX_DIFF
+#define wxSTC_DIFF_DEFAULT 0
+#define wxSTC_DIFF_COMMENT 1
+#define wxSTC_DIFF_COMMAND 2
+#define wxSTC_DIFF_HEADER 3
+#define wxSTC_DIFF_POSITION 4
+#define wxSTC_DIFF_DELETED 5
+#define wxSTC_DIFF_ADDED 6
+#define wxSTC_DIFF_CHANGED 7
+
+/// Lexical states for SCLEX_CONF (Apache Configuration Files Lexer)
+#define wxSTC_CONF_DEFAULT 0
+#define wxSTC_CONF_COMMENT 1
+#define wxSTC_CONF_NUMBER 2
+#define wxSTC_CONF_IDENTIFIER 3
+#define wxSTC_CONF_EXTENSION 4
+#define wxSTC_CONF_PARAMETER 5
+#define wxSTC_CONF_STRING 6
+#define wxSTC_CONF_OPERATOR 7
+#define wxSTC_CONF_IP 8
+#define wxSTC_CONF_DIRECTIVE 9
+
+/// Lexical states for SCLEX_AVE, Avenue
+#define wxSTC_AVE_DEFAULT 0
+#define wxSTC_AVE_COMMENT 1
+#define wxSTC_AVE_NUMBER 2
+#define wxSTC_AVE_WORD 3
+#define wxSTC_AVE_STRING 6
+#define wxSTC_AVE_ENUM 7
+#define wxSTC_AVE_STRINGEOL 8
+#define wxSTC_AVE_IDENTIFIER 9
+#define wxSTC_AVE_OPERATOR 10
+#define wxSTC_AVE_WORD1 11
+#define wxSTC_AVE_WORD2 12
+#define wxSTC_AVE_WORD3 13
+#define wxSTC_AVE_WORD4 14
+#define wxSTC_AVE_WORD5 15
+#define wxSTC_AVE_WORD6 16
+
+/// Lexical states for SCLEX_ADA
+#define wxSTC_ADA_DEFAULT 0
+#define wxSTC_ADA_WORD 1
+#define wxSTC_ADA_IDENTIFIER 2
+#define wxSTC_ADA_NUMBER 3
+#define wxSTC_ADA_DELIMITER 4
+#define wxSTC_ADA_CHARACTER 5
+#define wxSTC_ADA_CHARACTEREOL 6
+#define wxSTC_ADA_STRING 7
+#define wxSTC_ADA_STRINGEOL 8
+#define wxSTC_ADA_LABEL 9
+#define wxSTC_ADA_COMMENTLINE 10
+#define wxSTC_ADA_ILLEGAL 11
+
+/// Lexical states for SCLEX_BAAN
+#define wxSTC_BAAN_DEFAULT 0
+#define wxSTC_BAAN_COMMENT 1
+#define wxSTC_BAAN_COMMENTDOC 2
+#define wxSTC_BAAN_NUMBER 3
+#define wxSTC_BAAN_WORD 4
+#define wxSTC_BAAN_STRING 5
+#define wxSTC_BAAN_PREPROCESSOR 6
+#define wxSTC_BAAN_OPERATOR 7
+#define wxSTC_BAAN_IDENTIFIER 8
+#define wxSTC_BAAN_STRINGEOL 9
+#define wxSTC_BAAN_WORD2 10
+
+/// Lexical states for SCLEX_LISP
+#define wxSTC_LISP_DEFAULT 0
+#define wxSTC_LISP_COMMENT 1
+#define wxSTC_LISP_NUMBER 2
+#define wxSTC_LISP_KEYWORD 3
+#define wxSTC_LISP_KEYWORD_KW 4
+#define wxSTC_LISP_SYMBOL 5
+#define wxSTC_LISP_STRING 6
+#define wxSTC_LISP_STRINGEOL 8
+#define wxSTC_LISP_IDENTIFIER 9
+#define wxSTC_LISP_OPERATOR 10
+#define wxSTC_LISP_SPECIAL 11
+#define wxSTC_LISP_MULTI_COMMENT 12
+
+/// Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW
+#define wxSTC_EIFFEL_DEFAULT 0
+#define wxSTC_EIFFEL_COMMENTLINE 1
+#define wxSTC_EIFFEL_NUMBER 2
+#define wxSTC_EIFFEL_WORD 3
+#define wxSTC_EIFFEL_STRING 4
+#define wxSTC_EIFFEL_CHARACTER 5
+#define wxSTC_EIFFEL_OPERATOR 6
+#define wxSTC_EIFFEL_IDENTIFIER 7
+#define wxSTC_EIFFEL_STRINGEOL 8
+
+/// Lexical states for SCLEX_NNCRONTAB (nnCron crontab Lexer)
+#define wxSTC_NNCRONTAB_DEFAULT 0
+#define wxSTC_NNCRONTAB_COMMENT 1
+#define wxSTC_NNCRONTAB_TASK 2
+#define wxSTC_NNCRONTAB_SECTION 3
+#define wxSTC_NNCRONTAB_KEYWORD 4
+#define wxSTC_NNCRONTAB_MODIFIER 5
+#define wxSTC_NNCRONTAB_ASTERISK 6
+#define wxSTC_NNCRONTAB_NUMBER 7
+#define wxSTC_NNCRONTAB_STRING 8
+#define wxSTC_NNCRONTAB_ENVIRONMENT 9
+#define wxSTC_NNCRONTAB_IDENTIFIER 10
+
+/// Lexical states for SCLEX_FORTH (Forth Lexer)
+#define wxSTC_FORTH_DEFAULT 0
+#define wxSTC_FORTH_COMMENT 1
+#define wxSTC_FORTH_COMMENT_ML 2
+#define wxSTC_FORTH_IDENTIFIER 3
+#define wxSTC_FORTH_CONTROL 4
+#define wxSTC_FORTH_KEYWORD 5
+#define wxSTC_FORTH_DEFWORD 6
+#define wxSTC_FORTH_PREWORD1 7
+#define wxSTC_FORTH_PREWORD2 8
+#define wxSTC_FORTH_NUMBER 9
+#define wxSTC_FORTH_STRING 10
+#define wxSTC_FORTH_LOCALE 11
+
+/// Lexical states for SCLEX_MATLAB
+#define wxSTC_MATLAB_DEFAULT 0
+#define wxSTC_MATLAB_COMMENT 1
+#define wxSTC_MATLAB_COMMAND 2
+#define wxSTC_MATLAB_NUMBER 3
+#define wxSTC_MATLAB_KEYWORD 4
+
+/// single quoted string
+#define wxSTC_MATLAB_STRING 5
+#define wxSTC_MATLAB_OPERATOR 6
+#define wxSTC_MATLAB_IDENTIFIER 7
+#define wxSTC_MATLAB_DOUBLEQUOTESTRING 8
+
+/// Lexical states for SCLEX_SCRIPTOL
+#define wxSTC_SCRIPTOL_DEFAULT 0
+#define wxSTC_SCRIPTOL_WHITE 1
+#define wxSTC_SCRIPTOL_COMMENTLINE 2
+#define wxSTC_SCRIPTOL_PERSISTENT 3
+#define wxSTC_SCRIPTOL_CSTYLE 4
+#define wxSTC_SCRIPTOL_COMMENTBLOCK 5
+#define wxSTC_SCRIPTOL_NUMBER 6
+#define wxSTC_SCRIPTOL_STRING 7
+#define wxSTC_SCRIPTOL_CHARACTER 8
+#define wxSTC_SCRIPTOL_STRINGEOL 9
+#define wxSTC_SCRIPTOL_KEYWORD 10
+#define wxSTC_SCRIPTOL_OPERATOR 11
+#define wxSTC_SCRIPTOL_IDENTIFIER 12
+#define wxSTC_SCRIPTOL_TRIPLE 13
+#define wxSTC_SCRIPTOL_CLASSNAME 14
+#define wxSTC_SCRIPTOL_PREPROCESSOR 15
+
+/// Lexical states for SCLEX_ASM
+#define wxSTC_ASM_DEFAULT 0
+#define wxSTC_ASM_COMMENT 1
+#define wxSTC_ASM_NUMBER 2
+#define wxSTC_ASM_STRING 3
+#define wxSTC_ASM_OPERATOR 4
+#define wxSTC_ASM_IDENTIFIER 5
+#define wxSTC_ASM_CPUINSTRUCTION 6
+#define wxSTC_ASM_MATHINSTRUCTION 7
+#define wxSTC_ASM_REGISTER 8
+#define wxSTC_ASM_DIRECTIVE 9
+#define wxSTC_ASM_DIRECTIVEOPERAND 10
+#define wxSTC_ASM_COMMENTBLOCK 11
+#define wxSTC_ASM_CHARACTER 12
+#define wxSTC_ASM_STRINGEOL 13
+#define wxSTC_ASM_EXTINSTRUCTION 14
+#define wxSTC_ASM_COMMENTDIRECTIVE 15
+
+/// Lexical states for SCLEX_FORTRAN
+#define wxSTC_F_DEFAULT 0
+#define wxSTC_F_COMMENT 1
+#define wxSTC_F_NUMBER 2
+#define wxSTC_F_STRING1 3
+#define wxSTC_F_STRING2 4
+#define wxSTC_F_STRINGEOL 5
+#define wxSTC_F_OPERATOR 6
+#define wxSTC_F_IDENTIFIER 7
+#define wxSTC_F_WORD 8
+#define wxSTC_F_WORD2 9
+#define wxSTC_F_WORD3 10
+#define wxSTC_F_PREPROCESSOR 11
+#define wxSTC_F_OPERATOR2 12
+#define wxSTC_F_LABEL 13
+#define wxSTC_F_CONTINUATION 14
+
+/// Lexical states for SCLEX_CSS
+#define wxSTC_CSS_DEFAULT 0
+#define wxSTC_CSS_TAG 1
+#define wxSTC_CSS_CLASS 2
+#define wxSTC_CSS_PSEUDOCLASS 3
+#define wxSTC_CSS_UNKNOWN_PSEUDOCLASS 4
+#define wxSTC_CSS_OPERATOR 5
+#define wxSTC_CSS_IDENTIFIER 6
+#define wxSTC_CSS_UNKNOWN_IDENTIFIER 7
+#define wxSTC_CSS_VALUE 8
+#define wxSTC_CSS_COMMENT 9
+#define wxSTC_CSS_ID 10
+#define wxSTC_CSS_IMPORTANT 11
+#define wxSTC_CSS_DIRECTIVE 12
+#define wxSTC_CSS_DOUBLESTRING 13
+#define wxSTC_CSS_SINGLESTRING 14
+#define wxSTC_CSS_IDENTIFIER2 15
+#define wxSTC_CSS_ATTRIBUTE 16
+#define wxSTC_CSS_IDENTIFIER3 17
+#define wxSTC_CSS_PSEUDOELEMENT 18
+#define wxSTC_CSS_EXTENDED_IDENTIFIER 19
+#define wxSTC_CSS_EXTENDED_PSEUDOCLASS 20
+#define wxSTC_CSS_EXTENDED_PSEUDOELEMENT 21
+#define wxSTC_CSS_MEDIA 22
+#define wxSTC_CSS_VARIABLE 23
+
+/// Lexical states for SCLEX_POV
+#define wxSTC_POV_DEFAULT 0
+#define wxSTC_POV_COMMENT 1
+#define wxSTC_POV_COMMENTLINE 2
+#define wxSTC_POV_NUMBER 3
+#define wxSTC_POV_OPERATOR 4
+#define wxSTC_POV_IDENTIFIER 5
+#define wxSTC_POV_STRING 6
+#define wxSTC_POV_STRINGEOL 7
+#define wxSTC_POV_DIRECTIVE 8
+#define wxSTC_POV_BADDIRECTIVE 9
+#define wxSTC_POV_WORD2 10
+#define wxSTC_POV_WORD3 11
+#define wxSTC_POV_WORD4 12
+#define wxSTC_POV_WORD5 13
+#define wxSTC_POV_WORD6 14
+#define wxSTC_POV_WORD7 15
+#define wxSTC_POV_WORD8 16
+
+/// Lexical states for SCLEX_LOUT
+#define wxSTC_LOUT_DEFAULT 0
+#define wxSTC_LOUT_COMMENT 1
+#define wxSTC_LOUT_NUMBER 2
+#define wxSTC_LOUT_WORD 3
+#define wxSTC_LOUT_WORD2 4
+#define wxSTC_LOUT_WORD3 5
+#define wxSTC_LOUT_WORD4 6
+#define wxSTC_LOUT_STRING 7
+#define wxSTC_LOUT_OPERATOR 8
+#define wxSTC_LOUT_IDENTIFIER 9
+#define wxSTC_LOUT_STRINGEOL 10
+
+/// Lexical states for SCLEX_ESCRIPT
+#define wxSTC_ESCRIPT_DEFAULT 0
+#define wxSTC_ESCRIPT_COMMENT 1
+#define wxSTC_ESCRIPT_COMMENTLINE 2
+#define wxSTC_ESCRIPT_COMMENTDOC 3
+#define wxSTC_ESCRIPT_NUMBER 4
+#define wxSTC_ESCRIPT_WORD 5
+#define wxSTC_ESCRIPT_STRING 6
+#define wxSTC_ESCRIPT_OPERATOR 7
+#define wxSTC_ESCRIPT_IDENTIFIER 8
+#define wxSTC_ESCRIPT_BRACE 9
+#define wxSTC_ESCRIPT_WORD2 10
+#define wxSTC_ESCRIPT_WORD3 11
+
+/// Lexical states for SCLEX_PS
+#define wxSTC_PS_DEFAULT 0
+#define wxSTC_PS_COMMENT 1
+#define wxSTC_PS_DSC_COMMENT 2
+#define wxSTC_PS_DSC_VALUE 3
+#define wxSTC_PS_NUMBER 4
+#define wxSTC_PS_NAME 5
+#define wxSTC_PS_KEYWORD 6
+#define wxSTC_PS_LITERAL 7
+#define wxSTC_PS_IMMEVAL 8
+#define wxSTC_PS_PAREN_ARRAY 9
+#define wxSTC_PS_PAREN_DICT 10
+#define wxSTC_PS_PAREN_PROC 11
+#define wxSTC_PS_TEXT 12
+#define wxSTC_PS_HEXSTRING 13
+#define wxSTC_PS_BASE85STRING 14
+#define wxSTC_PS_BADSTRINGCHAR 15
+
+/// Lexical states for SCLEX_NSIS
+#define wxSTC_NSIS_DEFAULT 0
+#define wxSTC_NSIS_COMMENT 1
+#define wxSTC_NSIS_STRINGDQ 2
+#define wxSTC_NSIS_STRINGLQ 3
+#define wxSTC_NSIS_STRINGRQ 4
+#define wxSTC_NSIS_FUNCTION 5
+#define wxSTC_NSIS_VARIABLE 6
+#define wxSTC_NSIS_LABEL 7
+#define wxSTC_NSIS_USERDEFINED 8
+#define wxSTC_NSIS_SECTIONDEF 9
+#define wxSTC_NSIS_SUBSECTIONDEF 10
+#define wxSTC_NSIS_IFDEFINEDEF 11
+#define wxSTC_NSIS_MACRODEF 12
+#define wxSTC_NSIS_STRINGVAR 13
+#define wxSTC_NSIS_NUMBER 14
+#define wxSTC_NSIS_SECTIONGROUP 15
+#define wxSTC_NSIS_PAGEEX 16
+#define wxSTC_NSIS_FUNCTIONDEF 17
+#define wxSTC_NSIS_COMMENTBOX 18
+
+/// Lexical states for SCLEX_MMIXAL
+#define wxSTC_MMIXAL_LEADWS 0
+#define wxSTC_MMIXAL_COMMENT 1
+#define wxSTC_MMIXAL_LABEL 2
+#define wxSTC_MMIXAL_OPCODE 3
+#define wxSTC_MMIXAL_OPCODE_PRE 4
+#define wxSTC_MMIXAL_OPCODE_VALID 5
+#define wxSTC_MMIXAL_OPCODE_UNKNOWN 6
+#define wxSTC_MMIXAL_OPCODE_POST 7
+#define wxSTC_MMIXAL_OPERANDS 8
+#define wxSTC_MMIXAL_NUMBER 9
+#define wxSTC_MMIXAL_REF 10
+#define wxSTC_MMIXAL_CHAR 11
+#define wxSTC_MMIXAL_STRING 12
+#define wxSTC_MMIXAL_REGISTER 13
+#define wxSTC_MMIXAL_HEX 14
+#define wxSTC_MMIXAL_OPERATOR 15
+#define wxSTC_MMIXAL_SYMBOL 16
+#define wxSTC_MMIXAL_INCLUDE 17
+
+/// Lexical states for SCLEX_CLW
+#define wxSTC_CLW_DEFAULT 0
+#define wxSTC_CLW_LABEL 1
+#define wxSTC_CLW_COMMENT 2
+#define wxSTC_CLW_STRING 3
+#define wxSTC_CLW_USER_IDENTIFIER 4
+#define wxSTC_CLW_INTEGER_CONSTANT 5
+#define wxSTC_CLW_REAL_CONSTANT 6
+#define wxSTC_CLW_PICTURE_STRING 7
+#define wxSTC_CLW_KEYWORD 8
+#define wxSTC_CLW_COMPILER_DIRECTIVE 9
+#define wxSTC_CLW_RUNTIME_EXPRESSIONS 10
+#define wxSTC_CLW_BUILTIN_PROCEDURES_FUNCTION 11
+#define wxSTC_CLW_STRUCTURE_DATA_TYPE 12
+#define wxSTC_CLW_ATTRIBUTE 13
+#define wxSTC_CLW_STANDARD_EQUATE 14
+#define wxSTC_CLW_ERROR 15
+#define wxSTC_CLW_DEPRECATED 16
+
+/// Lexical states for SCLEX_LOT
+#define wxSTC_LOT_DEFAULT 0
+#define wxSTC_LOT_HEADER 1
+#define wxSTC_LOT_BREAK 2
+#define wxSTC_LOT_SET 3
+#define wxSTC_LOT_PASS 4
+#define wxSTC_LOT_FAIL 5
+#define wxSTC_LOT_ABORT 6
+
+/// Lexical states for SCLEX_YAML
+#define wxSTC_YAML_DEFAULT 0
+#define wxSTC_YAML_COMMENT 1
+#define wxSTC_YAML_IDENTIFIER 2
+#define wxSTC_YAML_KEYWORD 3
+#define wxSTC_YAML_NUMBER 4
+#define wxSTC_YAML_REFERENCE 5
+#define wxSTC_YAML_DOCUMENT 6
+#define wxSTC_YAML_TEXT 7
+#define wxSTC_YAML_ERROR 8
+#define wxSTC_YAML_OPERATOR 9
+
+/// Lexical states for SCLEX_TEX
+#define wxSTC_TEX_DEFAULT 0
+#define wxSTC_TEX_SPECIAL 1
+#define wxSTC_TEX_GROUP 2
+#define wxSTC_TEX_SYMBOL 3
+#define wxSTC_TEX_COMMAND 4
+#define wxSTC_TEX_TEXT 5
+#define wxSTC_METAPOST_DEFAULT 0
+#define wxSTC_METAPOST_SPECIAL 1
+#define wxSTC_METAPOST_GROUP 2
+#define wxSTC_METAPOST_SYMBOL 3
+#define wxSTC_METAPOST_COMMAND 4
+#define wxSTC_METAPOST_TEXT 5
+#define wxSTC_METAPOST_EXTRA 6
+
+/// Lexical states for SCLEX_ERLANG
+#define wxSTC_ERLANG_DEFAULT 0
+#define wxSTC_ERLANG_COMMENT 1
+#define wxSTC_ERLANG_VARIABLE 2
+#define wxSTC_ERLANG_NUMBER 3
+#define wxSTC_ERLANG_KEYWORD 4
+#define wxSTC_ERLANG_STRING 5
+#define wxSTC_ERLANG_OPERATOR 6
+#define wxSTC_ERLANG_ATOM 7
+#define wxSTC_ERLANG_FUNCTION_NAME 8
+#define wxSTC_ERLANG_CHARACTER 9
+#define wxSTC_ERLANG_MACRO 10
+#define wxSTC_ERLANG_RECORD 11
+#define wxSTC_ERLANG_PREPROC 12
+#define wxSTC_ERLANG_NODE_NAME 13
+#define wxSTC_ERLANG_COMMENT_FUNCTION 14
+#define wxSTC_ERLANG_COMMENT_MODULE 15
+#define wxSTC_ERLANG_COMMENT_DOC 16
+#define wxSTC_ERLANG_COMMENT_DOC_MACRO 17
+#define wxSTC_ERLANG_ATOM_QUOTED 18
+#define wxSTC_ERLANG_MACRO_QUOTED 19
+#define wxSTC_ERLANG_RECORD_QUOTED 20
+#define wxSTC_ERLANG_NODE_NAME_QUOTED 21
+#define wxSTC_ERLANG_BIFS 22
+#define wxSTC_ERLANG_MODULES 23
+#define wxSTC_ERLANG_MODULES_ATT 24
+#define wxSTC_ERLANG_UNKNOWN 31
+
+/// Lexical states for SCLEX_OCTAVE are identical to MatLab
+/// Lexical states for SCLEX_MSSQL
+#define wxSTC_MSSQL_DEFAULT 0
+#define wxSTC_MSSQL_COMMENT 1
+#define wxSTC_MSSQL_LINE_COMMENT 2
+#define wxSTC_MSSQL_NUMBER 3
+#define wxSTC_MSSQL_STRING 4
+#define wxSTC_MSSQL_OPERATOR 5
+#define wxSTC_MSSQL_IDENTIFIER 6
+#define wxSTC_MSSQL_VARIABLE 7
+#define wxSTC_MSSQL_COLUMN_NAME 8
+#define wxSTC_MSSQL_STATEMENT 9
+#define wxSTC_MSSQL_DATATYPE 10
+#define wxSTC_MSSQL_SYSTABLE 11
+#define wxSTC_MSSQL_GLOBAL_VARIABLE 12
+#define wxSTC_MSSQL_FUNCTION 13
+#define wxSTC_MSSQL_STORED_PROCEDURE 14
+#define wxSTC_MSSQL_DEFAULT_PREF_DATATYPE 15
+#define wxSTC_MSSQL_COLUMN_NAME_2 16
+
+/// Lexical states for SCLEX_VERILOG
+#define wxSTC_V_DEFAULT 0
+#define wxSTC_V_COMMENT 1
+#define wxSTC_V_COMMENTLINE 2
+#define wxSTC_V_COMMENTLINEBANG 3
+#define wxSTC_V_NUMBER 4
+#define wxSTC_V_WORD 5
+#define wxSTC_V_STRING 6
+#define wxSTC_V_WORD2 7
+#define wxSTC_V_WORD3 8
+#define wxSTC_V_PREPROCESSOR 9
+#define wxSTC_V_OPERATOR 10
+#define wxSTC_V_IDENTIFIER 11
+#define wxSTC_V_STRINGEOL 12
+#define wxSTC_V_USER 19
+
+/// Lexical states for SCLEX_KIX
+#define wxSTC_KIX_DEFAULT 0
+#define wxSTC_KIX_COMMENT 1
+#define wxSTC_KIX_STRING1 2
+#define wxSTC_KIX_STRING2 3
+#define wxSTC_KIX_NUMBER 4
+#define wxSTC_KIX_VAR 5
+#define wxSTC_KIX_MACRO 6
+#define wxSTC_KIX_KEYWORD 7
+#define wxSTC_KIX_FUNCTIONS 8
+#define wxSTC_KIX_OPERATOR 9
+#define wxSTC_KIX_IDENTIFIER 31
+
+/// Lexical states for SCLEX_GUI4CLI
+#define wxSTC_GC_DEFAULT 0
+#define wxSTC_GC_COMMENTLINE 1
+#define wxSTC_GC_COMMENTBLOCK 2
+#define wxSTC_GC_GLOBAL 3
+#define wxSTC_GC_EVENT 4
+#define wxSTC_GC_ATTRIBUTE 5
+#define wxSTC_GC_CONTROL 6
+#define wxSTC_GC_COMMAND 7
+#define wxSTC_GC_STRING 8
+#define wxSTC_GC_OPERATOR 9
+
+/// Lexical states for SCLEX_SPECMAN
+#define wxSTC_SN_DEFAULT 0
+#define wxSTC_SN_CODE 1
+#define wxSTC_SN_COMMENTLINE 2
+#define wxSTC_SN_COMMENTLINEBANG 3
+#define wxSTC_SN_NUMBER 4
+#define wxSTC_SN_WORD 5
+#define wxSTC_SN_STRING 6
+#define wxSTC_SN_WORD2 7
+#define wxSTC_SN_WORD3 8
+#define wxSTC_SN_PREPROCESSOR 9
+#define wxSTC_SN_OPERATOR 10
+#define wxSTC_SN_IDENTIFIER 11
+#define wxSTC_SN_STRINGEOL 12
+#define wxSTC_SN_REGEXTAG 13
+#define wxSTC_SN_SIGNAL 14
+#define wxSTC_SN_USER 19
+
+/// Lexical states for SCLEX_AU3
+#define wxSTC_AU3_DEFAULT 0
+#define wxSTC_AU3_COMMENT 1
+#define wxSTC_AU3_COMMENTBLOCK 2
+#define wxSTC_AU3_NUMBER 3
+#define wxSTC_AU3_FUNCTION 4
+#define wxSTC_AU3_KEYWORD 5
+#define wxSTC_AU3_MACRO 6
+#define wxSTC_AU3_STRING 7
+#define wxSTC_AU3_OPERATOR 8
+#define wxSTC_AU3_VARIABLE 9
+#define wxSTC_AU3_SENT 10
+#define wxSTC_AU3_PREPROCESSOR 11
+#define wxSTC_AU3_SPECIAL 12
+#define wxSTC_AU3_EXPAND 13
+#define wxSTC_AU3_COMOBJ 14
+#define wxSTC_AU3_UDF 15
+
+/// Lexical states for SCLEX_APDL
+#define wxSTC_APDL_DEFAULT 0
+#define wxSTC_APDL_COMMENT 1
+#define wxSTC_APDL_COMMENTBLOCK 2
+#define wxSTC_APDL_NUMBER 3
+#define wxSTC_APDL_STRING 4
+#define wxSTC_APDL_OPERATOR 5
+#define wxSTC_APDL_WORD 6
+#define wxSTC_APDL_PROCESSOR 7
+#define wxSTC_APDL_COMMAND 8
+#define wxSTC_APDL_SLASHCOMMAND 9
+#define wxSTC_APDL_STARCOMMAND 10
+#define wxSTC_APDL_ARGUMENT 11
+#define wxSTC_APDL_FUNCTION 12
+
+/// Lexical states for SCLEX_BASH
+#define wxSTC_SH_DEFAULT 0
+#define wxSTC_SH_ERROR 1
+#define wxSTC_SH_COMMENTLINE 2
+#define wxSTC_SH_NUMBER 3
+#define wxSTC_SH_WORD 4
+#define wxSTC_SH_STRING 5
+#define wxSTC_SH_CHARACTER 6
+#define wxSTC_SH_OPERATOR 7
+#define wxSTC_SH_IDENTIFIER 8
+#define wxSTC_SH_SCALAR 9
+#define wxSTC_SH_PARAM 10
+#define wxSTC_SH_BACKTICKS 11
+#define wxSTC_SH_HERE_DELIM 12
+#define wxSTC_SH_HERE_Q 13
+
+/// Lexical states for SCLEX_ASN1
+#define wxSTC_ASN1_DEFAULT 0
+#define wxSTC_ASN1_COMMENT 1
+#define wxSTC_ASN1_IDENTIFIER 2
+#define wxSTC_ASN1_STRING 3
+#define wxSTC_ASN1_OID 4
+#define wxSTC_ASN1_SCALAR 5
+#define wxSTC_ASN1_KEYWORD 6
+#define wxSTC_ASN1_ATTRIBUTE 7
+#define wxSTC_ASN1_DESCRIPTOR 8
+#define wxSTC_ASN1_TYPE 9
+#define wxSTC_ASN1_OPERATOR 10
+
+/// Lexical states for SCLEX_VHDL
+#define wxSTC_VHDL_DEFAULT 0
+#define wxSTC_VHDL_COMMENT 1
+#define wxSTC_VHDL_COMMENTLINEBANG 2
+#define wxSTC_VHDL_NUMBER 3
+#define wxSTC_VHDL_STRING 4
+#define wxSTC_VHDL_OPERATOR 5
+#define wxSTC_VHDL_IDENTIFIER 6
+#define wxSTC_VHDL_STRINGEOL 7
+#define wxSTC_VHDL_KEYWORD 8
+#define wxSTC_VHDL_STDOPERATOR 9
+#define wxSTC_VHDL_ATTRIBUTE 10
+#define wxSTC_VHDL_STDFUNCTION 11
+#define wxSTC_VHDL_STDPACKAGE 12
+#define wxSTC_VHDL_STDTYPE 13
+#define wxSTC_VHDL_USERWORD 14
+
+/// Lexical states for SCLEX_CAML
+#define wxSTC_CAML_DEFAULT 0
+#define wxSTC_CAML_IDENTIFIER 1
+#define wxSTC_CAML_TAGNAME 2
+#define wxSTC_CAML_KEYWORD 3
+#define wxSTC_CAML_KEYWORD2 4
+#define wxSTC_CAML_KEYWORD3 5
+#define wxSTC_CAML_LINENUM 6
+#define wxSTC_CAML_OPERATOR 7
+#define wxSTC_CAML_NUMBER 8
+#define wxSTC_CAML_CHAR 9
+#define wxSTC_CAML_WHITE 10
+#define wxSTC_CAML_STRING 11
+#define wxSTC_CAML_COMMENT 12
+#define wxSTC_CAML_COMMENT1 13
+#define wxSTC_CAML_COMMENT2 14
+#define wxSTC_CAML_COMMENT3 15
+
+/// Lexical states for SCLEX_HASKELL
+#define wxSTC_HA_DEFAULT 0
+#define wxSTC_HA_IDENTIFIER 1
+#define wxSTC_HA_KEYWORD 2
+#define wxSTC_HA_NUMBER 3
+#define wxSTC_HA_STRING 4
+#define wxSTC_HA_CHARACTER 5
+#define wxSTC_HA_CLASS 6
+#define wxSTC_HA_MODULE 7
+#define wxSTC_HA_CAPITAL 8
+#define wxSTC_HA_DATA 9
+#define wxSTC_HA_IMPORT 10
+#define wxSTC_HA_OPERATOR 11
+#define wxSTC_HA_INSTANCE 12
+#define wxSTC_HA_COMMENTLINE 13
+#define wxSTC_HA_COMMENTBLOCK 14
+#define wxSTC_HA_COMMENTBLOCK2 15
+#define wxSTC_HA_COMMENTBLOCK3 16
+
+/// Lexical states of SCLEX_TADS3
+#define wxSTC_T3_DEFAULT 0
+#define wxSTC_T3_X_DEFAULT 1
+#define wxSTC_T3_PREPROCESSOR 2
+#define wxSTC_T3_BLOCK_COMMENT 3
+#define wxSTC_T3_LINE_COMMENT 4
+#define wxSTC_T3_OPERATOR 5
+#define wxSTC_T3_KEYWORD 6
+#define wxSTC_T3_NUMBER 7
+#define wxSTC_T3_IDENTIFIER 8
+#define wxSTC_T3_S_STRING 9
+#define wxSTC_T3_D_STRING 10
+#define wxSTC_T3_X_STRING 11
+#define wxSTC_T3_LIB_DIRECTIVE 12
+#define wxSTC_T3_MSG_PARAM 13
+#define wxSTC_T3_HTML_TAG 14
+#define wxSTC_T3_HTML_DEFAULT 15
+#define wxSTC_T3_HTML_STRING 16
+#define wxSTC_T3_USER1 17
+#define wxSTC_T3_USER2 18
+#define wxSTC_T3_USER3 19
+#define wxSTC_T3_BRACE 20
+
+/// Lexical states for SCLEX_REBOL
+#define wxSTC_REBOL_DEFAULT 0
+#define wxSTC_REBOL_COMMENTLINE 1
+#define wxSTC_REBOL_COMMENTBLOCK 2
+#define wxSTC_REBOL_PREFACE 3
+#define wxSTC_REBOL_OPERATOR 4
+#define wxSTC_REBOL_CHARACTER 5
+#define wxSTC_REBOL_QUOTEDSTRING 6
+#define wxSTC_REBOL_BRACEDSTRING 7
+#define wxSTC_REBOL_NUMBER 8
+#define wxSTC_REBOL_PAIR 9
+#define wxSTC_REBOL_TUPLE 10
+#define wxSTC_REBOL_BINARY 11
+#define wxSTC_REBOL_MONEY 12
+#define wxSTC_REBOL_ISSUE 13
+#define wxSTC_REBOL_TAG 14
+#define wxSTC_REBOL_FILE 15
+#define wxSTC_REBOL_EMAIL 16
+#define wxSTC_REBOL_URL 17
+#define wxSTC_REBOL_DATE 18
+#define wxSTC_REBOL_TIME 19
+#define wxSTC_REBOL_IDENTIFIER 20
+#define wxSTC_REBOL_WORD 21
+#define wxSTC_REBOL_WORD2 22
+#define wxSTC_REBOL_WORD3 23
+#define wxSTC_REBOL_WORD4 24
+#define wxSTC_REBOL_WORD5 25
+#define wxSTC_REBOL_WORD6 26
+#define wxSTC_REBOL_WORD7 27
+#define wxSTC_REBOL_WORD8 28
+
+/// Lexical states for SCLEX_SQL
+#define wxSTC_SQL_DEFAULT 0
+#define wxSTC_SQL_COMMENT 1
+#define wxSTC_SQL_COMMENTLINE 2
+#define wxSTC_SQL_COMMENTDOC 3
+#define wxSTC_SQL_NUMBER 4
+#define wxSTC_SQL_WORD 5
+#define wxSTC_SQL_STRING 6
+#define wxSTC_SQL_CHARACTER 7
+#define wxSTC_SQL_SQLPLUS 8
+#define wxSTC_SQL_SQLPLUS_PROMPT 9
+#define wxSTC_SQL_OPERATOR 10
+#define wxSTC_SQL_IDENTIFIER 11
+#define wxSTC_SQL_SQLPLUS_COMMENT 13
+#define wxSTC_SQL_COMMENTLINEDOC 15
+#define wxSTC_SQL_WORD2 16
+#define wxSTC_SQL_COMMENTDOCKEYWORD 17
+#define wxSTC_SQL_COMMENTDOCKEYWORDERROR 18
+#define wxSTC_SQL_USER1 19
+#define wxSTC_SQL_USER2 20
+#define wxSTC_SQL_USER3 21
+#define wxSTC_SQL_USER4 22
+#define wxSTC_SQL_QUOTEDIDENTIFIER 23
+
+/// Lexical states for SCLEX_SMALLTALK
+#define wxSTC_ST_DEFAULT 0
+#define wxSTC_ST_STRING 1
+#define wxSTC_ST_NUMBER 2
+#define wxSTC_ST_COMMENT 3
+#define wxSTC_ST_SYMBOL 4
+#define wxSTC_ST_BINARY 5
+#define wxSTC_ST_BOOL 6
+#define wxSTC_ST_SELF 7
+#define wxSTC_ST_SUPER 8
+#define wxSTC_ST_NIL 9
+#define wxSTC_ST_GLOBAL 10
+#define wxSTC_ST_RETURN 11
+#define wxSTC_ST_SPECIAL 12
+#define wxSTC_ST_KWSEND 13
+#define wxSTC_ST_ASSIGN 14
+#define wxSTC_ST_CHARACTER 15
+#define wxSTC_ST_SPEC_SEL 16
+
+/// Lexical states for SCLEX_FLAGSHIP (clipper)
+#define wxSTC_FS_DEFAULT 0
+#define wxSTC_FS_COMMENT 1
+#define wxSTC_FS_COMMENTLINE 2
+#define wxSTC_FS_COMMENTDOC 3
+#define wxSTC_FS_COMMENTLINEDOC 4
+#define wxSTC_FS_COMMENTDOCKEYWORD 5
+#define wxSTC_FS_COMMENTDOCKEYWORDERROR 6
+#define wxSTC_FS_KEYWORD 7
+#define wxSTC_FS_KEYWORD2 8
+#define wxSTC_FS_KEYWORD3 9
+#define wxSTC_FS_KEYWORD4 10
+#define wxSTC_FS_NUMBER 11
+#define wxSTC_FS_STRING 12
+#define wxSTC_FS_PREPROCESSOR 13
+#define wxSTC_FS_OPERATOR 14
+#define wxSTC_FS_IDENTIFIER 15
+#define wxSTC_FS_DATE 16
+#define wxSTC_FS_STRINGEOL 17
+#define wxSTC_FS_CONSTANT 18
+#define wxSTC_FS_WORDOPERATOR 19
+#define wxSTC_FS_DISABLEDCODE 20
+#define wxSTC_FS_DEFAULT_C 21
+#define wxSTC_FS_COMMENTDOC_C 22
+#define wxSTC_FS_COMMENTLINEDOC_C 23
+#define wxSTC_FS_KEYWORD_C 24
+#define wxSTC_FS_KEYWORD2_C 25
+#define wxSTC_FS_NUMBER_C 26
+#define wxSTC_FS_STRING_C 27
+#define wxSTC_FS_PREPROCESSOR_C 28
+#define wxSTC_FS_OPERATOR_C 29
+#define wxSTC_FS_IDENTIFIER_C 30
+#define wxSTC_FS_STRINGEOL_C 31
+
+/// Lexical states for SCLEX_CSOUND
+#define wxSTC_CSOUND_DEFAULT 0
+#define wxSTC_CSOUND_COMMENT 1
+#define wxSTC_CSOUND_NUMBER 2
+#define wxSTC_CSOUND_OPERATOR 3
+#define wxSTC_CSOUND_INSTR 4
+#define wxSTC_CSOUND_IDENTIFIER 5
+#define wxSTC_CSOUND_OPCODE 6
+#define wxSTC_CSOUND_HEADERSTMT 7
+#define wxSTC_CSOUND_USERKEYWORD 8
+#define wxSTC_CSOUND_COMMENTBLOCK 9
+#define wxSTC_CSOUND_PARAM 10
+#define wxSTC_CSOUND_ARATE_VAR 11
+#define wxSTC_CSOUND_KRATE_VAR 12
+#define wxSTC_CSOUND_IRATE_VAR 13
+#define wxSTC_CSOUND_GLOBAL_VAR 14
+#define wxSTC_CSOUND_STRINGEOL 15
+
+/// Lexical states for SCLEX_INNOSETUP
+#define wxSTC_INNO_DEFAULT 0
+#define wxSTC_INNO_COMMENT 1
+#define wxSTC_INNO_KEYWORD 2
+#define wxSTC_INNO_PARAMETER 3
+#define wxSTC_INNO_SECTION 4
+#define wxSTC_INNO_PREPROC 5
+#define wxSTC_INNO_INLINE_EXPANSION 6
+#define wxSTC_INNO_COMMENT_PASCAL 7
+#define wxSTC_INNO_KEYWORD_PASCAL 8
+#define wxSTC_INNO_KEYWORD_USER 9
+#define wxSTC_INNO_STRING_DOUBLE 10
+#define wxSTC_INNO_STRING_SINGLE 11
+#define wxSTC_INNO_IDENTIFIER 12
+
+/// Lexical states for SCLEX_OPAL
+#define wxSTC_OPAL_SPACE 0
+#define wxSTC_OPAL_COMMENT_BLOCK 1
+#define wxSTC_OPAL_COMMENT_LINE 2
+#define wxSTC_OPAL_INTEGER 3
+#define wxSTC_OPAL_KEYWORD 4
+#define wxSTC_OPAL_SORT 5
+#define wxSTC_OPAL_STRING 6
+#define wxSTC_OPAL_PAR 7
+#define wxSTC_OPAL_BOOL_CONST 8
+#define wxSTC_OPAL_DEFAULT 32
+
+/// Lexical states for SCLEX_SPICE
+#define wxSTC_SPICE_DEFAULT 0
+#define wxSTC_SPICE_IDENTIFIER 1
+#define wxSTC_SPICE_KEYWORD 2
+#define wxSTC_SPICE_KEYWORD2 3
+#define wxSTC_SPICE_KEYWORD3 4
+#define wxSTC_SPICE_NUMBER 5
+#define wxSTC_SPICE_DELIMITER 6
+#define wxSTC_SPICE_VALUE 7
+#define wxSTC_SPICE_COMMENTLINE 8
+
+/// Lexical states for SCLEX_CMAKE
+#define wxSTC_CMAKE_DEFAULT 0
+#define wxSTC_CMAKE_COMMENT 1
+#define wxSTC_CMAKE_STRINGDQ 2
+#define wxSTC_CMAKE_STRINGLQ 3
+#define wxSTC_CMAKE_STRINGRQ 4
+#define wxSTC_CMAKE_COMMANDS 5
+#define wxSTC_CMAKE_PARAMETERS 6
+#define wxSTC_CMAKE_VARIABLE 7
+#define wxSTC_CMAKE_USERDEFINED 8
+#define wxSTC_CMAKE_WHILEDEF 9
+#define wxSTC_CMAKE_FOREACHDEF 10
+#define wxSTC_CMAKE_IFDEFINEDEF 11
+#define wxSTC_CMAKE_MACRODEF 12
+#define wxSTC_CMAKE_STRINGVAR 13
+#define wxSTC_CMAKE_NUMBER 14
+
+/// Lexical states for SCLEX_GAP
+#define wxSTC_GAP_DEFAULT 0
+#define wxSTC_GAP_IDENTIFIER 1
+#define wxSTC_GAP_KEYWORD 2
+#define wxSTC_GAP_KEYWORD2 3
+#define wxSTC_GAP_KEYWORD3 4
+#define wxSTC_GAP_KEYWORD4 5
+#define wxSTC_GAP_STRING 6
+#define wxSTC_GAP_CHAR 7
+#define wxSTC_GAP_OPERATOR 8
+#define wxSTC_GAP_COMMENT 9
+#define wxSTC_GAP_NUMBER 10
+#define wxSTC_GAP_STRINGEOL 11
+
+/// Lexical state for SCLEX_PLM
+#define wxSTC_PLM_DEFAULT 0
+#define wxSTC_PLM_COMMENT 1
+#define wxSTC_PLM_STRING 2
+#define wxSTC_PLM_NUMBER 3
+#define wxSTC_PLM_IDENTIFIER 4
+#define wxSTC_PLM_OPERATOR 5
+#define wxSTC_PLM_CONTROL 6
+#define wxSTC_PLM_KEYWORD 7
+
+/// Lexical state for SCLEX_PROGRESS
+#define wxSTC_4GL_DEFAULT 0
+#define wxSTC_4GL_NUMBER 1
+#define wxSTC_4GL_WORD 2
+#define wxSTC_4GL_STRING 3
+#define wxSTC_4GL_CHARACTER 4
+#define wxSTC_4GL_PREPROCESSOR 5
+#define wxSTC_4GL_OPERATOR 6
+#define wxSTC_4GL_IDENTIFIER 7
+#define wxSTC_4GL_BLOCK 8
+#define wxSTC_4GL_END 9
+#define wxSTC_4GL_COMMENT1 10
+#define wxSTC_4GL_COMMENT2 11
+#define wxSTC_4GL_COMMENT3 12
+#define wxSTC_4GL_COMMENT4 13
+#define wxSTC_4GL_COMMENT5 14
+#define wxSTC_4GL_COMMENT6 15
+#define wxSTC_4GL_DEFAULT_ 16
+#define wxSTC_4GL_NUMBER_ 17
+#define wxSTC_4GL_WORD_ 18
+#define wxSTC_4GL_STRING_ 19
+#define wxSTC_4GL_CHARACTER_ 20
+#define wxSTC_4GL_PREPROCESSOR_ 21
+#define wxSTC_4GL_OPERATOR_ 22
+#define wxSTC_4GL_IDENTIFIER_ 23
+#define wxSTC_4GL_BLOCK_ 24
+#define wxSTC_4GL_END_ 25
+#define wxSTC_4GL_COMMENT1_ 26
+#define wxSTC_4GL_COMMENT2_ 27
+#define wxSTC_4GL_COMMENT3_ 28
+#define wxSTC_4GL_COMMENT4_ 29
+#define wxSTC_4GL_COMMENT5_ 30
+#define wxSTC_4GL_COMMENT6_ 31
+
+/// Lexical states for SCLEX_ABAQUS
+#define wxSTC_ABAQUS_DEFAULT 0
+#define wxSTC_ABAQUS_COMMENT 1
+#define wxSTC_ABAQUS_COMMENTBLOCK 2
+#define wxSTC_ABAQUS_NUMBER 3
+#define wxSTC_ABAQUS_STRING 4
+#define wxSTC_ABAQUS_OPERATOR 5
+#define wxSTC_ABAQUS_WORD 6
+#define wxSTC_ABAQUS_PROCESSOR 7
+#define wxSTC_ABAQUS_COMMAND 8
+#define wxSTC_ABAQUS_SLASHCOMMAND 9
+#define wxSTC_ABAQUS_STARCOMMAND 10
+#define wxSTC_ABAQUS_ARGUMENT 11
+#define wxSTC_ABAQUS_FUNCTION 12
+
+/// Lexical states for SCLEX_ASYMPTOTE
+#define wxSTC_ASY_DEFAULT 0
+#define wxSTC_ASY_COMMENT 1
+#define wxSTC_ASY_COMMENTLINE 2
+#define wxSTC_ASY_NUMBER 3
+#define wxSTC_ASY_WORD 4
+#define wxSTC_ASY_STRING 5
+#define wxSTC_ASY_CHARACTER 6
+#define wxSTC_ASY_OPERATOR 7
+#define wxSTC_ASY_IDENTIFIER 8
+#define wxSTC_ASY_STRINGEOL 9
+#define wxSTC_ASY_COMMENTLINEDOC 10
+#define wxSTC_ASY_WORD2 11
+
+/// Lexical states for SCLEX_R
+#define wxSTC_R_DEFAULT 0
+#define wxSTC_R_COMMENT 1
+#define wxSTC_R_KWORD 2
+#define wxSTC_R_BASEKWORD 3
+#define wxSTC_R_OTHERKWORD 4
+#define wxSTC_R_NUMBER 5
+#define wxSTC_R_STRING 6
+#define wxSTC_R_STRING2 7
+#define wxSTC_R_OPERATOR 8
+#define wxSTC_R_IDENTIFIER 9
+#define wxSTC_R_INFIX 10
+#define wxSTC_R_INFIXEOL 11
+
+/// Lexical state for SCLEX_MAGIKSF
+#define wxSTC_MAGIK_DEFAULT 0
+#define wxSTC_MAGIK_COMMENT 1
+#define wxSTC_MAGIK_HYPER_COMMENT 16
+#define wxSTC_MAGIK_STRING 2
+#define wxSTC_MAGIK_CHARACTER 3
+#define wxSTC_MAGIK_NUMBER 4
+#define wxSTC_MAGIK_IDENTIFIER 5
+#define wxSTC_MAGIK_OPERATOR 6
+#define wxSTC_MAGIK_FLOW 7
+#define wxSTC_MAGIK_CONTAINER 8
+#define wxSTC_MAGIK_BRACKET_BLOCK 9
+#define wxSTC_MAGIK_BRACE_BLOCK 10
+#define wxSTC_MAGIK_SQBRACKET_BLOCK 11
+#define wxSTC_MAGIK_UNKNOWN_KEYWORD 12
+#define wxSTC_MAGIK_KEYWORD 13
+#define wxSTC_MAGIK_PRAGMA 14
+#define wxSTC_MAGIK_SYMBOL 15
+
+/// Lexical state for SCLEX_POWERSHELL
+#define wxSTC_POWERSHELL_DEFAULT 0
+#define wxSTC_POWERSHELL_COMMENT 1
+#define wxSTC_POWERSHELL_STRING 2
+#define wxSTC_POWERSHELL_CHARACTER 3
+#define wxSTC_POWERSHELL_NUMBER 4
+#define wxSTC_POWERSHELL_VARIABLE 5
+#define wxSTC_POWERSHELL_OPERATOR 6
+#define wxSTC_POWERSHELL_IDENTIFIER 7
+#define wxSTC_POWERSHELL_KEYWORD 8
+#define wxSTC_POWERSHELL_CMDLET 9
+#define wxSTC_POWERSHELL_ALIAS 10
+#define wxSTC_POWERSHELL_FUNCTION 11
+#define wxSTC_POWERSHELL_USER1 12
+#define wxSTC_POWERSHELL_COMMENTSTREAM 13
+
+/// Lexical state for SCLEX_MYSQL
+#define wxSTC_MYSQL_DEFAULT 0
+#define wxSTC_MYSQL_COMMENT 1
+#define wxSTC_MYSQL_COMMENTLINE 2
+#define wxSTC_MYSQL_VARIABLE 3
+#define wxSTC_MYSQL_SYSTEMVARIABLE 4
+#define wxSTC_MYSQL_KNOWNSYSTEMVARIABLE 5
+#define wxSTC_MYSQL_NUMBER 6
+#define wxSTC_MYSQL_MAJORKEYWORD 7
+#define wxSTC_MYSQL_KEYWORD 8
+#define wxSTC_MYSQL_DATABASEOBJECT 9
+#define wxSTC_MYSQL_PROCEDUREKEYWORD 10
+#define wxSTC_MYSQL_STRING 11
+#define wxSTC_MYSQL_SQSTRING 12
+#define wxSTC_MYSQL_DQSTRING 13
+#define wxSTC_MYSQL_OPERATOR 14
+#define wxSTC_MYSQL_FUNCTION 15
+#define wxSTC_MYSQL_IDENTIFIER 16
+#define wxSTC_MYSQL_QUOTEDIDENTIFIER 17
+#define wxSTC_MYSQL_USER1 18
+#define wxSTC_MYSQL_USER2 19
+#define wxSTC_MYSQL_USER3 20
+#define wxSTC_MYSQL_HIDDENCOMMAND 21
+
+/// Lexical state for SCLEX_PO
+#define wxSTC_PO_DEFAULT 0
+#define wxSTC_PO_COMMENT 1
+#define wxSTC_PO_MSGID 2
+#define wxSTC_PO_MSGID_TEXT 3
+#define wxSTC_PO_MSGSTR 4
+#define wxSTC_PO_MSGSTR_TEXT 5
+#define wxSTC_PO_MSGCTXT 6
+#define wxSTC_PO_MSGCTXT_TEXT 7
+#define wxSTC_PO_FUZZY 8
+
+/// Lexical states for SCLEX_PASCAL
+#define wxSTC_PAS_DEFAULT 0
+#define wxSTC_PAS_IDENTIFIER 1
+#define wxSTC_PAS_COMMENT 2
+#define wxSTC_PAS_COMMENT2 3
+#define wxSTC_PAS_COMMENTLINE 4
+#define wxSTC_PAS_PREPROCESSOR 5
+#define wxSTC_PAS_PREPROCESSOR2 6
+#define wxSTC_PAS_NUMBER 7
+#define wxSTC_PAS_HEXNUMBER 8
+#define wxSTC_PAS_WORD 9
+#define wxSTC_PAS_STRING 10
+#define wxSTC_PAS_STRINGEOL 11
+#define wxSTC_PAS_CHARACTER 12
+#define wxSTC_PAS_OPERATOR 13
+#define wxSTC_PAS_ASM 14
+
+/// Lexical state for SCLEX_SORCUS
+#define wxSTC_SORCUS_DEFAULT 0
+#define wxSTC_SORCUS_COMMAND 1
+#define wxSTC_SORCUS_PARAMETER 2
+#define wxSTC_SORCUS_COMMENTLINE 3
+#define wxSTC_SORCUS_STRING 4
+#define wxSTC_SORCUS_STRINGEOL 5
+#define wxSTC_SORCUS_IDENTIFIER 6
+#define wxSTC_SORCUS_OPERATOR 7
+#define wxSTC_SORCUS_NUMBER 8
+#define wxSTC_SORCUS_CONSTANT 9
+
+/// Lexical state for SCLEX_POWERPRO
+#define wxSTC_POWERPRO_DEFAULT 0
+#define wxSTC_POWERPRO_COMMENTBLOCK 1
+#define wxSTC_POWERPRO_COMMENTLINE 2
+#define wxSTC_POWERPRO_NUMBER 3
+#define wxSTC_POWERPRO_WORD 4
+#define wxSTC_POWERPRO_WORD2 5
+#define wxSTC_POWERPRO_WORD3 6
+#define wxSTC_POWERPRO_WORD4 7
+#define wxSTC_POWERPRO_DOUBLEQUOTEDSTRING 8
+#define wxSTC_POWERPRO_SINGLEQUOTEDSTRING 9
+#define wxSTC_POWERPRO_LINECONTINUE 10
+#define wxSTC_POWERPRO_OPERATOR 11
+#define wxSTC_POWERPRO_IDENTIFIER 12
+#define wxSTC_POWERPRO_STRINGEOL 13
+#define wxSTC_POWERPRO_VERBATIM 14
+#define wxSTC_POWERPRO_ALTQUOTE 15
+#define wxSTC_POWERPRO_FUNCTION 16
+
+/// Lexical states for SCLEX_SML
+#define wxSTC_SML_DEFAULT 0
+#define wxSTC_SML_IDENTIFIER 1
+#define wxSTC_SML_TAGNAME 2
+#define wxSTC_SML_KEYWORD 3
+#define wxSTC_SML_KEYWORD2 4
+#define wxSTC_SML_KEYWORD3 5
+#define wxSTC_SML_LINENUM 6
+#define wxSTC_SML_OPERATOR 7
+#define wxSTC_SML_NUMBER 8
+#define wxSTC_SML_CHAR 9
+#define wxSTC_SML_STRING 11
+#define wxSTC_SML_COMMENT 12
+#define wxSTC_SML_COMMENT1 13
+#define wxSTC_SML_COMMENT2 14
+#define wxSTC_SML_COMMENT3 15
+
+/// Lexical state for SCLEX_MARKDOWN
+#define wxSTC_MARKDOWN_DEFAULT 0
+#define wxSTC_MARKDOWN_LINE_BEGIN 1
+#define wxSTC_MARKDOWN_STRONG1 2
+#define wxSTC_MARKDOWN_STRONG2 3
+#define wxSTC_MARKDOWN_EM1 4
+#define wxSTC_MARKDOWN_EM2 5
+#define wxSTC_MARKDOWN_HEADER1 6
+#define wxSTC_MARKDOWN_HEADER2 7
+#define wxSTC_MARKDOWN_HEADER3 8
+#define wxSTC_MARKDOWN_HEADER4 9
+#define wxSTC_MARKDOWN_HEADER5 10
+#define wxSTC_MARKDOWN_HEADER6 11
+#define wxSTC_MARKDOWN_PRECHAR 12
+#define wxSTC_MARKDOWN_ULIST_ITEM 13
+#define wxSTC_MARKDOWN_OLIST_ITEM 14
+#define wxSTC_MARKDOWN_BLOCKQUOTE 15
+#define wxSTC_MARKDOWN_STRIKEOUT 16
+#define wxSTC_MARKDOWN_HRULE 17
+#define wxSTC_MARKDOWN_LINK 18
+#define wxSTC_MARKDOWN_CODE 19
+#define wxSTC_MARKDOWN_CODE2 20
+#define wxSTC_MARKDOWN_CODEBK 21
+
+/// Lexical state for SCLEX_TXT2TAGS
+#define wxSTC_TXT2TAGS_DEFAULT 0
+#define wxSTC_TXT2TAGS_LINE_BEGIN 1
+#define wxSTC_TXT2TAGS_STRONG1 2
+#define wxSTC_TXT2TAGS_STRONG2 3
+#define wxSTC_TXT2TAGS_EM1 4
+#define wxSTC_TXT2TAGS_EM2 5
+#define wxSTC_TXT2TAGS_HEADER1 6
+#define wxSTC_TXT2TAGS_HEADER2 7
+#define wxSTC_TXT2TAGS_HEADER3 8
+#define wxSTC_TXT2TAGS_HEADER4 9
+#define wxSTC_TXT2TAGS_HEADER5 10
+#define wxSTC_TXT2TAGS_HEADER6 11
+#define wxSTC_TXT2TAGS_PRECHAR 12
+#define wxSTC_TXT2TAGS_ULIST_ITEM 13
+#define wxSTC_TXT2TAGS_OLIST_ITEM 14
+#define wxSTC_TXT2TAGS_BLOCKQUOTE 15
+#define wxSTC_TXT2TAGS_STRIKEOUT 16
+#define wxSTC_TXT2TAGS_HRULE 17
+#define wxSTC_TXT2TAGS_LINK 18
+#define wxSTC_TXT2TAGS_CODE 19
+#define wxSTC_TXT2TAGS_CODE2 20
+#define wxSTC_TXT2TAGS_CODEBK 21
+#define wxSTC_TXT2TAGS_COMMENT 22
+#define wxSTC_TXT2TAGS_OPTION 23
+#define wxSTC_TXT2TAGS_PREPROC 24
+#define wxSTC_TXT2TAGS_POSTPROC 25
+
+/// Lexical states for SCLEX_A68K
+#define wxSTC_A68K_DEFAULT 0
+#define wxSTC_A68K_COMMENT 1
+#define wxSTC_A68K_NUMBER_DEC 2
+#define wxSTC_A68K_NUMBER_BIN 3
+#define wxSTC_A68K_NUMBER_HEX 4
+#define wxSTC_A68K_STRING1 5
+#define wxSTC_A68K_OPERATOR 6
+#define wxSTC_A68K_CPUINSTRUCTION 7
+#define wxSTC_A68K_EXTINSTRUCTION 8
+#define wxSTC_A68K_REGISTER 9
+#define wxSTC_A68K_DIRECTIVE 10
+#define wxSTC_A68K_MACRO_ARG 11
+#define wxSTC_A68K_LABEL 12
+#define wxSTC_A68K_STRING2 13
+#define wxSTC_A68K_IDENTIFIER 14
+#define wxSTC_A68K_MACRO_DECLARATION 15
+#define wxSTC_A68K_COMMENT_WORD 16
+#define wxSTC_A68K_COMMENT_SPECIAL 17
+#define wxSTC_A68K_COMMENT_DOXYGEN 18
+
+/// Lexical states for SCLEX_MODULA
+#define wxSTC_MODULA_DEFAULT 0
+#define wxSTC_MODULA_COMMENT 1
+#define wxSTC_MODULA_DOXYCOMM 2
+#define wxSTC_MODULA_DOXYKEY 3
+#define wxSTC_MODULA_KEYWORD 4
+#define wxSTC_MODULA_RESERVED 5
+#define wxSTC_MODULA_NUMBER 6
+#define wxSTC_MODULA_BASENUM 7
+#define wxSTC_MODULA_FLOAT 8
+#define wxSTC_MODULA_STRING 9
+#define wxSTC_MODULA_STRSPEC 10
+#define wxSTC_MODULA_CHAR 11
+#define wxSTC_MODULA_CHARSPEC 12
+#define wxSTC_MODULA_PROC 13
+#define wxSTC_MODULA_PRAGMA 14
+#define wxSTC_MODULA_PRGKEY 15
+#define wxSTC_MODULA_OPERATOR 16
+#define wxSTC_MODULA_BADSTR 17
+
+/// Lexical states for SCLEX_COFFEESCRIPT
+#define wxSTC_COFFEESCRIPT_DEFAULT 0
+#define wxSTC_COFFEESCRIPT_COMMENT 1
+#define wxSTC_COFFEESCRIPT_COMMENTLINE 2
+#define wxSTC_COFFEESCRIPT_COMMENTDOC 3
+#define wxSTC_COFFEESCRIPT_NUMBER 4
+#define wxSTC_COFFEESCRIPT_WORD 5
+#define wxSTC_COFFEESCRIPT_STRING 6
+#define wxSTC_COFFEESCRIPT_CHARACTER 7
+#define wxSTC_COFFEESCRIPT_UUID 8
+#define wxSTC_COFFEESCRIPT_PREPROCESSOR 9
+#define wxSTC_COFFEESCRIPT_OPERATOR 10
+#define wxSTC_COFFEESCRIPT_IDENTIFIER 11
+#define wxSTC_COFFEESCRIPT_STRINGEOL 12
+#define wxSTC_COFFEESCRIPT_VERBATIM 13
+#define wxSTC_COFFEESCRIPT_REGEX 14
+#define wxSTC_COFFEESCRIPT_COMMENTLINEDOC 15
+#define wxSTC_COFFEESCRIPT_WORD2 16
+#define wxSTC_COFFEESCRIPT_COMMENTDOCKEYWORD 17
+#define wxSTC_COFFEESCRIPT_COMMENTDOCKEYWORDERROR 18
+#define wxSTC_COFFEESCRIPT_GLOBALCLASS 19
+#define wxSTC_COFFEESCRIPT_STRINGRAW 20
+#define wxSTC_COFFEESCRIPT_TRIPLEVERBATIM 21
+#define wxSTC_COFFEESCRIPT_HASHQUOTEDSTRING 22
+#define wxSTC_COFFEESCRIPT_COMMENTBLOCK 22
+#define wxSTC_COFFEESCRIPT_VERBOSE_REGEX 23
+#define wxSTC_COFFEESCRIPT_VERBOSE_REGEX_COMMENT 24
+
+/// Lexical states for SCLEX_AVS
+#define wxSTC_AVS_DEFAULT 0
+#define wxSTC_AVS_COMMENTBLOCK 1
+#define wxSTC_AVS_COMMENTBLOCKN 2
+#define wxSTC_AVS_COMMENTLINE 3
+#define wxSTC_AVS_NUMBER 4
+#define wxSTC_AVS_OPERATOR 5
+#define wxSTC_AVS_IDENTIFIER 6
+#define wxSTC_AVS_STRING 7
+#define wxSTC_AVS_TRIPLESTRING 8
+#define wxSTC_AVS_KEYWORD 9
+#define wxSTC_AVS_FILTER 10
+#define wxSTC_AVS_PLUGIN 11
+#define wxSTC_AVS_FUNCTION 12
+#define wxSTC_AVS_CLIPPROP 13
+#define wxSTC_AVS_USERDFN 14
+
+/// Lexical states for SCLEX_ECL
+#define wxSTC_ECL_DEFAULT 0
+#define wxSTC_ECL_COMMENT 1
+#define wxSTC_ECL_COMMENTLINE 2
+#define wxSTC_ECL_NUMBER 3
+#define wxSTC_ECL_STRING 4
+#define wxSTC_ECL_WORD0 5
+#define wxSTC_ECL_OPERATOR 6
+#define wxSTC_ECL_CHARACTER 7
+#define wxSTC_ECL_UUID 8
+#define wxSTC_ECL_PREPROCESSOR 9
+#define wxSTC_ECL_UNKNOWN 10
+#define wxSTC_ECL_IDENTIFIER 11
+#define wxSTC_ECL_STRINGEOL 12
+#define wxSTC_ECL_VERBATIM 13
+#define wxSTC_ECL_REGEX 14
+#define wxSTC_ECL_COMMENTLINEDOC 15
+#define wxSTC_ECL_WORD1 16
+#define wxSTC_ECL_COMMENTDOCKEYWORD 17
+#define wxSTC_ECL_COMMENTDOCKEYWORDERROR 18
+#define wxSTC_ECL_WORD2 19
+#define wxSTC_ECL_WORD3 20
+#define wxSTC_ECL_WORD4 21
+#define wxSTC_ECL_WORD5 22
+#define wxSTC_ECL_COMMENTDOC 23
+#define wxSTC_ECL_ADDED 24
+#define wxSTC_ECL_DELETED 25
+#define wxSTC_ECL_CHANGED 26
+#define wxSTC_ECL_MOVED 27
+
+/// Lexical states for SCLEX_OSCRIPT
+#define wxSTC_OSCRIPT_DEFAULT 0
+#define wxSTC_OSCRIPT_LINE_COMMENT 1
+#define wxSTC_OSCRIPT_BLOCK_COMMENT 2
+#define wxSTC_OSCRIPT_DOC_COMMENT 3
+#define wxSTC_OSCRIPT_PREPROCESSOR 4
+#define wxSTC_OSCRIPT_NUMBER 5
+#define wxSTC_OSCRIPT_SINGLEQUOTE_STRING 6
+#define wxSTC_OSCRIPT_DOUBLEQUOTE_STRING 7
+#define wxSTC_OSCRIPT_CONSTANT 8
+#define wxSTC_OSCRIPT_IDENTIFIER 9
+#define wxSTC_OSCRIPT_GLOBAL 10
+#define wxSTC_OSCRIPT_KEYWORD 11
+#define wxSTC_OSCRIPT_OPERATOR 12
+#define wxSTC_OSCRIPT_LABEL 13
+#define wxSTC_OSCRIPT_TYPE 14
+#define wxSTC_OSCRIPT_FUNCTION 15
+#define wxSTC_OSCRIPT_OBJECT 16
+#define wxSTC_OSCRIPT_PROPERTY 17
+#define wxSTC_OSCRIPT_METHOD 18
+
+/// Lexical states for SCLEX_VISUALPROLOG
+#define wxSTC_VISUALPROLOG_DEFAULT 0
+#define wxSTC_VISUALPROLOG_KEY_MAJOR 1
+#define wxSTC_VISUALPROLOG_KEY_MINOR 2
+#define wxSTC_VISUALPROLOG_KEY_DIRECTIVE 3
+#define wxSTC_VISUALPROLOG_COMMENT_BLOCK 4
+#define wxSTC_VISUALPROLOG_COMMENT_LINE 5
+#define wxSTC_VISUALPROLOG_COMMENT_KEY 6
+#define wxSTC_VISUALPROLOG_COMMENT_KEY_ERROR 7
+#define wxSTC_VISUALPROLOG_IDENTIFIER 8
+#define wxSTC_VISUALPROLOG_VARIABLE 9
+#define wxSTC_VISUALPROLOG_ANONYMOUS 10
+#define wxSTC_VISUALPROLOG_NUMBER 11
+#define wxSTC_VISUALPROLOG_OPERATOR 12
+#define wxSTC_VISUALPROLOG_CHARACTER 13
+#define wxSTC_VISUALPROLOG_CHARACTER_TOO_MANY 14
+#define wxSTC_VISUALPROLOG_CHARACTER_ESCAPE_ERROR 15
+#define wxSTC_VISUALPROLOG_STRING 16
+#define wxSTC_VISUALPROLOG_STRING_ESCAPE 17
+#define wxSTC_VISUALPROLOG_STRING_ESCAPE_ERROR 18
+#define wxSTC_VISUALPROLOG_STRING_EOL_OPEN 19
+#define wxSTC_VISUALPROLOG_STRING_VERBATIM 20
+#define wxSTC_VISUALPROLOG_STRING_VERBATIM_SPECIAL 21
+#define wxSTC_VISUALPROLOG_STRING_VERBATIM_EOL 22
+
+//}}}
+//----------------------------------------------------------------------
+
+//----------------------------------------------------------------------
+// Commands that can be bound to keystrokes section {{{
+
+
+/// Redoes the next action on the undo history.
+#define wxSTC_CMD_REDO 2011
+
+/// Select all the text in the document.
+#define wxSTC_CMD_SELECTALL 2013
+
+/// Undo one action in the undo history.
+#define wxSTC_CMD_UNDO 2176
+
+/// Cut the selection to the clipboard.
+#define wxSTC_CMD_CUT 2177
+
+/// Copy the selection to the clipboard.
+#define wxSTC_CMD_COPY 2178
+
+/// Paste the contents of the clipboard into the document replacing the selection.
+#define wxSTC_CMD_PASTE 2179
+
+/// Clear the selection.
+#define wxSTC_CMD_CLEAR 2180
+
+/// Move caret down one line.
+#define wxSTC_CMD_LINEDOWN 2300
+
+/// Move caret down one line extending selection to new caret position.
+#define wxSTC_CMD_LINEDOWNEXTEND 2301
+
+/// Move caret up one line.
+#define wxSTC_CMD_LINEUP 2302
+
+/// Move caret up one line extending selection to new caret position.
+#define wxSTC_CMD_LINEUPEXTEND 2303
+
+/// Move caret left one character.
+#define wxSTC_CMD_CHARLEFT 2304
+
+/// Move caret left one character extending selection to new caret position.
+#define wxSTC_CMD_CHARLEFTEXTEND 2305
+
+/// Move caret right one character.
+#define wxSTC_CMD_CHARRIGHT 2306
+
+/// Move caret right one character extending selection to new caret position.
+#define wxSTC_CMD_CHARRIGHTEXTEND 2307
+
+/// Move caret left one word.
+#define wxSTC_CMD_WORDLEFT 2308
+
+/// Move caret left one word extending selection to new caret position.
+#define wxSTC_CMD_WORDLEFTEXTEND 2309
+
+/// Move caret right one word.
+#define wxSTC_CMD_WORDRIGHT 2310
+
+/// Move caret right one word extending selection to new caret position.
+#define wxSTC_CMD_WORDRIGHTEXTEND 2311
+
+/// Move caret to first position on line.
+#define wxSTC_CMD_HOME 2312
+
+/// Move caret to first position on line extending selection to new caret position.
+#define wxSTC_CMD_HOMEEXTEND 2313
+
+/// Move caret to last position on line.
+#define wxSTC_CMD_LINEEND 2314
+
+/// Move caret to last position on line extending selection to new caret position.
+#define wxSTC_CMD_LINEENDEXTEND 2315
+
+/// Move caret to first position in document.
+#define wxSTC_CMD_DOCUMENTSTART 2316
+
+/// Move caret to first position in document extending selection to new caret position.
+#define wxSTC_CMD_DOCUMENTSTARTEXTEND 2317
+
+/// Move caret to last position in document.
+#define wxSTC_CMD_DOCUMENTEND 2318
+
+/// Move caret to last position in document extending selection to new caret position.
+#define wxSTC_CMD_DOCUMENTENDEXTEND 2319
+
+/// Move caret one page up.
+#define wxSTC_CMD_PAGEUP 2320
+
+/// Move caret one page up extending selection to new caret position.
+#define wxSTC_CMD_PAGEUPEXTEND 2321
+
+/// Move caret one page down.
+#define wxSTC_CMD_PAGEDOWN 2322
+
+/// Move caret one page down extending selection to new caret position.
+#define wxSTC_CMD_PAGEDOWNEXTEND 2323
+
+/// Switch from insert to overtype mode or the reverse.
+#define wxSTC_CMD_EDITTOGGLEOVERTYPE 2324
+
+/// Cancel any modes such as call tip or auto-completion list display.
+#define wxSTC_CMD_CANCEL 2325
+
+/// Delete the selection or if no selection, the character before the caret.
+#define wxSTC_CMD_DELETEBACK 2326
+
+/// If selection is empty or all on one line replace the selection with a tab character.
+/// If more than one line selected, indent the lines.
+#define wxSTC_CMD_TAB 2327
+
+/// Dedent the selected lines.
+#define wxSTC_CMD_BACKTAB 2328
+
+/// Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
+#define wxSTC_CMD_NEWLINE 2329
+
+/// Insert a Form Feed character.
+#define wxSTC_CMD_FORMFEED 2330
+
+/// Move caret to before first visible character on line.
+/// If already there move to first character on line.
+#define wxSTC_CMD_VCHOME 2331
+
+/// Like VCHome but extending selection to new caret position.
+#define wxSTC_CMD_VCHOMEEXTEND 2332
+
+/// Magnify the displayed text by increasing the sizes by 1 point.
+#define wxSTC_CMD_ZOOMIN 2333
+
+/// Make the displayed text smaller by decreasing the sizes by 1 point.
+#define wxSTC_CMD_ZOOMOUT 2334
+
+/// Delete the word to the left of the caret.
+#define wxSTC_CMD_DELWORDLEFT 2335
+
+/// Delete the word to the right of the caret.
+#define wxSTC_CMD_DELWORDRIGHT 2336
+
+/// Delete the word to the right of the caret, but not the trailing non-word characters.
+#define wxSTC_CMD_DELWORDRIGHTEND 2518
+
+/// Cut the line containing the caret.
+#define wxSTC_CMD_LINECUT 2337
+
+/// Delete the line containing the caret.
+#define wxSTC_CMD_LINEDELETE 2338
+
+/// Switch the current line with the previous.
+#define wxSTC_CMD_LINETRANSPOSE 2339
+
+/// Duplicate the current line.
+#define wxSTC_CMD_LINEDUPLICATE 2404
+
+/// Transform the selection to lower case.
+#define wxSTC_CMD_LOWERCASE 2340
+
+/// Transform the selection to upper case.
+#define wxSTC_CMD_UPPERCASE 2341
+
+/// Scroll the document down, keeping the caret visible.
+#define wxSTC_CMD_LINESCROLLDOWN 2342
+
+/// Scroll the document up, keeping the caret visible.
+#define wxSTC_CMD_LINESCROLLUP 2343
+
+/// Delete the selection or if no selection, the character before the caret.
+/// Will not delete the character before at the start of a line.
+#define wxSTC_CMD_DELETEBACKNOTLINE 2344
+
+/// Move caret to first position on display line.
+#define wxSTC_CMD_HOMEDISPLAY 2345
+
+/// Move caret to first position on display line extending selection to
+/// new caret position.
+#define wxSTC_CMD_HOMEDISPLAYEXTEND 2346
+
+/// Move caret to last position on display line.
+#define wxSTC_CMD_LINEENDDISPLAY 2347
+
+/// Move caret to last position on display line extending selection to new
+/// caret position.
+#define wxSTC_CMD_LINEENDDISPLAYEXTEND 2348
+
+/// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
+/// except they behave differently when word-wrap is enabled:
+/// They go first to the start / end of the display line, like (Home|LineEnd)Display
+/// The difference is that, the cursor is already at the point, it goes on to the start
+/// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
+#define wxSTC_CMD_HOMEWRAP 2349
+#define wxSTC_CMD_HOMEWRAPEXTEND 2450
+#define wxSTC_CMD_LINEENDWRAP 2451
+#define wxSTC_CMD_LINEENDWRAPEXTEND 2452
+#define wxSTC_CMD_VCHOMEWRAP 2453
+#define wxSTC_CMD_VCHOMEWRAPEXTEND 2454
+
+/// Copy the line containing the caret.
+#define wxSTC_CMD_LINECOPY 2455
+
+/// Move to the previous change in capitalisation.
+#define wxSTC_CMD_WORDPARTLEFT 2390
+
+/// Move to the previous change in capitalisation extending selection
+/// to new caret position.
+#define wxSTC_CMD_WORDPARTLEFTEXTEND 2391
+
+/// Move to the change next in capitalisation.
+#define wxSTC_CMD_WORDPARTRIGHT 2392
+
+/// Move to the next change in capitalisation extending selection
+/// to new caret position.
+#define wxSTC_CMD_WORDPARTRIGHTEXTEND 2393
+
+/// Delete back from the current position to the start of the line.
+#define wxSTC_CMD_DELLINELEFT 2395
+
+/// Delete forwards from the current position to the end of the line.
+#define wxSTC_CMD_DELLINERIGHT 2396
+
+/// Move caret between paragraphs (delimited by empty lines).
+#define wxSTC_CMD_PARADOWN 2413
+#define wxSTC_CMD_PARADOWNEXTEND 2414
+#define wxSTC_CMD_PARAUP 2415
+#define wxSTC_CMD_PARAUPEXTEND 2416
+
+/// Move caret down one line, extending rectangular selection to new caret position.
+#define wxSTC_CMD_LINEDOWNRECTEXTEND 2426
+
+/// Move caret up one line, extending rectangular selection to new caret position.
+#define wxSTC_CMD_LINEUPRECTEXTEND 2427
+
+/// Move caret left one character, extending rectangular selection to new caret position.
+#define wxSTC_CMD_CHARLEFTRECTEXTEND 2428
+
+/// Move caret right one character, extending rectangular selection to new caret position.
+#define wxSTC_CMD_CHARRIGHTRECTEXTEND 2429
+
+/// Move caret to first position on line, extending rectangular selection to new caret position.
+#define wxSTC_CMD_HOMERECTEXTEND 2430
+
+/// Move caret to before first visible character on line.
+/// If already there move to first character on line.
+/// In either case, extend rectangular selection to new caret position.
+#define wxSTC_CMD_VCHOMERECTEXTEND 2431
+
+/// Move caret to last position on line, extending rectangular selection to new caret position.
+#define wxSTC_CMD_LINEENDRECTEXTEND 2432
+
+/// Move caret one page up, extending rectangular selection to new caret position.
+#define wxSTC_CMD_PAGEUPRECTEXTEND 2433
+
+/// Move caret one page down, extending rectangular selection to new caret position.
+#define wxSTC_CMD_PAGEDOWNRECTEXTEND 2434
+
+/// Move caret to top of page, or one page up if already at top of page.
+#define wxSTC_CMD_STUTTEREDPAGEUP 2435
+
+/// Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.
+#define wxSTC_CMD_STUTTEREDPAGEUPEXTEND 2436
+
+/// Move caret to bottom of page, or one page down if already at bottom of page.
+#define wxSTC_CMD_STUTTEREDPAGEDOWN 2437
+
+/// Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.
+#define wxSTC_CMD_STUTTEREDPAGEDOWNEXTEND 2438
+
+/// Move caret left one word, position cursor at end of word.
+#define wxSTC_CMD_WORDLEFTEND 2439
+
+/// Move caret left one word, position cursor at end of word, extending selection to new caret position.
+#define wxSTC_CMD_WORDLEFTENDEXTEND 2440
+
+/// Move caret right one word, position cursor at end of word.
+#define wxSTC_CMD_WORDRIGHTEND 2441
+
+/// Move caret right one word, position cursor at end of word, extending selection to new caret position.
+#define wxSTC_CMD_WORDRIGHTENDEXTEND 2442
+
+/// Centre current line in window.
+#define wxSTC_CMD_VERTICALCENTRECARET 2619
+
+/// Move the selected lines up one line, shifting the line above after the selection
+#define wxSTC_CMD_MOVESELECTEDLINESUP 2620
+
+/// Move the selected lines down one line, shifting the line below before the selection
+#define wxSTC_CMD_MOVESELECTEDLINESDOWN 2621
+
+/// Scroll to start of document.
+#define wxSTC_CMD_SCROLLTOSTART 2628
+
+/// Scroll to end of document.
+#define wxSTC_CMD_SCROLLTOEND 2629
+
+//}}}
+//----------------------------------------------------------------------
+
+class ScintillaWX; // forward declare
+class WordList;
+struct SCNotification;
+
+#ifndef SWIG
+extern WXDLLIMPEXP_DATA_STC(const char) wxSTCNameStr[];
+class WXDLLIMPEXP_FWD_STC wxStyledTextCtrl;
+class WXDLLIMPEXP_FWD_STC wxStyledTextEvent;
+#endif
+
+//----------------------------------------------------------------------
+
+class WXDLLIMPEXP_STC wxStyledTextCtrl : public wxControl,
+#if wxUSE_TEXTCTRL
+ public wxTextCtrlIface
+#else // !wxUSE_TEXTCTRL
+ public wxTextEntryBase
+#endif // wxUSE_TEXTCTRL/!wxUSE_TEXTCTRL
+{
+public:
+
+#ifdef SWIG
+ %pythonAppend wxStyledTextCtrl "self._setOORInfo(self)"
+ %pythonAppend wxStyledTextCtrl() ""
+
+ wxStyledTextCtrl(wxWindow *parent, wxWindowID id=wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0,
+ const wxString& name = wxPySTCNameStr);
+ %RenameCtor(PreStyledTextCtrl, wxStyledTextCtrl());
+
+#else
+ wxStyledTextCtrl(wxWindow *parent, wxWindowID id=wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0,
+ const wxString& name = wxSTCNameStr);
+ wxStyledTextCtrl() { m_swx = NULL; }
+ ~wxStyledTextCtrl();
+
+#endif
+
+ bool Create(wxWindow *parent, wxWindowID id=wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0,
+ const wxString& name = wxSTCNameStr);
+
+
+ //----------------------------------------------------------------------
+ // Generated method declaration section {{{
+
+
+ // Add text to the document at current position.
+ void AddText(const wxString& text);
+
+ // Add array of cells to document.
+ void AddStyledText(const wxMemoryBuffer& data);
+
+ // Insert string at a position.
+ void InsertText(int pos, const wxString& text);
+
+ // Delete all text in the document.
+ void ClearAll();
+
+ // Delete a range of text in the document.
+ void DeleteRange(int pos, int deleteLength);
+
+ // Set all style bytes to 0, remove all folding information.
+ void ClearDocumentStyle();
+
+ // Returns the number of bytes in the document.
+ int GetLength() const;
+
+ // Returns the character byte at the position.
+ int GetCharAt(int pos) const;
+
+ // Returns the position of the caret.
+ int GetCurrentPos() const;
+
+ // Returns the position of the opposite end of the selection to the caret.
+ int GetAnchor() const;
+
+ // Returns the style byte at the position.
+ int GetStyleAt(int pos) const;
+
+ // Redoes the next action on the undo history.
+ void Redo();
+
+ // Choose between collecting actions into the undo
+ // history and discarding them.
+ void SetUndoCollection(bool collectUndo);
+
+ // Select all the text in the document.
+ void SelectAll();
+
+ // Remember the current position in the undo history as the position
+ // at which the document was saved.
+ void SetSavePoint();
+
+ // Retrieve a buffer of cells.
+ wxMemoryBuffer GetStyledText(int startPos, int endPos);
+
+ // Are there any redoable actions in the undo history?
+ bool CanRedo() const;
+
+ // Retrieve the line number at which a particular marker is located.
+ int MarkerLineFromHandle(int handle);
+
+ // Delete a marker.
+ void MarkerDeleteHandle(int handle);
+
+ // Is undo history being collected?
+ bool GetUndoCollection() const;
+
+ // Are white space characters currently visible?
+ // Returns one of SCWS_* constants.
+ int GetViewWhiteSpace() const;
+
+ // Make white space characters invisible, always visible or visible outside indentation.
+ void SetViewWhiteSpace(int viewWS);
+
+ // Find the position from a point within the window.
+ int PositionFromPoint(wxPoint pt) const;
+
+ // Find the position from a point within the window but return
+ // INVALID_POSITION if not close to text.
+ int PositionFromPointClose(int x, int y);
+
+ // Set caret to start of a line and ensure it is visible.
+ void GotoLine(int line);
+
+ // Set caret to a position and ensure it is visible.
+ void GotoPos(int pos);
+
+ // Set the selection anchor to a position. The anchor is the opposite
+ // end of the selection from the caret.
+ void SetAnchor(int posAnchor);
+
+ // Retrieve the text of the line containing the caret.
+ // Returns the index of the caret on the line.
+ #ifdef SWIG
+ wxString GetCurLine(int* OUTPUT);
+#else
+ wxString GetCurLine(int* linePos=NULL);
+#endif
+
+ // Retrieve the position of the last correctly styled character.
+ int GetEndStyled() const;
+
+ // Convert all line endings in the document to one mode.
+ void ConvertEOLs(int eolMode);
+
+ // Retrieve the current end of line mode - one of CRLF, CR, or LF.
+ int GetEOLMode() const;
+
+ // Set the current end of line mode.
+ void SetEOLMode(int eolMode);
+
+ // Set the current styling position to pos and the styling mask to mask.
+ // The styling mask can be used to protect some bits in each styling byte from modification.
+ void StartStyling(int pos, int mask);
+
+ // Change style from current styling position for length characters to a style
+ // and move the current styling position to after this newly styled segment.
+ void SetStyling(int length, int style);
+
+ // Is drawing done first into a buffer or direct to the screen?
+ bool GetBufferedDraw() const;
+
+ // If drawing is buffered then each line of text is drawn into a bitmap buffer
+ // before drawing it to the screen to avoid flicker.
+ void SetBufferedDraw(bool buffered);
+
+ // Change the visible size of a tab to be a multiple of the width of a space character.
+ void SetTabWidth(int tabWidth);
+
+ // Retrieve the visible size of a tab.
+ int GetTabWidth() const;
+
+ // Set the code page used to interpret the bytes of the document as characters.
+ void SetCodePage(int codePage);
+
+ // Set the symbol used for a particular marker number,
+ // and optionally the fore and background colours.
+ void MarkerDefine(int markerNumber, int markerSymbol,
+ const wxColour& foreground = wxNullColour,
+ const wxColour& background = wxNullColour);
+
+ // Set the foreground colour used for a particular marker number.
+ void MarkerSetForeground(int markerNumber, const wxColour& fore);
+
+ // Set the background colour used for a particular marker number.
+ void MarkerSetBackground(int markerNumber, const wxColour& back);
+
+ // Set the background colour used for a particular marker number when its folding block is selected.
+ void MarkerSetBackgroundSelected(int markerNumber, const wxColour& back);
+
+ // Enable/disable highlight for current folding bloc (smallest one that contains the caret)
+ void MarkerEnableHighlight(bool enabled);
+
+ // Add a marker to a line, returning an ID which can be used to find or delete the marker.
+ int MarkerAdd(int line, int markerNumber);
+
+ // Delete a marker from a line.
+ void MarkerDelete(int line, int markerNumber);
+
+ // Delete all markers with a particular number from all lines.
+ void MarkerDeleteAll(int markerNumber);
+
+ // Get a bit mask of all the markers set on a line.
+ int MarkerGet(int line);
+
+ // Find the next line at or after lineStart that includes a marker in mask.
+ // Return -1 when no more lines.
+ int MarkerNext(int lineStart, int markerMask);
+
+ // Find the previous line before lineStart that includes a marker in mask.
+ int MarkerPrevious(int lineStart, int markerMask);
+
+ // Define a marker from a bitmap
+ void MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp);
+
+ // Add a set of markers to a line.
+ void MarkerAddSet(int line, int set);
+
+ // Set the alpha used for a marker that is drawn in the text area, not the margin.
+ void MarkerSetAlpha(int markerNumber, int alpha);
+
+ // Set a margin to be either numeric or symbolic.
+ void SetMarginType(int margin, int marginType);
+
+ // Retrieve the type of a margin.
+ int GetMarginType(int margin) const;
+
+ // Set the width of a margin to a width expressed in pixels.
+ void SetMarginWidth(int margin, int pixelWidth);
+
+ // Retrieve the width of a margin in pixels.
+ int GetMarginWidth(int margin) const;
+
+ // Set a mask that determines which markers are displayed in a margin.
+ void SetMarginMask(int margin, int mask);
+
+ // Retrieve the marker mask of a margin.
+ int GetMarginMask(int margin) const;
+
+ // Make a margin sensitive or insensitive to mouse clicks.
+ void SetMarginSensitive(int margin, bool sensitive);
+
+ // Retrieve the mouse click sensitivity of a margin.
+ bool GetMarginSensitive(int margin) const;
+
+ // Set the cursor shown when the mouse is inside a margin.
+ void SetMarginCursor(int margin, int cursor);
+
+ // Retrieve the cursor shown in a margin.
+ int GetMarginCursor(int margin) const;
+
+ // Clear all the styles and make equivalent to the global default style.
+ void StyleClearAll();
+
+ // Set the foreground colour of a style.
+ void StyleSetForeground(int style, const wxColour& fore);
+
+ // Set the background colour of a style.
+ void StyleSetBackground(int style, const wxColour& back);
+
+ // Set a style to be bold or not.
+ void StyleSetBold(int style, bool bold);
+
+ // Set a style to be italic or not.
+ void StyleSetItalic(int style, bool italic);
+
+ // Set the size of characters of a style.
+ void StyleSetSize(int style, int sizePoints);
+
+ // Set the font of a style.
+ void StyleSetFaceName(int style, const wxString& fontName);
+
+ // Set a style to have its end of line filled or not.
+ void StyleSetEOLFilled(int style, bool filled);
+
+ // Reset the default style to its state at startup
+ void StyleResetDefault();
+
+ // Set a style to be underlined or not.
+ void StyleSetUnderline(int style, bool underline);
+
+ // Get the foreground colour of a style.
+ wxColour StyleGetForeground(int style) const;
+
+ // Get the background colour of a style.
+ wxColour StyleGetBackground(int style) const;
+
+ // Get is a style bold or not.
+ bool StyleGetBold(int style) const;
+
+ // Get is a style italic or not.
+ bool StyleGetItalic(int style) const;
+
+ // Get the size of characters of a style.
+ int StyleGetSize(int style) const;
+
+ // Get the font facename of a style
+ wxString StyleGetFaceName(int style);
+
+ // Get is a style to have its end of line filled or not.
+ bool StyleGetEOLFilled(int style) const;
+
+ // Get is a style underlined or not.
+ bool StyleGetUnderline(int style) const;
+
+ // Get is a style mixed case, or to force upper or lower case.
+ int StyleGetCase(int style) const;
+
+ // Get the character set of the font in a style.
+ int StyleGetCharacterSet(int style) const;
+
+ // Get is a style visible or not.
+ bool StyleGetVisible(int style) const;
+
+ // Get is a style changeable or not (read only).
+ // Experimental feature, currently buggy.
+ bool StyleGetChangeable(int style) const;
+
+ // Get is a style a hotspot or not.
+ bool StyleGetHotSpot(int style) const;
+
+ // Set a style to be mixed case, or to force upper or lower case.
+ void StyleSetCase(int style, int caseForce);
+
+ // Set the size of characters of a style. Size is in points multiplied by 100.
+ void StyleSetSizeFractional(int style, int caseForce);
+
+ // Get the size of characters of a style in points multiplied by 100
+ int StyleGetSizeFractional(int style) const;
+
+ // Set the weight of characters of a style.
+ void StyleSetWeight(int style, int weight);
+
+ // Get the weight of characters of a style.
+ int StyleGetWeight(int style) const;
+
+ // Set a style to be a hotspot or not.
+ void StyleSetHotSpot(int style, bool hotspot);
+
+ // Set the foreground colour of the main and additional selections and whether to use this setting.
+ void SetSelForeground(bool useSetting, const wxColour& fore);
+
+ // Set the background colour of the main and additional selections and whether to use this setting.
+ void SetSelBackground(bool useSetting, const wxColour& back);
+
+ // Get the alpha of the selection.
+ int GetSelAlpha() const;
+
+ // Set the alpha of the selection.
+ void SetSelAlpha(int alpha);
+
+ // Is the selection end of line filled?
+ bool GetSelEOLFilled() const;
+
+ // Set the selection to have its end of line filled or not.
+ void SetSelEOLFilled(bool filled);
+
+ // Set the foreground colour of the caret.
+ void SetCaretForeground(const wxColour& fore);
+
+ // When key+modifier combination km is pressed perform msg.
+ void CmdKeyAssign(int key, int modifiers, int cmd);
+
+ // When key+modifier combination km is pressed do nothing.
+ void CmdKeyClear(int key, int modifiers);
+
+ // Drop all key mappings.
+ void CmdKeyClearAll();
+
+ // Set the styles for a segment of the document.
+ void SetStyleBytes(int length, char* styleBytes);
+
+ // Set a style to be visible or not.
+ void StyleSetVisible(int style, bool visible);
+
+ // Get the time in milliseconds that the caret is on and off.
+ int GetCaretPeriod() const;
+
+ // Get the time in milliseconds that the caret is on and off. 0 = steady on.
+ void SetCaretPeriod(int periodMilliseconds);
+
+ // Set the set of characters making up words for when moving or selecting by word.
+ // First sets defaults like SetCharsDefault.
+ void SetWordChars(const wxString& characters);
+
+ // Get the set of characters making up words for when moving or selecting by word.
+ wxString GetWordChars() const;
+
+ // Start a sequence of actions that is undone and redone as a unit.
+ // May be nested.
+ void BeginUndoAction();
+
+ // End a sequence of actions that is undone and redone as a unit.
+ void EndUndoAction();
+
+ // Set an indicator to plain, squiggle or TT.
+ void IndicatorSetStyle(int indic, int style);
+
+ // Retrieve the style of an indicator.
+ int IndicatorGetStyle(int indic) const;
+
+ // Set the foreground colour of an indicator.
+ void IndicatorSetForeground(int indic, const wxColour& fore);
+
+ // Retrieve the foreground colour of an indicator.
+ wxColour IndicatorGetForeground(int indic) const;
+
+ // Set an indicator to draw under text or over(default).
+ void IndicatorSetUnder(int indic, bool under);
+
+ // Retrieve whether indicator drawn under or over text.
+ bool IndicatorGetUnder(int indic) const;
+
+ // Set the foreground colour of all whitespace and whether to use this setting.
+ void SetWhitespaceForeground(bool useSetting, const wxColour& fore);
+
+ // Set the background colour of all whitespace and whether to use this setting.
+ void SetWhitespaceBackground(bool useSetting, const wxColour& back);
+
+ // Set the size of the dots used to mark space characters.
+ void SetWhitespaceSize(int size);
+
+ // Get the size of the dots used to mark space characters.
+ int GetWhitespaceSize() const;
+
+ // Divide each styling byte into lexical class bits (default: 5) and indicator
+ // bits (default: 3). If a lexer requires more than 32 lexical states, then this
+ // is used to expand the possible states.
+ void SetStyleBits(int bits);
+
+ // Retrieve number of bits in style bytes used to hold the lexical state.
+ int GetStyleBits() const;
+
+ // Used to hold extra styling information for each line.
+ void SetLineState(int line, int state);
+
+ // Retrieve the extra styling information for a line.
+ int GetLineState(int line) const;
+
+ // Retrieve the last line number that has line state.
+ int GetMaxLineState() const;
+
+ // Is the background of the line containing the caret in a different colour?
+ bool GetCaretLineVisible() const;
+
+ // Display the background of the line containing the caret in a different colour.
+ void SetCaretLineVisible(bool show);
+
+ // Get the colour of the background of the line containing the caret.
+ wxColour GetCaretLineBackground() const;
+
+ // Set the colour of the background of the line containing the caret.
+ void SetCaretLineBackground(const wxColour& back);
+
+ // Set a style to be changeable or not (read only).
+ // Experimental feature, currently buggy.
+ void StyleSetChangeable(int style, bool changeable);
+
+ // Display a auto-completion list.
+ // The lenEntered parameter indicates how many characters before
+ // the caret should be used to provide context.
+ void AutoCompShow(int lenEntered, const wxString& itemList);
+
+ // Remove the auto-completion list from the screen.
+ void AutoCompCancel();
+
+ // Is there an auto-completion list visible?
+ bool AutoCompActive();
+
+ // Retrieve the position of the caret when the auto-completion list was displayed.
+ int AutoCompPosStart();
+
+ // User has selected an item so remove the list and insert the selection.
+ void AutoCompComplete();
+
+ // Define a set of character that when typed cancel the auto-completion list.
+ void AutoCompStops(const wxString& characterSet);
+
+ // Change the separator character in the string setting up an auto-completion list.
+ // Default is space but can be changed if items contain space.
+ void AutoCompSetSeparator(int separatorCharacter);
+
+ // Retrieve the auto-completion list separator character.
+ int AutoCompGetSeparator() const;
+
+ // Select the item in the auto-completion list that starts with a string.
+ void AutoCompSelect(const wxString& text);
+
+ // Should the auto-completion list be cancelled if the user backspaces to a
+ // position before where the box was created.
+ void AutoCompSetCancelAtStart(bool cancel);
+
+ // Retrieve whether auto-completion cancelled by backspacing before start.
+ bool AutoCompGetCancelAtStart() const;
+
+ // Define a set of characters that when typed will cause the autocompletion to
+ // choose the selected item.
+ void AutoCompSetFillUps(const wxString& characterSet);
+
+ // Should a single item auto-completion list automatically choose the item.
+ void AutoCompSetChooseSingle(bool chooseSingle);
+
+ // Retrieve whether a single item auto-completion list automatically choose the item.
+ bool AutoCompGetChooseSingle() const;
+
+ // Set whether case is significant when performing auto-completion searches.
+ void AutoCompSetIgnoreCase(bool ignoreCase);
+
+ // Retrieve state of ignore case flag.
+ bool AutoCompGetIgnoreCase() const;
+
+ // Display a list of strings and send notification when user chooses one.
+ void UserListShow(int listType, const wxString& itemList);
+
+ // Set whether or not autocompletion is hidden automatically when nothing matches.
+ void AutoCompSetAutoHide(bool autoHide);
+
+ // Retrieve whether or not autocompletion is hidden automatically when nothing matches.
+ bool AutoCompGetAutoHide() const;
+
+ // Set whether or not autocompletion deletes any word characters
+ // after the inserted text upon completion.
+ void AutoCompSetDropRestOfWord(bool dropRestOfWord);
+
+ // Retrieve whether or not autocompletion deletes any word characters
+ // after the inserted text upon completion.
+ bool AutoCompGetDropRestOfWord() const;
+
+ // Register an image for use in autocompletion lists.
+ void RegisterImage(int type, const wxBitmap& bmp);
+
+ // Clear all the registered images.
+ void ClearRegisteredImages();
+
+ // Retrieve the auto-completion list type-separator character.
+ int AutoCompGetTypeSeparator() const;
+
+ // Change the type-separator character in the string setting up an auto-completion list.
+ // Default is '?' but can be changed if items contain '?'.
+ void AutoCompSetTypeSeparator(int separatorCharacter);
+
+ // Set the maximum width, in characters, of auto-completion and user lists.
+ // Set to 0 to autosize to fit longest item, which is the default.
+ void AutoCompSetMaxWidth(int characterCount);
+
+ // Get the maximum width, in characters, of auto-completion and user lists.
+ int AutoCompGetMaxWidth() const;
+
+ // Set the maximum height, in rows, of auto-completion and user lists.
+ // The default is 5 rows.
+ void AutoCompSetMaxHeight(int rowCount);
+
+ // Set the maximum height, in rows, of auto-completion and user lists.
+ int AutoCompGetMaxHeight() const;
+
+ // Set the number of spaces used for one level of indentation.
+ void SetIndent(int indentSize);
+
+ // Retrieve indentation size.
+ int GetIndent() const;
+
+ // Indentation will only use space characters if useTabs is false, otherwise
+ // it will use a combination of tabs and spaces.
+ void SetUseTabs(bool useTabs);
+
+ // Retrieve whether tabs will be used in indentation.
+ bool GetUseTabs() const;
+
+ // Change the indentation of a line to a number of columns.
+ void SetLineIndentation(int line, int indentSize);
+
+ // Retrieve the number of columns that a line is indented.
+ int GetLineIndentation(int line) const;
+
+ // Retrieve the position before the first non indentation character on a line.
+ int GetLineIndentPosition(int line) const;
+
+ // Retrieve the column number of a position, taking tab width into account.
+ int GetColumn(int pos) const;
+
+ // Count characters between two positions.
+ int CountCharacters(int startPos, int endPos);
+
+ // Show or hide the horizontal scroll bar.
+ void SetUseHorizontalScrollBar(bool show);
+
+ // Is the horizontal scroll bar visible?
+ bool GetUseHorizontalScrollBar() const;
+
+ // Show or hide indentation guides.
+ void SetIndentationGuides(int indentView);
+
+ // Are the indentation guides visible?
+ int GetIndentationGuides() const;
+
+ // Set the highlighted indentation guide column.
+ // 0 = no highlighted guide.
+ void SetHighlightGuide(int column);
+
+ // Get the highlighted indentation guide column.
+ int GetHighlightGuide() const;
+
+ // Get the position after the last visible characters on a line.
+ int GetLineEndPosition(int line) const;
+
+ // Get the code page used to interpret the bytes of the document as characters.
+ int GetCodePage() const;
+
+ // Get the foreground colour of the caret.
+ wxColour GetCaretForeground() const;
+
+ // In read-only mode?
+ bool GetReadOnly() const;
+
+ // Sets the position of the caret.
+ void SetCurrentPos(int pos);
+
+ // Sets the position that starts the selection - this becomes the anchor.
+ void SetSelectionStart(int pos);
+
+ // Returns the position at the start of the selection.
+ int GetSelectionStart() const;
+
+ // Sets the position that ends the selection - this becomes the currentPosition.
+ void SetSelectionEnd(int pos);
+
+ // Returns the position at the end of the selection.
+ int GetSelectionEnd() const;
+
+ // Set caret to a position, while removing any existing selection.
+ void SetEmptySelection(int pos);
+
+ // Sets the print magnification added to the point size of each style for printing.
+ void SetPrintMagnification(int magnification);
+
+ // Returns the print magnification.
+ int GetPrintMagnification() const;
+
+ // Modify colours when printing for clearer printed text.
+ void SetPrintColourMode(int mode);
+
+ // Returns the print colour mode.
+ int GetPrintColourMode() const;
+
+ // Find some text in the document.
+ int FindText(int minPos, int maxPos, const wxString& text, int flags=0);
+
+ // On Windows, will draw the document into a display context such as a printer.
+ int FormatRange(bool doDraw,
+ int startPos,
+ int endPos,
+ wxDC* draw,
+ wxDC* target,
+ wxRect renderRect,
+ wxRect pageRect);
+
+ // Retrieve the display line at the top of the display.
+ int GetFirstVisibleLine() const;
+
+ // Retrieve the contents of a line.
+ wxString GetLine(int line) const;
+
+ // Returns the number of lines in the document. There is always at least one.
+ int GetLineCount() const;
+
+ // Sets the size in pixels of the left margin.
+ void SetMarginLeft(int pixelWidth);
+
+ // Returns the size in pixels of the left margin.
+ int GetMarginLeft() const;
+
+ // Sets the size in pixels of the right margin.
+ void SetMarginRight(int pixelWidth);
+
+ // Returns the size in pixels of the right margin.
+ int GetMarginRight() const;
+
+ // Is the document different from when it was last saved?
+ bool GetModify() const;
+
+ // Retrieve the selected text.
+ wxString GetSelectedText();
+
+ // Retrieve a range of text.
+ wxString GetTextRange(int startPos, int endPos);
+
+ // Draw the selection in normal style or with selection highlighted.
+ void HideSelection(bool normal);
+
+ // Retrieve the line containing a position.
+ int LineFromPosition(int pos) const;
+
+ // Retrieve the position at the start of a line.
+ int PositionFromLine(int line) const;
+
+ // Scroll horizontally and vertically.
+ void LineScroll(int columns, int lines);
+
+ // Ensure the caret is visible.
+ void EnsureCaretVisible();
+
+ // Replace the selected text with the argument text.
+ void ReplaceSelection(const wxString& text);
+
+ // Set to read only or read write.
+ void SetReadOnly(bool readOnly);
+
+ // Will a paste succeed?
+ bool CanPaste() const;
+
+ // Are there any undoable actions in the undo history?
+ bool CanUndo() const;
+
+ // Delete the undo history.
+ void EmptyUndoBuffer();
+
+ // Undo one action in the undo history.
+ void Undo();
+
+ // Cut the selection to the clipboard.
+ void Cut();
+
+ // Copy the selection to the clipboard.
+ void Copy();
+
+ // Paste the contents of the clipboard into the document replacing the selection.
+ void Paste();
+
+ // Clear the selection.
+ void Clear();
+
+ // Replace the contents of the document with the argument text.
+ void SetText(const wxString& text);
+
+ // Retrieve all the text in the document.
+ wxString GetText() const;
+
+ // Retrieve the number of characters in the document.
+ int GetTextLength() const;
+
+ // Set to overtype (true) or insert mode.
+ void SetOvertype(bool overtype);
+
+ // Returns true if overtype mode is active otherwise false is returned.
+ bool GetOvertype() const;
+
+ // Set the width of the insert mode caret.
+ void SetCaretWidth(int pixelWidth);
+
+ // Returns the width of the insert mode caret.
+ int GetCaretWidth() const;
+
+ // Sets the position that starts the target which is used for updating the
+ // document without affecting the scroll position.
+ void SetTargetStart(int pos);
+
+ // Get the position that starts the target.
+ int GetTargetStart() const;
+
+ // Sets the position that ends the target which is used for updating the
+ // document without affecting the scroll position.
+ void SetTargetEnd(int pos);
+
+ // Get the position that ends the target.
+ int GetTargetEnd() const;
+
+ // Replace the target text with the argument text.
+ // Text is counted so it can contain NULs.
+ // Returns the length of the replacement text.
+ int ReplaceTarget(const wxString& text);
+
+ // Replace the target text with the argument text after \\d processing.
+ // Text is counted so it can contain NULs.
+ // Looks for \\d where d is between 1 and 9 and replaces these with the strings
+ // matched in the last search operation which were surrounded by \( and \).
+ // Returns the length of the replacement text including any change
+ // caused by processing the \\d patterns.
+ int ReplaceTargetRE(const wxString& text);
+
+ // Search for a counted string in the target and set the target to the found
+ // range. Text is counted so it can contain NULs.
+ // Returns length of range or -1 for failure in which case target is not moved.
+ int SearchInTarget(const wxString& text);
+
+ // Set the search flags used by SearchInTarget.
+ void SetSearchFlags(int flags);
+
+ // Get the search flags used by SearchInTarget.
+ int GetSearchFlags() const;
+
+ // Show a call tip containing a definition near position pos.
+ void CallTipShow(int pos, const wxString& definition);
+
+ // Remove the call tip from the screen.
+ void CallTipCancel();
+
+ // Is there an active call tip?
+ bool CallTipActive();
+
+ // Retrieve the position where the caret was before displaying the call tip.
+ int CallTipPosAtStart();
+
+ // Highlight a segment of the definition.
+ void CallTipSetHighlight(int start, int end);
+
+ // Set the background colour for the call tip.
+ void CallTipSetBackground(const wxColour& back);
+
+ // Set the foreground colour for the call tip.
+ void CallTipSetForeground(const wxColour& fore);
+
+ // Set the foreground colour for the highlighted part of the call tip.
+ void CallTipSetForegroundHighlight(const wxColour& fore);
+
+ // Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
+ void CallTipUseStyle(int tabSize);
+
+ // Set position of calltip, above or below text.
+ void CallTipSetPosition(bool above);
+
+ // Find the display line of a document line taking hidden lines into account.
+ int VisibleFromDocLine(int line);
+
+ // Find the document line of a display line taking hidden lines into account.
+ int DocLineFromVisible(int lineDisplay);
+
+ // The number of display lines needed to wrap a document line
+ int WrapCount(int line);
+
+ // Set the fold level of a line.
+ // This encodes an integer level along with flags indicating whether the
+ // line is a header and whether it is effectively white space.
+ void SetFoldLevel(int line, int level);
+
+ // Retrieve the fold level of a line.
+ int GetFoldLevel(int line) const;
+
+ // Find the last child line of a header line.
+ int GetLastChild(int line, int level) const;
+
+ // Find the parent line of a child line.
+ int GetFoldParent(int line) const;
+
+ // Make a range of lines visible.
+ void ShowLines(int lineStart, int lineEnd);
+
+ // Make a range of lines invisible.
+ void HideLines(int lineStart, int lineEnd);
+
+ // Is a line visible?
+ bool GetLineVisible(int line) const;
+
+ // Are all lines visible?
+ bool GetAllLinesVisible() const;
+
+ // Show the children of a header line.
+ void SetFoldExpanded(int line, bool expanded);
+
+ // Is a header line expanded?
+ bool GetFoldExpanded(int line) const;
+
+ // Switch a header line between expanded and contracted.
+ void ToggleFold(int line);
+
+ // Ensure a particular line is visible by expanding any header line hiding it.
+ void EnsureVisible(int line);
+
+ // Set some style options for folding.
+ void SetFoldFlags(int flags);
+
+ // Ensure a particular line is visible by expanding any header line hiding it.
+ // Use the currently set visibility policy to determine which range to display.
+ void EnsureVisibleEnforcePolicy(int line);
+
+ // Sets whether a tab pressed when caret is within indentation indents.
+ void SetTabIndents(bool tabIndents);
+
+ // Does a tab pressed when caret is within indentation indent?
+ bool GetTabIndents() const;
+
+ // Sets whether a backspace pressed when caret is within indentation unindents.
+ void SetBackSpaceUnIndents(bool bsUnIndents);
+
+ // Does a backspace pressed when caret is within indentation unindent?
+ bool GetBackSpaceUnIndents() const;
+
+ // Sets the time the mouse must sit still to generate a mouse dwell event.
+ void SetMouseDwellTime(int periodMilliseconds);
+
+ // Retrieve the time the mouse must sit still to generate a mouse dwell event.
+ int GetMouseDwellTime() const;
+
+ // Get position of start of word.
+ int WordStartPosition(int pos, bool onlyWordCharacters);
+
+ // Get position of end of word.
+ int WordEndPosition(int pos, bool onlyWordCharacters);
+
+ // Sets whether text is word wrapped.
+ void SetWrapMode(int mode);
+
+ // Retrieve whether text is word wrapped.
+ int GetWrapMode() const;
+
+ // Set the display mode of visual flags for wrapped lines.
+ void SetWrapVisualFlags(int wrapVisualFlags);
+
+ // Retrive the display mode of visual flags for wrapped lines.
+ int GetWrapVisualFlags() const;
+
+ // Set the location of visual flags for wrapped lines.
+ void SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation);
+
+ // Retrive the location of visual flags for wrapped lines.
+ int GetWrapVisualFlagsLocation() const;
+
+ // Set the start indent for wrapped lines.
+ void SetWrapStartIndent(int indent);
+
+ // Retrive the start indent for wrapped lines.
+ int GetWrapStartIndent() const;
+
+ // Sets how wrapped sublines are placed. Default is fixed.
+ void SetWrapIndentMode(int mode);
+
+ // Retrieve how wrapped sublines are placed. Default is fixed.
+ int GetWrapIndentMode() const;
+
+ // Sets the degree of caching of layout information.
+ void SetLayoutCache(int mode);
+
+ // Retrieve the degree of caching of layout information.
+ int GetLayoutCache() const;
+
+ // Sets the document width assumed for scrolling.
+ void SetScrollWidth(int pixelWidth);
+
+ // Retrieve the document width assumed for scrolling.
+ int GetScrollWidth() const;
+
+ // Sets whether the maximum width line displayed is used to set scroll width.
+ void SetScrollWidthTracking(bool tracking);
+
+ // Retrieve whether the scroll width tracks wide lines.
+ bool GetScrollWidthTracking() const;
+
+ // Measure the pixel width of some text in a particular style.
+ // NUL terminated text argument.
+ // Does not handle tab or control characters.
+ int TextWidth(int style, const wxString& text);
+
+ // Sets the scroll range so that maximum scroll position has
+ // the last line at the bottom of the view (default).
+ // Setting this to false allows scrolling one page below the last line.
+ void SetEndAtLastLine(bool endAtLastLine);
+
+ // Retrieve whether the maximum scroll position has the last
+ // line at the bottom of the view.
+ bool GetEndAtLastLine() const;
+
+ // Retrieve the height of a particular line of text in pixels.
+ int TextHeight(int line);
+
+ // Show or hide the vertical scroll bar.
+ void SetUseVerticalScrollBar(bool show);
+
+ // Is the vertical scroll bar visible?
+ bool GetUseVerticalScrollBar() const;
+
+ // Append a string to the end of the document without changing the selection.
+ void AppendText(const wxString& text);
+
+ // Is drawing done in two phases with backgrounds drawn before foregrounds?
+ bool GetTwoPhaseDraw() const;
+
+ // In twoPhaseDraw mode, drawing is performed in two phases, first the background
+ // and then the foreground. This avoids chopping off characters that overlap the next run.
+ void SetTwoPhaseDraw(bool twoPhase);
+
+ // Scroll so that a display line is at the top of the display.
+ void SetFirstVisibleLine(int lineDisplay);
+
+ // Change the effect of pasting when there are multiple selections.
+ void SetMultiPaste(int multiPaste);
+
+ // Retrieve the effect of pasting when there are multiple selections.
+ int GetMultiPaste() const;
+
+ // Retrieve the value of a tag from a regular expression search.
+ wxString GetTag(int tagNumber) const;
+
+ // Make the target range start and end be the same as the selection range start and end.
+ void TargetFromSelection();
+
+ // Join the lines in the target.
+ void LinesJoin();
+
+ // Split the lines in the target into lines that are less wide than pixelWidth
+ // where possible.
+ void LinesSplit(int pixelWidth);
+
+ // Set the colours used as a chequerboard pattern in the fold margin
+ void SetFoldMarginColour(bool useSetting, const wxColour& back);
+ void SetFoldMarginHiColour(bool useSetting, const wxColour& fore);
+
+ // Move caret down one line.
+ void LineDown();
+
+ // Move caret down one line extending selection to new caret position.
+ void LineDownExtend();
+
+ // Move caret up one line.
+ void LineUp();
+
+ // Move caret up one line extending selection to new caret position.
+ void LineUpExtend();
+
+ // Move caret left one character.
+ void CharLeft();
+
+ // Move caret left one character extending selection to new caret position.
+ void CharLeftExtend();
+
+ // Move caret right one character.
+ void CharRight();
+
+ // Move caret right one character extending selection to new caret position.
+ void CharRightExtend();
+
+ // Move caret left one word.
+ void WordLeft();
+
+ // Move caret left one word extending selection to new caret position.
+ void WordLeftExtend();
+
+ // Move caret right one word.
+ void WordRight();
+
+ // Move caret right one word extending selection to new caret position.
+ void WordRightExtend();
+
+ // Move caret to first position on line.
+ void Home();
+
+ // Move caret to first position on line extending selection to new caret position.
+ void HomeExtend();
+
+ // Move caret to last position on line.
+ void LineEnd();
+
+ // Move caret to last position on line extending selection to new caret position.
+ void LineEndExtend();
+
+ // Move caret to first position in document.
+ void DocumentStart();
+
+ // Move caret to first position in document extending selection to new caret position.
+ void DocumentStartExtend();
+
+ // Move caret to last position in document.
+ void DocumentEnd();
+
+ // Move caret to last position in document extending selection to new caret position.
+ void DocumentEndExtend();
+
+ // Move caret one page up.
+ void PageUp();
+
+ // Move caret one page up extending selection to new caret position.
+ void PageUpExtend();
+
+ // Move caret one page down.
+ void PageDown();
+
+ // Move caret one page down extending selection to new caret position.
+ void PageDownExtend();
+
+ // Switch from insert to overtype mode or the reverse.
+ void EditToggleOvertype();
+
+ // Cancel any modes such as call tip or auto-completion list display.
+ void Cancel();
+
+ // Delete the selection or if no selection, the character before the caret.
+ void DeleteBack();
+
+ // If selection is empty or all on one line replace the selection with a tab character.
+ // If more than one line selected, indent the lines.
+ void Tab();
+
+ // Dedent the selected lines.
+ void BackTab();
+
+ // Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
+ void NewLine();
+
+ // Insert a Form Feed character.
+ void FormFeed();
+
+ // Move caret to before first visible character on line.
+ // If already there move to first character on line.
+ void VCHome();
+
+ // Like VCHome but extending selection to new caret position.
+ void VCHomeExtend();
+
+ // Magnify the displayed text by increasing the sizes by 1 point.
+ void ZoomIn();
+
+ // Make the displayed text smaller by decreasing the sizes by 1 point.
+ void ZoomOut();
+
+ // Delete the word to the left of the caret.
+ void DelWordLeft();
+
+ // Delete the word to the right of the caret.
+ void DelWordRight();
+
+ // Delete the word to the right of the caret, but not the trailing non-word characters.
+ void DelWordRightEnd();
+
+ // Cut the line containing the caret.
+ void LineCut();
+
+ // Delete the line containing the caret.
+ void LineDelete();
+
+ // Switch the current line with the previous.
+ void LineTranspose();
+
+ // Duplicate the current line.
+ void LineDuplicate();
+
+ // Transform the selection to lower case.
+ void LowerCase();
+
+ // Transform the selection to upper case.
+ void UpperCase();
+
+ // Scroll the document down, keeping the caret visible.
+ void LineScrollDown();
+
+ // Scroll the document up, keeping the caret visible.
+ void LineScrollUp();
+
+ // Delete the selection or if no selection, the character before the caret.
+ // Will not delete the character before at the start of a line.
+ void DeleteBackNotLine();
+
+ // Move caret to first position on display line.
+ void HomeDisplay();
+
+ // Move caret to first position on display line extending selection to
+ // new caret position.
+ void HomeDisplayExtend();
+
+ // Move caret to last position on display line.
+ void LineEndDisplay();
+
+ // Move caret to last position on display line extending selection to new
+ // caret position.
+ void LineEndDisplayExtend();
+
+ // These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
+ // except they behave differently when word-wrap is enabled:
+ // They go first to the start / end of the display line, like (Home|LineEnd)Display
+ // The difference is that, the cursor is already at the point, it goes on to the start
+ // or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
+ void HomeWrap();
+ void HomeWrapExtend();
+ void LineEndWrap();
+ void LineEndWrapExtend();
+ void VCHomeWrap();
+ void VCHomeWrapExtend();
+
+ // Copy the line containing the caret.
+ void LineCopy();
+
+ // Move the caret inside current view if it's not there already.
+ void MoveCaretInsideView();
+
+ // How many characters are on a line, including end of line characters?
+ int LineLength(int line) const;
+
+ // Highlight the characters at two positions.
+ void BraceHighlight(int pos1, int pos2);
+
+ // Use specified indicator to highlight matching braces instead of changing their style.
+ void BraceHighlightIndicator(bool useBraceHighlightIndicator, int indicator);
+
+ // Highlight the character at a position indicating there is no matching brace.
+ void BraceBadLight(int pos);
+
+ // Use specified indicator to highlight non matching brace instead of changing its style.
+ void BraceBadLightIndicator(bool useBraceBadLightIndicator, int indicator);
+
+ // Find the position of a matching brace or INVALID_POSITION if no match.
+ int BraceMatch(int pos);
+
+ // Are the end of line characters visible?
+ bool GetViewEOL() const;
+
+ // Make the end of line characters visible or invisible.
+ void SetViewEOL(bool visible);
+
+ // Retrieve a pointer to the document object.
+ void* GetDocPointer();
+
+ // Change the document object used.
+ void SetDocPointer(void* docPointer);
+
+ // Set which document modification events are sent to the container.
+ void SetModEventMask(int mask);
+
+ // Retrieve the column number which text should be kept within.
+ int GetEdgeColumn() const;
+
+ // Set the column number of the edge.
+ // If text goes past the edge then it is highlighted.
+ void SetEdgeColumn(int column);
+
+ // Retrieve the edge highlight mode.
+ int GetEdgeMode() const;
+
+ // The edge may be displayed by a line (EDGE_LINE) or by highlighting text that
+ // goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
+ void SetEdgeMode(int mode);
+
+ // Retrieve the colour used in edge indication.
+ wxColour GetEdgeColour() const;
+
+ // Change the colour used in edge indication.
+ void SetEdgeColour(const wxColour& edgeColour);
+
+ // Sets the current caret position to be the search anchor.
+ void SearchAnchor();
+
+ // Find some text starting at the search anchor.
+ // Does not ensure the selection is visible.
+ int SearchNext(int flags, const wxString& text);
+
+ // Find some text starting at the search anchor and moving backwards.
+ // Does not ensure the selection is visible.
+ int SearchPrev(int flags, const wxString& text);
+
+ // Retrieves the number of lines completely visible.
+ int LinesOnScreen() const;
+
+ // Set whether a pop up menu is displayed automatically when the user presses
+ // the wrong mouse button.
+ void UsePopUp(bool allowPopUp);
+
+ // Is the selection rectangular? The alternative is the more common stream selection.
+ bool SelectionIsRectangle() const;
+
+ // Set the zoom level. This number of points is added to the size of all fonts.
+ // It may be positive to magnify or negative to reduce.
+ void SetZoom(int zoom);
+
+ // Retrieve the zoom level.
+ int GetZoom() const;
+
+ // Create a new document object.
+ // Starts with reference count of 1 and not selected into editor.
+ void* CreateDocument();
+
+ // Extend life of document.
+ void AddRefDocument(void* docPointer);
+
+ // Release a reference to the document, deleting document if it fades to black.
+ void ReleaseDocument(void* docPointer);
+
+ // Get which document modification events are sent to the container.
+ int GetModEventMask() const;
+
+ // Change internal focus flag.
+ void SetSTCFocus(bool focus);
+
+ // Get internal focus flag.
+ bool GetSTCFocus() const;
+
+ // Change error status - 0 = OK.
+ void SetStatus(int statusCode);
+
+ // Get error status.
+ int GetStatus() const;
+
+ // Set whether the mouse is captured when its button is pressed.
+ void SetMouseDownCaptures(bool captures);
+
+ // Get whether mouse gets captured.
+ bool GetMouseDownCaptures() const;
+
+ // Sets the cursor to one of the SC_CURSOR* values.
+ void SetSTCCursor(int cursorType);
+
+ // Get cursor type.
+ int GetSTCCursor() const;
+
+ // Change the way control characters are displayed:
+ // If symbol is < 32, keep the drawn way, else, use the given character.
+ void SetControlCharSymbol(int symbol);
+
+ // Get the way control characters are displayed.
+ int GetControlCharSymbol() const;
+
+ // Move to the previous change in capitalisation.
+ void WordPartLeft();
+
+ // Move to the previous change in capitalisation extending selection
+ // to new caret position.
+ void WordPartLeftExtend();
+
+ // Move to the change next in capitalisation.
+ void WordPartRight();
+
+ // Move to the next change in capitalisation extending selection
+ // to new caret position.
+ void WordPartRightExtend();
+
+ // Set the way the display area is determined when a particular line
+ // is to be moved to by Find, FindNext, GotoLine, etc.
+ void SetVisiblePolicy(int visiblePolicy, int visibleSlop);
+
+ // Delete back from the current position to the start of the line.
+ void DelLineLeft();
+
+ // Delete forwards from the current position to the end of the line.
+ void DelLineRight();
+
+ // Get and Set the xOffset (ie, horizontal scroll position).
+ void SetXOffset(int newOffset);
+ int GetXOffset() const;
+
+ // Set the last x chosen value to be the caret x position.
+ void ChooseCaretX();
+
+ // Set the way the caret is kept visible when going sideways.
+ // The exclusion zone is given in pixels.
+ void SetXCaretPolicy(int caretPolicy, int caretSlop);
+
+ // Set the way the line the caret is on is kept visible.
+ // The exclusion zone is given in lines.
+ void SetYCaretPolicy(int caretPolicy, int caretSlop);
+
+ // Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
+ void SetPrintWrapMode(int mode);
+
+ // Is printing line wrapped?
+ int GetPrintWrapMode() const;
+
+ // Set a fore colour for active hotspots.
+ void SetHotspotActiveForeground(bool useSetting, const wxColour& fore);
+
+ // Get the fore colour for active hotspots.
+ wxColour GetHotspotActiveForeground() const;
+
+ // Set a back colour for active hotspots.
+ void SetHotspotActiveBackground(bool useSetting, const wxColour& back);
+
+ // Get the back colour for active hotspots.
+ wxColour GetHotspotActiveBackground() const;
+
+ // Enable / Disable underlining active hotspots.
+ void SetHotspotActiveUnderline(bool underline);
+
+ // Get whether underlining for active hotspots.
+ bool GetHotspotActiveUnderline() const;
+
+ // Limit hotspots to single line so hotspots on two lines don't merge.
+ void SetHotspotSingleLine(bool singleLine);
+
+ // Get the HotspotSingleLine property
+ bool GetHotspotSingleLine() const;
+
+ // Move caret between paragraphs (delimited by empty lines).
+ void ParaDown();
+ void ParaDownExtend();
+ void ParaUp();
+ void ParaUpExtend();
+
+ // Given a valid document position, return the previous position taking code
+ // page into account. Returns 0 if passed 0.
+ int PositionBefore(int pos);
+
+ // Given a valid document position, return the next position taking code
+ // page into account. Maximum value returned is the last position in the document.
+ int PositionAfter(int pos);
+
+ // Copy a range of text to the clipboard. Positions are clipped into the document.
+ void CopyRange(int start, int end);
+
+ // Copy argument text to the clipboard.
+ void CopyText(int length, const wxString& text);
+
+ // Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or
+ // by lines (SC_SEL_LINES).
+ void SetSelectionMode(int mode);
+
+ // Get the mode of the current selection.
+ int GetSelectionMode() const;
+
+ // Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).
+ int GetLineSelStartPosition(int line);
+
+ // Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).
+ int GetLineSelEndPosition(int line);
+
+ // Move caret down one line, extending rectangular selection to new caret position.
+ void LineDownRectExtend();
+
+ // Move caret up one line, extending rectangular selection to new caret position.
+ void LineUpRectExtend();
+
+ // Move caret left one character, extending rectangular selection to new caret position.
+ void CharLeftRectExtend();
+
+ // Move caret right one character, extending rectangular selection to new caret position.
+ void CharRightRectExtend();
+
+ // Move caret to first position on line, extending rectangular selection to new caret position.
+ void HomeRectExtend();
+
+ // Move caret to before first visible character on line.
+ // If already there move to first character on line.
+ // In either case, extend rectangular selection to new caret position.
+ void VCHomeRectExtend();
+
+ // Move caret to last position on line, extending rectangular selection to new caret position.
+ void LineEndRectExtend();
+
+ // Move caret one page up, extending rectangular selection to new caret position.
+ void PageUpRectExtend();
+
+ // Move caret one page down, extending rectangular selection to new caret position.
+ void PageDownRectExtend();
+
+ // Move caret to top of page, or one page up if already at top of page.
+ void StutteredPageUp();
+
+ // Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.
+ void StutteredPageUpExtend();
+
+ // Move caret to bottom of page, or one page down if already at bottom of page.
+ void StutteredPageDown();
+
+ // Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.
+ void StutteredPageDownExtend();
+
+ // Move caret left one word, position cursor at end of word.
+ void WordLeftEnd();
+
+ // Move caret left one word, position cursor at end of word, extending selection to new caret position.
+ void WordLeftEndExtend();
+
+ // Move caret right one word, position cursor at end of word.
+ void WordRightEnd();
+
+ // Move caret right one word, position cursor at end of word, extending selection to new caret position.
+ void WordRightEndExtend();
+
+ // Set the set of characters making up whitespace for when moving or selecting by word.
+ // Should be called after SetWordChars.
+ void SetWhitespaceChars(const wxString& characters);
+
+ // Get the set of characters making up whitespace for when moving or selecting by word.
+ wxString GetWhitespaceChars() const;
+
+ // Set the set of characters making up punctuation characters
+ // Should be called after SetWordChars.
+ void SetPunctuationChars(const wxString& characters);
+
+ // Get the set of characters making up punctuation characters
+ wxString GetPunctuationChars() const;
+
+ // Reset the set of characters for whitespace and word characters to the defaults.
+ void SetCharsDefault();
+
+ // Get currently selected item position in the auto-completion list
+ int AutoCompGetCurrent() const;
+
+ // Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference.
+ void AutoCompSetCaseInsensitiveBehaviour(int behaviour);
+
+ // Get auto-completion case insensitive behaviour.
+ int AutoCompGetCaseInsensitiveBehaviour() const;
+
+ // Enlarge the document to a particular size of text bytes.
+ void Allocate(int bytes);
+
+ // Find the position of a column on a line taking into account tabs and
+ // multi-byte characters. If beyond end of line, return line end position.
+ int FindColumn(int line, int column);
+
+ // Can the caret preferred x position only be changed by explicit movement commands?
+ int GetCaretSticky() const;
+
+ // Stop the caret preferred x position changing when the user types.
+ void SetCaretSticky(int useCaretStickyBehaviour);
+
+ // Switch between sticky and non-sticky: meant to be bound to a key.
+ void ToggleCaretSticky();
+
+ // Enable/Disable convert-on-paste for line endings
+ void SetPasteConvertEndings(bool convert);
+
+ // Get convert-on-paste setting
+ bool GetPasteConvertEndings() const;
+
+ // Duplicate the selection. If selection empty duplicate the line containing the caret.
+ void SelectionDuplicate();
+
+ // Set background alpha of the caret line.
+ void SetCaretLineBackAlpha(int alpha);
+
+ // Get the background alpha of the caret line.
+ int GetCaretLineBackAlpha() const;
+
+ // Set the style of the caret to be drawn.
+ void SetCaretStyle(int caretStyle);
+
+ // Returns the current style of the caret.
+ int GetCaretStyle() const;
+
+ // Set the indicator used for IndicatorFillRange and IndicatorClearRange
+ void SetIndicatorCurrent(int indicator);
+
+ // Get the current indicator
+ int GetIndicatorCurrent() const;
+
+ // Set the value used for IndicatorFillRange
+ void SetIndicatorValue(int value);
+
+ // Get the current indicator value
+ int GetIndicatorValue() const;
+
+ // Turn a indicator on over a range.
+ void IndicatorFillRange(int position, int fillLength);
+
+ // Turn a indicator off over a range.
+ void IndicatorClearRange(int position, int clearLength);
+
+ // Are any indicators present at position?
+ int IndicatorAllOnFor(int position);
+
+ // What value does a particular indicator have at at a position?
+ int IndicatorValueAt(int indicator, int position);
+
+ // Where does a particular indicator start?
+ int IndicatorStart(int indicator, int position);
+
+ // Where does a particular indicator end?
+ int IndicatorEnd(int indicator, int position);
+
+ // Set number of entries in position cache
+ void SetPositionCacheSize(int size);
+
+ // How many entries are allocated to the position cache?
+ int GetPositionCacheSize() const;
+
+ // Copy the selection, if selection empty copy the line with the caret
+ void CopyAllowLine();
+
+ // Compact the document buffer and return a read-only pointer to the
+ // characters in the document.
+ const char* GetCharacterPointer() const;
+
+ // Return a read-only pointer to a range of characters in the document.
+ // May move the gap so that the range is contiguous, but will only move up
+ // to rangeLength bytes.
+ const char* GetRangePointer(int position, int rangeLength) const;
+
+ // Return a position which, to avoid performance costs, should not be within
+ // the range of a call to GetRangePointer.
+ int GetGapPosition() const;
+
+ // Always interpret keyboard input as Unicode
+ void SetKeysUnicode(bool keysUnicode);
+
+ // Are keys always interpreted as Unicode?
+ bool GetKeysUnicode() const;
+
+ // Set the alpha fill colour of the given indicator.
+ void IndicatorSetAlpha(int indicator, int alpha);
+
+ // Get the alpha fill colour of the given indicator.
+ int IndicatorGetAlpha(int indicator) const;
+
+ // Set the alpha outline colour of the given indicator.
+ void IndicatorSetOutlineAlpha(int indicator, int alpha);
+
+ // Get the alpha outline colour of the given indicator.
+ int IndicatorGetOutlineAlpha(int indicator) const;
+
+ // Set extra ascent for each line
+ void SetExtraAscent(int extraAscent);
+
+ // Get extra ascent for each line
+ int GetExtraAscent() const;
+
+ // Set extra descent for each line
+ void SetExtraDescent(int extraDescent);
+
+ // Get extra descent for each line
+ int GetExtraDescent() const;
+
+ // Which symbol was defined for markerNumber with MarkerDefine
+ int GetMarkerSymbolDefined(int markerNumber);
+
+ // Set the text in the text margin for a line
+ void MarginSetText(int line, const wxString& text);
+
+ // Get the text in the text margin for a line
+ wxString MarginGetText(int line) const;
+
+ // Set the style number for the text margin for a line
+ void MarginSetStyle(int line, int style);
+
+ // Get the style number for the text margin for a line
+ int MarginGetStyle(int line) const;
+
+ // Set the style in the text margin for a line
+ void MarginSetStyles(int line, const wxString& styles);
+
+ // Get the styles in the text margin for a line
+ wxString MarginGetStyles(int line) const;
+
+ // Clear the margin text on all lines
+ void MarginTextClearAll();
+
+ // Get the start of the range of style numbers used for margin text
+ void MarginSetStyleOffset(int style);
+
+ // Get the start of the range of style numbers used for margin text
+ int MarginGetStyleOffset() const;
+
+ // Set the margin options.
+ void SetMarginOptions(int marginOptions);
+
+ // Get the margin options.
+ int GetMarginOptions() const;
+
+ // Set the annotation text for a line
+ void AnnotationSetText(int line, const wxString& text);
+
+ // Get the annotation text for a line
+ wxString AnnotationGetText(int line) const;
+
+ // Set the style number for the annotations for a line
+ void AnnotationSetStyle(int line, int style);
+
+ // Get the style number for the annotations for a line
+ int AnnotationGetStyle(int line) const;
+
+ // Set the annotation styles for a line
+ void AnnotationSetStyles(int line, const wxString& styles);
+
+ // Get the annotation styles for a line
+ wxString AnnotationGetStyles(int line) const;
+
+ // Get the number of annotation lines for a line
+ int AnnotationGetLines(int line) const;
+
+ // Clear the annotations from all lines
+ void AnnotationClearAll();
+
+ // Set the visibility for the annotations for a view
+ void AnnotationSetVisible(int visible);
+
+ // Get the visibility for the annotations for a view
+ int AnnotationGetVisible() const;
+
+ // Get the start of the range of style numbers used for annotations
+ void AnnotationSetStyleOffset(int style);
+
+ // Get the start of the range of style numbers used for annotations
+ int AnnotationGetStyleOffset() const;
+
+ // Add a container action to the undo stack
+ void AddUndoAction(int token, int flags);
+
+ // Find the position of a character from a point within the window.
+ int CharPositionFromPoint(int x, int y);
+
+ // Find the position of a character from a point within the window.
+ // Return INVALID_POSITION if not close to text.
+ int CharPositionFromPointClose(int x, int y);
+
+ // Set whether multiple selections can be made
+ void SetMultipleSelection(bool multipleSelection);
+
+ // Whether multiple selections can be made
+ bool GetMultipleSelection() const;
+
+ // Set whether typing can be performed into multiple selections
+ void SetAdditionalSelectionTyping(bool additionalSelectionTyping);
+
+ // Whether typing can be performed into multiple selections
+ bool GetAdditionalSelectionTyping() const;
+
+ // Set whether additional carets will blink
+ void SetAdditionalCaretsBlink(bool additionalCaretsBlink);
+
+ // Whether additional carets will blink
+ bool GetAdditionalCaretsBlink() const;
+
+ // Set whether additional carets are visible
+ void SetAdditionalCaretsVisible(bool additionalCaretsBlink);
+
+ // Whether additional carets are visible
+ bool GetAdditionalCaretsVisible() const;
+
+ // How many selections are there?
+ int GetSelections() const;
+
+ // Clear selections to a single empty stream selection
+ void ClearSelections();
+
+ // Add a selection
+ int AddSelection(int caret, int anchor);
+
+ // Set the main selection
+ void SetMainSelection(int selection);
+
+ // Which selection is the main selection
+ int GetMainSelection() const;
+ void SetSelectionNCaret(int selection, int pos);
+ int GetSelectionNCaret(int selection) const;
+ void SetSelectionNAnchor(int selection, int posAnchor);
+ int GetSelectionNAnchor(int selection) const;
+ void SetSelectionNCaretVirtualSpace(int selection, int space);
+ int GetSelectionNCaretVirtualSpace(int selection) const;
+ void SetSelectionNAnchorVirtualSpace(int selection, int space);
+ int GetSelectionNAnchorVirtualSpace(int selection) const;
+
+ // Sets the position that starts the selection - this becomes the anchor.
+ void SetSelectionNStart(int selection, int pos);
+
+ // Returns the position at the start of the selection.
+ int GetSelectionNStart(int selection) const;
+
+ // Sets the position that ends the selection - this becomes the currentPosition.
+ void SetSelectionNEnd(int selection, int pos);
+
+ // Returns the position at the end of the selection.
+ int GetSelectionNEnd(int selection) const;
+ void SetRectangularSelectionCaret(int pos);
+ int GetRectangularSelectionCaret() const;
+ void SetRectangularSelectionAnchor(int posAnchor);
+ int GetRectangularSelectionAnchor() const;
+ void SetRectangularSelectionCaretVirtualSpace(int space);
+ int GetRectangularSelectionCaretVirtualSpace() const;
+ void SetRectangularSelectionAnchorVirtualSpace(int space);
+ int GetRectangularSelectionAnchorVirtualSpace() const;
+ void SetVirtualSpaceOptions(int virtualSpaceOptions);
+ int GetVirtualSpaceOptions() const;
+
+ // On GTK+, allow selecting the modifier key to use for mouse-based
+ // rectangular selection. Often the window manager requires Alt+Mouse Drag
+ // for moving windows.
+ // Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER.
+ void SetRectangularSelectionModifier(int modifier);
+
+ // Get the modifier key used for rectangular selection.
+ int GetRectangularSelectionModifier() const;
+
+ // Set the foreground colour of additional selections.
+ // Must have previously called SetSelFore with non-zero first argument for this to have an effect.
+ void SetAdditionalSelForeground(const wxColour& fore);
+
+ // Set the background colour of additional selections.
+ // Must have previously called SetSelBack with non-zero first argument for this to have an effect.
+ void SetAdditionalSelBackground(const wxColour& back);
+
+ // Set the alpha of the selection.
+ void SetAdditionalSelAlpha(int alpha);
+
+ // Get the alpha of the selection.
+ int GetAdditionalSelAlpha() const;
+
+ // Set the foreground colour of additional carets.
+ void SetAdditionalCaretForeground(const wxColour& fore);
+
+ // Get the foreground colour of additional carets.
+ wxColour GetAdditionalCaretForeground() const;
+
+ // Set the main selection to the next selection.
+ void RotateSelection();
+
+ // Swap that caret and anchor of the main selection.
+ void SwapMainAnchorCaret();
+
+ // Indicate that the internal state of a lexer has changed over a range and therefore
+ // there may be a need to redraw.
+ int ChangeLexerState(int start, int end);
+
+ // Find the next line at or after lineStart that is a contracted fold header line.
+ // Return -1 when no more lines.
+ int ContractedFoldNext(int lineStart);
+
+ // Centre current line in window.
+ void VerticalCentreCaret();
+
+ // Move the selected lines up one line, shifting the line above after the selection
+ void MoveSelectedLinesUp();
+
+ // Move the selected lines down one line, shifting the line below before the selection
+ void MoveSelectedLinesDown();
+
+ // Set the identifier reported as idFrom in notification messages.
+ void SetIdentifier(int identifier);
+
+ // Get the identifier.
+ int GetIdentifier() const;
+
+ // Set the width for future RGBA image data.
+ void RGBAImageSetWidth(int width);
+
+ // Set the height for future RGBA image data.
+ void RGBAImageSetHeight(int height);
+
+ // Define a marker from RGBA data.
+ // It has the width and height from RGBAImageSetWidth/Height
+ void MarkerDefineRGBAImage(int markerNumber, const unsigned char* pixels);
+
+ // Register an RGBA image for use in autocompletion lists.
+ // It has the width and height from RGBAImageSetWidth/Height
+ void RegisterRGBAImage(int type, const unsigned char* pixels);
+
+ // Scroll to start of document.
+ void ScrollToStart();
+
+ // Scroll to end of document.
+ void ScrollToEnd();
+
+ // Set the technology used.
+ void SetTechnology(int technology);
+
+ // Get the tech.
+ int GetTechnology() const;
+
+ // Create an ILoader*.
+ void* CreateLoader(int bytes) const;
+
+ // Start notifying the container of all key presses and commands.
+ void StartRecord();
+
+ // Stop notifying the container of all key presses and commands.
+ void StopRecord();
+
+ // Set the lexing language of the document.
+ void SetLexer(int lexer);
+
+ // Retrieve the lexing language of the document.
+ int GetLexer() const;
+
+ // Colourise a segment of the document using the current lexing language.
+ void Colourise(int start, int end);
+
+ // Set up a value that may be used by a lexer for some optional feature.
+ void SetProperty(const wxString& key, const wxString& value);
+
+ // Set up the key words used by the lexer.
+ void SetKeyWords(int keywordSet, const wxString& keyWords);
+
+ // Set the lexing language of the document based on string name.
+ void SetLexerLanguage(const wxString& language);
+
+ // Retrieve a 'property' value previously set with SetProperty.
+ wxString GetProperty(const wxString& key);
+
+ // Retrieve a 'property' value previously set with SetProperty,
+ // with '$()' variable replacement on returned buffer.
+ wxString GetPropertyExpanded(const wxString& key);
+
+ // Retrieve a 'property' value previously set with SetProperty,
+ // interpreted as an int AFTER any '$()' variable replacement.
+ int GetPropertyInt(const wxString& key) const;
+
+ // Retrieve the number of bits the current lexer needs for styling.
+ int GetStyleBitsNeeded() const;
+
+ // For private communication between an application and a known lexer.
+ void* PrivateLexerCall(int operation, void* pointer);
+
+ // Retrieve a '\n' separated list of properties understood by the current lexer.
+ wxString PropertyNames() const;
+
+ // Retrieve the type of a property.
+ int PropertyType(const wxString& name);
+
+ // Describe a property.
+ wxString DescribeProperty(const wxString& name) const;
+
+ // Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer.
+ wxString DescribeKeyWordSets() const;
+
+ //}}}
+ //----------------------------------------------------------------------
+
+ // Manually declared methods
+
+ // Returns the line number of the line with the caret.
+ int GetCurrentLine();
+
+ // Extract style settings from a spec-string which is composed of one or
+ // more of the following comma separated elements:
+ //
+ // bold turns on bold
+ // italic turns on italics
+ // fore:[name or #RRGGBB] sets the foreground colour
+ // back:[name or #RRGGBB] sets the background colour
+ // face:[facename] sets the font face name to use
+ // size:[num] sets the font size in points
+ // eol turns on eol filling
+ // underline turns on underlining
+ //
+ void StyleSetSpec(int styleNum, const wxString& spec);
+
+
+ // Get the font of a style.
+ wxFont StyleGetFont(int style);
+
+
+ // Set style size, face, bold, italic, and underline attributes from
+ // a wxFont's attributes.
+ void StyleSetFont(int styleNum, wxFont& font);
+
+
+
+ // Set all font style attributes at once.
+ void StyleSetFontAttr(int styleNum, int size,
+ const wxString& faceName,
+ bool bold, bool italic,
+ bool underline,
+ wxFontEncoding encoding=wxFONTENCODING_DEFAULT);
+
+
+ // Set the character set of the font in a style. Converts the Scintilla
+ // character set values to a wxFontEncoding.
+ void StyleSetCharacterSet(int style, int characterSet);
+
+ // Set the font encoding to be used by a style.
+ void StyleSetFontEncoding(int style, wxFontEncoding encoding);
+
+
+ // Perform one of the operations defined by the wxSTC_CMD_* constants.
+ void CmdKeyExecute(int cmd);
+
+
+ // Set the left and right margin in the edit area, measured in pixels.
+ void SetMargins(int left, int right);
+
+
+ // Retrieve the point in the window where a position is displayed.
+ wxPoint PointFromPosition(int pos);
+
+
+ // Scroll enough to make the given line visible
+ void ScrollToLine(int line);
+
+
+ // Scroll enough to make the given column visible
+ void ScrollToColumn(int column);
+
+
+ // Send a message to Scintilla
+ //
+ // NB: this method is not really const as it can modify the control but it
+ // has to be declared as such as it's called from both const and
+ // non-const methods and we can't distinguish between the two
+ wxIntPtr SendMsg(int msg, wxUIntPtr wp=0, wxIntPtr lp=0) const;
+
+
+ // Set the vertical scrollbar to use instead of the ont that's built-in.
+ void SetVScrollBar(wxScrollBar* bar);
+
+
+ // Set the horizontal scrollbar to use instead of the ont that's built-in.
+ void SetHScrollBar(wxScrollBar* bar);
+
+ // Can be used to prevent the EVT_CHAR handler from adding the char
+ bool GetLastKeydownProcessed() { return m_lastKeyDownConsumed; }
+ void SetLastKeydownProcessed(bool val) { m_lastKeyDownConsumed = val; }
+
+ // if we derive from wxTextAreaBase it already provides these methods
+#if !wxUSE_TEXTCTRL
+ // Write the contents of the editor to filename
+ bool SaveFile(const wxString& filename);
+
+ // Load the contents of filename into the editor
+ bool LoadFile(const wxString& filename);
+#endif // !wxUSE_TEXTCTRL
+
+#ifdef STC_USE_DND
+ // Allow for simulating a DnD DragOver
+ wxDragResult DoDragOver(wxCoord x, wxCoord y, wxDragResult def);
+
+ // Allow for simulating a DnD DropText
+ bool DoDropText(long x, long y, const wxString& data);
+#endif
+
+ // Specify whether anti-aliased fonts should be used. Will have no effect
+ // on some platforms, but on some (wxMac for example) can greatly improve
+ // performance.
+ void SetUseAntiAliasing(bool useAA);
+
+ // Returns the current UseAntiAliasing setting.
+ bool GetUseAntiAliasing();
+
+ // Clear annotations from the given line.
+ void AnnotationClearLine(int line);
+
+
+
+ // The following methods are nearly equivalent to their similarly named
+ // cousins above. The difference is that these methods bypass wxString
+ // and always use a char* even if used in a unicode build of wxWidgets.
+ // In that case the character data will be utf-8 encoded since that is
+ // what is used internally by Scintilla in unicode builds.
+
+ // Add text to the document at current position.
+ void AddTextRaw(const char* text, int length=-1);
+
+ // Insert string at a position.
+ void InsertTextRaw(int pos, const char* text);
+
+ // Retrieve the text of the line containing the caret.
+ // Returns the index of the caret on the line.
+#ifdef SWIG
+ wxCharBuffer GetCurLineRaw(int* OUTPUT);
+#else
+ wxCharBuffer GetCurLineRaw(int* linePos=NULL);
+#endif
+
+ // Retrieve the contents of a line.
+ wxCharBuffer GetLineRaw(int line);
+
+ // Retrieve the selected text.
+ wxCharBuffer GetSelectedTextRaw();
+
+ // Retrieve a range of text.
+ wxCharBuffer GetTextRangeRaw(int startPos, int endPos);
+
+ // Replace the contents of the document with the argument text.
+ void SetTextRaw(const char* text);
+
+ // Retrieve all the text in the document.
+ wxCharBuffer GetTextRaw();
+
+ // Append a string to the end of the document without changing the selection.
+ void AppendTextRaw(const char* text, int length=-1);
+
+#ifdef SWIG
+ %pythoncode "_stc_utf8_methods.py"
+#endif
+
+
+ // implement wxTextEntryBase pure virtual methods
+ // ----------------------------------------------
+
+ virtual void WriteText(const wxString& text)
+ {
+ ReplaceSelection(text);
+ }
+
+ virtual void Remove(long from, long to)
+ {
+ Replace(from, to, "");
+ }
+ virtual void Replace(long from, long to, const wxString& text)
+ {
+ SetTargetStart((int)from);
+ SetTargetEnd((int)to);
+ ReplaceTarget(text);
+ }
+
+ /*
+ These functions are already declared in the generated section.
+
+ virtual void Copy();
+ virtual void Cut();
+ virtual void Paste();
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual bool CanUndo() const;
+ virtual bool CanRedo() const;
+
+ */
+
+ virtual void SetInsertionPoint(long pos)
+ {
+ SetCurrentPos(int(pos == -1 ? GetLastPosition() : pos));
+ }
+ virtual long GetInsertionPoint() const { return GetCurrentPos(); }
+ virtual long GetLastPosition() const { return GetTextLength(); }
+
+ virtual void SetSelection(long from, long to)
+ {
+ if ( from == -1 && to == -1 )
+ {
+ SelectAll();
+ }
+ else
+ {
+ SetSelectionStart((int)from);
+ SetSelectionEnd((int)to);
+ }
+ }
+
+ virtual void SelectNone()
+ {
+ ClearSelections();
+ }
+
+#ifdef SWIG
+ void GetSelection(long* OUTPUT, long* OUTPUT) const;
+#else
+ virtual void GetSelection(long *from, long *to) const
+ {
+ if ( from )
+ *from = GetSelectionStart();
+ if ( to )
+ *to = GetSelectionEnd();
+ }
+
+ // kept for compatibility only
+ void GetSelection(int *from, int *to)
+ {
+ long f, t;
+ GetSelection(&f, &t);
+ if ( from )
+ *from = (int)f;
+ if ( to )
+ *to = (int)t;
+ }
+#endif
+
+ virtual bool IsEditable() const { return !GetReadOnly(); }
+ virtual void SetEditable(bool editable) { SetReadOnly(!editable); }
+
+ // implement wxTextAreaBase pure virtual methods
+ // ---------------------------------------------
+
+ virtual int GetLineLength(long lineNo) const { return static_cast<int>(GetLineText(lineNo).length()); }
+ virtual wxString GetLineText(long lineNo) const
+ {
+ wxString text = GetLine(static_cast<int>(lineNo));
+ size_t lastNewLine = text.find_last_not_of(wxS("\r\n"));
+
+ if ( lastNewLine != wxString::npos )
+ text.erase(lastNewLine + 1); // remove trailing cr+lf
+ else
+ text.clear();
+ return text;
+ }
+ virtual int GetNumberOfLines() const { return GetLineCount(); }
+
+ virtual bool IsModified() const { return GetModify(); }
+ virtual void MarkDirty() { wxFAIL_MSG("not implemented"); }
+ virtual void DiscardEdits() { SetSavePoint(); }
+
+ virtual bool SetStyle(long WXUNUSED(start), long WXUNUSED(end),
+ const wxTextAttr& WXUNUSED(style))
+ {
+ wxFAIL_MSG("not implemented");
+
+ return false;
+ }
+
+ virtual bool GetStyle(long WXUNUSED(position), wxTextAttr& WXUNUSED(style))
+ {
+ wxFAIL_MSG("not implemented");
+
+ return false;
+ }
+
+ virtual bool SetDefaultStyle(const wxTextAttr& WXUNUSED(style))
+ {
+ wxFAIL_MSG("not implemented");
+
+ return false;
+ }
+
+ virtual long XYToPosition(long x, long y) const
+ {
+ long pos = PositionFromLine((int)y);
+ pos += x;
+ return pos;
+ }
+
+ virtual bool PositionToXY(long pos, long *x, long *y) const
+ {
+ int l = LineFromPosition((int)pos);
+ if ( l == -1 )
+ return false;
+
+ if ( x )
+ *x = pos - PositionFromLine(l);
+
+ if ( y )
+ *y = l;
+
+ return true;
+ }
+
+ virtual void ShowPosition(long pos) { GotoPos((int)pos); }
+
+ // FIXME-VC6: can't use wxWindow here because of "error C2603: illegal
+ // access declaration: 'wxWindow' is not a direct base of
+ // 'wxStyledTextCtrl'" with VC6
+ using wxControl::HitTest;
+
+ virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const
+ {
+ const long l = PositionFromPoint(pt);
+ if ( l == -1 )
+ return wxTE_HT_BELOW; // we don't really know where it was
+
+ if ( pos )
+ *pos = l;
+
+ return wxTE_HT_ON_TEXT;
+ }
+
+ // just unhide it
+ virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
+ wxTextCoord *col,
+ wxTextCoord *row) const
+ {
+ return wxTextAreaBase::HitTest(pt, col, row);
+ }
+
+ static wxVersionInfo GetLibraryVersionInfo();
+
+protected:
+ virtual void DoSetValue(const wxString& value, int flags);
+ virtual wxString DoGetValue() const { return GetText(); }
+ virtual wxWindow *GetEditableWindow() { return this; }
+
+#ifndef SWIG
+ virtual bool DoLoadFile(const wxString& file, int fileType);
+ virtual bool DoSaveFile(const wxString& file, int fileType);
+
+ // Event handlers
+ void OnPaint(wxPaintEvent& evt);
+ void OnScrollWin(wxScrollWinEvent& evt);
+ void OnScroll(wxScrollEvent& evt);
+ void OnSize(wxSizeEvent& evt);
+ void OnMouseLeftDown(wxMouseEvent& evt);
+ void OnMouseMove(wxMouseEvent& evt);
+ void OnMouseLeftUp(wxMouseEvent& evt);
+ void OnMouseRightUp(wxMouseEvent& evt);
+ void OnMouseMiddleUp(wxMouseEvent& evt);
+ void OnContextMenu(wxContextMenuEvent& evt);
+ void OnMouseWheel(wxMouseEvent& evt);
+ void OnChar(wxKeyEvent& evt);
+ void OnKeyDown(wxKeyEvent& evt);
+ void OnLoseFocus(wxFocusEvent& evt);
+ void OnGainFocus(wxFocusEvent& evt);
+ void OnSysColourChanged(wxSysColourChangedEvent& evt);
+ void OnEraseBackground(wxEraseEvent& evt);
+ void OnMenu(wxCommandEvent& evt);
+ void OnListBox(wxCommandEvent& evt);
+ void OnIdle(wxIdleEvent& evt);
+
+ virtual wxSize DoGetBestSize() const;
+
+ // Turn notifications from Scintilla into events
+ void NotifyChange();
+ void NotifyParent(SCNotification* scn);
+
+private:
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxStyledTextCtrl)
+
+protected:
+
+ ScintillaWX* m_swx;
+ wxStopWatch m_stopWatch;
+ wxScrollBar* m_vScrollBar;
+ wxScrollBar* m_hScrollBar;
+
+ bool m_lastKeyDownConsumed;
+
+ friend class ScintillaWX;
+ friend class Platform;
+#endif // !SWIG
+};
+
+//----------------------------------------------------------------------
+
+class WXDLLIMPEXP_STC wxStyledTextEvent : public wxCommandEvent {
+public:
+ wxStyledTextEvent(wxEventType commandType=0, int id=0);
+#ifndef SWIG
+ wxStyledTextEvent(const wxStyledTextEvent& event);
+#endif
+ ~wxStyledTextEvent() {}
+
+ void SetPosition(int pos) { m_position = pos; }
+ void SetKey(int k) { m_key = k; }
+ void SetModifiers(int m) { m_modifiers = m; }
+ void SetModificationType(int t) { m_modificationType = t; }
+ void SetText(const wxString& t) { m_text = t; }
+ void SetLength(int len) { m_length = len; }
+ void SetLinesAdded(int num) { m_linesAdded = num; }
+ void SetLine(int val) { m_line = val; }
+ void SetFoldLevelNow(int val) { m_foldLevelNow = val; }
+ void SetFoldLevelPrev(int val) { m_foldLevelPrev = val; }
+ void SetMargin(int val) { m_margin = val; }
+ void SetMessage(int val) { m_message = val; }
+ void SetWParam(int val) { m_wParam = val; }
+ void SetLParam(int val) { m_lParam = val; }
+ void SetListType(int val) { m_listType = val; }
+ void SetX(int val) { m_x = val; }
+ void SetY(int val) { m_y = val; }
+ void SetToken(int val) { m_token = val; }
+ void SetAnnotationLinesAdded(int val) { m_annotationLinesAdded = val; }
+ void SetUpdated(int val) { m_updated = val; }
+#ifdef STC_USE_DND
+ void SetDragText(const wxString& val) { m_dragText = val; }
+ void SetDragFlags(int flags) { m_dragFlags = flags; }
+ void SetDragResult(wxDragResult val) { m_dragResult = val; }
+
+ // This method is kept mainly for backwards compatibility, use
+ // SetDragFlags() in the new code.
+ void SetDragAllowMove(bool allow)
+ {
+ if ( allow )
+ m_dragFlags |= wxDrag_AllowMove;
+ else
+ m_dragFlags &= ~(wxDrag_AllowMove | wxDrag_DefaultMove);
+ }
+#endif
+
+ int GetPosition() const { return m_position; }
+ int GetKey() const { return m_key; }
+ int GetModifiers() const { return m_modifiers; }
+ int GetModificationType() const { return m_modificationType; }
+ wxString GetText() const { return m_text; }
+ int GetLength() const { return m_length; }
+ int GetLinesAdded() const { return m_linesAdded; }
+ int GetLine() const { return m_line; }
+ int GetFoldLevelNow() const { return m_foldLevelNow; }
+ int GetFoldLevelPrev() const { return m_foldLevelPrev; }
+ int GetMargin() const { return m_margin; }
+ int GetMessage() const { return m_message; }
+ int GetWParam() const { return m_wParam; }
+ int GetLParam() const { return m_lParam; }
+ int GetListType() const { return m_listType; }
+ int GetX() const { return m_x; }
+ int GetY() const { return m_y; }
+ int GetToken() const { return m_token; }
+ int GetAnnotationsLinesAdded() const { return m_annotationLinesAdded; }
+ int GetUpdated() const { return m_updated; }
+
+#ifdef STC_USE_DND
+ wxString GetDragText() { return m_dragText; }
+ int GetDragFlags() { return m_dragFlags; }
+ wxDragResult GetDragResult() { return m_dragResult; }
+
+ bool GetDragAllowMove() { return (GetDragFlags() & wxDrag_AllowMove) != 0; }
+#endif
+
+ bool GetShift() const;
+ bool GetControl() const;
+ bool GetAlt() const;
+
+ virtual wxEvent* Clone() const { return new wxStyledTextEvent(*this); }
+
+#ifndef SWIG
+private:
+ DECLARE_DYNAMIC_CLASS(wxStyledTextEvent)
+
+ int m_position;
+ int m_key;
+ int m_modifiers;
+
+ int m_modificationType; // wxEVT_STC_MODIFIED
+ wxString m_text;
+ int m_length;
+ int m_linesAdded;
+ int m_line;
+ int m_foldLevelNow;
+ int m_foldLevelPrev;
+
+ int m_margin; // wxEVT_STC_MARGINCLICK
+
+ int m_message; // wxEVT_STC_MACRORECORD
+ int m_wParam;
+ int m_lParam;
+
+ int m_listType;
+ int m_x;
+ int m_y;
+
+ int m_token; // wxEVT_STC__MODIFIED with SC_MOD_CONTAINER
+ int m_annotationLinesAdded; // wxEVT_STC_MODIFIED with SC_MOD_CHANGEANNOTATION
+ int m_updated; // wxEVT_STC_UPDATEUI
+
+
+#if wxUSE_DRAG_AND_DROP
+ wxString m_dragText; // wxEVT_STC_START_DRAG, wxEVT_STC_DO_DROP
+ int m_dragFlags; // wxEVT_STC_START_DRAG
+ wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP
+#endif
+#endif
+};
+
+
+
+#ifndef SWIG
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CHANGE, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_STYLENEEDED, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CHARADDED, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_SAVEPOINTREACHED, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_SAVEPOINTLEFT, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_ROMODIFYATTEMPT, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_KEY, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_DOUBLECLICK, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_UPDATEUI, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_MODIFIED, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_MACRORECORD, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_MARGINCLICK, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_NEEDSHOWN, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_PAINTED, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_USERLISTSELECTION, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_URIDROPPED, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_DWELLSTART, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_DWELLEND, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_START_DRAG, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_DRAG_OVER, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_DO_DROP, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_ZOOM, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_CLICK, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_DCLICK, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CALLTIP_CLICK, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_SELECTION, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_INDICATOR_CLICK, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_INDICATOR_RELEASE, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_CANCELLED, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_CHAR_DELETED, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_RELEASE_CLICK, wxStyledTextEvent );
+#else
+ enum {
+ wxEVT_STC_CHANGE,
+ wxEVT_STC_STYLENEEDED,
+ wxEVT_STC_CHARADDED,
+ wxEVT_STC_SAVEPOINTREACHED,
+ wxEVT_STC_SAVEPOINTLEFT,
+ wxEVT_STC_ROMODIFYATTEMPT,
+ wxEVT_STC_KEY,
+ wxEVT_STC_DOUBLECLICK,
+ wxEVT_STC_UPDATEUI,
+ wxEVT_STC_MODIFIED,
+ wxEVT_STC_MACRORECORD,
+ wxEVT_STC_MARGINCLICK,
+ wxEVT_STC_NEEDSHOWN,
+ wxEVT_STC_PAINTED,
+ wxEVT_STC_USERLISTSELECTION,
+ wxEVT_STC_URIDROPPED,
+ wxEVT_STC_DWELLSTART,
+ wxEVT_STC_DWELLEND,
+ wxEVT_STC_START_DRAG,
+ wxEVT_STC_DRAG_OVER,
+ wxEVT_STC_DO_DROP,
+ wxEVT_STC_ZOOM,
+ wxEVT_STC_HOTSPOT_CLICK,
+ wxEVT_STC_HOTSPOT_DCLICK,
+ wxEVT_STC_CALLTIP_CLICK,
+ wxEVT_STC_AUTOCOMP_SELECTION,
+ wxEVT_STC_INDICATOR_CLICK,
+ wxEVT_STC_INDICATOR_RELEASE,
+ wxEVT_STC_AUTOCOMP_CANCELLED,
+ wxEVT_STC_AUTOCOMP_CHAR_DELETED,
+ wxEVT_STC_HOTSPOT_RELEASE_CLICK
+ };
+#endif
+
+
+
+#ifndef SWIG
+typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
+
+#define wxStyledTextEventHandler( func ) \
+ wxEVENT_HANDLER_CAST( wxStyledTextEventFunction, func )
+
+#define EVT_STC_CHANGE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_STYLENEEDED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_CHARADDED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_SAVEPOINTREACHED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_SAVEPOINTLEFT(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_ROMODIFYATTEMPT(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_KEY(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_DOUBLECLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_UPDATEUI(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_MODIFIED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_MACRORECORD(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_MARGINCLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_NEEDSHOWN(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_PAINTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_PAINTED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_USERLISTSELECTION(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_USERLISTSELECTION, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_URIDROPPED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_DWELLSTART(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_DWELLEND(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_START_DRAG(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_DRAG_OVER(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_DO_DROP(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_ZOOM(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ZOOM, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_HOTSPOT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_HOTSPOT_DCLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_DCLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_CALLTIP_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CALLTIP_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_AUTOCOMP_SELECTION(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_SELECTION, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_INDICATOR_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_INDICATOR_RELEASE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_RELEASE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_AUTOCOMP_CANCELLED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_CANCELLED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_AUTOCOMP_CHAR_DELETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_CHAR_DELETED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_HOTSPOT_RELEASE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_RELEASE_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+
+#endif
+
+#endif // wxUSE_STC
+
+#endif // _WX_STC_STC_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/stdpaths.h
+// Purpose: declaration of wxStandardPaths class
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 2004-10-17
+// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_STDPATHS_H_
+#define _WX_STDPATHS_H_
+
+#include "wx/defs.h"
+
+#include "wx/string.h"
+#include "wx/filefn.h"
+
+class WXDLLIMPEXP_FWD_BASE wxStandardPaths;
+
+// ----------------------------------------------------------------------------
+// wxStandardPaths returns the standard locations in the file system
+// ----------------------------------------------------------------------------
+
+// NB: This is always compiled in, wxUSE_STDPATHS=0 only disables native
+// wxStandardPaths class, but a minimal version is always available
+class WXDLLIMPEXP_BASE wxStandardPathsBase
+{
+public:
+ // possible resources categories
+ enum ResourceCat
+ {
+ // no special category
+ ResourceCat_None,
+
+ // message catalog resources
+ ResourceCat_Messages,
+
+ // end of enum marker
+ ResourceCat_Max
+ };
+
+ // what should we use to construct paths unique to this application:
+ // (AppInfo_AppName and AppInfo_VendorName can be combined together)
+ enum
+ {
+ AppInfo_None = 0, // nothing
+ AppInfo_AppName = 1, // the application name
+ AppInfo_VendorName = 2 // the vendor name
+ };
+
+
+ // return the global standard paths object
+ static wxStandardPaths& Get();
+
+ // return the path (directory+filename) of the running executable or
+ // wxEmptyString if it couldn't be determined.
+ // The path is returned as an absolute path whenever possible.
+ // Default implementation only try to use wxApp->argv[0].
+ virtual wxString GetExecutablePath() const;
+
+ // return the directory with system config files:
+ // /etc under Unix, c:\Documents and Settings\All Users\Application Data
+ // under Windows, /Library/Preferences for Mac
+ virtual wxString GetConfigDir() const = 0;
+
+ // return the directory for the user config files:
+ // $HOME under Unix, c:\Documents and Settings\username under Windows,
+ // ~/Library/Preferences under Mac
+ //
+ // only use this if you have a single file to put there, otherwise
+ // GetUserDataDir() is more appropriate
+ virtual wxString GetUserConfigDir() const = 0;
+
+ // return the location of the applications global, i.e. not user-specific,
+ // data files
+ //
+ // prefix/share/appname under Unix, c:\Program Files\appname under Windows,
+ // appname.app/Contents/SharedSupport app bundle directory under Mac
+ virtual wxString GetDataDir() const = 0;
+
+ // return the location for application data files which are host-specific
+ //
+ // same as GetDataDir() except under Unix where it is /etc/appname
+ virtual wxString GetLocalDataDir() const;
+
+ // return the directory for the user-dependent application data files
+ //
+ // $HOME/.appname under Unix,
+ // c:\Documents and Settings\username\Application Data\appname under Windows
+ // and ~/Library/Application Support/appname under Mac
+ virtual wxString GetUserDataDir() const = 0;
+
+ // return the directory for user data files which shouldn't be shared with
+ // the other machines
+ //
+ // same as GetUserDataDir() for all platforms except Windows where it is
+ // the "Local Settings\Application Data\appname" directory
+ virtual wxString GetUserLocalDataDir() const;
+
+ // return the directory where the loadable modules (plugins) live
+ //
+ // prefix/lib/appname under Unix, program directory under Windows and
+ // Contents/Plugins app bundle subdirectory under Mac
+ virtual wxString GetPluginsDir() const = 0;
+
+ // get resources directory: resources are auxiliary files used by the
+ // application and include things like image and sound files
+ //
+ // same as GetDataDir() for all platforms except Mac where it returns
+ // Contents/Resources subdirectory of the app bundle
+ virtual wxString GetResourcesDir() const { return GetDataDir(); }
+
+ // get localized resources directory containing the resource files of the
+ // specified category for the given language
+ //
+ // in general this is just GetResourcesDir()/lang under Windows and Unix
+ // and GetResourcesDir()/lang.lproj under Mac but is something quite
+ // different under Unix for message catalog category (namely the standard
+ // prefix/share/locale/lang/LC_MESSAGES)
+ virtual wxString
+ GetLocalizedResourcesDir(const wxString& lang,
+ ResourceCat WXUNUSED(category)
+ = ResourceCat_None) const
+ {
+ return GetResourcesDir() + wxFILE_SEP_PATH + lang;
+ }
+
+ // return the "Documents" directory for the current user
+ //
+ // C:\Documents and Settings\username\My Documents under Windows,
+ // $HOME under Unix and ~/Documents under Mac
+ virtual wxString GetDocumentsDir() const;
+
+ // return the directory for the documents files used by this application:
+ // it's a subdirectory of GetDocumentsDir() constructed using the
+ // application name/vendor if it exists or just GetDocumentsDir() otherwise
+ virtual wxString GetAppDocumentsDir() const;
+
+ // return the temporary directory for the current user
+ virtual wxString GetTempDir() const;
+
+
+ // virtual dtor for the base class
+ virtual ~wxStandardPathsBase();
+
+ // Information used by AppendAppInfo
+ void UseAppInfo(int info)
+ {
+ m_usedAppInfo = info;
+ }
+
+ bool UsesAppInfo(int info) const { return (m_usedAppInfo & info) != 0; }
+
+
+protected:
+ // Ctor is protected as this is a base class which should never be created
+ // directly.
+ wxStandardPathsBase();
+
+ // append the path component, with a leading path separator if a
+ // path separator or dot (.) is not already at the end of dir
+ static wxString AppendPathComponent(const wxString& dir, const wxString& component);
+
+ // append application information determined by m_usedAppInfo to dir
+ wxString AppendAppInfo(const wxString& dir) const;
+
+
+ // combination of AppInfo_XXX flags used by AppendAppInfo()
+ int m_usedAppInfo;
+};
+
+#if wxUSE_STDPATHS
+ #if defined(__WINDOWS__)
+ #include "wx/msw/stdpaths.h"
+ #define wxHAS_NATIVE_STDPATHS
+ // We want CoreFoundation paths on both CarbonLib and Darwin (for all ports)
+ #elif defined(__WXMAC__) || defined(__DARWIN__)
+ #include "wx/osx/core/stdpaths.h"
+ #define wxHAS_NATIVE_STDPATHS
+ #elif defined(__OS2__)
+ #include "wx/os2/stdpaths.h"
+ #define wxHAS_NATIVE_STDPATHS
+ #elif defined(__UNIX__)
+ #include "wx/unix/stdpaths.h"
+ #define wxHAS_NATIVE_STDPATHS
+ #endif
+#endif
+
+// ----------------------------------------------------------------------------
+// Minimal generic implementation
+// ----------------------------------------------------------------------------
+
+// NB: Note that this minimal implementation is compiled in even if
+// wxUSE_STDPATHS=0, so that our code can still use wxStandardPaths.
+
+#ifndef wxHAS_NATIVE_STDPATHS
+class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase
+{
+public:
+ void SetInstallPrefix(const wxString& prefix) { m_prefix = prefix; }
+ wxString GetInstallPrefix() const { return m_prefix; }
+
+ virtual wxString GetExecutablePath() const { return m_prefix; }
+ virtual wxString GetConfigDir() const { return m_prefix; }
+ virtual wxString GetUserConfigDir() const { return m_prefix; }
+ virtual wxString GetDataDir() const { return m_prefix; }
+ virtual wxString GetLocalDataDir() const { return m_prefix; }
+ virtual wxString GetUserDataDir() const { return m_prefix; }
+ virtual wxString GetPluginsDir() const { return m_prefix; }
+ virtual wxString GetDocumentsDir() const { return m_prefix; }
+
+protected:
+ // Ctor is protected because wxStandardPaths::Get() should always be used
+ // to access the global wxStandardPaths object of the correct type instead
+ // of creating one of a possibly wrong type yourself.
+ wxStandardPaths() { }
+
+private:
+ wxString m_prefix;
+};
+#endif // !wxHAS_NATIVE_STDPATHS
+
+#endif // _WX_STDPATHS_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/stdstream.h
+// Purpose: Header of std::istream and std::ostream derived wrappers for
+// wxInputStream and wxOutputStream
+// Author: Jonathan Liu <net147@gmail.com>
+// Created: 2009-05-02
+// Copyright: (c) 2009 Jonathan Liu
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_STDSTREAM_H_
+#define _WX_STDSTREAM_H_
+
+#include "wx/defs.h" // wxUSE_STD_IOSTREAM
+
+#if wxUSE_STREAMS && wxUSE_STD_IOSTREAM
+
+#include "wx/defs.h"
+#include "wx/stream.h"
+#include "wx/ioswrap.h"
+
+// ==========================================================================
+// wxStdInputStreamBuffer
+// ==========================================================================
+
+class WXDLLIMPEXP_BASE wxStdInputStreamBuffer : public std::streambuf
+{
+public:
+ wxStdInputStreamBuffer(wxInputStream& stream);
+ virtual ~wxStdInputStreamBuffer() { }
+
+protected:
+ virtual std::streambuf *setbuf(char *s, std::streamsize n);
+ virtual std::streampos seekoff(std::streamoff off,
+ std::ios_base::seekdir way,
+ std::ios_base::openmode which =
+ std::ios_base::in |
+ std::ios_base::out);
+ virtual std::streampos seekpos(std::streampos sp,
+ std::ios_base::openmode which =
+ std::ios_base::in |
+ std::ios_base::out);
+ virtual std::streamsize showmanyc();
+ virtual std::streamsize xsgetn(char *s, std::streamsize n);
+ virtual int underflow();
+ virtual int uflow();
+ virtual int pbackfail(int c = EOF);
+
+ // Special work around for VC8/9 (this bug was fixed in VC10 and later):
+ // these versions have non-standard _Xsgetn_s() that it being called from
+ // the stream code instead of xsgetn() and so our overridden implementation
+ // never actually gets used. To work around this, forward to it explicitly.
+#if defined(__VISUALC8__) || defined(__VISUALC9__)
+ virtual std::streamsize
+ _Xsgetn_s(char *s, size_t WXUNUSED(size), std::streamsize n)
+ {
+ return xsgetn(s, n);
+ }
+#endif // VC8 or VC9
+
+ wxInputStream& m_stream;
+ int m_lastChar;
+};
+
+// ==========================================================================
+// wxStdInputStream
+// ==========================================================================
+
+class WXDLLIMPEXP_BASE wxStdInputStream : public std::istream
+{
+public:
+ wxStdInputStream(wxInputStream& stream);
+ virtual ~wxStdInputStream() { }
+
+protected:
+ wxStdInputStreamBuffer m_streamBuffer;
+};
+
+// ==========================================================================
+// wxStdOutputStreamBuffer
+// ==========================================================================
+
+class WXDLLIMPEXP_BASE wxStdOutputStreamBuffer : public std::streambuf
+{
+public:
+ wxStdOutputStreamBuffer(wxOutputStream& stream);
+ virtual ~wxStdOutputStreamBuffer() { }
+
+protected:
+ virtual std::streambuf *setbuf(char *s, std::streamsize n);
+ virtual std::streampos seekoff(std::streamoff off,
+ std::ios_base::seekdir way,
+ std::ios_base::openmode which =
+ std::ios_base::in |
+ std::ios_base::out);
+ virtual std::streampos seekpos(std::streampos sp,
+ std::ios_base::openmode which =
+ std::ios_base::in |
+ std::ios_base::out);
+ virtual std::streamsize xsputn(const char *s, std::streamsize n);
+ virtual int overflow(int c);
+
+ wxOutputStream& m_stream;
+};
+
+// ==========================================================================
+// wxStdOutputStream
+// ==========================================================================
+
+class WXDLLIMPEXP_BASE wxStdOutputStream : public std::ostream
+{
+public:
+ wxStdOutputStream(wxOutputStream& stream);
+ virtual ~wxStdOutputStream() { }
+
+protected:
+ wxStdOutputStreamBuffer m_streamBuffer;
+};
+
+#endif // wxUSE_STREAMS && wxUSE_STD_IOSTREAM
+
+#endif // _WX_STDSTREAM_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/stockitem.h
+// Purpose: stock items helpers (privateh header)
+// Author: Vaclav Slavik
+// Modified by:
+// Created: 2004-08-15
+// Copyright: (c) Vaclav Slavik, 2004
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_STOCKITEM_H_
+#define _WX_STOCKITEM_H_
+
+#include "wx/defs.h"
+#include "wx/chartype.h"
+#include "wx/string.h"
+#include "wx/accel.h"
+
+// ----------------------------------------------------------------------------
+// Helper functions for stock items handling:
+// ----------------------------------------------------------------------------
+
+// Returns true if the ID is in the list of recognized stock actions
+WXDLLIMPEXP_CORE bool wxIsStockID(wxWindowID id);
+
+// Returns true of the label is empty or label of a stock button with
+// given ID
+WXDLLIMPEXP_CORE bool wxIsStockLabel(wxWindowID id, const wxString& label);
+
+enum wxStockLabelQueryFlag
+{
+ wxSTOCK_NOFLAGS = 0,
+
+ wxSTOCK_WITH_MNEMONIC = 1,
+ wxSTOCK_WITH_ACCELERATOR = 2,
+
+ // by default, stock items text is returned with ellipsis, if appropriate,
+ // this flag allows to avoid having it
+ wxSTOCK_WITHOUT_ELLIPSIS = 4,
+
+ // return label for button, not menu item: buttons should always use
+ // mnemonics and never use ellipsis
+ wxSTOCK_FOR_BUTTON = wxSTOCK_WITHOUT_ELLIPSIS | wxSTOCK_WITH_MNEMONIC
+};
+
+// Returns label that should be used for given stock UI element (e.g. "&OK"
+// for wxSTOCK_OK); if wxSTOCK_WITH_MNEMONIC is given, the & character
+// is included; if wxSTOCK_WITH_ACCELERATOR is given, the stock accelerator
+// for given ID is concatenated to the label using \t as separator
+WXDLLIMPEXP_CORE wxString wxGetStockLabel(wxWindowID id,
+ long flags = wxSTOCK_WITH_MNEMONIC);
+
+#if wxUSE_ACCEL
+
+ // Returns the accelerator that should be used for given stock UI element
+ // (e.g. "Ctrl+x" for wxSTOCK_EXIT)
+ WXDLLIMPEXP_CORE wxAcceleratorEntry wxGetStockAccelerator(wxWindowID id);
+
+#endif
+
+// wxStockHelpStringClient conceptually works like wxArtClient: it gives a hint to
+// wxGetStockHelpString() about the context where the help string is to be used
+enum wxStockHelpStringClient
+{
+ wxSTOCK_MENU // help string to use for menu items
+};
+
+// Returns an help string for the given stock UI element and for the given "context".
+WXDLLIMPEXP_CORE wxString wxGetStockHelpString(wxWindowID id,
+ wxStockHelpStringClient client = wxSTOCK_MENU);
+
+
+#ifdef __WXGTK20__
+
+// Translates stock ID to GTK+'s stock item string identifier:
+WXDLLIMPEXP_CORE const char *wxGetStockGtkID(wxWindowID id);
+
+#endif
+
+#endif // _WX_STOCKITEM_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/stopwatch.h
+// Purpose: wxStopWatch and global time-related functions
+// Author: Julian Smart (wxTimer), Sylvain Bougnoux (wxStopWatch),
+// Vadim Zeitlin (time functions, current wxStopWatch)
+// Created: 26.06.03 (extracted from wx/timer.h)
+// Copyright: (c) 1998-2003 Julian Smart, Sylvain Bougnoux
+// (c) 2011 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_STOPWATCH_H_
+#define _WX_STOPWATCH_H_
+
+#include "wx/defs.h"
+#include "wx/longlong.h"
+
+// Time-related functions are also available via this header for compatibility
+// but you should include wx/time.h directly if you need only them and not
+// wxStopWatch itself.
+#include "wx/time.h"
+
+// ----------------------------------------------------------------------------
+// wxStopWatch: measure time intervals with up to 1ms resolution
+// ----------------------------------------------------------------------------
+
+#if wxUSE_STOPWATCH
+
+class WXDLLIMPEXP_BASE wxStopWatch
+{
+public:
+ // ctor starts the stop watch
+ wxStopWatch() { m_pauseCount = 0; Start(); }
+
+ // Start the stop watch at the moment t0 expressed in milliseconds (i.e.
+ // calling Time() immediately afterwards returns t0). This can be used to
+ // restart an existing stopwatch.
+ void Start(long t0 = 0);
+
+ // pause the stop watch
+ void Pause()
+ {
+ if ( m_pauseCount++ == 0 )
+ m_elapsedBeforePause = GetCurrentClockValue() - m_t0;
+ }
+
+ // resume it
+ void Resume()
+ {
+ wxASSERT_MSG( m_pauseCount > 0,
+ wxT("Resuming stop watch which is not paused") );
+
+ if ( --m_pauseCount == 0 )
+ {
+ DoStart();
+ m_t0 -= m_elapsedBeforePause;
+ }
+ }
+
+ // Get elapsed time since the last Start() in microseconds.
+ wxLongLong TimeInMicro() const;
+
+ // get elapsed time since the last Start() in milliseconds
+ long Time() const { return (TimeInMicro()/1000).ToLong(); }
+
+private:
+ // Really starts the stop watch. The initial time is set to current clock
+ // value.
+ void DoStart();
+
+ // Returns the current clock value in its native units.
+ wxLongLong GetCurrentClockValue() const;
+
+ // Return the frequency of the clock used in its ticks per second.
+ wxLongLong GetClockFreq() const;
+
+
+ // The clock value when the stop watch was last started. Its units vary
+ // depending on the platform.
+ wxLongLong m_t0;
+
+ // The elapsed time as of last Pause() call (only valid if m_pauseCount >
+ // 0) in the same units as m_t0.
+ wxLongLong m_elapsedBeforePause;
+
+ // if > 0, the stop watch is paused, otherwise it is running
+ int m_pauseCount;
+};
+
+#endif // wxUSE_STOPWATCH
+
+#if wxUSE_LONGLONG && WXWIN_COMPATIBILITY_2_6
+
+ // Starts a global timer
+ // -- DEPRECATED: use wxStopWatch instead
+ wxDEPRECATED( void WXDLLIMPEXP_BASE wxStartTimer() );
+
+ // Gets elapsed milliseconds since last wxStartTimer or wxGetElapsedTime
+ // -- DEPRECATED: use wxStopWatch instead
+ wxDEPRECATED( long WXDLLIMPEXP_BASE wxGetElapsedTime(bool resetTimer = true) );
+
+#endif // wxUSE_LONGLONG && WXWIN_COMPATIBILITY_2_6
+
+#endif // _WX_STOPWATCH_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/strconv.h
+// Purpose: conversion routines for char sets any Unicode
+// Author: Ove Kaaven, Robert Roebling, Vadim Zeitlin
+// Modified by:
+// Created: 29/01/98
+// Copyright: (c) 1998 Ove Kaaven, Robert Roebling
+// (c) 1998-2006 Vadim Zeitlin
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_STRCONV_H_
+#define _WX_STRCONV_H_
+
+#include "wx/defs.h"
+#include "wx/chartype.h"
+#include "wx/buffer.h"
+
+#ifdef __DIGITALMARS__
+#include "typeinfo.h"
+#endif
+
+#if defined(__VISAGECPP__) && __IBMCPP__ >= 400
+# undef __BSEXCPT__
+#endif
+
+#include <stdlib.h>
+
+class WXDLLIMPEXP_FWD_BASE wxString;
+
+// the error value returned by wxMBConv methods
+#define wxCONV_FAILED ((size_t)-1)
+
+// ----------------------------------------------------------------------------
+// wxMBConv (abstract base class for conversions)
+// ----------------------------------------------------------------------------
+
+// When deriving a new class from wxMBConv you must reimplement ToWChar() and
+// FromWChar() methods which are not pure virtual only for historical reasons,
+// don't let the fact that the existing classes implement MB2WC/WC2MB() instead
+// confuse you.
+//
+// You also have to implement Clone() to allow copying the conversions
+// polymorphically.
+//
+// And you might need to override GetMBNulLen() as well.
+class WXDLLIMPEXP_BASE wxMBConv
+{
+public:
+ // The functions doing actual conversion from/to narrow to/from wide
+ // character strings.
+ //
+ // On success, the return value is the length (i.e. the number of
+ // characters, not bytes) of the converted string including any trailing
+ // L'\0' or (possibly multiple) '\0'(s). If the conversion fails or if
+ // there is not enough space for everything, including the trailing NUL
+ // character(s), in the output buffer, wxCONV_FAILED is returned.
+ //
+ // In the special case when dst is NULL (the value of dstLen is ignored
+ // then) the return value is the length of the needed buffer but nothing
+ // happens otherwise. If srcLen is wxNO_LEN, the entire string, up to and
+ // including the trailing NUL(s), is converted, otherwise exactly srcLen
+ // bytes are.
+ //
+ // Typical usage:
+ //
+ // size_t dstLen = conv.ToWChar(NULL, 0, src);
+ // if ( dstLen == wxCONV_FAILED )
+ // ... handle error ...
+ // wchar_t *wbuf = new wchar_t[dstLen];
+ // conv.ToWChar(wbuf, dstLen, src);
+ // ... work with wbuf ...
+ // delete [] wbuf;
+ //
+ virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
+ const char *src, size_t srcLen = wxNO_LEN) const;
+
+ virtual size_t FromWChar(char *dst, size_t dstLen,
+ const wchar_t *src, size_t srcLen = wxNO_LEN) const;
+
+
+ // Convenience functions for translating NUL-terminated strings: returns
+ // the buffer containing the converted string or NULL pointer if the
+ // conversion failed.
+ const wxWCharBuffer cMB2WC(const char *in) const;
+ const wxCharBuffer cWC2MB(const wchar_t *in) const;
+
+ // Convenience functions for converting strings which may contain embedded
+ // NULs and don't have to be NUL-terminated.
+ //
+ // inLen is the length of the buffer including trailing NUL if any or
+ // wxNO_LEN if the input is NUL-terminated.
+ //
+ // outLen receives, if not NULL, the length of the converted string or 0 if
+ // the conversion failed (returning 0 and not -1 in this case makes it
+ // difficult to distinguish between failed conversion and empty input but
+ // this is done for backwards compatibility). Notice that the rules for
+ // whether outLen accounts or not for the last NUL are the same as for
+ // To/FromWChar() above: if inLen is specified, outLen is exactly the
+ // number of characters converted, whether the last one of them was NUL or
+ // not. But if inLen == wxNO_LEN then outLen doesn't account for the last
+ // NUL even though it is present.
+ const wxWCharBuffer
+ cMB2WC(const char *in, size_t inLen, size_t *outLen) const;
+ const wxCharBuffer
+ cWC2MB(const wchar_t *in, size_t inLen, size_t *outLen) const;
+
+ // And yet more convenience functions for converting the entire buffers:
+ // these are the simplest and least error-prone as you never need to bother
+ // with lengths/sizes directly.
+ const wxWCharBuffer cMB2WC(const wxScopedCharBuffer& in) const;
+ const wxCharBuffer cWC2MB(const wxScopedWCharBuffer& in) const;
+
+ // convenience functions for converting MB or WC to/from wxWin default
+#if wxUSE_UNICODE
+ const wxWCharBuffer cMB2WX(const char *psz) const { return cMB2WC(psz); }
+ const wxCharBuffer cWX2MB(const wchar_t *psz) const { return cWC2MB(psz); }
+ const wchar_t* cWC2WX(const wchar_t *psz) const { return psz; }
+ const wchar_t* cWX2WC(const wchar_t *psz) const { return psz; }
+#else // ANSI
+ const char* cMB2WX(const char *psz) const { return psz; }
+ const char* cWX2MB(const char *psz) const { return psz; }
+ const wxCharBuffer cWC2WX(const wchar_t *psz) const { return cWC2MB(psz); }
+ const wxWCharBuffer cWX2WC(const char *psz) const { return cMB2WC(psz); }
+#endif // Unicode/ANSI
+
+ // this function is used in the implementation of cMB2WC() to distinguish
+ // between the following cases:
+ //
+ // a) var width encoding with strings terminated by a single NUL
+ // (usual multibyte encodings): return 1 in this case
+ // b) fixed width encoding with 2 bytes/char and so terminated by
+ // 2 NULs (UTF-16/UCS-2 and variants): return 2 in this case
+ // c) fixed width encoding with 4 bytes/char and so terminated by
+ // 4 NULs (UTF-32/UCS-4 and variants): return 4 in this case
+ //
+ // anything else is not supported currently and -1 should be returned
+ virtual size_t GetMBNulLen() const { return 1; }
+
+ // return the maximal value currently returned by GetMBNulLen() for any
+ // encoding
+ static size_t GetMaxMBNulLen() { return 4 /* for UTF-32 */; }
+
+#if wxUSE_UNICODE_UTF8
+ // return true if the converter's charset is UTF-8, i.e. char* strings
+ // decoded using this object can be directly copied to wxString's internal
+ // storage without converting to WC and than back to UTF-8 MB string
+ virtual bool IsUTF8() const { return false; }
+#endif
+
+ // The old conversion functions. The existing classes currently mostly
+ // implement these ones but we're in transition to using To/FromWChar()
+ // instead and any new classes should implement just the new functions.
+ // For now, however, we provide default implementation of To/FromWChar() in
+ // this base class in terms of MB2WC/WC2MB() to avoid having to rewrite all
+ // the conversions at once.
+ //
+ // On success, the return value is the length (i.e. the number of
+ // characters, not bytes) not counting the trailing NUL(s) of the converted
+ // string. On failure, (size_t)-1 is returned. In the special case when
+ // outputBuf is NULL the return value is the same one but nothing is
+ // written to the buffer.
+ //
+ // Note that outLen is the length of the output buffer, not the length of
+ // the input (which is always supposed to be terminated by one or more
+ // NULs, as appropriate for the encoding)!
+ virtual size_t MB2WC(wchar_t *out, const char *in, size_t outLen) const;
+ virtual size_t WC2MB(char *out, const wchar_t *in, size_t outLen) const;
+
+
+ // make a heap-allocated copy of this object
+ virtual wxMBConv *Clone() const = 0;
+
+ // virtual dtor for any base class
+ virtual ~wxMBConv();
+};
+
+// ----------------------------------------------------------------------------
+// wxMBConvLibc uses standard mbstowcs() and wcstombs() functions for
+// conversion (hence it depends on the current locale)
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMBConvLibc : public wxMBConv
+{
+public:
+ virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const;
+ virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const;
+
+ virtual wxMBConv *Clone() const { return new wxMBConvLibc; }
+
+#if wxUSE_UNICODE_UTF8
+ virtual bool IsUTF8() const { return wxLocaleIsUtf8; }
+#endif
+};
+
+#ifdef __UNIX__
+
+// ----------------------------------------------------------------------------
+// wxConvBrokenFileNames is made for Unix in Unicode mode when
+// files are accidentally written in an encoding which is not
+// the system encoding. Typically, the system encoding will be
+// UTF8 but there might be files stored in ISO8859-1 on disk.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxConvBrokenFileNames : public wxMBConv
+{
+public:
+ wxConvBrokenFileNames(const wxString& charset);
+ wxConvBrokenFileNames(const wxConvBrokenFileNames& conv)
+ : wxMBConv(),
+ m_conv(conv.m_conv ? conv.m_conv->Clone() : NULL)
+ {
+ }
+ virtual ~wxConvBrokenFileNames() { delete m_conv; }
+
+ virtual size_t MB2WC(wchar_t *out, const char *in, size_t outLen) const
+ {
+ return m_conv->MB2WC(out, in, outLen);
+ }
+
+ virtual size_t WC2MB(char *out, const wchar_t *in, size_t outLen) const
+ {
+ return m_conv->WC2MB(out, in, outLen);
+ }
+
+ virtual size_t GetMBNulLen() const
+ {
+ // cast needed to call a private function
+ return m_conv->GetMBNulLen();
+ }
+
+#if wxUSE_UNICODE_UTF8
+ virtual bool IsUTF8() const { return m_conv->IsUTF8(); }
+#endif
+
+ virtual wxMBConv *Clone() const { return new wxConvBrokenFileNames(*this); }
+
+private:
+ // the conversion object we forward to
+ wxMBConv *m_conv;
+
+ wxDECLARE_NO_ASSIGN_CLASS(wxConvBrokenFileNames);
+};
+
+#endif // __UNIX__
+
+// ----------------------------------------------------------------------------
+// wxMBConvUTF7 (for conversion using UTF7 encoding)
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMBConvUTF7 : public wxMBConv
+{
+public:
+ wxMBConvUTF7() { }
+
+ // compiler-generated copy ctor, assignment operator and dtor are ok
+ // (assuming it's ok to copy the shift state -- not really sure about it)
+
+ virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
+ const char *src, size_t srcLen = wxNO_LEN) const;
+ virtual size_t FromWChar(char *dst, size_t dstLen,
+ const wchar_t *src, size_t srcLen = wxNO_LEN) const;
+
+ virtual wxMBConv *Clone() const { return new wxMBConvUTF7; }
+
+private:
+ // UTF-7 decoder/encoder may be in direct mode or in shifted mode after a
+ // '+' (and until the '-' or any other non-base64 character)
+ struct StateMode
+ {
+ enum Mode
+ {
+ Direct, // pass through state
+ Shifted // after a '+' (and before '-')
+ };
+ };
+
+ // the current decoder state: this is only used by ToWChar() if srcLen
+ // parameter is not wxNO_LEN, when working on the entire NUL-terminated
+ // strings we neither update nor use the state
+ class DecoderState : private StateMode
+ {
+ private:
+ // current state: this one is private as we want to enforce the use of
+ // ToDirect/ToShifted() methods below
+ Mode mode;
+
+ public:
+ // the initial state is direct
+ DecoderState() { mode = Direct; }
+
+ // switch to/from shifted mode
+ void ToDirect() { mode = Direct; }
+ void ToShifted() { mode = Shifted; accum = bit = 0; isLSB = false; }
+
+ bool IsDirect() const { return mode == Direct; }
+ bool IsShifted() const { return mode == Shifted; }
+
+
+ // these variables are only used in shifted mode
+
+ unsigned int accum; // accumulator of the bit we've already got
+ unsigned int bit; // the number of bits consumed mod 8
+ unsigned char msb; // the high byte of UTF-16 word
+ bool isLSB; // whether we're decoding LSB or MSB of UTF-16 word
+ };
+
+ DecoderState m_stateDecoder;
+
+
+ // encoder state is simpler as we always receive entire Unicode characters
+ // on input
+ class EncoderState : private StateMode
+ {
+ private:
+ Mode mode;
+
+ public:
+ EncoderState() { mode = Direct; }
+
+ void ToDirect() { mode = Direct; }
+ void ToShifted() { mode = Shifted; accum = bit = 0; }
+
+ bool IsDirect() const { return mode == Direct; }
+ bool IsShifted() const { return mode == Shifted; }
+
+ unsigned int accum;
+ unsigned int bit;
+ };
+
+ EncoderState m_stateEncoder;
+};
+
+// ----------------------------------------------------------------------------
+// wxMBConvUTF8 (for conversion using UTF8 encoding)
+// ----------------------------------------------------------------------------
+
+// this is the real UTF-8 conversion class, it has to be called "strict UTF-8"
+// for compatibility reasons: the wxMBConvUTF8 class below also supports lossy
+// conversions if it is created with non default options
+class WXDLLIMPEXP_BASE wxMBConvStrictUTF8 : public wxMBConv
+{
+public:
+ // compiler-generated default ctor and other methods are ok
+
+ virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
+ const char *src, size_t srcLen = wxNO_LEN) const;
+ virtual size_t FromWChar(char *dst, size_t dstLen,
+ const wchar_t *src, size_t srcLen = wxNO_LEN) const;
+
+ virtual wxMBConv *Clone() const { return new wxMBConvStrictUTF8(); }
+
+#if wxUSE_UNICODE_UTF8
+ // NB: other mapping modes are not, strictly speaking, UTF-8, so we can't
+ // take the shortcut in that case
+ virtual bool IsUTF8() const { return true; }
+#endif
+};
+
+class WXDLLIMPEXP_BASE wxMBConvUTF8 : public wxMBConvStrictUTF8
+{
+public:
+ enum
+ {
+ MAP_INVALID_UTF8_NOT = 0,
+ MAP_INVALID_UTF8_TO_PUA = 1,
+ MAP_INVALID_UTF8_TO_OCTAL = 2
+ };
+
+ wxMBConvUTF8(int options = MAP_INVALID_UTF8_NOT) : m_options(options) { }
+
+ virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
+ const char *src, size_t srcLen = wxNO_LEN) const;
+ virtual size_t FromWChar(char *dst, size_t dstLen,
+ const wchar_t *src, size_t srcLen = wxNO_LEN) const;
+
+ virtual wxMBConv *Clone() const { return new wxMBConvUTF8(m_options); }
+
+#if wxUSE_UNICODE_UTF8
+ // NB: other mapping modes are not, strictly speaking, UTF-8, so we can't
+ // take the shortcut in that case
+ virtual bool IsUTF8() const { return m_options == MAP_INVALID_UTF8_NOT; }
+#endif
+
+private:
+ int m_options;
+};
+
+// ----------------------------------------------------------------------------
+// wxMBConvUTF16Base: for both LE and BE variants
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMBConvUTF16Base : public wxMBConv
+{
+public:
+ enum { BYTES_PER_CHAR = 2 };
+
+ virtual size_t GetMBNulLen() const { return BYTES_PER_CHAR; }
+
+protected:
+ // return the length of the buffer using srcLen if it's not wxNO_LEN and
+ // computing the length ourselves if it is; also checks that the length is
+ // even if specified as we need an entire number of UTF-16 characters and
+ // returns wxNO_LEN which indicates error if it is odd
+ static size_t GetLength(const char *src, size_t srcLen);
+};
+
+// ----------------------------------------------------------------------------
+// wxMBConvUTF16LE (for conversion using UTF16 Little Endian encoding)
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMBConvUTF16LE : public wxMBConvUTF16Base
+{
+public:
+ virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
+ const char *src, size_t srcLen = wxNO_LEN) const;
+ virtual size_t FromWChar(char *dst, size_t dstLen,
+ const wchar_t *src, size_t srcLen = wxNO_LEN) const;
+ virtual wxMBConv *Clone() const { return new wxMBConvUTF16LE; }
+};
+
+// ----------------------------------------------------------------------------
+// wxMBConvUTF16BE (for conversion using UTF16 Big Endian encoding)
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMBConvUTF16BE : public wxMBConvUTF16Base
+{
+public:
+ virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
+ const char *src, size_t srcLen = wxNO_LEN) const;
+ virtual size_t FromWChar(char *dst, size_t dstLen,
+ const wchar_t *src, size_t srcLen = wxNO_LEN) const;
+ virtual wxMBConv *Clone() const { return new wxMBConvUTF16BE; }
+};
+
+// ----------------------------------------------------------------------------
+// wxMBConvUTF32Base: base class for both LE and BE variants
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMBConvUTF32Base : public wxMBConv
+{
+public:
+ enum { BYTES_PER_CHAR = 4 };
+
+ virtual size_t GetMBNulLen() const { return BYTES_PER_CHAR; }
+
+protected:
+ // this is similar to wxMBConvUTF16Base method with the same name except
+ // that, of course, it verifies that length is divisible by 4 if given and
+ // not by 2
+ static size_t GetLength(const char *src, size_t srcLen);
+};
+
+// ----------------------------------------------------------------------------
+// wxMBConvUTF32LE (for conversion using UTF32 Little Endian encoding)
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMBConvUTF32LE : public wxMBConvUTF32Base
+{
+public:
+ virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
+ const char *src, size_t srcLen = wxNO_LEN) const;
+ virtual size_t FromWChar(char *dst, size_t dstLen,
+ const wchar_t *src, size_t srcLen = wxNO_LEN) const;
+ virtual wxMBConv *Clone() const { return new wxMBConvUTF32LE; }
+};
+
+// ----------------------------------------------------------------------------
+// wxMBConvUTF32BE (for conversion using UTF32 Big Endian encoding)
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMBConvUTF32BE : public wxMBConvUTF32Base
+{
+public:
+ virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
+ const char *src, size_t srcLen = wxNO_LEN) const;
+ virtual size_t FromWChar(char *dst, size_t dstLen,
+ const wchar_t *src, size_t srcLen = wxNO_LEN) const;
+ virtual wxMBConv *Clone() const { return new wxMBConvUTF32BE; }
+};
+
+// ----------------------------------------------------------------------------
+// wxCSConv (for conversion based on loadable char sets)
+// ----------------------------------------------------------------------------
+
+#include "wx/fontenc.h"
+
+class WXDLLIMPEXP_BASE wxCSConv : public wxMBConv
+{
+public:
+ // we can be created either from charset name or from an encoding constant
+ // but we can't have both at once
+ wxCSConv(const wxString& charset);
+ wxCSConv(wxFontEncoding encoding);
+
+ wxCSConv(const wxCSConv& conv);
+ virtual ~wxCSConv();
+
+ wxCSConv& operator=(const wxCSConv& conv);
+
+ virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
+ const char *src, size_t srcLen = wxNO_LEN) const;
+ virtual size_t FromWChar(char *dst, size_t dstLen,
+ const wchar_t *src, size_t srcLen = wxNO_LEN) const;
+ virtual size_t GetMBNulLen() const;
+
+#if wxUSE_UNICODE_UTF8
+ virtual bool IsUTF8() const;
+#endif
+
+ virtual wxMBConv *Clone() const { return new wxCSConv(*this); }
+
+ void Clear();
+
+ // return true if the conversion could be initialized successfully
+ bool IsOk() const;
+
+private:
+ // common part of all ctors
+ void Init();
+
+ // Creates the conversion to use, called from all ctors to initialize
+ // m_convReal.
+ wxMBConv *DoCreate() const;
+
+ // Set the name (may be only called when m_name == NULL), makes copy of
+ // the charset string.
+ void SetName(const char *charset);
+
+ // Set m_encoding field respecting the rules below, i.e. making sure it has
+ // a valid value if m_name == NULL (thus this should be always called after
+ // SetName()).
+ //
+ // Input encoding may be valid or not.
+ void SetEncoding(wxFontEncoding encoding);
+
+
+ // The encoding we use is specified by the two fields below:
+ //
+ // 1. If m_name != NULL, m_encoding corresponds to it if it's one of
+ // encodings we know about (i.e. member of wxFontEncoding) or is
+ // wxFONTENCODING_SYSTEM otherwise.
+ //
+ // 2. If m_name == NULL, m_encoding is always valid, i.e. not one of
+ // wxFONTENCODING_{SYSTEM,DEFAULT,MAX}.
+ char *m_name;
+ wxFontEncoding m_encoding;
+
+ // The conversion object for our encoding or NULL if we failed to create it
+ // in which case we fall back to hard-coded ISO8859-1 conversion.
+ wxMBConv *m_convReal;
+};
+
+
+// ----------------------------------------------------------------------------
+// declare predefined conversion objects
+// ----------------------------------------------------------------------------
+
+// Note: this macro is an implementation detail (see the comment in
+// strconv.cpp). The wxGet_XXX() and wxGet_XXXPtr() functions shouldn't be
+// used by user code and neither should XXXPtr, use the wxConvXXX macro
+// instead.
+#define WX_DECLARE_GLOBAL_CONV(klass, name) \
+ extern WXDLLIMPEXP_DATA_BASE(klass*) name##Ptr; \
+ extern WXDLLIMPEXP_BASE klass* wxGet_##name##Ptr(); \
+ inline klass& wxGet_##name() \
+ { \
+ if ( !name##Ptr ) \
+ name##Ptr = wxGet_##name##Ptr(); \
+ return *name##Ptr; \
+ }
+
+
+// conversion to be used with all standard functions affected by locale, e.g.
+// strtol(), strftime(), ...
+WX_DECLARE_GLOBAL_CONV(wxMBConv, wxConvLibc)
+#define wxConvLibc wxGet_wxConvLibc()
+
+// conversion ISO-8859-1/UTF-7/UTF-8 <-> wchar_t
+WX_DECLARE_GLOBAL_CONV(wxCSConv, wxConvISO8859_1)
+#define wxConvISO8859_1 wxGet_wxConvISO8859_1()
+
+WX_DECLARE_GLOBAL_CONV(wxMBConvStrictUTF8, wxConvUTF8)
+#define wxConvUTF8 wxGet_wxConvUTF8()
+
+WX_DECLARE_GLOBAL_CONV(wxMBConvUTF7, wxConvUTF7)
+#define wxConvUTF7 wxGet_wxConvUTF7()
+
+// conversion used for the file names on the systems where they're not Unicode
+// (basically anything except Windows)
+//
+// this is used by all file functions, can be changed by the application
+//
+// by default UTF-8 under Mac OS X and wxConvLibc elsewhere (but it's not used
+// under Windows normally)
+extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvFileName;
+
+// backwards compatible define
+#define wxConvFile (*wxConvFileName)
+
+// the current conversion object, may be set to any conversion, is used by
+// default in a couple of places inside wx (initially same as wxConvLibc)
+extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvCurrent;
+
+// the conversion corresponding to the current locale
+WX_DECLARE_GLOBAL_CONV(wxCSConv, wxConvLocal)
+#define wxConvLocal wxGet_wxConvLocal()
+
+// the conversion corresponding to the encoding of the standard UI elements
+//
+// by default this is the same as wxConvLocal but may be changed if the program
+// needs to use a fixed encoding
+extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI;
+
+#undef WX_DECLARE_GLOBAL_CONV
+
+// ----------------------------------------------------------------------------
+// endianness-dependent conversions
+// ----------------------------------------------------------------------------
+
+#ifdef WORDS_BIGENDIAN
+ typedef wxMBConvUTF16BE wxMBConvUTF16;
+ typedef wxMBConvUTF32BE wxMBConvUTF32;
+#else
+ typedef wxMBConvUTF16LE wxMBConvUTF16;
+ typedef wxMBConvUTF32LE wxMBConvUTF32;
+#endif
+
+// ----------------------------------------------------------------------------
+// filename conversion macros
+// ----------------------------------------------------------------------------
+
+// filenames are multibyte on Unix and widechar on Windows
+#if wxMBFILES && wxUSE_UNICODE
+ #define wxFNCONV(name) wxConvFileName->cWX2MB(name)
+ #define wxFNSTRINGCAST wxMBSTRINGCAST
+#else
+#if defined( __WXOSX_OR_COCOA__ ) && wxMBFILES
+ #define wxFNCONV(name) wxConvFileName->cWC2MB( wxConvLocal.cWX2WC(name) )
+#else
+ #define wxFNCONV(name) name
+#endif
+ #define wxFNSTRINGCAST WXSTRINGCAST
+#endif
+
+// ----------------------------------------------------------------------------
+// macros for the most common conversions
+// ----------------------------------------------------------------------------
+
+#if wxUSE_UNICODE
+ #define wxConvertWX2MB(s) wxConvCurrent->cWX2MB(s)
+ #define wxConvertMB2WX(s) wxConvCurrent->cMB2WX(s)
+
+ // these functions should be used when the conversions really, really have
+ // to succeed (usually because we pass their results to a standard C
+ // function which would crash if we passed NULL to it), so these functions
+ // always return a valid pointer if their argument is non-NULL
+
+ // this function safety is achieved by trying wxConvLibc first, wxConvUTF8
+ // next if it fails and, finally, wxConvISO8859_1 which always succeeds
+ extern WXDLLIMPEXP_BASE wxWCharBuffer wxSafeConvertMB2WX(const char *s);
+
+ // this function uses wxConvLibc and wxConvUTF8(MAP_INVALID_UTF8_TO_OCTAL)
+ // if it fails
+ extern WXDLLIMPEXP_BASE wxCharBuffer wxSafeConvertWX2MB(const wchar_t *ws);
+#else // ANSI
+ // no conversions to do
+ #define wxConvertWX2MB(s) (s)
+ #define wxConvertMB2WX(s) (s)
+ #define wxSafeConvertMB2WX(s) (s)
+ #define wxSafeConvertWX2MB(s) (s)
+#endif // Unicode/ANSI
+
+#endif // _WX_STRCONV_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/stream.h
+// Purpose: stream classes
+// Author: Guilhem Lavaux, Guillermo Rodriguez Garcia, Vadim Zeitlin
+// Modified by:
+// Created: 11/07/98
+// Copyright: (c) Guilhem Lavaux
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WXSTREAM_H__
+#define _WX_WXSTREAM_H__
+
+#include "wx/defs.h"
+
+#if wxUSE_STREAMS
+
+#include <stdio.h>
+#include "wx/object.h"
+#include "wx/string.h"
+#include "wx/filefn.h" // for wxFileOffset, wxInvalidOffset and wxSeekMode
+
+class WXDLLIMPEXP_FWD_BASE wxStreamBase;
+class WXDLLIMPEXP_FWD_BASE wxInputStream;
+class WXDLLIMPEXP_FWD_BASE wxOutputStream;
+
+typedef wxInputStream& (*__wxInputManip)(wxInputStream&);
+typedef wxOutputStream& (*__wxOutputManip)(wxOutputStream&);
+
+WXDLLIMPEXP_BASE wxOutputStream& wxEndL(wxOutputStream& o_stream);
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+enum wxStreamError
+{
+ wxSTREAM_NO_ERROR = 0, // stream is in good state
+ wxSTREAM_EOF, // EOF reached in Read() or similar
+ wxSTREAM_WRITE_ERROR, // generic write error
+ wxSTREAM_READ_ERROR // generic read error
+};
+
+const int wxEOF = -1;
+
+// ============================================================================
+// base stream classes: wxInputStream and wxOutputStream
+// ============================================================================
+
+// ---------------------------------------------------------------------------
+// wxStreamBase: common (but non virtual!) base for all stream classes
+// ---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxStreamBase : public wxObject
+{
+public:
+ wxStreamBase();
+ virtual ~wxStreamBase();
+
+ // error testing
+ wxStreamError GetLastError() const { return m_lasterror; }
+ virtual bool IsOk() const { return GetLastError() == wxSTREAM_NO_ERROR; }
+ bool operator!() const { return !IsOk(); }
+
+ // reset the stream state
+ void Reset(wxStreamError error = wxSTREAM_NO_ERROR) { m_lasterror = error; }
+
+ // this doesn't make sense for all streams, always test its return value
+ virtual size_t GetSize() const;
+ virtual wxFileOffset GetLength() const { return wxInvalidOffset; }
+
+ // returns true if the streams supports seeking to arbitrary offsets
+ virtual bool IsSeekable() const { return false; }
+
+protected:
+ virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode);
+ virtual wxFileOffset OnSysTell() const;
+
+ size_t m_lastcount;
+ wxStreamError m_lasterror;
+
+ friend class wxStreamBuffer;
+
+ DECLARE_ABSTRACT_CLASS(wxStreamBase)
+ wxDECLARE_NO_COPY_CLASS(wxStreamBase);
+};
+
+// ----------------------------------------------------------------------------
+// wxInputStream: base class for the input streams
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxInputStream : public wxStreamBase
+{
+public:
+ // ctor and dtor, nothing exciting
+ wxInputStream();
+ virtual ~wxInputStream();
+
+
+ // IO functions
+ // ------------
+
+ // return a character from the stream without removing it, i.e. it will
+ // still be returned by the next call to GetC()
+ //
+ // blocks until something appears in the stream if necessary, if nothing
+ // ever does (i.e. EOF) LastRead() will return 0 (and the return value is
+ // undefined), otherwise 1
+ virtual char Peek();
+
+ // return one byte from the stream, blocking until it appears if
+ // necessary
+ //
+ // on success returns a value between 0 - 255, or wxEOF on EOF or error.
+ int GetC();
+
+ // read at most the given number of bytes from the stream
+ //
+ // there are 2 possible situations here: either there is nothing at all in
+ // the stream right now in which case Read() blocks until something appears
+ // (use CanRead() to avoid this) or there is already some data available in
+ // the stream and then Read() doesn't block but returns just the data it
+ // can read without waiting for more
+ //
+ // in any case, if there are not enough bytes in the stream right now,
+ // LastRead() value will be less than size but greater than 0. If it is 0,
+ // it means that EOF has been reached.
+ virtual wxInputStream& Read(void *buffer, size_t size);
+
+ // Read exactly the given number of bytes, unlike Read(), which may read
+ // less than the requested amount of data without returning an error, this
+ // method either reads all the data or returns false.
+ bool ReadAll(void *buffer, size_t size);
+
+ // copy the entire contents of this stream into streamOut, stopping only
+ // when EOF is reached or an error occurs
+ wxInputStream& Read(wxOutputStream& streamOut);
+
+
+ // status functions
+ // ----------------
+
+ // returns the number of bytes read by the last call to Read(), GetC() or
+ // Peek()
+ //
+ // this should be used to discover whether that call succeeded in reading
+ // all the requested data or not
+ virtual size_t LastRead() const { return wxStreamBase::m_lastcount; }
+
+ // returns true if some data is available in the stream right now, so that
+ // calling Read() wouldn't block
+ virtual bool CanRead() const;
+
+ // is the stream at EOF?
+ //
+ // note that this cannot be really implemented for all streams and
+ // CanRead() is more reliable than Eof()
+ virtual bool Eof() const;
+
+
+ // write back buffer
+ // -----------------
+
+ // put back the specified number of bytes into the stream, they will be
+ // fetched by the next call to the read functions
+ //
+ // returns the number of bytes really stuffed back
+ size_t Ungetch(const void *buffer, size_t size);
+
+ // put back the specified character in the stream
+ //
+ // returns true if ok, false on error
+ bool Ungetch(char c);
+
+
+ // position functions
+ // ------------------
+
+ // move the stream pointer to the given position (if the stream supports
+ // it)
+ //
+ // returns wxInvalidOffset on error
+ virtual wxFileOffset SeekI(wxFileOffset pos, wxSeekMode mode = wxFromStart);
+
+ // return the current position of the stream pointer or wxInvalidOffset
+ virtual wxFileOffset TellI() const;
+
+
+ // stream-like operators
+ // ---------------------
+
+ wxInputStream& operator>>(wxOutputStream& out) { return Read(out); }
+ wxInputStream& operator>>(__wxInputManip func) { return func(*this); }
+
+protected:
+ // do read up to size bytes of data into the provided buffer
+ //
+ // this method should return 0 if EOF has been reached or an error occurred
+ // (m_lasterror should be set accordingly as well) or the number of bytes
+ // read
+ virtual size_t OnSysRead(void *buffer, size_t size) = 0;
+
+ // write-back buffer support
+ // -------------------------
+
+ // return the pointer to a buffer big enough to hold sizeNeeded bytes
+ char *AllocSpaceWBack(size_t sizeNeeded);
+
+ // read up to size data from the write back buffer, return the number of
+ // bytes read
+ size_t GetWBack(void *buf, size_t size);
+
+ // write back buffer or NULL if none
+ char *m_wback;
+
+ // the size of the buffer
+ size_t m_wbacksize;
+
+ // the current position in the buffer
+ size_t m_wbackcur;
+
+ friend class wxStreamBuffer;
+
+ DECLARE_ABSTRACT_CLASS(wxInputStream)
+ wxDECLARE_NO_COPY_CLASS(wxInputStream);
+};
+
+// ----------------------------------------------------------------------------
+// wxOutputStream: base for the output streams
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxOutputStream : public wxStreamBase
+{
+public:
+ wxOutputStream();
+ virtual ~wxOutputStream();
+
+ void PutC(char c);
+ virtual wxOutputStream& Write(const void *buffer, size_t size);
+
+ // This is ReadAll() equivalent for Write(): it either writes exactly the
+ // given number of bytes or returns false, unlike Write() which can write
+ // less data than requested but still return without error.
+ bool WriteAll(const void *buffer, size_t size);
+
+ wxOutputStream& Write(wxInputStream& stream_in);
+
+ virtual wxFileOffset SeekO(wxFileOffset pos, wxSeekMode mode = wxFromStart);
+ virtual wxFileOffset TellO() const;
+
+ virtual size_t LastWrite() const { return wxStreamBase::m_lastcount; }
+
+ virtual void Sync();
+ virtual bool Close() { return true; }
+
+ wxOutputStream& operator<<(wxInputStream& out) { return Write(out); }
+ wxOutputStream& operator<<( __wxOutputManip func) { return func(*this); }
+
+protected:
+ // to be implemented in the derived classes (it should have been pure
+ // virtual)
+ virtual size_t OnSysWrite(const void *buffer, size_t bufsize);
+
+ friend class wxStreamBuffer;
+
+ DECLARE_ABSTRACT_CLASS(wxOutputStream)
+ wxDECLARE_NO_COPY_CLASS(wxOutputStream);
+};
+
+// ============================================================================
+// helper stream classes
+// ============================================================================
+
+// ---------------------------------------------------------------------------
+// A stream for measuring streamed output
+// ---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxCountingOutputStream : public wxOutputStream
+{
+public:
+ wxCountingOutputStream();
+
+ virtual wxFileOffset GetLength() const;
+ bool Ok() const { return IsOk(); }
+ virtual bool IsOk() const { return true; }
+
+protected:
+ virtual size_t OnSysWrite(const void *buffer, size_t size);
+ virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
+ virtual wxFileOffset OnSysTell() const;
+
+ size_t m_currentPos,
+ m_lastPos;
+
+ DECLARE_DYNAMIC_CLASS(wxCountingOutputStream)
+ wxDECLARE_NO_COPY_CLASS(wxCountingOutputStream);
+};
+
+// ---------------------------------------------------------------------------
+// "Filter" streams
+// ---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxFilterInputStream : public wxInputStream
+{
+public:
+ wxFilterInputStream();
+ wxFilterInputStream(wxInputStream& stream);
+ wxFilterInputStream(wxInputStream *stream);
+ virtual ~wxFilterInputStream();
+
+ char Peek() { return m_parent_i_stream->Peek(); }
+
+ wxFileOffset GetLength() const { return m_parent_i_stream->GetLength(); }
+
+ wxInputStream *GetFilterInputStream() const { return m_parent_i_stream; }
+
+protected:
+ wxInputStream *m_parent_i_stream;
+ bool m_owns;
+
+ DECLARE_ABSTRACT_CLASS(wxFilterInputStream)
+ wxDECLARE_NO_COPY_CLASS(wxFilterInputStream);
+};
+
+class WXDLLIMPEXP_BASE wxFilterOutputStream : public wxOutputStream
+{
+public:
+ wxFilterOutputStream();
+ wxFilterOutputStream(wxOutputStream& stream);
+ wxFilterOutputStream(wxOutputStream *stream);
+ virtual ~wxFilterOutputStream();
+
+ wxFileOffset GetLength() const { return m_parent_o_stream->GetLength(); }
+
+ wxOutputStream *GetFilterOutputStream() const { return m_parent_o_stream; }
+
+ bool Close();
+
+protected:
+ wxOutputStream *m_parent_o_stream;
+ bool m_owns;
+
+ DECLARE_ABSTRACT_CLASS(wxFilterOutputStream)
+ wxDECLARE_NO_COPY_CLASS(wxFilterOutputStream);
+};
+
+enum wxStreamProtocolType
+{
+ wxSTREAM_PROTOCOL, // wxFileSystem protocol (should be only one)
+ wxSTREAM_MIMETYPE, // MIME types the stream handles
+ wxSTREAM_ENCODING, // The HTTP Content-Encodings the stream handles
+ wxSTREAM_FILEEXT // File extensions the stream handles
+};
+
+void WXDLLIMPEXP_BASE wxUseFilterClasses();
+
+class WXDLLIMPEXP_BASE wxFilterClassFactoryBase : public wxObject
+{
+public:
+ virtual ~wxFilterClassFactoryBase() { }
+
+ wxString GetProtocol() const { return wxString(*GetProtocols()); }
+ wxString PopExtension(const wxString& location) const;
+
+ virtual const wxChar * const *GetProtocols(wxStreamProtocolType type
+ = wxSTREAM_PROTOCOL) const = 0;
+
+ bool CanHandle(const wxString& protocol,
+ wxStreamProtocolType type
+ = wxSTREAM_PROTOCOL) const;
+
+protected:
+ wxString::size_type FindExtension(const wxString& location) const;
+
+ DECLARE_ABSTRACT_CLASS(wxFilterClassFactoryBase)
+};
+
+class WXDLLIMPEXP_BASE wxFilterClassFactory : public wxFilterClassFactoryBase
+{
+public:
+ virtual ~wxFilterClassFactory() { }
+
+ virtual wxFilterInputStream *NewStream(wxInputStream& stream) const = 0;
+ virtual wxFilterOutputStream *NewStream(wxOutputStream& stream) const = 0;
+ virtual wxFilterInputStream *NewStream(wxInputStream *stream) const = 0;
+ virtual wxFilterOutputStream *NewStream(wxOutputStream *stream) const = 0;
+
+ static const wxFilterClassFactory *Find(const wxString& protocol,
+ wxStreamProtocolType type
+ = wxSTREAM_PROTOCOL);
+
+ static const wxFilterClassFactory *GetFirst();
+ const wxFilterClassFactory *GetNext() const { return m_next; }
+
+ void PushFront() { Remove(); m_next = sm_first; sm_first = this; }
+ void Remove();
+
+protected:
+ wxFilterClassFactory() : m_next(this) { }
+
+ wxFilterClassFactory& operator=(const wxFilterClassFactory&)
+ { return *this; }
+
+private:
+ static wxFilterClassFactory *sm_first;
+ wxFilterClassFactory *m_next;
+
+ DECLARE_ABSTRACT_CLASS(wxFilterClassFactory)
+};
+
+// ============================================================================
+// buffered streams
+// ============================================================================
+
+// ---------------------------------------------------------------------------
+// Stream buffer: this class can be derived from and passed to
+// wxBufferedStreams to implement custom buffering
+// ---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxStreamBuffer
+{
+public:
+ enum BufMode
+ {
+ read,
+ write,
+ read_write
+ };
+
+ wxStreamBuffer(wxStreamBase& stream, BufMode mode)
+ {
+ InitWithStream(stream, mode);
+ }
+
+ wxStreamBuffer(size_t bufsize, wxInputStream& stream)
+ {
+ InitWithStream(stream, read);
+ SetBufferIO(bufsize);
+ }
+
+ wxStreamBuffer(size_t bufsize, wxOutputStream& stream)
+ {
+ InitWithStream(stream, write);
+ SetBufferIO(bufsize);
+ }
+
+ wxStreamBuffer(const wxStreamBuffer& buf);
+ virtual ~wxStreamBuffer();
+
+ // Filtered IO
+ virtual size_t Read(void *buffer, size_t size);
+ size_t Read(wxStreamBuffer *buf);
+ virtual size_t Write(const void *buffer, size_t size);
+ size_t Write(wxStreamBuffer *buf);
+
+ virtual char Peek();
+ virtual char GetChar();
+ virtual void PutChar(char c);
+ virtual wxFileOffset Tell() const;
+ virtual wxFileOffset Seek(wxFileOffset pos, wxSeekMode mode);
+
+ // Buffer control
+ void ResetBuffer();
+ void Truncate();
+
+ // NB: the buffer must always be allocated with malloc() if takeOwn is
+ // true as it will be deallocated by free()
+ void SetBufferIO(void *start, void *end, bool takeOwnership = false);
+ void SetBufferIO(void *start, size_t len, bool takeOwnership = false);
+ void SetBufferIO(size_t bufsize);
+ void *GetBufferStart() const { return m_buffer_start; }
+ void *GetBufferEnd() const { return m_buffer_end; }
+ void *GetBufferPos() const { return m_buffer_pos; }
+ size_t GetBufferSize() const { return m_buffer_end - m_buffer_start; }
+ size_t GetIntPosition() const { return m_buffer_pos - m_buffer_start; }
+ void SetIntPosition(size_t pos) { m_buffer_pos = m_buffer_start + pos; }
+ size_t GetLastAccess() const { return m_buffer_end - m_buffer_start; }
+ size_t GetBytesLeft() const { return m_buffer_end - m_buffer_pos; }
+
+ void Fixed(bool fixed) { m_fixed = fixed; }
+ void Flushable(bool f) { m_flushable = f; }
+
+ bool FlushBuffer();
+ bool FillBuffer();
+ size_t GetDataLeft();
+
+ // misc accessors
+ wxStreamBase *GetStream() const { return m_stream; }
+ bool HasBuffer() const { return m_buffer_start != m_buffer_end; }
+
+ bool IsFixed() const { return m_fixed; }
+ bool IsFlushable() const { return m_flushable; }
+
+ // only for input/output buffers respectively, returns NULL otherwise
+ wxInputStream *GetInputStream() const;
+ wxOutputStream *GetOutputStream() const;
+
+#if WXWIN_COMPATIBILITY_2_6
+ // deprecated, for compatibility only
+ wxDEPRECATED( wxStreamBase *Stream() );
+#endif // WXWIN_COMPATIBILITY_2_6
+
+ // this constructs a dummy wxStreamBuffer, used by (and exists for)
+ // wxMemoryStreams only, don't use!
+ wxStreamBuffer(BufMode mode);
+
+protected:
+ void GetFromBuffer(void *buffer, size_t size);
+ void PutToBuffer(const void *buffer, size_t size);
+
+ // set the last error to the specified value if we didn't have it before
+ void SetError(wxStreamError err);
+
+ // common part of several ctors
+ void Init();
+
+ // common part of ctors taking wxStreamBase parameter
+ void InitWithStream(wxStreamBase& stream, BufMode mode);
+
+ // init buffer variables to be empty
+ void InitBuffer();
+
+ // free the buffer (always safe to call)
+ void FreeBuffer();
+
+ // the buffer itself: the pointers to its start and end and the current
+ // position in the buffer
+ char *m_buffer_start,
+ *m_buffer_end,
+ *m_buffer_pos;
+
+ // the stream we're associated with
+ wxStreamBase *m_stream;
+
+ // its mode
+ BufMode m_mode;
+
+ // flags
+ bool m_destroybuf, // deallocate buffer?
+ m_fixed,
+ m_flushable;
+
+
+ wxDECLARE_NO_ASSIGN_CLASS(wxStreamBuffer);
+};
+
+// ---------------------------------------------------------------------------
+// wxBufferedInputStream
+// ---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxBufferedInputStream : public wxFilterInputStream
+{
+public:
+ // create a buffered stream on top of the specified low-level stream
+ //
+ // if a non NULL buffer is given to the stream, it will be deleted by it,
+ // otherwise a default 1KB buffer will be used
+ wxBufferedInputStream(wxInputStream& stream,
+ wxStreamBuffer *buffer = NULL);
+
+ // ctor allowing to specify the buffer size, it's just a more convenient
+ // alternative to creating wxStreamBuffer, calling its SetBufferIO(bufsize)
+ // and using the ctor above
+ wxBufferedInputStream(wxInputStream& stream, size_t bufsize);
+
+
+ virtual ~wxBufferedInputStream();
+
+ char Peek();
+ wxInputStream& Read(void *buffer, size_t size);
+
+ // Position functions
+ wxFileOffset SeekI(wxFileOffset pos, wxSeekMode mode = wxFromStart);
+ wxFileOffset TellI() const;
+ bool IsSeekable() const { return m_parent_i_stream->IsSeekable(); }
+
+ // the buffer given to the stream will be deleted by it
+ void SetInputStreamBuffer(wxStreamBuffer *buffer);
+ wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; }
+
+#if WXWIN_COMPATIBILITY_2_6
+ // deprecated, for compatibility only
+ wxDEPRECATED( wxStreamBuffer *InputStreamBuffer() const );
+#endif // WXWIN_COMPATIBILITY_2_6
+
+protected:
+ virtual size_t OnSysRead(void *buffer, size_t bufsize);
+ virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode);
+ virtual wxFileOffset OnSysTell() const;
+
+ wxStreamBuffer *m_i_streambuf;
+
+ wxDECLARE_NO_COPY_CLASS(wxBufferedInputStream);
+};
+
+// ----------------------------------------------------------------------------
+// wxBufferedOutputStream
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxBufferedOutputStream : public wxFilterOutputStream
+{
+public:
+ // create a buffered stream on top of the specified low-level stream
+ //
+ // if a non NULL buffer is given to the stream, it will be deleted by it,
+ // otherwise a default 1KB buffer will be used
+ wxBufferedOutputStream(wxOutputStream& stream,
+ wxStreamBuffer *buffer = NULL);
+
+ // ctor allowing to specify the buffer size, it's just a more convenient
+ // alternative to creating wxStreamBuffer, calling its SetBufferIO(bufsize)
+ // and using the ctor above
+ wxBufferedOutputStream(wxOutputStream& stream, size_t bufsize);
+
+ virtual ~wxBufferedOutputStream();
+
+ wxOutputStream& Write(const void *buffer, size_t size);
+
+ // Position functions
+ wxFileOffset SeekO(wxFileOffset pos, wxSeekMode mode = wxFromStart);
+ wxFileOffset TellO() const;
+ bool IsSeekable() const { return m_parent_o_stream->IsSeekable(); }
+
+ void Sync();
+ bool Close();
+
+ wxFileOffset GetLength() const;
+
+ // the buffer given to the stream will be deleted by it
+ void SetOutputStreamBuffer(wxStreamBuffer *buffer);
+ wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; }
+
+#if WXWIN_COMPATIBILITY_2_6
+ // deprecated, for compatibility only
+ wxDEPRECATED( wxStreamBuffer *OutputStreamBuffer() const );
+#endif // WXWIN_COMPATIBILITY_2_6
+
+protected:
+ virtual size_t OnSysWrite(const void *buffer, size_t bufsize);
+ virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode);
+ virtual wxFileOffset OnSysTell() const;
+
+ wxStreamBuffer *m_o_streambuf;
+
+ wxDECLARE_NO_COPY_CLASS(wxBufferedOutputStream);
+};
+
+#if WXWIN_COMPATIBILITY_2_6
+ inline wxStreamBase *wxStreamBuffer::Stream() { return m_stream; }
+ inline wxStreamBuffer *wxBufferedInputStream::InputStreamBuffer() const { return m_i_streambuf; }
+ inline wxStreamBuffer *wxBufferedOutputStream::OutputStreamBuffer() const { return m_o_streambuf; }
+#endif // WXWIN_COMPATIBILITY_2_6
+
+// ---------------------------------------------------------------------------
+// wxWrapperInputStream: forwards all IO to another stream.
+// ---------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxWrapperInputStream : public wxFilterInputStream
+{
+public:
+ // Constructor fully initializing the stream. The overload taking pointer
+ // takes ownership of the parent stream, the one taking reference does not.
+ //
+ // Notice that this class also has a default ctor but it's protected as the
+ // derived class is supposed to take care of calling InitParentStream() if
+ // it's used.
+ wxWrapperInputStream(wxInputStream& stream);
+ wxWrapperInputStream(wxInputStream* stream);
+
+ // Override the base class methods to forward to the wrapped stream.
+ virtual wxFileOffset GetLength() const;
+ virtual bool IsSeekable() const;
+
+protected:
+ virtual size_t OnSysRead(void *buffer, size_t size);
+ virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
+ virtual wxFileOffset OnSysTell() const;
+
+ // Ensure that our own last error is the same as that of the real stream.
+ //
+ // This method is const because the error must be updated even from const
+ // methods (in other words, it really should have been mutable in the first
+ // place).
+ void SynchronizeLastError() const
+ {
+ const_cast<wxWrapperInputStream*>(this)->
+ Reset(m_parent_i_stream->GetLastError());
+ }
+
+ // Default constructor, use InitParentStream() later.
+ wxWrapperInputStream();
+
+ // Set up the wrapped stream for an object initialized using the default
+ // constructor. The ownership logic is the same as above.
+ void InitParentStream(wxInputStream& stream);
+ void InitParentStream(wxInputStream* stream);
+
+ wxDECLARE_NO_COPY_CLASS(wxWrapperInputStream);
+};
+
+
+#endif // wxUSE_STREAMS
+
+#endif // _WX_WXSTREAM_H__
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/string.h
+// Purpose: wxString class
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 29/01/98
+// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+/*
+ Efficient string class [more or less] compatible with MFC CString,
+ wxWidgets version 1 wxString and std::string and some handy functions
+ missing from string.h.
+*/
+
+#ifndef _WX_WXSTRING_H__
+#define _WX_WXSTRING_H__
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h" // everybody should include this
+
+#if defined(__WXMAC__) || defined(__VISAGECPP__)
+ #include <ctype.h>
+#endif
+
+#if defined(__VISAGECPP__) && __IBMCPP__ >= 400
+ // problem in VACPP V4 with including stdlib.h multiple times
+ // strconv includes it anyway
+# include <stdio.h>
+# include <string.h>
+# include <stdarg.h>
+# include <limits.h>
+#else
+# include <string.h>
+# include <stdio.h>
+# include <stdarg.h>
+# include <limits.h>
+# include <stdlib.h>
+#endif
+
+#include "wx/wxcrtbase.h" // for wxChar, wxStrlen() etc.
+#include "wx/strvararg.h"
+#include "wx/buffer.h" // for wxCharBuffer
+#include "wx/strconv.h" // for wxConvertXXX() macros and wxMBConv classes
+#include "wx/stringimpl.h"
+#include "wx/stringops.h"
+#include "wx/unichar.h"
+
+// by default we cache the mapping of the positions in UTF-8 string to the byte
+// offset as this results in noticeable performance improvements for loops over
+// strings using indices; comment out this line to disable this
+//
+// notice that this optimization is well worth using even in debug builds as it
+// changes asymptotic complexity of algorithms using indices to iterate over
+// wxString back to expected linear from quadratic
+//
+// also notice that wxTLS_TYPE() (__declspec(thread) in this case) is unsafe to
+// use in DLL build under pre-Vista Windows so we disable this code for now, if
+// anybody really needs to use UTF-8 build under Windows with this optimization
+// it would have to be re-tested and probably corrected
+// CS: under OSX release builds the string destructor/cache cleanup sometimes
+// crashes, disable until we find the true reason or a better workaround
+#if wxUSE_UNICODE_UTF8 && !defined(__WINDOWS__) && !defined(__WXOSX__)
+ #define wxUSE_STRING_POS_CACHE 1
+#else
+ #define wxUSE_STRING_POS_CACHE 0
+#endif
+
+#if wxUSE_STRING_POS_CACHE
+ #include "wx/tls.h"
+
+ // change this 0 to 1 to enable additional (very expensive) asserts
+ // verifying that string caching logic works as expected
+ #if 0
+ #define wxSTRING_CACHE_ASSERT(cond) wxASSERT(cond)
+ #else
+ #define wxSTRING_CACHE_ASSERT(cond)
+ #endif
+#endif // wxUSE_STRING_POS_CACHE
+
+class WXDLLIMPEXP_FWD_BASE wxString;
+
+// unless this symbol is predefined to disable the compatibility functions, do
+// use them
+#ifndef WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER
+ #define WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER 1
+#endif
+
+namespace wxPrivate
+{
+ template <typename T> struct wxStringAsBufHelper;
+}
+
+// ---------------------------------------------------------------------------
+// macros
+// ---------------------------------------------------------------------------
+
+// casts [unfortunately!] needed to call some broken functions which require
+// "char *" instead of "const char *"
+#define WXSTRINGCAST (wxChar *)(const wxChar *)
+#define wxCSTRINGCAST (wxChar *)(const wxChar *)
+#define wxMBSTRINGCAST (char *)(const char *)
+#define wxWCSTRINGCAST (wchar_t *)(const wchar_t *)
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+#if WXWIN_COMPATIBILITY_2_6
+
+// deprecated in favour of wxString::npos, don't use in new code
+//
+// maximum possible length for a string means "take all string" everywhere
+#define wxSTRING_MAXLEN wxString::npos
+
+#endif // WXWIN_COMPATIBILITY_2_6
+
+// ---------------------------------------------------------------------------
+// global functions complementing standard C string library replacements for
+// strlen() and portable strcasecmp()
+//---------------------------------------------------------------------------
+
+#if WXWIN_COMPATIBILITY_2_8
+// Use wxXXX() functions from wxcrt.h instead! These functions are for
+// backwards compatibility only.
+
+// checks whether the passed in pointer is NULL and if the string is empty
+wxDEPRECATED_MSG("use wxIsEmpty() instead")
+inline bool IsEmpty(const char *p) { return (!p || !*p); }
+
+// safe version of strlen() (returns 0 if passed NULL pointer)
+wxDEPRECATED_MSG("use wxStrlen() instead")
+inline size_t Strlen(const char *psz)
+ { return psz ? strlen(psz) : 0; }
+
+// portable strcasecmp/_stricmp
+wxDEPRECATED_MSG("use wxStricmp() instead")
+inline int Stricmp(const char *psz1, const char *psz2)
+ { return wxCRT_StricmpA(psz1, psz2); }
+
+#endif // WXWIN_COMPATIBILITY_2_8
+
+// ----------------------------------------------------------------------------
+// wxCStrData
+// ----------------------------------------------------------------------------
+
+// Lightweight object returned by wxString::c_str() and implicitly convertible
+// to either const char* or const wchar_t*.
+class wxCStrData
+{
+private:
+ // Ctors; for internal use by wxString and wxCStrData only
+ wxCStrData(const wxString *str, size_t offset = 0, bool owned = false)
+ : m_str(str), m_offset(offset), m_owned(owned) {}
+
+public:
+ // Ctor constructs the object from char literal; they are needed to make
+ // operator?: compile and they intentionally take char*, not const char*
+ inline wxCStrData(char *buf);
+ inline wxCStrData(wchar_t *buf);
+ inline wxCStrData(const wxCStrData& data);
+
+ inline ~wxCStrData();
+
+ // AsWChar() and AsChar() can't be defined here as they use wxString and so
+ // must come after it and because of this won't be inlined when called from
+ // wxString methods (without a lot of work to extract these wxString methods
+ // from inside the class itself). But we still define them being inline
+ // below to let compiler inline them from elsewhere. And because of this we
+ // must declare them as inline here because otherwise some compilers give
+ // warnings about them, e.g. mingw32 3.4.5 warns about "<symbol> defined
+ // locally after being referenced with dllimport linkage" while IRIX
+ // mipsPro 7.4 warns about "function declared inline after being called".
+ inline const wchar_t* AsWChar() const;
+ operator const wchar_t*() const { return AsWChar(); }
+
+ inline const char* AsChar() const;
+ const unsigned char* AsUnsignedChar() const
+ { return (const unsigned char *) AsChar(); }
+ operator const char*() const { return AsChar(); }
+ operator const unsigned char*() const { return AsUnsignedChar(); }
+
+ operator const void*() const { return AsChar(); }
+
+ // returns buffers that are valid as long as the associated wxString exists
+ const wxScopedCharBuffer AsCharBuf() const
+ {
+ return wxScopedCharBuffer::CreateNonOwned(AsChar());
+ }
+
+ const wxScopedWCharBuffer AsWCharBuf() const
+ {
+ return wxScopedWCharBuffer::CreateNonOwned(AsWChar());
+ }
+
+ inline wxString AsString() const;
+
+ // returns the value as C string in internal representation (equivalent
+ // to AsString().wx_str(), but more efficient)
+ const wxStringCharType *AsInternal() const;
+
+ // allow expressions like "c_str()[0]":
+ inline wxUniChar operator[](size_t n) const;
+ wxUniChar operator[](int n) const { return operator[](size_t(n)); }
+ wxUniChar operator[](long n) const { return operator[](size_t(n)); }
+#ifndef wxSIZE_T_IS_UINT
+ wxUniChar operator[](unsigned int n) const { return operator[](size_t(n)); }
+#endif // size_t != unsigned int
+
+ // These operators are needed to emulate the pointer semantics of c_str():
+ // expressions like "wxChar *p = str.c_str() + 1;" should continue to work
+ // (we need both versions to resolve ambiguities). Note that this means
+ // the 'n' value is interpreted as addition to char*/wchar_t* pointer, it
+ // is *not* number of Unicode characters in wxString.
+ wxCStrData operator+(int n) const
+ { return wxCStrData(m_str, m_offset + n, m_owned); }
+ wxCStrData operator+(long n) const
+ { return wxCStrData(m_str, m_offset + n, m_owned); }
+ wxCStrData operator+(size_t n) const
+ { return wxCStrData(m_str, m_offset + n, m_owned); }
+
+ // and these for "str.c_str() + (p2 - p1)" (it also works for any integer
+ // expression but it must be ptrdiff_t and not e.g. int to work in this
+ // example):
+ wxCStrData operator-(ptrdiff_t n) const
+ {
+ wxASSERT_MSG( n <= (ptrdiff_t)m_offset,
+ wxT("attempt to construct address before the beginning of the string") );
+ return wxCStrData(m_str, m_offset - n, m_owned);
+ }
+
+ // this operator is needed to make expressions like "*c_str()" or
+ // "*(c_str() + 2)" work
+ inline wxUniChar operator*() const;
+
+private:
+ // the wxString this object was returned for
+ const wxString *m_str;
+ // Offset into c_str() return value. Note that this is *not* offset in
+ // m_str in Unicode characters. Instead, it is index into the
+ // char*/wchar_t* buffer returned by c_str(). It's interpretation depends
+ // on how is the wxCStrData instance used: if it is eventually cast to
+ // const char*, m_offset will be in bytes form string's start; if it is
+ // cast to const wchar_t*, it will be in wchar_t values.
+ size_t m_offset;
+ // should m_str be deleted, i.e. is it owned by us?
+ bool m_owned;
+
+ friend class WXDLLIMPEXP_FWD_BASE wxString;
+};
+
+// ----------------------------------------------------------------------------
+// wxStringPrintfMixin
+// ---------------------------------------------------------------------------
+
+// NB: VC6 has a bug that causes linker errors if you have template methods
+// in a class using __declspec(dllimport). The solution is to split such
+// class into two classes, one that contains the template methods and does
+// *not* use WXDLLIMPEXP_BASE and another class that contains the rest
+// (with DLL linkage).
+//
+// We only do this for VC6 here, because the code is less efficient
+// (Printf() has to use dynamic_cast<>) and because OpenWatcom compiler
+// cannot compile this code.
+
+#if defined(__VISUALC__) && __VISUALC__ < 1300
+ #define wxNEEDS_WXSTRING_PRINTF_MIXIN
+#endif
+
+#ifdef wxNEEDS_WXSTRING_PRINTF_MIXIN
+// this class contains implementation of wxString's vararg methods, it's
+// exported from wxBase DLL
+class WXDLLIMPEXP_BASE wxStringPrintfMixinBase
+{
+protected:
+ wxStringPrintfMixinBase() {}
+
+#if !wxUSE_UTF8_LOCALE_ONLY
+ int DoPrintfWchar(const wxChar *format, ...);
+ static wxString DoFormatWchar(const wxChar *format, ...);
+#endif
+#if wxUSE_UNICODE_UTF8
+ int DoPrintfUtf8(const char *format, ...);
+ static wxString DoFormatUtf8(const char *format, ...);
+#endif
+};
+
+// this class contains template wrappers for wxString's vararg methods, it's
+// intentionally *not* exported from the DLL in order to fix the VC6 bug
+// described above
+class wxStringPrintfMixin : public wxStringPrintfMixinBase
+{
+private:
+ // to further complicate things, we can't return wxString from
+ // wxStringPrintfMixin::Format() because wxString is not yet declared at
+ // this point; the solution is to use this fake type trait template - this
+ // way the compiler won't know the return type until Format() is used
+ // (this doesn't compile with Watcom, but VC6 compiles it just fine):
+ template<typename T> struct StringReturnType
+ {
+ typedef wxString type;
+ };
+
+public:
+ // these are duplicated wxString methods, they're also declared below
+ // if !wxNEEDS_WXSTRING_PRINTF_MIXIN:
+
+ // static wxString Format(const wString& format, ...) WX_ATTRIBUTE_PRINTF_1;
+ WX_DEFINE_VARARG_FUNC_SANS_N0(static typename StringReturnType<T1>::type,
+ Format, 1, (const wxFormatString&),
+ DoFormatWchar, DoFormatUtf8)
+ // We have to implement the version without template arguments manually
+ // because of the StringReturnType<> hack, although WX_DEFINE_VARARG_FUNC
+ // normally does it itself. It has to be a template so that we can use
+ // the hack, even though there's no real template parameter. We can't move
+ // it to wxStrig, because it would shadow these versions of Format() then.
+ template<typename T>
+ inline static typename StringReturnType<T>::type
+ Format(const T& fmt)
+ {
+ // NB: this doesn't compile if T is not (some form of) a string;
+ // this makes Format's prototype equivalent to
+ // Format(const wxFormatString& fmt)
+ return DoFormatWchar(wxFormatString(fmt));
+ }
+
+ // int Printf(const wxString& format, ...);
+ WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxFormatString&),
+ DoPrintfWchar, DoPrintfUtf8)
+ // int sprintf(const wxString& format, ...) WX_ATTRIBUTE_PRINTF_2;
+ WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wxFormatString&),
+ DoPrintfWchar, DoPrintfUtf8)
+
+protected:
+ wxStringPrintfMixin() : wxStringPrintfMixinBase() {}
+};
+#endif // wxNEEDS_WXSTRING_PRINTF_MIXIN
+
+
+// ----------------------------------------------------------------------------
+// wxString: string class trying to be compatible with std::string, MFC
+// CString and wxWindows 1.x wxString all at once
+// ---------------------------------------------------------------------------
+
+#ifdef wxNEEDS_WXSTRING_PRINTF_MIXIN
+ // "non dll-interface class 'wxStringPrintfMixin' used as base interface
+ // for dll-interface class 'wxString'" -- this is OK in our case
+ #pragma warning (push)
+ #pragma warning (disable:4275)
+#endif
+
+#if wxUSE_UNICODE_UTF8
+// see the comment near wxString::iterator for why we need this
+class WXDLLIMPEXP_BASE wxStringIteratorNode
+{
+public:
+ wxStringIteratorNode()
+ : m_str(NULL), m_citer(NULL), m_iter(NULL), m_prev(NULL), m_next(NULL) {}
+ wxStringIteratorNode(const wxString *str,
+ wxStringImpl::const_iterator *citer)
+ { DoSet(str, citer, NULL); }
+ wxStringIteratorNode(const wxString *str, wxStringImpl::iterator *iter)
+ { DoSet(str, NULL, iter); }
+ ~wxStringIteratorNode()
+ { clear(); }
+
+ inline void set(const wxString *str, wxStringImpl::const_iterator *citer)
+ { clear(); DoSet(str, citer, NULL); }
+ inline void set(const wxString *str, wxStringImpl::iterator *iter)
+ { clear(); DoSet(str, NULL, iter); }
+
+ const wxString *m_str;
+ wxStringImpl::const_iterator *m_citer;
+ wxStringImpl::iterator *m_iter;
+ wxStringIteratorNode *m_prev, *m_next;
+
+private:
+ inline void clear();
+ inline void DoSet(const wxString *str,
+ wxStringImpl::const_iterator *citer,
+ wxStringImpl::iterator *iter);
+
+ // the node belongs to a particular iterator instance, it's not copied
+ // when a copy of the iterator is made
+ wxDECLARE_NO_COPY_CLASS(wxStringIteratorNode);
+};
+#endif // wxUSE_UNICODE_UTF8
+
+class WXDLLIMPEXP_BASE wxString
+#ifdef wxNEEDS_WXSTRING_PRINTF_MIXIN
+ : public wxStringPrintfMixin
+#endif
+{
+ // NB: special care was taken in arranging the member functions in such order
+ // that all inline functions can be effectively inlined, verify that all
+ // performance critical functions are still inlined if you change order!
+public:
+ // an 'invalid' value for string index, moved to this place due to a CW bug
+ static const size_t npos;
+
+private:
+ // if we hadn't made these operators private, it would be possible to
+ // compile "wxString s; s = 17;" without any warnings as 17 is implicitly
+ // converted to char in C and we do have operator=(char)
+ //
+ // NB: we don't need other versions (short/long and unsigned) as attempt
+ // to assign another numeric type to wxString will now result in
+ // ambiguity between operator=(char) and operator=(int)
+ wxString& operator=(int);
+
+ // these methods are not implemented - there is _no_ conversion from int to
+ // string, you're doing something wrong if the compiler wants to call it!
+ //
+ // try `s << i' or `s.Printf("%d", i)' instead
+ wxString(int);
+
+
+ // buffer for holding temporary substring when using any of the methods
+ // that take (char*,size_t) or (wchar_t*,size_t) arguments:
+ template<typename T>
+ struct SubstrBufFromType
+ {
+ T data;
+ size_t len;
+
+ SubstrBufFromType(const T& data_, size_t len_)
+ : data(data_), len(len_)
+ {
+ wxASSERT_MSG( len != npos, "must have real length" );
+ }
+ };
+
+#if wxUSE_UNICODE_UTF8
+ // even char* -> char* needs conversion, from locale charset to UTF-8
+ typedef SubstrBufFromType<wxScopedCharBuffer> SubstrBufFromWC;
+ typedef SubstrBufFromType<wxScopedCharBuffer> SubstrBufFromMB;
+#elif wxUSE_UNICODE_WCHAR
+ typedef SubstrBufFromType<const wchar_t*> SubstrBufFromWC;
+ typedef SubstrBufFromType<wxScopedWCharBuffer> SubstrBufFromMB;
+#else
+ typedef SubstrBufFromType<const char*> SubstrBufFromMB;
+ typedef SubstrBufFromType<wxScopedCharBuffer> SubstrBufFromWC;
+#endif
+
+
+ // Functions implementing primitive operations on string data; wxString
+ // methods and iterators are implemented in terms of it. The differences
+ // between UTF-8 and wchar_t* representations of the string are mostly
+ // contained here.
+
+#if wxUSE_UNICODE_UTF8
+ static SubstrBufFromMB ConvertStr(const char *psz, size_t nLength,
+ const wxMBConv& conv);
+ static SubstrBufFromWC ConvertStr(const wchar_t *pwz, size_t nLength,
+ const wxMBConv& conv);
+#elif wxUSE_UNICODE_WCHAR
+ static SubstrBufFromMB ConvertStr(const char *psz, size_t nLength,
+ const wxMBConv& conv);
+#else
+ static SubstrBufFromWC ConvertStr(const wchar_t *pwz, size_t nLength,
+ const wxMBConv& conv);
+#endif
+
+#if !wxUSE_UNICODE_UTF8 // wxUSE_UNICODE_WCHAR or !wxUSE_UNICODE
+ // returns C string encoded as the implementation expects:
+ #if wxUSE_UNICODE
+ static const wchar_t* ImplStr(const wchar_t* str)
+ { return str ? str : wxT(""); }
+ static const SubstrBufFromWC ImplStr(const wchar_t* str, size_t n)
+ { return SubstrBufFromWC(str, (str && n == npos) ? wxWcslen(str) : n); }
+ static wxScopedWCharBuffer ImplStr(const char* str,
+ const wxMBConv& conv = wxConvLibc)
+ { return ConvertStr(str, npos, conv).data; }
+ static SubstrBufFromMB ImplStr(const char* str, size_t n,
+ const wxMBConv& conv = wxConvLibc)
+ { return ConvertStr(str, n, conv); }
+ #else
+ static const char* ImplStr(const char* str,
+ const wxMBConv& WXUNUSED(conv) = wxConvLibc)
+ { return str ? str : ""; }
+ static const SubstrBufFromMB ImplStr(const char* str, size_t n,
+ const wxMBConv& WXUNUSED(conv) = wxConvLibc)
+ { return SubstrBufFromMB(str, (str && n == npos) ? wxStrlen(str) : n); }
+ static wxScopedCharBuffer ImplStr(const wchar_t* str)
+ { return ConvertStr(str, npos, wxConvLibc).data; }
+ static SubstrBufFromWC ImplStr(const wchar_t* str, size_t n)
+ { return ConvertStr(str, n, wxConvLibc); }
+ #endif
+
+ // translates position index in wxString to/from index in underlying
+ // wxStringImpl:
+ static size_t PosToImpl(size_t pos) { return pos; }
+ static void PosLenToImpl(size_t pos, size_t len,
+ size_t *implPos, size_t *implLen)
+ { *implPos = pos; *implLen = len; }
+ static size_t LenToImpl(size_t len) { return len; }
+ static size_t PosFromImpl(size_t pos) { return pos; }
+
+ // we don't want to define these as empty inline functions as it could
+ // result in noticeable (and quite unnecessary in non-UTF-8 build) slowdown
+ // in debug build where the inline functions are not effectively inlined
+ #define wxSTRING_INVALIDATE_CACHE()
+ #define wxSTRING_INVALIDATE_CACHED_LENGTH()
+ #define wxSTRING_UPDATE_CACHED_LENGTH(n)
+ #define wxSTRING_SET_CACHED_LENGTH(n)
+
+#else // wxUSE_UNICODE_UTF8
+
+ static wxScopedCharBuffer ImplStr(const char* str,
+ const wxMBConv& conv = wxConvLibc)
+ { return ConvertStr(str, npos, conv).data; }
+ static SubstrBufFromMB ImplStr(const char* str, size_t n,
+ const wxMBConv& conv = wxConvLibc)
+ { return ConvertStr(str, n, conv); }
+
+ static wxScopedCharBuffer ImplStr(const wchar_t* str)
+ { return ConvertStr(str, npos, wxMBConvUTF8()).data; }
+ static SubstrBufFromWC ImplStr(const wchar_t* str, size_t n)
+ { return ConvertStr(str, n, wxMBConvUTF8()); }
+
+#if wxUSE_STRING_POS_CACHE
+ // this is an extremely simple cache used by PosToImpl(): each cache element
+ // contains the string it applies to and the index corresponding to the last
+ // used position in this wxString in its m_impl string
+ //
+ // NB: notice that this struct (and nested Element one) must be a POD or we
+ // wouldn't be able to use a thread-local variable of this type, in
+ // particular it should have no ctor -- we rely on statics being
+ // initialized to 0 instead
+ struct Cache
+ {
+ enum { SIZE = 8 };
+
+ struct Element
+ {
+ const wxString *str; // the string to which this element applies
+ size_t pos, // the cached index in this string
+ impl, // the corresponding position in its m_impl
+ len; // cached length or npos if unknown
+
+ // reset cached index to 0
+ void ResetPos() { pos = impl = 0; }
+
+ // reset position and length
+ void Reset() { ResetPos(); len = npos; }
+ };
+
+ // cache the indices mapping for the last few string used
+ Element cached[SIZE];
+
+ // the last used index
+ unsigned lastUsed;
+ };
+
+#ifndef wxHAS_COMPILER_TLS
+ // we must use an accessor function and not a static variable when the TLS
+ // variables support is implemented in the library (and not by the compiler)
+ // because the global s_cache variable could be not yet initialized when a
+ // ctor of another global object is executed and if that ctor uses any
+ // wxString methods, bad things happen
+ //
+ // however notice that this approach does not work when compiler TLS is used,
+ // at least not with g++ 4.1.2 under amd64 as it apparently compiles code
+ // using this accessor incorrectly when optimizations are enabled (-O2 is
+ // enough) -- luckily we don't need it then neither as static __thread
+ // variables are initialized by 0 anyhow then and so we can use the variable
+ // directly
+ WXEXPORT static Cache& GetCache()
+ {
+ static wxTLS_TYPE(Cache) s_cache;
+
+ return wxTLS_VALUE(s_cache);
+ }
+
+ // this helper struct is used to ensure that GetCache() is called during
+ // static initialization time, i.e. before any threads creation, as otherwise
+ // the static s_cache construction inside GetCache() wouldn't be MT-safe
+ friend struct wxStrCacheInitializer;
+#else // wxHAS_COMPILER_TLS
+ static wxTLS_TYPE(Cache) ms_cache;
+ static Cache& GetCache() { return wxTLS_VALUE(ms_cache); }
+#endif // !wxHAS_COMPILER_TLS/wxHAS_COMPILER_TLS
+
+ static Cache::Element *GetCacheBegin() { return GetCache().cached; }
+ static Cache::Element *GetCacheEnd() { return GetCacheBegin() + Cache::SIZE; }
+ static unsigned& LastUsedCacheElement() { return GetCache().lastUsed; }
+
+ // this is used in debug builds only to provide a convenient function,
+ // callable from a debugger, to show the cache contents
+ friend struct wxStrCacheDumper;
+
+ // uncomment this to have access to some profiling statistics on program
+ // termination
+ //#define wxPROFILE_STRING_CACHE
+
+#ifdef wxPROFILE_STRING_CACHE
+ static struct PosToImplCacheStats
+ {
+ unsigned postot, // total non-trivial calls to PosToImpl
+ poshits, // cache hits from PosToImpl()
+ mishits, // cached position beyond the needed one
+ sumpos, // sum of all positions, used to compute the
+ // average position after dividing by postot
+ sumofs, // sum of all offsets after using the cache, used to
+ // compute the average after dividing by hits
+ lentot, // number of total calls to length()
+ lenhits; // number of cache hits in length()
+ } ms_cacheStats;
+
+ friend struct wxStrCacheStatsDumper;
+
+ #define wxCACHE_PROFILE_FIELD_INC(field) ms_cacheStats.field++
+ #define wxCACHE_PROFILE_FIELD_ADD(field, val) ms_cacheStats.field += (val)
+#else // !wxPROFILE_STRING_CACHE
+ #define wxCACHE_PROFILE_FIELD_INC(field)
+ #define wxCACHE_PROFILE_FIELD_ADD(field, val)
+#endif // wxPROFILE_STRING_CACHE/!wxPROFILE_STRING_CACHE
+
+ // note: it could seem that the functions below shouldn't be inline because
+ // they are big, contain loops and so the compiler shouldn't be able to
+ // inline them anyhow, however moving them into string.cpp does decrease the
+ // code performance by ~5%, at least when using g++ 4.1 so do keep them here
+ // unless tests show that it's not advantageous any more
+
+ // return the pointer to the cache element for this string or NULL if not
+ // cached
+ Cache::Element *FindCacheElement() const
+ {
+ // profiling seems to show a small but consistent gain if we use this
+ // simple loop instead of starting from the last used element (there are
+ // a lot of misses in this function...)
+ Cache::Element * const cacheBegin = GetCacheBegin();
+#ifndef wxHAS_COMPILER_TLS
+ // during destruction tls calls may return NULL, in this case return NULL
+ // immediately without accessing anything else
+ if ( cacheBegin == NULL )
+ return NULL;
+#endif
+ Cache::Element * const cacheEnd = GetCacheEnd();
+ for ( Cache::Element *c = cacheBegin; c != cacheEnd; c++ )
+ {
+ if ( c->str == this )
+ return c;
+ }
+
+ return NULL;
+ }
+
+ // unlike FindCacheElement(), this one always returns a valid pointer to the
+ // cache element for this string, it may have valid last cached position and
+ // its corresponding index in the byte string or not
+ Cache::Element *GetCacheElement() const
+ {
+ Cache::Element * const cacheBegin = GetCacheBegin();
+ Cache::Element * const cacheEnd = GetCacheEnd();
+ Cache::Element * const cacheStart = cacheBegin + LastUsedCacheElement();
+
+ // check the last used first, this does no (measurable) harm for a miss
+ // but does help for simple loops addressing the same string all the time
+ if ( cacheStart->str == this )
+ return cacheStart;
+
+ // notice that we're going to check cacheStart again inside this call but
+ // profiling shows that it's still faster to use a simple loop like
+ // inside FindCacheElement() than manually looping with wrapping starting
+ // from the cache entry after the start one
+ Cache::Element *c = FindCacheElement();
+ if ( !c )
+ {
+ // claim the next cache entry for this string
+ c = cacheStart;
+ if ( ++c == cacheEnd )
+ c = cacheBegin;
+
+ c->str = this;
+ c->Reset();
+
+ // and remember the last used element
+ LastUsedCacheElement() = c - cacheBegin;
+ }
+
+ return c;
+ }
+
+ size_t DoPosToImpl(size_t pos) const
+ {
+ wxCACHE_PROFILE_FIELD_INC(postot);
+
+ // NB: although the case of pos == 1 (and offset from cached position
+ // equal to 1) are common, nothing is gained by writing special code
+ // for handling them, the compiler (at least g++ 4.1 used) seems to
+ // optimize the code well enough on its own
+
+ wxCACHE_PROFILE_FIELD_ADD(sumpos, pos);
+
+ Cache::Element * const cache = GetCacheElement();
+
+ // cached position can't be 0 so if it is, it means that this entry was
+ // used for length caching only so far, i.e. it doesn't count as a hit
+ // from our point of view
+ if ( cache->pos )
+ {
+ wxCACHE_PROFILE_FIELD_INC(poshits);
+ }
+
+ if ( pos == cache->pos )
+ return cache->impl;
+
+ // this seems to happen only rarely so just reset the cache in this case
+ // instead of complicating code even further by seeking backwards in this
+ // case
+ if ( cache->pos > pos )
+ {
+ wxCACHE_PROFILE_FIELD_INC(mishits);
+
+ cache->ResetPos();
+ }
+
+ wxCACHE_PROFILE_FIELD_ADD(sumofs, pos - cache->pos);
+
+
+ wxStringImpl::const_iterator i(m_impl.begin() + cache->impl);
+ for ( size_t n = cache->pos; n < pos; n++ )
+ wxStringOperations::IncIter(i);
+
+ cache->pos = pos;
+ cache->impl = i - m_impl.begin();
+
+ wxSTRING_CACHE_ASSERT(
+ (int)cache->impl == (begin() + pos).impl() - m_impl.begin() );
+
+ return cache->impl;
+ }
+
+ void InvalidateCache()
+ {
+ Cache::Element * const cache = FindCacheElement();
+ if ( cache )
+ cache->Reset();
+ }
+
+ void InvalidateCachedLength()
+ {
+ Cache::Element * const cache = FindCacheElement();
+ if ( cache )
+ cache->len = npos;
+ }
+
+ void SetCachedLength(size_t len)
+ {
+ // we optimistically cache the length here even if the string wasn't
+ // present in the cache before, this seems to do no harm and the
+ // potential for avoiding length recomputation for long strings looks
+ // interesting
+ GetCacheElement()->len = len;
+ }
+
+ void UpdateCachedLength(ptrdiff_t delta)
+ {
+ Cache::Element * const cache = FindCacheElement();
+ if ( cache && cache->len != npos )
+ {
+ wxSTRING_CACHE_ASSERT( (ptrdiff_t)cache->len + delta >= 0 );
+
+ cache->len += delta;
+ }
+ }
+
+ #define wxSTRING_INVALIDATE_CACHE() InvalidateCache()
+ #define wxSTRING_INVALIDATE_CACHED_LENGTH() InvalidateCachedLength()
+ #define wxSTRING_UPDATE_CACHED_LENGTH(n) UpdateCachedLength(n)
+ #define wxSTRING_SET_CACHED_LENGTH(n) SetCachedLength(n)
+#else // !wxUSE_STRING_POS_CACHE
+ size_t DoPosToImpl(size_t pos) const
+ {
+ return (begin() + pos).impl() - m_impl.begin();
+ }
+
+ #define wxSTRING_INVALIDATE_CACHE()
+ #define wxSTRING_INVALIDATE_CACHED_LENGTH()
+ #define wxSTRING_UPDATE_CACHED_LENGTH(n)
+ #define wxSTRING_SET_CACHED_LENGTH(n)
+#endif // wxUSE_STRING_POS_CACHE/!wxUSE_STRING_POS_CACHE
+
+ size_t PosToImpl(size_t pos) const
+ {
+ return pos == 0 || pos == npos ? pos : DoPosToImpl(pos);
+ }
+
+ void PosLenToImpl(size_t pos, size_t len, size_t *implPos, size_t *implLen) const;
+
+ size_t LenToImpl(size_t len) const
+ {
+ size_t pos, len2;
+ PosLenToImpl(0, len, &pos, &len2);
+ return len2;
+ }
+
+ size_t PosFromImpl(size_t pos) const
+ {
+ if ( pos == 0 || pos == npos )
+ return pos;
+ else
+ return const_iterator(this, m_impl.begin() + pos) - begin();
+ }
+#endif // !wxUSE_UNICODE_UTF8/wxUSE_UNICODE_UTF8
+
+public:
+ // standard types
+ typedef wxUniChar value_type;
+ typedef wxUniChar char_type;
+ typedef wxUniCharRef reference;
+ typedef wxChar* pointer;
+ typedef const wxChar* const_pointer;
+
+ typedef size_t size_type;
+ typedef wxUniChar const_reference;
+
+#if wxUSE_STD_STRING
+ #if wxUSE_UNICODE_UTF8
+ // random access is not O(1), as required by Random Access Iterator
+ #define WX_STR_ITERATOR_TAG std::bidirectional_iterator_tag
+ #else
+ #define WX_STR_ITERATOR_TAG std::random_access_iterator_tag
+ #endif
+ #define WX_DEFINE_ITERATOR_CATEGORY(cat) typedef cat iterator_category;
+#else
+ // not defining iterator_category at all in this case is better than defining
+ // it as some dummy type -- at least it results in more intelligible error
+ // messages
+ #define WX_DEFINE_ITERATOR_CATEGORY(cat)
+#endif
+
+ #define WX_STR_ITERATOR_IMPL(iterator_name, pointer_type, reference_type) \
+ private: \
+ typedef wxStringImpl::iterator_name underlying_iterator; \
+ public: \
+ WX_DEFINE_ITERATOR_CATEGORY(WX_STR_ITERATOR_TAG) \
+ typedef wxUniChar value_type; \
+ typedef ptrdiff_t difference_type; \
+ typedef reference_type reference; \
+ typedef pointer_type pointer; \
+ \
+ reference operator[](size_t n) const { return *(*this + n); } \
+ \
+ iterator_name& operator++() \
+ { wxStringOperations::IncIter(m_cur); return *this; } \
+ iterator_name& operator--() \
+ { wxStringOperations::DecIter(m_cur); return *this; } \
+ iterator_name operator++(int) \
+ { \
+ iterator_name tmp = *this; \
+ wxStringOperations::IncIter(m_cur); \
+ return tmp; \
+ } \
+ iterator_name operator--(int) \
+ { \
+ iterator_name tmp = *this; \
+ wxStringOperations::DecIter(m_cur); \
+ return tmp; \
+ } \
+ \
+ iterator_name& operator+=(ptrdiff_t n) \
+ { \
+ m_cur = wxStringOperations::AddToIter(m_cur, n); \
+ return *this; \
+ } \
+ iterator_name& operator-=(ptrdiff_t n) \
+ { \
+ m_cur = wxStringOperations::AddToIter(m_cur, -n); \
+ return *this; \
+ } \
+ \
+ difference_type operator-(const iterator_name& i) const \
+ { return wxStringOperations::DiffIters(m_cur, i.m_cur); } \
+ \
+ bool operator==(const iterator_name& i) const \
+ { return m_cur == i.m_cur; } \
+ bool operator!=(const iterator_name& i) const \
+ { return m_cur != i.m_cur; } \
+ \
+ bool operator<(const iterator_name& i) const \
+ { return m_cur < i.m_cur; } \
+ bool operator>(const iterator_name& i) const \
+ { return m_cur > i.m_cur; } \
+ bool operator<=(const iterator_name& i) const \
+ { return m_cur <= i.m_cur; } \
+ bool operator>=(const iterator_name& i) const \
+ { return m_cur >= i.m_cur; } \
+ \
+ private: \
+ /* for internal wxString use only: */ \
+ underlying_iterator impl() const { return m_cur; } \
+ \
+ friend class wxString; \
+ friend class wxCStrData; \
+ \
+ private: \
+ underlying_iterator m_cur
+
+ class WXDLLIMPEXP_FWD_BASE const_iterator;
+
+#if wxUSE_UNICODE_UTF8
+ // NB: In UTF-8 build, (non-const) iterator needs to keep reference
+ // to the underlying wxStringImpl, because UTF-8 is variable-length
+ // encoding and changing the value pointer to by an iterator (using
+ // its operator*) requires calling wxStringImpl::replace() if the old
+ // and new values differ in their encoding's length.
+ //
+ // Furthermore, the replace() call may invalid all iterators for the
+ // string, so we have to keep track of outstanding iterators and update
+ // them if replace() happens.
+ //
+ // This is implemented by maintaining linked list of iterators for every
+ // string and traversing it in wxUniCharRef::operator=(). Head of the
+ // list is stored in wxString. (FIXME-UTF8)
+
+ class WXDLLIMPEXP_BASE iterator
+ {
+ WX_STR_ITERATOR_IMPL(iterator, wxChar*, wxUniCharRef);
+
+ public:
+ iterator() {}
+ iterator(const iterator& i)
+ : m_cur(i.m_cur), m_node(i.str(), &m_cur) {}
+ iterator& operator=(const iterator& i)
+ {
+ if (&i != this)
+ {
+ m_cur = i.m_cur;
+ m_node.set(i.str(), &m_cur);
+ }
+ return *this;
+ }
+
+ reference operator*()
+ { return wxUniCharRef::CreateForString(*str(), m_cur); }
+
+ iterator operator+(ptrdiff_t n) const
+ { return iterator(str(), wxStringOperations::AddToIter(m_cur, n)); }
+ iterator operator-(ptrdiff_t n) const
+ { return iterator(str(), wxStringOperations::AddToIter(m_cur, -n)); }
+
+ // Normal iterators need to be comparable with the const_iterators so
+ // declare the comparison operators and implement them below after the
+ // full const_iterator declaration.
+ bool operator==(const const_iterator& i) const;
+ bool operator!=(const const_iterator& i) const;
+ bool operator<(const const_iterator& i) const;
+ bool operator>(const const_iterator& i) const;
+ bool operator<=(const const_iterator& i) const;
+ bool operator>=(const const_iterator& i) const;
+
+ private:
+ iterator(wxString *wxstr, underlying_iterator ptr)
+ : m_cur(ptr), m_node(wxstr, &m_cur) {}
+
+ wxString* str() const { return const_cast<wxString*>(m_node.m_str); }
+
+ wxStringIteratorNode m_node;
+
+ friend class const_iterator;
+ };
+
+ class WXDLLIMPEXP_BASE const_iterator
+ {
+ // NB: reference_type is intentionally value, not reference, the character
+ // may be encoded differently in wxString data:
+ WX_STR_ITERATOR_IMPL(const_iterator, const wxChar*, wxUniChar);
+
+ public:
+ const_iterator() {}
+ const_iterator(const const_iterator& i)
+ : m_cur(i.m_cur), m_node(i.str(), &m_cur) {}
+ const_iterator(const iterator& i)
+ : m_cur(i.m_cur), m_node(i.str(), &m_cur) {}
+
+ const_iterator& operator=(const const_iterator& i)
+ {
+ if (&i != this)
+ {
+ m_cur = i.m_cur;
+ m_node.set(i.str(), &m_cur);
+ }
+ return *this;
+ }
+ const_iterator& operator=(const iterator& i)
+ { m_cur = i.m_cur; m_node.set(i.str(), &m_cur); return *this; }
+
+ reference operator*() const
+ { return wxStringOperations::DecodeChar(m_cur); }
+
+ const_iterator operator+(ptrdiff_t n) const
+ { return const_iterator(str(), wxStringOperations::AddToIter(m_cur, n)); }
+ const_iterator operator-(ptrdiff_t n) const
+ { return const_iterator(str(), wxStringOperations::AddToIter(m_cur, -n)); }
+
+ // Notice that comparison operators taking non-const iterator are not
+ // needed here because of the implicit conversion from non-const iterator
+ // to const ones ensure that the versions for const_iterator declared
+ // inside WX_STR_ITERATOR_IMPL can be used.
+
+ private:
+ // for internal wxString use only:
+ const_iterator(const wxString *wxstr, underlying_iterator ptr)
+ : m_cur(ptr), m_node(wxstr, &m_cur) {}
+
+ const wxString* str() const { return m_node.m_str; }
+
+ wxStringIteratorNode m_node;
+ };
+
+ size_t IterToImplPos(wxString::iterator i) const
+ { return wxStringImpl::const_iterator(i.impl()) - m_impl.begin(); }
+
+ iterator GetIterForNthChar(size_t n)
+ { return iterator(this, m_impl.begin() + PosToImpl(n)); }
+ const_iterator GetIterForNthChar(size_t n) const
+ { return const_iterator(this, m_impl.begin() + PosToImpl(n)); }
+#else // !wxUSE_UNICODE_UTF8
+
+ class WXDLLIMPEXP_BASE iterator
+ {
+ WX_STR_ITERATOR_IMPL(iterator, wxChar*, wxUniCharRef);
+
+ public:
+ iterator() {}
+ iterator(const iterator& i) : m_cur(i.m_cur) {}
+
+ reference operator*()
+ { return wxUniCharRef::CreateForString(m_cur); }
+
+ iterator operator+(ptrdiff_t n) const
+ { return iterator(wxStringOperations::AddToIter(m_cur, n)); }
+ iterator operator-(ptrdiff_t n) const
+ { return iterator(wxStringOperations::AddToIter(m_cur, -n)); }
+
+ // As in UTF-8 case above, define comparison operators taking
+ // const_iterator too.
+ bool operator==(const const_iterator& i) const;
+ bool operator!=(const const_iterator& i) const;
+ bool operator<(const const_iterator& i) const;
+ bool operator>(const const_iterator& i) const;
+ bool operator<=(const const_iterator& i) const;
+ bool operator>=(const const_iterator& i) const;
+
+ private:
+ // for internal wxString use only:
+ iterator(underlying_iterator ptr) : m_cur(ptr) {}
+ iterator(wxString *WXUNUSED(str), underlying_iterator ptr) : m_cur(ptr) {}
+
+ friend class const_iterator;
+ };
+
+ class WXDLLIMPEXP_BASE const_iterator
+ {
+ // NB: reference_type is intentionally value, not reference, the character
+ // may be encoded differently in wxString data:
+ WX_STR_ITERATOR_IMPL(const_iterator, const wxChar*, wxUniChar);
+
+ public:
+ const_iterator() {}
+ const_iterator(const const_iterator& i) : m_cur(i.m_cur) {}
+ const_iterator(const iterator& i) : m_cur(i.m_cur) {}
+
+ reference operator*() const
+ { return wxStringOperations::DecodeChar(m_cur); }
+
+ const_iterator operator+(ptrdiff_t n) const
+ { return const_iterator(wxStringOperations::AddToIter(m_cur, n)); }
+ const_iterator operator-(ptrdiff_t n) const
+ { return const_iterator(wxStringOperations::AddToIter(m_cur, -n)); }
+
+ // As in UTF-8 case above, we don't need comparison operators taking
+ // iterator because we have an implicit conversion from iterator to
+ // const_iterator so the operators declared by WX_STR_ITERATOR_IMPL will
+ // be used.
+
+ private:
+ // for internal wxString use only:
+ const_iterator(underlying_iterator ptr) : m_cur(ptr) {}
+ const_iterator(const wxString *WXUNUSED(str), underlying_iterator ptr)
+ : m_cur(ptr) {}
+ };
+
+ iterator GetIterForNthChar(size_t n) { return begin() + n; }
+ const_iterator GetIterForNthChar(size_t n) const { return begin() + n; }
+#endif // wxUSE_UNICODE_UTF8/!wxUSE_UNICODE_UTF8
+
+ #undef WX_STR_ITERATOR_TAG
+ #undef WX_STR_ITERATOR_IMPL
+
+ // This method is mostly used by wxWidgets itself and return the offset of
+ // the given iterator in bytes relative to the start of the buffer
+ // representing the current string contents in the current locale encoding.
+ //
+ // It is inefficient as it involves converting part of the string to this
+ // encoding (and also unsafe as it simply returns 0 if the conversion fails)
+ // and so should be avoided if possible, wx itself only uses it to implement
+ // backwards-compatible API.
+ ptrdiff_t IterOffsetInMBStr(const const_iterator& i) const
+ {
+ const wxString str(begin(), i);
+
+ // This is logically equivalent to strlen(str.mb_str()) but avoids
+ // actually converting the string to multibyte and just computes the
+ // length that it would have after conversion.
+ size_t ofs = wxConvLibc.FromWChar(NULL, 0, str.wc_str(), str.length());
+ return ofs == wxCONV_FAILED ? 0 : static_cast<ptrdiff_t>(ofs);
+ }
+
+ friend class iterator;
+ friend class const_iterator;
+
+ template <typename T>
+ class reverse_iterator_impl
+ {
+ public:
+ typedef T iterator_type;
+
+ WX_DEFINE_ITERATOR_CATEGORY(typename T::iterator_category)
+ typedef typename T::value_type value_type;
+ typedef typename T::difference_type difference_type;
+ typedef typename T::reference reference;
+ typedef typename T::pointer *pointer;
+
+ reverse_iterator_impl() {}
+ reverse_iterator_impl(iterator_type i) : m_cur(i) {}
+ reverse_iterator_impl(const reverse_iterator_impl& ri)
+ : m_cur(ri.m_cur) {}
+
+ iterator_type base() const { return m_cur; }
+
+ reference operator*() const { return *(m_cur-1); }
+ reference operator[](size_t n) const { return *(*this + n); }
+
+ reverse_iterator_impl& operator++()
+ { --m_cur; return *this; }
+ reverse_iterator_impl operator++(int)
+ { reverse_iterator_impl tmp = *this; --m_cur; return tmp; }
+ reverse_iterator_impl& operator--()
+ { ++m_cur; return *this; }
+ reverse_iterator_impl operator--(int)
+ { reverse_iterator_impl tmp = *this; ++m_cur; return tmp; }
+
+ // NB: explicit <T> in the functions below is to keep BCC 5.5 happy
+ reverse_iterator_impl operator+(ptrdiff_t n) const
+ { return reverse_iterator_impl<T>(m_cur - n); }
+ reverse_iterator_impl operator-(ptrdiff_t n) const
+ { return reverse_iterator_impl<T>(m_cur + n); }
+ reverse_iterator_impl operator+=(ptrdiff_t n)
+ { m_cur -= n; return *this; }
+ reverse_iterator_impl operator-=(ptrdiff_t n)
+ { m_cur += n; return *this; }
+
+ unsigned operator-(const reverse_iterator_impl& i) const
+ { return i.m_cur - m_cur; }
+
+ bool operator==(const reverse_iterator_impl& ri) const
+ { return m_cur == ri.m_cur; }
+ bool operator!=(const reverse_iterator_impl& ri) const
+ { return !(*this == ri); }
+
+ bool operator<(const reverse_iterator_impl& i) const
+ { return m_cur > i.m_cur; }
+ bool operator>(const reverse_iterator_impl& i) const
+ { return m_cur < i.m_cur; }
+ bool operator<=(const reverse_iterator_impl& i) const
+ { return m_cur >= i.m_cur; }
+ bool operator>=(const reverse_iterator_impl& i) const
+ { return m_cur <= i.m_cur; }
+
+ private:
+ iterator_type m_cur;
+ };
+
+ typedef reverse_iterator_impl<iterator> reverse_iterator;
+ typedef reverse_iterator_impl<const_iterator> const_reverse_iterator;
+
+private:
+ // used to transform an expression built using c_str() (and hence of type
+ // wxCStrData) to an iterator into the string
+ static const_iterator CreateConstIterator(const wxCStrData& data)
+ {
+ return const_iterator(data.m_str,
+ (data.m_str->begin() + data.m_offset).impl());
+ }
+
+ // in UTF-8 STL build, creation from std::string requires conversion under
+ // non-UTF8 locales, so we can't have and use wxString(wxStringImpl) ctor;
+ // instead we define dummy type that lets us have wxString ctor for creation
+ // from wxStringImpl that couldn't be used by user code (in all other builds,
+ // "standard" ctors can be used):
+#if wxUSE_UNICODE_UTF8 && wxUSE_STL_BASED_WXSTRING
+ struct CtorFromStringImplTag {};
+
+ wxString(CtorFromStringImplTag* WXUNUSED(dummy), const wxStringImpl& src)
+ : m_impl(src) {}
+
+ static wxString FromImpl(const wxStringImpl& src)
+ { return wxString((CtorFromStringImplTag*)NULL, src); }
+#else
+ #if !wxUSE_STL_BASED_WXSTRING
+ wxString(const wxStringImpl& src) : m_impl(src) { }
+ // else: already defined as wxString(wxStdString) below
+ #endif
+ static wxString FromImpl(const wxStringImpl& src) { return wxString(src); }
+#endif
+
+public:
+ // constructors and destructor
+ // ctor for an empty string
+ wxString() {}
+
+ // copy ctor
+ wxString(const wxString& stringSrc) : m_impl(stringSrc.m_impl) { }
+
+ // string containing nRepeat copies of ch
+ wxString(wxUniChar ch, size_t nRepeat = 1 )
+ { assign(nRepeat, ch); }
+ wxString(size_t nRepeat, wxUniChar ch)
+ { assign(nRepeat, ch); }
+ wxString(wxUniCharRef ch, size_t nRepeat = 1)
+ { assign(nRepeat, ch); }
+ wxString(size_t nRepeat, wxUniCharRef ch)
+ { assign(nRepeat, ch); }
+ wxString(char ch, size_t nRepeat = 1)
+ { assign(nRepeat, ch); }
+ wxString(size_t nRepeat, char ch)
+ { assign(nRepeat, ch); }
+ wxString(wchar_t ch, size_t nRepeat = 1)
+ { assign(nRepeat, ch); }
+ wxString(size_t nRepeat, wchar_t ch)
+ { assign(nRepeat, ch); }
+
+ // ctors from char* strings:
+ wxString(const char *psz)
+ : m_impl(ImplStr(psz)) {}
+ wxString(const char *psz, const wxMBConv& conv)
+ : m_impl(ImplStr(psz, conv)) {}
+ wxString(const char *psz, size_t nLength)
+ { assign(psz, nLength); }
+ wxString(const char *psz, const wxMBConv& conv, size_t nLength)
+ {
+ SubstrBufFromMB str(ImplStr(psz, nLength, conv));
+ m_impl.assign(str.data, str.len);
+ }
+
+ // and unsigned char*:
+ wxString(const unsigned char *psz)
+ : m_impl(ImplStr((const char*)psz)) {}
+ wxString(const unsigned char *psz, const wxMBConv& conv)
+ : m_impl(ImplStr((const char*)psz, conv)) {}
+ wxString(const unsigned char *psz, size_t nLength)
+ { assign((const char*)psz, nLength); }
+ wxString(const unsigned char *psz, const wxMBConv& conv, size_t nLength)
+ {
+ SubstrBufFromMB str(ImplStr((const char*)psz, nLength, conv));
+ m_impl.assign(str.data, str.len);
+ }
+
+ // ctors from wchar_t* strings:
+ wxString(const wchar_t *pwz)
+ : m_impl(ImplStr(pwz)) {}
+ wxString(const wchar_t *pwz, const wxMBConv& WXUNUSED(conv))
+ : m_impl(ImplStr(pwz)) {}
+ wxString(const wchar_t *pwz, size_t nLength)
+ { assign(pwz, nLength); }
+ wxString(const wchar_t *pwz, const wxMBConv& WXUNUSED(conv), size_t nLength)
+ { assign(pwz, nLength); }
+
+ wxString(const wxScopedCharBuffer& buf)
+ { assign(buf.data(), buf.length()); }
+ wxString(const wxScopedWCharBuffer& buf)
+ { assign(buf.data(), buf.length()); }
+
+ // NB: this version uses m_impl.c_str() to force making a copy of the
+ // string, so that "wxString(str.c_str())" idiom for passing strings
+ // between threads works
+ wxString(const wxCStrData& cstr)
+ : m_impl(cstr.AsString().m_impl.c_str()) { }
+
+ // as we provide both ctors with this signature for both char and unsigned
+ // char string, we need to provide one for wxCStrData to resolve ambiguity
+ wxString(const wxCStrData& cstr, size_t nLength)
+ : m_impl(cstr.AsString().Mid(0, nLength).m_impl) {}
+
+ // and because wxString is convertible to wxCStrData and const wxChar *
+ // we also need to provide this one
+ wxString(const wxString& str, size_t nLength)
+ { assign(str, nLength); }
+
+
+#if wxUSE_STRING_POS_CACHE
+ ~wxString()
+ {
+ // we need to invalidate our cache entry as another string could be
+ // recreated at the same address (unlikely, but still possible, with the
+ // heap-allocated strings but perfectly common with stack-allocated ones)
+ InvalidateCache();
+ }
+#endif // wxUSE_STRING_POS_CACHE
+
+ // even if we're not built with wxUSE_STD_STRING_CONV_IN_WXSTRING == 1 it is
+ // very convenient to allow implicit conversions from std::string to wxString
+ // and vice verse as this allows to use the same strings in non-GUI and GUI
+ // code, however we don't want to unconditionally add this ctor as it would
+ // make wx lib dependent on libstdc++ on some Linux versions which is bad, so
+ // instead we ask the client code to define this wxUSE_STD_STRING symbol if
+ // they need it
+#if wxUSE_STD_STRING
+ #if wxUSE_UNICODE_WCHAR
+ wxString(const wxStdWideString& str) : m_impl(str) {}
+ #else // UTF-8 or ANSI
+ wxString(const wxStdWideString& str)
+ { assign(str.c_str(), str.length()); }
+ #endif
+
+ #if !wxUSE_UNICODE // ANSI build
+ // FIXME-UTF8: do this in UTF8 build #if wxUSE_UTF8_LOCALE_ONLY, too
+ wxString(const std::string& str) : m_impl(str) {}
+ #else // Unicode
+ wxString(const std::string& str)
+ { assign(str.c_str(), str.length()); }
+ #endif
+#endif // wxUSE_STD_STRING
+
+ // Also always provide explicit conversions to std::[w]string in any case,
+ // see below for the implicit ones.
+#if wxUSE_STD_STRING
+ // We can avoid a copy if we already use this string type internally,
+ // otherwise we create a copy on the fly:
+ #if wxUSE_UNICODE_WCHAR && wxUSE_STL_BASED_WXSTRING
+ #define wxStringToStdWstringRetType const wxStdWideString&
+ const wxStdWideString& ToStdWstring() const { return m_impl; }
+ #else
+ // wxStringImpl is either not std::string or needs conversion
+ #define wxStringToStdWstringRetType wxStdWideString
+ wxStdWideString ToStdWstring() const
+ {
+#if wxUSE_UNICODE_WCHAR
+ wxScopedWCharBuffer buf =
+ wxScopedWCharBuffer::CreateNonOwned(m_impl.c_str(), m_impl.length());
+#else // !wxUSE_UNICODE_WCHAR
+ wxScopedWCharBuffer buf(wc_str());
+#endif
+
+ return wxStdWideString(buf.data(), buf.length());
+ }
+ #endif
+
+ #if (!wxUSE_UNICODE || wxUSE_UTF8_LOCALE_ONLY) && wxUSE_STL_BASED_WXSTRING
+ // wxStringImpl is std::string in the encoding we want
+ #define wxStringToStdStringRetType const std::string&
+ const std::string& ToStdString() const { return m_impl; }
+ #else
+ // wxStringImpl is either not std::string or needs conversion
+ #define wxStringToStdStringRetType std::string
+ std::string ToStdString() const
+ {
+ wxScopedCharBuffer buf(mb_str());
+ return std::string(buf.data(), buf.length());
+ }
+ #endif
+
+#if wxUSE_STD_STRING_CONV_IN_WXSTRING
+ // Implicit conversions to std::[w]string are not provided by default as
+ // they conflict with the implicit conversions to "const char/wchar_t *"
+ // which we use for backwards compatibility but do provide them if
+ // explicitly requested.
+ operator wxStringToStdStringRetType() const { return ToStdString(); }
+ operator wxStringToStdWstringRetType() const { return ToStdWstring(); }
+#endif // wxUSE_STD_STRING_CONV_IN_WXSTRING
+
+#undef wxStringToStdStringRetType
+#undef wxStringToStdWstringRetType
+
+#endif // wxUSE_STD_STRING
+
+ wxString Clone() const
+ {
+ // make a deep copy of the string, i.e. the returned string will have
+ // ref count = 1 with refcounted implementation
+ return wxString::FromImpl(wxStringImpl(m_impl.c_str(), m_impl.length()));
+ }
+
+ // first valid index position
+ const_iterator begin() const { return const_iterator(this, m_impl.begin()); }
+ iterator begin() { return iterator(this, m_impl.begin()); }
+ // position one after the last valid one
+ const_iterator end() const { return const_iterator(this, m_impl.end()); }
+ iterator end() { return iterator(this, m_impl.end()); }
+
+ // first element of the reversed string
+ const_reverse_iterator rbegin() const
+ { return const_reverse_iterator(end()); }
+ reverse_iterator rbegin()
+ { return reverse_iterator(end()); }
+ // one beyond the end of the reversed string
+ const_reverse_iterator rend() const
+ { return const_reverse_iterator(begin()); }
+ reverse_iterator rend()
+ { return reverse_iterator(begin()); }
+
+ // std::string methods:
+#if wxUSE_UNICODE_UTF8
+ size_t length() const
+ {
+#if wxUSE_STRING_POS_CACHE
+ wxCACHE_PROFILE_FIELD_INC(lentot);
+
+ Cache::Element * const cache = GetCacheElement();
+
+ if ( cache->len == npos )
+ {
+ // it's probably not worth trying to be clever and using cache->pos
+ // here as it's probably 0 anyhow -- you usually call length() before
+ // starting to index the string
+ cache->len = end() - begin();
+ }
+ else
+ {
+ wxCACHE_PROFILE_FIELD_INC(lenhits);
+
+ wxSTRING_CACHE_ASSERT( (int)cache->len == end() - begin() );
+ }
+
+ return cache->len;
+#else // !wxUSE_STRING_POS_CACHE
+ return end() - begin();
+#endif // wxUSE_STRING_POS_CACHE/!wxUSE_STRING_POS_CACHE
+ }
+#else
+ size_t length() const { return m_impl.length(); }
+#endif
+
+ size_type size() const { return length(); }
+ size_type max_size() const { return npos; }
+
+ bool empty() const { return m_impl.empty(); }
+
+ // NB: these methods don't have a well-defined meaning in UTF-8 case
+ size_type capacity() const { return m_impl.capacity(); }
+ void reserve(size_t sz) { m_impl.reserve(sz); }
+
+ void resize(size_t nSize, wxUniChar ch = wxT('\0'))
+ {
+ const size_t len = length();
+ if ( nSize == len)
+ return;
+
+#if wxUSE_UNICODE_UTF8
+ if ( nSize < len )
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ // we can't use wxStringImpl::resize() for truncating the string as it
+ // counts in bytes, not characters
+ erase(nSize);
+ return;
+ }
+
+ // we also can't use (presumably more efficient) resize() if we have to
+ // append characters taking more than one byte
+ if ( !ch.IsAscii() )
+ {
+ append(nSize - len, ch);
+ }
+ else // can use (presumably faster) resize() version
+#endif // wxUSE_UNICODE_UTF8
+ {
+ wxSTRING_INVALIDATE_CACHED_LENGTH();
+
+ m_impl.resize(nSize, (wxStringCharType)ch);
+ }
+ }
+
+ wxString substr(size_t nStart = 0, size_t nLen = npos) const
+ {
+ size_t pos, len;
+ PosLenToImpl(nStart, nLen, &pos, &len);
+ return FromImpl(m_impl.substr(pos, len));
+ }
+
+ // generic attributes & operations
+ // as standard strlen()
+ size_t Len() const { return length(); }
+ // string contains any characters?
+ bool IsEmpty() const { return empty(); }
+ // empty string is "false", so !str will return true
+ bool operator!() const { return empty(); }
+ // truncate the string to given length
+ wxString& Truncate(size_t uiLen);
+ // empty string contents
+ void Empty() { clear(); }
+ // empty the string and free memory
+ void Clear() { clear(); }
+
+ // contents test
+ // Is an ascii value
+ bool IsAscii() const;
+ // Is a number
+ bool IsNumber() const;
+ // Is a word
+ bool IsWord() const;
+
+ // data access (all indexes are 0 based)
+ // read access
+ wxUniChar at(size_t n) const
+ { return wxStringOperations::DecodeChar(m_impl.begin() + PosToImpl(n)); }
+ wxUniChar GetChar(size_t n) const
+ { return at(n); }
+ // read/write access
+ wxUniCharRef at(size_t n)
+ { return *GetIterForNthChar(n); }
+ wxUniCharRef GetWritableChar(size_t n)
+ { return at(n); }
+ // write access
+ void SetChar(size_t n, wxUniChar ch)
+ { at(n) = ch; }
+
+ // get last character
+ wxUniChar Last() const
+ {
+ wxASSERT_MSG( !empty(), wxT("wxString: index out of bounds") );
+ return *rbegin();
+ }
+
+ // get writable last character
+ wxUniCharRef Last()
+ {
+ wxASSERT_MSG( !empty(), wxT("wxString: index out of bounds") );
+ return *rbegin();
+ }
+
+ /*
+ Note that we we must define all of the overloads below to avoid
+ ambiguity when using str[0].
+ */
+ wxUniChar operator[](int n) const
+ { return at(n); }
+ wxUniChar operator[](long n) const
+ { return at(n); }
+ wxUniChar operator[](size_t n) const
+ { return at(n); }
+#ifndef wxSIZE_T_IS_UINT
+ wxUniChar operator[](unsigned int n) const
+ { return at(n); }
+#endif // size_t != unsigned int
+
+ // operator versions of GetWriteableChar()
+ wxUniCharRef operator[](int n)
+ { return at(n); }
+ wxUniCharRef operator[](long n)
+ { return at(n); }
+ wxUniCharRef operator[](size_t n)
+ { return at(n); }
+#ifndef wxSIZE_T_IS_UINT
+ wxUniCharRef operator[](unsigned int n)
+ { return at(n); }
+#endif // size_t != unsigned int
+
+
+ /*
+ Overview of wxString conversions, implicit and explicit:
+
+ - wxString has a std::[w]string-like c_str() method, however it does
+ not return a C-style string directly but instead returns wxCStrData
+ helper object which is convertible to either "char *" narrow string
+ or "wchar_t *" wide string. Usually the correct conversion will be
+ applied by the compiler automatically but if this doesn't happen you
+ need to explicitly choose one using wxCStrData::AsChar() or AsWChar()
+ methods or another wxString conversion function.
+
+ - One of the places where the conversion does *NOT* happen correctly is
+ when c_str() is passed to a vararg function such as printf() so you
+ must *NOT* use c_str() with them. Either use wxPrintf() (all wx
+ functions do handle c_str() correctly, even if they appear to be
+ vararg (but they're not, really)) or add an explicit AsChar() or, if
+ compatibility with previous wxWidgets versions is important, add a
+ cast to "const char *".
+
+ - In non-STL mode only, wxString is also implicitly convertible to
+ wxCStrData. The same warning as above applies.
+
+ - c_str() is polymorphic as it can be converted to either narrow or
+ wide string. If you explicitly need one or the other, choose to use
+ mb_str() (for narrow) or wc_str() (for wide) instead. Notice that
+ these functions can return either the pointer to string directly (if
+ this is what the string uses internally) or a temporary buffer
+ containing the string and convertible to it. Again, conversion will
+ usually be done automatically by the compiler but beware of the
+ vararg functions: you need an explicit cast when using them.
+
+ - There are also non-const versions of mb_str() and wc_str() called
+ char_str() and wchar_str(). They are only meant to be used with
+ non-const-correct functions and they always return buffers.
+
+ - Finally wx_str() returns whatever string representation is used by
+ wxString internally. It may be either a narrow or wide string
+ depending on wxWidgets build mode but it will always be a raw pointer
+ (and not a buffer).
+ */
+
+ // explicit conversion to wxCStrData
+ wxCStrData c_str() const { return wxCStrData(this); }
+ wxCStrData data() const { return c_str(); }
+
+ // implicit conversion to wxCStrData
+ operator wxCStrData() const { return c_str(); }
+
+ // the first two operators conflict with operators for conversion to
+ // std::string and they must be disabled if those conversions are enabled;
+ // the next one only makes sense if conversions to char* are also defined
+ // and not defining it in STL build also helps us to get more clear error
+ // messages for the code which relies on implicit conversion to char* in
+ // STL build
+#if !wxUSE_STD_STRING_CONV_IN_WXSTRING
+ operator const char*() const { return c_str(); }
+ operator const wchar_t*() const { return c_str(); }
+
+ // implicit conversion to untyped pointer for compatibility with previous
+ // wxWidgets versions: this is the same as conversion to const char * so it
+ // may fail!
+ operator const void*() const { return c_str(); }
+#endif // !wxUSE_STD_STRING_CONV_IN_WXSTRING
+
+ // identical to c_str(), for MFC compatibility
+ const wxCStrData GetData() const { return c_str(); }
+
+ // explicit conversion to C string in internal representation (char*,
+ // wchar_t*, UTF-8-encoded char*, depending on the build):
+ const wxStringCharType *wx_str() const { return m_impl.c_str(); }
+
+ // conversion to *non-const* multibyte or widestring buffer; modifying
+ // returned buffer won't affect the string, these methods are only useful
+ // for passing values to const-incorrect functions
+ wxWritableCharBuffer char_str(const wxMBConv& conv = wxConvLibc) const
+ { return mb_str(conv); }
+ wxWritableWCharBuffer wchar_str() const { return wc_str(); }
+
+ // conversion to the buffer of the given type T (= char or wchar_t) and
+ // also optionally return the buffer length
+ //
+ // this is mostly/only useful for the template functions
+ //
+ // FIXME-VC6: the second argument only exists for VC6 which doesn't support
+ // explicit template function selection, do not use it unless
+ // you must support VC6!
+ template <typename T>
+ wxCharTypeBuffer<T> tchar_str(size_t *len = NULL,
+ T * WXUNUSED(dummy) = NULL) const
+ {
+#if wxUSE_UNICODE
+ // we need a helper dispatcher depending on type
+ return wxPrivate::wxStringAsBufHelper<T>::Get(*this, len);
+#else // ANSI
+ // T can only be char in ANSI build
+ if ( len )
+ *len = length();
+
+ return wxCharTypeBuffer<T>::CreateNonOwned(wx_str(), length());
+#endif // Unicode build kind
+ }
+
+ // conversion to/from plain (i.e. 7 bit) ASCII: this is useful for
+ // converting numbers or strings which are certain not to contain special
+ // chars (typically system functions, X atoms, environment variables etc.)
+ //
+ // the behaviour of these functions with the strings containing anything
+ // else than 7 bit ASCII characters is undefined, use at your own risk.
+#if wxUSE_UNICODE
+ static wxString FromAscii(const char *ascii, size_t len);
+ static wxString FromAscii(const char *ascii);
+ static wxString FromAscii(char ascii);
+ const wxScopedCharBuffer ToAscii() const;
+#else // ANSI
+ static wxString FromAscii(const char *ascii) { return wxString( ascii ); }
+ static wxString FromAscii(const char *ascii, size_t len)
+ { return wxString( ascii, len ); }
+ static wxString FromAscii(char ascii) { return wxString( ascii ); }
+ const char *ToAscii() const { return c_str(); }
+#endif // Unicode/!Unicode
+
+ // also provide unsigned char overloads as signed/unsigned doesn't matter
+ // for 7 bit ASCII characters
+ static wxString FromAscii(const unsigned char *ascii)
+ { return FromAscii((const char *)ascii); }
+ static wxString FromAscii(const unsigned char *ascii, size_t len)
+ { return FromAscii((const char *)ascii, len); }
+
+ // conversion to/from UTF-8:
+#if wxUSE_UNICODE_UTF8
+ static wxString FromUTF8Unchecked(const char *utf8)
+ {
+ if ( !utf8 )
+ return wxEmptyString;
+
+ wxASSERT( wxStringOperations::IsValidUtf8String(utf8) );
+ return FromImpl(wxStringImpl(utf8));
+ }
+ static wxString FromUTF8Unchecked(const char *utf8, size_t len)
+ {
+ if ( !utf8 )
+ return wxEmptyString;
+ if ( len == npos )
+ return FromUTF8Unchecked(utf8);
+
+ wxASSERT( wxStringOperations::IsValidUtf8String(utf8, len) );
+ return FromImpl(wxStringImpl(utf8, len));
+ }
+
+ static wxString FromUTF8(const char *utf8)
+ {
+ if ( !utf8 || !wxStringOperations::IsValidUtf8String(utf8) )
+ return "";
+
+ return FromImpl(wxStringImpl(utf8));
+ }
+ static wxString FromUTF8(const char *utf8, size_t len)
+ {
+ if ( len == npos )
+ return FromUTF8(utf8);
+
+ if ( !utf8 || !wxStringOperations::IsValidUtf8String(utf8, len) )
+ return "";
+
+ return FromImpl(wxStringImpl(utf8, len));
+ }
+
+ const wxScopedCharBuffer utf8_str() const
+ { return wxCharBuffer::CreateNonOwned(m_impl.c_str(), m_impl.length()); }
+
+ // this function exists in UTF-8 build only and returns the length of the
+ // internal UTF-8 representation
+ size_t utf8_length() const { return m_impl.length(); }
+#elif wxUSE_UNICODE_WCHAR
+ static wxString FromUTF8(const char *utf8, size_t len = npos)
+ { return wxString(utf8, wxMBConvUTF8(), len); }
+ static wxString FromUTF8Unchecked(const char *utf8, size_t len = npos)
+ {
+ const wxString s(utf8, wxMBConvUTF8(), len);
+ wxASSERT_MSG( !utf8 || !*utf8 || !s.empty(),
+ "string must be valid UTF-8" );
+ return s;
+ }
+ const wxScopedCharBuffer utf8_str() const { return mb_str(wxMBConvUTF8()); }
+#else // ANSI
+ static wxString FromUTF8(const char *utf8)
+ { return wxString(wxMBConvUTF8().cMB2WC(utf8)); }
+ static wxString FromUTF8(const char *utf8, size_t len)
+ {
+ size_t wlen;
+ wxScopedWCharBuffer buf(wxMBConvUTF8().cMB2WC(utf8, len == npos ? wxNO_LEN : len, &wlen));
+ return wxString(buf.data(), wlen);
+ }
+ static wxString FromUTF8Unchecked(const char *utf8, size_t len = npos)
+ {
+ size_t wlen;
+ wxScopedWCharBuffer buf
+ (
+ wxMBConvUTF8().cMB2WC
+ (
+ utf8,
+ len == npos ? wxNO_LEN : len,
+ &wlen
+ )
+ );
+ wxASSERT_MSG( !utf8 || !*utf8 || wlen,
+ "string must be valid UTF-8" );
+
+ return wxString(buf.data(), wlen);
+ }
+ const wxScopedCharBuffer utf8_str() const
+ { return wxMBConvUTF8().cWC2MB(wc_str()); }
+#endif
+
+ const wxScopedCharBuffer ToUTF8() const { return utf8_str(); }
+
+ // functions for storing binary data in wxString:
+#if wxUSE_UNICODE
+ static wxString From8BitData(const char *data, size_t len)
+ { return wxString(data, wxConvISO8859_1, len); }
+ // version for NUL-terminated data:
+ static wxString From8BitData(const char *data)
+ { return wxString(data, wxConvISO8859_1); }
+ const wxScopedCharBuffer To8BitData() const
+ { return mb_str(wxConvISO8859_1); }
+#else // ANSI
+ static wxString From8BitData(const char *data, size_t len)
+ { return wxString(data, len); }
+ // version for NUL-terminated data:
+ static wxString From8BitData(const char *data)
+ { return wxString(data); }
+ const wxScopedCharBuffer To8BitData() const
+ { return wxScopedCharBuffer::CreateNonOwned(wx_str(), length()); }
+#endif // Unicode/ANSI
+
+ // conversions with (possible) format conversions: have to return a
+ // buffer with temporary data
+ //
+ // the functions defined (in either Unicode or ANSI) mode are mb_str() to
+ // return an ANSI (multibyte) string, wc_str() to return a wide string and
+ // fn_str() to return a string which should be used with the OS APIs
+ // accepting the file names. The return value is always the same, but the
+ // type differs because a function may either return pointer to the buffer
+ // directly or have to use intermediate buffer for translation.
+
+#if wxUSE_UNICODE
+
+ // this is an optimization: even though using mb_str(wxConvLibc) does the
+ // same thing (i.e. returns pointer to internal representation as locale is
+ // always an UTF-8 one) in wxUSE_UTF8_LOCALE_ONLY case, we can avoid the
+ // extra checks and the temporary buffer construction by providing a
+ // separate mb_str() overload
+#if wxUSE_UTF8_LOCALE_ONLY
+ const char* mb_str() const { return wx_str(); }
+ const wxScopedCharBuffer mb_str(const wxMBConv& conv) const
+ {
+ return AsCharBuf(conv);
+ }
+#else // !wxUSE_UTF8_LOCALE_ONLY
+ const wxScopedCharBuffer mb_str(const wxMBConv& conv = wxConvLibc) const
+ {
+ return AsCharBuf(conv);
+ }
+#endif // wxUSE_UTF8_LOCALE_ONLY/!wxUSE_UTF8_LOCALE_ONLY
+
+ const wxWX2MBbuf mbc_str() const { return mb_str(*wxConvCurrent); }
+
+#if wxUSE_UNICODE_WCHAR
+ const wchar_t* wc_str() const { return wx_str(); }
+#elif wxUSE_UNICODE_UTF8
+ const wxScopedWCharBuffer wc_str() const
+ { return AsWCharBuf(wxMBConvStrictUTF8()); }
+#endif
+ // for compatibility with !wxUSE_UNICODE version
+ const wxWX2WCbuf wc_str(const wxMBConv& WXUNUSED(conv)) const
+ { return wc_str(); }
+
+#if wxMBFILES
+ const wxScopedCharBuffer fn_str() const { return mb_str(wxConvFile); }
+#else // !wxMBFILES
+ const wxWX2WCbuf fn_str() const { return wc_str(); }
+#endif // wxMBFILES/!wxMBFILES
+
+#else // ANSI
+ const char* mb_str() const { return wx_str(); }
+
+ // for compatibility with wxUSE_UNICODE version
+ const char* mb_str(const wxMBConv& WXUNUSED(conv)) const { return wx_str(); }
+
+ const wxWX2MBbuf mbc_str() const { return mb_str(); }
+
+ const wxScopedWCharBuffer wc_str(const wxMBConv& conv = wxConvLibc) const
+ { return AsWCharBuf(conv); }
+
+ const wxScopedCharBuffer fn_str() const
+ { return wxConvFile.cWC2WX( wc_str( wxConvLibc ) ); }
+#endif // Unicode/ANSI
+
+#if wxUSE_UNICODE_UTF8
+ const wxScopedWCharBuffer t_str() const { return wc_str(); }
+#elif wxUSE_UNICODE_WCHAR
+ const wchar_t* t_str() const { return wx_str(); }
+#else
+ const char* t_str() const { return wx_str(); }
+#endif
+
+
+ // overloaded assignment
+ // from another wxString
+ wxString& operator=(const wxString& stringSrc)
+ {
+ if ( this != &stringSrc )
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ m_impl = stringSrc.m_impl;
+ }
+
+ return *this;
+ }
+
+ wxString& operator=(const wxCStrData& cstr)
+ { return *this = cstr.AsString(); }
+ // from a character
+ wxString& operator=(wxUniChar ch)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+#if wxUSE_UNICODE_UTF8
+ if ( !ch.IsAscii() )
+ m_impl = wxStringOperations::EncodeChar(ch);
+ else
+#endif // wxUSE_UNICODE_UTF8
+ m_impl = (wxStringCharType)ch;
+ return *this;
+ }
+
+ wxString& operator=(wxUniCharRef ch)
+ { return operator=((wxUniChar)ch); }
+ wxString& operator=(char ch)
+ { return operator=(wxUniChar(ch)); }
+ wxString& operator=(unsigned char ch)
+ { return operator=(wxUniChar(ch)); }
+ wxString& operator=(wchar_t ch)
+ { return operator=(wxUniChar(ch)); }
+ // from a C string - STL probably will crash on NULL,
+ // so we need to compensate in that case
+#if wxUSE_STL_BASED_WXSTRING
+ wxString& operator=(const char *psz)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ if ( psz )
+ m_impl = ImplStr(psz);
+ else
+ clear();
+
+ return *this;
+ }
+
+ wxString& operator=(const wchar_t *pwz)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ if ( pwz )
+ m_impl = ImplStr(pwz);
+ else
+ clear();
+
+ return *this;
+ }
+#else // !wxUSE_STL_BASED_WXSTRING
+ wxString& operator=(const char *psz)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ m_impl = ImplStr(psz);
+
+ return *this;
+ }
+
+ wxString& operator=(const wchar_t *pwz)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ m_impl = ImplStr(pwz);
+
+ return *this;
+ }
+#endif // wxUSE_STL_BASED_WXSTRING/!wxUSE_STL_BASED_WXSTRING
+
+ wxString& operator=(const unsigned char *psz)
+ { return operator=((const char*)psz); }
+
+ // from wxScopedWCharBuffer
+ wxString& operator=(const wxScopedWCharBuffer& s)
+ { return assign(s); }
+ // from wxScopedCharBuffer
+ wxString& operator=(const wxScopedCharBuffer& s)
+ { return assign(s); }
+
+ // string concatenation
+ // in place concatenation
+ /*
+ Concatenate and return the result. Note that the left to right
+ associativity of << allows to write things like "str << str1 << str2
+ << ..." (unlike with +=)
+ */
+ // string += string
+ wxString& operator<<(const wxString& s)
+ {
+#if WXWIN_COMPATIBILITY_2_8 && !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8
+ wxASSERT_MSG( s.IsValid(),
+ wxT("did you forget to call UngetWriteBuf()?") );
+#endif
+
+ append(s);
+ return *this;
+ }
+ // string += C string
+ wxString& operator<<(const char *psz)
+ { append(psz); return *this; }
+ wxString& operator<<(const wchar_t *pwz)
+ { append(pwz); return *this; }
+ wxString& operator<<(const wxCStrData& psz)
+ { append(psz.AsString()); return *this; }
+ // string += char
+ wxString& operator<<(wxUniChar ch) { append(1, ch); return *this; }
+ wxString& operator<<(wxUniCharRef ch) { append(1, ch); return *this; }
+ wxString& operator<<(char ch) { append(1, ch); return *this; }
+ wxString& operator<<(unsigned char ch) { append(1, ch); return *this; }
+ wxString& operator<<(wchar_t ch) { append(1, ch); return *this; }
+
+ // string += buffer (i.e. from wxGetString)
+ wxString& operator<<(const wxScopedWCharBuffer& s)
+ { return append(s); }
+ wxString& operator<<(const wxScopedCharBuffer& s)
+ { return append(s); }
+
+ // string += C string
+ wxString& Append(const wxString& s)
+ {
+ // test for empty() to share the string if possible
+ if ( empty() )
+ *this = s;
+ else
+ append(s);
+ return *this;
+ }
+ wxString& Append(const char* psz)
+ { append(psz); return *this; }
+ wxString& Append(const wchar_t* pwz)
+ { append(pwz); return *this; }
+ wxString& Append(const wxCStrData& psz)
+ { append(psz); return *this; }
+ wxString& Append(const wxScopedCharBuffer& psz)
+ { append(psz); return *this; }
+ wxString& Append(const wxScopedWCharBuffer& psz)
+ { append(psz); return *this; }
+ wxString& Append(const char* psz, size_t nLen)
+ { append(psz, nLen); return *this; }
+ wxString& Append(const wchar_t* pwz, size_t nLen)
+ { append(pwz, nLen); return *this; }
+ wxString& Append(const wxCStrData& psz, size_t nLen)
+ { append(psz, nLen); return *this; }
+ wxString& Append(const wxScopedCharBuffer& psz, size_t nLen)
+ { append(psz, nLen); return *this; }
+ wxString& Append(const wxScopedWCharBuffer& psz, size_t nLen)
+ { append(psz, nLen); return *this; }
+ // append count copies of given character
+ wxString& Append(wxUniChar ch, size_t count = 1u)
+ { append(count, ch); return *this; }
+ wxString& Append(wxUniCharRef ch, size_t count = 1u)
+ { append(count, ch); return *this; }
+ wxString& Append(char ch, size_t count = 1u)
+ { append(count, ch); return *this; }
+ wxString& Append(unsigned char ch, size_t count = 1u)
+ { append(count, ch); return *this; }
+ wxString& Append(wchar_t ch, size_t count = 1u)
+ { append(count, ch); return *this; }
+
+ // prepend a string, return the string itself
+ wxString& Prepend(const wxString& str)
+ { *this = str + *this; return *this; }
+
+ // non-destructive concatenation
+ // two strings
+ friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string1,
+ const wxString& string2);
+ // string with a single char
+ friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxUniChar ch);
+ // char with a string
+ friend wxString WXDLLIMPEXP_BASE operator+(wxUniChar ch, const wxString& string);
+ // string with C string
+ friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string,
+ const char *psz);
+ friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string,
+ const wchar_t *pwz);
+ // C string with string
+ friend wxString WXDLLIMPEXP_BASE operator+(const char *psz,
+ const wxString& string);
+ friend wxString WXDLLIMPEXP_BASE operator+(const wchar_t *pwz,
+ const wxString& string);
+
+ // stream-like functions
+ // insert an int into string
+ wxString& operator<<(int i)
+ { return (*this) << Format(wxT("%d"), i); }
+ // insert an unsigned int into string
+ wxString& operator<<(unsigned int ui)
+ { return (*this) << Format(wxT("%u"), ui); }
+ // insert a long into string
+ wxString& operator<<(long l)
+ { return (*this) << Format(wxT("%ld"), l); }
+ // insert an unsigned long into string
+ wxString& operator<<(unsigned long ul)
+ { return (*this) << Format(wxT("%lu"), ul); }
+#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
+ // insert a long long if they exist and aren't longs
+ wxString& operator<<(wxLongLong_t ll)
+ {
+ return (*this) << Format("%" wxLongLongFmtSpec "d", ll);
+ }
+ // insert an unsigned long long
+ wxString& operator<<(wxULongLong_t ull)
+ {
+ return (*this) << Format("%" wxLongLongFmtSpec "u" , ull);
+ }
+#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
+ // insert a float into string
+ wxString& operator<<(float f)
+ { return (*this) << Format(wxT("%f"), f); }
+ // insert a double into string
+ wxString& operator<<(double d)
+ { return (*this) << Format(wxT("%g"), d); }
+
+ // string comparison
+ // case-sensitive comparison (returns a value < 0, = 0 or > 0)
+ int Cmp(const char *psz) const
+ { return compare(psz); }
+ int Cmp(const wchar_t *pwz) const
+ { return compare(pwz); }
+ int Cmp(const wxString& s) const
+ { return compare(s); }
+ int Cmp(const wxCStrData& s) const
+ { return compare(s); }
+ int Cmp(const wxScopedCharBuffer& s) const
+ { return compare(s); }
+ int Cmp(const wxScopedWCharBuffer& s) const
+ { return compare(s); }
+ // same as Cmp() but not case-sensitive
+ int CmpNoCase(const wxString& s) const;
+
+ // test for the string equality, either considering case or not
+ // (if compareWithCase then the case matters)
+ bool IsSameAs(const wxString& str, bool compareWithCase = true) const
+ {
+#if !wxUSE_UNICODE_UTF8
+ // in UTF-8 build, length() is O(n) and doing this would be _slower_
+ if ( length() != str.length() )
+ return false;
+#endif
+ return (compareWithCase ? Cmp(str) : CmpNoCase(str)) == 0;
+ }
+ bool IsSameAs(const char *str, bool compareWithCase = true) const
+ { return (compareWithCase ? Cmp(str) : CmpNoCase(str)) == 0; }
+ bool IsSameAs(const wchar_t *str, bool compareWithCase = true) const
+ { return (compareWithCase ? Cmp(str) : CmpNoCase(str)) == 0; }
+
+ bool IsSameAs(const wxCStrData& str, bool compareWithCase = true) const
+ { return IsSameAs(str.AsString(), compareWithCase); }
+ bool IsSameAs(const wxScopedCharBuffer& str, bool compareWithCase = true) const
+ { return IsSameAs(str.data(), compareWithCase); }
+ bool IsSameAs(const wxScopedWCharBuffer& str, bool compareWithCase = true) const
+ { return IsSameAs(str.data(), compareWithCase); }
+ // comparison with a single character: returns true if equal
+ bool IsSameAs(wxUniChar c, bool compareWithCase = true) const;
+ // FIXME-UTF8: remove these overloads
+ bool IsSameAs(wxUniCharRef c, bool compareWithCase = true) const
+ { return IsSameAs(wxUniChar(c), compareWithCase); }
+ bool IsSameAs(char c, bool compareWithCase = true) const
+ { return IsSameAs(wxUniChar(c), compareWithCase); }
+ bool IsSameAs(unsigned char c, bool compareWithCase = true) const
+ { return IsSameAs(wxUniChar(c), compareWithCase); }
+ bool IsSameAs(wchar_t c, bool compareWithCase = true) const
+ { return IsSameAs(wxUniChar(c), compareWithCase); }
+ bool IsSameAs(int c, bool compareWithCase = true) const
+ { return IsSameAs(wxUniChar(c), compareWithCase); }
+
+ // simple sub-string extraction
+ // return substring starting at nFirst of length nCount (or till the end
+ // if nCount = default value)
+ wxString Mid(size_t nFirst, size_t nCount = npos) const;
+
+ // operator version of Mid()
+ wxString operator()(size_t start, size_t len) const
+ { return Mid(start, len); }
+
+ // check if the string starts with the given prefix and return the rest
+ // of the string in the provided pointer if it is not NULL; otherwise
+ // return false
+ bool StartsWith(const wxString& prefix, wxString *rest = NULL) const;
+ // check if the string ends with the given suffix and return the
+ // beginning of the string before the suffix in the provided pointer if
+ // it is not NULL; otherwise return false
+ bool EndsWith(const wxString& suffix, wxString *rest = NULL) const;
+
+ // get first nCount characters
+ wxString Left(size_t nCount) const;
+ // get last nCount characters
+ wxString Right(size_t nCount) const;
+ // get all characters before the first occurrence of ch
+ // (returns the whole string if ch not found) and also put everything
+ // following the first occurrence of ch into rest if it's non-NULL
+ wxString BeforeFirst(wxUniChar ch, wxString *rest = NULL) const;
+ // get all characters before the last occurrence of ch
+ // (returns empty string if ch not found) and also put everything
+ // following the last occurrence of ch into rest if it's non-NULL
+ wxString BeforeLast(wxUniChar ch, wxString *rest = NULL) const;
+ // get all characters after the first occurrence of ch
+ // (returns empty string if ch not found)
+ wxString AfterFirst(wxUniChar ch) const;
+ // get all characters after the last occurrence of ch
+ // (returns the whole string if ch not found)
+ wxString AfterLast(wxUniChar ch) const;
+
+ // for compatibility only, use more explicitly named functions above
+ wxString Before(wxUniChar ch) const { return BeforeLast(ch); }
+ wxString After(wxUniChar ch) const { return AfterFirst(ch); }
+
+ // case conversion
+ // convert to upper case in place, return the string itself
+ wxString& MakeUpper();
+ // convert to upper case, return the copy of the string
+ wxString Upper() const { return wxString(*this).MakeUpper(); }
+ // convert to lower case in place, return the string itself
+ wxString& MakeLower();
+ // convert to lower case, return the copy of the string
+ wxString Lower() const { return wxString(*this).MakeLower(); }
+ // convert the first character to the upper case and the rest to the
+ // lower one, return the modified string itself
+ wxString& MakeCapitalized();
+ // convert the first character to the upper case and the rest to the
+ // lower one, return the copy of the string
+ wxString Capitalize() const { return wxString(*this).MakeCapitalized(); }
+
+ // trimming/padding whitespace (either side) and truncating
+ // remove spaces from left or from right (default) side
+ wxString& Trim(bool bFromRight = true);
+ // add nCount copies chPad in the beginning or at the end (default)
+ wxString& Pad(size_t nCount, wxUniChar chPad = wxT(' '), bool bFromRight = true);
+
+ // searching and replacing
+ // searching (return starting index, or -1 if not found)
+ int Find(wxUniChar ch, bool bFromEnd = false) const; // like strchr/strrchr
+ int Find(wxUniCharRef ch, bool bFromEnd = false) const
+ { return Find(wxUniChar(ch), bFromEnd); }
+ int Find(char ch, bool bFromEnd = false) const
+ { return Find(wxUniChar(ch), bFromEnd); }
+ int Find(unsigned char ch, bool bFromEnd = false) const
+ { return Find(wxUniChar(ch), bFromEnd); }
+ int Find(wchar_t ch, bool bFromEnd = false) const
+ { return Find(wxUniChar(ch), bFromEnd); }
+ // searching (return starting index, or -1 if not found)
+ int Find(const wxString& sub) const // like strstr
+ {
+ size_type idx = find(sub);
+ return (idx == npos) ? wxNOT_FOUND : (int)idx;
+ }
+ int Find(const char *sub) const // like strstr
+ {
+ size_type idx = find(sub);
+ return (idx == npos) ? wxNOT_FOUND : (int)idx;
+ }
+ int Find(const wchar_t *sub) const // like strstr
+ {
+ size_type idx = find(sub);
+ return (idx == npos) ? wxNOT_FOUND : (int)idx;
+ }
+
+ int Find(const wxCStrData& sub) const
+ { return Find(sub.AsString()); }
+ int Find(const wxScopedCharBuffer& sub) const
+ { return Find(sub.data()); }
+ int Find(const wxScopedWCharBuffer& sub) const
+ { return Find(sub.data()); }
+
+ // replace first (or all of bReplaceAll) occurrences of substring with
+ // another string, returns the number of replacements made
+ size_t Replace(const wxString& strOld,
+ const wxString& strNew,
+ bool bReplaceAll = true);
+
+ // check if the string contents matches a mask containing '*' and '?'
+ bool Matches(const wxString& mask) const;
+
+ // conversion to numbers: all functions return true only if the whole
+ // string is a number and put the value of this number into the pointer
+ // provided, the base is the numeric base in which the conversion should be
+ // done and must be comprised between 2 and 36 or be 0 in which case the
+ // standard C rules apply (leading '0' => octal, "0x" => hex)
+ // convert to a signed integer
+ bool ToLong(long *val, int base = 10) const;
+ // convert to an unsigned integer
+ bool ToULong(unsigned long *val, int base = 10) const;
+ // convert to wxLongLong
+#if defined(wxLongLong_t)
+ bool ToLongLong(wxLongLong_t *val, int base = 10) const;
+ // convert to wxULongLong
+ bool ToULongLong(wxULongLong_t *val, int base = 10) const;
+#endif // wxLongLong_t
+ // convert to a double
+ bool ToDouble(double *val) const;
+
+ // conversions to numbers using C locale
+ // convert to a signed integer
+ bool ToCLong(long *val, int base = 10) const;
+ // convert to an unsigned integer
+ bool ToCULong(unsigned long *val, int base = 10) const;
+ // convert to a double
+ bool ToCDouble(double *val) const;
+
+ // create a string representing the given floating point number with the
+ // default (like %g) or fixed (if precision >=0) precision
+ // in the current locale
+ static wxString FromDouble(double val, int precision = -1);
+ // in C locale
+ static wxString FromCDouble(double val, int precision = -1);
+
+#ifndef wxNEEDS_WXSTRING_PRINTF_MIXIN
+ // formatted input/output
+ // as sprintf(), returns the number of characters written or < 0 on error
+ // (take 'this' into account in attribute parameter count)
+ // int Printf(const wxString& format, ...);
+ WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxFormatString&),
+ DoPrintfWchar, DoPrintfUtf8)
+#ifdef __WATCOMC__
+ // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
+ WX_VARARG_WATCOM_WORKAROUND(int, Printf, 1, (const wxString&),
+ (wxFormatString(f1)));
+ WX_VARARG_WATCOM_WORKAROUND(int, Printf, 1, (const wxCStrData&),
+ (wxFormatString(f1)));
+ WX_VARARG_WATCOM_WORKAROUND(int, Printf, 1, (const char*),
+ (wxFormatString(f1)));
+ WX_VARARG_WATCOM_WORKAROUND(int, Printf, 1, (const wchar_t*),
+ (wxFormatString(f1)));
+#endif
+#endif // !wxNEEDS_WXSTRING_PRINTF_MIXIN
+ // as vprintf(), returns the number of characters written or < 0 on error
+ int PrintfV(const wxString& format, va_list argptr);
+
+#ifndef wxNEEDS_WXSTRING_PRINTF_MIXIN
+ // returns the string containing the result of Printf() to it
+ // static wxString Format(const wxString& format, ...) WX_ATTRIBUTE_PRINTF_1;
+ WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const wxFormatString&),
+ DoFormatWchar, DoFormatUtf8)
+#ifdef __WATCOMC__
+ // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
+ WX_VARARG_WATCOM_WORKAROUND(static wxString, Format, 1, (const wxString&),
+ (wxFormatString(f1)));
+ WX_VARARG_WATCOM_WORKAROUND(static wxString, Format, 1, (const wxCStrData&),
+ (wxFormatString(f1)));
+ WX_VARARG_WATCOM_WORKAROUND(static wxString, Format, 1, (const char*),
+ (wxFormatString(f1)));
+ WX_VARARG_WATCOM_WORKAROUND(static wxString, Format, 1, (const wchar_t*),
+ (wxFormatString(f1)));
+#endif
+#endif
+ // the same as above, but takes a va_list
+ static wxString FormatV(const wxString& format, va_list argptr);
+
+ // raw access to string memory
+ // ensure that string has space for at least nLen characters
+ // only works if the data of this string is not shared
+ bool Alloc(size_t nLen) { reserve(nLen); return capacity() >= nLen; }
+ // minimize the string's memory
+ // only works if the data of this string is not shared
+ bool Shrink();
+#if WXWIN_COMPATIBILITY_2_8 && !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8
+ // These are deprecated, use wxStringBuffer or wxStringBufferLength instead
+ //
+ // get writable buffer of at least nLen bytes. Unget() *must* be called
+ // a.s.a.p. to put string back in a reasonable state!
+ wxDEPRECATED( wxStringCharType *GetWriteBuf(size_t nLen) );
+ // call this immediately after GetWriteBuf() has been used
+ wxDEPRECATED( void UngetWriteBuf() );
+ wxDEPRECATED( void UngetWriteBuf(size_t nLen) );
+#endif // WXWIN_COMPATIBILITY_2_8 && !wxUSE_STL_BASED_WXSTRING && wxUSE_UNICODE_UTF8
+
+ // wxWidgets version 1 compatibility functions
+
+ // use Mid()
+ wxString SubString(size_t from, size_t to) const
+ { return Mid(from, (to - from + 1)); }
+ // values for second parameter of CompareTo function
+ enum caseCompare {exact, ignoreCase};
+ // values for first parameter of Strip function
+ enum stripType {leading = 0x1, trailing = 0x2, both = 0x3};
+
+#ifndef wxNEEDS_WXSTRING_PRINTF_MIXIN
+ // use Printf()
+ // (take 'this' into account in attribute parameter count)
+ // int sprintf(const wxString& format, ...) WX_ATTRIBUTE_PRINTF_2;
+ WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wxFormatString&),
+ DoPrintfWchar, DoPrintfUtf8)
+#ifdef __WATCOMC__
+ // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
+ WX_VARARG_WATCOM_WORKAROUND(int, sprintf, 1, (const wxString&),
+ (wxFormatString(f1)));
+ WX_VARARG_WATCOM_WORKAROUND(int, sprintf, 1, (const wxCStrData&),
+ (wxFormatString(f1)));
+ WX_VARARG_WATCOM_WORKAROUND(int, sprintf, 1, (const char*),
+ (wxFormatString(f1)));
+ WX_VARARG_WATCOM_WORKAROUND(int, sprintf, 1, (const wchar_t*),
+ (wxFormatString(f1)));
+#endif
+#endif // wxNEEDS_WXSTRING_PRINTF_MIXIN
+
+ // use Cmp()
+ int CompareTo(const wxChar* psz, caseCompare cmp = exact) const
+ { return cmp == exact ? Cmp(psz) : CmpNoCase(psz); }
+
+ // use length()
+ size_t Length() const { return length(); }
+ // Count the number of characters
+ int Freq(wxUniChar ch) const;
+ // use MakeLower
+ void LowerCase() { MakeLower(); }
+ // use MakeUpper
+ void UpperCase() { MakeUpper(); }
+ // use Trim except that it doesn't change this string
+ wxString Strip(stripType w = trailing) const;
+
+ // use Find (more general variants not yet supported)
+ size_t Index(const wxChar* psz) const { return Find(psz); }
+ size_t Index(wxUniChar ch) const { return Find(ch); }
+ // use Truncate
+ wxString& Remove(size_t pos) { return Truncate(pos); }
+ wxString& RemoveLast(size_t n = 1) { return Truncate(length() - n); }
+
+ wxString& Remove(size_t nStart, size_t nLen)
+ { return (wxString&)erase( nStart, nLen ); }
+
+ // use Find()
+ int First( wxUniChar ch ) const { return Find(ch); }
+ int First( wxUniCharRef ch ) const { return Find(ch); }
+ int First( char ch ) const { return Find(ch); }
+ int First( unsigned char ch ) const { return Find(ch); }
+ int First( wchar_t ch ) const { return Find(ch); }
+ int First( const wxString& str ) const { return Find(str); }
+ int Last( wxUniChar ch ) const { return Find(ch, true); }
+ bool Contains(const wxString& str) const { return Find(str) != wxNOT_FOUND; }
+
+ // use empty()
+ bool IsNull() const { return empty(); }
+
+ // std::string compatibility functions
+
+ // take nLen chars starting at nPos
+ wxString(const wxString& str, size_t nPos, size_t nLen)
+ { assign(str, nPos, nLen); }
+ // take all characters from first to last
+ wxString(const_iterator first, const_iterator last)
+ : m_impl(first.impl(), last.impl()) { }
+#if WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER
+ // the 2 overloads below are for compatibility with the existing code using
+ // pointers instead of iterators
+ wxString(const char *first, const char *last)
+ {
+ SubstrBufFromMB str(ImplStr(first, last - first));
+ m_impl.assign(str.data, str.len);
+ }
+ wxString(const wchar_t *first, const wchar_t *last)
+ {
+ SubstrBufFromWC str(ImplStr(first, last - first));
+ m_impl.assign(str.data, str.len);
+ }
+ // and this one is needed to compile code adding offsets to c_str() result
+ wxString(const wxCStrData& first, const wxCStrData& last)
+ : m_impl(CreateConstIterator(first).impl(),
+ CreateConstIterator(last).impl())
+ {
+ wxASSERT_MSG( first.m_str == last.m_str,
+ wxT("pointers must be into the same string") );
+ }
+#endif // WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER
+
+ // lib.string.modifiers
+ // append elements str[pos], ..., str[pos+n]
+ wxString& append(const wxString& str, size_t pos, size_t n)
+ {
+ wxSTRING_UPDATE_CACHED_LENGTH(n);
+
+ size_t from, len;
+ str.PosLenToImpl(pos, n, &from, &len);
+ m_impl.append(str.m_impl, from, len);
+ return *this;
+ }
+ // append a string
+ wxString& append(const wxString& str)
+ {
+ wxSTRING_UPDATE_CACHED_LENGTH(str.length());
+
+ m_impl.append(str.m_impl);
+ return *this;
+ }
+
+ // append first n (or all if n == npos) characters of sz
+ wxString& append(const char *sz)
+ {
+ wxSTRING_INVALIDATE_CACHED_LENGTH();
+
+ m_impl.append(ImplStr(sz));
+ return *this;
+ }
+
+ wxString& append(const wchar_t *sz)
+ {
+ wxSTRING_INVALIDATE_CACHED_LENGTH();
+
+ m_impl.append(ImplStr(sz));
+ return *this;
+ }
+
+ wxString& append(const char *sz, size_t n)
+ {
+ wxSTRING_INVALIDATE_CACHED_LENGTH();
+
+ SubstrBufFromMB str(ImplStr(sz, n));
+ m_impl.append(str.data, str.len);
+ return *this;
+ }
+ wxString& append(const wchar_t *sz, size_t n)
+ {
+ wxSTRING_UPDATE_CACHED_LENGTH(n);
+
+ SubstrBufFromWC str(ImplStr(sz, n));
+ m_impl.append(str.data, str.len);
+ return *this;
+ }
+
+ wxString& append(const wxCStrData& str)
+ { return append(str.AsString()); }
+ wxString& append(const wxScopedCharBuffer& str)
+ { return append(str.data(), str.length()); }
+ wxString& append(const wxScopedWCharBuffer& str)
+ { return append(str.data(), str.length()); }
+ wxString& append(const wxCStrData& str, size_t n)
+ { return append(str.AsString(), 0, n); }
+ wxString& append(const wxScopedCharBuffer& str, size_t n)
+ { return append(str.data(), n); }
+ wxString& append(const wxScopedWCharBuffer& str, size_t n)
+ { return append(str.data(), n); }
+
+ // append n copies of ch
+ wxString& append(size_t n, wxUniChar ch)
+ {
+#if wxUSE_UNICODE_UTF8
+ if ( !ch.IsAscii() )
+ {
+ wxSTRING_INVALIDATE_CACHED_LENGTH();
+
+ m_impl.append(wxStringOperations::EncodeNChars(n, ch));
+ }
+ else // ASCII
+#endif
+ {
+ wxSTRING_UPDATE_CACHED_LENGTH(n);
+
+ m_impl.append(n, (wxStringCharType)ch);
+ }
+
+ return *this;
+ }
+
+ wxString& append(size_t n, wxUniCharRef ch)
+ { return append(n, wxUniChar(ch)); }
+ wxString& append(size_t n, char ch)
+ { return append(n, wxUniChar(ch)); }
+ wxString& append(size_t n, unsigned char ch)
+ { return append(n, wxUniChar(ch)); }
+ wxString& append(size_t n, wchar_t ch)
+ { return append(n, wxUniChar(ch)); }
+
+ // append from first to last
+ wxString& append(const_iterator first, const_iterator last)
+ {
+ wxSTRING_INVALIDATE_CACHED_LENGTH();
+
+ m_impl.append(first.impl(), last.impl());
+ return *this;
+ }
+#if WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER
+ wxString& append(const char *first, const char *last)
+ { return append(first, last - first); }
+ wxString& append(const wchar_t *first, const wchar_t *last)
+ { return append(first, last - first); }
+ wxString& append(const wxCStrData& first, const wxCStrData& last)
+ { return append(CreateConstIterator(first), CreateConstIterator(last)); }
+#endif // WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER
+
+ // same as `this_string = str'
+ wxString& assign(const wxString& str)
+ {
+ wxSTRING_SET_CACHED_LENGTH(str.length());
+
+ m_impl = str.m_impl;
+
+ return *this;
+ }
+
+ // This is a non-standard-compliant overload taking the first "len"
+ // characters of the source string.
+ wxString& assign(const wxString& str, size_t len)
+ {
+#if wxUSE_STRING_POS_CACHE
+ // It is legal to pass len > str.length() to wxStringImpl::assign() but
+ // by restricting it here we save some work for that function so it's not
+ // really less efficient and, at the same time, ensure that we don't
+ // cache invalid length.
+ const size_t lenSrc = str.length();
+ if ( len > lenSrc )
+ len = lenSrc;
+
+ wxSTRING_SET_CACHED_LENGTH(len);
+#endif // wxUSE_STRING_POS_CACHE
+
+ m_impl.assign(str.m_impl, 0, str.LenToImpl(len));
+
+ return *this;
+ }
+
+ // same as ` = str[pos..pos + n]
+ wxString& assign(const wxString& str, size_t pos, size_t n)
+ {
+ size_t from, len;
+ str.PosLenToImpl(pos, n, &from, &len);
+ m_impl.assign(str.m_impl, from, len);
+
+ // it's important to call this after PosLenToImpl() above in case str is
+ // the same string as this one
+ wxSTRING_SET_CACHED_LENGTH(n);
+
+ return *this;
+ }
+
+ // same as `= first n (or all if n == npos) characters of sz'
+ wxString& assign(const char *sz)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ m_impl.assign(ImplStr(sz));
+
+ return *this;
+ }
+
+ wxString& assign(const wchar_t *sz)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ m_impl.assign(ImplStr(sz));
+
+ return *this;
+ }
+
+ wxString& assign(const char *sz, size_t n)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ SubstrBufFromMB str(ImplStr(sz, n));
+ m_impl.assign(str.data, str.len);
+
+ return *this;
+ }
+
+ wxString& assign(const wchar_t *sz, size_t n)
+ {
+ wxSTRING_SET_CACHED_LENGTH(n);
+
+ SubstrBufFromWC str(ImplStr(sz, n));
+ m_impl.assign(str.data, str.len);
+
+ return *this;
+ }
+
+ wxString& assign(const wxCStrData& str)
+ { return assign(str.AsString()); }
+ wxString& assign(const wxScopedCharBuffer& str)
+ { return assign(str.data(), str.length()); }
+ wxString& assign(const wxScopedWCharBuffer& str)
+ { return assign(str.data(), str.length()); }
+ wxString& assign(const wxCStrData& str, size_t len)
+ { return assign(str.AsString(), len); }
+ wxString& assign(const wxScopedCharBuffer& str, size_t len)
+ { return assign(str.data(), len); }
+ wxString& assign(const wxScopedWCharBuffer& str, size_t len)
+ { return assign(str.data(), len); }
+
+ // same as `= n copies of ch'
+ wxString& assign(size_t n, wxUniChar ch)
+ {
+ wxSTRING_SET_CACHED_LENGTH(n);
+
+#if wxUSE_UNICODE_UTF8
+ if ( !ch.IsAscii() )
+ m_impl.assign(wxStringOperations::EncodeNChars(n, ch));
+ else
+#endif
+ m_impl.assign(n, (wxStringCharType)ch);
+
+ return *this;
+ }
+
+ wxString& assign(size_t n, wxUniCharRef ch)
+ { return assign(n, wxUniChar(ch)); }
+ wxString& assign(size_t n, char ch)
+ { return assign(n, wxUniChar(ch)); }
+ wxString& assign(size_t n, unsigned char ch)
+ { return assign(n, wxUniChar(ch)); }
+ wxString& assign(size_t n, wchar_t ch)
+ { return assign(n, wxUniChar(ch)); }
+
+ // assign from first to last
+ wxString& assign(const_iterator first, const_iterator last)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ m_impl.assign(first.impl(), last.impl());
+
+ return *this;
+ }
+#if WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER
+ wxString& assign(const char *first, const char *last)
+ { return assign(first, last - first); }
+ wxString& assign(const wchar_t *first, const wchar_t *last)
+ { return assign(first, last - first); }
+ wxString& assign(const wxCStrData& first, const wxCStrData& last)
+ { return assign(CreateConstIterator(first), CreateConstIterator(last)); }
+#endif // WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER
+
+ // string comparison
+ int compare(const wxString& str) const;
+ int compare(const char* sz) const;
+ int compare(const wchar_t* sz) const;
+ int compare(const wxCStrData& str) const
+ { return compare(str.AsString()); }
+ int compare(const wxScopedCharBuffer& str) const
+ { return compare(str.data()); }
+ int compare(const wxScopedWCharBuffer& str) const
+ { return compare(str.data()); }
+ // comparison with a substring
+ int compare(size_t nStart, size_t nLen, const wxString& str) const;
+ // comparison of 2 substrings
+ int compare(size_t nStart, size_t nLen,
+ const wxString& str, size_t nStart2, size_t nLen2) const;
+ // substring comparison with first nCount characters of sz
+ int compare(size_t nStart, size_t nLen,
+ const char* sz, size_t nCount = npos) const;
+ int compare(size_t nStart, size_t nLen,
+ const wchar_t* sz, size_t nCount = npos) const;
+
+ // insert another string
+ wxString& insert(size_t nPos, const wxString& str)
+ { insert(GetIterForNthChar(nPos), str.begin(), str.end()); return *this; }
+ // insert n chars of str starting at nStart (in str)
+ wxString& insert(size_t nPos, const wxString& str, size_t nStart, size_t n)
+ {
+ wxSTRING_UPDATE_CACHED_LENGTH(n);
+
+ size_t from, len;
+ str.PosLenToImpl(nStart, n, &from, &len);
+ m_impl.insert(PosToImpl(nPos), str.m_impl, from, len);
+
+ return *this;
+ }
+
+ // insert first n (or all if n == npos) characters of sz
+ wxString& insert(size_t nPos, const char *sz)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ m_impl.insert(PosToImpl(nPos), ImplStr(sz));
+
+ return *this;
+ }
+
+ wxString& insert(size_t nPos, const wchar_t *sz)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ m_impl.insert(PosToImpl(nPos), ImplStr(sz)); return *this;
+ }
+
+ wxString& insert(size_t nPos, const char *sz, size_t n)
+ {
+ wxSTRING_UPDATE_CACHED_LENGTH(n);
+
+ SubstrBufFromMB str(ImplStr(sz, n));
+ m_impl.insert(PosToImpl(nPos), str.data, str.len);
+
+ return *this;
+ }
+
+ wxString& insert(size_t nPos, const wchar_t *sz, size_t n)
+ {
+ wxSTRING_UPDATE_CACHED_LENGTH(n);
+
+ SubstrBufFromWC str(ImplStr(sz, n));
+ m_impl.insert(PosToImpl(nPos), str.data, str.len);
+
+ return *this;
+ }
+
+ // insert n copies of ch
+ wxString& insert(size_t nPos, size_t n, wxUniChar ch)
+ {
+ wxSTRING_UPDATE_CACHED_LENGTH(n);
+
+#if wxUSE_UNICODE_UTF8
+ if ( !ch.IsAscii() )
+ m_impl.insert(PosToImpl(nPos), wxStringOperations::EncodeNChars(n, ch));
+ else
+#endif
+ m_impl.insert(PosToImpl(nPos), n, (wxStringCharType)ch);
+ return *this;
+ }
+
+ iterator insert(iterator it, wxUniChar ch)
+ {
+ wxSTRING_UPDATE_CACHED_LENGTH(1);
+
+#if wxUSE_UNICODE_UTF8
+ if ( !ch.IsAscii() )
+ {
+ size_t pos = IterToImplPos(it);
+ m_impl.insert(pos, wxStringOperations::EncodeChar(ch));
+ return iterator(this, m_impl.begin() + pos);
+ }
+ else
+#endif
+ return iterator(this, m_impl.insert(it.impl(), (wxStringCharType)ch));
+ }
+
+ void insert(iterator it, const_iterator first, const_iterator last)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ m_impl.insert(it.impl(), first.impl(), last.impl());
+ }
+
+#if WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER
+ void insert(iterator it, const char *first, const char *last)
+ { insert(it - begin(), first, last - first); }
+ void insert(iterator it, const wchar_t *first, const wchar_t *last)
+ { insert(it - begin(), first, last - first); }
+ void insert(iterator it, const wxCStrData& first, const wxCStrData& last)
+ { insert(it, CreateConstIterator(first), CreateConstIterator(last)); }
+#endif // WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER
+
+ void insert(iterator it, size_type n, wxUniChar ch)
+ {
+ wxSTRING_UPDATE_CACHED_LENGTH(n);
+
+#if wxUSE_UNICODE_UTF8
+ if ( !ch.IsAscii() )
+ m_impl.insert(IterToImplPos(it), wxStringOperations::EncodeNChars(n, ch));
+ else
+#endif
+ m_impl.insert(it.impl(), n, (wxStringCharType)ch);
+ }
+
+ // delete characters from nStart to nStart + nLen
+ wxString& erase(size_type pos = 0, size_type n = npos)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ size_t from, len;
+ PosLenToImpl(pos, n, &from, &len);
+ m_impl.erase(from, len);
+
+ return *this;
+ }
+
+ // delete characters from first up to last
+ iterator erase(iterator first, iterator last)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ return iterator(this, m_impl.erase(first.impl(), last.impl()));
+ }
+
+ iterator erase(iterator first)
+ {
+ wxSTRING_UPDATE_CACHED_LENGTH(-1);
+
+ return iterator(this, m_impl.erase(first.impl()));
+ }
+
+#ifdef wxSTRING_BASE_HASNT_CLEAR
+ void clear() { erase(); }
+#else
+ void clear()
+ {
+ wxSTRING_SET_CACHED_LENGTH(0);
+
+ m_impl.clear();
+ }
+#endif
+
+ // replaces the substring of length nLen starting at nStart
+ wxString& replace(size_t nStart, size_t nLen, const char* sz)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ size_t from, len;
+ PosLenToImpl(nStart, nLen, &from, &len);
+ m_impl.replace(from, len, ImplStr(sz));
+
+ return *this;
+ }
+
+ wxString& replace(size_t nStart, size_t nLen, const wchar_t* sz)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ size_t from, len;
+ PosLenToImpl(nStart, nLen, &from, &len);
+ m_impl.replace(from, len, ImplStr(sz));
+
+ return *this;
+ }
+
+ // replaces the substring of length nLen starting at nStart
+ wxString& replace(size_t nStart, size_t nLen, const wxString& str)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ size_t from, len;
+ PosLenToImpl(nStart, nLen, &from, &len);
+ m_impl.replace(from, len, str.m_impl);
+
+ return *this;
+ }
+
+ // replaces the substring with nCount copies of ch
+ wxString& replace(size_t nStart, size_t nLen, size_t nCount, wxUniChar ch)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ size_t from, len;
+ PosLenToImpl(nStart, nLen, &from, &len);
+#if wxUSE_UNICODE_UTF8
+ if ( !ch.IsAscii() )
+ m_impl.replace(from, len, wxStringOperations::EncodeNChars(nCount, ch));
+ else
+#endif
+ m_impl.replace(from, len, nCount, (wxStringCharType)ch);
+
+ return *this;
+ }
+
+ // replaces a substring with another substring
+ wxString& replace(size_t nStart, size_t nLen,
+ const wxString& str, size_t nStart2, size_t nLen2)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ size_t from, len;
+ PosLenToImpl(nStart, nLen, &from, &len);
+
+ size_t from2, len2;
+ str.PosLenToImpl(nStart2, nLen2, &from2, &len2);
+
+ m_impl.replace(from, len, str.m_impl, from2, len2);
+
+ return *this;
+ }
+
+ // replaces the substring with first nCount chars of sz
+ wxString& replace(size_t nStart, size_t nLen,
+ const char* sz, size_t nCount)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ size_t from, len;
+ PosLenToImpl(nStart, nLen, &from, &len);
+
+ SubstrBufFromMB str(ImplStr(sz, nCount));
+
+ m_impl.replace(from, len, str.data, str.len);
+
+ return *this;
+ }
+
+ wxString& replace(size_t nStart, size_t nLen,
+ const wchar_t* sz, size_t nCount)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ size_t from, len;
+ PosLenToImpl(nStart, nLen, &from, &len);
+
+ SubstrBufFromWC str(ImplStr(sz, nCount));
+
+ m_impl.replace(from, len, str.data, str.len);
+
+ return *this;
+ }
+
+ wxString& replace(size_t nStart, size_t nLen,
+ const wxString& s, size_t nCount)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ size_t from, len;
+ PosLenToImpl(nStart, nLen, &from, &len);
+ m_impl.replace(from, len, s.m_impl.c_str(), s.LenToImpl(nCount));
+
+ return *this;
+ }
+
+ wxString& replace(iterator first, iterator last, const char* s)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ m_impl.replace(first.impl(), last.impl(), ImplStr(s));
+
+ return *this;
+ }
+
+ wxString& replace(iterator first, iterator last, const wchar_t* s)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ m_impl.replace(first.impl(), last.impl(), ImplStr(s));
+
+ return *this;
+ }
+
+ wxString& replace(iterator first, iterator last, const char* s, size_type n)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ SubstrBufFromMB str(ImplStr(s, n));
+ m_impl.replace(first.impl(), last.impl(), str.data, str.len);
+
+ return *this;
+ }
+
+ wxString& replace(iterator first, iterator last, const wchar_t* s, size_type n)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ SubstrBufFromWC str(ImplStr(s, n));
+ m_impl.replace(first.impl(), last.impl(), str.data, str.len);
+
+ return *this;
+ }
+
+ wxString& replace(iterator first, iterator last, const wxString& s)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ m_impl.replace(first.impl(), last.impl(), s.m_impl);
+
+ return *this;
+ }
+
+ wxString& replace(iterator first, iterator last, size_type n, wxUniChar ch)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+#if wxUSE_UNICODE_UTF8
+ if ( !ch.IsAscii() )
+ m_impl.replace(first.impl(), last.impl(),
+ wxStringOperations::EncodeNChars(n, ch));
+ else
+#endif
+ m_impl.replace(first.impl(), last.impl(), n, (wxStringCharType)ch);
+
+ return *this;
+ }
+
+ wxString& replace(iterator first, iterator last,
+ const_iterator first1, const_iterator last1)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ m_impl.replace(first.impl(), last.impl(), first1.impl(), last1.impl());
+
+ return *this;
+ }
+
+ wxString& replace(iterator first, iterator last,
+ const char *first1, const char *last1)
+ { replace(first, last, first1, last1 - first1); return *this; }
+ wxString& replace(iterator first, iterator last,
+ const wchar_t *first1, const wchar_t *last1)
+ { replace(first, last, first1, last1 - first1); return *this; }
+
+ // swap two strings
+ void swap(wxString& str)
+ {
+#if wxUSE_STRING_POS_CACHE
+ // we modify not only this string but also the other one directly so we
+ // need to invalidate cache for both of them (we could also try to
+ // exchange their cache entries but it seems unlikely to be worth it)
+ InvalidateCache();
+ str.InvalidateCache();
+#endif // wxUSE_STRING_POS_CACHE
+
+ m_impl.swap(str.m_impl);
+ }
+
+ // find a substring
+ size_t find(const wxString& str, size_t nStart = 0) const
+ { return PosFromImpl(m_impl.find(str.m_impl, PosToImpl(nStart))); }
+
+ // find first n characters of sz
+ size_t find(const char* sz, size_t nStart = 0, size_t n = npos) const
+ {
+ SubstrBufFromMB str(ImplStr(sz, n));
+ return PosFromImpl(m_impl.find(str.data, PosToImpl(nStart), str.len));
+ }
+ size_t find(const wchar_t* sz, size_t nStart = 0, size_t n = npos) const
+ {
+ SubstrBufFromWC str(ImplStr(sz, n));
+ return PosFromImpl(m_impl.find(str.data, PosToImpl(nStart), str.len));
+ }
+ size_t find(const wxScopedCharBuffer& s, size_t nStart = 0, size_t n = npos) const
+ { return find(s.data(), nStart, n); }
+ size_t find(const wxScopedWCharBuffer& s, size_t nStart = 0, size_t n = npos) const
+ { return find(s.data(), nStart, n); }
+ size_t find(const wxCStrData& s, size_t nStart = 0, size_t n = npos) const
+ { return find(s.AsWChar(), nStart, n); }
+
+ // find the first occurrence of character ch after nStart
+ size_t find(wxUniChar ch, size_t nStart = 0) const
+ {
+#if wxUSE_UNICODE_UTF8
+ if ( !ch.IsAscii() )
+ return PosFromImpl(m_impl.find(wxStringOperations::EncodeChar(ch),
+ PosToImpl(nStart)));
+ else
+#endif
+ return PosFromImpl(m_impl.find((wxStringCharType)ch,
+ PosToImpl(nStart)));
+
+ }
+ size_t find(wxUniCharRef ch, size_t nStart = 0) const
+ { return find(wxUniChar(ch), nStart); }
+ size_t find(char ch, size_t nStart = 0) const
+ { return find(wxUniChar(ch), nStart); }
+ size_t find(unsigned char ch, size_t nStart = 0) const
+ { return find(wxUniChar(ch), nStart); }
+ size_t find(wchar_t ch, size_t nStart = 0) const
+ { return find(wxUniChar(ch), nStart); }
+
+ // rfind() family is exactly like find() but works right to left
+
+ // as find, but from the end
+ size_t rfind(const wxString& str, size_t nStart = npos) const
+ { return PosFromImpl(m_impl.rfind(str.m_impl, PosToImpl(nStart))); }
+
+ // as find, but from the end
+ size_t rfind(const char* sz, size_t nStart = npos, size_t n = npos) const
+ {
+ SubstrBufFromMB str(ImplStr(sz, n));
+ return PosFromImpl(m_impl.rfind(str.data, PosToImpl(nStart), str.len));
+ }
+ size_t rfind(const wchar_t* sz, size_t nStart = npos, size_t n = npos) const
+ {
+ SubstrBufFromWC str(ImplStr(sz, n));
+ return PosFromImpl(m_impl.rfind(str.data, PosToImpl(nStart), str.len));
+ }
+ size_t rfind(const wxScopedCharBuffer& s, size_t nStart = npos, size_t n = npos) const
+ { return rfind(s.data(), nStart, n); }
+ size_t rfind(const wxScopedWCharBuffer& s, size_t nStart = npos, size_t n = npos) const
+ { return rfind(s.data(), nStart, n); }
+ size_t rfind(const wxCStrData& s, size_t nStart = npos, size_t n = npos) const
+ { return rfind(s.AsWChar(), nStart, n); }
+ // as find, but from the end
+ size_t rfind(wxUniChar ch, size_t nStart = npos) const
+ {
+#if wxUSE_UNICODE_UTF8
+ if ( !ch.IsAscii() )
+ return PosFromImpl(m_impl.rfind(wxStringOperations::EncodeChar(ch),
+ PosToImpl(nStart)));
+ else
+#endif
+ return PosFromImpl(m_impl.rfind((wxStringCharType)ch,
+ PosToImpl(nStart)));
+ }
+ size_t rfind(wxUniCharRef ch, size_t nStart = npos) const
+ { return rfind(wxUniChar(ch), nStart); }
+ size_t rfind(char ch, size_t nStart = npos) const
+ { return rfind(wxUniChar(ch), nStart); }
+ size_t rfind(unsigned char ch, size_t nStart = npos) const
+ { return rfind(wxUniChar(ch), nStart); }
+ size_t rfind(wchar_t ch, size_t nStart = npos) const
+ { return rfind(wxUniChar(ch), nStart); }
+
+ // find first/last occurrence of any character (not) in the set:
+#if wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8
+ // FIXME-UTF8: this is not entirely correct, because it doesn't work if
+ // sizeof(wchar_t)==2 and surrogates are present in the string;
+ // should we care? Probably not.
+ size_t find_first_of(const wxString& str, size_t nStart = 0) const
+ { return m_impl.find_first_of(str.m_impl, nStart); }
+ size_t find_first_of(const char* sz, size_t nStart = 0) const
+ { return m_impl.find_first_of(ImplStr(sz), nStart); }
+ size_t find_first_of(const wchar_t* sz, size_t nStart = 0) const
+ { return m_impl.find_first_of(ImplStr(sz), nStart); }
+ size_t find_first_of(const char* sz, size_t nStart, size_t n) const
+ { return m_impl.find_first_of(ImplStr(sz), nStart, n); }
+ size_t find_first_of(const wchar_t* sz, size_t nStart, size_t n) const
+ { return m_impl.find_first_of(ImplStr(sz), nStart, n); }
+ size_t find_first_of(wxUniChar c, size_t nStart = 0) const
+ { return m_impl.find_first_of((wxChar)c, nStart); }
+
+ size_t find_last_of(const wxString& str, size_t nStart = npos) const
+ { return m_impl.find_last_of(str.m_impl, nStart); }
+ size_t find_last_of(const char* sz, size_t nStart = npos) const
+ { return m_impl.find_last_of(ImplStr(sz), nStart); }
+ size_t find_last_of(const wchar_t* sz, size_t nStart = npos) const
+ { return m_impl.find_last_of(ImplStr(sz), nStart); }
+ size_t find_last_of(const char* sz, size_t nStart, size_t n) const
+ { return m_impl.find_last_of(ImplStr(sz), nStart, n); }
+ size_t find_last_of(const wchar_t* sz, size_t nStart, size_t n) const
+ { return m_impl.find_last_of(ImplStr(sz), nStart, n); }
+ size_t find_last_of(wxUniChar c, size_t nStart = npos) const
+ { return m_impl.find_last_of((wxChar)c, nStart); }
+
+ size_t find_first_not_of(const wxString& str, size_t nStart = 0) const
+ { return m_impl.find_first_not_of(str.m_impl, nStart); }
+ size_t find_first_not_of(const char* sz, size_t nStart = 0) const
+ { return m_impl.find_first_not_of(ImplStr(sz), nStart); }
+ size_t find_first_not_of(const wchar_t* sz, size_t nStart = 0) const
+ { return m_impl.find_first_not_of(ImplStr(sz), nStart); }
+ size_t find_first_not_of(const char* sz, size_t nStart, size_t n) const
+ { return m_impl.find_first_not_of(ImplStr(sz), nStart, n); }
+ size_t find_first_not_of(const wchar_t* sz, size_t nStart, size_t n) const
+ { return m_impl.find_first_not_of(ImplStr(sz), nStart, n); }
+ size_t find_first_not_of(wxUniChar c, size_t nStart = 0) const
+ { return m_impl.find_first_not_of((wxChar)c, nStart); }
+
+ size_t find_last_not_of(const wxString& str, size_t nStart = npos) const
+ { return m_impl.find_last_not_of(str.m_impl, nStart); }
+ size_t find_last_not_of(const char* sz, size_t nStart = npos) const
+ { return m_impl.find_last_not_of(ImplStr(sz), nStart); }
+ size_t find_last_not_of(const wchar_t* sz, size_t nStart = npos) const
+ { return m_impl.find_last_not_of(ImplStr(sz), nStart); }
+ size_t find_last_not_of(const char* sz, size_t nStart, size_t n) const
+ { return m_impl.find_last_not_of(ImplStr(sz), nStart, n); }
+ size_t find_last_not_of(const wchar_t* sz, size_t nStart, size_t n) const
+ { return m_impl.find_last_not_of(ImplStr(sz), nStart, n); }
+ size_t find_last_not_of(wxUniChar c, size_t nStart = npos) const
+ { return m_impl.find_last_not_of((wxChar)c, nStart); }
+#else
+ // we can't use std::string implementation in UTF-8 build, because the
+ // character sets would be interpreted wrongly:
+
+ // as strpbrk() but starts at nStart, returns npos if not found
+ size_t find_first_of(const wxString& str, size_t nStart = 0) const
+#if wxUSE_UNICODE // FIXME-UTF8: temporary
+ { return find_first_of(str.wc_str(), nStart); }
+#else
+ { return find_first_of(str.mb_str(), nStart); }
+#endif
+ // same as above
+ size_t find_first_of(const char* sz, size_t nStart = 0) const;
+ size_t find_first_of(const wchar_t* sz, size_t nStart = 0) const;
+ size_t find_first_of(const char* sz, size_t nStart, size_t n) const;
+ size_t find_first_of(const wchar_t* sz, size_t nStart, size_t n) const;
+ // same as find(char, size_t)
+ size_t find_first_of(wxUniChar c, size_t nStart = 0) const
+ { return find(c, nStart); }
+ // find the last (starting from nStart) char from str in this string
+ size_t find_last_of (const wxString& str, size_t nStart = npos) const
+#if wxUSE_UNICODE // FIXME-UTF8: temporary
+ { return find_last_of(str.wc_str(), nStart); }
+#else
+ { return find_last_of(str.mb_str(), nStart); }
+#endif
+ // same as above
+ size_t find_last_of (const char* sz, size_t nStart = npos) const;
+ size_t find_last_of (const wchar_t* sz, size_t nStart = npos) const;
+ size_t find_last_of(const char* sz, size_t nStart, size_t n) const;
+ size_t find_last_of(const wchar_t* sz, size_t nStart, size_t n) const;
+ // same as above
+ size_t find_last_of(wxUniChar c, size_t nStart = npos) const
+ { return rfind(c, nStart); }
+
+ // find first/last occurrence of any character not in the set
+
+ // as strspn() (starting from nStart), returns npos on failure
+ size_t find_first_not_of(const wxString& str, size_t nStart = 0) const
+#if wxUSE_UNICODE // FIXME-UTF8: temporary
+ { return find_first_not_of(str.wc_str(), nStart); }
+#else
+ { return find_first_not_of(str.mb_str(), nStart); }
+#endif
+ // same as above
+ size_t find_first_not_of(const char* sz, size_t nStart = 0) const;
+ size_t find_first_not_of(const wchar_t* sz, size_t nStart = 0) const;
+ size_t find_first_not_of(const char* sz, size_t nStart, size_t n) const;
+ size_t find_first_not_of(const wchar_t* sz, size_t nStart, size_t n) const;
+ // same as above
+ size_t find_first_not_of(wxUniChar ch, size_t nStart = 0) const;
+ // as strcspn()
+ size_t find_last_not_of(const wxString& str, size_t nStart = npos) const
+#if wxUSE_UNICODE // FIXME-UTF8: temporary
+ { return find_last_not_of(str.wc_str(), nStart); }
+#else
+ { return find_last_not_of(str.mb_str(), nStart); }
+#endif
+ // same as above
+ size_t find_last_not_of(const char* sz, size_t nStart = npos) const;
+ size_t find_last_not_of(const wchar_t* sz, size_t nStart = npos) const;
+ size_t find_last_not_of(const char* sz, size_t nStart, size_t n) const;
+ size_t find_last_not_of(const wchar_t* sz, size_t nStart, size_t n) const;
+ // same as above
+ size_t find_last_not_of(wxUniChar ch, size_t nStart = npos) const;
+#endif // wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8 or not
+
+ // provide char/wchar_t/wxUniCharRef overloads for char-finding functions
+ // above to resolve ambiguities:
+ size_t find_first_of(wxUniCharRef ch, size_t nStart = 0) const
+ { return find_first_of(wxUniChar(ch), nStart); }
+ size_t find_first_of(char ch, size_t nStart = 0) const
+ { return find_first_of(wxUniChar(ch), nStart); }
+ size_t find_first_of(unsigned char ch, size_t nStart = 0) const
+ { return find_first_of(wxUniChar(ch), nStart); }
+ size_t find_first_of(wchar_t ch, size_t nStart = 0) const
+ { return find_first_of(wxUniChar(ch), nStart); }
+ size_t find_last_of(wxUniCharRef ch, size_t nStart = npos) const
+ { return find_last_of(wxUniChar(ch), nStart); }
+ size_t find_last_of(char ch, size_t nStart = npos) const
+ { return find_last_of(wxUniChar(ch), nStart); }
+ size_t find_last_of(unsigned char ch, size_t nStart = npos) const
+ { return find_last_of(wxUniChar(ch), nStart); }
+ size_t find_last_of(wchar_t ch, size_t nStart = npos) const
+ { return find_last_of(wxUniChar(ch), nStart); }
+ size_t find_first_not_of(wxUniCharRef ch, size_t nStart = 0) const
+ { return find_first_not_of(wxUniChar(ch), nStart); }
+ size_t find_first_not_of(char ch, size_t nStart = 0) const
+ { return find_first_not_of(wxUniChar(ch), nStart); }
+ size_t find_first_not_of(unsigned char ch, size_t nStart = 0) const
+ { return find_first_not_of(wxUniChar(ch), nStart); }
+ size_t find_first_not_of(wchar_t ch, size_t nStart = 0) const
+ { return find_first_not_of(wxUniChar(ch), nStart); }
+ size_t find_last_not_of(wxUniCharRef ch, size_t nStart = npos) const
+ { return find_last_not_of(wxUniChar(ch), nStart); }
+ size_t find_last_not_of(char ch, size_t nStart = npos) const
+ { return find_last_not_of(wxUniChar(ch), nStart); }
+ size_t find_last_not_of(unsigned char ch, size_t nStart = npos) const
+ { return find_last_not_of(wxUniChar(ch), nStart); }
+ size_t find_last_not_of(wchar_t ch, size_t nStart = npos) const
+ { return find_last_not_of(wxUniChar(ch), nStart); }
+
+ // and additional overloads for the versions taking strings:
+ size_t find_first_of(const wxCStrData& sz, size_t nStart = 0) const
+ { return find_first_of(sz.AsString(), nStart); }
+ size_t find_first_of(const wxScopedCharBuffer& sz, size_t nStart = 0) const
+ { return find_first_of(sz.data(), nStart); }
+ size_t find_first_of(const wxScopedWCharBuffer& sz, size_t nStart = 0) const
+ { return find_first_of(sz.data(), nStart); }
+ size_t find_first_of(const wxCStrData& sz, size_t nStart, size_t n) const
+ { return find_first_of(sz.AsWChar(), nStart, n); }
+ size_t find_first_of(const wxScopedCharBuffer& sz, size_t nStart, size_t n) const
+ { return find_first_of(sz.data(), nStart, n); }
+ size_t find_first_of(const wxScopedWCharBuffer& sz, size_t nStart, size_t n) const
+ { return find_first_of(sz.data(), nStart, n); }
+
+ size_t find_last_of(const wxCStrData& sz, size_t nStart = 0) const
+ { return find_last_of(sz.AsString(), nStart); }
+ size_t find_last_of(const wxScopedCharBuffer& sz, size_t nStart = 0) const
+ { return find_last_of(sz.data(), nStart); }
+ size_t find_last_of(const wxScopedWCharBuffer& sz, size_t nStart = 0) const
+ { return find_last_of(sz.data(), nStart); }
+ size_t find_last_of(const wxCStrData& sz, size_t nStart, size_t n) const
+ { return find_last_of(sz.AsWChar(), nStart, n); }
+ size_t find_last_of(const wxScopedCharBuffer& sz, size_t nStart, size_t n) const
+ { return find_last_of(sz.data(), nStart, n); }
+ size_t find_last_of(const wxScopedWCharBuffer& sz, size_t nStart, size_t n) const
+ { return find_last_of(sz.data(), nStart, n); }
+
+ size_t find_first_not_of(const wxCStrData& sz, size_t nStart = 0) const
+ { return find_first_not_of(sz.AsString(), nStart); }
+ size_t find_first_not_of(const wxScopedCharBuffer& sz, size_t nStart = 0) const
+ { return find_first_not_of(sz.data(), nStart); }
+ size_t find_first_not_of(const wxScopedWCharBuffer& sz, size_t nStart = 0) const
+ { return find_first_not_of(sz.data(), nStart); }
+ size_t find_first_not_of(const wxCStrData& sz, size_t nStart, size_t n) const
+ { return find_first_not_of(sz.AsWChar(), nStart, n); }
+ size_t find_first_not_of(const wxScopedCharBuffer& sz, size_t nStart, size_t n) const
+ { return find_first_not_of(sz.data(), nStart, n); }
+ size_t find_first_not_of(const wxScopedWCharBuffer& sz, size_t nStart, size_t n) const
+ { return find_first_not_of(sz.data(), nStart, n); }
+
+ size_t find_last_not_of(const wxCStrData& sz, size_t nStart = 0) const
+ { return find_last_not_of(sz.AsString(), nStart); }
+ size_t find_last_not_of(const wxScopedCharBuffer& sz, size_t nStart = 0) const
+ { return find_last_not_of(sz.data(), nStart); }
+ size_t find_last_not_of(const wxScopedWCharBuffer& sz, size_t nStart = 0) const
+ { return find_last_not_of(sz.data(), nStart); }
+ size_t find_last_not_of(const wxCStrData& sz, size_t nStart, size_t n) const
+ { return find_last_not_of(sz.AsWChar(), nStart, n); }
+ size_t find_last_not_of(const wxScopedCharBuffer& sz, size_t nStart, size_t n) const
+ { return find_last_not_of(sz.data(), nStart, n); }
+ size_t find_last_not_of(const wxScopedWCharBuffer& sz, size_t nStart, size_t n) const
+ { return find_last_not_of(sz.data(), nStart, n); }
+
+ // string += string
+ wxString& operator+=(const wxString& s)
+ {
+ wxSTRING_INVALIDATE_CACHED_LENGTH();
+
+ m_impl += s.m_impl;
+ return *this;
+ }
+ // string += C string
+ wxString& operator+=(const char *psz)
+ {
+ wxSTRING_INVALIDATE_CACHED_LENGTH();
+
+ m_impl += ImplStr(psz);
+ return *this;
+ }
+ wxString& operator+=(const wchar_t *pwz)
+ {
+ wxSTRING_INVALIDATE_CACHED_LENGTH();
+
+ m_impl += ImplStr(pwz);
+ return *this;
+ }
+ wxString& operator+=(const wxCStrData& s)
+ {
+ wxSTRING_INVALIDATE_CACHED_LENGTH();
+
+ m_impl += s.AsString().m_impl;
+ return *this;
+ }
+ wxString& operator+=(const wxScopedCharBuffer& s)
+ { return append(s); }
+ wxString& operator+=(const wxScopedWCharBuffer& s)
+ { return append(s); }
+ // string += char
+ wxString& operator+=(wxUniChar ch)
+ {
+ wxSTRING_UPDATE_CACHED_LENGTH(1);
+
+#if wxUSE_UNICODE_UTF8
+ if ( !ch.IsAscii() )
+ m_impl += wxStringOperations::EncodeChar(ch);
+ else
+#endif
+ m_impl += (wxStringCharType)ch;
+ return *this;
+ }
+ wxString& operator+=(wxUniCharRef ch) { return *this += wxUniChar(ch); }
+ wxString& operator+=(int ch) { return *this += wxUniChar(ch); }
+ wxString& operator+=(char ch) { return *this += wxUniChar(ch); }
+ wxString& operator+=(unsigned char ch) { return *this += wxUniChar(ch); }
+ wxString& operator+=(wchar_t ch) { return *this += wxUniChar(ch); }
+
+private:
+#if !wxUSE_STL_BASED_WXSTRING
+ // helpers for wxStringBuffer and wxStringBufferLength
+ wxStringCharType *DoGetWriteBuf(size_t nLen)
+ {
+ return m_impl.DoGetWriteBuf(nLen);
+ }
+
+ void DoUngetWriteBuf()
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ m_impl.DoUngetWriteBuf();
+ }
+
+ void DoUngetWriteBuf(size_t nLen)
+ {
+ wxSTRING_INVALIDATE_CACHE();
+
+ m_impl.DoUngetWriteBuf(nLen);
+ }
+#endif // !wxUSE_STL_BASED_WXSTRING
+
+#ifndef wxNEEDS_WXSTRING_PRINTF_MIXIN
+ #if !wxUSE_UTF8_LOCALE_ONLY
+ int DoPrintfWchar(const wxChar *format, ...);
+ static wxString DoFormatWchar(const wxChar *format, ...);
+ #endif
+ #if wxUSE_UNICODE_UTF8
+ int DoPrintfUtf8(const char *format, ...);
+ static wxString DoFormatUtf8(const char *format, ...);
+ #endif
+#endif
+
+#if !wxUSE_STL_BASED_WXSTRING
+ // check string's data validity
+ bool IsValid() const { return m_impl.GetStringData()->IsValid(); }
+#endif
+
+private:
+ wxStringImpl m_impl;
+
+ // buffers for compatibility conversion from (char*)c_str() and
+ // (wchar_t*)c_str(): the pointers returned by these functions should remain
+ // valid until the string itself is modified for compatibility with the
+ // existing code and consistency with std::string::c_str() so returning a
+ // temporary buffer won't do and we need to cache the conversion results
+
+ // TODO-UTF8: benchmark various approaches to keeping compatibility buffers
+ template<typename T>
+ struct ConvertedBuffer
+ {
+ // notice that there is no need to initialize m_len here as it's unused
+ // as long as m_str is NULL
+ ConvertedBuffer() : m_str(NULL) {}
+ ~ConvertedBuffer()
+ { free(m_str); }
+
+ bool Extend(size_t len)
+ {
+ // add extra 1 for the trailing NUL
+ void * const str = realloc(m_str, sizeof(T)*(len + 1));
+ if ( !str )
+ return false;
+
+ m_str = static_cast<T *>(str);
+ m_len = len;
+
+ return true;
+ }
+
+ const wxScopedCharTypeBuffer<T> AsScopedBuffer() const
+ {
+ return wxScopedCharTypeBuffer<T>::CreateNonOwned(m_str, m_len);
+ }
+
+ T *m_str; // pointer to the string data
+ size_t m_len; // length, not size, i.e. in chars and without last NUL
+ };
+
+
+#if wxUSE_UNICODE
+ // common mb_str() and wxCStrData::AsChar() helper: performs the conversion
+ // and returns either m_convertedToChar.m_str (in which case its m_len is
+ // also updated) or NULL if it failed
+ //
+ // there is an important exception: in wxUSE_UNICODE_UTF8 build if conv is a
+ // UTF-8 one, we return m_impl.c_str() directly, without doing any conversion
+ // as optimization and so the caller needs to check for this before using
+ // m_convertedToChar
+ //
+ // NB: AsChar() returns char* in any build, unlike mb_str()
+ const char *AsChar(const wxMBConv& conv) const;
+
+ // mb_str() implementation helper
+ wxScopedCharBuffer AsCharBuf(const wxMBConv& conv) const
+ {
+#if wxUSE_UNICODE_UTF8
+ // avoid conversion if we can
+ if ( conv.IsUTF8() )
+ {
+ return wxScopedCharBuffer::CreateNonOwned(m_impl.c_str(),
+ m_impl.length());
+ }
+#endif // wxUSE_UNICODE_UTF8
+
+ // call this solely in order to fill in m_convertedToChar as AsChar()
+ // updates it as a side effect: this is a bit ugly but it's a completely
+ // internal function so the users of this class shouldn't care or know
+ // about it and doing it like this, i.e. having a separate AsChar(),
+ // allows us to avoid the creation and destruction of a temporary buffer
+ // when using wxCStrData without duplicating any code
+ if ( !AsChar(conv) )
+ {
+ // although it would be probably more correct to return NULL buffer
+ // from here if the conversion fails, a lot of existing code doesn't
+ // expect mb_str() (or wc_str()) to ever return NULL so return an
+ // empty string otherwise to avoid crashes in it
+ //
+ // also, some existing code does check for the conversion success and
+ // so asserting here would be bad too -- even if it does mean that
+ // silently losing data is possible for badly written code
+ return wxScopedCharBuffer::CreateNonOwned("", 0);
+ }
+
+ return m_convertedToChar.AsScopedBuffer();
+ }
+
+ ConvertedBuffer<char> m_convertedToChar;
+#endif // !wxUSE_UNICODE
+
+#if !wxUSE_UNICODE_WCHAR
+ // common wc_str() and wxCStrData::AsWChar() helper for both UTF-8 and ANSI
+ // builds: converts the string contents into m_convertedToWChar and returns
+ // NULL if the conversion failed (this can only happen in ANSI build)
+ //
+ // NB: AsWChar() returns wchar_t* in any build, unlike wc_str()
+ const wchar_t *AsWChar(const wxMBConv& conv) const;
+
+ // wc_str() implementation helper
+ wxScopedWCharBuffer AsWCharBuf(const wxMBConv& conv) const
+ {
+ if ( !AsWChar(conv) )
+ return wxScopedWCharBuffer::CreateNonOwned(L"", 0);
+
+ return m_convertedToWChar.AsScopedBuffer();
+ }
+
+ ConvertedBuffer<wchar_t> m_convertedToWChar;
+#endif // !wxUSE_UNICODE_WCHAR
+
+#if wxUSE_UNICODE_UTF8
+ // FIXME-UTF8: (try to) move this elsewhere (TLS) or solve differently
+ // assigning to character pointer to by wxString::iterator may
+ // change the underlying wxStringImpl iterator, so we have to
+ // keep track of all iterators and update them as necessary:
+ struct wxStringIteratorNodeHead
+ {
+ wxStringIteratorNodeHead() : ptr(NULL) {}
+ wxStringIteratorNode *ptr;
+
+ // copying is disallowed as it would result in more than one pointer into
+ // the same linked list
+ wxDECLARE_NO_COPY_CLASS(wxStringIteratorNodeHead);
+ };
+
+ wxStringIteratorNodeHead m_iterators;
+
+ friend class WXDLLIMPEXP_FWD_BASE wxStringIteratorNode;
+ friend class WXDLLIMPEXP_FWD_BASE wxUniCharRef;
+#endif // wxUSE_UNICODE_UTF8
+
+ friend class WXDLLIMPEXP_FWD_BASE wxCStrData;
+ friend class wxStringInternalBuffer;
+ friend class wxStringInternalBufferLength;
+};
+
+#ifdef wxNEEDS_WXSTRING_PRINTF_MIXIN
+ #pragma warning (pop)
+#endif
+
+// string iterator operators that satisfy STL Random Access Iterator
+// requirements:
+inline wxString::iterator operator+(ptrdiff_t n, wxString::iterator i)
+ { return i + n; }
+inline wxString::const_iterator operator+(ptrdiff_t n, wxString::const_iterator i)
+ { return i + n; }
+inline wxString::reverse_iterator operator+(ptrdiff_t n, wxString::reverse_iterator i)
+ { return i + n; }
+inline wxString::const_reverse_iterator operator+(ptrdiff_t n, wxString::const_reverse_iterator i)
+ { return i + n; }
+
+// notice that even though for many compilers the friend declarations above are
+// enough, from the point of view of C++ standard we must have the declarations
+// here as friend ones are not injected in the enclosing namespace and without
+// them the code fails to compile with conforming compilers such as xlC or g++4
+wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, const wxString& string2);
+wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const char *psz);
+wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const wchar_t *pwz);
+wxString WXDLLIMPEXP_BASE operator+(const char *psz, const wxString& string);
+wxString WXDLLIMPEXP_BASE operator+(const wchar_t *pwz, const wxString& string);
+
+wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxUniChar ch);
+wxString WXDLLIMPEXP_BASE operator+(wxUniChar ch, const wxString& string);
+
+inline wxString operator+(const wxString& string, wxUniCharRef ch)
+ { return string + (wxUniChar)ch; }
+inline wxString operator+(const wxString& string, char ch)
+ { return string + wxUniChar(ch); }
+inline wxString operator+(const wxString& string, wchar_t ch)
+ { return string + wxUniChar(ch); }
+inline wxString operator+(wxUniCharRef ch, const wxString& string)
+ { return (wxUniChar)ch + string; }
+inline wxString operator+(char ch, const wxString& string)
+ { return wxUniChar(ch) + string; }
+inline wxString operator+(wchar_t ch, const wxString& string)
+ { return wxUniChar(ch) + string; }
+
+
+#define wxGetEmptyString() wxString()
+
+// ----------------------------------------------------------------------------
+// helper functions which couldn't be defined inline
+// ----------------------------------------------------------------------------
+
+namespace wxPrivate
+{
+
+#if wxUSE_UNICODE_WCHAR
+
+template <>
+struct wxStringAsBufHelper<char>
+{
+ static wxScopedCharBuffer Get(const wxString& s, size_t *len)
+ {
+ wxScopedCharBuffer buf(s.mb_str());
+ if ( len )
+ *len = buf ? strlen(buf) : 0;
+ return buf;
+ }
+};
+
+template <>
+struct wxStringAsBufHelper<wchar_t>
+{
+ static wxScopedWCharBuffer Get(const wxString& s, size_t *len)
+ {
+ const size_t length = s.length();
+ if ( len )
+ *len = length;
+ return wxScopedWCharBuffer::CreateNonOwned(s.wx_str(), length);
+ }
+};
+
+#elif wxUSE_UNICODE_UTF8
+
+template <>
+struct wxStringAsBufHelper<char>
+{
+ static wxScopedCharBuffer Get(const wxString& s, size_t *len)
+ {
+ const size_t length = s.utf8_length();
+ if ( len )
+ *len = length;
+ return wxScopedCharBuffer::CreateNonOwned(s.wx_str(), length);
+ }
+};
+
+template <>
+struct wxStringAsBufHelper<wchar_t>
+{
+ static wxScopedWCharBuffer Get(const wxString& s, size_t *len)
+ {
+ wxScopedWCharBuffer wbuf(s.wc_str());
+ if ( len )
+ *len = wxWcslen(wbuf);
+ return wbuf;
+ }
+};
+
+#endif // Unicode build kind
+
+} // namespace wxPrivate
+
+// ----------------------------------------------------------------------------
+// wxStringBuffer: a tiny class allowing to get a writable pointer into string
+// ----------------------------------------------------------------------------
+
+#if !wxUSE_STL_BASED_WXSTRING
+// string buffer for direct access to string data in their native
+// representation:
+class wxStringInternalBuffer
+{
+public:
+ typedef wxStringCharType CharType;
+
+ wxStringInternalBuffer(wxString& str, size_t lenWanted = 1024)
+ : m_str(str), m_buf(NULL)
+ { m_buf = m_str.DoGetWriteBuf(lenWanted); }
+
+ ~wxStringInternalBuffer() { m_str.DoUngetWriteBuf(); }
+
+ operator wxStringCharType*() const { return m_buf; }
+
+private:
+ wxString& m_str;
+ wxStringCharType *m_buf;
+
+ wxDECLARE_NO_COPY_CLASS(wxStringInternalBuffer);
+};
+
+class wxStringInternalBufferLength
+{
+public:
+ typedef wxStringCharType CharType;
+
+ wxStringInternalBufferLength(wxString& str, size_t lenWanted = 1024)
+ : m_str(str), m_buf(NULL), m_len(0), m_lenSet(false)
+ {
+ m_buf = m_str.DoGetWriteBuf(lenWanted);
+ wxASSERT(m_buf != NULL);
+ }
+
+ ~wxStringInternalBufferLength()
+ {
+ wxASSERT(m_lenSet);
+ m_str.DoUngetWriteBuf(m_len);
+ }
+
+ operator wxStringCharType*() const { return m_buf; }
+ void SetLength(size_t length) { m_len = length; m_lenSet = true; }
+
+private:
+ wxString& m_str;
+ wxStringCharType *m_buf;
+ size_t m_len;
+ bool m_lenSet;
+
+ wxDECLARE_NO_COPY_CLASS(wxStringInternalBufferLength);
+};
+
+#endif // !wxUSE_STL_BASED_WXSTRING
+
+template<typename T>
+class wxStringTypeBufferBase
+{
+public:
+ typedef T CharType;
+
+ wxStringTypeBufferBase(wxString& str, size_t lenWanted = 1024)
+ : m_str(str), m_buf(lenWanted)
+ {
+ // for compatibility with old wxStringBuffer which provided direct
+ // access to wxString internal buffer, initialize ourselves with the
+ // string initial contents
+
+ // FIXME-VC6: remove the ugly (CharType *)NULL and use normal
+ // tchar_str<CharType>
+ size_t len;
+ const wxCharTypeBuffer<CharType> buf(str.tchar_str(&len, (CharType *)NULL));
+ if ( buf )
+ {
+ if ( len > lenWanted )
+ {
+ // in this case there is not enough space for terminating NUL,
+ // ensure that we still put it there
+ m_buf.data()[lenWanted] = 0;
+ len = lenWanted - 1;
+ }
+
+ memcpy(m_buf.data(), buf, (len + 1)*sizeof(CharType));
+ }
+ //else: conversion failed, this can happen when trying to get Unicode
+ // string contents into a char string
+ }
+
+ operator CharType*() { return m_buf.data(); }
+
+protected:
+ wxString& m_str;
+ wxCharTypeBuffer<CharType> m_buf;
+};
+
+template<typename T>
+class wxStringTypeBufferLengthBase : public wxStringTypeBufferBase<T>
+{
+public:
+ wxStringTypeBufferLengthBase(wxString& str, size_t lenWanted = 1024)
+ : wxStringTypeBufferBase<T>(str, lenWanted),
+ m_len(0),
+ m_lenSet(false)
+ { }
+
+ ~wxStringTypeBufferLengthBase()
+ {
+ wxASSERT_MSG( this->m_lenSet, "forgot to call SetLength()" );
+ }
+
+ void SetLength(size_t length) { m_len = length; m_lenSet = true; }
+
+protected:
+ size_t m_len;
+ bool m_lenSet;
+};
+
+template<typename T>
+class wxStringTypeBuffer : public wxStringTypeBufferBase<T>
+{
+public:
+ wxStringTypeBuffer(wxString& str, size_t lenWanted = 1024)
+ : wxStringTypeBufferBase<T>(str, lenWanted)
+ { }
+
+ ~wxStringTypeBuffer()
+ {
+ this->m_str.assign(this->m_buf.data());
+ }
+
+ wxDECLARE_NO_COPY_CLASS(wxStringTypeBuffer);
+};
+
+template<typename T>
+class wxStringTypeBufferLength : public wxStringTypeBufferLengthBase<T>
+{
+public:
+ wxStringTypeBufferLength(wxString& str, size_t lenWanted = 1024)
+ : wxStringTypeBufferLengthBase<T>(str, lenWanted)
+ { }
+
+ ~wxStringTypeBufferLength()
+ {
+ this->m_str.assign(this->m_buf.data(), this->m_len);
+ }
+
+ wxDECLARE_NO_COPY_CLASS(wxStringTypeBufferLength);
+};
+
+#if wxUSE_STL_BASED_WXSTRING
+
+WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxStringTypeBufferBase<wxStringCharType> )
+
+class wxStringInternalBuffer : public wxStringTypeBufferBase<wxStringCharType>
+{
+public:
+ wxStringInternalBuffer(wxString& str, size_t lenWanted = 1024)
+ : wxStringTypeBufferBase<wxStringCharType>(str, lenWanted) {}
+ ~wxStringInternalBuffer()
+ { m_str.m_impl.assign(m_buf.data()); }
+
+ wxDECLARE_NO_COPY_CLASS(wxStringInternalBuffer);
+};
+
+WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE(
+ wxStringTypeBufferLengthBase<wxStringCharType> )
+
+class wxStringInternalBufferLength
+ : public wxStringTypeBufferLengthBase<wxStringCharType>
+{
+public:
+ wxStringInternalBufferLength(wxString& str, size_t lenWanted = 1024)
+ : wxStringTypeBufferLengthBase<wxStringCharType>(str, lenWanted) {}
+
+ ~wxStringInternalBufferLength()
+ {
+ m_str.m_impl.assign(m_buf.data(), m_len);
+ }
+
+ wxDECLARE_NO_COPY_CLASS(wxStringInternalBufferLength);
+};
+
+#endif // wxUSE_STL_BASED_WXSTRING
+
+
+#if wxUSE_STL_BASED_WXSTRING || wxUSE_UNICODE_UTF8
+typedef wxStringTypeBuffer<wxChar> wxStringBuffer;
+typedef wxStringTypeBufferLength<wxChar> wxStringBufferLength;
+#else // if !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8
+typedef wxStringInternalBuffer wxStringBuffer;
+typedef wxStringInternalBufferLength wxStringBufferLength;
+#endif // !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8
+
+#if wxUSE_UNICODE_UTF8
+typedef wxStringInternalBuffer wxUTF8StringBuffer;
+typedef wxStringInternalBufferLength wxUTF8StringBufferLength;
+#elif wxUSE_UNICODE_WCHAR
+
+WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxStringTypeBufferBase<char> )
+
+// Note about inlined dtors in the classes below: this is done not for
+// performance reasons but just to avoid linking errors in the MSVC DLL build
+// under Windows: if a class has non-inline methods it must be declared as
+// being DLL-exported but, due to an extremely interesting feature of MSVC 7
+// and later, any template class which is used as a base of a DLL-exported
+// class is implicitly made DLL-exported too, as explained at the bottom of
+// http://msdn.microsoft.com/en-us/library/twa2aw10.aspx (just to confirm: yes,
+// _inheriting_ from a class can change whether it is being exported from DLL)
+//
+// But this results in link errors because the base template class is not DLL-
+// exported, whether it is declared with WXDLLIMPEXP_BASE or not, because it
+// does have only inline functions. So the simplest fix is to just make all the
+// functions of these classes inline too.
+
+class wxUTF8StringBuffer : public wxStringTypeBufferBase<char>
+{
+public:
+ wxUTF8StringBuffer(wxString& str, size_t lenWanted = 1024)
+ : wxStringTypeBufferBase<char>(str, lenWanted) {}
+ ~wxUTF8StringBuffer()
+ {
+ wxMBConvStrictUTF8 conv;
+ size_t wlen = conv.ToWChar(NULL, 0, m_buf);
+ wxCHECK_RET( wlen != wxCONV_FAILED, "invalid UTF-8 data in string buffer?" );
+
+ wxStringInternalBuffer wbuf(m_str, wlen);
+ conv.ToWChar(wbuf, wlen, m_buf);
+ }
+
+ wxDECLARE_NO_COPY_CLASS(wxUTF8StringBuffer);
+};
+
+WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxStringTypeBufferLengthBase<char> )
+
+class wxUTF8StringBufferLength : public wxStringTypeBufferLengthBase<char>
+{
+public:
+ wxUTF8StringBufferLength(wxString& str, size_t lenWanted = 1024)
+ : wxStringTypeBufferLengthBase<char>(str, lenWanted) {}
+ ~wxUTF8StringBufferLength()
+ {
+ wxCHECK_RET(m_lenSet, "length not set");
+
+ wxMBConvStrictUTF8 conv;
+ size_t wlen = conv.ToWChar(NULL, 0, m_buf, m_len);
+ wxCHECK_RET( wlen != wxCONV_FAILED, "invalid UTF-8 data in string buffer?" );
+
+ wxStringInternalBufferLength wbuf(m_str, wlen);
+ conv.ToWChar(wbuf, wlen, m_buf, m_len);
+ wbuf.SetLength(wlen);
+ }
+
+ wxDECLARE_NO_COPY_CLASS(wxUTF8StringBufferLength);
+};
+#endif // wxUSE_UNICODE_UTF8/wxUSE_UNICODE_WCHAR
+
+
+// ---------------------------------------------------------------------------
+// wxString comparison functions: operator versions are always case sensitive
+// ---------------------------------------------------------------------------
+
+#define wxCMP_WXCHAR_STRING(p, s, op) 0 op s.Cmp(p)
+
+wxDEFINE_ALL_COMPARISONS(const wxChar *, const wxString&, wxCMP_WXCHAR_STRING)
+
+#undef wxCMP_WXCHAR_STRING
+
+inline bool operator==(const wxString& s1, const wxString& s2)
+ { return s1.IsSameAs(s2); }
+inline bool operator!=(const wxString& s1, const wxString& s2)
+ { return !s1.IsSameAs(s2); }
+inline bool operator< (const wxString& s1, const wxString& s2)
+ { return s1.Cmp(s2) < 0; }
+inline bool operator> (const wxString& s1, const wxString& s2)
+ { return s1.Cmp(s2) > 0; }
+inline bool operator<=(const wxString& s1, const wxString& s2)
+ { return s1.Cmp(s2) <= 0; }
+inline bool operator>=(const wxString& s1, const wxString& s2)
+ { return s1.Cmp(s2) >= 0; }
+
+inline bool operator==(const wxString& s1, const wxCStrData& s2)
+ { return s1 == s2.AsString(); }
+inline bool operator==(const wxCStrData& s1, const wxString& s2)
+ { return s1.AsString() == s2; }
+inline bool operator!=(const wxString& s1, const wxCStrData& s2)
+ { return s1 != s2.AsString(); }
+inline bool operator!=(const wxCStrData& s1, const wxString& s2)
+ { return s1.AsString() != s2; }
+
+inline bool operator==(const wxString& s1, const wxScopedWCharBuffer& s2)
+ { return (s1.Cmp((const wchar_t *)s2) == 0); }
+inline bool operator==(const wxScopedWCharBuffer& s1, const wxString& s2)
+ { return (s2.Cmp((const wchar_t *)s1) == 0); }
+inline bool operator!=(const wxString& s1, const wxScopedWCharBuffer& s2)
+ { return (s1.Cmp((const wchar_t *)s2) != 0); }
+inline bool operator!=(const wxScopedWCharBuffer& s1, const wxString& s2)
+ { return (s2.Cmp((const wchar_t *)s1) != 0); }
+
+inline bool operator==(const wxString& s1, const wxScopedCharBuffer& s2)
+ { return (s1.Cmp((const char *)s2) == 0); }
+inline bool operator==(const wxScopedCharBuffer& s1, const wxString& s2)
+ { return (s2.Cmp((const char *)s1) == 0); }
+inline bool operator!=(const wxString& s1, const wxScopedCharBuffer& s2)
+ { return (s1.Cmp((const char *)s2) != 0); }
+inline bool operator!=(const wxScopedCharBuffer& s1, const wxString& s2)
+ { return (s2.Cmp((const char *)s1) != 0); }
+
+inline wxString operator+(const wxString& string, const wxScopedWCharBuffer& buf)
+ { return string + (const wchar_t *)buf; }
+inline wxString operator+(const wxScopedWCharBuffer& buf, const wxString& string)
+ { return (const wchar_t *)buf + string; }
+
+inline wxString operator+(const wxString& string, const wxScopedCharBuffer& buf)
+ { return string + (const char *)buf; }
+inline wxString operator+(const wxScopedCharBuffer& buf, const wxString& string)
+ { return (const char *)buf + string; }
+
+// comparison with char
+inline bool operator==(const wxUniChar& c, const wxString& s) { return s.IsSameAs(c); }
+inline bool operator==(const wxUniCharRef& c, const wxString& s) { return s.IsSameAs(c); }
+inline bool operator==(char c, const wxString& s) { return s.IsSameAs(c); }
+inline bool operator==(wchar_t c, const wxString& s) { return s.IsSameAs(c); }
+inline bool operator==(int c, const wxString& s) { return s.IsSameAs(c); }
+inline bool operator==(const wxString& s, const wxUniChar& c) { return s.IsSameAs(c); }
+inline bool operator==(const wxString& s, const wxUniCharRef& c) { return s.IsSameAs(c); }
+inline bool operator==(const wxString& s, char c) { return s.IsSameAs(c); }
+inline bool operator==(const wxString& s, wchar_t c) { return s.IsSameAs(c); }
+inline bool operator!=(const wxUniChar& c, const wxString& s) { return !s.IsSameAs(c); }
+inline bool operator!=(const wxUniCharRef& c, const wxString& s) { return !s.IsSameAs(c); }
+inline bool operator!=(char c, const wxString& s) { return !s.IsSameAs(c); }
+inline bool operator!=(wchar_t c, const wxString& s) { return !s.IsSameAs(c); }
+inline bool operator!=(int c, const wxString& s) { return !s.IsSameAs(c); }
+inline bool operator!=(const wxString& s, const wxUniChar& c) { return !s.IsSameAs(c); }
+inline bool operator!=(const wxString& s, const wxUniCharRef& c) { return !s.IsSameAs(c); }
+inline bool operator!=(const wxString& s, char c) { return !s.IsSameAs(c); }
+inline bool operator!=(const wxString& s, wchar_t c) { return !s.IsSameAs(c); }
+
+
+// wxString iterators comparisons
+inline bool wxString::iterator::operator==(const const_iterator& i) const
+ { return i == *this; }
+inline bool wxString::iterator::operator!=(const const_iterator& i) const
+ { return i != *this; }
+inline bool wxString::iterator::operator<(const const_iterator& i) const
+ { return i > *this; }
+inline bool wxString::iterator::operator>(const const_iterator& i) const
+ { return i < *this; }
+inline bool wxString::iterator::operator<=(const const_iterator& i) const
+ { return i >= *this; }
+inline bool wxString::iterator::operator>=(const const_iterator& i) const
+ { return i <= *this; }
+
+// comparison with C string in Unicode build
+#if wxUSE_UNICODE
+
+#define wxCMP_CHAR_STRING(p, s, op) wxString(p) op s
+
+wxDEFINE_ALL_COMPARISONS(const char *, const wxString&, wxCMP_CHAR_STRING)
+
+#undef wxCMP_CHAR_STRING
+
+#endif // wxUSE_UNICODE
+
+// we also need to provide the operators for comparison with wxCStrData to
+// resolve ambiguity between operator(const wxChar *,const wxString &) and
+// operator(const wxChar *, const wxChar *) for "p == s.c_str()"
+//
+// notice that these are (shallow) pointer comparisons, not (deep) string ones
+#define wxCMP_CHAR_CSTRDATA(p, s, op) p op s.AsChar()
+#define wxCMP_WCHAR_CSTRDATA(p, s, op) p op s.AsWChar()
+
+wxDEFINE_ALL_COMPARISONS(const wchar_t *, const wxCStrData&, wxCMP_WCHAR_CSTRDATA)
+wxDEFINE_ALL_COMPARISONS(const char *, const wxCStrData&, wxCMP_CHAR_CSTRDATA)
+
+#undef wxCMP_CHAR_CSTRDATA
+#undef wxCMP_WCHAR_CSTRDATA
+
+// ---------------------------------------------------------------------------
+// Implementation only from here until the end of file
+// ---------------------------------------------------------------------------
+
+#if wxUSE_STD_IOSTREAM
+
+#include "wx/iosfwrap.h"
+
+WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxString&);
+WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxCStrData&);
+WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxScopedCharBuffer&);
+#ifndef __BORLANDC__
+WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxScopedWCharBuffer&);
+#endif
+
+#if wxUSE_UNICODE && defined(HAVE_WOSTREAM)
+
+WXDLLIMPEXP_BASE wxSTD wostream& operator<<(wxSTD wostream&, const wxString&);
+WXDLLIMPEXP_BASE wxSTD wostream& operator<<(wxSTD wostream&, const wxCStrData&);
+WXDLLIMPEXP_BASE wxSTD wostream& operator<<(wxSTD wostream&, const wxScopedWCharBuffer&);
+
+#endif // wxUSE_UNICODE && defined(HAVE_WOSTREAM)
+
+#endif // wxUSE_STD_IOSTREAM
+
+// ---------------------------------------------------------------------------
+// wxCStrData implementation
+// ---------------------------------------------------------------------------
+
+inline wxCStrData::wxCStrData(char *buf)
+ : m_str(new wxString(buf)), m_offset(0), m_owned(true) {}
+inline wxCStrData::wxCStrData(wchar_t *buf)
+ : m_str(new wxString(buf)), m_offset(0), m_owned(true) {}
+
+inline wxCStrData::wxCStrData(const wxCStrData& data)
+ : m_str(data.m_owned ? new wxString(*data.m_str) : data.m_str),
+ m_offset(data.m_offset),
+ m_owned(data.m_owned)
+{
+}
+
+inline wxCStrData::~wxCStrData()
+{
+ if ( m_owned )
+ delete const_cast<wxString*>(m_str); // cast to silence warnings
+}
+
+// AsChar() and AsWChar() implementations simply forward to wxString methods
+
+inline const wchar_t* wxCStrData::AsWChar() const
+{
+ const wchar_t * const p =
+#if wxUSE_UNICODE_WCHAR
+ m_str->wc_str();
+#elif wxUSE_UNICODE_UTF8
+ m_str->AsWChar(wxMBConvStrictUTF8());
+#else
+ m_str->AsWChar(wxConvLibc);
+#endif
+
+ // in Unicode build the string always has a valid Unicode representation
+ // and even if a conversion is needed (as in UTF8 case) it can't fail
+ //
+ // but in ANSI build the string contents might be not convertible to
+ // Unicode using the current locale encoding so we do need to check for
+ // errors
+#if !wxUSE_UNICODE
+ if ( !p )
+ {
+ // if conversion fails, return empty string and not NULL to avoid
+ // crashes in code written with either wxWidgets 2 wxString or
+ // std::string behaviour in mind: neither of them ever returns NULL
+ // from its c_str() and so we shouldn't neither
+ //
+ // notice that the same is done in AsChar() below and
+ // wxString::wc_str() and mb_str() for the same reasons
+ return L"";
+ }
+#endif // !wxUSE_UNICODE
+
+ return p + m_offset;
+}
+
+inline const char* wxCStrData::AsChar() const
+{
+#if wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY
+ const char * const p = m_str->AsChar(wxConvLibc);
+ if ( !p )
+ return "";
+#else // !wxUSE_UNICODE || wxUSE_UTF8_LOCALE_ONLY
+ const char * const p = m_str->mb_str();
+#endif // wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY
+
+ return p + m_offset;
+}
+
+inline wxString wxCStrData::AsString() const
+{
+ if ( m_offset == 0 )
+ return *m_str;
+ else
+ return m_str->Mid(m_offset);
+}
+
+inline const wxStringCharType *wxCStrData::AsInternal() const
+{
+#if wxUSE_UNICODE_UTF8
+ return wxStringOperations::AddToIter(m_str->wx_str(), m_offset);
+#else
+ return m_str->wx_str() + m_offset;
+#endif
+}
+
+inline wxUniChar wxCStrData::operator*() const
+{
+ if ( m_str->empty() )
+ return wxUniChar(wxT('\0'));
+ else
+ return (*m_str)[m_offset];
+}
+
+inline wxUniChar wxCStrData::operator[](size_t n) const
+{
+ // NB: we intentionally use operator[] and not at() here because the former
+ // works for the terminating NUL while the latter does not
+ return (*m_str)[m_offset + n];
+}
+
+// ----------------------------------------------------------------------------
+// more wxCStrData operators
+// ----------------------------------------------------------------------------
+
+// we need to define those to allow "size_t pos = p - s.c_str()" where p is
+// some pointer into the string
+inline size_t operator-(const char *p, const wxCStrData& cs)
+{
+ return p - cs.AsChar();
+}
+
+inline size_t operator-(const wchar_t *p, const wxCStrData& cs)
+{
+ return p - cs.AsWChar();
+}
+
+// ----------------------------------------------------------------------------
+// implementation of wx[W]CharBuffer inline methods using wxCStrData
+// ----------------------------------------------------------------------------
+
+// FIXME-UTF8: move this to buffer.h
+inline wxCharBuffer::wxCharBuffer(const wxCStrData& cstr)
+ : wxCharTypeBufferBase(cstr.AsCharBuf())
+{
+}
+
+inline wxWCharBuffer::wxWCharBuffer(const wxCStrData& cstr)
+ : wxCharTypeBufferBase(cstr.AsWCharBuf())
+{
+}
+
+#if wxUSE_UNICODE_UTF8
+// ----------------------------------------------------------------------------
+// implementation of wxStringIteratorNode inline methods
+// ----------------------------------------------------------------------------
+
+void wxStringIteratorNode::DoSet(const wxString *str,
+ wxStringImpl::const_iterator *citer,
+ wxStringImpl::iterator *iter)
+{
+ m_prev = NULL;
+ m_iter = iter;
+ m_citer = citer;
+ m_str = str;
+ if ( str )
+ {
+ m_next = str->m_iterators.ptr;
+ const_cast<wxString*>(m_str)->m_iterators.ptr = this;
+ if ( m_next )
+ m_next->m_prev = this;
+ }
+ else
+ {
+ m_next = NULL;
+ }
+}
+
+void wxStringIteratorNode::clear()
+{
+ if ( m_next )
+ m_next->m_prev = m_prev;
+ if ( m_prev )
+ m_prev->m_next = m_next;
+ else if ( m_str ) // first in the list
+ const_cast<wxString*>(m_str)->m_iterators.ptr = m_next;
+
+ m_next = m_prev = NULL;
+ m_citer = NULL;
+ m_iter = NULL;
+ m_str = NULL;
+}
+#endif // wxUSE_UNICODE_UTF8
+
+#if WXWIN_COMPATIBILITY_2_8
+ // lot of code out there doesn't explicitly include wx/crt.h, but uses
+ // CRT wrappers that are now declared in wx/wxcrt.h and wx/wxcrtvararg.h,
+ // so let's include this header now that wxString is defined and it's safe
+ // to do it:
+ #include "wx/crt.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// Checks on wxString characters
+// ----------------------------------------------------------------------------
+
+template<bool (T)(const wxUniChar& c)>
+ inline bool wxStringCheck(const wxString& val)
+ {
+ for ( wxString::const_iterator i = val.begin();
+ i != val.end();
+ ++i )
+ if (T(*i) == 0)
+ return false;
+ return true;
+ }
+
+#endif // _WX_WXSTRING_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/stringimpl.h
+// Purpose: wxStringImpl class, implementation of wxString
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 29/01/98
+// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+/*
+ This header implements std::string-like string class, wxStringImpl, that is
+ used by wxString to store the data. Alternatively, if wxUSE_STD_STRING=1,
+ wxStringImpl is just a typedef to std:: string class.
+*/
+
+#ifndef _WX_WXSTRINGIMPL_H__
+#define _WX_WXSTRINGIMPL_H__
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h" // everybody should include this
+#include "wx/chartype.h" // for wxChar
+#include "wx/wxcrtbase.h" // for wxStrlen() etc.
+
+#include <stdlib.h>
+
+// ---------------------------------------------------------------------------
+// macros
+// ---------------------------------------------------------------------------
+
+// implementation only
+#define wxASSERT_VALID_INDEX(i) \
+ wxASSERT_MSG( (size_t)(i) <= length(), wxT("invalid index in wxString") )
+
+
+// ----------------------------------------------------------------------------
+// global data
+// ----------------------------------------------------------------------------
+
+// global pointer to empty string
+extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxEmptyString;
+#if wxUSE_UNICODE_UTF8
+// FIXME-UTF8: we should have only one wxEmptyString
+extern WXDLLIMPEXP_DATA_BASE(const wxStringCharType*) wxEmptyStringImpl;
+#endif
+
+
+// ----------------------------------------------------------------------------
+// deal with various build options
+// ----------------------------------------------------------------------------
+
+// we use STL-based string internally if we use std::string at all now, there
+// should be no reason to prefer our internal implement but if you really need
+// it you can predefine wxUSE_STL_BASED_WXSTRING as 0 when building the library
+#ifndef wxUSE_STL_BASED_WXSTRING
+ #define wxUSE_STL_BASED_WXSTRING wxUSE_STD_STRING
+#endif
+
+// in both cases we need to define wxStdString
+#if wxUSE_STL_BASED_WXSTRING || wxUSE_STD_STRING
+
+#include "wx/beforestd.h"
+#include <string>
+#include "wx/afterstd.h"
+
+#ifdef HAVE_STD_WSTRING
+ typedef std::wstring wxStdWideString;
+#else
+ typedef std::basic_string<wchar_t> wxStdWideString;
+#endif
+
+#if wxUSE_UNICODE_WCHAR
+ typedef wxStdWideString wxStdString;
+#else
+ typedef std::string wxStdString;
+#endif
+
+#endif // wxUSE_STL_BASED_WXSTRING || wxUSE_STD_STRING
+
+
+#if wxUSE_STL_BASED_WXSTRING
+
+ // we always want ctor from std::string when using std::string internally
+ #undef wxUSE_STD_STRING
+ #define wxUSE_STD_STRING 1
+
+ // the versions of std::string included with gcc 2.95 and VC6 (for which
+ // _MSC_VER == 1200) and eVC4 (_MSC_VER == 1201) lack clear() method
+ #if (defined(__GNUG__) && (__GNUG__ < 3)) || \
+ !wxCHECK_VISUALC_VERSION(7) || defined(__EVC4__)
+ #define wxSTRING_BASE_HASNT_CLEAR
+ #endif
+
+ typedef wxStdString wxStringImpl;
+#else // if !wxUSE_STL_BASED_WXSTRING
+
+// in non-STL mode, compare() is implemented in wxString and not wxStringImpl
+#undef HAVE_STD_STRING_COMPARE
+
+// ---------------------------------------------------------------------------
+// string data prepended with some housekeeping info (used by wxString class),
+// is never used directly (but had to be put here to allow inlining)
+// ---------------------------------------------------------------------------
+
+struct WXDLLIMPEXP_BASE wxStringData
+{
+ int nRefs; // reference count
+ size_t nDataLength, // actual string length
+ nAllocLength; // allocated memory size
+
+ // mimics declaration 'wxStringCharType data[nAllocLength]'
+ wxStringCharType* data() const { return (wxStringCharType*)(this + 1); }
+
+ // empty string has a special ref count so it's never deleted
+ bool IsEmpty() const { return (nRefs == -1); }
+ bool IsShared() const { return (nRefs > 1); }
+
+ // lock/unlock
+ void Lock() { if ( !IsEmpty() ) nRefs++; }
+
+ // VC++ will refuse to inline Unlock but profiling shows that it is wrong
+#if defined(__VISUALC__) && (__VISUALC__ >= 1200)
+ __forceinline
+#endif
+ // VC++ free must take place in same DLL as allocation when using non dll
+ // run-time library (e.g. Multithreaded instead of Multithreaded DLL)
+#if defined(__VISUALC__) && defined(_MT) && !defined(_DLL)
+ void Unlock() { if ( !IsEmpty() && --nRefs == 0) Free(); }
+ // we must not inline deallocation since allocation is not inlined
+ void Free();
+#else
+ void Unlock() { if ( !IsEmpty() && --nRefs == 0) free(this); }
+#endif
+
+ // if we had taken control over string memory (GetWriteBuf), it's
+ // intentionally put in invalid state
+ void Validate(bool b) { nRefs = (b ? 1 : 0); }
+ bool IsValid() const { return (nRefs != 0); }
+};
+
+class WXDLLIMPEXP_BASE wxStringImpl
+{
+public:
+ // an 'invalid' value for string index, moved to this place due to a CW bug
+ static const size_t npos;
+
+protected:
+ // points to data preceded by wxStringData structure with ref count info
+ wxStringCharType *m_pchData;
+
+ // accessor to string data
+ wxStringData* GetStringData() const { return (wxStringData*)m_pchData - 1; }
+
+ // string (re)initialization functions
+ // initializes the string to the empty value (must be called only from
+ // ctors, use Reinit() otherwise)
+#if wxUSE_UNICODE_UTF8
+ void Init() { m_pchData = (wxStringCharType *)wxEmptyStringImpl; } // FIXME-UTF8
+#else
+ void Init() { m_pchData = (wxStringCharType *)wxEmptyString; }
+#endif
+ // initializes the string with (a part of) C-string
+ void InitWith(const wxStringCharType *psz, size_t nPos = 0, size_t nLen = npos);
+ // as Init, but also frees old data
+ void Reinit() { GetStringData()->Unlock(); Init(); }
+
+ // memory allocation
+ // allocates memory for string of length nLen
+ bool AllocBuffer(size_t nLen);
+ // effectively copies data to string
+ bool AssignCopy(size_t, const wxStringCharType *);
+
+ // append a (sub)string
+ bool ConcatSelf(size_t nLen, const wxStringCharType *src, size_t nMaxLen);
+ bool ConcatSelf(size_t nLen, const wxStringCharType *src)
+ { return ConcatSelf(nLen, src, nLen); }
+
+ // functions called before writing to the string: they copy it if there
+ // are other references to our data (should be the only owner when writing)
+ bool CopyBeforeWrite();
+ bool AllocBeforeWrite(size_t);
+
+ // compatibility with wxString
+ bool Alloc(size_t nLen);
+
+public:
+ // standard types
+ typedef wxStringCharType value_type;
+ typedef wxStringCharType char_type;
+ typedef size_t size_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+
+ // macro to define the bulk of iterator and const_iterator classes
+ #define WX_DEFINE_STRINGIMPL_ITERATOR(iterator_name, ref_type, ptr_type) \
+ public: \
+ typedef wxStringCharType value_type; \
+ typedef ref_type reference; \
+ typedef ptr_type pointer; \
+ typedef int difference_type; \
+ \
+ iterator_name() : m_ptr(NULL) { } \
+ iterator_name(pointer ptr) : m_ptr(ptr) { } \
+ \
+ reference operator*() const { return *m_ptr; } \
+ \
+ iterator_name& operator++() { m_ptr++; return *this; } \
+ iterator_name operator++(int) \
+ { \
+ const iterator_name tmp(*this); \
+ m_ptr++; \
+ return tmp; \
+ } \
+ \
+ iterator_name& operator--() { m_ptr--; return *this; } \
+ iterator_name operator--(int) \
+ { \
+ const iterator_name tmp(*this); \
+ m_ptr--; \
+ return tmp; \
+ } \
+ \
+ iterator_name operator+(ptrdiff_t n) const \
+ { return iterator_name(m_ptr + n); } \
+ iterator_name operator-(ptrdiff_t n) const \
+ { return iterator_name(m_ptr - n); } \
+ iterator_name& operator+=(ptrdiff_t n) \
+ { m_ptr += n; return *this; } \
+ iterator_name& operator-=(ptrdiff_t n) \
+ { m_ptr -= n; return *this; } \
+ \
+ difference_type operator-(const iterator_name& i) const \
+ { return m_ptr - i.m_ptr; } \
+ \
+ bool operator==(const iterator_name& i) const \
+ { return m_ptr == i.m_ptr; } \
+ bool operator!=(const iterator_name& i) const \
+ { return m_ptr != i.m_ptr; } \
+ \
+ bool operator<(const iterator_name& i) const \
+ { return m_ptr < i.m_ptr; } \
+ bool operator>(const iterator_name& i) const \
+ { return m_ptr > i.m_ptr; } \
+ bool operator<=(const iterator_name& i) const \
+ { return m_ptr <= i.m_ptr; } \
+ bool operator>=(const iterator_name& i) const \
+ { return m_ptr >= i.m_ptr; } \
+ \
+ private: \
+ /* for wxStringImpl use only */ \
+ pointer GetPtr() const { return m_ptr; } \
+ \
+ friend class wxStringImpl; \
+ \
+ pointer m_ptr
+
+ // we need to declare const_iterator in wxStringImpl scope, the friend
+ // declaration inside iterator class itself is not enough, or at least not
+ // for g++ 3.4 (g++ 4 is ok)
+ class WXDLLIMPEXP_FWD_BASE const_iterator;
+
+ class WXDLLIMPEXP_BASE iterator
+ {
+ WX_DEFINE_STRINGIMPL_ITERATOR(iterator,
+ wxStringCharType&,
+ wxStringCharType*);
+
+ friend class const_iterator;
+ };
+
+ class WXDLLIMPEXP_BASE const_iterator
+ {
+ public:
+ const_iterator(iterator i) : m_ptr(i.m_ptr) { }
+
+ WX_DEFINE_STRINGIMPL_ITERATOR(const_iterator,
+ const wxStringCharType&,
+ const wxStringCharType*);
+ };
+
+ #undef WX_DEFINE_STRINGIMPL_ITERATOR
+
+
+ // constructors and destructor
+ // ctor for an empty string
+ wxStringImpl() { Init(); }
+ // copy ctor
+ wxStringImpl(const wxStringImpl& stringSrc)
+ {
+ wxASSERT_MSG( stringSrc.GetStringData()->IsValid(),
+ wxT("did you forget to call UngetWriteBuf()?") );
+
+ if ( stringSrc.empty() ) {
+ // nothing to do for an empty string
+ Init();
+ }
+ else {
+ m_pchData = stringSrc.m_pchData; // share same data
+ GetStringData()->Lock(); // => one more copy
+ }
+ }
+ // string containing nRepeat copies of ch
+ wxStringImpl(size_type nRepeat, wxStringCharType ch);
+ // ctor takes first nLength characters from C string
+ // (default value of npos means take all the string)
+ wxStringImpl(const wxStringCharType *psz)
+ { InitWith(psz, 0, npos); }
+ wxStringImpl(const wxStringCharType *psz, size_t nLength)
+ { InitWith(psz, 0, nLength); }
+ // take nLen chars starting at nPos
+ wxStringImpl(const wxStringImpl& str, size_t nPos, size_t nLen)
+ {
+ wxASSERT_MSG( str.GetStringData()->IsValid(),
+ wxT("did you forget to call UngetWriteBuf()?") );
+ Init();
+ size_t strLen = str.length() - nPos; nLen = strLen < nLen ? strLen : nLen;
+ InitWith(str.c_str(), nPos, nLen);
+ }
+ // take everything between start and end
+ wxStringImpl(const_iterator start, const_iterator end);
+
+
+ // ctor from and conversion to std::string
+#if wxUSE_STD_STRING
+ wxStringImpl(const wxStdString& impl)
+ { InitWith(impl.c_str(), 0, impl.length()); }
+
+ operator wxStdString() const
+ { return wxStdString(c_str(), length()); }
+#endif
+
+#if defined(__VISUALC__) && (__VISUALC__ >= 1200)
+ // disable warning about Unlock() below not being inlined (first, it
+ // seems to be inlined nevertheless and second, even if it isn't, there
+ // is nothing we can do about this
+ #pragma warning(push)
+ #pragma warning (disable:4714)
+#endif
+
+ // dtor is not virtual, this class must not be inherited from!
+ ~wxStringImpl()
+ {
+ GetStringData()->Unlock();
+ }
+
+#if defined(__VISUALC__) && (__VISUALC__ >= 1200)
+ #pragma warning(pop)
+#endif
+
+ // overloaded assignment
+ // from another wxString
+ wxStringImpl& operator=(const wxStringImpl& stringSrc);
+ // from a character
+ wxStringImpl& operator=(wxStringCharType ch);
+ // from a C string
+ wxStringImpl& operator=(const wxStringCharType *psz);
+
+ // return the length of the string
+ size_type length() const { return GetStringData()->nDataLength; }
+ // return the length of the string
+ size_type size() const { return length(); }
+ // return the maximum size of the string
+ size_type max_size() const { return npos; }
+ // resize the string, filling the space with c if c != 0
+ void resize(size_t nSize, wxStringCharType ch = '\0');
+ // delete the contents of the string
+ void clear() { erase(0, npos); }
+ // returns true if the string is empty
+ bool empty() const { return length() == 0; }
+ // inform string about planned change in size
+ void reserve(size_t sz) { Alloc(sz); }
+ size_type capacity() const { return GetStringData()->nAllocLength; }
+
+ // lib.string.access
+ // return the character at position n
+ value_type operator[](size_type n) const { return m_pchData[n]; }
+ value_type at(size_type n) const
+ { wxASSERT_VALID_INDEX( n ); return m_pchData[n]; }
+ // returns the writable character at position n
+ reference operator[](size_type n) { CopyBeforeWrite(); return m_pchData[n]; }
+ reference at(size_type n)
+ {
+ wxASSERT_VALID_INDEX( n );
+ CopyBeforeWrite();
+ return m_pchData[n];
+ } // FIXME-UTF8: not useful for us...?
+
+ // lib.string.modifiers
+ // append elements str[pos], ..., str[pos+n]
+ wxStringImpl& append(const wxStringImpl& str, size_t pos, size_t n)
+ {
+ wxASSERT(pos <= str.length());
+ ConcatSelf(n, str.c_str() + pos, str.length() - pos);
+ return *this;
+ }
+ // append a string
+ wxStringImpl& append(const wxStringImpl& str)
+ { ConcatSelf(str.length(), str.c_str()); return *this; }
+ // append first n (or all if n == npos) characters of sz
+ wxStringImpl& append(const wxStringCharType *sz)
+ { ConcatSelf(wxStrlen(sz), sz); return *this; }
+ wxStringImpl& append(const wxStringCharType *sz, size_t n)
+ { ConcatSelf(n, sz); return *this; }
+ // append n copies of ch
+ wxStringImpl& append(size_t n, wxStringCharType ch);
+ // append from first to last
+ wxStringImpl& append(const_iterator first, const_iterator last)
+ { ConcatSelf(last - first, first.GetPtr()); return *this; }
+
+ // same as `this_string = str'
+ wxStringImpl& assign(const wxStringImpl& str)
+ { return *this = str; }
+ // same as ` = str[pos..pos + n]
+ wxStringImpl& assign(const wxStringImpl& str, size_t pos, size_t n)
+ { return replace(0, npos, str, pos, n); }
+ // same as `= first n (or all if n == npos) characters of sz'
+ wxStringImpl& assign(const wxStringCharType *sz)
+ { return replace(0, npos, sz, wxStrlen(sz)); }
+ wxStringImpl& assign(const wxStringCharType *sz, size_t n)
+ { return replace(0, npos, sz, n); }
+ // same as `= n copies of ch'
+ wxStringImpl& assign(size_t n, wxStringCharType ch)
+ { return replace(0, npos, n, ch); }
+ // assign from first to last
+ wxStringImpl& assign(const_iterator first, const_iterator last)
+ { return replace(begin(), end(), first, last); }
+
+ // first valid index position
+ const_iterator begin() const { return m_pchData; }
+ iterator begin();
+ // position one after the last valid one
+ const_iterator end() const { return m_pchData + length(); }
+ iterator end();
+
+ // insert another string
+ wxStringImpl& insert(size_t nPos, const wxStringImpl& str)
+ {
+ wxASSERT( str.GetStringData()->IsValid() );
+ return insert(nPos, str.c_str(), str.length());
+ }
+ // insert n chars of str starting at nStart (in str)
+ wxStringImpl& insert(size_t nPos, const wxStringImpl& str, size_t nStart, size_t n)
+ {
+ wxASSERT( str.GetStringData()->IsValid() );
+ wxASSERT( nStart < str.length() );
+ size_t strLen = str.length() - nStart;
+ n = strLen < n ? strLen : n;
+ return insert(nPos, str.c_str() + nStart, n);
+ }
+ // insert first n (or all if n == npos) characters of sz
+ wxStringImpl& insert(size_t nPos, const wxStringCharType *sz, size_t n = npos);
+ // insert n copies of ch
+ wxStringImpl& insert(size_t nPos, size_t n, wxStringCharType ch)
+ { return insert(nPos, wxStringImpl(n, ch)); }
+ iterator insert(iterator it, wxStringCharType ch)
+ { size_t idx = it - begin(); insert(idx, 1, ch); return begin() + idx; }
+ void insert(iterator it, const_iterator first, const_iterator last)
+ { insert(it - begin(), first.GetPtr(), last - first); }
+ void insert(iterator it, size_type n, wxStringCharType ch)
+ { insert(it - begin(), n, ch); }
+
+ // delete characters from nStart to nStart + nLen
+ wxStringImpl& erase(size_type pos = 0, size_type n = npos);
+ iterator erase(iterator first, iterator last)
+ {
+ size_t idx = first - begin();
+ erase(idx, last - first);
+ return begin() + idx;
+ }
+ iterator erase(iterator first);
+
+ // explicit conversion to C string (use this with printf()!)
+ const wxStringCharType* c_str() const { return m_pchData; }
+ const wxStringCharType* data() const { return m_pchData; }
+
+ // replaces the substring of length nLen starting at nStart
+ wxStringImpl& replace(size_t nStart, size_t nLen, const wxStringCharType* sz)
+ { return replace(nStart, nLen, sz, npos); }
+ // replaces the substring of length nLen starting at nStart
+ wxStringImpl& replace(size_t nStart, size_t nLen, const wxStringImpl& str)
+ { return replace(nStart, nLen, str.c_str(), str.length()); }
+ // replaces the substring with nCount copies of ch
+ wxStringImpl& replace(size_t nStart, size_t nLen,
+ size_t nCount, wxStringCharType ch)
+ { return replace(nStart, nLen, wxStringImpl(nCount, ch)); }
+ // replaces a substring with another substring
+ wxStringImpl& replace(size_t nStart, size_t nLen,
+ const wxStringImpl& str, size_t nStart2, size_t nLen2)
+ { return replace(nStart, nLen, str.substr(nStart2, nLen2)); }
+ // replaces the substring with first nCount chars of sz
+ wxStringImpl& replace(size_t nStart, size_t nLen,
+ const wxStringCharType* sz, size_t nCount);
+
+ wxStringImpl& replace(iterator first, iterator last, const_pointer s)
+ { return replace(first - begin(), last - first, s); }
+ wxStringImpl& replace(iterator first, iterator last, const_pointer s,
+ size_type n)
+ { return replace(first - begin(), last - first, s, n); }
+ wxStringImpl& replace(iterator first, iterator last, const wxStringImpl& s)
+ { return replace(first - begin(), last - first, s); }
+ wxStringImpl& replace(iterator first, iterator last, size_type n, wxStringCharType c)
+ { return replace(first - begin(), last - first, n, c); }
+ wxStringImpl& replace(iterator first, iterator last,
+ const_iterator first1, const_iterator last1)
+ { return replace(first - begin(), last - first, first1.GetPtr(), last1 - first1); }
+
+ // swap two strings
+ void swap(wxStringImpl& str);
+
+ // All find() functions take the nStart argument which specifies the
+ // position to start the search on, the default value is 0. All functions
+ // return npos if there were no match.
+
+ // find a substring
+ size_t find(const wxStringImpl& str, size_t nStart = 0) const;
+
+ // find first n characters of sz
+ size_t find(const wxStringCharType* sz, size_t nStart = 0, size_t n = npos) const;
+
+ // find the first occurrence of character ch after nStart
+ size_t find(wxStringCharType ch, size_t nStart = 0) const;
+
+ // rfind() family is exactly like find() but works right to left
+
+ // as find, but from the end
+ size_t rfind(const wxStringImpl& str, size_t nStart = npos) const;
+
+ // as find, but from the end
+ size_t rfind(const wxStringCharType* sz, size_t nStart = npos,
+ size_t n = npos) const;
+ // as find, but from the end
+ size_t rfind(wxStringCharType ch, size_t nStart = npos) const;
+
+ size_type copy(wxStringCharType* s, size_type n, size_type pos = 0);
+
+ // substring extraction
+ wxStringImpl substr(size_t nStart = 0, size_t nLen = npos) const;
+
+ // string += string
+ wxStringImpl& operator+=(const wxStringImpl& s) { return append(s); }
+ // string += C string
+ wxStringImpl& operator+=(const wxStringCharType *psz) { return append(psz); }
+ // string += char
+ wxStringImpl& operator+=(wxStringCharType ch) { return append(1, ch); }
+
+ // helpers for wxStringBuffer and wxStringBufferLength
+ wxStringCharType *DoGetWriteBuf(size_t nLen);
+ void DoUngetWriteBuf();
+ void DoUngetWriteBuf(size_t nLen);
+
+ friend class WXDLLIMPEXP_FWD_BASE wxString;
+};
+
+#endif // !wxUSE_STL_BASED_WXSTRING
+
+// don't pollute the library user's name space
+#undef wxASSERT_VALID_INDEX
+
+#endif // _WX_WXSTRINGIMPL_H__
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/stringops.h
+// Purpose: implementation of wxString primitive operations
+// Author: Vaclav Slavik
+// Modified by:
+// Created: 2007-04-16
+// Copyright: (c) 2007 REA Elektronik GmbH
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WXSTRINGOPS_H__
+#define _WX_WXSTRINGOPS_H__
+
+#include "wx/chartype.h"
+#include "wx/stringimpl.h"
+#include "wx/unichar.h"
+#include "wx/buffer.h"
+
+// This header contains wxStringOperations "namespace" class that implements
+// elementary operations on string data as static methods; wxString methods and
+// iterators are implemented in terms of it. Two implementations are available,
+// one for UTF-8 encoded char* string and one for "raw" wchar_t* strings (or
+// char* in ANSI build).
+
+// FIXME-UTF8: only wchar after we remove ANSI build
+#if wxUSE_UNICODE_WCHAR || !wxUSE_UNICODE
+struct WXDLLIMPEXP_BASE wxStringOperationsWchar
+{
+ // moves the iterator to the next Unicode character
+ template <typename Iterator>
+ static void IncIter(Iterator& i) { ++i; }
+
+ // moves the iterator to the previous Unicode character
+ template <typename Iterator>
+ static void DecIter(Iterator& i) { --i; }
+
+ // moves the iterator by n Unicode characters
+ template <typename Iterator>
+ static Iterator AddToIter(const Iterator& i, ptrdiff_t n)
+ { return i + n; }
+
+ // returns distance of the two iterators in Unicode characters
+ template <typename Iterator>
+ static ptrdiff_t DiffIters(const Iterator& i1, const Iterator& i2)
+ { return i1 - i2; }
+
+ // encodes the character to a form used to represent it in internal
+ // representation (returns a string in UTF8 version)
+ static wxChar EncodeChar(const wxUniChar& ch) { return (wxChar)ch; }
+
+ static wxUniChar DecodeChar(const wxStringImpl::const_iterator& i)
+ { return *i; }
+};
+#endif // wxUSE_UNICODE_WCHAR || !wxUSE_UNICODE
+
+
+#if wxUSE_UNICODE_UTF8
+struct WXDLLIMPEXP_BASE wxStringOperationsUtf8
+{
+ // checks correctness of UTF-8 sequence
+ static bool IsValidUtf8String(const char *c,
+ size_t len = wxStringImpl::npos);
+ static bool IsValidUtf8LeadByte(unsigned char c)
+ {
+ return (c <= 0x7F) || (c >= 0xC2 && c <= 0xF4);
+ }
+
+ // table of offsets to skip forward when iterating over UTF-8 sequence
+ static const unsigned char ms_utf8IterTable[256];
+
+
+ template<typename Iterator>
+ static void IncIter(Iterator& i)
+ {
+ wxASSERT( IsValidUtf8LeadByte(*i) );
+ i += ms_utf8IterTable[(unsigned char)*i];
+ }
+
+ template<typename Iterator>
+ static void DecIter(Iterator& i)
+ {
+ // Non-lead bytes are all in the 0x80..0xBF range (i.e. 10xxxxxx in
+ // binary), so we just have to go back until we hit a byte that is
+ // either < 0x80 (i.e. 0xxxxxxx in binary) or 0xC0..0xFF (11xxxxxx in
+ // binary; this includes some invalid values, but we can ignore it
+ // here, because we assume valid UTF-8 input for the purpose of
+ // efficient implementation).
+ --i;
+ while ( ((*i) & 0xC0) == 0x80 /* 2 highest bits are '10' */ )
+ --i;
+ }
+
+ template<typename Iterator>
+ static Iterator AddToIter(const Iterator& i, ptrdiff_t n)
+ {
+ Iterator out(i);
+
+ if ( n > 0 )
+ {
+ for ( ptrdiff_t j = 0; j < n; ++j )
+ IncIter(out);
+ }
+ else if ( n < 0 )
+ {
+ for ( ptrdiff_t j = 0; j > n; --j )
+ DecIter(out);
+ }
+
+ return out;
+ }
+
+ template<typename Iterator>
+ static ptrdiff_t DiffIters(Iterator i1, Iterator i2)
+ {
+ ptrdiff_t dist = 0;
+
+ if ( i1 < i2 )
+ {
+ while ( i1 != i2 )
+ {
+ IncIter(i1);
+ dist--;
+ }
+ }
+ else if ( i2 < i1 )
+ {
+ while ( i2 != i1 )
+ {
+ IncIter(i2);
+ dist++;
+ }
+ }
+
+ return dist;
+ }
+
+ // encodes the character as UTF-8:
+ typedef wxUniChar::Utf8CharBuffer Utf8CharBuffer;
+ static Utf8CharBuffer EncodeChar(const wxUniChar& ch)
+ { return ch.AsUTF8(); }
+
+ // returns n copies of ch encoded in UTF-8 string
+ static wxCharBuffer EncodeNChars(size_t n, const wxUniChar& ch);
+
+ // returns the length of UTF-8 encoding of the character with lead byte 'c'
+ static size_t GetUtf8CharLength(char c)
+ {
+ wxASSERT( IsValidUtf8LeadByte(c) );
+ return ms_utf8IterTable[(unsigned char)c];
+ }
+
+ // decodes single UTF-8 character from UTF-8 string
+ static wxUniChar DecodeChar(wxStringImpl::const_iterator i)
+ {
+ if ( (unsigned char)*i < 0x80 )
+ return (int)*i;
+ return DecodeNonAsciiChar(i);
+ }
+
+private:
+ static wxUniChar DecodeNonAsciiChar(wxStringImpl::const_iterator i);
+};
+#endif // wxUSE_UNICODE_UTF8
+
+
+#if wxUSE_UNICODE_UTF8
+typedef wxStringOperationsUtf8 wxStringOperations;
+#else
+typedef wxStringOperationsWchar wxStringOperations;
+#endif
+
+#endif // _WX_WXSTRINGOPS_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/strvararg.h
+// Purpose: macros for implementing type-safe vararg passing of strings
+// Author: Vaclav Slavik
+// Created: 2007-02-19
+// Copyright: (c) 2007 REA Elektronik GmbH
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_STRVARARG_H_
+#define _WX_STRVARARG_H_
+
+#include "wx/platform.h"
+#if wxONLY_WATCOM_EARLIER_THAN(1,4)
+ #error "OpenWatcom version >= 1.4 is required to compile this code"
+#endif
+
+#include "wx/cpp.h"
+#include "wx/chartype.h"
+#include "wx/strconv.h"
+#include "wx/buffer.h"
+#include "wx/unichar.h"
+
+#if defined(HAVE_TYPE_TRAITS)
+ #include <type_traits>
+#elif defined(HAVE_TR1_TYPE_TRAITS)
+ #ifdef __VISUALC__
+ #include <type_traits>
+ #else
+ #include <tr1/type_traits>
+ #endif
+#endif
+
+class WXDLLIMPEXP_FWD_BASE wxCStrData;
+class WXDLLIMPEXP_FWD_BASE wxString;
+
+// ----------------------------------------------------------------------------
+// WX_DEFINE_VARARG_FUNC* macros
+// ----------------------------------------------------------------------------
+
+// This macro is used to implement type-safe wrappers for variadic functions
+// that accept strings as arguments. This makes it possible to pass char*,
+// wchar_t* or even wxString (as opposed to having to use wxString::c_str())
+// to e.g. wxPrintf().
+//
+// This is done by defining a set of N template function taking 1..N arguments
+// (currently, N is set to 30 in this header). These functions are just thin
+// wrappers around another variadic function ('impl' or 'implUtf8' arguments,
+// see below) and the only thing the wrapper does is that it normalizes the
+// arguments passed in so that they are of the type expected by variadic
+// functions taking string arguments, i.e., char* or wchar_t*, depending on the
+// build:
+// * char* in the current locale's charset in ANSI build
+// * char* with UTF-8 encoding if wxUSE_UNICODE_UTF8 and the app is running
+// under an UTF-8 locale
+// * wchar_t* if wxUSE_UNICODE_WCHAR or if wxUSE_UNICODE_UTF8 and the current
+// locale is not UTF-8
+//
+// Note that wxFormatString *must* be used for the format parameter of these
+// functions, otherwise the implementation won't work correctly. Furthermore,
+// it must be passed by value, not reference, because it's modified by the
+// vararg templates internally.
+//
+// Parameters:
+// [ there are examples in square brackets showing values of the parameters
+// for the wxFprintf() wrapper for fprintf() function with the following
+// prototype:
+// int wxFprintf(FILE *stream, const wxString& format, ...); ]
+//
+// rettype Functions' return type [int]
+// name Name of the function [fprintf]
+// numfixed The number of leading "fixed" (i.e., not variadic)
+// arguments of the function (e.g. "stream" and "format"
+// arguments of fprintf()); their type is _not_ converted
+// using wxArgNormalizer<T>, unlike the rest of
+// the function's arguments [2]
+// fixed List of types of the leading "fixed" arguments, in
+// parenthesis [(FILE*,const wxString&)]
+// impl Name of the variadic function that implements 'name' for
+// the native strings representation (wchar_t* if
+// wxUSE_UNICODE_WCHAR or wxUSE_UNICODE_UTF8 when running under
+// non-UTF8 locale, char* in ANSI build) [wxCrt_Fprintf]
+// implUtf8 Like 'impl', but for the UTF-8 char* version to be used
+// if wxUSE_UNICODE_UTF8 and running under UTF-8 locale
+// (ignored otherwise) [fprintf]
+//
+#define WX_DEFINE_VARARG_FUNC(rettype, name, numfixed, fixed, impl, implUtf8) \
+ _WX_VARARG_DEFINE_FUNC_N0(rettype, name, impl, implUtf8, numfixed, fixed) \
+ WX_DEFINE_VARARG_FUNC_SANS_N0(rettype, name, numfixed, fixed, impl, implUtf8)
+
+// ditto, but without the version with 0 template/vararg arguments
+#define WX_DEFINE_VARARG_FUNC_SANS_N0(rettype, name, \
+ numfixed, fixed, impl, implUtf8) \
+ _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \
+ _WX_VARARG_DEFINE_FUNC, \
+ rettype, name, impl, implUtf8, numfixed, fixed)
+
+// Like WX_DEFINE_VARARG_FUNC, but for variadic functions that don't return
+// a value.
+#define WX_DEFINE_VARARG_FUNC_VOID(name, numfixed, fixed, impl, implUtf8) \
+ _WX_VARARG_DEFINE_FUNC_VOID_N0(name, impl, implUtf8, numfixed, fixed) \
+ _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \
+ _WX_VARARG_DEFINE_FUNC_VOID, \
+ void, name, impl, implUtf8, numfixed, fixed)
+
+// Like WX_DEFINE_VARARG_FUNC_VOID, but instead of wrapping an implementation
+// function, does nothing in defined functions' bodies.
+//
+// Used to implement wxLogXXX functions if wxUSE_LOG=0.
+#define WX_DEFINE_VARARG_FUNC_NOP(name, numfixed, fixed) \
+ _WX_VARARG_DEFINE_FUNC_NOP_N0(name, numfixed, fixed) \
+ _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \
+ _WX_VARARG_DEFINE_FUNC_NOP, \
+ void, name, dummy, dummy, numfixed, fixed)
+
+// Like WX_DEFINE_VARARG_FUNC_CTOR, but for defining template constructors
+#define WX_DEFINE_VARARG_FUNC_CTOR(name, numfixed, fixed, impl, implUtf8) \
+ _WX_VARARG_DEFINE_FUNC_CTOR_N0(name, impl, implUtf8, numfixed, fixed) \
+ _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \
+ _WX_VARARG_DEFINE_FUNC_CTOR, \
+ void, name, impl, implUtf8, numfixed, fixed)
+
+
+// ----------------------------------------------------------------------------
+// wxFormatString
+// ----------------------------------------------------------------------------
+
+// This class must be used for format string argument of the functions
+// defined using WX_DEFINE_VARARG_FUNC_* macros. It converts the string to
+// char* or wchar_t* for passing to implementation function efficiently (i.e.
+// without keeping the converted string in memory for longer than necessary,
+// like c_str()). It also converts format string to the correct form that
+// accounts for string changes done by wxArgNormalizer<>
+//
+// Note that this class can _only_ be used for function arguments!
+class WXDLLIMPEXP_BASE wxFormatString
+{
+public:
+ wxFormatString(const char *str)
+ : m_char(wxScopedCharBuffer::CreateNonOwned(str)), m_str(NULL), m_cstr(NULL) {}
+ wxFormatString(const wchar_t *str)
+ : m_wchar(wxScopedWCharBuffer::CreateNonOwned(str)), m_str(NULL), m_cstr(NULL) {}
+ wxFormatString(const wxString& str)
+ : m_str(&str), m_cstr(NULL) {}
+ wxFormatString(const wxCStrData& str)
+ : m_str(NULL), m_cstr(&str) {}
+ wxFormatString(const wxScopedCharBuffer& str)
+ : m_char(str), m_str(NULL), m_cstr(NULL) {}
+ wxFormatString(const wxScopedWCharBuffer& str)
+ : m_wchar(str), m_str(NULL), m_cstr(NULL) {}
+
+ // Possible argument types. These are or-combinable for wxASSERT_ARG_TYPE
+ // convenience. Some of the values are or-combined with another value, this
+ // expresses "supertypes" for use with wxASSERT_ARG_TYPE masks. For example,
+ // a char* string is also a pointer and an integer is also a char.
+ enum ArgumentType
+ {
+ Arg_Char = 0x0001, // character as char %c
+ Arg_Pointer = 0x0002, // %p
+ Arg_String = 0x0004 | Arg_Pointer, // any form of string (%s and %p too)
+
+ Arg_Int = 0x0008 | Arg_Char, // (ints can be used with %c)
+#if SIZEOF_INT == SIZEOF_LONG
+ Arg_LongInt = Arg_Int,
+#else
+ Arg_LongInt = 0x0010,
+#endif
+#if defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG == SIZEOF_LONG
+ Arg_LongLongInt = Arg_LongInt,
+#elif defined(wxLongLong_t)
+ Arg_LongLongInt = 0x0020,
+#endif
+
+ Arg_Double = 0x0040,
+ Arg_LongDouble = 0x0080,
+
+#if defined(wxSIZE_T_IS_UINT)
+ Arg_Size_t = Arg_Int,
+#elif defined(wxSIZE_T_IS_ULONG)
+ Arg_Size_t = Arg_LongInt,
+#elif defined(SIZEOF_LONG_LONG) && SIZEOF_SIZE_T == SIZEOF_LONG_LONG
+ Arg_Size_t = Arg_LongLongInt,
+#else
+ Arg_Size_t = 0x0100,
+#endif
+
+ Arg_IntPtr = 0x0200, // %n -- store # of chars written
+ Arg_ShortIntPtr = 0x0400,
+ Arg_LongIntPtr = 0x0800,
+
+ Arg_Unknown = 0x8000 // unrecognized specifier (likely error)
+ };
+
+ // returns the type of format specifier for n-th variadic argument (this is
+ // not necessarily n-th format specifier if positional specifiers are used);
+ // called by wxArgNormalizer<> specializations to get information about
+ // n-th variadic argument desired representation
+ ArgumentType GetArgumentType(unsigned n) const;
+
+ // returns the value passed to ctor, only converted to wxString, similarly
+ // to other InputAsXXX() methods
+ wxString InputAsString() const;
+
+#if !wxUSE_UNICODE_WCHAR
+ operator const char*() const
+ { return const_cast<wxFormatString*>(this)->AsChar(); }
+private:
+ // InputAsChar() returns the value passed to ctor, only converted
+ // to char, while AsChar() takes the string returned by InputAsChar()
+ // and does format string conversion on it as well (and similarly for
+ // ..AsWChar() below)
+ const char* InputAsChar();
+ const char* AsChar();
+ wxScopedCharBuffer m_convertedChar;
+#endif // !wxUSE_UNICODE_WCHAR
+
+#if wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY
+public:
+ operator const wchar_t*() const
+ { return const_cast<wxFormatString*>(this)->AsWChar(); }
+private:
+ const wchar_t* InputAsWChar();
+ const wchar_t* AsWChar();
+ wxScopedWCharBuffer m_convertedWChar;
+#endif // wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY
+
+private:
+ wxScopedCharBuffer m_char;
+ wxScopedWCharBuffer m_wchar;
+
+ // NB: we can use a pointer here, because wxFormatString is only used
+ // as function argument, so it has shorter life than the string
+ // passed to the ctor
+ const wxString * const m_str;
+ const wxCStrData * const m_cstr;
+
+ wxDECLARE_NO_ASSIGN_CLASS(wxFormatString);
+};
+
+// these two helper classes are used to find wxFormatString argument among fixed
+// arguments passed to a vararg template
+struct wxFormatStringArgument
+{
+ wxFormatStringArgument(const wxFormatString *s = NULL) : m_str(s) {}
+ const wxFormatString *m_str;
+
+ // overriding this operator allows us to reuse _WX_VARARG_JOIN macro
+ wxFormatStringArgument operator,(const wxFormatStringArgument& a) const
+ {
+ wxASSERT_MSG( m_str == NULL || a.m_str == NULL,
+ "can't have two format strings in vararg function" );
+ return wxFormatStringArgument(m_str ? m_str : a.m_str);
+ }
+
+ operator const wxFormatString*() const { return m_str; }
+};
+
+template<typename T>
+struct wxFormatStringArgumentFinder
+{
+ static wxFormatStringArgument find(T)
+ {
+ // by default, arguments are not format strings, so return "not found"
+ return wxFormatStringArgument();
+ }
+};
+
+template<>
+struct wxFormatStringArgumentFinder<const wxFormatString&>
+{
+ static wxFormatStringArgument find(const wxFormatString& arg)
+ { return wxFormatStringArgument(&arg); }
+};
+
+template<>
+struct wxFormatStringArgumentFinder<wxFormatString>
+ : public wxFormatStringArgumentFinder<const wxFormatString&> {};
+
+// avoid passing big objects by value to wxFormatStringArgumentFinder::find()
+// (and especially wx[W]CharBuffer with its auto_ptr<> style semantics!):
+template<>
+struct wxFormatStringArgumentFinder<wxString>
+ : public wxFormatStringArgumentFinder<const wxString&> {};
+
+template<>
+struct wxFormatStringArgumentFinder<wxScopedCharBuffer>
+ : public wxFormatStringArgumentFinder<const wxScopedCharBuffer&> {};
+
+template<>
+struct wxFormatStringArgumentFinder<wxScopedWCharBuffer>
+ : public wxFormatStringArgumentFinder<const wxScopedWCharBuffer&> {};
+
+template<>
+struct wxFormatStringArgumentFinder<wxCharBuffer>
+ : public wxFormatStringArgumentFinder<const wxCharBuffer&> {};
+
+template<>
+struct wxFormatStringArgumentFinder<wxWCharBuffer>
+ : public wxFormatStringArgumentFinder<const wxWCharBuffer&> {};
+
+
+// ----------------------------------------------------------------------------
+// wxArgNormalizer*<T> converters
+// ----------------------------------------------------------------------------
+
+#if wxDEBUG_LEVEL
+ // Check that the format specifier for index-th argument in 'fmt' has
+ // the correct type (one of wxFormatString::Arg_XXX or-combination in
+ // 'expected_mask').
+ #define wxASSERT_ARG_TYPE(fmt, index, expected_mask) \
+ wxSTATEMENT_MACRO_BEGIN \
+ if ( !fmt ) \
+ break; \
+ const int argtype = fmt->GetArgumentType(index); \
+ wxASSERT_MSG( (argtype & (expected_mask)) == argtype, \
+ "format specifier doesn't match argument type" ); \
+ wxSTATEMENT_MACRO_END
+#else
+ // Just define it to suppress "unused parameter" warnings for the
+ // parameters which we don't use otherwise
+ #define wxASSERT_ARG_TYPE(fmt, index, expected_mask) \
+ wxUnusedVar(fmt); \
+ wxUnusedVar(index)
+#endif // wxDEBUG_LEVEL/!wxDEBUG_LEVEL
+
+
+#if defined(HAVE_TYPE_TRAITS) || defined(HAVE_TR1_TYPE_TRAITS)
+
+// Note: this type is misnamed, so that the error message is easier to
+// understand (no error happens for enums, because the IsEnum=true case is
+// specialized).
+template<bool IsEnum>
+struct wxFormatStringSpecifierNonPodType {};
+
+template<>
+struct wxFormatStringSpecifierNonPodType<true>
+{
+ enum { value = wxFormatString::Arg_Int };
+};
+
+template<typename T>
+struct wxFormatStringSpecifier
+{
+#ifdef HAVE_TYPE_TRAITS
+ typedef std::is_enum<T> is_enum;
+#elif defined HAVE_TR1_TYPE_TRAITS
+ typedef std::tr1::is_enum<T> is_enum;
+#endif
+ enum { value = wxFormatStringSpecifierNonPodType<is_enum::value>::value };
+};
+
+#else // !HAVE_(TR1_)TYPE_TRAITS
+
+template<typename T>
+struct wxFormatStringSpecifier
+{
+ // We can't detect enums without is_enum, so the only thing we can
+ // do is to accept unknown types. However, the only acceptable unknown
+ // types still are enums, which are promoted to ints, so return Arg_Int
+ // here. This will at least catch passing of non-POD types through ... at
+ // runtime.
+ //
+ // Furthermore, if the compiler doesn't have partial template
+ // specialization, we didn't cover pointers either.
+#ifdef HAVE_PARTIAL_SPECIALIZATION
+ enum { value = wxFormatString::Arg_Int };
+#else
+ enum { value = wxFormatString::Arg_Int | wxFormatString::Arg_Pointer };
+#endif
+};
+
+#endif // HAVE_TR1_TYPE_TRAITS/!HAVE_TR1_TYPE_TRAITS
+
+
+#ifdef HAVE_PARTIAL_SPECIALIZATION
+template<typename T>
+struct wxFormatStringSpecifier<T*>
+{
+ enum { value = wxFormatString::Arg_Pointer };
+};
+
+template<typename T>
+struct wxFormatStringSpecifier<const T*>
+{
+ enum { value = wxFormatString::Arg_Pointer };
+};
+#endif // !HAVE_PARTIAL_SPECIALIZATION
+
+
+#define wxFORMAT_STRING_SPECIFIER(T, arg) \
+ template<> struct wxFormatStringSpecifier<T> \
+ { \
+ enum { value = arg }; \
+ };
+
+wxFORMAT_STRING_SPECIFIER(bool, wxFormatString::Arg_Int)
+wxFORMAT_STRING_SPECIFIER(int, wxFormatString::Arg_Int)
+wxFORMAT_STRING_SPECIFIER(unsigned int, wxFormatString::Arg_Int)
+wxFORMAT_STRING_SPECIFIER(short int, wxFormatString::Arg_Int)
+wxFORMAT_STRING_SPECIFIER(short unsigned int, wxFormatString::Arg_Int)
+wxFORMAT_STRING_SPECIFIER(long int, wxFormatString::Arg_LongInt)
+wxFORMAT_STRING_SPECIFIER(long unsigned int, wxFormatString::Arg_LongInt)
+#ifdef wxLongLong_t
+wxFORMAT_STRING_SPECIFIER(wxLongLong_t, wxFormatString::Arg_LongLongInt)
+wxFORMAT_STRING_SPECIFIER(wxULongLong_t, wxFormatString::Arg_LongLongInt)
+#endif
+wxFORMAT_STRING_SPECIFIER(float, wxFormatString::Arg_Double)
+wxFORMAT_STRING_SPECIFIER(double, wxFormatString::Arg_Double)
+wxFORMAT_STRING_SPECIFIER(long double, wxFormatString::Arg_LongDouble)
+
+#if wxWCHAR_T_IS_REAL_TYPE
+wxFORMAT_STRING_SPECIFIER(wchar_t, wxFormatString::Arg_Char | wxFormatString::Arg_Int)
+#endif
+
+#if !wxUSE_UNICODE
+wxFORMAT_STRING_SPECIFIER(char, wxFormatString::Arg_Char | wxFormatString::Arg_Int)
+wxFORMAT_STRING_SPECIFIER(signed char, wxFormatString::Arg_Char | wxFormatString::Arg_Int)
+wxFORMAT_STRING_SPECIFIER(unsigned char, wxFormatString::Arg_Char | wxFormatString::Arg_Int)
+#endif
+
+wxFORMAT_STRING_SPECIFIER(char*, wxFormatString::Arg_String)
+wxFORMAT_STRING_SPECIFIER(unsigned char*, wxFormatString::Arg_String)
+wxFORMAT_STRING_SPECIFIER(signed char*, wxFormatString::Arg_String)
+wxFORMAT_STRING_SPECIFIER(const char*, wxFormatString::Arg_String)
+wxFORMAT_STRING_SPECIFIER(const unsigned char*, wxFormatString::Arg_String)
+wxFORMAT_STRING_SPECIFIER(const signed char*, wxFormatString::Arg_String)
+wxFORMAT_STRING_SPECIFIER(wchar_t*, wxFormatString::Arg_String)
+wxFORMAT_STRING_SPECIFIER(const wchar_t*, wxFormatString::Arg_String)
+
+wxFORMAT_STRING_SPECIFIER(int*, wxFormatString::Arg_IntPtr | wxFormatString::Arg_Pointer)
+wxFORMAT_STRING_SPECIFIER(short int*, wxFormatString::Arg_ShortIntPtr | wxFormatString::Arg_Pointer)
+wxFORMAT_STRING_SPECIFIER(long int*, wxFormatString::Arg_LongIntPtr | wxFormatString::Arg_Pointer)
+
+#undef wxFORMAT_STRING_SPECIFIER
+
+
+// Converts an argument passed to wxPrint etc. into standard form expected,
+// by wxXXX functions, e.g. all strings (wxString, char*, wchar_t*) are
+// converted into wchar_t* or char* depending on the build.
+template<typename T>
+struct wxArgNormalizer
+{
+ // Ctor. 'value' is the value passed as variadic argument, 'fmt' is pointer
+ // to printf-like format string or NULL if the variadic function doesn't
+ // use format string and 'index' is index of 'value' in variadic arguments
+ // list (starting at 1)
+ wxArgNormalizer(T value,
+ const wxFormatString *fmt, unsigned index)
+ : m_value(value)
+ {
+ wxASSERT_ARG_TYPE( fmt, index, wxFormatStringSpecifier<T>::value );
+ }
+
+ // Returns the value in a form that can be safely passed to real vararg
+ // functions. In case of strings, this is char* in ANSI build and wchar_t*
+ // in Unicode build.
+ T get() const { return m_value; }
+
+ T m_value;
+};
+
+// normalizer for passing arguments to functions working with wchar_t* (and
+// until ANSI build is removed, char* in ANSI build as well - FIXME-UTF8)
+// string representation
+#if !wxUSE_UTF8_LOCALE_ONLY
+template<typename T>
+struct wxArgNormalizerWchar : public wxArgNormalizer<T>
+{
+ wxArgNormalizerWchar(T value,
+ const wxFormatString *fmt, unsigned index)
+ : wxArgNormalizer<T>(value, fmt, index) {}
+};
+#endif // !wxUSE_UTF8_LOCALE_ONLY
+
+// normalizer for passing arguments to functions working with UTF-8 encoded
+// char* strings
+#if wxUSE_UNICODE_UTF8
+ template<typename T>
+ struct wxArgNormalizerUtf8 : public wxArgNormalizer<T>
+ {
+ wxArgNormalizerUtf8(T value,
+ const wxFormatString *fmt, unsigned index)
+ : wxArgNormalizer<T>(value, fmt, index) {}
+ };
+
+ #define wxArgNormalizerNative wxArgNormalizerUtf8
+#else // wxUSE_UNICODE_WCHAR
+ #define wxArgNormalizerNative wxArgNormalizerWchar
+#endif // wxUSE_UNICODE_UTF8 // wxUSE_UNICODE_UTF8
+
+
+
+// special cases for converting strings:
+
+
+// base class for wxArgNormalizer<T> specializations that need to do conversion;
+// CharType is either wxStringCharType or wchar_t in UTF-8 build when wrapping
+// widechar CRT function
+template<typename CharType>
+struct wxArgNormalizerWithBuffer
+{
+ typedef wxScopedCharTypeBuffer<CharType> CharBuffer;
+
+ wxArgNormalizerWithBuffer() {}
+ wxArgNormalizerWithBuffer(const CharBuffer& buf,
+ const wxFormatString *fmt,
+ unsigned index)
+ : m_value(buf)
+ {
+ wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_String );
+ }
+
+ const CharType *get() const { return m_value; }
+
+ CharBuffer m_value;
+};
+
+// string objects:
+template<>
+struct WXDLLIMPEXP_BASE wxArgNormalizerNative<const wxString&>
+{
+ wxArgNormalizerNative(const wxString& s,
+ const wxFormatString *fmt,
+ unsigned index)
+ : m_value(s)
+ {
+ wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_String );
+ }
+
+ const wxStringCharType *get() const;
+
+ const wxString& m_value;
+};
+
+// c_str() values:
+template<>
+struct WXDLLIMPEXP_BASE wxArgNormalizerNative<const wxCStrData&>
+{
+ wxArgNormalizerNative(const wxCStrData& value,
+ const wxFormatString *fmt,
+ unsigned index)
+ : m_value(value)
+ {
+ wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_String );
+ }
+
+ const wxStringCharType *get() const;
+
+ const wxCStrData& m_value;
+};
+
+// wxString/wxCStrData conversion to wchar_t* value
+#if wxUSE_UNICODE_UTF8 && !wxUSE_UTF8_LOCALE_ONLY
+template<>
+struct WXDLLIMPEXP_BASE wxArgNormalizerWchar<const wxString&>
+ : public wxArgNormalizerWithBuffer<wchar_t>
+{
+ wxArgNormalizerWchar(const wxString& s,
+ const wxFormatString *fmt, unsigned index);
+};
+
+template<>
+struct WXDLLIMPEXP_BASE wxArgNormalizerWchar<const wxCStrData&>
+ : public wxArgNormalizerWithBuffer<wchar_t>
+{
+ wxArgNormalizerWchar(const wxCStrData& s,
+ const wxFormatString *fmt, unsigned index);
+};
+#endif // wxUSE_UNICODE_UTF8 && !wxUSE_UTF8_LOCALE_ONLY
+
+
+// C string pointers of the wrong type (wchar_t* for ANSI or UTF8 build,
+// char* for wchar_t Unicode build or UTF8):
+#if wxUSE_UNICODE_WCHAR
+
+template<>
+struct wxArgNormalizerWchar<const char*>
+ : public wxArgNormalizerWithBuffer<wchar_t>
+{
+ wxArgNormalizerWchar(const char* s,
+ const wxFormatString *fmt, unsigned index)
+ : wxArgNormalizerWithBuffer<wchar_t>(wxConvLibc.cMB2WC(s), fmt, index) {}
+};
+
+#elif wxUSE_UNICODE_UTF8
+
+template<>
+struct wxArgNormalizerUtf8<const wchar_t*>
+ : public wxArgNormalizerWithBuffer<char>
+{
+ wxArgNormalizerUtf8(const wchar_t* s,
+ const wxFormatString *fmt, unsigned index)
+ : wxArgNormalizerWithBuffer<char>(wxConvUTF8.cWC2MB(s), fmt, index) {}
+};
+
+template<>
+struct wxArgNormalizerUtf8<const char*>
+ : public wxArgNormalizerWithBuffer<char>
+{
+ wxArgNormalizerUtf8(const char* s,
+ const wxFormatString *fmt,
+ unsigned index)
+ {
+ wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_String );
+
+ if ( wxLocaleIsUtf8 )
+ {
+ m_value = wxScopedCharBuffer::CreateNonOwned(s);
+ }
+ else
+ {
+ // convert to widechar string first:
+ wxScopedWCharBuffer buf(wxConvLibc.cMB2WC(s));
+
+ // then to UTF-8:
+ if ( buf )
+ m_value = wxConvUTF8.cWC2MB(buf);
+ }
+ }
+};
+
+// UTF-8 build needs conversion to wchar_t* too:
+#if !wxUSE_UTF8_LOCALE_ONLY
+template<>
+struct wxArgNormalizerWchar<const char*>
+ : public wxArgNormalizerWithBuffer<wchar_t>
+{
+ wxArgNormalizerWchar(const char* s,
+ const wxFormatString *fmt, unsigned index)
+ : wxArgNormalizerWithBuffer<wchar_t>(wxConvLibc.cMB2WC(s), fmt, index) {}
+};
+#endif // !wxUSE_UTF8_LOCALE_ONLY
+
+#else // ANSI - FIXME-UTF8
+
+template<>
+struct wxArgNormalizerWchar<const wchar_t*>
+ : public wxArgNormalizerWithBuffer<char>
+{
+ wxArgNormalizerWchar(const wchar_t* s,
+ const wxFormatString *fmt, unsigned index)
+ : wxArgNormalizerWithBuffer<char>(wxConvLibc.cWC2MB(s), fmt, index) {}
+};
+
+#endif // wxUSE_UNICODE_WCHAR/wxUSE_UNICODE_UTF8/ANSI
+
+
+// this macro is used to implement specialization that are exactly same as
+// some other specialization, i.e. to "forward" the implementation (e.g. for
+// T=wxString and T=const wxString&). Note that the ctor takes BaseT argument,
+// not T!
+#if wxUSE_UNICODE_UTF8
+ #if wxUSE_UTF8_LOCALE_ONLY
+ #define WX_ARG_NORMALIZER_FORWARD(T, BaseT) \
+ _WX_ARG_NORMALIZER_FORWARD_IMPL(wxArgNormalizerUtf8, T, BaseT)
+ #else // possibly non-UTF8 locales
+ #define WX_ARG_NORMALIZER_FORWARD(T, BaseT) \
+ _WX_ARG_NORMALIZER_FORWARD_IMPL(wxArgNormalizerWchar, T, BaseT); \
+ _WX_ARG_NORMALIZER_FORWARD_IMPL(wxArgNormalizerUtf8, T, BaseT)
+ #endif
+#else // wxUSE_UNICODE_WCHAR
+ #define WX_ARG_NORMALIZER_FORWARD(T, BaseT) \
+ _WX_ARG_NORMALIZER_FORWARD_IMPL(wxArgNormalizerWchar, T, BaseT)
+#endif // wxUSE_UNICODE_UTF8/wxUSE_UNICODE_WCHAR
+
+#define _WX_ARG_NORMALIZER_FORWARD_IMPL(Normalizer, T, BaseT) \
+ template<> \
+ struct Normalizer<T> : public Normalizer<BaseT> \
+ { \
+ Normalizer(BaseT value, \
+ const wxFormatString *fmt, unsigned index) \
+ : Normalizer<BaseT>(value, fmt, index) {} \
+ }
+
+// non-reference versions of specializations for string objects
+WX_ARG_NORMALIZER_FORWARD(wxString, const wxString&);
+WX_ARG_NORMALIZER_FORWARD(wxCStrData, const wxCStrData&);
+
+// versions for passing non-const pointers:
+WX_ARG_NORMALIZER_FORWARD(char*, const char*);
+WX_ARG_NORMALIZER_FORWARD(wchar_t*, const wchar_t*);
+
+// versions for passing wx[W]CharBuffer:
+WX_ARG_NORMALIZER_FORWARD(wxScopedCharBuffer, const char*);
+WX_ARG_NORMALIZER_FORWARD(const wxScopedCharBuffer&, const char*);
+WX_ARG_NORMALIZER_FORWARD(wxScopedWCharBuffer, const wchar_t*);
+WX_ARG_NORMALIZER_FORWARD(const wxScopedWCharBuffer&, const wchar_t*);
+WX_ARG_NORMALIZER_FORWARD(wxCharBuffer, const char*);
+WX_ARG_NORMALIZER_FORWARD(const wxCharBuffer&, const char*);
+WX_ARG_NORMALIZER_FORWARD(wxWCharBuffer, const wchar_t*);
+WX_ARG_NORMALIZER_FORWARD(const wxWCharBuffer&, const wchar_t*);
+
+// versions for std::[w]string:
+#if wxUSE_STD_STRING
+
+#include "wx/stringimpl.h"
+
+#if !wxUSE_UTF8_LOCALE_ONLY
+template<>
+struct wxArgNormalizerWchar<const std::string&>
+ : public wxArgNormalizerWchar<const char*>
+{
+ wxArgNormalizerWchar(const std::string& s,
+ const wxFormatString *fmt, unsigned index)
+ : wxArgNormalizerWchar<const char*>(s.c_str(), fmt, index) {}
+};
+
+template<>
+struct wxArgNormalizerWchar<const wxStdWideString&>
+ : public wxArgNormalizerWchar<const wchar_t*>
+{
+ wxArgNormalizerWchar(const wxStdWideString& s,
+ const wxFormatString *fmt, unsigned index)
+ : wxArgNormalizerWchar<const wchar_t*>(s.c_str(), fmt, index) {}
+};
+#endif // !wxUSE_UTF8_LOCALE_ONLY
+
+#if wxUSE_UNICODE_UTF8
+template<>
+struct wxArgNormalizerUtf8<const std::string&>
+ : public wxArgNormalizerUtf8<const char*>
+{
+ wxArgNormalizerUtf8(const std::string& s,
+ const wxFormatString *fmt, unsigned index)
+ : wxArgNormalizerUtf8<const char*>(s.c_str(), fmt, index) {}
+};
+
+template<>
+struct wxArgNormalizerUtf8<const wxStdWideString&>
+ : public wxArgNormalizerUtf8<const wchar_t*>
+{
+ wxArgNormalizerUtf8(const wxStdWideString& s,
+ const wxFormatString *fmt, unsigned index)
+ : wxArgNormalizerUtf8<const wchar_t*>(s.c_str(), fmt, index) {}
+};
+#endif // wxUSE_UNICODE_UTF8
+
+WX_ARG_NORMALIZER_FORWARD(std::string, const std::string&);
+WX_ARG_NORMALIZER_FORWARD(wxStdWideString, const wxStdWideString&);
+
+#endif // wxUSE_STD_STRING
+
+
+// versions for wxUniChar, wxUniCharRef:
+// (this is same for UTF-8 and Wchar builds, we just convert to wchar_t)
+template<>
+struct wxArgNormalizer<const wxUniChar&> : public wxArgNormalizer<wchar_t>
+{
+ wxArgNormalizer(const wxUniChar& s,
+ const wxFormatString *fmt, unsigned index)
+ : wxArgNormalizer<wchar_t>(wx_truncate_cast(wchar_t, s.GetValue()), fmt, index) {}
+};
+
+// for wchar_t, default handler does the right thing
+
+// char has to be treated differently in Unicode builds: a char argument may
+// be used either for a character value (which should be converted into
+// wxUniChar) or as an integer value (which should be left as-is). We take
+// advantage of the fact that both char and wchar_t are converted into int
+// in variadic arguments here.
+#if wxUSE_UNICODE
+template<typename T>
+struct wxArgNormalizerNarrowChar
+{
+ wxArgNormalizerNarrowChar(T value,
+ const wxFormatString *fmt, unsigned index)
+ {
+ wxASSERT_ARG_TYPE( fmt, index,
+ wxFormatString::Arg_Char | wxFormatString::Arg_Int );
+
+ // FIXME-UTF8: which one is better default in absence of fmt string
+ // (i.e. when used like e.g. Foo("foo", "bar", 'c', NULL)?
+ if ( !fmt || fmt->GetArgumentType(index) == wxFormatString::Arg_Char )
+ m_value = wx_truncate_cast(T, wxUniChar(value).GetValue());
+ else
+ m_value = value;
+ }
+
+ int get() const { return m_value; }
+
+ T m_value;
+};
+
+template<>
+struct wxArgNormalizer<char> : public wxArgNormalizerNarrowChar<char>
+{
+ wxArgNormalizer(char value,
+ const wxFormatString *fmt, unsigned index)
+ : wxArgNormalizerNarrowChar<char>(value, fmt, index) {}
+};
+
+template<>
+struct wxArgNormalizer<unsigned char>
+ : public wxArgNormalizerNarrowChar<unsigned char>
+{
+ wxArgNormalizer(unsigned char value,
+ const wxFormatString *fmt, unsigned index)
+ : wxArgNormalizerNarrowChar<unsigned char>(value, fmt, index) {}
+};
+
+template<>
+struct wxArgNormalizer<signed char>
+ : public wxArgNormalizerNarrowChar<signed char>
+{
+ wxArgNormalizer(signed char value,
+ const wxFormatString *fmt, unsigned index)
+ : wxArgNormalizerNarrowChar<signed char>(value, fmt, index) {}
+};
+
+#endif // wxUSE_UNICODE
+
+// convert references:
+WX_ARG_NORMALIZER_FORWARD(wxUniChar, const wxUniChar&);
+WX_ARG_NORMALIZER_FORWARD(const wxUniCharRef&, const wxUniChar&);
+WX_ARG_NORMALIZER_FORWARD(wxUniCharRef, const wxUniChar&);
+WX_ARG_NORMALIZER_FORWARD(const wchar_t&, wchar_t);
+
+WX_ARG_NORMALIZER_FORWARD(const char&, char);
+WX_ARG_NORMALIZER_FORWARD(const unsigned char&, unsigned char);
+WX_ARG_NORMALIZER_FORWARD(const signed char&, signed char);
+
+
+#undef WX_ARG_NORMALIZER_FORWARD
+#undef _WX_ARG_NORMALIZER_FORWARD_IMPL
+
+// NB: Don't #undef wxASSERT_ARG_TYPE here as it's also used in wx/longlong.h.
+
+// ----------------------------------------------------------------------------
+// WX_VA_ARG_STRING
+// ----------------------------------------------------------------------------
+
+// Replacement for va_arg() for use with strings in functions that accept
+// strings normalized by wxArgNormalizer<T>:
+
+struct WXDLLIMPEXP_BASE wxArgNormalizedString
+{
+ wxArgNormalizedString(const void* ptr) : m_ptr(ptr) {}
+
+ // returns true if non-NULL string was passed in
+ bool IsValid() const { return m_ptr != NULL; }
+ operator bool() const { return IsValid(); }
+
+ // extracts the string, returns empty string if NULL was passed in
+ wxString GetString() const;
+ operator wxString() const;
+
+private:
+ const void *m_ptr;
+};
+
+#define WX_VA_ARG_STRING(ap) wxArgNormalizedString(va_arg(ap, const void*))
+
+// ----------------------------------------------------------------------------
+// implementation of the WX_DEFINE_VARARG_* macros
+// ----------------------------------------------------------------------------
+
+// NB: The vararg emulation code is limited to 30 variadic and 4 fixed
+// arguments at the moment.
+// If you need more variadic arguments, you need to
+// 1) increase the value of _WX_VARARG_MAX_ARGS
+// 2) add _WX_VARARG_JOIN_* and _WX_VARARG_ITER_* up to the new
+// _WX_VARARG_MAX_ARGS value to the lists below
+// If you need more fixed arguments, you need to
+// 1) increase the value of _WX_VARARG_MAX_FIXED_ARGS
+// 2) add _WX_VARARG_FIXED_EXPAND_* and _WX_VARARG_FIXED_UNUSED_EXPAND_*
+// macros below
+#define _WX_VARARG_MAX_ARGS 30
+#define _WX_VARARG_MAX_FIXED_ARGS 4
+
+#define _WX_VARARG_JOIN_1(m) m(1)
+#define _WX_VARARG_JOIN_2(m) _WX_VARARG_JOIN_1(m), m(2)
+#define _WX_VARARG_JOIN_3(m) _WX_VARARG_JOIN_2(m), m(3)
+#define _WX_VARARG_JOIN_4(m) _WX_VARARG_JOIN_3(m), m(4)
+#define _WX_VARARG_JOIN_5(m) _WX_VARARG_JOIN_4(m), m(5)
+#define _WX_VARARG_JOIN_6(m) _WX_VARARG_JOIN_5(m), m(6)
+#define _WX_VARARG_JOIN_7(m) _WX_VARARG_JOIN_6(m), m(7)
+#define _WX_VARARG_JOIN_8(m) _WX_VARARG_JOIN_7(m), m(8)
+#define _WX_VARARG_JOIN_9(m) _WX_VARARG_JOIN_8(m), m(9)
+#define _WX_VARARG_JOIN_10(m) _WX_VARARG_JOIN_9(m), m(10)
+#define _WX_VARARG_JOIN_11(m) _WX_VARARG_JOIN_10(m), m(11)
+#define _WX_VARARG_JOIN_12(m) _WX_VARARG_JOIN_11(m), m(12)
+#define _WX_VARARG_JOIN_13(m) _WX_VARARG_JOIN_12(m), m(13)
+#define _WX_VARARG_JOIN_14(m) _WX_VARARG_JOIN_13(m), m(14)
+#define _WX_VARARG_JOIN_15(m) _WX_VARARG_JOIN_14(m), m(15)
+#define _WX_VARARG_JOIN_16(m) _WX_VARARG_JOIN_15(m), m(16)
+#define _WX_VARARG_JOIN_17(m) _WX_VARARG_JOIN_16(m), m(17)
+#define _WX_VARARG_JOIN_18(m) _WX_VARARG_JOIN_17(m), m(18)
+#define _WX_VARARG_JOIN_19(m) _WX_VARARG_JOIN_18(m), m(19)
+#define _WX_VARARG_JOIN_20(m) _WX_VARARG_JOIN_19(m), m(20)
+#define _WX_VARARG_JOIN_21(m) _WX_VARARG_JOIN_20(m), m(21)
+#define _WX_VARARG_JOIN_22(m) _WX_VARARG_JOIN_21(m), m(22)
+#define _WX_VARARG_JOIN_23(m) _WX_VARARG_JOIN_22(m), m(23)
+#define _WX_VARARG_JOIN_24(m) _WX_VARARG_JOIN_23(m), m(24)
+#define _WX_VARARG_JOIN_25(m) _WX_VARARG_JOIN_24(m), m(25)
+#define _WX_VARARG_JOIN_26(m) _WX_VARARG_JOIN_25(m), m(26)
+#define _WX_VARARG_JOIN_27(m) _WX_VARARG_JOIN_26(m), m(27)
+#define _WX_VARARG_JOIN_28(m) _WX_VARARG_JOIN_27(m), m(28)
+#define _WX_VARARG_JOIN_29(m) _WX_VARARG_JOIN_28(m), m(29)
+#define _WX_VARARG_JOIN_30(m) _WX_VARARG_JOIN_29(m), m(30)
+
+#define _WX_VARARG_ITER_1(m,a,b,c,d,e,f) m(1,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_2(m,a,b,c,d,e,f) _WX_VARARG_ITER_1(m,a,b,c,d,e,f) m(2,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_3(m,a,b,c,d,e,f) _WX_VARARG_ITER_2(m,a,b,c,d,e,f) m(3,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_4(m,a,b,c,d,e,f) _WX_VARARG_ITER_3(m,a,b,c,d,e,f) m(4,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_5(m,a,b,c,d,e,f) _WX_VARARG_ITER_4(m,a,b,c,d,e,f) m(5,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_6(m,a,b,c,d,e,f) _WX_VARARG_ITER_5(m,a,b,c,d,e,f) m(6,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_7(m,a,b,c,d,e,f) _WX_VARARG_ITER_6(m,a,b,c,d,e,f) m(7,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_8(m,a,b,c,d,e,f) _WX_VARARG_ITER_7(m,a,b,c,d,e,f) m(8,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_9(m,a,b,c,d,e,f) _WX_VARARG_ITER_8(m,a,b,c,d,e,f) m(9,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_10(m,a,b,c,d,e,f) _WX_VARARG_ITER_9(m,a,b,c,d,e,f) m(10,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_11(m,a,b,c,d,e,f) _WX_VARARG_ITER_10(m,a,b,c,d,e,f) m(11,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_12(m,a,b,c,d,e,f) _WX_VARARG_ITER_11(m,a,b,c,d,e,f) m(12,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_13(m,a,b,c,d,e,f) _WX_VARARG_ITER_12(m,a,b,c,d,e,f) m(13,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_14(m,a,b,c,d,e,f) _WX_VARARG_ITER_13(m,a,b,c,d,e,f) m(14,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_15(m,a,b,c,d,e,f) _WX_VARARG_ITER_14(m,a,b,c,d,e,f) m(15,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_16(m,a,b,c,d,e,f) _WX_VARARG_ITER_15(m,a,b,c,d,e,f) m(16,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_17(m,a,b,c,d,e,f) _WX_VARARG_ITER_16(m,a,b,c,d,e,f) m(17,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_18(m,a,b,c,d,e,f) _WX_VARARG_ITER_17(m,a,b,c,d,e,f) m(18,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_19(m,a,b,c,d,e,f) _WX_VARARG_ITER_18(m,a,b,c,d,e,f) m(19,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_20(m,a,b,c,d,e,f) _WX_VARARG_ITER_19(m,a,b,c,d,e,f) m(20,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_21(m,a,b,c,d,e,f) _WX_VARARG_ITER_20(m,a,b,c,d,e,f) m(21,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_22(m,a,b,c,d,e,f) _WX_VARARG_ITER_21(m,a,b,c,d,e,f) m(22,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_23(m,a,b,c,d,e,f) _WX_VARARG_ITER_22(m,a,b,c,d,e,f) m(23,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_24(m,a,b,c,d,e,f) _WX_VARARG_ITER_23(m,a,b,c,d,e,f) m(24,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_25(m,a,b,c,d,e,f) _WX_VARARG_ITER_24(m,a,b,c,d,e,f) m(25,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_26(m,a,b,c,d,e,f) _WX_VARARG_ITER_25(m,a,b,c,d,e,f) m(26,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_27(m,a,b,c,d,e,f) _WX_VARARG_ITER_26(m,a,b,c,d,e,f) m(27,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_28(m,a,b,c,d,e,f) _WX_VARARG_ITER_27(m,a,b,c,d,e,f) m(28,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_29(m,a,b,c,d,e,f) _WX_VARARG_ITER_28(m,a,b,c,d,e,f) m(29,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_30(m,a,b,c,d,e,f) _WX_VARARG_ITER_29(m,a,b,c,d,e,f) m(30,a,b,c,d,e,f)
+
+
+#define _WX_VARARG_FIXED_EXPAND_1(t1) \
+ t1 f1
+#define _WX_VARARG_FIXED_EXPAND_2(t1,t2) \
+ t1 f1, t2 f2
+#define _WX_VARARG_FIXED_EXPAND_3(t1,t2,t3) \
+ t1 f1, t2 f2, t3 f3
+#define _WX_VARARG_FIXED_EXPAND_4(t1,t2,t3,t4) \
+ t1 f1, t2 f2, t3 f3, t4 f4
+
+#define _WX_VARARG_FIXED_UNUSED_EXPAND_1(t1) \
+ t1 WXUNUSED(f1)
+#define _WX_VARARG_FIXED_UNUSED_EXPAND_2(t1,t2) \
+ t1 WXUNUSED(f1), t2 WXUNUSED(f2)
+#define _WX_VARARG_FIXED_UNUSED_EXPAND_3(t1,t2,t3) \
+ t1 WXUNUSED(f1), t2 WXUNUSED(f2), t3 WXUNUSED(f3)
+#define _WX_VARARG_FIXED_UNUSED_EXPAND_4(t1,t2,t3,t4) \
+ t1 WXUNUSED(f1), t2 WXUNUSED(f2), t3 WXUNUSED(f3), t4 WXUNUSED(f4)
+
+#define _WX_VARARG_FIXED_TYPEDEFS_1(t1) \
+ typedef t1 TF1
+#define _WX_VARARG_FIXED_TYPEDEFS_2(t1,t2) \
+ _WX_VARARG_FIXED_TYPEDEFS_1(t1); typedef t2 TF2
+#define _WX_VARARG_FIXED_TYPEDEFS_3(t1,t2,t3) \
+ _WX_VARARG_FIXED_TYPEDEFS_2(t1,t2); typedef t3 TF3
+#define _WX_VARARG_FIXED_TYPEDEFS_4(t1,t2,t3,t4) \
+ _WX_VARARG_FIXED_TYPEDEFS_3(t1,t2,t3); typedef t4 TF4
+
+// This macro expands N-items tuple of fixed arguments types into part of
+// function's declaration. For example,
+// "_WX_VARARG_FIXED_EXPAND(3, (int, char*, int))" expands into
+// "int f1, char* f2, int f3".
+#define _WX_VARARG_FIXED_EXPAND(N, args) \
+ _WX_VARARG_FIXED_EXPAND_IMPL(N, args)
+#define _WX_VARARG_FIXED_EXPAND_IMPL(N, args) \
+ _WX_VARARG_FIXED_EXPAND_##N args
+
+// Ditto for unused arguments
+#define _WX_VARARG_FIXED_UNUSED_EXPAND(N, args) \
+ _WX_VARARG_FIXED_UNUSED_EXPAND_IMPL(N, args)
+#define _WX_VARARG_FIXED_UNUSED_EXPAND_IMPL(N, args) \
+ _WX_VARARG_FIXED_UNUSED_EXPAND_##N args
+
+// Declarates typedefs for fixed arguments types; i-th fixed argument types
+// will have TFi typedef.
+#define _WX_VARARG_FIXED_TYPEDEFS(N, args) \
+ _WX_VARARG_FIXED_TYPEDEFS_IMPL(N, args)
+#define _WX_VARARG_FIXED_TYPEDEFS_IMPL(N, args) \
+ _WX_VARARG_FIXED_TYPEDEFS_##N args
+
+
+// This macro calls another macro 'm' passed as second argument 'N' times,
+// with its only argument set to 1..N, and concatenates the results using
+// comma as separator.
+//
+// An example:
+// #define foo(i) x##i
+// // this expands to "x1,x2,x3,x4"
+// _WX_VARARG_JOIN(4, foo)
+//
+//
+// N must not be greater than _WX_VARARG_MAX_ARGS (=30).
+#define _WX_VARARG_JOIN(N, m) _WX_VARARG_JOIN_IMPL(N, m)
+#define _WX_VARARG_JOIN_IMPL(N, m) _WX_VARARG_JOIN_##N(m)
+
+
+// This macro calls another macro 'm' passed as second argument 'N' times, with
+// its first argument set to 1..N and the remaining arguments set to 'a', 'b',
+// 'c', 'd', 'e' and 'f'. The results are separated with whitespace in the
+// expansion.
+//
+// An example:
+// // this macro expands to:
+// // foo(1,a,b,c,d,e,f)
+// // foo(2,a,b,c,d,e,f)
+// // foo(3,a,b,c,d,e,f)
+// _WX_VARARG_ITER(3, foo, a, b, c, d, e, f)
+//
+// N must not be greater than _WX_VARARG_MAX_ARGS (=30).
+#define _WX_VARARG_ITER(N,m,a,b,c,d,e,f) \
+ _WX_VARARG_ITER_IMPL(N,m,a,b,c,d,e,f)
+#define _WX_VARARG_ITER_IMPL(N,m,a,b,c,d,e,f) \
+ _WX_VARARG_ITER_##N(m,a,b,c,d,e,f)
+
+// Generates code snippet for i-th "variadic" argument in vararg function's
+// prototype:
+#define _WX_VARARG_ARG(i) T##i a##i
+
+// Like _WX_VARARG_ARG_UNUSED, but outputs argument's type with WXUNUSED:
+#define _WX_VARARG_ARG_UNUSED(i) T##i WXUNUSED(a##i)
+
+// Generates code snippet for i-th type in vararg function's template<...>:
+#define _WX_VARARG_TEMPL(i) typename T##i
+
+// Generates code snippet for passing i-th argument of vararg function
+// wrapper to its implementation, normalizing it in the process:
+#define _WX_VARARG_PASS_WCHAR(i) \
+ wxArgNormalizerWchar<T##i>(a##i, fmt, i).get()
+#define _WX_VARARG_PASS_UTF8(i) \
+ wxArgNormalizerUtf8<T##i>(a##i, fmt, i).get()
+
+
+// And the same for fixed arguments, _not_ normalizing it:
+#define _WX_VARARG_PASS_FIXED(i) f##i
+
+#define _WX_VARARG_FIND_FMT(i) \
+ (wxFormatStringArgumentFinder<TF##i>::find(f##i))
+
+#define _WX_VARARG_FORMAT_STRING(numfixed, fixed) \
+ _WX_VARARG_FIXED_TYPEDEFS(numfixed, fixed); \
+ const wxFormatString *fmt = \
+ (_WX_VARARG_JOIN(numfixed, _WX_VARARG_FIND_FMT))
+
+#if wxUSE_UNICODE_UTF8
+ #define _WX_VARARG_DO_CALL_UTF8(return_kw, impl, implUtf8, N, numfixed) \
+ return_kw implUtf8(_WX_VARARG_JOIN(numfixed, _WX_VARARG_PASS_FIXED), \
+ _WX_VARARG_JOIN(N, _WX_VARARG_PASS_UTF8))
+ #define _WX_VARARG_DO_CALL0_UTF8(return_kw, impl, implUtf8, numfixed) \
+ return_kw implUtf8(_WX_VARARG_JOIN(numfixed, _WX_VARARG_PASS_FIXED))
+#endif // wxUSE_UNICODE_UTF8
+
+#define _WX_VARARG_DO_CALL_WCHAR(return_kw, impl, implUtf8, N, numfixed) \
+ return_kw impl(_WX_VARARG_JOIN(numfixed, _WX_VARARG_PASS_FIXED), \
+ _WX_VARARG_JOIN(N, _WX_VARARG_PASS_WCHAR))
+#define _WX_VARARG_DO_CALL0_WCHAR(return_kw, impl, implUtf8, numfixed) \
+ return_kw impl(_WX_VARARG_JOIN(numfixed, _WX_VARARG_PASS_FIXED))
+
+#if wxUSE_UNICODE_UTF8
+ #if wxUSE_UTF8_LOCALE_ONLY
+ #define _WX_VARARG_DO_CALL _WX_VARARG_DO_CALL_UTF8
+ #define _WX_VARARG_DO_CALL0 _WX_VARARG_DO_CALL0_UTF8
+ #else // possibly non-UTF8 locales
+ #define _WX_VARARG_DO_CALL(return_kw, impl, implUtf8, N, numfixed) \
+ if ( wxLocaleIsUtf8 ) \
+ _WX_VARARG_DO_CALL_UTF8(return_kw, impl, implUtf8, N, numfixed);\
+ else \
+ _WX_VARARG_DO_CALL_WCHAR(return_kw, impl, implUtf8, N, numfixed)
+
+ #define _WX_VARARG_DO_CALL0(return_kw, impl, implUtf8, numfixed) \
+ if ( wxLocaleIsUtf8 ) \
+ _WX_VARARG_DO_CALL0_UTF8(return_kw, impl, implUtf8, numfixed); \
+ else \
+ _WX_VARARG_DO_CALL0_WCHAR(return_kw, impl, implUtf8, numfixed)
+ #endif // wxUSE_UTF8_LOCALE_ONLY or not
+#else // wxUSE_UNICODE_WCHAR or ANSI
+ #define _WX_VARARG_DO_CALL _WX_VARARG_DO_CALL_WCHAR
+ #define _WX_VARARG_DO_CALL0 _WX_VARARG_DO_CALL0_WCHAR
+#endif // wxUSE_UNICODE_UTF8 / wxUSE_UNICODE_WCHAR
+
+
+// Macro to be used with _WX_VARARG_ITER in the implementation of
+// WX_DEFINE_VARARG_FUNC (see its documentation for the meaning of arguments)
+#define _WX_VARARG_DEFINE_FUNC(N, rettype, name, \
+ impl, implUtf8, numfixed, fixed) \
+ template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \
+ rettype name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \
+ _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \
+ { \
+ _WX_VARARG_FORMAT_STRING(numfixed, fixed); \
+ _WX_VARARG_DO_CALL(return, impl, implUtf8, N, numfixed); \
+ }
+
+#define _WX_VARARG_DEFINE_FUNC_N0(rettype, name, \
+ impl, implUtf8, numfixed, fixed) \
+ inline rettype name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed)) \
+ { \
+ _WX_VARARG_DO_CALL0(return, impl, implUtf8, numfixed); \
+ }
+
+// Macro to be used with _WX_VARARG_ITER in the implementation of
+// WX_DEFINE_VARARG_FUNC_VOID (see its documentation for the meaning of
+// arguments; rettype is ignored and is used only to satisfy _WX_VARARG_ITER's
+// requirements).
+#define _WX_VARARG_DEFINE_FUNC_VOID(N, rettype, name, \
+ impl, implUtf8, numfixed, fixed) \
+ template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \
+ void name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \
+ _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \
+ { \
+ _WX_VARARG_FORMAT_STRING(numfixed, fixed); \
+ _WX_VARARG_DO_CALL(wxEMPTY_PARAMETER_VALUE, \
+ impl, implUtf8, N, numfixed); \
+ }
+
+#define _WX_VARARG_DEFINE_FUNC_VOID_N0(name, impl, implUtf8, numfixed, fixed) \
+ inline void name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed)) \
+ { \
+ _WX_VARARG_DO_CALL0(wxEMPTY_PARAMETER_VALUE, \
+ impl, implUtf8, numfixed); \
+ }
+
+// Macro to be used with _WX_VARARG_ITER in the implementation of
+// WX_DEFINE_VARARG_FUNC_CTOR (see its documentation for the meaning of
+// arguments; rettype is ignored and is used only to satisfy _WX_VARARG_ITER's
+// requirements).
+#define _WX_VARARG_DEFINE_FUNC_CTOR(N, rettype, name, \
+ impl, implUtf8, numfixed, fixed) \
+ template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \
+ name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \
+ _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \
+ { \
+ _WX_VARARG_FORMAT_STRING(numfixed, fixed); \
+ _WX_VARARG_DO_CALL(wxEMPTY_PARAMETER_VALUE, \
+ impl, implUtf8, N, numfixed); \
+ }
+
+#define _WX_VARARG_DEFINE_FUNC_CTOR_N0(name, impl, implUtf8, numfixed, fixed) \
+ inline name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed)) \
+ { \
+ _WX_VARARG_DO_CALL0(wxEMPTY_PARAMETER_VALUE, \
+ impl, implUtf8, numfixed); \
+ }
+
+// Macro to be used with _WX_VARARG_ITER in the implementation of
+// WX_DEFINE_VARARG_FUNC_NOP, i.e. empty stub for a disabled vararg function.
+// The rettype and impl arguments are ignored.
+#define _WX_VARARG_DEFINE_FUNC_NOP(N, rettype, name, \
+ impl, implUtf8, numfixed, fixed) \
+ template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \
+ void name(_WX_VARARG_FIXED_UNUSED_EXPAND(numfixed, fixed), \
+ _WX_VARARG_JOIN(N, _WX_VARARG_ARG_UNUSED)) \
+ {}
+
+#define _WX_VARARG_DEFINE_FUNC_NOP_N0(name, numfixed, fixed) \
+ inline void name(_WX_VARARG_FIXED_UNUSED_EXPAND(numfixed, fixed)) \
+ {}
+
+
+// ----------------------------------------------------------------------------
+// workaround for OpenWatcom bug #351
+// ----------------------------------------------------------------------------
+
+#ifdef __WATCOMC__
+// workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
+
+// This macro can be used to forward a 'vararg' template to another one with
+// different fixed arguments types. Parameters are same as for
+// WX_DEFINE_VARARG_FUNC (rettype=void can be used here), 'convfixed' is how
+// to convert fixed arguments. For example, this is typical code for dealing
+// with different forms of format string:
+//
+// WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const wxFormatString&),
+// DoPrintfWchar, DoPrintfUtf8)
+// #ifdef __WATCOMC__
+// WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const wxString&),
+// (wxFormatString(f1)))
+// WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const char*),
+// (wxFormatString(f1)))
+// ...
+#define WX_VARARG_WATCOM_WORKAROUND(rettype, name, numfixed, fixed, convfixed)\
+ _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \
+ _WX_VARARG_WATCOM_WORKAROUND, \
+ rettype, name, convfixed, dummy, numfixed, fixed)
+
+#define WX_VARARG_WATCOM_WORKAROUND_CTOR(name, numfixed, fixed, convfixed) \
+ _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \
+ _WX_VARARG_WATCOM_WORKAROUND_CTOR, \
+ dummy, name, convfixed, dummy, numfixed, fixed)
+
+#define _WX_VARARG_WATCOM_UNPACK_1(a1) a1
+#define _WX_VARARG_WATCOM_UNPACK_2(a1, a2) a1, a2
+#define _WX_VARARG_WATCOM_UNPACK_3(a1, a2, a3) a1, a2, a3
+#define _WX_VARARG_WATCOM_UNPACK_4(a1, a2, a3, a4) a1, a2, a3, a4
+#define _WX_VARARG_WATCOM_UNPACK(N, convfixed) \
+ _WX_VARARG_WATCOM_UNPACK_##N convfixed
+
+#define _WX_VARARG_PASS_WATCOM(i) a##i
+
+#define _WX_VARARG_WATCOM_WORKAROUND(N, rettype, name, \
+ convfixed, dummy, numfixed, fixed) \
+ template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \
+ rettype name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \
+ _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \
+ { \
+ return name(_WX_VARARG_WATCOM_UNPACK(numfixed, convfixed), \
+ _WX_VARARG_JOIN(N, _WX_VARARG_PASS_WATCOM)); \
+ }
+
+#define _WX_VARARG_WATCOM_WORKAROUND_CTOR(N, dummy1, name, \
+ convfixed, dummy2, numfixed, fixed) \
+ template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \
+ name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \
+ _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \
+ { \
+ name(_WX_VARARG_WATCOM_UNPACK(numfixed, convfixed), \
+ _WX_VARARG_JOIN(N, _WX_VARARG_PASS_WATCOM)); \
+ }
+
+#endif // __WATCOMC__
+
+#endif // _WX_STRVARARG_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/sysopt.h
+// Purpose: wxSystemOptions
+// Author: Julian Smart
+// Modified by:
+// Created: 2001-07-10
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SYSOPT_H_
+#define _WX_SYSOPT_H_
+
+#include "wx/object.h"
+
+// ----------------------------------------------------------------------------
+// Enables an application to influence the wxWidgets implementation
+// ----------------------------------------------------------------------------
+
+class
+#if wxUSE_SYSTEM_OPTIONS
+WXDLLIMPEXP_BASE
+#endif
+wxSystemOptions : public wxObject
+{
+public:
+ wxSystemOptions() { }
+
+ // User-customizable hints to wxWidgets or associated libraries
+ // These could also be used to influence GetSystem... calls, indeed
+ // to implement SetSystemColour/Font/Metric
+
+#if wxUSE_SYSTEM_OPTIONS
+ static void SetOption(const wxString& name, const wxString& value);
+ static void SetOption(const wxString& name, int value);
+#endif // wxUSE_SYSTEM_OPTIONS
+ static wxString GetOption(const wxString& name);
+ static int GetOptionInt(const wxString& name);
+ static bool HasOption(const wxString& name);
+
+ static bool IsFalse(const wxString& name)
+ {
+ return HasOption(name) && GetOptionInt(name) == 0;
+ }
+};
+
+#if !wxUSE_SYSTEM_OPTIONS
+
+// define inline stubs for accessors to make it possible to use wxSystemOptions
+// in the library itself without checking for wxUSE_SYSTEM_OPTIONS all the time
+
+/* static */ inline
+wxString wxSystemOptions::GetOption(const wxString& WXUNUSED(name))
+{
+ return wxEmptyString;
+}
+
+/* static */ inline
+int wxSystemOptions::GetOptionInt(const wxString& WXUNUSED(name))
+{
+ return 0;
+}
+
+/* static */ inline
+bool wxSystemOptions::HasOption(const wxString& WXUNUSED(name))
+{
+ return false;
+}
+
+#endif // !wxUSE_SYSTEM_OPTIONS
+
+#endif
+ // _WX_SYSOPT_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/tarstrm.h
+// Purpose: Streams for Tar files
+// Author: Mike Wetherell
+// Copyright: (c) 2004 Mike Wetherell
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WXTARSTREAM_H__
+#define _WX_WXTARSTREAM_H__
+
+#include "wx/defs.h"
+
+#if wxUSE_TARSTREAM
+
+#include "wx/archive.h"
+#include "wx/hashmap.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Constants
+
+// TypeFlag values
+enum wxTarType
+{
+ wxTAR_REGTYPE = '0', // regular file
+ wxTAR_LNKTYPE = '1', // hard link
+ wxTAR_SYMTYPE = '2', // symbolic link
+ wxTAR_CHRTYPE = '3', // character special
+ wxTAR_BLKTYPE = '4', // block special
+ wxTAR_DIRTYPE = '5', // directory
+ wxTAR_FIFOTYPE = '6', // named pipe
+ wxTAR_CONTTYPE = '7' // contiguous file
+};
+
+// Archive Formats (use wxTAR_PAX, it's backward compatible)
+enum wxTarFormat
+{
+ wxTAR_USTAR, // POSIX.1-1990 tar format
+ wxTAR_PAX // POSIX.1-2001 tar format
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+// wxTarNotifier
+
+class WXDLLIMPEXP_BASE wxTarNotifier
+{
+public:
+ virtual ~wxTarNotifier() { }
+
+ virtual void OnEntryUpdated(class wxTarEntry& entry) = 0;
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Tar Entry - hold the meta data for a file in the tar
+
+class WXDLLIMPEXP_BASE wxTarEntry : public wxArchiveEntry
+{
+public:
+ wxTarEntry(const wxString& name = wxEmptyString,
+ const wxDateTime& dt = wxDateTime::Now(),
+ wxFileOffset size = wxInvalidOffset);
+ virtual ~wxTarEntry();
+
+ wxTarEntry(const wxTarEntry& entry);
+ wxTarEntry& operator=(const wxTarEntry& entry);
+
+ // Get accessors
+ wxString GetName(wxPathFormat format = wxPATH_NATIVE) const;
+ wxString GetInternalName() const { return m_Name; }
+ wxPathFormat GetInternalFormat() const { return wxPATH_UNIX; }
+ int GetMode() const;
+ int GetUserId() const { return m_UserId; }
+ int GetGroupId() const { return m_GroupId; }
+ wxFileOffset GetSize() const { return m_Size; }
+ wxFileOffset GetOffset() const { return m_Offset; }
+ wxDateTime GetDateTime() const { return m_ModifyTime; }
+ wxDateTime GetAccessTime() const { return m_AccessTime; }
+ wxDateTime GetCreateTime() const { return m_CreateTime; }
+ int GetTypeFlag() const { return m_TypeFlag; }
+ wxString GetLinkName() const { return m_LinkName; }
+ wxString GetUserName() const { return m_UserName; }
+ wxString GetGroupName() const { return m_GroupName; }
+ int GetDevMajor() const { return m_DevMajor; }
+ int GetDevMinor() const { return m_DevMinor; }
+
+ // is accessors
+ bool IsDir() const;
+ bool IsReadOnly() const { return !(m_Mode & 0222); }
+
+ // set accessors
+ void SetName(const wxString& name, wxPathFormat format = wxPATH_NATIVE);
+ void SetUserId(int id) { m_UserId = id; }
+ void SetGroupId(int id) { m_GroupId = id; }
+ void SetMode(int mode);
+ void SetSize(wxFileOffset size) { m_Size = size; }
+ void SetDateTime(const wxDateTime& dt) { m_ModifyTime = dt; }
+ void SetAccessTime(const wxDateTime& dt) { m_AccessTime = dt; }
+ void SetCreateTime(const wxDateTime& dt) { m_CreateTime = dt; }
+ void SetTypeFlag(int type) { m_TypeFlag = type; }
+ void SetLinkName(const wxString& link) { m_LinkName = link; }
+ void SetUserName(const wxString& user) { m_UserName = user; }
+ void SetGroupName(const wxString& group) { m_GroupName = group; }
+ void SetDevMajor(int dev) { m_DevMajor = dev; }
+ void SetDevMinor(int dev) { m_DevMinor = dev; }
+
+ // set is accessors
+ void SetIsDir(bool isDir = true);
+ void SetIsReadOnly(bool isReadOnly = true);
+
+ static wxString GetInternalName(const wxString& name,
+ wxPathFormat format = wxPATH_NATIVE,
+ bool *pIsDir = NULL);
+
+ wxTarEntry *Clone() const { return new wxTarEntry(*this); }
+
+ void SetNotifier(wxTarNotifier& WXUNUSED(notifier)) { }
+
+private:
+ void SetOffset(wxFileOffset offset) { m_Offset = offset; }
+
+ virtual wxArchiveEntry* DoClone() const { return Clone(); }
+
+ wxString m_Name;
+ int m_Mode;
+ bool m_IsModeSet;
+ int m_UserId;
+ int m_GroupId;
+ wxFileOffset m_Size;
+ wxFileOffset m_Offset;
+ wxDateTime m_ModifyTime;
+ wxDateTime m_AccessTime;
+ wxDateTime m_CreateTime;
+ int m_TypeFlag;
+ wxString m_LinkName;
+ wxString m_UserName;
+ wxString m_GroupName;
+ int m_DevMajor;
+ int m_DevMinor;
+
+ friend class wxTarInputStream;
+
+ DECLARE_DYNAMIC_CLASS(wxTarEntry)
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+// wxTarInputStream
+
+WX_DECLARE_STRING_HASH_MAP(wxString, wxTarHeaderRecords);
+
+class WXDLLIMPEXP_BASE wxTarInputStream : public wxArchiveInputStream
+{
+public:
+ typedef wxTarEntry entry_type;
+
+ wxTarInputStream(wxInputStream& stream, wxMBConv& conv = wxConvLocal);
+ wxTarInputStream(wxInputStream *stream, wxMBConv& conv = wxConvLocal);
+ virtual ~wxTarInputStream();
+
+ bool OpenEntry(wxTarEntry& entry);
+ bool CloseEntry();
+
+ wxTarEntry *GetNextEntry();
+
+ wxFileOffset GetLength() const { return m_size; }
+ bool IsSeekable() const { return m_parent_i_stream->IsSeekable(); }
+
+protected:
+ size_t OnSysRead(void *buffer, size_t size);
+ wxFileOffset OnSysTell() const { return m_pos; }
+ wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode);
+
+private:
+ void Init();
+
+ wxArchiveEntry *DoGetNextEntry() { return GetNextEntry(); }
+ bool OpenEntry(wxArchiveEntry& entry);
+ bool IsOpened() const { return m_pos != wxInvalidOffset; }
+
+ wxStreamError ReadHeaders();
+ bool ReadExtendedHeader(wxTarHeaderRecords*& recs);
+
+ wxString GetExtendedHeader(const wxString& key) const;
+ wxString GetHeaderPath() const;
+ wxFileOffset GetHeaderNumber(int id) const;
+ wxString GetHeaderString(int id) const;
+ wxDateTime GetHeaderDate(const wxString& key) const;
+
+ wxFileOffset m_pos; // position within the current entry
+ wxFileOffset m_offset; // offset to the start of the entry's data
+ wxFileOffset m_size; // size of the current entry's data
+
+ int m_sumType;
+ int m_tarType;
+ class wxTarHeaderBlock *m_hdr;
+ wxTarHeaderRecords *m_HeaderRecs;
+ wxTarHeaderRecords *m_GlobalHeaderRecs;
+
+ wxDECLARE_NO_COPY_CLASS(wxTarInputStream);
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+// wxTarOutputStream
+
+class WXDLLIMPEXP_BASE wxTarOutputStream : public wxArchiveOutputStream
+{
+public:
+ wxTarOutputStream(wxOutputStream& stream,
+ wxTarFormat format = wxTAR_PAX,
+ wxMBConv& conv = wxConvLocal);
+ wxTarOutputStream(wxOutputStream *stream,
+ wxTarFormat format = wxTAR_PAX,
+ wxMBConv& conv = wxConvLocal);
+ virtual ~wxTarOutputStream();
+
+ bool PutNextEntry(wxTarEntry *entry);
+
+ bool PutNextEntry(const wxString& name,
+ const wxDateTime& dt = wxDateTime::Now(),
+ wxFileOffset size = wxInvalidOffset);
+
+ bool PutNextDirEntry(const wxString& name,
+ const wxDateTime& dt = wxDateTime::Now());
+
+ bool CopyEntry(wxTarEntry *entry, wxTarInputStream& inputStream);
+ bool CopyArchiveMetaData(wxTarInputStream& WXUNUSED(s)) { return true; }
+
+ void Sync();
+ bool CloseEntry();
+ bool Close();
+
+ bool IsSeekable() const { return m_parent_o_stream->IsSeekable(); }
+
+ void SetBlockingFactor(int factor) { m_BlockingFactor = factor; }
+ int GetBlockingFactor() const { return m_BlockingFactor; }
+
+protected:
+ size_t OnSysWrite(const void *buffer, size_t size);
+ wxFileOffset OnSysTell() const { return m_pos; }
+ wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
+
+private:
+ void Init(wxTarFormat format);
+
+ bool PutNextEntry(wxArchiveEntry *entry);
+ bool CopyEntry(wxArchiveEntry *entry, wxArchiveInputStream& stream);
+ bool CopyArchiveMetaData(wxArchiveInputStream& WXUNUSED(s)) { return true; }
+ bool IsOpened() const { return m_pos != wxInvalidOffset; }
+
+ bool WriteHeaders(wxTarEntry& entry);
+ bool ModifyHeader();
+ wxString PaxHeaderPath(const wxString& format, const wxString& path);
+
+ void SetExtendedHeader(const wxString& key, const wxString& value);
+ void SetHeaderPath(const wxString& name);
+ bool SetHeaderNumber(int id, wxFileOffset n);
+ void SetHeaderString(int id, const wxString& str);
+ void SetHeaderDate(const wxString& key, const wxDateTime& datetime);
+
+ wxFileOffset m_pos; // position within the current entry
+ wxFileOffset m_maxpos; // max pos written
+ wxFileOffset m_size; // expected entry size
+
+ wxFileOffset m_headpos; // offset within the file to the entry's header
+ wxFileOffset m_datapos; // offset within the file to the entry's data
+
+ wxFileOffset m_tarstart;// offset within the file to the tar
+ wxFileOffset m_tarsize; // size of tar so far
+
+ bool m_pax;
+ int m_BlockingFactor;
+ wxUint32 m_chksum;
+ bool m_large;
+ class wxTarHeaderBlock *m_hdr;
+ class wxTarHeaderBlock *m_hdr2;
+ char *m_extendedHdr;
+ size_t m_extendedSize;
+ wxString m_badfit;
+ bool m_endrecWritten;
+
+ wxDECLARE_NO_COPY_CLASS(wxTarOutputStream);
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Iterators
+
+#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR
+typedef wxArchiveIterator<wxTarInputStream> wxTarIter;
+typedef wxArchiveIterator<wxTarInputStream,
+ std::pair<wxString, wxTarEntry*> > wxTarPairIter;
+#endif
+
+
+/////////////////////////////////////////////////////////////////////////////
+// wxTarClassFactory
+
+class WXDLLIMPEXP_BASE wxTarClassFactory : public wxArchiveClassFactory
+{
+public:
+ typedef wxTarEntry entry_type;
+ typedef wxTarInputStream instream_type;
+ typedef wxTarOutputStream outstream_type;
+ typedef wxTarNotifier notifier_type;
+#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR
+ typedef wxTarIter iter_type;
+ typedef wxTarPairIter pairiter_type;
+#endif
+
+ wxTarClassFactory();
+
+ wxTarEntry *NewEntry() const
+ { return new wxTarEntry; }
+ wxTarInputStream *NewStream(wxInputStream& stream) const
+ { return new wxTarInputStream(stream, GetConv()); }
+ wxTarOutputStream *NewStream(wxOutputStream& stream) const
+ { return new wxTarOutputStream(stream, wxTAR_PAX, GetConv()); }
+ wxTarInputStream *NewStream(wxInputStream *stream) const
+ { return new wxTarInputStream(stream, GetConv()); }
+ wxTarOutputStream *NewStream(wxOutputStream *stream) const
+ { return new wxTarOutputStream(stream, wxTAR_PAX, GetConv()); }
+
+ wxString GetInternalName(const wxString& name,
+ wxPathFormat format = wxPATH_NATIVE) const
+ { return wxTarEntry::GetInternalName(name, format); }
+
+ const wxChar * const *GetProtocols(wxStreamProtocolType type
+ = wxSTREAM_PROTOCOL) const;
+
+protected:
+ wxArchiveEntry *DoNewEntry() const
+ { return NewEntry(); }
+ wxArchiveInputStream *DoNewStream(wxInputStream& stream) const
+ { return NewStream(stream); }
+ wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const
+ { return NewStream(stream); }
+ wxArchiveInputStream *DoNewStream(wxInputStream *stream) const
+ { return NewStream(stream); }
+ wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const
+ { return NewStream(stream); }
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxTarClassFactory)
+};
+
+
+#endif // wxUSE_TARSTREAM
+
+#endif // _WX_WXTARSTREAM_H__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/taskbar.h
+// Purpose: wxTaskBarIcon base header and class
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TASKBAR_H_BASE_
+#define _WX_TASKBAR_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_TASKBARICON
+
+#include "wx/event.h"
+
+class WXDLLIMPEXP_FWD_ADV wxTaskBarIconEvent;
+
+// ----------------------------------------------------------------------------
+
+// type of taskbar item to create. Only applicable in wxOSX_COCOA
+enum wxTaskBarIconType
+{
+ wxTBI_DOCK,
+ wxTBI_CUSTOM_STATUSITEM,
+#if defined(wxOSX_USE_COCOA) && wxOSX_USE_COCOA
+ wxTBI_DEFAULT_TYPE = wxTBI_CUSTOM_STATUSITEM
+#else
+ wxTBI_DEFAULT_TYPE = wxTBI_DOCK
+#endif
+};
+
+
+// ----------------------------------------------------------------------------
+// wxTaskBarIconBase: define wxTaskBarIcon interface
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxTaskBarIconBase : public wxEvtHandler
+{
+public:
+ wxTaskBarIconBase() { }
+
+#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__)
+ static bool IsAvailable();
+#else
+ static bool IsAvailable() { return true; }
+#endif
+
+ // Operations:
+ virtual bool SetIcon(const wxIcon& icon,
+ const wxString& tooltip = wxEmptyString) = 0;
+ virtual bool RemoveIcon() = 0;
+ virtual bool PopupMenu(wxMenu *menu) = 0;
+
+ // delayed destruction (similarly to wxWindow::Destroy())
+ void Destroy();
+
+protected:
+ // creates menu to be displayed when user clicks on the icon
+ virtual wxMenu *CreatePopupMenu() { return NULL; }
+
+private:
+ // default events handling, calls CreatePopupMenu:
+ void OnRightButtonDown(wxTaskBarIconEvent& event);
+
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxTaskBarIconBase);
+};
+
+
+// ----------------------------------------------------------------------------
+// now include the actual class declaration
+// ----------------------------------------------------------------------------
+
+#if defined(__WXMSW__)
+ #include "wx/msw/taskbar.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/taskbar.h"
+#elif defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__)
+ #include "wx/unix/taskbarx11.h"
+#elif defined (__WXMAC__)
+ #include "wx/osx/taskbarosx.h"
+#elif defined (__WXCOCOA__)
+ #include "wx/cocoa/taskbar.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// wxTaskBarIcon events
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxTaskBarIconEvent : public wxEvent
+{
+public:
+ wxTaskBarIconEvent(wxEventType evtType, wxTaskBarIcon *tbIcon)
+ : wxEvent(wxID_ANY, evtType)
+ {
+ SetEventObject(tbIcon);
+ }
+
+ virtual wxEvent *Clone() const { return new wxTaskBarIconEvent(*this); }
+
+private:
+ wxDECLARE_NO_ASSIGN_CLASS(wxTaskBarIconEvent);
+};
+
+typedef void (wxEvtHandler::*wxTaskBarIconEventFunction)(wxTaskBarIconEvent&);
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_MOVE, wxTaskBarIconEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_LEFT_DOWN, wxTaskBarIconEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_LEFT_UP, wxTaskBarIconEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_RIGHT_DOWN, wxTaskBarIconEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_RIGHT_UP, wxTaskBarIconEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_LEFT_DCLICK, wxTaskBarIconEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_RIGHT_DCLICK, wxTaskBarIconEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_BALLOON_TIMEOUT, wxTaskBarIconEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_BALLOON_CLICK, wxTaskBarIconEvent );
+
+#define wxTaskBarIconEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxTaskBarIconEventFunction, func)
+
+#define wx__DECLARE_TASKBAREVT(evt, fn) \
+ wx__DECLARE_EVT0(wxEVT_TASKBAR_ ## evt, wxTaskBarIconEventHandler(fn))
+
+#define EVT_TASKBAR_MOVE(fn) wx__DECLARE_TASKBAREVT(MOVE, fn)
+#define EVT_TASKBAR_LEFT_DOWN(fn) wx__DECLARE_TASKBAREVT(LEFT_DOWN, fn)
+#define EVT_TASKBAR_LEFT_UP(fn) wx__DECLARE_TASKBAREVT(LEFT_UP, fn)
+#define EVT_TASKBAR_RIGHT_DOWN(fn) wx__DECLARE_TASKBAREVT(RIGHT_DOWN, fn)
+#define EVT_TASKBAR_RIGHT_UP(fn) wx__DECLARE_TASKBAREVT(RIGHT_UP, fn)
+#define EVT_TASKBAR_LEFT_DCLICK(fn) wx__DECLARE_TASKBAREVT(LEFT_DCLICK, fn)
+#define EVT_TASKBAR_RIGHT_DCLICK(fn) wx__DECLARE_TASKBAREVT(RIGHT_DCLICK, fn)
+
+// taskbar menu is shown on right button press under all platforms except MSW
+// where it's shown on right button release, using this event type and macro
+// allows to write code which works correctly on all platforms
+#ifdef __WXMSW__
+ #define wxEVT_TASKBAR_CLICK wxEVT_TASKBAR_RIGHT_UP
+#else
+ #define wxEVT_TASKBAR_CLICK wxEVT_TASKBAR_RIGHT_DOWN
+#endif
+#define EVT_TASKBAR_CLICK(fn) wx__DECLARE_TASKBAREVT(CLICK, fn)
+
+// these events are currently generated only under wxMSW and only after (MSW-
+// specific) ShowBalloon() had been called, don't use them in portable code
+#define EVT_TASKBAR_BALLOON_TIMEOUT(fn) \
+ wx__DECLARE_TASKBAREVT(BALLOON_TIMEOUT, fn)
+#define EVT_TASKBAR_BALLOON_CLICK(fn) \
+ wx__DECLARE_TASKBAREVT(BALLOON_CLICK, fn)
+
+#endif // wxUSE_TASKBARICON
+
+#endif // _WX_TASKBAR_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/tbarbase.h
+// Purpose: Base class for toolbar classes
+// Author: Julian Smart
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TBARBASE_H_
+#define _WX_TBARBASE_H_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_TOOLBAR
+
+#include "wx/bitmap.h"
+#include "wx/list.h"
+#include "wx/control.h"
+
+class WXDLLIMPEXP_FWD_CORE wxToolBarBase;
+class WXDLLIMPEXP_FWD_CORE wxToolBarToolBase;
+class WXDLLIMPEXP_FWD_CORE wxImage;
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxToolBarNameStr[];
+extern WXDLLIMPEXP_DATA_CORE(const wxSize) wxDefaultSize;
+extern WXDLLIMPEXP_DATA_CORE(const wxPoint) wxDefaultPosition;
+
+enum wxToolBarToolStyle
+{
+ wxTOOL_STYLE_BUTTON = 1,
+ wxTOOL_STYLE_SEPARATOR = 2,
+ wxTOOL_STYLE_CONTROL
+};
+
+// ----------------------------------------------------------------------------
+// wxToolBarTool is a toolbar element.
+//
+// It has a unique id (except for the separators which always have id wxID_ANY), the
+// style (telling whether it is a normal button, separator or a control), the
+// state (toggled or not, enabled or not) and short and long help strings. The
+// default implementations use the short help string for the tooltip text which
+// is popped up when the mouse pointer enters the tool and the long help string
+// for the applications status bar.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxToolBarToolBase : public wxObject
+{
+public:
+ // ctors & dtor
+ // ------------
+
+ // generic ctor for any kind of tool
+ wxToolBarToolBase(wxToolBarBase *tbar = NULL,
+ int toolid = wxID_SEPARATOR,
+ const wxString& label = wxEmptyString,
+ const wxBitmap& bmpNormal = wxNullBitmap,
+ const wxBitmap& bmpDisabled = wxNullBitmap,
+ wxItemKind kind = wxITEM_NORMAL,
+ wxObject *clientData = NULL,
+ const wxString& shortHelpString = wxEmptyString,
+ const wxString& longHelpString = wxEmptyString)
+ : m_label(label),
+ m_shortHelpString(shortHelpString),
+ m_longHelpString(longHelpString)
+ {
+ Init
+ (
+ tbar,
+ toolid == wxID_SEPARATOR ? wxTOOL_STYLE_SEPARATOR
+ : wxTOOL_STYLE_BUTTON,
+ toolid == wxID_ANY ? wxWindow::NewControlId()
+ : toolid,
+ kind
+ );
+
+ m_clientData = clientData;
+
+ m_bmpNormal = bmpNormal;
+ m_bmpDisabled = bmpDisabled;
+ }
+
+ // ctor for controls only
+ wxToolBarToolBase(wxToolBarBase *tbar,
+ wxControl *control,
+ const wxString& label)
+ : m_label(label)
+ {
+ Init(tbar, wxTOOL_STYLE_CONTROL, control->GetId(), wxITEM_MAX);
+
+ m_control = control;
+ }
+
+ virtual ~wxToolBarToolBase();
+
+ // accessors
+ // ---------
+
+ // general
+ int GetId() const { return m_id; }
+
+ wxControl *GetControl() const
+ {
+ wxASSERT_MSG( IsControl(), wxT("this toolbar tool is not a control") );
+
+ return m_control;
+ }
+
+ wxToolBarBase *GetToolBar() const { return m_tbar; }
+
+ // style/kind
+ bool IsStretchable() const { return m_stretchable; }
+ bool IsButton() const { return m_toolStyle == wxTOOL_STYLE_BUTTON; }
+ bool IsControl() const { return m_toolStyle == wxTOOL_STYLE_CONTROL; }
+ bool IsSeparator() const { return m_toolStyle == wxTOOL_STYLE_SEPARATOR; }
+ bool IsStretchableSpace() const { return IsSeparator() && IsStretchable(); }
+ int GetStyle() const { return m_toolStyle; }
+ wxItemKind GetKind() const
+ {
+ wxASSERT_MSG( IsButton(), wxT("only makes sense for buttons") );
+
+ return m_kind;
+ }
+
+ void MakeStretchable()
+ {
+ wxASSERT_MSG( IsSeparator(), "only separators can be stretchable" );
+
+ m_stretchable = true;
+ }
+
+ // state
+ bool IsEnabled() const { return m_enabled; }
+ bool IsToggled() const { return m_toggled; }
+ bool CanBeToggled() const
+ { return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO; }
+
+ // attributes
+ const wxBitmap& GetNormalBitmap() const { return m_bmpNormal; }
+ const wxBitmap& GetDisabledBitmap() const { return m_bmpDisabled; }
+
+ const wxBitmap& GetBitmap() const
+ { return IsEnabled() ? GetNormalBitmap() : GetDisabledBitmap(); }
+
+ const wxString& GetLabel() const { return m_label; }
+
+ const wxString& GetShortHelp() const { return m_shortHelpString; }
+ const wxString& GetLongHelp() const { return m_longHelpString; }
+
+ wxObject *GetClientData() const
+ {
+ if ( m_toolStyle == wxTOOL_STYLE_CONTROL )
+ {
+ return (wxObject*)m_control->GetClientData();
+ }
+ else
+ {
+ return m_clientData;
+ }
+ }
+
+ // modifiers: return true if the state really changed
+ virtual bool Enable(bool enable);
+ virtual bool Toggle(bool toggle);
+ virtual bool SetToggle(bool toggle);
+ virtual bool SetShortHelp(const wxString& help);
+ virtual bool SetLongHelp(const wxString& help);
+
+ void Toggle() { Toggle(!IsToggled()); }
+
+ virtual void SetNormalBitmap(const wxBitmap& bmp) { m_bmpNormal = bmp; }
+ virtual void SetDisabledBitmap(const wxBitmap& bmp) { m_bmpDisabled = bmp; }
+
+ virtual void SetLabel(const wxString& label) { m_label = label; }
+
+ void SetClientData(wxObject *clientData)
+ {
+ if ( m_toolStyle == wxTOOL_STYLE_CONTROL )
+ {
+ m_control->SetClientData(clientData);
+ }
+ else
+ {
+ m_clientData = clientData;
+ }
+ }
+
+ // add tool to/remove it from a toolbar
+ virtual void Detach() { m_tbar = NULL; }
+ virtual void Attach(wxToolBarBase *tbar) { m_tbar = tbar; }
+
+#if wxUSE_MENUS
+ // these methods are only for tools of wxITEM_DROPDOWN kind (but even such
+ // tools can have a NULL associated menu)
+ virtual void SetDropdownMenu(wxMenu *menu);
+ wxMenu *GetDropdownMenu() const { return m_dropdownMenu; }
+#endif
+
+protected:
+ // common part of all ctors
+ void Init(wxToolBarBase *tbar,
+ wxToolBarToolStyle style,
+ int toolid,
+ wxItemKind kind)
+ {
+ m_tbar = tbar;
+ m_toolStyle = style;
+ m_id = toolid;
+ m_kind = kind;
+
+ m_clientData = NULL;
+
+ m_stretchable = false;
+ m_toggled = false;
+ m_enabled = true;
+
+#if wxUSE_MENUS
+ m_dropdownMenu = NULL;
+#endif
+
+ }
+
+ wxToolBarBase *m_tbar; // the toolbar to which we belong (may be NULL)
+
+ // tool parameters
+ wxToolBarToolStyle m_toolStyle;
+ wxWindowIDRef m_id; // the tool id, wxID_SEPARATOR for separator
+ wxItemKind m_kind; // for normal buttons may be wxITEM_NORMAL/CHECK/RADIO
+
+ // as controls have their own client data, no need to waste memory
+ union
+ {
+ wxObject *m_clientData;
+ wxControl *m_control;
+ };
+
+ // true if this tool is stretchable: currently is only value for separators
+ bool m_stretchable;
+
+ // tool state
+ bool m_toggled;
+ bool m_enabled;
+
+ // normal and disabled bitmaps for the tool, both can be invalid
+ wxBitmap m_bmpNormal;
+ wxBitmap m_bmpDisabled;
+
+ // the button label
+ wxString m_label;
+
+ // short and long help strings
+ wxString m_shortHelpString;
+ wxString m_longHelpString;
+
+#if wxUSE_MENUS
+ wxMenu *m_dropdownMenu;
+#endif
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxToolBarToolBase)
+};
+
+// a list of toolbar tools
+WX_DECLARE_EXPORTED_LIST(wxToolBarToolBase, wxToolBarToolsList);
+
+// ----------------------------------------------------------------------------
+// the base class for all toolbars
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxToolBarBase : public wxControl
+{
+public:
+ wxToolBarBase();
+ virtual ~wxToolBarBase();
+
+ // toolbar construction
+ // --------------------
+
+ // the full AddTool() function
+ //
+ // If bmpDisabled is wxNullBitmap, a shadowed version of the normal bitmap
+ // is created and used as the disabled image.
+ wxToolBarToolBase *AddTool(int toolid,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxBitmap& bmpDisabled,
+ wxItemKind kind = wxITEM_NORMAL,
+ const wxString& shortHelp = wxEmptyString,
+ const wxString& longHelp = wxEmptyString,
+ wxObject *data = NULL)
+ {
+ return DoAddTool(toolid, label, bitmap, bmpDisabled, kind,
+ shortHelp, longHelp, data);
+ }
+
+ // the most common AddTool() version
+ wxToolBarToolBase *AddTool(int toolid,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxString& shortHelp = wxEmptyString,
+ wxItemKind kind = wxITEM_NORMAL)
+ {
+ return AddTool(toolid, label, bitmap, wxNullBitmap, kind, shortHelp);
+ }
+
+ // add a check tool, i.e. a tool which can be toggled
+ wxToolBarToolBase *AddCheckTool(int toolid,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxBitmap& bmpDisabled = wxNullBitmap,
+ const wxString& shortHelp = wxEmptyString,
+ const wxString& longHelp = wxEmptyString,
+ wxObject *data = NULL)
+ {
+ return AddTool(toolid, label, bitmap, bmpDisabled, wxITEM_CHECK,
+ shortHelp, longHelp, data);
+ }
+
+ // add a radio tool, i.e. a tool which can be toggled and releases any
+ // other toggled radio tools in the same group when it happens
+ wxToolBarToolBase *AddRadioTool(int toolid,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxBitmap& bmpDisabled = wxNullBitmap,
+ const wxString& shortHelp = wxEmptyString,
+ const wxString& longHelp = wxEmptyString,
+ wxObject *data = NULL)
+ {
+ return AddTool(toolid, label, bitmap, bmpDisabled, wxITEM_RADIO,
+ shortHelp, longHelp, data);
+ }
+
+
+ // insert the new tool at the given position, if pos == GetToolsCount(), it
+ // is equivalent to AddTool()
+ virtual wxToolBarToolBase *InsertTool
+ (
+ size_t pos,
+ int toolid,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxBitmap& bmpDisabled = wxNullBitmap,
+ wxItemKind kind = wxITEM_NORMAL,
+ const wxString& shortHelp = wxEmptyString,
+ const wxString& longHelp = wxEmptyString,
+ wxObject *clientData = NULL
+ );
+
+ virtual wxToolBarToolBase *AddTool (wxToolBarToolBase *tool);
+ virtual wxToolBarToolBase *InsertTool (size_t pos, wxToolBarToolBase *tool);
+
+ // add an arbitrary control to the toolbar (notice that the control will be
+ // deleted by the toolbar and that it will also adjust its position/size)
+ //
+ // the label is optional and, if specified, will be shown near the control
+ // NB: the control should have toolbar as its parent
+ virtual wxToolBarToolBase *
+ AddControl(wxControl *control, const wxString& label = wxEmptyString);
+
+ virtual wxToolBarToolBase *
+ InsertControl(size_t pos, wxControl *control,
+ const wxString& label = wxEmptyString);
+
+ // get the control with the given id or return NULL
+ virtual wxControl *FindControl( int toolid );
+
+ // add a separator to the toolbar
+ virtual wxToolBarToolBase *AddSeparator();
+ virtual wxToolBarToolBase *InsertSeparator(size_t pos);
+
+ // add a stretchable space to the toolbar: this is similar to a separator
+ // except that it's always blank and that all the extra space the toolbar
+ // has is [equally] distributed among the stretchable spaces in it
+ virtual wxToolBarToolBase *AddStretchableSpace();
+ virtual wxToolBarToolBase *InsertStretchableSpace(size_t pos);
+
+ // remove the tool from the toolbar: the caller is responsible for actually
+ // deleting the pointer
+ virtual wxToolBarToolBase *RemoveTool(int toolid);
+
+ // delete tool either by index or by position
+ virtual bool DeleteToolByPos(size_t pos);
+ virtual bool DeleteTool(int toolid);
+
+ // delete all tools
+ virtual void ClearTools();
+
+ // must be called after all buttons have been created to finish toolbar
+ // initialisation
+ //
+ // derived class versions should call the base one first, before doing
+ // platform-specific stuff
+ virtual bool Realize();
+
+ // tools state
+ // -----------
+
+ virtual void EnableTool(int toolid, bool enable);
+ virtual void ToggleTool(int toolid, bool toggle);
+
+ // Set this to be togglable (or not)
+ virtual void SetToggle(int toolid, bool toggle);
+
+ // set/get tools client data (not for controls)
+ virtual wxObject *GetToolClientData(int toolid) const;
+ virtual void SetToolClientData(int toolid, wxObject *clientData);
+
+ // returns tool pos, or wxNOT_FOUND if tool isn't found
+ virtual int GetToolPos(int id) const;
+
+ // return true if the tool is toggled
+ virtual bool GetToolState(int toolid) const;
+
+ virtual bool GetToolEnabled(int toolid) const;
+
+ virtual void SetToolShortHelp(int toolid, const wxString& helpString);
+ virtual wxString GetToolShortHelp(int toolid) const;
+ virtual void SetToolLongHelp(int toolid, const wxString& helpString);
+ virtual wxString GetToolLongHelp(int toolid) const;
+
+ virtual void SetToolNormalBitmap(int WXUNUSED(id),
+ const wxBitmap& WXUNUSED(bitmap)) {}
+ virtual void SetToolDisabledBitmap(int WXUNUSED(id),
+ const wxBitmap& WXUNUSED(bitmap)) {}
+
+
+ // margins/packing/separation
+ // --------------------------
+
+ virtual void SetMargins(int x, int y);
+ void SetMargins(const wxSize& size)
+ { SetMargins((int) size.x, (int) size.y); }
+ virtual void SetToolPacking(int packing)
+ { m_toolPacking = packing; }
+ virtual void SetToolSeparation(int separation)
+ { m_toolSeparation = separation; }
+
+ virtual wxSize GetToolMargins() const { return wxSize(m_xMargin, m_yMargin); }
+ virtual int GetToolPacking() const { return m_toolPacking; }
+ virtual int GetToolSeparation() const { return m_toolSeparation; }
+
+ // toolbar geometry
+ // ----------------
+
+ // set the number of toolbar rows
+ virtual void SetRows(int nRows);
+
+ // the toolbar can wrap - limit the number of columns or rows it may take
+ void SetMaxRowsCols(int rows, int cols)
+ { m_maxRows = rows; m_maxCols = cols; }
+ int GetMaxRows() const { return m_maxRows; }
+ int GetMaxCols() const { return m_maxCols; }
+
+ // get/set the size of the bitmaps used by the toolbar: should be called
+ // before adding any tools to the toolbar
+ virtual void SetToolBitmapSize(const wxSize& size)
+ { m_defaultWidth = size.x; m_defaultHeight = size.y; }
+ virtual wxSize GetToolBitmapSize() const
+ { return wxSize(m_defaultWidth, m_defaultHeight); }
+
+ // the button size in some implementations is bigger than the bitmap size:
+ // get the total button size (by default the same as bitmap size)
+ virtual wxSize GetToolSize() const
+ { return GetToolBitmapSize(); }
+
+ // returns a (non separator) tool containing the point (x, y) or NULL if
+ // there is no tool at this point (coordinates are client)
+ virtual wxToolBarToolBase *FindToolForPosition(wxCoord x,
+ wxCoord y) const = 0;
+
+ // find the tool by id
+ wxToolBarToolBase *FindById(int toolid) const;
+
+ // return true if this is a vertical toolbar, otherwise false
+ bool IsVertical() const;
+
+ // these methods allow to access tools by their index in the toolbar
+ size_t GetToolsCount() const { return m_tools.GetCount(); }
+ const wxToolBarToolBase *GetToolByPos(int pos) const { return m_tools[pos]; }
+
+#if WXWIN_COMPATIBILITY_2_8
+ // the old versions of the various methods kept for compatibility
+ // don't use in the new code!
+ // --------------------------------------------------------------
+ wxDEPRECATED_INLINE(
+ wxToolBarToolBase *AddTool(int toolid,
+ const wxBitmap& bitmap,
+ const wxBitmap& bmpDisabled,
+ bool toggle = false,
+ wxObject *clientData = NULL,
+ const wxString& shortHelpString = wxEmptyString,
+ const wxString& longHelpString = wxEmptyString)
+ ,
+ return AddTool(toolid, wxEmptyString,
+ bitmap, bmpDisabled,
+ toggle ? wxITEM_CHECK : wxITEM_NORMAL,
+ shortHelpString, longHelpString, clientData);
+ )
+ wxDEPRECATED_INLINE(
+ wxToolBarToolBase *AddTool(int toolid,
+ const wxBitmap& bitmap,
+ const wxString& shortHelpString = wxEmptyString,
+ const wxString& longHelpString = wxEmptyString)
+ ,
+ return AddTool(toolid, wxEmptyString,
+ bitmap, wxNullBitmap, wxITEM_NORMAL,
+ shortHelpString, longHelpString, NULL);
+ )
+ wxDEPRECATED_INLINE(
+ wxToolBarToolBase *AddTool(int toolid,
+ const wxBitmap& bitmap,
+ const wxBitmap& bmpDisabled,
+ bool toggle,
+ wxCoord xPos,
+ wxCoord yPos = wxDefaultCoord,
+ wxObject *clientData = NULL,
+ const wxString& shortHelp = wxEmptyString,
+ const wxString& longHelp = wxEmptyString)
+ ,
+ return DoAddTool(toolid, wxEmptyString, bitmap, bmpDisabled,
+ toggle ? wxITEM_CHECK : wxITEM_NORMAL,
+ shortHelp, longHelp, clientData, xPos, yPos);
+ )
+ wxDEPRECATED_INLINE(
+ wxToolBarToolBase *InsertTool(size_t pos,
+ int toolid,
+ const wxBitmap& bitmap,
+ const wxBitmap& bmpDisabled = wxNullBitmap,
+ bool toggle = false,
+ wxObject *clientData = NULL,
+ const wxString& shortHelp = wxEmptyString,
+ const wxString& longHelp = wxEmptyString)
+ ,
+ return InsertTool(pos, toolid, wxEmptyString, bitmap, bmpDisabled,
+ toggle ? wxITEM_CHECK : wxITEM_NORMAL,
+ shortHelp, longHelp, clientData);
+ )
+#endif // WXWIN_COMPATIBILITY_2_8
+
+ // event handlers
+ // --------------
+
+ // NB: these functions are deprecated, use EVT_TOOL_XXX() instead!
+
+ // Only allow toggle if returns true. Call when left button up.
+ virtual bool OnLeftClick(int toolid, bool toggleDown);
+
+ // Call when right button down.
+ virtual void OnRightClick(int toolid, long x, long y);
+
+ // Called when the mouse cursor enters a tool bitmap.
+ // Argument is wxID_ANY if mouse is exiting the toolbar.
+ virtual void OnMouseEnter(int toolid);
+
+ // more deprecated functions
+ // -------------------------
+
+ // use GetToolMargins() instead
+ wxSize GetMargins() const { return GetToolMargins(); }
+
+ // Tool factories,
+ // helper functions to create toolbar tools
+ // -------------------------
+ virtual wxToolBarToolBase *CreateTool(int toolid,
+ const wxString& label,
+ const wxBitmap& bmpNormal,
+ const wxBitmap& bmpDisabled = wxNullBitmap,
+ wxItemKind kind = wxITEM_NORMAL,
+ wxObject *clientData = NULL,
+ const wxString& shortHelp = wxEmptyString,
+ const wxString& longHelp = wxEmptyString) = 0;
+
+ virtual wxToolBarToolBase *CreateTool(wxControl *control,
+ const wxString& label) = 0;
+
+ // this one is not virtual but just a simple helper/wrapper around
+ // CreateTool() for separators
+ wxToolBarToolBase *CreateSeparator()
+ {
+ return CreateTool(wxID_SEPARATOR,
+ wxEmptyString,
+ wxNullBitmap, wxNullBitmap,
+ wxITEM_SEPARATOR, NULL,
+ wxEmptyString, wxEmptyString);
+ }
+
+
+ // implementation only from now on
+ // -------------------------------
+
+ // Do the toolbar button updates (check for EVT_UPDATE_UI handlers)
+ virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE) ;
+
+ // don't want toolbars to accept the focus
+ virtual bool AcceptsFocus() const { return false; }
+
+#if wxUSE_MENUS
+ // Set dropdown menu
+ bool SetDropdownMenu(int toolid, wxMenu *menu);
+#endif
+
+protected:
+ // choose the default border for this window
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ // to implement in derived classes
+ // -------------------------------
+
+ // create a new toolbar tool and add it to the toolbar, this is typically
+ // implemented by just calling InsertTool()
+ virtual wxToolBarToolBase *DoAddTool
+ (
+ int toolid,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxBitmap& bmpDisabled,
+ wxItemKind kind,
+ const wxString& shortHelp = wxEmptyString,
+ const wxString& longHelp = wxEmptyString,
+ wxObject *clientData = NULL,
+ wxCoord xPos = wxDefaultCoord,
+ wxCoord yPos = wxDefaultCoord
+ );
+
+ // the tool is not yet inserted into m_tools list when this function is
+ // called and will only be added to it if this function succeeds
+ virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool) = 0;
+
+ // the tool is still in m_tools list when this function is called, it will
+ // only be deleted from it if it succeeds
+ virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool) = 0;
+
+ // called when the tools enabled flag changes
+ virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable) = 0;
+
+ // called when the tool is toggled
+ virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle) = 0;
+
+ // called when the tools "can be toggled" flag changes
+ virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) = 0;
+
+
+ // helper functions
+ // ----------------
+
+ // call this from derived class ctor/Create() to ensure that we have either
+ // wxTB_HORIZONTAL or wxTB_VERTICAL style, there is a lot of existing code
+ // which randomly checks either one or the other of them and gets confused
+ // if neither is set (and making one of them 0 is not an option neither as
+ // then the existing tests would break down)
+ void FixupStyle();
+
+ // un-toggle all buttons in the same radio group
+ void UnToggleRadioGroup(wxToolBarToolBase *tool);
+
+ // make the size of the buttons big enough to fit the largest bitmap size
+ void AdjustToolBitmapSize();
+
+ // calls InsertTool() and deletes the tool if inserting it failed
+ wxToolBarToolBase *DoInsertNewTool(size_t pos, wxToolBarToolBase *tool)
+ {
+ if ( !InsertTool(pos, tool) )
+ {
+ delete tool;
+ return NULL;
+ }
+
+ return tool;
+ }
+
+ // the list of all our tools
+ wxToolBarToolsList m_tools;
+
+ // the offset of the first tool
+ int m_xMargin;
+ int m_yMargin;
+
+ // the maximum number of toolbar rows/columns
+ int m_maxRows;
+ int m_maxCols;
+
+ // the tool packing and separation
+ int m_toolPacking,
+ m_toolSeparation;
+
+ // the size of the toolbar bitmaps
+ wxCoord m_defaultWidth, m_defaultHeight;
+
+private:
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxToolBarBase);
+};
+
+// deprecated function for creating the image for disabled buttons, use
+// wxImage::ConvertToGreyscale() instead
+#if WXWIN_COMPATIBILITY_2_8
+
+wxDEPRECATED( bool wxCreateGreyedImage(const wxImage& in, wxImage& out) );
+
+#endif // WXWIN_COMPATIBILITY_2_8
+
+
+#endif // wxUSE_TOOLBAR
+
+#endif
+ // _WX_TBARBASE_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/textbuf.h
+// Purpose: class wxTextBuffer to work with text buffers of _small_ size
+// (buffer is fully loaded in memory) and which understands CR/LF
+// differences between platforms.
+// Created: 14.11.01
+// Author: Morten Hanssen, Vadim Zeitlin
+// Copyright: (c) 1998-2001 Morten Hanssen, Vadim Zeitlin
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TEXTBUFFER_H
+#define _WX_TEXTBUFFER_H
+
+#include "wx/defs.h"
+#include "wx/arrstr.h"
+#include "wx/convauto.h"
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// the line termination type (kept wxTextFileType name for compatibility)
+enum wxTextFileType
+{
+ wxTextFileType_None, // incomplete (the last line of the file only)
+ wxTextFileType_Unix, // line is terminated with 'LF' = 0xA = 10 = '\n'
+ wxTextFileType_Dos, // 'CR' 'LF'
+ wxTextFileType_Mac, // 'CR' = 0xD = 13 = '\r'
+ wxTextFileType_Os2 // 'CR' 'LF'
+};
+
+#include "wx/string.h"
+
+#if wxUSE_TEXTBUFFER
+
+#include "wx/dynarray.h"
+
+// ----------------------------------------------------------------------------
+// wxTextBuffer
+// ----------------------------------------------------------------------------
+
+WX_DEFINE_USER_EXPORTED_ARRAY_INT(wxTextFileType,
+ wxArrayLinesType,
+ class WXDLLIMPEXP_BASE);
+
+#endif // wxUSE_TEXTBUFFER
+
+class WXDLLIMPEXP_BASE wxTextBuffer
+{
+public:
+ // constants and static functions
+ // default type for current platform (determined at compile time)
+ static const wxTextFileType typeDefault;
+
+ // this function returns a string which is identical to "text" passed in
+ // except that the line terminator characters are changed to correspond the
+ // given type. Called with the default argument, the function translates
+ // the string to the native format (Unix for Unix, DOS for Windows, ...).
+ static wxString Translate(const wxString& text,
+ wxTextFileType type = typeDefault);
+
+ // get the buffer termination string
+ static const wxChar *GetEOL(wxTextFileType type = typeDefault);
+
+ // the static methods of this class are compiled in even when
+ // !wxUSE_TEXTBUFFER because they are used by the library itself, but the
+ // rest can be left out
+#if wxUSE_TEXTBUFFER
+
+ // buffer operations
+ // -----------------
+
+ // buffer exists?
+ bool Exists() const;
+
+ // create the buffer if it doesn't already exist
+ bool Create();
+
+ // same as Create() but with (another) buffer name
+ bool Create(const wxString& strBufferName);
+
+ // Open() also loads buffer in memory on success
+ bool Open(const wxMBConv& conv = wxConvAuto());
+
+ // same as Open() but with (another) buffer name
+ bool Open(const wxString& strBufferName, const wxMBConv& conv = wxConvAuto());
+
+ // closes the buffer and frees memory, losing all changes
+ bool Close();
+
+ // is buffer currently opened?
+ bool IsOpened() const { return m_isOpened; }
+
+ // accessors
+ // ---------
+
+ // get the number of lines in the buffer
+ size_t GetLineCount() const { return m_aLines.size(); }
+
+ // the returned line may be modified (but don't add CR/LF at the end!)
+ wxString& GetLine(size_t n) { return m_aLines[n]; }
+ const wxString& GetLine(size_t n) const { return m_aLines[n]; }
+ wxString& operator[](size_t n) { return m_aLines[n]; }
+ const wxString& operator[](size_t n) const { return m_aLines[n]; }
+
+ // the current line has meaning only when you're using
+ // GetFirstLine()/GetNextLine() functions, it doesn't get updated when
+ // you're using "direct access" i.e. GetLine()
+ size_t GetCurrentLine() const { return m_nCurLine; }
+ void GoToLine(size_t n) { m_nCurLine = n; }
+ bool Eof() const { return m_nCurLine == m_aLines.size(); }
+
+ // these methods allow more "iterator-like" traversal of the list of
+ // lines, i.e. you may write something like:
+ // for ( str = GetFirstLine(); !Eof(); str = GetNextLine() ) { ... }
+
+ // NB: const is commented out because not all compilers understand
+ // 'mutable' keyword yet (m_nCurLine should be mutable)
+ wxString& GetFirstLine() /* const */
+ { return m_aLines.empty() ? ms_eof : m_aLines[m_nCurLine = 0]; }
+ wxString& GetNextLine() /* const */
+ { return ++m_nCurLine == m_aLines.size() ? ms_eof
+ : m_aLines[m_nCurLine]; }
+ wxString& GetPrevLine() /* const */
+ { wxASSERT(m_nCurLine > 0); return m_aLines[--m_nCurLine]; }
+ wxString& GetLastLine() /* const */
+ { m_nCurLine = m_aLines.size() - 1; return m_aLines.Last(); }
+
+ // get the type of the line (see also GetEOL)
+ wxTextFileType GetLineType(size_t n) const { return m_aTypes[n]; }
+
+ // guess the type of buffer
+ wxTextFileType GuessType() const;
+
+ // get the name of the buffer
+ const wxString& GetName() const { return m_strBufferName; }
+
+ // add/remove lines
+ // ----------------
+
+ // add a line to the end
+ void AddLine(const wxString& str, wxTextFileType type = typeDefault)
+ { m_aLines.push_back(str); m_aTypes.push_back(type); }
+ // insert a line before the line number n
+ void InsertLine(const wxString& str,
+ size_t n,
+ wxTextFileType type = typeDefault)
+ {
+ m_aLines.insert(m_aLines.begin() + n, str);
+ m_aTypes.insert(m_aTypes.begin()+n, type);
+ }
+
+ // delete one line
+ void RemoveLine(size_t n)
+ {
+ m_aLines.erase(m_aLines.begin() + n);
+ m_aTypes.erase(m_aTypes.begin() + n);
+ }
+
+ // remove all lines
+ void Clear() { m_aLines.clear(); m_aTypes.clear(); m_nCurLine = 0; }
+
+ // change the buffer (default argument means "don't change type")
+ // possibly in another format
+ bool Write(wxTextFileType typeNew = wxTextFileType_None,
+ const wxMBConv& conv = wxConvAuto());
+
+ // dtor
+ virtual ~wxTextBuffer();
+
+protected:
+ // ctors
+ // -----
+
+ // default ctor, use Open(string)
+ wxTextBuffer() { m_nCurLine = 0; m_isOpened = false; }
+
+ // ctor from filename
+ wxTextBuffer(const wxString& strBufferName);
+
+ enum wxTextBufferOpenMode { ReadAccess, WriteAccess };
+
+ // Must implement these in derived classes.
+ virtual bool OnExists() const = 0;
+ virtual bool OnOpen(const wxString &strBufferName,
+ wxTextBufferOpenMode openmode) = 0;
+ virtual bool OnClose() = 0;
+ virtual bool OnRead(const wxMBConv& conv) = 0;
+ virtual bool OnWrite(wxTextFileType typeNew, const wxMBConv& conv) = 0;
+
+ static wxString ms_eof; // dummy string returned at EOF
+ wxString m_strBufferName; // name of the buffer
+
+private:
+ wxArrayLinesType m_aTypes; // type of each line
+ wxArrayString m_aLines; // lines of file
+
+ size_t m_nCurLine; // number of current line in the buffer
+
+ bool m_isOpened; // was the buffer successfully opened the last time?
+#endif // wxUSE_TEXTBUFFER
+
+ // copy ctor/assignment operator not implemented
+ wxTextBuffer(const wxTextBuffer&);
+ wxTextBuffer& operator=(const wxTextBuffer&);
+};
+
+#endif // _WX_TEXTBUFFER_H
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/textcompleter.h
+// Purpose: Declaration of wxTextCompleter class.
+// Author: Vadim Zeitlin
+// Created: 2011-04-13
+// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TEXTCOMPLETER_H_
+#define _WX_TEXTCOMPLETER_H_
+
+// ----------------------------------------------------------------------------
+// wxTextCompleter: used by wxTextEnter::AutoComplete()
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxTextCompleter
+{
+public:
+ wxTextCompleter() { }
+
+ // The virtual functions to be implemented by the derived classes: the
+ // first one is called to start preparing for completions for the given
+ // prefix and, if it returns true, GetNext() is called until it returns an
+ // empty string indicating that there are no more completions.
+ virtual bool Start(const wxString& prefix) = 0;
+ virtual wxString GetNext() = 0;
+
+ virtual ~wxTextCompleter();
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxTextCompleter);
+};
+
+// ----------------------------------------------------------------------------
+// wxTextCompleterSimple: returns the entire set of completions at once
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxTextCompleterSimple : public wxTextCompleter
+{
+public:
+ wxTextCompleterSimple() { }
+
+ // Must be implemented to return all the completions for the given prefix.
+ virtual void GetCompletions(const wxString& prefix, wxArrayString& res) = 0;
+
+ virtual bool Start(const wxString& prefix);
+ virtual wxString GetNext();
+
+private:
+ wxArrayString m_completions;
+ unsigned m_index;
+
+ wxDECLARE_NO_COPY_CLASS(wxTextCompleterSimple);
+};
+
+// ----------------------------------------------------------------------------
+// wxTextCompleterFixed: Trivial wxTextCompleter implementation which always
+// returns the same fixed array of completions.
+// ----------------------------------------------------------------------------
+
+// NB: This class is private and intentionally not documented as it is
+// currently used only for implementation of completion with the fixed list
+// of strings only by wxWidgets itself, do not use it outside of wxWidgets.
+
+class wxTextCompleterFixed : public wxTextCompleterSimple
+{
+public:
+ void SetCompletions(const wxArrayString& strings)
+ {
+ m_strings = strings;
+ }
+
+ virtual void GetCompletions(const wxString& WXUNUSED(prefix),
+ wxArrayString& res)
+ {
+ res = m_strings;
+ }
+
+private:
+ wxArrayString m_strings;
+};
+
+
+#endif // _WX_TEXTCOMPLETER_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/textctrl.h
+// Purpose: wxTextAttr and wxTextCtrlBase class - the interface of wxTextCtrl
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 13.07.99
+// Copyright: (c) Vadim Zeitlin
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TEXTCTRL_H_BASE_
+#define _WX_TEXTCTRL_H_BASE_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_TEXTCTRL
+
+#include "wx/control.h" // the base class
+#include "wx/textentry.h" // single-line text entry interface
+#include "wx/dynarray.h" // wxArrayInt
+#include "wx/gdicmn.h" // wxPoint
+
+// some compilers don't have standard compliant rdbuf() (and MSVC has it only
+// in its new iostream library, not in the old one used with iostream.h)
+#if defined(__WATCOMC__) || \
+ ((defined(__VISUALC5__) || defined(__VISUALC6__)) && wxUSE_IOSTREAMH)
+ #define wxHAS_TEXT_WINDOW_STREAM 0
+#elif wxUSE_STD_IOSTREAM
+ #include "wx/ioswrap.h"
+ #define wxHAS_TEXT_WINDOW_STREAM 1
+#else
+ #define wxHAS_TEXT_WINDOW_STREAM 0
+#endif
+
+class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
+class WXDLLIMPEXP_FWD_CORE wxTextCtrlBase;
+
+// ----------------------------------------------------------------------------
+// wxTextCtrl types
+// ----------------------------------------------------------------------------
+
+// wxTextCoord is the line or row number (which should have been unsigned but
+// is long for backwards compatibility)
+typedef long wxTextCoord;
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxTextCtrlNameStr[];
+
+// this is intentionally not enum to avoid warning fixes with
+// typecasting from enum type to wxTextCoord
+const wxTextCoord wxOutOfRangeTextCoord = -1;
+const wxTextCoord wxInvalidTextCoord = -2;
+
+// ----------------------------------------------------------------------------
+// wxTextCtrl style flags
+// ----------------------------------------------------------------------------
+
+#define wxTE_NO_VSCROLL 0x0002
+
+#define wxTE_READONLY 0x0010
+#define wxTE_MULTILINE 0x0020
+#define wxTE_PROCESS_TAB 0x0040
+
+// alignment flags
+#define wxTE_LEFT 0x0000 // 0x0000
+#define wxTE_CENTER wxALIGN_CENTER_HORIZONTAL // 0x0100
+#define wxTE_RIGHT wxALIGN_RIGHT // 0x0200
+#define wxTE_CENTRE wxTE_CENTER
+
+// this style means to use RICHEDIT control and does something only under wxMSW
+// and Win32 and is silently ignored under all other platforms
+#define wxTE_RICH 0x0080
+
+#define wxTE_PROCESS_ENTER 0x0400
+#define wxTE_PASSWORD 0x0800
+
+// automatically detect the URLs and generate the events when mouse is
+// moved/clicked over an URL
+//
+// this is for Win32 richedit and wxGTK2 multiline controls only so far
+#define wxTE_AUTO_URL 0x1000
+
+// by default, the Windows text control doesn't show the selection when it
+// doesn't have focus - use this style to force it to always show it
+#define wxTE_NOHIDESEL 0x2000
+
+// use wxHSCROLL to not wrap text at all, wxTE_CHARWRAP to wrap it at any
+// position and wxTE_WORDWRAP to wrap at words boundary
+//
+// if no wrapping style is given at all, the control wraps at word boundary
+#define wxTE_DONTWRAP wxHSCROLL
+#define wxTE_CHARWRAP 0x4000 // wrap at any position
+#define wxTE_WORDWRAP 0x0001 // wrap only at words boundaries
+#define wxTE_BESTWRAP 0x0000 // this is the default
+
+#if WXWIN_COMPATIBILITY_2_6
+ // obsolete synonym
+ #define wxTE_LINEWRAP wxTE_CHARWRAP
+#endif // WXWIN_COMPATIBILITY_2_6
+
+#if WXWIN_COMPATIBILITY_2_8
+ // this style is (or at least should be) on by default now, don't use it
+ #define wxTE_AUTO_SCROLL 0
+#endif // WXWIN_COMPATIBILITY_2_8
+
+// force using RichEdit version 2.0 or 3.0 instead of 1.0 (default) for
+// wxTE_RICH controls - can be used together with or instead of wxTE_RICH
+#define wxTE_RICH2 0x8000
+
+// reuse wxTE_RICH2's value for CAPEDIT control on Windows CE
+#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
+#define wxTE_CAPITALIZE wxTE_RICH2
+#else
+#define wxTE_CAPITALIZE 0
+#endif
+
+// ----------------------------------------------------------------------------
+// wxTextCtrl file types
+// ----------------------------------------------------------------------------
+
+#define wxTEXT_TYPE_ANY 0
+
+// ----------------------------------------------------------------------------
+// wxTextCtrl::HitTest return values
+// ----------------------------------------------------------------------------
+
+// the point asked is ...
+enum wxTextCtrlHitTestResult
+{
+ wxTE_HT_UNKNOWN = -2, // this means HitTest() is simply not implemented
+ wxTE_HT_BEFORE, // either to the left or upper
+ wxTE_HT_ON_TEXT, // directly on
+ wxTE_HT_BELOW, // below [the last line]
+ wxTE_HT_BEYOND // after [the end of line]
+};
+// ... the character returned
+
+// ----------------------------------------------------------------------------
+// Types for wxTextAttr
+// ----------------------------------------------------------------------------
+
+// Alignment
+
+enum wxTextAttrAlignment
+{
+ wxTEXT_ALIGNMENT_DEFAULT,
+ wxTEXT_ALIGNMENT_LEFT,
+ wxTEXT_ALIGNMENT_CENTRE,
+ wxTEXT_ALIGNMENT_CENTER = wxTEXT_ALIGNMENT_CENTRE,
+ wxTEXT_ALIGNMENT_RIGHT,
+ wxTEXT_ALIGNMENT_JUSTIFIED
+};
+
+// Flags to indicate which attributes are being applied
+enum wxTextAttrFlags
+{
+ wxTEXT_ATTR_TEXT_COLOUR = 0x00000001,
+ wxTEXT_ATTR_BACKGROUND_COLOUR = 0x00000002,
+
+ wxTEXT_ATTR_FONT_FACE = 0x00000004,
+ wxTEXT_ATTR_FONT_POINT_SIZE = 0x00000008,
+ wxTEXT_ATTR_FONT_PIXEL_SIZE = 0x10000000,
+ wxTEXT_ATTR_FONT_WEIGHT = 0x00000010,
+ wxTEXT_ATTR_FONT_ITALIC = 0x00000020,
+ wxTEXT_ATTR_FONT_UNDERLINE = 0x00000040,
+ wxTEXT_ATTR_FONT_STRIKETHROUGH = 0x08000000,
+ wxTEXT_ATTR_FONT_ENCODING = 0x02000000,
+ wxTEXT_ATTR_FONT_FAMILY = 0x04000000,
+ wxTEXT_ATTR_FONT_SIZE = \
+ ( wxTEXT_ATTR_FONT_POINT_SIZE | wxTEXT_ATTR_FONT_PIXEL_SIZE ),
+ wxTEXT_ATTR_FONT = \
+ ( wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT | \
+ wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE | wxTEXT_ATTR_FONT_STRIKETHROUGH | wxTEXT_ATTR_FONT_ENCODING | wxTEXT_ATTR_FONT_FAMILY ),
+
+ wxTEXT_ATTR_ALIGNMENT = 0x00000080,
+ wxTEXT_ATTR_LEFT_INDENT = 0x00000100,
+ wxTEXT_ATTR_RIGHT_INDENT = 0x00000200,
+ wxTEXT_ATTR_TABS = 0x00000400,
+ wxTEXT_ATTR_PARA_SPACING_AFTER = 0x00000800,
+ wxTEXT_ATTR_PARA_SPACING_BEFORE = 0x00001000,
+ wxTEXT_ATTR_LINE_SPACING = 0x00002000,
+ wxTEXT_ATTR_CHARACTER_STYLE_NAME = 0x00004000,
+ wxTEXT_ATTR_PARAGRAPH_STYLE_NAME = 0x00008000,
+ wxTEXT_ATTR_LIST_STYLE_NAME = 0x00010000,
+
+ wxTEXT_ATTR_BULLET_STYLE = 0x00020000,
+ wxTEXT_ATTR_BULLET_NUMBER = 0x00040000,
+ wxTEXT_ATTR_BULLET_TEXT = 0x00080000,
+ wxTEXT_ATTR_BULLET_NAME = 0x00100000,
+
+ wxTEXT_ATTR_BULLET = \
+ ( wxTEXT_ATTR_BULLET_STYLE | wxTEXT_ATTR_BULLET_NUMBER | wxTEXT_ATTR_BULLET_TEXT | \
+ wxTEXT_ATTR_BULLET_NAME ),
+
+
+ wxTEXT_ATTR_URL = 0x00200000,
+ wxTEXT_ATTR_PAGE_BREAK = 0x00400000,
+ wxTEXT_ATTR_EFFECTS = 0x00800000,
+ wxTEXT_ATTR_OUTLINE_LEVEL = 0x01000000,
+
+ /*!
+ * Character and paragraph combined styles
+ */
+
+ wxTEXT_ATTR_CHARACTER = \
+ (wxTEXT_ATTR_FONT|wxTEXT_ATTR_EFFECTS| \
+ wxTEXT_ATTR_BACKGROUND_COLOUR|wxTEXT_ATTR_TEXT_COLOUR|wxTEXT_ATTR_CHARACTER_STYLE_NAME|wxTEXT_ATTR_URL),
+
+ wxTEXT_ATTR_PARAGRAPH = \
+ (wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_TABS|\
+ wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|wxTEXT_ATTR_LINE_SPACING|\
+ wxTEXT_ATTR_BULLET|wxTEXT_ATTR_PARAGRAPH_STYLE_NAME|wxTEXT_ATTR_LIST_STYLE_NAME|wxTEXT_ATTR_OUTLINE_LEVEL|wxTEXT_ATTR_PAGE_BREAK),
+
+ wxTEXT_ATTR_ALL = (wxTEXT_ATTR_CHARACTER|wxTEXT_ATTR_PARAGRAPH)
+};
+
+/*!
+ * Styles for wxTextAttr::SetBulletStyle
+ */
+enum wxTextAttrBulletStyle
+{
+ wxTEXT_ATTR_BULLET_STYLE_NONE = 0x00000000,
+ wxTEXT_ATTR_BULLET_STYLE_ARABIC = 0x00000001,
+ wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER = 0x00000002,
+ wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER = 0x00000004,
+ wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER = 0x00000008,
+ wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER = 0x00000010,
+ wxTEXT_ATTR_BULLET_STYLE_SYMBOL = 0x00000020,
+ wxTEXT_ATTR_BULLET_STYLE_BITMAP = 0x00000040,
+ wxTEXT_ATTR_BULLET_STYLE_PARENTHESES = 0x00000080,
+ wxTEXT_ATTR_BULLET_STYLE_PERIOD = 0x00000100,
+ wxTEXT_ATTR_BULLET_STYLE_STANDARD = 0x00000200,
+ wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS = 0x00000400,
+ wxTEXT_ATTR_BULLET_STYLE_OUTLINE = 0x00000800,
+
+ wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT = 0x00000000,
+ wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT = 0x00001000,
+ wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE = 0x00002000,
+
+ wxTEXT_ATTR_BULLET_STYLE_CONTINUATION = 0x00004000
+};
+
+/*!
+ * Styles for wxTextAttr::SetTextEffects
+ */
+enum wxTextAttrEffects
+{
+ wxTEXT_ATTR_EFFECT_NONE = 0x00000000,
+ wxTEXT_ATTR_EFFECT_CAPITALS = 0x00000001,
+ wxTEXT_ATTR_EFFECT_SMALL_CAPITALS = 0x00000002,
+ wxTEXT_ATTR_EFFECT_STRIKETHROUGH = 0x00000004,
+ wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH = 0x00000008,
+ wxTEXT_ATTR_EFFECT_SHADOW = 0x00000010,
+ wxTEXT_ATTR_EFFECT_EMBOSS = 0x00000020,
+ wxTEXT_ATTR_EFFECT_OUTLINE = 0x00000040,
+ wxTEXT_ATTR_EFFECT_ENGRAVE = 0x00000080,
+ wxTEXT_ATTR_EFFECT_SUPERSCRIPT = 0x00000100,
+ wxTEXT_ATTR_EFFECT_SUBSCRIPT = 0x00000200
+};
+
+/*!
+ * Line spacing values
+ */
+enum wxTextAttrLineSpacing
+{
+ wxTEXT_ATTR_LINE_SPACING_NORMAL = 10,
+ wxTEXT_ATTR_LINE_SPACING_HALF = 15,
+ wxTEXT_ATTR_LINE_SPACING_TWICE = 20
+};
+
+// ----------------------------------------------------------------------------
+// wxTextAttr: a structure containing the visual attributes of a text
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxTextAttr
+{
+public:
+ // ctors
+ wxTextAttr() { Init(); }
+ wxTextAttr(const wxTextAttr& attr) { Init(); Copy(attr); }
+ wxTextAttr(const wxColour& colText,
+ const wxColour& colBack = wxNullColour,
+ const wxFont& font = wxNullFont,
+ wxTextAttrAlignment alignment = wxTEXT_ALIGNMENT_DEFAULT);
+
+ // Initialise this object.
+ void Init();
+
+ // Copy
+ void Copy(const wxTextAttr& attr);
+
+ // Assignment
+ void operator= (const wxTextAttr& attr);
+
+ // Equality test
+ bool operator== (const wxTextAttr& attr) const;
+
+ // Partial equality test. If @a weakTest is @true, attributes of this object do not
+ // have to be present if those attributes of @a attr are present. If @a weakTest is
+ // @false, the function will fail if an attribute is present in @a attr but not
+ // in this object.
+ bool EqPartial(const wxTextAttr& attr, bool weakTest = true) const;
+
+ // Get attributes from font.
+ bool GetFontAttributes(const wxFont& font, int flags = wxTEXT_ATTR_FONT);
+
+ // setters
+ void SetTextColour(const wxColour& colText) { m_colText = colText; m_flags |= wxTEXT_ATTR_TEXT_COLOUR; }
+ void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; m_flags |= wxTEXT_ATTR_BACKGROUND_COLOUR; }
+ void SetAlignment(wxTextAttrAlignment alignment) { m_textAlignment = alignment; m_flags |= wxTEXT_ATTR_ALIGNMENT; }
+ void SetTabs(const wxArrayInt& tabs) { m_tabs = tabs; m_flags |= wxTEXT_ATTR_TABS; }
+ void SetLeftIndent(int indent, int subIndent = 0) { m_leftIndent = indent; m_leftSubIndent = subIndent; m_flags |= wxTEXT_ATTR_LEFT_INDENT; }
+ void SetRightIndent(int indent) { m_rightIndent = indent; m_flags |= wxTEXT_ATTR_RIGHT_INDENT; }
+
+ void SetFontSize(int pointSize) { m_fontSize = pointSize; m_flags &= ~wxTEXT_ATTR_FONT_SIZE; m_flags |= wxTEXT_ATTR_FONT_POINT_SIZE; }
+ void SetFontPointSize(int pointSize) { m_fontSize = pointSize; m_flags &= ~wxTEXT_ATTR_FONT_SIZE; m_flags |= wxTEXT_ATTR_FONT_POINT_SIZE; }
+ void SetFontPixelSize(int pixelSize) { m_fontSize = pixelSize; m_flags &= ~wxTEXT_ATTR_FONT_SIZE; m_flags |= wxTEXT_ATTR_FONT_PIXEL_SIZE; }
+ void SetFontStyle(wxFontStyle fontStyle) { m_fontStyle = fontStyle; m_flags |= wxTEXT_ATTR_FONT_ITALIC; }
+ void SetFontWeight(wxFontWeight fontWeight) { m_fontWeight = fontWeight; m_flags |= wxTEXT_ATTR_FONT_WEIGHT; }
+ void SetFontFaceName(const wxString& faceName) { m_fontFaceName = faceName; m_flags |= wxTEXT_ATTR_FONT_FACE; }
+ void SetFontUnderlined(bool underlined) { m_fontUnderlined = underlined; m_flags |= wxTEXT_ATTR_FONT_UNDERLINE; }
+ void SetFontStrikethrough(bool strikethrough) { m_fontStrikethrough = strikethrough; m_flags |= wxTEXT_ATTR_FONT_STRIKETHROUGH; }
+ void SetFontEncoding(wxFontEncoding encoding) { m_fontEncoding = encoding; m_flags |= wxTEXT_ATTR_FONT_ENCODING; }
+ void SetFontFamily(wxFontFamily family) { m_fontFamily = family; m_flags |= wxTEXT_ATTR_FONT_FAMILY; }
+
+ // Set font
+ void SetFont(const wxFont& font, int flags = (wxTEXT_ATTR_FONT & ~wxTEXT_ATTR_FONT_PIXEL_SIZE)) { GetFontAttributes(font, flags); }
+
+ void SetFlags(long flags) { m_flags = flags; }
+
+ void SetCharacterStyleName(const wxString& name) { m_characterStyleName = name; m_flags |= wxTEXT_ATTR_CHARACTER_STYLE_NAME; }
+ void SetParagraphStyleName(const wxString& name) { m_paragraphStyleName = name; m_flags |= wxTEXT_ATTR_PARAGRAPH_STYLE_NAME; }
+ void SetListStyleName(const wxString& name) { m_listStyleName = name; SetFlags(GetFlags() | wxTEXT_ATTR_LIST_STYLE_NAME); }
+ void SetParagraphSpacingAfter(int spacing) { m_paragraphSpacingAfter = spacing; m_flags |= wxTEXT_ATTR_PARA_SPACING_AFTER; }
+ void SetParagraphSpacingBefore(int spacing) { m_paragraphSpacingBefore = spacing; m_flags |= wxTEXT_ATTR_PARA_SPACING_BEFORE; }
+ void SetLineSpacing(int spacing) { m_lineSpacing = spacing; m_flags |= wxTEXT_ATTR_LINE_SPACING; }
+ void SetBulletStyle(int style) { m_bulletStyle = style; m_flags |= wxTEXT_ATTR_BULLET_STYLE; }
+ void SetBulletNumber(int n) { m_bulletNumber = n; m_flags |= wxTEXT_ATTR_BULLET_NUMBER; }
+ void SetBulletText(const wxString& text) { m_bulletText = text; m_flags |= wxTEXT_ATTR_BULLET_TEXT; }
+ void SetBulletFont(const wxString& bulletFont) { m_bulletFont = bulletFont; }
+ void SetBulletName(const wxString& name) { m_bulletName = name; m_flags |= wxTEXT_ATTR_BULLET_NAME; }
+ void SetURL(const wxString& url) { m_urlTarget = url; m_flags |= wxTEXT_ATTR_URL; }
+ void SetPageBreak(bool pageBreak = true) { SetFlags(pageBreak ? (GetFlags() | wxTEXT_ATTR_PAGE_BREAK) : (GetFlags() & ~wxTEXT_ATTR_PAGE_BREAK)); }
+ void SetTextEffects(int effects) { m_textEffects = effects; SetFlags(GetFlags() | wxTEXT_ATTR_EFFECTS); }
+ void SetTextEffectFlags(int effects) { m_textEffectFlags = effects; }
+ void SetOutlineLevel(int level) { m_outlineLevel = level; SetFlags(GetFlags() | wxTEXT_ATTR_OUTLINE_LEVEL); }
+
+ const wxColour& GetTextColour() const { return m_colText; }
+ const wxColour& GetBackgroundColour() const { return m_colBack; }
+ wxTextAttrAlignment GetAlignment() const { return m_textAlignment; }
+ const wxArrayInt& GetTabs() const { return m_tabs; }
+ long GetLeftIndent() const { return m_leftIndent; }
+ long GetLeftSubIndent() const { return m_leftSubIndent; }
+ long GetRightIndent() const { return m_rightIndent; }
+ long GetFlags() const { return m_flags; }
+
+ int GetFontSize() const { return m_fontSize; }
+ wxFontStyle GetFontStyle() const { return m_fontStyle; }
+ wxFontWeight GetFontWeight() const { return m_fontWeight; }
+ bool GetFontUnderlined() const { return m_fontUnderlined; }
+ bool GetFontStrikethrough() const { return m_fontStrikethrough; }
+ const wxString& GetFontFaceName() const { return m_fontFaceName; }
+ wxFontEncoding GetFontEncoding() const { return m_fontEncoding; }
+ wxFontFamily GetFontFamily() const { return m_fontFamily; }
+
+ wxFont GetFont() const;
+
+ const wxString& GetCharacterStyleName() const { return m_characterStyleName; }
+ const wxString& GetParagraphStyleName() const { return m_paragraphStyleName; }
+ const wxString& GetListStyleName() const { return m_listStyleName; }
+ int GetParagraphSpacingAfter() const { return m_paragraphSpacingAfter; }
+ int GetParagraphSpacingBefore() const { return m_paragraphSpacingBefore; }
+
+ int GetLineSpacing() const { return m_lineSpacing; }
+ int GetBulletStyle() const { return m_bulletStyle; }
+ int GetBulletNumber() const { return m_bulletNumber; }
+ const wxString& GetBulletText() const { return m_bulletText; }
+ const wxString& GetBulletFont() const { return m_bulletFont; }
+ const wxString& GetBulletName() const { return m_bulletName; }
+ const wxString& GetURL() const { return m_urlTarget; }
+ int GetTextEffects() const { return m_textEffects; }
+ int GetTextEffectFlags() const { return m_textEffectFlags; }
+ int GetOutlineLevel() const { return m_outlineLevel; }
+
+ // accessors
+ bool HasTextColour() const { return m_colText.IsOk() && HasFlag(wxTEXT_ATTR_TEXT_COLOUR) ; }
+ bool HasBackgroundColour() const { return m_colBack.IsOk() && HasFlag(wxTEXT_ATTR_BACKGROUND_COLOUR) ; }
+ bool HasAlignment() const { return (m_textAlignment != wxTEXT_ALIGNMENT_DEFAULT) && HasFlag(wxTEXT_ATTR_ALIGNMENT) ; }
+ bool HasTabs() const { return HasFlag(wxTEXT_ATTR_TABS) ; }
+ bool HasLeftIndent() const { return HasFlag(wxTEXT_ATTR_LEFT_INDENT); }
+ bool HasRightIndent() const { return HasFlag(wxTEXT_ATTR_RIGHT_INDENT); }
+ bool HasFontWeight() const { return HasFlag(wxTEXT_ATTR_FONT_WEIGHT); }
+ bool HasFontSize() const { return HasFlag(wxTEXT_ATTR_FONT_SIZE); }
+ bool HasFontPointSize() const { return HasFlag(wxTEXT_ATTR_FONT_POINT_SIZE); }
+ bool HasFontPixelSize() const { return HasFlag(wxTEXT_ATTR_FONT_PIXEL_SIZE); }
+ bool HasFontItalic() const { return HasFlag(wxTEXT_ATTR_FONT_ITALIC); }
+ bool HasFontUnderlined() const { return HasFlag(wxTEXT_ATTR_FONT_UNDERLINE); }
+ bool HasFontStrikethrough() const { return HasFlag(wxTEXT_ATTR_FONT_STRIKETHROUGH); }
+ bool HasFontFaceName() const { return HasFlag(wxTEXT_ATTR_FONT_FACE); }
+ bool HasFontEncoding() const { return HasFlag(wxTEXT_ATTR_FONT_ENCODING); }
+ bool HasFontFamily() const { return HasFlag(wxTEXT_ATTR_FONT_FAMILY); }
+ bool HasFont() const { return HasFlag(wxTEXT_ATTR_FONT); }
+
+ bool HasParagraphSpacingAfter() const { return HasFlag(wxTEXT_ATTR_PARA_SPACING_AFTER); }
+ bool HasParagraphSpacingBefore() const { return HasFlag(wxTEXT_ATTR_PARA_SPACING_BEFORE); }
+ bool HasLineSpacing() const { return HasFlag(wxTEXT_ATTR_LINE_SPACING); }
+ bool HasCharacterStyleName() const { return HasFlag(wxTEXT_ATTR_CHARACTER_STYLE_NAME) && !m_characterStyleName.IsEmpty(); }
+ bool HasParagraphStyleName() const { return HasFlag(wxTEXT_ATTR_PARAGRAPH_STYLE_NAME) && !m_paragraphStyleName.IsEmpty(); }
+ bool HasListStyleName() const { return HasFlag(wxTEXT_ATTR_LIST_STYLE_NAME) || !m_listStyleName.IsEmpty(); }
+ bool HasBulletStyle() const { return HasFlag(wxTEXT_ATTR_BULLET_STYLE); }
+ bool HasBulletNumber() const { return HasFlag(wxTEXT_ATTR_BULLET_NUMBER); }
+ bool HasBulletText() const { return HasFlag(wxTEXT_ATTR_BULLET_TEXT); }
+ bool HasBulletName() const { return HasFlag(wxTEXT_ATTR_BULLET_NAME); }
+ bool HasURL() const { return HasFlag(wxTEXT_ATTR_URL); }
+ bool HasPageBreak() const { return HasFlag(wxTEXT_ATTR_PAGE_BREAK); }
+ bool HasTextEffects() const { return HasFlag(wxTEXT_ATTR_EFFECTS); }
+ bool HasTextEffect(int effect) const { return HasFlag(wxTEXT_ATTR_EFFECTS) && ((GetTextEffectFlags() & effect) != 0); }
+ bool HasOutlineLevel() const { return HasFlag(wxTEXT_ATTR_OUTLINE_LEVEL); }
+
+ bool HasFlag(long flag) const { return (m_flags & flag) != 0; }
+ void RemoveFlag(long flag) { m_flags &= ~flag; }
+ void AddFlag(long flag) { m_flags |= flag; }
+
+ // Is this a character style?
+ bool IsCharacterStyle() const { return HasFlag(wxTEXT_ATTR_CHARACTER); }
+ bool IsParagraphStyle() const { return HasFlag(wxTEXT_ATTR_PARAGRAPH); }
+
+ // returns false if we have any attributes set, true otherwise
+ bool IsDefault() const
+ {
+ return GetFlags() == 0;
+ }
+
+ // Merges the given attributes. If compareWith
+ // is non-NULL, then it will be used to mask out those attributes that are the same in style
+ // and compareWith, for situations where we don't want to explicitly set inherited attributes.
+ bool Apply(const wxTextAttr& style, const wxTextAttr* compareWith = NULL);
+
+ // merges the attributes of the base and the overlay objects and returns
+ // the result; the parameter attributes take precedence
+ //
+ // WARNING: the order of arguments is the opposite of Combine()
+ static wxTextAttr Merge(const wxTextAttr& base, const wxTextAttr& overlay)
+ {
+ return Combine(overlay, base, NULL);
+ }
+
+ // merges the attributes of this object and overlay
+ void Merge(const wxTextAttr& overlay)
+ {
+ *this = Merge(*this, overlay);
+ }
+
+ // return the attribute having the valid font and colours: it uses the
+ // attributes set in attr and falls back first to attrDefault and then to
+ // the text control font/colours for those attributes which are not set
+ static wxTextAttr Combine(const wxTextAttr& attr,
+ const wxTextAttr& attrDef,
+ const wxTextCtrlBase *text);
+
+ // Compare tabs
+ static bool TabsEq(const wxArrayInt& tabs1, const wxArrayInt& tabs2);
+
+ // Remove attributes
+ static bool RemoveStyle(wxTextAttr& destStyle, const wxTextAttr& style);
+
+ // Combine two bitlists, specifying the bits of interest with separate flags.
+ static bool CombineBitlists(int& valueA, int valueB, int& flagsA, int flagsB);
+
+ // Compare two bitlists
+ static bool BitlistsEqPartial(int valueA, int valueB, int flags);
+
+ // Split into paragraph and character styles
+ static bool SplitParaCharStyles(const wxTextAttr& style, wxTextAttr& parStyle, wxTextAttr& charStyle);
+
+private:
+ long m_flags;
+
+ // Paragraph styles
+ wxArrayInt m_tabs; // array of int: tab stops in 1/10 mm
+ int m_leftIndent; // left indent in 1/10 mm
+ int m_leftSubIndent; // left indent for all but the first
+ // line in a paragraph relative to the
+ // first line, in 1/10 mm
+ int m_rightIndent; // right indent in 1/10 mm
+ wxTextAttrAlignment m_textAlignment;
+
+ int m_paragraphSpacingAfter;
+ int m_paragraphSpacingBefore;
+ int m_lineSpacing;
+ int m_bulletStyle;
+ int m_bulletNumber;
+ int m_textEffects;
+ int m_textEffectFlags;
+ int m_outlineLevel;
+ wxString m_bulletText;
+ wxString m_bulletFont;
+ wxString m_bulletName;
+ wxString m_urlTarget;
+ wxFontEncoding m_fontEncoding;
+
+ // Character styles
+ wxColour m_colText,
+ m_colBack;
+ int m_fontSize;
+ wxFontStyle m_fontStyle;
+ wxFontWeight m_fontWeight;
+ wxFontFamily m_fontFamily;
+ bool m_fontUnderlined;
+ bool m_fontStrikethrough;
+ wxString m_fontFaceName;
+
+ // Character style
+ wxString m_characterStyleName;
+
+ // Paragraph style
+ wxString m_paragraphStyleName;
+
+ // List style
+ wxString m_listStyleName;
+};
+
+// ----------------------------------------------------------------------------
+// wxTextAreaBase: multiline text control specific methods
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxTextAreaBase
+{
+public:
+ wxTextAreaBase() { }
+ virtual ~wxTextAreaBase() { }
+
+ // lines access
+ // ------------
+
+ virtual int GetLineLength(long lineNo) const = 0;
+ virtual wxString GetLineText(long lineNo) const = 0;
+ virtual int GetNumberOfLines() const = 0;
+
+
+ // file IO
+ // -------
+
+ bool LoadFile(const wxString& file, int fileType = wxTEXT_TYPE_ANY)
+ { return DoLoadFile(file, fileType); }
+ bool SaveFile(const wxString& file = wxEmptyString,
+ int fileType = wxTEXT_TYPE_ANY);
+
+ // dirty flag handling
+ // -------------------
+
+ virtual bool IsModified() const = 0;
+ virtual void MarkDirty() = 0;
+ virtual void DiscardEdits() = 0;
+ void SetModified(bool modified)
+ {
+ if ( modified )
+ MarkDirty();
+ else
+ DiscardEdits();
+ }
+
+
+ // styles handling
+ // ---------------
+
+ // text control under some platforms supports the text styles: these
+ // methods allow to apply the given text style to the given selection or to
+ // set/get the style which will be used for all appended text
+ virtual bool SetStyle(long start, long end, const wxTextAttr& style) = 0;
+ virtual bool GetStyle(long position, wxTextAttr& style) = 0;
+ virtual bool SetDefaultStyle(const wxTextAttr& style) = 0;
+ virtual const wxTextAttr& GetDefaultStyle() const { return m_defaultStyle; }
+
+
+ // coordinates translation
+ // -----------------------
+
+ // translate between the position (which is just an index in the text ctrl
+ // considering all its contents as a single strings) and (x, y) coordinates
+ // which represent column and line.
+ virtual long XYToPosition(long x, long y) const = 0;
+ virtual bool PositionToXY(long pos, long *x, long *y) const = 0;
+
+ // translate the given position (which is just an index in the text control)
+ // to client coordinates
+ wxPoint PositionToCoords(long pos) const;
+
+
+ virtual void ShowPosition(long pos) = 0;
+
+ // find the character at position given in pixels
+ //
+ // NB: pt is in device coords (not adjusted for the client area origin nor
+ // scrolling)
+ virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const;
+ virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
+ wxTextCoord *col,
+ wxTextCoord *row) const;
+ virtual wxString GetValue() const = 0;
+ virtual void SetValue(const wxString& value) = 0;
+
+protected:
+ // implementation of loading/saving
+ virtual bool DoLoadFile(const wxString& file, int fileType);
+ virtual bool DoSaveFile(const wxString& file, int fileType);
+
+ // Return true if the given position is valid, i.e. positive and less than
+ // the last position.
+ virtual bool IsValidPosition(long pos) const = 0;
+
+ // Default stub implementation of PositionToCoords() always returns
+ // wxDefaultPosition.
+ virtual wxPoint DoPositionToCoords(long pos) const;
+
+ // the name of the last file loaded with LoadFile() which will be used by
+ // SaveFile() by default
+ wxString m_filename;
+
+ // the text style which will be used for any new text added to the control
+ wxTextAttr m_defaultStyle;
+
+
+ wxDECLARE_NO_COPY_CLASS(wxTextAreaBase);
+};
+
+// this class defines wxTextCtrl interface, wxTextCtrlBase actually implements
+// too much things because it derives from wxTextEntry and not wxTextEntryBase
+// and so any classes which "look like" wxTextCtrl (such as wxRichTextCtrl)
+// but don't need the (native) implementation bits from wxTextEntry should
+// actually derive from this one and not wxTextCtrlBase
+class WXDLLIMPEXP_CORE wxTextCtrlIface : public wxTextAreaBase,
+ public wxTextEntryBase
+{
+public:
+ wxTextCtrlIface() { }
+
+ // wxTextAreaBase overrides
+ virtual wxString GetValue() const
+ {
+ return wxTextEntryBase::GetValue();
+ }
+ virtual void SetValue(const wxString& value)
+ {
+ wxTextEntryBase::SetValue(value);
+ }
+
+protected:
+ virtual bool IsValidPosition(long pos) const
+ {
+ return pos >= 0 && pos <= GetLastPosition();
+ }
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxTextCtrlIface);
+};
+
+// ----------------------------------------------------------------------------
+// wxTextCtrl: a single or multiple line text zone where user can edit text
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxTextCtrlBase : public wxControl,
+#if wxHAS_TEXT_WINDOW_STREAM
+ public wxSTD streambuf,
+#endif
+ public wxTextAreaBase,
+ public wxTextEntry
+{
+public:
+ // creation
+ // --------
+
+ wxTextCtrlBase() { }
+ virtual ~wxTextCtrlBase() { }
+
+
+ // more readable flag testing methods
+ bool IsSingleLine() const { return !HasFlag(wxTE_MULTILINE); }
+ bool IsMultiLine() const { return !IsSingleLine(); }
+
+ // stream-like insertion operators: these are always available, whether we
+ // were, or not, compiled with streambuf support
+ wxTextCtrl& operator<<(const wxString& s);
+ wxTextCtrl& operator<<(int i);
+ wxTextCtrl& operator<<(long i);
+ wxTextCtrl& operator<<(float f) { return *this << double(f); }
+ wxTextCtrl& operator<<(double d);
+ wxTextCtrl& operator<<(char c) { return *this << wxString(c); }
+ wxTextCtrl& operator<<(wchar_t c) { return *this << wxString(c); }
+
+ // insert the character which would have resulted from this key event,
+ // return true if anything has been inserted
+ virtual bool EmulateKeyPress(const wxKeyEvent& event);
+
+
+ // do the window-specific processing after processing the update event
+ virtual void DoUpdateWindowUI(wxUpdateUIEvent& event);
+
+ virtual bool ShouldInheritColours() const { return false; }
+
+ // work around the problem with having HitTest() both in wxControl and
+ // wxTextAreaBase base classes
+ virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const
+ {
+ return wxTextAreaBase::HitTest(pt, pos);
+ }
+
+ virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
+ wxTextCoord *col,
+ wxTextCoord *row) const
+ {
+ return wxTextAreaBase::HitTest(pt, col, row);
+ }
+
+ // we provide stubs for these functions as not all platforms have styles
+ // support, but we really should leave them pure virtual here
+ virtual bool SetStyle(long start, long end, const wxTextAttr& style);
+ virtual bool GetStyle(long position, wxTextAttr& style);
+ virtual bool SetDefaultStyle(const wxTextAttr& style);
+
+ // wxTextAreaBase overrides
+ virtual wxString GetValue() const
+ {
+ return wxTextEntry::GetValue();
+ }
+ virtual void SetValue(const wxString& value)
+ {
+ wxTextEntry::SetValue(value);
+ }
+
+ // wxTextEntry overrides
+ virtual bool SetHint(const wxString& hint);
+
+ // wxWindow overrides
+ virtual wxVisualAttributes GetDefaultAttributes() const
+ {
+ return GetClassDefaultAttributes(GetWindowVariant());
+ }
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL)
+ {
+ return GetCompositeControlsDefaultAttributes(variant);
+ }
+
+protected:
+ // override streambuf method
+#if wxHAS_TEXT_WINDOW_STREAM
+ int overflow(int i);
+#endif // wxHAS_TEXT_WINDOW_STREAM
+
+ // Another wxTextAreaBase override.
+ virtual bool IsValidPosition(long pos) const
+ {
+ return pos >= 0 && pos <= GetLastPosition();
+ }
+
+ // implement the wxTextEntry pure virtual method
+ virtual wxWindow *GetEditableWindow() { return this; }
+
+ wxDECLARE_NO_COPY_CLASS(wxTextCtrlBase);
+ DECLARE_ABSTRACT_CLASS(wxTextCtrlBase)
+};
+
+// ----------------------------------------------------------------------------
+// include the platform-dependent class definition
+// ----------------------------------------------------------------------------
+
+#if defined(__WXX11__)
+ #include "wx/x11/textctrl.h"
+#elif defined(__WXUNIVERSAL__)
+ #include "wx/univ/textctrl.h"
+#elif defined(__SMARTPHONE__) && defined(__WXWINCE__)
+ #include "wx/msw/wince/textctrlce.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/textctrl.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/textctrl.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/textctrl.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/textctrl.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/textctrl.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/textctrl.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/textctrl.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// wxTextCtrl events
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxTextUrlEvent;
+
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_ENTER, wxCommandEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_URL, wxTextUrlEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_MAXLEN, wxCommandEvent);
+
+class WXDLLIMPEXP_CORE wxTextUrlEvent : public wxCommandEvent
+{
+public:
+ wxTextUrlEvent(int winid, const wxMouseEvent& evtMouse,
+ long start, long end)
+ : wxCommandEvent(wxEVT_TEXT_URL, winid),
+ m_evtMouse(evtMouse), m_start(start), m_end(end)
+ { }
+ wxTextUrlEvent(const wxTextUrlEvent& event)
+ : wxCommandEvent(event),
+ m_evtMouse(event.m_evtMouse),
+ m_start(event.m_start),
+ m_end(event.m_end) { }
+
+ // get the mouse event which happened over the URL
+ const wxMouseEvent& GetMouseEvent() const { return m_evtMouse; }
+
+ // get the start of the URL
+ long GetURLStart() const { return m_start; }
+
+ // get the end of the URL
+ long GetURLEnd() const { return m_end; }
+
+ virtual wxEvent *Clone() const { return new wxTextUrlEvent(*this); }
+
+protected:
+ // the corresponding mouse event
+ wxMouseEvent m_evtMouse;
+
+ // the start and end indices of the URL in the text control
+ long m_start,
+ m_end;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTextUrlEvent)
+
+public:
+ // for wxWin RTTI only, don't use
+ wxTextUrlEvent() : m_evtMouse(), m_start(0), m_end(0) { }
+};
+
+typedef void (wxEvtHandler::*wxTextUrlEventFunction)(wxTextUrlEvent&);
+
+#define wxTextEventHandler(func) wxCommandEventHandler(func)
+#define wxTextUrlEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxTextUrlEventFunction, func)
+
+#define wx__DECLARE_TEXTEVT(evt, id, fn) \
+ wx__DECLARE_EVT1(wxEVT_TEXT_ ## evt, id, wxTextEventHandler(fn))
+
+#define wx__DECLARE_TEXTURLEVT(evt, id, fn) \
+ wx__DECLARE_EVT1(wxEVT_TEXT_ ## evt, id, wxTextUrlEventHandler(fn))
+
+#define EVT_TEXT(id, fn) wx__DECLARE_EVT1(wxEVT_TEXT, id, wxTextEventHandler(fn))
+#define EVT_TEXT_ENTER(id, fn) wx__DECLARE_TEXTEVT(ENTER, id, fn)
+#define EVT_TEXT_URL(id, fn) wx__DECLARE_TEXTURLEVT(URL, id, fn)
+#define EVT_TEXT_MAXLEN(id, fn) wx__DECLARE_TEXTEVT(MAXLEN, id, fn)
+
+#if wxHAS_TEXT_WINDOW_STREAM
+
+// ----------------------------------------------------------------------------
+// wxStreamToTextRedirector: this class redirects all data sent to the given
+// C++ stream to the wxTextCtrl given to its ctor during its lifetime.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxStreamToTextRedirector
+{
+private:
+ void Init(wxTextCtrl *text)
+ {
+ m_sbufOld = m_ostr.rdbuf();
+ m_ostr.rdbuf(text);
+ }
+
+public:
+ wxStreamToTextRedirector(wxTextCtrl *text)
+ : m_ostr(wxSTD cout)
+ {
+ Init(text);
+ }
+
+ wxStreamToTextRedirector(wxTextCtrl *text, wxSTD ostream *ostr)
+ : m_ostr(*ostr)
+ {
+ Init(text);
+ }
+
+ ~wxStreamToTextRedirector()
+ {
+ m_ostr.rdbuf(m_sbufOld);
+ }
+
+private:
+ // the stream we're redirecting
+ wxSTD ostream& m_ostr;
+
+ // the old streambuf (before we changed it)
+ wxSTD streambuf *m_sbufOld;
+};
+
+#endif // wxHAS_TEXT_WINDOW_STREAM
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_TEXT_UPDATED wxEVT_TEXT
+#define wxEVT_COMMAND_TEXT_ENTER wxEVT_TEXT_ENTER
+#define wxEVT_COMMAND_TEXT_URL wxEVT_TEXT_URL
+#define wxEVT_COMMAND_TEXT_MAXLEN wxEVT_TEXT_MAXLEN
+
+#endif // wxUSE_TEXTCTRL
+
+#endif
+ // _WX_TEXTCTRL_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/textdlg.h
+// Purpose: wxTextEntryDialog class
+// Author: Julian Smart
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TEXTDLG_H_BASE_
+#define _WX_TEXTDLG_H_BASE_
+
+#include "wx/generic/textdlgg.h"
+
+#endif // _WX_TEXTDLG_H_BASE_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/textentry.h
+// Purpose: declares wxTextEntry interface defining a simple text entry
+// Author: Vadim Zeitlin
+// Created: 2007-09-24
+// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TEXTENTRY_H_
+#define _WX_TEXTENTRY_H_
+
+// wxTextPos is the position in the text (currently it's hardly used anywhere
+// and should probably be replaced with int anyhow)
+typedef long wxTextPos;
+
+class WXDLLIMPEXP_FWD_BASE wxArrayString;
+class WXDLLIMPEXP_FWD_CORE wxTextCompleter;
+class WXDLLIMPEXP_FWD_CORE wxTextEntryHintData;
+class WXDLLIMPEXP_FWD_CORE wxWindow;
+
+#include "wx/filefn.h" // for wxFILE and wxDIR only
+#include "wx/gdicmn.h" // for wxPoint
+
+// ----------------------------------------------------------------------------
+// wxTextEntryBase
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxTextEntryBase
+{
+public:
+ wxTextEntryBase() { m_eventsBlock = 0; m_hintData = NULL; }
+ virtual ~wxTextEntryBase();
+
+
+ // accessing the value
+ // -------------------
+
+ // SetValue() generates a text change event, ChangeValue() doesn't
+ virtual void SetValue(const wxString& value)
+ { DoSetValue(value, SetValue_SendEvent); }
+ virtual void ChangeValue(const wxString& value);
+
+ // writing text inserts it at the current position replacing any current
+ // selection, appending always inserts it at the end and doesn't remove any
+ // existing text (but it will reset the selection if there is any)
+ virtual void WriteText(const wxString& text) = 0;
+ virtual void AppendText(const wxString& text);
+
+ virtual wxString GetValue() const;
+ virtual wxString GetRange(long from, long to) const;
+ bool IsEmpty() const { return GetLastPosition() <= 0; }
+
+
+ // editing operations
+ // ------------------
+
+ virtual void Replace(long from, long to, const wxString& value);
+ virtual void Remove(long from, long to) = 0;
+ virtual void Clear() { SetValue(wxString()); }
+ void RemoveSelection();
+
+
+ // clipboard operations
+ // --------------------
+
+ virtual void Copy() = 0;
+ virtual void Cut() = 0;
+ virtual void Paste() = 0;
+
+ virtual bool CanCopy() const;
+ virtual bool CanCut() const;
+ virtual bool CanPaste() const;
+
+ // undo/redo
+ // ---------
+
+ virtual void Undo() = 0;
+ virtual void Redo() = 0;
+
+ virtual bool CanUndo() const = 0;
+ virtual bool CanRedo() const = 0;
+
+
+ // insertion point
+ // ---------------
+
+ // note that moving insertion point removes any current selection
+ virtual void SetInsertionPoint(long pos) = 0;
+ virtual void SetInsertionPointEnd() { SetInsertionPoint(-1); }
+ virtual long GetInsertionPoint() const = 0;
+ virtual long GetLastPosition() const = 0;
+
+
+ // selection
+ // ---------
+
+ virtual void SetSelection(long from, long to) = 0;
+ virtual void SelectAll() { SetSelection(-1, -1); }
+ virtual void SelectNone()
+ { const long pos = GetInsertionPoint(); SetSelection(pos, pos); }
+ virtual void GetSelection(long *from, long *to) const = 0;
+ bool HasSelection() const;
+ virtual wxString GetStringSelection() const;
+
+
+ // auto-completion
+ // ---------------
+
+ // these functions allow to auto-complete the text already entered into the
+ // control using either the given fixed list of strings, the paths from the
+ // file system or an arbitrary user-defined completer
+ //
+ // they all return true if completion was enabled or false on error (most
+ // commonly meaning that this functionality is not available under the
+ // current platform)
+
+ bool AutoComplete(const wxArrayString& choices)
+ { return DoAutoCompleteStrings(choices); }
+
+ bool AutoCompleteFileNames()
+ { return DoAutoCompleteFileNames(wxFILE); }
+
+ bool AutoCompleteDirectories()
+ { return DoAutoCompleteFileNames(wxDIR); }
+
+ // notice that we take ownership of the pointer and will delete it
+ //
+ // if the pointer is NULL auto-completion is disabled
+ bool AutoComplete(wxTextCompleter *completer)
+ { return DoAutoCompleteCustom(completer); }
+
+
+ // status
+ // ------
+
+ virtual bool IsEditable() const = 0;
+ virtual void SetEditable(bool editable) = 0;
+
+
+ // set the max number of characters which may be entered in a single line
+ // text control
+ virtual void SetMaxLength(unsigned long WXUNUSED(len)) { }
+
+
+ // hints
+ // -----
+
+ // hint is the (usually greyed out) text shown in the control as long as
+ // it's empty and doesn't have focus, it is typically used in controls used
+ // for searching to let the user know what is supposed to be entered there
+
+ virtual bool SetHint(const wxString& hint);
+ virtual wxString GetHint() const;
+
+
+ // margins
+ // -------
+
+ // margins are the empty space between borders of control and the text
+ // itself. When setting margin, use value -1 to indicate that specific
+ // margin should not be changed.
+
+ bool SetMargins(const wxPoint& pt)
+ { return DoSetMargins(pt); }
+ bool SetMargins(wxCoord left, wxCoord top = -1)
+ { return DoSetMargins(wxPoint(left, top)); }
+ wxPoint GetMargins() const
+ { return DoGetMargins(); }
+
+
+ // implementation only
+ // -------------------
+
+ // generate the wxEVT_TEXT event for GetEditableWindow(),
+ // like SetValue() does and return true if the event was processed
+ //
+ // NB: this is public for wxRichTextCtrl use only right now, do not call it
+ static bool SendTextUpdatedEvent(wxWindow *win);
+
+ // generate the wxEVT_TEXT event for this window
+ bool SendTextUpdatedEvent()
+ {
+ return SendTextUpdatedEvent(GetEditableWindow());
+ }
+
+
+ // generate the wxEVT_TEXT event for this window if the
+ // events are not currently disabled
+ void SendTextUpdatedEventIfAllowed()
+ {
+ if ( EventsAllowed() )
+ SendTextUpdatedEvent();
+ }
+
+ // this function is provided solely for the purpose of forwarding text
+ // change notifications state from one control to another, e.g. it can be
+ // used by a wxComboBox which derives from wxTextEntry if it delegates all
+ // of its methods to another wxTextCtrl
+ void ForwardEnableTextChangedEvents(bool enable)
+ {
+ // it's important to call the functions which update m_eventsBlock here
+ // and not just our own EnableTextChangedEvents() because our state
+ // (i.e. the result of EventsAllowed()) must change as well
+ if ( enable )
+ ResumeTextChangedEvents();
+ else
+ SuppressTextChangedEvents();
+ }
+
+protected:
+ // flags for DoSetValue(): common part of SetValue() and ChangeValue() and
+ // also used to implement WriteText() in wxMSW
+ enum
+ {
+ SetValue_NoEvent = 0,
+ SetValue_SendEvent = 1,
+ SetValue_SelectionOnly = 2
+ };
+
+ virtual void DoSetValue(const wxString& value, int flags);
+ virtual wxString DoGetValue() const = 0;
+
+ // override this to return the associated window, it will be used for event
+ // generation and also by generic hints implementation
+ virtual wxWindow *GetEditableWindow() = 0;
+
+ // margins functions
+ virtual bool DoSetMargins(const wxPoint& pt);
+ virtual wxPoint DoGetMargins() const;
+
+ // the derived classes should override these virtual methods to implement
+ // auto-completion, they do the same thing as their public counterparts but
+ // have different names to allow overriding just one of them without hiding
+ // the other one(s)
+ virtual bool DoAutoCompleteStrings(const wxArrayString& WXUNUSED(choices))
+ { return false; }
+ virtual bool DoAutoCompleteFileNames(int WXUNUSED(flags)) // wxFILE | wxDIR
+ { return false; }
+ virtual bool DoAutoCompleteCustom(wxTextCompleter *completer);
+
+
+ // class which should be used to temporarily disable text change events
+ //
+ // if suppress argument in ctor is false, nothing is done
+ class EventsSuppressor
+ {
+ public:
+ EventsSuppressor(wxTextEntryBase *text, bool suppress = true)
+ : m_text(text),
+ m_suppress(suppress)
+ {
+ if ( m_suppress )
+ m_text->SuppressTextChangedEvents();
+ }
+
+ ~EventsSuppressor()
+ {
+ if ( m_suppress )
+ m_text->ResumeTextChangedEvents();
+ }
+
+ private:
+ wxTextEntryBase *m_text;
+ bool m_suppress;
+ };
+
+ friend class EventsSuppressor;
+
+private:
+ // suppress or resume the text changed events generation: don't use these
+ // functions directly, use EventsSuppressor class above instead
+ void SuppressTextChangedEvents()
+ {
+ if ( !m_eventsBlock++ )
+ EnableTextChangedEvents(false);
+ }
+
+ void ResumeTextChangedEvents()
+ {
+ if ( !--m_eventsBlock )
+ EnableTextChangedEvents(true);
+ }
+
+
+ // this must be overridden in the derived classes if our implementation of
+ // SetValue() or Replace() is used to disable (and enable back) generation
+ // of the text changed events
+ //
+ // initially the generation of the events is enabled
+ virtual void EnableTextChangedEvents(bool WXUNUSED(enable)) { }
+
+ // return true if the events are currently not suppressed
+ bool EventsAllowed() const { return m_eventsBlock == 0; }
+
+
+ // if this counter is non-null, events are blocked
+ unsigned m_eventsBlock;
+
+ // hint-related stuff, only allocated if/when SetHint() is used
+ wxTextEntryHintData *m_hintData;
+
+ // It needs to call our Do{Get,Set}Value() to work with the real control
+ // contents.
+ friend class wxTextEntryHintData;
+};
+
+#ifdef __WXUNIVERSAL__
+ // TODO: we need to use wxTextEntryDelegate here, but for now just prevent
+ // the GTK/MSW classes from being used in wxUniv build
+ class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase
+ {
+ };
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/textentry.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/textentry.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/textentry.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/textentry.h"
+#elif defined(__WXPM__)
+ #include "wx/os2/textentry.h"
+#else
+ // no platform-specific implementation of wxTextEntry yet
+ class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase
+ {
+ };
+#endif
+
+#endif // _WX_TEXTENTRY_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/textfile.h
+// Purpose: class wxTextFile to work with text files of _small_ size
+// (file is fully loaded in memory) and which understands CR/LF
+// differences between platforms.
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 03.04.98
+// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TEXTFILE_H
+#define _WX_TEXTFILE_H
+
+#include "wx/defs.h"
+
+#include "wx/textbuf.h"
+
+#if wxUSE_TEXTFILE
+
+#include "wx/file.h"
+
+// ----------------------------------------------------------------------------
+// wxTextFile
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxTextFile : public wxTextBuffer
+{
+public:
+ // constructors
+ wxTextFile() { }
+ wxTextFile(const wxString& strFileName);
+
+protected:
+ // implement the base class pure virtuals
+ virtual bool OnExists() const;
+ virtual bool OnOpen(const wxString &strBufferName,
+ wxTextBufferOpenMode OpenMode);
+ virtual bool OnClose();
+ virtual bool OnRead(const wxMBConv& conv);
+ virtual bool OnWrite(wxTextFileType typeNew, const wxMBConv& conv);
+
+private:
+
+ wxFile m_file;
+
+ wxDECLARE_NO_COPY_CLASS(wxTextFile);
+};
+
+#else // !wxUSE_TEXTFILE
+
+// old code relies on the static methods of wxTextFile being always available
+// and they still are available in wxTextBuffer (even if !wxUSE_TEXTBUFFER), so
+// make it possible to use them in a backwards compatible way
+typedef wxTextBuffer wxTextFile;
+
+#endif // wxUSE_TEXTFILE/!wxUSE_TEXTFILE
+
+#endif // _WX_TEXTFILE_H
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/textwrapper.h
+// Purpose: declaration of wxTextWrapper class
+// Author: Vadim Zeitlin
+// Created: 2009-05-31 (extracted from dlgcmn.cpp via wx/private/stattext.h)
+// Copyright: (c) 1999, 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TEXTWRAPPER_H_
+#define _WX_TEXTWRAPPER_H_
+
+#include "wx/window.h"
+
+// ----------------------------------------------------------------------------
+// wxTextWrapper
+// ----------------------------------------------------------------------------
+
+// this class is used to wrap the text on word boundary: wrapping is done by
+// calling OnStartLine() and OnOutputLine() functions
+class WXDLLIMPEXP_CORE wxTextWrapper
+{
+public:
+ wxTextWrapper() { m_eol = false; }
+
+ // win is used for getting the font, text is the text to wrap, width is the
+ // max line width or -1 to disable wrapping
+ void Wrap(wxWindow *win, const wxString& text, int widthMax);
+
+ // we don't need it, but just to avoid compiler warnings
+ virtual ~wxTextWrapper() { }
+
+protected:
+ // line may be empty
+ virtual void OnOutputLine(const wxString& line) = 0;
+
+ // called at the start of every new line (except the very first one)
+ virtual void OnNewLine() { }
+
+private:
+ // call OnOutputLine() and set m_eol to true
+ void DoOutputLine(const wxString& line)
+ {
+ OnOutputLine(line);
+
+ m_eol = true;
+ }
+
+ // this function is a destructive inspector: when it returns true it also
+ // resets the flag to false so calling it again wouldn't return true any
+ // more
+ bool IsStartOfNewLine()
+ {
+ if ( !m_eol )
+ return false;
+
+ m_eol = false;
+
+ return true;
+ }
+
+
+ bool m_eol;
+
+ wxDECLARE_NO_COPY_CLASS(wxTextWrapper);
+};
+
+#if wxUSE_STATTEXT
+
+#include "wx/sizer.h"
+#include "wx/stattext.h"
+
+// A class creating a sizer with one static text per line of text. Creation of
+// the controls used for each line can be customized by overriding
+// OnCreateLine() function.
+//
+// This class is currently private to wxWidgets and used only by wxDialog
+// itself. We may make it public later if there is sufficient interest.
+class wxTextSizerWrapper : public wxTextWrapper
+{
+public:
+ wxTextSizerWrapper(wxWindow *win)
+ {
+ m_win = win;
+ m_hLine = 0;
+ }
+
+ wxSizer *CreateSizer(const wxString& text, int widthMax)
+ {
+ m_sizer = new wxBoxSizer(wxVERTICAL);
+ Wrap(m_win, text, widthMax);
+ return m_sizer;
+ }
+
+ wxWindow *GetParent() const { return m_win; }
+
+protected:
+ virtual wxWindow *OnCreateLine(const wxString& line)
+ {
+ return new wxStaticText(m_win, wxID_ANY,
+ wxControl::EscapeMnemonics(line));
+ }
+
+ virtual void OnOutputLine(const wxString& line)
+ {
+ if ( !line.empty() )
+ {
+ m_sizer->Add(OnCreateLine(line));
+ }
+ else // empty line, no need to create a control for it
+ {
+ if ( !m_hLine )
+ m_hLine = m_win->GetCharHeight();
+
+ m_sizer->Add(5, m_hLine);
+ }
+ }
+
+private:
+ wxWindow *m_win;
+ wxSizer *m_sizer;
+ int m_hLine;
+};
+
+#endif // wxUSE_STATTEXT
+
+#endif // _WX_TEXTWRAPPER_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/tglbtn.h
+// Purpose: This dummy header includes the proper header file for the
+// system we're compiling under.
+// Author: John Norris, minor changes by Axel Schlueter
+// Modified by:
+// Created: 08.02.01
+// Copyright: (c) 2000 Johnny C. Norris II
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TOGGLEBUTTON_H_BASE_
+#define _WX_TOGGLEBUTTON_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_TOGGLEBTN
+
+#include "wx/event.h"
+#include "wx/anybutton.h" // base class
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr[];
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TOGGLEBUTTON, wxCommandEvent );
+
+// ----------------------------------------------------------------------------
+// wxToggleButtonBase
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxToggleButtonBase : public wxAnyButton
+{
+public:
+ wxToggleButtonBase() { }
+
+ // Get/set the value
+ virtual void SetValue(bool state) = 0;
+ virtual bool GetValue() const = 0;
+
+ void UpdateWindowUI(long flags)
+ {
+ wxControl::UpdateWindowUI(flags);
+
+ if ( !IsShown() )
+ return;
+
+ wxWindow *tlw = wxGetTopLevelParent( this );
+ if (tlw && wxPendingDelete.Member( tlw ))
+ return;
+
+ wxUpdateUIEvent event( GetId() );
+ event.SetEventObject(this);
+
+ if (GetEventHandler()->ProcessEvent(event) )
+ {
+ if ( event.GetSetChecked() )
+ SetValue( event.GetChecked() );
+ }
+ }
+
+ // Buttons on MSW can look bad if they are not native colours, because
+ // then they become owner-drawn and not theme-drawn. Disable it here
+ // in wxToggleButtonBase to make it consistent.
+ virtual bool ShouldInheritColours() const { return false; }
+
+protected:
+ // choose the default border for this window
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
+ wxDECLARE_NO_COPY_CLASS(wxToggleButtonBase);
+};
+
+
+#define EVT_TOGGLEBUTTON(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_TOGGLEBUTTON, id, wxCommandEventHandler(fn))
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/univ/tglbtn.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/tglbtn.h"
+ #define wxHAS_BITMAPTOGGLEBUTTON
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/tglbtn.h"
+ #define wxHAS_BITMAPTOGGLEBUTTON
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/tglbtn.h"
+# elif defined(__WXMOTIF__)
+ #include "wx/motif/tglbtn.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/tglbtn.h"
+ #define wxHAS_BITMAPTOGGLEBUTTON
+#elif defined(__WXPM__)
+ #include "wx/os2/tglbtn.h"
+#endif
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_TOGGLEBUTTON_CLICKED wxEVT_TOGGLEBUTTON
+
+#endif // wxUSE_TOGGLEBTN
+
+#endif // _WX_TOGGLEBUTTON_H_BASE_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/thread.h
+// Purpose: Thread API
+// Author: Guilhem Lavaux
+// Modified by: Vadim Zeitlin (modifications partly inspired by omnithreads
+// package from Olivetti & Oracle Research Laboratory)
+// Created: 04/13/98
+// Copyright: (c) Guilhem Lavaux
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_THREAD_H_
+#define _WX_THREAD_H_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// get the value of wxUSE_THREADS configuration flag
+#include "wx/defs.h"
+
+#if wxUSE_THREADS
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+enum wxMutexError
+{
+ wxMUTEX_NO_ERROR = 0, // operation completed successfully
+ wxMUTEX_INVALID, // mutex hasn't been initialized
+ wxMUTEX_DEAD_LOCK, // mutex is already locked by the calling thread
+ wxMUTEX_BUSY, // mutex is already locked by another thread
+ wxMUTEX_UNLOCKED, // attempt to unlock a mutex which is not locked
+ wxMUTEX_TIMEOUT, // LockTimeout() has timed out
+ wxMUTEX_MISC_ERROR // any other error
+};
+
+enum wxCondError
+{
+ wxCOND_NO_ERROR = 0,
+ wxCOND_INVALID,
+ wxCOND_TIMEOUT, // WaitTimeout() has timed out
+ wxCOND_MISC_ERROR
+};
+
+enum wxSemaError
+{
+ wxSEMA_NO_ERROR = 0,
+ wxSEMA_INVALID, // semaphore hasn't been initialized successfully
+ wxSEMA_BUSY, // returned by TryWait() if Wait() would block
+ wxSEMA_TIMEOUT, // returned by WaitTimeout()
+ wxSEMA_OVERFLOW, // Post() would increase counter past the max
+ wxSEMA_MISC_ERROR
+};
+
+enum wxThreadError
+{
+ wxTHREAD_NO_ERROR = 0, // No error
+ wxTHREAD_NO_RESOURCE, // No resource left to create a new thread
+ wxTHREAD_RUNNING, // The thread is already running
+ wxTHREAD_NOT_RUNNING, // The thread isn't running
+ wxTHREAD_KILLED, // Thread we waited for had to be killed
+ wxTHREAD_MISC_ERROR // Some other error
+};
+
+enum wxThreadKind
+{
+ wxTHREAD_DETACHED,
+ wxTHREAD_JOINABLE
+};
+
+enum wxThreadWait
+{
+ wxTHREAD_WAIT_BLOCK,
+ wxTHREAD_WAIT_YIELD, // process events while waiting; MSW only
+
+ // For compatibility reasons we use wxTHREAD_WAIT_YIELD by default as this
+ // was the default behaviour of wxMSW 2.8 but it should be avoided as it's
+ // dangerous and not portable.
+#if WXWIN_COMPATIBILITY_2_8
+ wxTHREAD_WAIT_DEFAULT = wxTHREAD_WAIT_YIELD
+#else
+ wxTHREAD_WAIT_DEFAULT = wxTHREAD_WAIT_BLOCK
+#endif
+};
+
+// Obsolete synonyms for wxPRIORITY_XXX for backwards compatibility-only
+enum
+{
+ WXTHREAD_MIN_PRIORITY = wxPRIORITY_MIN,
+ WXTHREAD_DEFAULT_PRIORITY = wxPRIORITY_DEFAULT,
+ WXTHREAD_MAX_PRIORITY = wxPRIORITY_MAX
+};
+
+// There are 2 types of mutexes: normal mutexes and recursive ones. The attempt
+// to lock a normal mutex by a thread which already owns it results in
+// undefined behaviour (it always works under Windows, it will almost always
+// result in a deadlock under Unix). Locking a recursive mutex in such
+// situation always succeeds and it must be unlocked as many times as it has
+// been locked.
+//
+// However recursive mutexes have several important drawbacks: first, in the
+// POSIX implementation, they're less efficient. Second, and more importantly,
+// they CAN NOT BE USED WITH CONDITION VARIABLES under Unix! Using them with
+// wxCondition will work under Windows and some Unices (notably Linux) but will
+// deadlock under other Unix versions (e.g. Solaris). As it might be difficult
+// to ensure that a recursive mutex is not used with wxCondition, it is a good
+// idea to avoid using recursive mutexes at all. Also, the last problem with
+// them is that some (older) Unix versions don't support this at all -- which
+// results in a configure warning when building and a deadlock when using them.
+enum wxMutexType
+{
+ // normal mutex: try to always use this one
+ wxMUTEX_DEFAULT,
+
+ // recursive mutex: don't use these ones with wxCondition
+ wxMUTEX_RECURSIVE
+};
+
+// forward declarations
+class WXDLLIMPEXP_FWD_BASE wxThreadHelper;
+class WXDLLIMPEXP_FWD_BASE wxConditionInternal;
+class WXDLLIMPEXP_FWD_BASE wxMutexInternal;
+class WXDLLIMPEXP_FWD_BASE wxSemaphoreInternal;
+class WXDLLIMPEXP_FWD_BASE wxThreadInternal;
+
+// ----------------------------------------------------------------------------
+// A mutex object is a synchronization object whose state is set to signaled
+// when it is not owned by any thread, and nonsignaled when it is owned. Its
+// name comes from its usefulness in coordinating mutually-exclusive access to
+// a shared resource. Only one thread at a time can own a mutex object.
+// ----------------------------------------------------------------------------
+
+// you should consider wxMutexLocker whenever possible instead of directly
+// working with wxMutex class - it is safer
+class WXDLLIMPEXP_BASE wxMutex
+{
+public:
+ // constructor & destructor
+ // ------------------------
+
+ // create either default (always safe) or recursive mutex
+ wxMutex(wxMutexType mutexType = wxMUTEX_DEFAULT);
+
+ // destroys the mutex kernel object
+ ~wxMutex();
+
+ // test if the mutex has been created successfully
+ bool IsOk() const;
+
+ // mutex operations
+ // ----------------
+
+ // Lock the mutex, blocking on it until it is unlocked by the other thread.
+ // The result of locking a mutex already locked by the current thread
+ // depend on the mutex type.
+ //
+ // The caller must call Unlock() later if Lock() returned wxMUTEX_NO_ERROR.
+ wxMutexError Lock();
+
+ // Same as Lock() but return wxMUTEX_TIMEOUT if the mutex can't be locked
+ // during the given number of milliseconds
+ wxMutexError LockTimeout(unsigned long ms);
+
+ // Try to lock the mutex: if it is currently locked, return immediately
+ // with an error. Otherwise the caller must call Unlock().
+ wxMutexError TryLock();
+
+ // Unlock the mutex. It is an error to unlock an already unlocked mutex
+ wxMutexError Unlock();
+
+protected:
+ wxMutexInternal *m_internal;
+
+ friend class wxConditionInternal;
+
+ wxDECLARE_NO_COPY_CLASS(wxMutex);
+};
+
+// a helper class which locks the mutex in the ctor and unlocks it in the dtor:
+// this ensures that mutex is always unlocked, even if the function returns or
+// throws an exception before it reaches the end
+class WXDLLIMPEXP_BASE wxMutexLocker
+{
+public:
+ // lock the mutex in the ctor
+ wxMutexLocker(wxMutex& mutex)
+ : m_isOk(false), m_mutex(mutex)
+ { m_isOk = ( m_mutex.Lock() == wxMUTEX_NO_ERROR ); }
+
+ // returns true if mutex was successfully locked in ctor
+ bool IsOk() const
+ { return m_isOk; }
+
+ // unlock the mutex in dtor
+ ~wxMutexLocker()
+ { if ( IsOk() ) m_mutex.Unlock(); }
+
+private:
+ // no assignment operator nor copy ctor
+ wxMutexLocker(const wxMutexLocker&);
+ wxMutexLocker& operator=(const wxMutexLocker&);
+
+ bool m_isOk;
+ wxMutex& m_mutex;
+};
+
+// ----------------------------------------------------------------------------
+// Critical section: this is the same as mutex but is only visible to the
+// threads of the same process. For the platforms which don't have native
+// support for critical sections, they're implemented entirely in terms of
+// mutexes.
+//
+// NB: wxCriticalSection object does not allocate any memory in its ctor
+// which makes it possible to have static globals of this class
+// ----------------------------------------------------------------------------
+
+// in order to avoid any overhead under platforms where critical sections are
+// just mutexes make all wxCriticalSection class functions inline
+#if !defined(__WINDOWS__)
+ #define wxCRITSECT_IS_MUTEX 1
+
+ #define wxCRITSECT_INLINE WXEXPORT inline
+#else // MSW
+ #define wxCRITSECT_IS_MUTEX 0
+
+ #define wxCRITSECT_INLINE
+#endif // MSW/!MSW
+
+enum wxCriticalSectionType
+{
+ // recursive critical section
+ wxCRITSEC_DEFAULT,
+
+ // non-recursive critical section
+ wxCRITSEC_NON_RECURSIVE
+};
+
+// you should consider wxCriticalSectionLocker whenever possible instead of
+// directly working with wxCriticalSection class - it is safer
+class WXDLLIMPEXP_BASE wxCriticalSection
+{
+public:
+ // ctor & dtor
+ wxCRITSECT_INLINE wxCriticalSection( wxCriticalSectionType critSecType = wxCRITSEC_DEFAULT );
+ wxCRITSECT_INLINE ~wxCriticalSection();
+ // enter the section (the same as locking a mutex)
+ wxCRITSECT_INLINE void Enter();
+
+ // try to enter the section (the same as trying to lock a mutex)
+ wxCRITSECT_INLINE bool TryEnter();
+
+ // leave the critical section (same as unlocking a mutex)
+ wxCRITSECT_INLINE void Leave();
+
+private:
+#if wxCRITSECT_IS_MUTEX
+ wxMutex m_mutex;
+#elif defined(__WINDOWS__)
+ // we can't allocate any memory in the ctor, so use placement new -
+ // unfortunately, we have to hardcode the sizeof() here because we can't
+ // include windows.h from this public header and we also have to use the
+ // union to force the correct (i.e. maximal) alignment
+ //
+ // if CRITICAL_SECTION size changes in Windows, you'll get an assert from
+ // thread.cpp and will need to increase the buffer size
+#ifdef __WIN64__
+ typedef char wxCritSectBuffer[40];
+#else // __WIN32__
+ typedef char wxCritSectBuffer[24];
+#endif
+ union
+ {
+ unsigned long m_dummy1;
+ void *m_dummy2;
+
+ wxCritSectBuffer m_buffer;
+ };
+#endif // Unix&OS2/Win32
+
+ wxDECLARE_NO_COPY_CLASS(wxCriticalSection);
+};
+
+#if wxCRITSECT_IS_MUTEX
+ // implement wxCriticalSection using mutexes
+ inline wxCriticalSection::wxCriticalSection( wxCriticalSectionType critSecType )
+ : m_mutex( critSecType == wxCRITSEC_DEFAULT ? wxMUTEX_RECURSIVE : wxMUTEX_DEFAULT ) { }
+ inline wxCriticalSection::~wxCriticalSection() { }
+
+ inline void wxCriticalSection::Enter() { (void)m_mutex.Lock(); }
+ inline bool wxCriticalSection::TryEnter() { return m_mutex.TryLock() == wxMUTEX_NO_ERROR; }
+ inline void wxCriticalSection::Leave() { (void)m_mutex.Unlock(); }
+#endif // wxCRITSECT_IS_MUTEX
+
+#undef wxCRITSECT_INLINE
+#undef wxCRITSECT_IS_MUTEX
+
+// wxCriticalSectionLocker is the same to critical sections as wxMutexLocker is
+// to mutexes
+class WXDLLIMPEXP_BASE wxCriticalSectionLocker
+{
+public:
+ wxCriticalSectionLocker(wxCriticalSection& cs)
+ : m_critsect(cs)
+ {
+ m_critsect.Enter();
+ }
+
+ ~wxCriticalSectionLocker()
+ {
+ m_critsect.Leave();
+ }
+
+private:
+ wxCriticalSection& m_critsect;
+
+ wxDECLARE_NO_COPY_CLASS(wxCriticalSectionLocker);
+};
+
+// ----------------------------------------------------------------------------
+// wxCondition models a POSIX condition variable which allows one (or more)
+// thread(s) to wait until some condition is fulfilled
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxCondition
+{
+public:
+ // Each wxCondition object is associated with a (single) wxMutex object.
+ // The mutex object MUST be locked before calling Wait()
+ wxCondition(wxMutex& mutex);
+
+ // dtor is not virtual, don't use this class polymorphically
+ ~wxCondition();
+
+ // return true if the condition has been created successfully
+ bool IsOk() const;
+
+ // NB: the associated mutex MUST be locked beforehand by the calling thread
+ //
+ // it atomically releases the lock on the associated mutex
+ // and starts waiting to be woken up by a Signal()/Broadcast()
+ // once its signaled, then it will wait until it can reacquire
+ // the lock on the associated mutex object, before returning.
+ wxCondError Wait();
+
+ // std::condition_variable-like variant that evaluates the associated condition
+ template<typename Functor>
+ wxCondError Wait(const Functor& predicate)
+ {
+ while ( !predicate() )
+ {
+ wxCondError e = Wait();
+ if ( e != wxCOND_NO_ERROR )
+ return e;
+ }
+ return wxCOND_NO_ERROR;
+ }
+
+ // exactly as Wait() except that it may also return if the specified
+ // timeout elapses even if the condition hasn't been signalled: in this
+ // case, the return value is wxCOND_TIMEOUT, otherwise (i.e. in case of a
+ // normal return) it is wxCOND_NO_ERROR.
+ //
+ // the timeout parameter specifies an interval that needs to be waited for
+ // in milliseconds
+ wxCondError WaitTimeout(unsigned long milliseconds);
+
+ // NB: the associated mutex may or may not be locked by the calling thread
+ //
+ // this method unblocks one thread if any are blocking on the condition.
+ // if no thread is blocking in Wait(), then the signal is NOT remembered
+ // The thread which was blocking on Wait() will then reacquire the lock
+ // on the associated mutex object before returning
+ wxCondError Signal();
+
+ // NB: the associated mutex may or may not be locked by the calling thread
+ //
+ // this method unblocks all threads if any are blocking on the condition.
+ // if no thread is blocking in Wait(), then the signal is NOT remembered
+ // The threads which were blocking on Wait() will then reacquire the lock
+ // on the associated mutex object before returning.
+ wxCondError Broadcast();
+
+
+#if WXWIN_COMPATIBILITY_2_6
+ // deprecated version, don't use
+ wxDEPRECATED( bool Wait(unsigned long milliseconds) );
+#endif // WXWIN_COMPATIBILITY_2_6
+
+private:
+ wxConditionInternal *m_internal;
+
+ wxDECLARE_NO_COPY_CLASS(wxCondition);
+};
+
+#if WXWIN_COMPATIBILITY_2_6
+ inline bool wxCondition::Wait(unsigned long milliseconds)
+ { return WaitTimeout(milliseconds) == wxCOND_NO_ERROR; }
+#endif // WXWIN_COMPATIBILITY_2_6
+
+// ----------------------------------------------------------------------------
+// wxSemaphore: a counter limiting the number of threads concurrently accessing
+// a shared resource
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxSemaphore
+{
+public:
+ // specifying a maxcount of 0 actually makes wxSemaphore behave as if there
+ // is no upper limit, if maxcount is 1 the semaphore behaves as a mutex
+ wxSemaphore( int initialcount = 0, int maxcount = 0 );
+
+ // dtor is not virtual, don't use this class polymorphically
+ ~wxSemaphore();
+
+ // return true if the semaphore has been created successfully
+ bool IsOk() const;
+
+ // wait indefinitely, until the semaphore count goes beyond 0
+ // and then decrement it and return (this method might have been called
+ // Acquire())
+ wxSemaError Wait();
+
+ // same as Wait(), but does not block, returns wxSEMA_NO_ERROR if
+ // successful and wxSEMA_BUSY if the count is currently zero
+ wxSemaError TryWait();
+
+ // same as Wait(), but as a timeout limit, returns wxSEMA_NO_ERROR if the
+ // semaphore was acquired and wxSEMA_TIMEOUT if the timeout has elapsed
+ wxSemaError WaitTimeout(unsigned long milliseconds);
+
+ // increments the semaphore count and signals one of the waiting threads
+ wxSemaError Post();
+
+private:
+ wxSemaphoreInternal *m_internal;
+
+ wxDECLARE_NO_COPY_CLASS(wxSemaphore);
+};
+
+// ----------------------------------------------------------------------------
+// wxThread: class encapsulating a thread of execution
+// ----------------------------------------------------------------------------
+
+// there are two different kinds of threads: joinable and detached (default)
+// ones. Only joinable threads can return a return code and only detached
+// threads auto-delete themselves - the user should delete the joinable
+// threads manually.
+
+// NB: in the function descriptions the words "this thread" mean the thread
+// created by the wxThread object while "main thread" is the thread created
+// during the process initialization (a.k.a. the GUI thread)
+
+// On VMS thread pointers are 64 bits (also needed for other systems???
+#ifdef __VMS
+ typedef unsigned long long wxThreadIdType;
+#else
+ typedef unsigned long wxThreadIdType;
+#endif
+
+class WXDLLIMPEXP_BASE wxThread
+{
+public:
+ // the return type for the thread function
+ typedef void *ExitCode;
+
+ // static functions
+ // Returns the wxThread object for the calling thread. NULL is returned
+ // if the caller is the main thread (but it's recommended to use
+ // IsMain() and only call This() for threads other than the main one
+ // because NULL is also returned on error). If the thread wasn't
+ // created with wxThread class, the returned value is undefined.
+ static wxThread *This();
+
+ // Returns true if current thread is the main thread.
+ //
+ // Notice that it also returns true if main thread id hadn't been
+ // initialized yet on the assumption that it's too early in wx startup
+ // process for any other threads to have been created in this case.
+ static bool IsMain()
+ {
+ return !ms_idMainThread || GetCurrentId() == ms_idMainThread;
+ }
+
+ // Return the main thread id
+ static wxThreadIdType GetMainId() { return ms_idMainThread; }
+
+ // Release the rest of our time slice letting the other threads run
+ static void Yield();
+
+ // Sleep during the specified period of time in milliseconds
+ //
+ // This is the same as wxMilliSleep().
+ static void Sleep(unsigned long milliseconds);
+
+ // get the number of system CPUs - useful with SetConcurrency()
+ // (the "best" value for it is usually number of CPUs + 1)
+ //
+ // Returns -1 if unknown, number of CPUs otherwise
+ static int GetCPUCount();
+
+ // Get the platform specific thread ID and return as a long. This
+ // can be used to uniquely identify threads, even if they are not
+ // wxThreads. This is used by wxPython.
+ static wxThreadIdType GetCurrentId();
+
+ // sets the concurrency level: this is, roughly, the number of threads
+ // the system tries to schedule to run in parallel. 0 means the
+ // default value (usually acceptable, but may not yield the best
+ // performance for this process)
+ //
+ // Returns true on success, false otherwise (if not implemented, for
+ // example)
+ static bool SetConcurrency(size_t level);
+
+ // constructor only creates the C++ thread object and doesn't create (or
+ // start) the real thread
+ wxThread(wxThreadKind kind = wxTHREAD_DETACHED);
+
+ // functions that change the thread state: all these can only be called
+ // from _another_ thread (typically the thread that created this one, e.g.
+ // the main thread), not from the thread itself
+
+ // create a new thread and optionally set the stack size on
+ // platforms that support that - call Run() to start it
+ // (special cased for watcom which won't accept 0 default)
+
+ wxThreadError Create(unsigned int stackSize = 0);
+
+ // starts execution of the thread - from the moment Run() is called
+ // the execution of wxThread::Entry() may start at any moment, caller
+ // shouldn't suppose that it starts after (or before) Run() returns.
+ wxThreadError Run();
+
+ // stops the thread if it's running and deletes the wxThread object if
+ // this is a detached thread freeing its memory - otherwise (for
+ // joinable threads) you still need to delete wxThread object
+ // yourself.
+ //
+ // this function only works if the thread calls TestDestroy()
+ // periodically - the thread will only be deleted the next time it
+ // does it!
+ //
+ // will fill the rc pointer with the thread exit code if it's !NULL
+ wxThreadError Delete(ExitCode *rc = NULL,
+ wxThreadWait waitMode = wxTHREAD_WAIT_DEFAULT);
+
+ // waits for a joinable thread to finish and returns its exit code
+ //
+ // Returns (ExitCode)-1 on error (for example, if the thread is not
+ // joinable)
+ ExitCode Wait(wxThreadWait waitMode = wxTHREAD_WAIT_DEFAULT);
+
+ // kills the thread without giving it any chance to clean up - should
+ // not be used under normal circumstances, use Delete() instead.
+ // It is a dangerous function that should only be used in the most
+ // extreme cases!
+ //
+ // The wxThread object is deleted by Kill() if the thread is
+ // detachable, but you still have to delete it manually for joinable
+ // threads.
+ wxThreadError Kill();
+
+ // pause a running thread: as Delete(), this only works if the thread
+ // calls TestDestroy() regularly
+ wxThreadError Pause();
+
+ // resume a paused thread
+ wxThreadError Resume();
+
+ // priority
+ // Sets the priority to "prio" which must be in 0..100 range (see
+ // also wxPRIORITY_XXX constants).
+ //
+ // NB: the priority can only be set before the thread is created
+ void SetPriority(unsigned int prio);
+
+ // Get the current priority.
+ unsigned int GetPriority() const;
+
+ // thread status inquiries
+ // Returns true if the thread is alive: i.e. running or suspended
+ bool IsAlive() const;
+ // Returns true if the thread is running (not paused, not killed).
+ bool IsRunning() const;
+ // Returns true if the thread is suspended
+ bool IsPaused() const;
+
+ // is the thread of detached kind?
+ bool IsDetached() const { return m_isDetached; }
+
+ // Get the thread ID - a platform dependent number which uniquely
+ // identifies a thread inside a process
+ wxThreadIdType GetId() const;
+
+ wxThreadKind GetKind() const
+ { return m_isDetached ? wxTHREAD_DETACHED : wxTHREAD_JOINABLE; }
+
+ // Returns true if the thread was asked to terminate: this function should
+ // be called by the thread from time to time, otherwise the main thread
+ // will be left forever in Delete()!
+ virtual bool TestDestroy();
+
+ // dtor is public, but the detached threads should never be deleted - use
+ // Delete() instead (or leave the thread terminate by itself)
+ virtual ~wxThread();
+
+protected:
+ // exits from the current thread - can be called only from this thread
+ void Exit(ExitCode exitcode = 0);
+
+ // entry point for the thread - called by Run() and executes in the context
+ // of this thread.
+ virtual void *Entry() = 0;
+
+ // use this to call the Entry() virtual method
+ void *CallEntry();
+
+ // Callbacks which may be overridden by the derived class to perform some
+ // specific actions when the thread is deleted or killed. By default they
+ // do nothing.
+
+ // This one is called by Delete() before actually deleting the thread and
+ // is executed in the context of the thread that called Delete().
+ virtual void OnDelete() {}
+
+ // This one is called by Kill() before killing the thread and is executed
+ // in the context of the thread that called Kill().
+ virtual void OnKill() {}
+
+private:
+ // no copy ctor/assignment operator
+ wxThread(const wxThread&);
+ wxThread& operator=(const wxThread&);
+
+ // called when the thread exits - in the context of this thread
+ //
+ // NB: this function will not be called if the thread is Kill()ed
+ virtual void OnExit() { }
+
+ friend class wxThreadInternal;
+ friend class wxThreadModule;
+
+
+ // the main thread identifier, should be set on startup
+ static wxThreadIdType ms_idMainThread;
+
+ // the (platform-dependent) thread class implementation
+ wxThreadInternal *m_internal;
+
+ // protects access to any methods of wxThreadInternal object
+ wxCriticalSection m_critsect;
+
+ // true if the thread is detached, false if it is joinable
+ bool m_isDetached;
+};
+
+// wxThreadHelperThread class
+// --------------------------
+
+class WXDLLIMPEXP_BASE wxThreadHelperThread : public wxThread
+{
+public:
+ // constructor only creates the C++ thread object and doesn't create (or
+ // start) the real thread
+ wxThreadHelperThread(wxThreadHelper& owner, wxThreadKind kind)
+ : wxThread(kind), m_owner(owner)
+ { }
+
+protected:
+ // entry point for the thread -- calls Entry() in owner.
+ virtual void *Entry();
+
+private:
+ // the owner of the thread
+ wxThreadHelper& m_owner;
+
+ // no copy ctor/assignment operator
+ wxThreadHelperThread(const wxThreadHelperThread&);
+ wxThreadHelperThread& operator=(const wxThreadHelperThread&);
+};
+
+// ----------------------------------------------------------------------------
+// wxThreadHelper: this class implements the threading logic to run a
+// background task in another object (such as a window). It is a mix-in: just
+// derive from it to implement a threading background task in your class.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxThreadHelper
+{
+private:
+ void KillThread()
+ {
+ // If wxThreadHelperThread is detached and is about to finish, it will
+ // set m_thread to NULL so don't delete it then.
+ // But if KillThread is called before wxThreadHelperThread (in detached mode)
+ // sets it to NULL, then the thread object still exists and can be killed
+ wxCriticalSectionLocker locker(m_critSection);
+
+ if ( m_thread )
+ {
+ m_thread->Kill();
+
+ if ( m_kind == wxTHREAD_JOINABLE )
+ delete m_thread;
+
+ m_thread = NULL;
+ }
+ }
+
+public:
+ // constructor only initializes m_thread to NULL
+ wxThreadHelper(wxThreadKind kind = wxTHREAD_JOINABLE)
+ : m_thread(NULL), m_kind(kind) { }
+
+ // destructor deletes m_thread
+ virtual ~wxThreadHelper() { KillThread(); }
+
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED( wxThreadError Create(unsigned int stackSize = 0) );
+#endif
+
+ // create a new thread (and optionally set the stack size on platforms that
+ // support/need that), call Run() to start it
+ wxThreadError CreateThread(wxThreadKind kind = wxTHREAD_JOINABLE,
+ unsigned int stackSize = 0)
+ {
+ KillThread();
+
+ m_kind = kind;
+ m_thread = new wxThreadHelperThread(*this, m_kind);
+
+ return m_thread->Create(stackSize);
+ }
+
+ // entry point for the thread - called by Run() and executes in the context
+ // of this thread.
+ virtual void *Entry() = 0;
+
+ // returns a pointer to the thread which can be used to call Run()
+ wxThread *GetThread() const
+ {
+ wxCriticalSectionLocker locker((wxCriticalSection&)m_critSection);
+
+ wxThread* thread = m_thread;
+
+ return thread;
+ }
+
+protected:
+ wxThread *m_thread;
+ wxThreadKind m_kind;
+ wxCriticalSection m_critSection; // To guard the m_thread variable
+
+ friend class wxThreadHelperThread;
+};
+
+#if WXWIN_COMPATIBILITY_2_8
+inline wxThreadError wxThreadHelper::Create(unsigned int stackSize)
+{ return CreateThread(m_kind, stackSize); }
+#endif
+
+// call Entry() in owner, put it down here to avoid circular declarations
+inline void *wxThreadHelperThread::Entry()
+{
+ void * const result = m_owner.Entry();
+
+ wxCriticalSectionLocker locker(m_owner.m_critSection);
+
+ // Detached thread will be deleted after returning, so make sure
+ // wxThreadHelper::GetThread will not return an invalid pointer.
+ // And that wxThreadHelper::KillThread will not try to kill
+ // an already deleted thread
+ if ( m_owner.m_kind == wxTHREAD_DETACHED )
+ m_owner.m_thread = NULL;
+
+ return result;
+}
+
+// ----------------------------------------------------------------------------
+// Automatic initialization
+// ----------------------------------------------------------------------------
+
+// GUI mutex handling.
+void WXDLLIMPEXP_BASE wxMutexGuiEnter();
+void WXDLLIMPEXP_BASE wxMutexGuiLeave();
+
+// macros for entering/leaving critical sections which may be used without
+// having to take them inside "#if wxUSE_THREADS"
+#define wxENTER_CRIT_SECT(cs) (cs).Enter()
+#define wxLEAVE_CRIT_SECT(cs) (cs).Leave()
+#define wxCRIT_SECT_DECLARE(cs) static wxCriticalSection cs
+#define wxCRIT_SECT_DECLARE_MEMBER(cs) wxCriticalSection cs
+#define wxCRIT_SECT_LOCKER(name, cs) wxCriticalSectionLocker name(cs)
+
+// function for checking if we're in the main thread which may be used whether
+// wxUSE_THREADS is 0 or 1
+inline bool wxIsMainThread() { return wxThread::IsMain(); }
+
+#else // !wxUSE_THREADS
+
+// no thread support
+inline void wxMutexGuiEnter() { }
+inline void wxMutexGuiLeave() { }
+
+// macros for entering/leaving critical sections which may be used without
+// having to take them inside "#if wxUSE_THREADS"
+// (the implementation uses dummy structs to force semicolon after the macro;
+// also notice that Watcom doesn't like declaring a struct as a member so we
+// need to actually define it in wxCRIT_SECT_DECLARE_MEMBER)
+#define wxENTER_CRIT_SECT(cs) do {} while (0)
+#define wxLEAVE_CRIT_SECT(cs) do {} while (0)
+#define wxCRIT_SECT_DECLARE(cs) struct wxDummyCS##cs
+#define wxCRIT_SECT_DECLARE_MEMBER(cs) struct wxDummyCSMember##cs { }
+#define wxCRIT_SECT_LOCKER(name, cs) struct wxDummyCSLocker##name
+
+// if there is only one thread, it is always the main one
+inline bool wxIsMainThread() { return true; }
+
+#endif // wxUSE_THREADS/!wxUSE_THREADS
+
+// mark part of code as being a critical section: this macro declares a
+// critical section with the given name and enters it immediately and leaves
+// it at the end of the current scope
+//
+// example:
+//
+// int Count()
+// {
+// static int s_counter = 0;
+//
+// wxCRITICAL_SECTION(counter);
+//
+// return ++s_counter;
+// }
+//
+// this function is MT-safe in presence of the threads but there is no
+// overhead when the library is compiled without threads
+#define wxCRITICAL_SECTION(name) \
+ wxCRIT_SECT_DECLARE(s_cs##name); \
+ wxCRIT_SECT_LOCKER(cs##name##Locker, s_cs##name)
+
+// automatically lock GUI mutex in ctor and unlock it in dtor
+class WXDLLIMPEXP_BASE wxMutexGuiLocker
+{
+public:
+ wxMutexGuiLocker() { wxMutexGuiEnter(); }
+ ~wxMutexGuiLocker() { wxMutexGuiLeave(); }
+};
+
+// -----------------------------------------------------------------------------
+// implementation only until the end of file
+// -----------------------------------------------------------------------------
+
+#if wxUSE_THREADS
+
+#if defined(__WINDOWS__) || defined(__OS2__) || defined(__EMX__) || defined(__DARWIN__)
+ // unlock GUI if there are threads waiting for and lock it back when
+ // there are no more of them - should be called periodically by the main
+ // thread
+ extern void WXDLLIMPEXP_BASE wxMutexGuiLeaveOrEnter();
+
+ // returns true if the main thread has GUI lock
+ extern bool WXDLLIMPEXP_BASE wxGuiOwnedByMainThread();
+
+ // wakes up the main thread if it's sleeping inside ::GetMessage()
+ extern void WXDLLIMPEXP_BASE wxWakeUpMainThread();
+
+#ifndef __DARWIN__
+ // return true if the main thread is waiting for some other to terminate:
+ // wxApp then should block all "dangerous" messages
+ extern bool WXDLLIMPEXP_BASE wxIsWaitingForThread();
+#endif
+#endif // MSW, OS/2
+
+#endif // wxUSE_THREADS
+
+#endif // _WX_THREAD_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/thrimpl.cpp
+// Purpose: common part of wxThread Implementations
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 04.06.02 (extracted from src/*/thread.cpp files)
+// Copyright: (c) Vadim Zeitlin (2002)
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// this file is supposed to be included only by the various thread.cpp
+
+// ----------------------------------------------------------------------------
+// wxMutex
+// ----------------------------------------------------------------------------
+
+wxMutex::wxMutex(wxMutexType mutexType)
+{
+ m_internal = new wxMutexInternal(mutexType);
+
+ if ( !m_internal->IsOk() )
+ {
+ delete m_internal;
+ m_internal = NULL;
+ }
+}
+
+wxMutex::~wxMutex()
+{
+ delete m_internal;
+}
+
+bool wxMutex::IsOk() const
+{
+ return m_internal != NULL;
+}
+
+wxMutexError wxMutex::Lock()
+{
+ wxCHECK_MSG( m_internal, wxMUTEX_INVALID,
+ wxT("wxMutex::Lock(): not initialized") );
+
+ return m_internal->Lock();
+}
+
+wxMutexError wxMutex::LockTimeout(unsigned long ms)
+{
+ wxCHECK_MSG( m_internal, wxMUTEX_INVALID,
+ wxT("wxMutex::Lock(): not initialized") );
+
+ return m_internal->Lock(ms);
+}
+
+wxMutexError wxMutex::TryLock()
+{
+ wxCHECK_MSG( m_internal, wxMUTEX_INVALID,
+ wxT("wxMutex::TryLock(): not initialized") );
+
+ return m_internal->TryLock();
+}
+
+wxMutexError wxMutex::Unlock()
+{
+ wxCHECK_MSG( m_internal, wxMUTEX_INVALID,
+ wxT("wxMutex::Unlock(): not initialized") );
+
+ return m_internal->Unlock();
+}
+
+// --------------------------------------------------------------------------
+// wxConditionInternal
+// --------------------------------------------------------------------------
+
+// Win32 and OS/2 don't have explicit support for the POSIX condition
+// variables and their events/event semaphores have quite different semantics,
+// so we reimplement the conditions from scratch using the mutexes and
+// semaphores
+#if defined(__WINDOWS__) || defined(__OS2__) || defined(__EMX__)
+
+class wxConditionInternal
+{
+public:
+ wxConditionInternal(wxMutex& mutex);
+
+ bool IsOk() const { return m_mutex.IsOk() && m_semaphore.IsOk(); }
+
+ wxCondError Wait();
+ wxCondError WaitTimeout(unsigned long milliseconds);
+
+ wxCondError Signal();
+ wxCondError Broadcast();
+
+private:
+ // the number of threads currently waiting for this condition
+ LONG m_numWaiters;
+
+ // the critical section protecting m_numWaiters
+ wxCriticalSection m_csWaiters;
+
+ wxMutex& m_mutex;
+ wxSemaphore m_semaphore;
+
+ wxDECLARE_NO_COPY_CLASS(wxConditionInternal);
+};
+
+wxConditionInternal::wxConditionInternal(wxMutex& mutex)
+ : m_mutex(mutex)
+{
+ // another thread can't access it until we return from ctor, so no need to
+ // protect access to m_numWaiters here
+ m_numWaiters = 0;
+}
+
+wxCondError wxConditionInternal::Wait()
+{
+ // increment the number of waiters
+ {
+ wxCriticalSectionLocker lock(m_csWaiters);
+ m_numWaiters++;
+ }
+
+ m_mutex.Unlock();
+
+ // after unlocking the mutex other threads may Signal() us, but it is ok
+ // now as we had already incremented m_numWaiters so Signal() will post the
+ // semaphore and decrement m_numWaiters back even if it is called before we
+ // start to Wait()
+ const wxSemaError err = m_semaphore.Wait();
+
+ m_mutex.Lock();
+
+ if ( err == wxSEMA_NO_ERROR )
+ {
+ // m_numWaiters was decremented by Signal()
+ return wxCOND_NO_ERROR;
+ }
+
+ // but in case of an error we need to do it manually
+ {
+ wxCriticalSectionLocker lock(m_csWaiters);
+ m_numWaiters--;
+ }
+
+ return err == wxSEMA_TIMEOUT ? wxCOND_TIMEOUT : wxCOND_MISC_ERROR;
+}
+
+wxCondError wxConditionInternal::WaitTimeout(unsigned long milliseconds)
+{
+ {
+ wxCriticalSectionLocker lock(m_csWaiters);
+ m_numWaiters++;
+ }
+
+ m_mutex.Unlock();
+
+ wxSemaError err = m_semaphore.WaitTimeout(milliseconds);
+
+ m_mutex.Lock();
+
+ if ( err == wxSEMA_NO_ERROR )
+ return wxCOND_NO_ERROR;
+
+ if ( err == wxSEMA_TIMEOUT )
+ {
+ // a potential race condition exists here: it happens when a waiting
+ // thread times out but doesn't have time to decrement m_numWaiters yet
+ // before Signal() is called in another thread
+ //
+ // to handle this particular case, check the semaphore again after
+ // acquiring m_csWaiters lock -- this will catch the signals missed
+ // during this window
+ wxCriticalSectionLocker lock(m_csWaiters);
+
+ err = m_semaphore.WaitTimeout(0);
+ if ( err == wxSEMA_NO_ERROR )
+ return wxCOND_NO_ERROR;
+
+ // we need to decrement m_numWaiters ourselves as it wasn't done by
+ // Signal()
+ m_numWaiters--;
+
+ return err == wxSEMA_TIMEOUT ? wxCOND_TIMEOUT : wxCOND_MISC_ERROR;
+ }
+
+ // undo m_numWaiters++ above in case of an error
+ {
+ wxCriticalSectionLocker lock(m_csWaiters);
+ m_numWaiters--;
+ }
+
+ return wxCOND_MISC_ERROR;
+}
+
+wxCondError wxConditionInternal::Signal()
+{
+ wxCriticalSectionLocker lock(m_csWaiters);
+
+ if ( m_numWaiters > 0 )
+ {
+ // increment the semaphore by 1
+ if ( m_semaphore.Post() != wxSEMA_NO_ERROR )
+ return wxCOND_MISC_ERROR;
+
+ m_numWaiters--;
+ }
+
+ return wxCOND_NO_ERROR;
+}
+
+wxCondError wxConditionInternal::Broadcast()
+{
+ wxCriticalSectionLocker lock(m_csWaiters);
+
+ while ( m_numWaiters > 0 )
+ {
+ if ( m_semaphore.Post() != wxSEMA_NO_ERROR )
+ return wxCOND_MISC_ERROR;
+
+ m_numWaiters--;
+ }
+
+ return wxCOND_NO_ERROR;
+}
+
+#endif // __WINDOWS__ || __OS2__ || __EMX__
+
+// ----------------------------------------------------------------------------
+// wxCondition
+// ----------------------------------------------------------------------------
+
+wxCondition::wxCondition(wxMutex& mutex)
+{
+ m_internal = new wxConditionInternal(mutex);
+
+ if ( !m_internal->IsOk() )
+ {
+ delete m_internal;
+ m_internal = NULL;
+ }
+}
+
+wxCondition::~wxCondition()
+{
+ delete m_internal;
+}
+
+bool wxCondition::IsOk() const
+{
+ return m_internal != NULL;
+}
+
+wxCondError wxCondition::Wait()
+{
+ wxCHECK_MSG( m_internal, wxCOND_INVALID,
+ wxT("wxCondition::Wait(): not initialized") );
+
+ return m_internal->Wait();
+}
+
+wxCondError wxCondition::WaitTimeout(unsigned long milliseconds)
+{
+ wxCHECK_MSG( m_internal, wxCOND_INVALID,
+ wxT("wxCondition::Wait(): not initialized") );
+
+ return m_internal->WaitTimeout(milliseconds);
+}
+
+wxCondError wxCondition::Signal()
+{
+ wxCHECK_MSG( m_internal, wxCOND_INVALID,
+ wxT("wxCondition::Signal(): not initialized") );
+
+ return m_internal->Signal();
+}
+
+wxCondError wxCondition::Broadcast()
+{
+ wxCHECK_MSG( m_internal, wxCOND_INVALID,
+ wxT("wxCondition::Broadcast(): not initialized") );
+
+ return m_internal->Broadcast();
+}
+
+// --------------------------------------------------------------------------
+// wxSemaphore
+// --------------------------------------------------------------------------
+
+wxSemaphore::wxSemaphore(int initialcount, int maxcount)
+{
+ m_internal = new wxSemaphoreInternal( initialcount, maxcount );
+ if ( !m_internal->IsOk() )
+ {
+ delete m_internal;
+ m_internal = NULL;
+ }
+}
+
+wxSemaphore::~wxSemaphore()
+{
+ delete m_internal;
+}
+
+bool wxSemaphore::IsOk() const
+{
+ return m_internal != NULL;
+}
+
+wxSemaError wxSemaphore::Wait()
+{
+ wxCHECK_MSG( m_internal, wxSEMA_INVALID,
+ wxT("wxSemaphore::Wait(): not initialized") );
+
+ return m_internal->Wait();
+}
+
+wxSemaError wxSemaphore::TryWait()
+{
+ wxCHECK_MSG( m_internal, wxSEMA_INVALID,
+ wxT("wxSemaphore::TryWait(): not initialized") );
+
+ return m_internal->TryWait();
+}
+
+wxSemaError wxSemaphore::WaitTimeout(unsigned long milliseconds)
+{
+ wxCHECK_MSG( m_internal, wxSEMA_INVALID,
+ wxT("wxSemaphore::WaitTimeout(): not initialized") );
+
+ return m_internal->WaitTimeout(milliseconds);
+}
+
+wxSemaError wxSemaphore::Post()
+{
+ wxCHECK_MSG( m_internal, wxSEMA_INVALID,
+ wxT("wxSemaphore::Post(): not initialized") );
+
+ return m_internal->Post();
+}
+
+// ----------------------------------------------------------------------------
+// wxThread
+// ----------------------------------------------------------------------------
+
+#include "wx/utils.h"
+#include "wx/private/threadinfo.h"
+#include "wx/scopeguard.h"
+
+void wxThread::Sleep(unsigned long milliseconds)
+{
+ wxMilliSleep(milliseconds);
+}
+
+void *wxThread::CallEntry()
+{
+ wxON_BLOCK_EXIT0(wxThreadSpecificInfo::ThreadCleanUp);
+ return Entry();
+}
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/time.h
+// Purpose: Miscellaneous time-related functions.
+// Author: Vadim Zeitlin
+// Created: 2011-11-26
+// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TIME_H_
+#define _WX_TIME_H_
+
+#include "wx/longlong.h"
+
+// Returns the difference between UTC and local time in seconds.
+WXDLLIMPEXP_BASE int wxGetTimeZone();
+
+// Get number of seconds since local time 00:00:00 Jan 1st 1970.
+extern long WXDLLIMPEXP_BASE wxGetLocalTime();
+
+// Get number of seconds since GMT 00:00:00, Jan 1st 1970.
+extern long WXDLLIMPEXP_BASE wxGetUTCTime();
+
+#if wxUSE_LONGLONG
+ typedef wxLongLong wxMilliClock_t;
+ inline long wxMilliClockToLong(wxLongLong ll) { return ll.ToLong(); }
+#else
+ typedef double wxMilliClock_t;
+ inline long wxMilliClockToLong(double d) { return wx_truncate_cast(long, d); }
+#endif // wxUSE_LONGLONG
+
+// Get number of milliseconds since local time 00:00:00 Jan 1st 1970
+extern wxMilliClock_t WXDLLIMPEXP_BASE wxGetLocalTimeMillis();
+
+#if wxUSE_LONGLONG
+
+// Get the number of milliseconds or microseconds since the Epoch.
+wxLongLong WXDLLIMPEXP_BASE wxGetUTCTimeMillis();
+wxLongLong WXDLLIMPEXP_BASE wxGetUTCTimeUSec();
+
+#endif // wxUSE_LONGLONG
+
+#define wxGetCurrentTime() wxGetLocalTime()
+
+// on some really old systems gettimeofday() doesn't have the second argument,
+// define wxGetTimeOfDay() to hide this difference
+#ifdef HAVE_GETTIMEOFDAY
+ #ifdef WX_GETTIMEOFDAY_NO_TZ
+ #define wxGetTimeOfDay(tv) gettimeofday(tv)
+ #else
+ #define wxGetTimeOfDay(tv) gettimeofday((tv), NULL)
+ #endif
+#endif // HAVE_GETTIMEOFDAY
+
+/* Two wrapper functions for thread safety */
+#ifdef HAVE_LOCALTIME_R
+#define wxLocaltime_r localtime_r
+#else
+WXDLLIMPEXP_BASE struct tm *wxLocaltime_r(const time_t*, struct tm*);
+#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__)
+ // On Windows, localtime _is_ threadsafe!
+#warning using pseudo thread-safe wrapper for localtime to emulate localtime_r
+#endif
+#endif
+
+#ifdef HAVE_GMTIME_R
+#define wxGmtime_r gmtime_r
+#else
+WXDLLIMPEXP_BASE struct tm *wxGmtime_r(const time_t*, struct tm*);
+#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__)
+ // On Windows, gmtime _is_ threadsafe!
+#warning using pseudo thread-safe wrapper for gmtime to emulate gmtime_r
+#endif
+#endif
+
+#endif // _WX_TIME_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/timectrl.h
+// Purpose: Declaration of wxTimePickerCtrl class.
+// Author: Vadim Zeitlin
+// Created: 2011-09-22
+// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TIMECTRL_H_
+#define _WX_TIMECTRL_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_TIMEPICKCTRL
+
+#include "wx/datetimectrl.h"
+
+#define wxTimePickerCtrlNameStr wxS("timectrl")
+
+// No special styles are currently defined for this control but still define a
+// symbolic constant for the default style for consistency.
+enum
+{
+ wxTP_DEFAULT = 0
+};
+
+// ----------------------------------------------------------------------------
+// wxTimePickerCtrl: Allow the user to enter the time.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxTimePickerCtrlBase : public wxDateTimePickerCtrl
+{
+public:
+ /*
+ The derived classes should implement ctor and Create() method with the
+ following signature:
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxDateTime& dt = wxDefaultDateTime,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxTP_DEFAULT,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxTimePickerCtrlNameStr);
+ */
+
+ /*
+ We also inherit Set/GetValue() methods from the base class which define
+ our public API. Notice that the date portion of the date passed as
+ input or received as output is or should be ignored, only the time part
+ of wxDateTime objects is really significant here. Use Set/GetTime()
+ below for possibly simpler interface.
+ */
+
+ // Set the given time.
+ bool SetTime(int hour, int min, int sec)
+ {
+ // Notice that we should use a date on which DST doesn't change to
+ // avoid any problems with time discontinuity so use a fixed date (on
+ // which nobody changes DST) instead of e.g. today.
+ wxDateTime dt(1, wxDateTime::Jan, 2012, hour, min, sec);
+ if ( !dt.IsValid() )
+ {
+ // No need to assert here, wxDateTime already does it for us.
+ return false;
+ }
+
+ SetValue(dt);
+
+ return true;
+ }
+
+ // Get the current time components. All pointers must be non-NULL.
+ bool GetTime(int* hour, int* min, int* sec) const
+ {
+ wxCHECK_MSG( hour && min && sec, false,
+ wxS("Time component pointers must be non-NULL") );
+
+ const wxDateTime::Tm tm = GetValue().GetTm();
+ *hour = tm.hour;
+ *min = tm.min;
+ *sec = tm.sec;
+
+ return true;
+ }
+};
+
+#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
+ #include "wx/msw/timectrl.h"
+
+ #define wxHAS_NATIVE_TIMEPICKERCTRL
+#elif defined(__WXOSX_COCOA__) && !defined(__WXUNIVERSAL__)
+ #include "wx/osx/timectrl.h"
+
+ #define wxHAS_NATIVE_TIMEPICKERCTRL
+#else
+ #include "wx/generic/timectrl.h"
+
+ class WXDLLIMPEXP_ADV wxTimePickerCtrl : public wxTimePickerCtrlGeneric
+ {
+ public:
+ wxTimePickerCtrl() { }
+ wxTimePickerCtrl(wxWindow *parent,
+ wxWindowID id,
+ const wxDateTime& date = wxDefaultDateTime,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxTP_DEFAULT,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxTimePickerCtrlNameStr)
+ : wxTimePickerCtrlGeneric(parent, id, date, pos, size, style, validator, name)
+ {
+ }
+
+ private:
+ wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTimePickerCtrl);
+ };
+#endif
+
+#endif // wxUSE_TIMEPICKCTRL
+
+#endif // _WX_TIMECTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/timer.h
+// Purpose: wxTimer, wxStopWatch and global time-related functions
+// Author: Julian Smart
+// Modified by: Vadim Zeitlin (wxTimerBase)
+// Guillermo Rodriguez (global clean up)
+// Created: 04/01/98
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TIMER_H_BASE_
+#define _WX_TIMER_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_TIMER
+
+#include "wx/object.h"
+#include "wx/longlong.h"
+#include "wx/event.h"
+#include "wx/stopwatch.h" // for backwards compatibility
+#include "wx/utils.h"
+
+
+// more readable flags for Start():
+
+// generate notifications periodically until the timer is stopped (default)
+#define wxTIMER_CONTINUOUS false
+
+// only send the notification once and then stop the timer
+#define wxTIMER_ONE_SHOT true
+
+class WXDLLIMPEXP_FWD_BASE wxTimerImpl;
+class WXDLLIMPEXP_FWD_BASE wxTimerEvent;
+
+// timer event type
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_TIMER, wxTimerEvent);
+
+// the interface of wxTimer class
+class WXDLLIMPEXP_BASE wxTimer : public wxEvtHandler
+{
+public:
+ // ctors and initializers
+ // ----------------------
+
+ // default: if you don't call SetOwner(), your only chance to get timer
+ // notifications is to override Notify() in the derived class
+ wxTimer()
+ {
+ Init();
+ SetOwner(this);
+ }
+
+ // ctor which allows to avoid having to override Notify() in the derived
+ // class: the owner will get timer notifications which can be handled with
+ // EVT_TIMER
+ wxTimer(wxEvtHandler *owner, int timerid = wxID_ANY)
+ {
+ Init();
+ SetOwner(owner, timerid);
+ }
+
+ // same as ctor above
+ void SetOwner(wxEvtHandler *owner, int timerid = wxID_ANY);
+
+ virtual ~wxTimer();
+
+
+ // working with the timer
+ // ----------------------
+
+ // NB: Start() and Stop() are not supposed to be overridden, they are only
+ // virtual for historical reasons, only Notify() can be overridden
+
+ // start the timer: if milliseconds == -1, use the same value as for the
+ // last Start()
+ //
+ // it is now valid to call Start() multiple times: this just restarts the
+ // timer if it is already running
+ virtual bool Start(int milliseconds = -1, bool oneShot = false);
+
+ // start the timer for one iteration only, this is just a simple wrapper
+ // for Start()
+ bool StartOnce(int milliseconds = -1) { return Start(milliseconds, true); }
+
+ // stop the timer, does nothing if the timer is not running
+ virtual void Stop();
+
+ // override this in your wxTimer-derived class if you want to process timer
+ // messages in it, use non default ctor or SetOwner() otherwise
+ virtual void Notify();
+
+
+ // accessors
+ // ---------
+
+ // get the object notified about the timer events
+ wxEvtHandler *GetOwner() const;
+
+ // return true if the timer is running
+ bool IsRunning() const;
+
+ // return the timer ID
+ int GetId() const;
+
+ // get the (last) timer interval in milliseconds
+ int GetInterval() const;
+
+ // return true if the timer is one shot
+ bool IsOneShot() const;
+
+protected:
+ // common part of all ctors
+ void Init();
+
+ wxTimerImpl *m_impl;
+
+ wxDECLARE_NO_COPY_CLASS(wxTimer);
+};
+
+// ----------------------------------------------------------------------------
+// wxTimerRunner: starts the timer in its ctor, stops in the dtor
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxTimerRunner
+{
+public:
+ wxTimerRunner(wxTimer& timer) : m_timer(timer) { }
+ wxTimerRunner(wxTimer& timer, int milli, bool oneShot = false)
+ : m_timer(timer)
+ {
+ m_timer.Start(milli, oneShot);
+ }
+
+ void Start(int milli, bool oneShot = false)
+ {
+ m_timer.Start(milli, oneShot);
+ }
+
+ ~wxTimerRunner()
+ {
+ if ( m_timer.IsRunning() )
+ {
+ m_timer.Stop();
+ }
+ }
+
+private:
+ wxTimer& m_timer;
+
+ wxDECLARE_NO_COPY_CLASS(wxTimerRunner);
+};
+
+// ----------------------------------------------------------------------------
+// wxTimerEvent
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxTimerEvent : public wxEvent
+{
+public:
+ wxTimerEvent()
+ : wxEvent(wxID_ANY, wxEVT_TIMER) { m_timer=NULL; }
+
+ wxTimerEvent(wxTimer& timer)
+ : wxEvent(timer.GetId(), wxEVT_TIMER),
+ m_timer(&timer)
+ {
+ SetEventObject(timer.GetOwner());
+ }
+
+ // accessors
+ int GetInterval() const { return m_timer->GetInterval(); }
+ wxTimer& GetTimer() const { return *m_timer; }
+
+ // implement the base class pure virtual
+ virtual wxEvent *Clone() const { return new wxTimerEvent(*this); }
+ virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_TIMER; }
+
+private:
+ wxTimer* m_timer;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTimerEvent)
+};
+
+typedef void (wxEvtHandler::*wxTimerEventFunction)(wxTimerEvent&);
+
+#define wxTimerEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxTimerEventFunction, func)
+
+#define EVT_TIMER(timerid, func) \
+ wx__DECLARE_EVT1(wxEVT_TIMER, timerid, wxTimerEventHandler(func))
+
+#endif // wxUSE_TIMER
+
+#endif // _WX_TIMER_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/tipdlg.h
+// Purpose: declaration of wxTipDialog
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 28.06.99
+// Copyright: (c) Vadim Zeitlin
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TIPDLG_H_
+#define _WX_TIPDLG_H_
+
+// ----------------------------------------------------------------------------
+// headers which we must include here
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_STARTUP_TIPS
+
+#include "wx/textfile.h"
+
+// ----------------------------------------------------------------------------
+// wxTipProvider - a class which is used by wxTipDialog to get the text of the
+// tips
+// ----------------------------------------------------------------------------
+
+// the abstract base class: it provides the tips, i.e. implements the GetTip()
+// function which returns the new tip each time it's called. To support this,
+// wxTipProvider evidently needs some internal state which is the tip "index"
+// and which should be saved/restored by the program to not always show one and
+// the same tip (of course, you may use random starting position as well...)
+class WXDLLIMPEXP_ADV wxTipProvider
+{
+public:
+ wxTipProvider(size_t currentTip) { m_currentTip = currentTip; }
+
+ // get the current tip and update the internal state to return the next tip
+ // when called for the next time
+ virtual wxString GetTip() = 0;
+
+ // get the current tip "index" (or whatever allows the tip provider to know
+ // from where to start the next time)
+ size_t GetCurrentTip() const { return m_currentTip; }
+
+ // Allows any user-derived class to optionally override this function to
+ // modify the tip as soon as it is read. If return wxEmptyString, then
+ // the tip is skipped, and the next one is read.
+ virtual wxString PreprocessTip(const wxString& tip) { return tip; }
+
+ // virtual dtor for the base class
+ virtual ~wxTipProvider() { }
+
+protected:
+ size_t m_currentTip;
+};
+
+// a function which returns an implementation of wxTipProvider using the
+// specified text file as the source of tips (each line is a tip).
+//
+// NB: the caller is responsible for deleting the pointer!
+#if wxUSE_TEXTFILE
+WXDLLIMPEXP_ADV wxTipProvider *wxCreateFileTipProvider(const wxString& filename,
+ size_t currentTip);
+#endif // wxUSE_TEXTFILE
+
+// ----------------------------------------------------------------------------
+// wxTipDialog
+// ----------------------------------------------------------------------------
+
+// A dialog which shows a "tip" - a short and helpful messages describing to
+// the user some program characteristic. Many programs show the tips at
+// startup, so the dialog has "Show tips on startup" checkbox which allows to
+// the user to disable this (however, it's the program which should show, or
+// not, the dialog on startup depending on its value, not this class).
+//
+// The function returns true if this checkbox is checked, false otherwise.
+WXDLLIMPEXP_ADV bool wxShowTip(wxWindow *parent,
+ wxTipProvider *tipProvider,
+ bool showAtStartup = true);
+
+#endif // wxUSE_STARTUP_TIPS
+
+#endif // _WX_TIPDLG_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/tipwin.h
+// Purpose: wxTipWindow is a window like the one typically used for
+// showing the tooltips
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 10.09.00
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TIPWIN_H_
+#define _WX_TIPWIN_H_
+
+#if wxUSE_TIPWINDOW
+
+#if wxUSE_POPUPWIN
+ #include "wx/popupwin.h"
+
+ #define wxTipWindowBase wxPopupTransientWindow
+#else
+ #include "wx/frame.h"
+
+ #define wxTipWindowBase wxFrame
+#endif
+#include "wx/arrstr.h"
+
+class WXDLLIMPEXP_FWD_CORE wxTipWindowView;
+
+// ----------------------------------------------------------------------------
+// wxTipWindow
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxTipWindow : public wxTipWindowBase
+{
+public:
+ // the mandatory ctor parameters are: the parent window and the text to
+ // show
+ //
+ // optionally you may also specify the length at which the lines are going
+ // to be broken in rows (100 pixels by default)
+ //
+ // windowPtr and rectBound are just passed to SetTipWindowPtr() and
+ // SetBoundingRect() - see below
+ wxTipWindow(wxWindow *parent,
+ const wxString& text,
+ wxCoord maxLength = 100,
+ wxTipWindow** windowPtr = NULL,
+ wxRect *rectBound = NULL);
+
+ virtual ~wxTipWindow();
+
+ // If windowPtr is not NULL the given address will be NULLed when the
+ // window has closed
+ void SetTipWindowPtr(wxTipWindow** windowPtr) { m_windowPtr = windowPtr; }
+
+ // If rectBound is not NULL, the window will disappear automatically when
+ // the mouse leave the specified rect: note that rectBound should be in the
+ // screen coordinates!
+ void SetBoundingRect(const wxRect& rectBound);
+
+ // Hide and destroy the window
+ void Close();
+
+protected:
+ // called by wxTipWindowView only
+ bool CheckMouseInBounds(const wxPoint& pos);
+
+ // event handlers
+ void OnMouseClick(wxMouseEvent& event);
+
+#if !wxUSE_POPUPWIN
+ void OnActivate(wxActivateEvent& event);
+ void OnKillFocus(wxFocusEvent& event);
+#else // wxUSE_POPUPWIN
+ virtual void OnDismiss();
+#endif // wxUSE_POPUPWIN/!wxUSE_POPUPWIN
+
+private:
+ wxArrayString m_textLines;
+ wxCoord m_heightLine;
+
+ wxTipWindowView *m_view;
+
+ wxTipWindow** m_windowPtr;
+ wxRect m_rectBound;
+
+ DECLARE_EVENT_TABLE()
+
+ friend class wxTipWindowView;
+
+ wxDECLARE_NO_COPY_CLASS(wxTipWindow);
+};
+
+#endif // wxUSE_TIPWINDOW
+
+#endif // _WX_TIPWIN_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/tls.h
+// Purpose: Implementation of thread local storage
+// Author: Vadim Zeitlin
+// Created: 2008-08-08
+// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TLS_H_
+#define _WX_TLS_H_
+
+#include "wx/defs.h"
+
+// ----------------------------------------------------------------------------
+// check for compiler support of thread-specific variables
+// ----------------------------------------------------------------------------
+
+// when not using threads at all, there is no need for thread-specific
+// values to be really thread-specific
+#if !wxUSE_THREADS
+ #define wxHAS_COMPILER_TLS
+ #define wxTHREAD_SPECIFIC_DECL
+// otherwise try to find the compiler-specific way to handle TLS unless
+// explicitly disabled by setting wxUSE_COMPILER_TLS to 0 (it is 1 by default).
+#elif wxUSE_COMPILER_TLS
+// __thread keyword is not supported correctly by MinGW, at least in some
+// configurations, see http://sourceforge.net/support/tracker.php?aid=2837047
+// and when in doubt we prefer to not use it at all.
+#if defined(HAVE___THREAD_KEYWORD) && !defined(__MINGW32__)
+ #define wxHAS_COMPILER_TLS
+ #define wxTHREAD_SPECIFIC_DECL __thread
+// MSVC has its own version which might be supported by some other Windows
+// compilers, to be tested
+#elif wxCHECK_VISUALC_VERSION(7)
+ #define wxHAS_COMPILER_TLS
+ #define wxTHREAD_SPECIFIC_DECL __declspec(thread)
+#endif // compilers
+#endif // wxUSE_COMPILER_TLS
+
+// ----------------------------------------------------------------------------
+// define wxTLS_TYPE()
+// ----------------------------------------------------------------------------
+
+#ifdef wxHAS_COMPILER_TLS
+ #define wxTLS_TYPE(T) wxTHREAD_SPECIFIC_DECL T
+ #define wxTLS_PTR(var) (&(var))
+ #define wxTLS_VALUE(var) (var)
+#else // !wxHAS_COMPILER_TLS
+
+ extern "C"
+ {
+ typedef void (*wxTlsDestructorFunction)(void*);
+ }
+
+ #if defined(__WINDOWS__)
+ #include "wx/msw/tls.h"
+ #elif defined(__OS2__)
+ #include "wx/os2/tls.h"
+ #elif defined(__UNIX__)
+ #include "wx/unix/tls.h"
+ #else
+ // TODO: we could emulate TLS for such platforms...
+ #error Neither compiler nor OS support thread-specific variables.
+ #endif
+
+ #include <stdlib.h> // for calloc()
+
+ // wxTlsValue<T> represents a thread-specific value of type T but, unlike
+ // with native compiler thread-specific variables, it behaves like a
+ // (never NULL) pointer to T and so needs to be dereferenced before use
+ //
+ // Note: T must be a POD!
+ //
+ // Note: On Unix, thread-specific T value is freed when the thread exits.
+ // On Windows, thread-specific values are freed later, when given
+ // wxTlsValue<T> is destroyed. The only exception to this is the
+ // value for the main thread, which is always freed when
+ // wxTlsValue<T> is destroyed.
+ template <typename T>
+ class wxTlsValue
+ {
+ public:
+ typedef T ValueType;
+
+ // ctor doesn't do anything, the object is created on first access
+ wxTlsValue() : m_key(free) {}
+
+ // dtor is only called in the main thread context and so is not enough
+ // to free memory allocated by us for the other threads, we use
+ // destructor function when using Pthreads for this (which is not
+ // called for the main thread as it doesn't call pthread_exit() but
+ // just to be safe we also reset the key anyhow)
+ ~wxTlsValue()
+ {
+ if ( m_key.Get() )
+ m_key.Set(NULL); // this deletes the value
+ }
+
+ // access the object creating it on demand
+ ValueType *Get()
+ {
+ void *value = m_key.Get();
+ if ( !value )
+ {
+ // ValueType must be POD to be used in wxHAS_COMPILER_TLS case
+ // anyhow (at least gcc doesn't accept non-POD values being
+ // declared with __thread) so initialize it as a POD too
+ value = calloc(1, sizeof(ValueType));
+
+ if ( !m_key.Set(value) )
+ {
+ free(value);
+
+ // this will probably result in a crash in the caller but
+ // it's arguably better to crash immediately instead of
+ // slowly dying from out-of-memory errors which would
+ // happen as the next access to this object would allocate
+ // another ValueType instance and so on forever
+ value = NULL;
+ }
+ }
+
+ return static_cast<ValueType *>(value);
+ }
+
+ // pointer-like accessors
+ ValueType *operator->() { return Get(); }
+ ValueType& operator*() { return *Get(); }
+
+ private:
+ wxTlsKey m_key;
+
+ DECLARE_NO_COPY_TEMPLATE_CLASS(wxTlsValue, T)
+ };
+
+ #define wxTLS_TYPE(T) wxTlsValue<T>
+ #define wxTLS_PTR(var) ((var).Get())
+ #define wxTLS_VALUE(var) (*(var))
+#endif // wxHAS_COMPILER_TLS/!wxHAS_COMPILER_TLS
+
+#endif // _WX_TLS_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/tokenzr.h
+// Purpose: String tokenizer - a C++ replacement for strtok(3)
+// Author: Guilhem Lavaux
+// Modified by: (or rather rewritten by) Vadim Zeitlin
+// Created: 04/22/98
+// Copyright: (c) Guilhem Lavaux
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TOKENZRH
+#define _WX_TOKENZRH
+
+#include "wx/object.h"
+#include "wx/string.h"
+#include "wx/arrstr.h"
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// default: delimiters are usual white space characters
+#define wxDEFAULT_DELIMITERS (wxT(" \t\r\n"))
+
+// wxStringTokenizer mode flags which determine its behaviour
+enum wxStringTokenizerMode
+{
+ wxTOKEN_INVALID = -1, // set by def ctor until SetString() is called
+ wxTOKEN_DEFAULT, // strtok() for whitespace delims, RET_EMPTY else
+ wxTOKEN_RET_EMPTY, // return empty token in the middle of the string
+ wxTOKEN_RET_EMPTY_ALL, // return trailing empty tokens too
+ wxTOKEN_RET_DELIMS, // return the delim with token (implies RET_EMPTY)
+ wxTOKEN_STRTOK // behave exactly like strtok(3)
+};
+
+// ----------------------------------------------------------------------------
+// wxStringTokenizer: replaces infamous strtok() and has some other features
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxStringTokenizer : public wxObject
+{
+public:
+ // ctors and initializers
+ // default ctor, call SetString() later
+ wxStringTokenizer() { m_mode = wxTOKEN_INVALID; }
+ // ctor which gives us the string
+ wxStringTokenizer(const wxString& str,
+ const wxString& delims = wxDEFAULT_DELIMITERS,
+ wxStringTokenizerMode mode = wxTOKEN_DEFAULT);
+
+ // args are same as for the non default ctor above
+ void SetString(const wxString& str,
+ const wxString& delims = wxDEFAULT_DELIMITERS,
+ wxStringTokenizerMode mode = wxTOKEN_DEFAULT);
+
+ // reinitialize the tokenizer with the same delimiters/mode
+ void Reinit(const wxString& str);
+
+ // tokens access
+ // return the number of remaining tokens
+ size_t CountTokens() const;
+ // did we reach the end of the string?
+ bool HasMoreTokens() const;
+ // get the next token, will return empty string if !HasMoreTokens()
+ wxString GetNextToken();
+ // get the delimiter which terminated the token last retrieved by
+ // GetNextToken() or NUL if there had been no tokens yet or the last
+ // one wasn't terminated (but ran to the end of the string)
+ wxChar GetLastDelimiter() const { return m_lastDelim; }
+
+ // get current tokenizer state
+ // returns the part of the string which remains to tokenize (*not* the
+ // initial string)
+ wxString GetString() const { return wxString(m_pos, m_string.end()); }
+
+ // returns the current position (i.e. one index after the last
+ // returned token or 0 if GetNextToken() has never been called) in the
+ // original string
+ size_t GetPosition() const { return m_pos - m_string.begin(); }
+
+ // misc
+ // get the current mode - can be different from the one passed to the
+ // ctor if it was wxTOKEN_DEFAULT
+ wxStringTokenizerMode GetMode() const { return m_mode; }
+ // do we return empty tokens?
+ bool AllowEmpty() const { return m_mode != wxTOKEN_STRTOK; }
+
+
+ // backwards compatibility section from now on
+ // -------------------------------------------
+
+ // for compatibility only, use GetNextToken() instead
+ wxString NextToken() { return GetNextToken(); }
+
+ // compatibility only, don't use
+ void SetString(const wxString& to_tokenize,
+ const wxString& delims,
+ bool WXUNUSED(ret_delim))
+ {
+ SetString(to_tokenize, delims, wxTOKEN_RET_DELIMS);
+ }
+
+ wxStringTokenizer(const wxString& to_tokenize,
+ const wxString& delims,
+ bool ret_delim)
+ {
+ SetString(to_tokenize, delims, ret_delim);
+ }
+
+protected:
+ bool IsOk() const { return m_mode != wxTOKEN_INVALID; }
+
+ bool DoHasMoreTokens() const;
+
+ enum MoreTokensState
+ {
+ MoreTokens_Unknown,
+ MoreTokens_Yes,
+ MoreTokens_No
+ };
+
+ MoreTokensState m_hasMoreTokens;
+
+ wxString m_string; // the string we tokenize
+ wxString::const_iterator m_stringEnd;
+ // FIXME-UTF8: use wxWcharBuffer
+ wxWxCharBuffer m_delims; // all possible delimiters
+ size_t m_delimsLen;
+
+ wxString::const_iterator m_pos; // the current position in m_string
+
+ wxStringTokenizerMode m_mode; // see wxTOKEN_XXX values
+
+ wxChar m_lastDelim; // delimiter after last token or '\0'
+};
+
+// ----------------------------------------------------------------------------
+// convenience function which returns all tokens at once
+// ----------------------------------------------------------------------------
+
+// the function takes the same parameters as wxStringTokenizer ctor and returns
+// the array containing all tokens
+wxArrayString WXDLLIMPEXP_BASE
+wxStringTokenize(const wxString& str,
+ const wxString& delims = wxDEFAULT_DELIMITERS,
+ wxStringTokenizerMode mode = wxTOKEN_DEFAULT);
+
+#endif // _WX_TOKENZRH
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/toolbar.h
+// Purpose: wxToolBar interface declaration
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 20.11.99
+// Copyright: (c) Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TOOLBAR_H_BASE_
+#define _WX_TOOLBAR_H_BASE_
+
+#include "wx/defs.h"
+
+// ----------------------------------------------------------------------------
+// wxToolBar style flags
+// ----------------------------------------------------------------------------
+
+enum
+{
+ // lay out the toolbar horizontally
+ wxTB_HORIZONTAL = wxHORIZONTAL, // == 0x0004
+ wxTB_TOP = wxTB_HORIZONTAL,
+
+ // lay out the toolbar vertically
+ wxTB_VERTICAL = wxVERTICAL, // == 0x0008
+ wxTB_LEFT = wxTB_VERTICAL,
+
+ // show 3D buttons (wxToolBarSimple only)
+ wxTB_3DBUTTONS = 0x0010,
+
+ // "flat" buttons (Win32/GTK only)
+ wxTB_FLAT = 0x0020,
+
+ // dockable toolbar (GTK only)
+ wxTB_DOCKABLE = 0x0040,
+
+ // don't show the icons (they're shown by default)
+ wxTB_NOICONS = 0x0080,
+
+ // show the text (not shown by default)
+ wxTB_TEXT = 0x0100,
+
+ // don't show the divider between toolbar and the window (Win32 only)
+ wxTB_NODIVIDER = 0x0200,
+
+ // no automatic alignment (Win32 only, useless)
+ wxTB_NOALIGN = 0x0400,
+
+ // show the text and the icons alongside, not vertically stacked (Win32/GTK)
+ wxTB_HORZ_LAYOUT = 0x0800,
+ wxTB_HORZ_TEXT = wxTB_HORZ_LAYOUT | wxTB_TEXT,
+
+ // don't show the toolbar short help tooltips
+ wxTB_NO_TOOLTIPS = 0x1000,
+
+ // lay out toolbar at the bottom of the window
+ wxTB_BOTTOM = 0x2000,
+
+ // lay out toolbar at the right edge of the window
+ wxTB_RIGHT = 0x4000,
+
+ wxTB_DEFAULT_STYLE = wxTB_HORIZONTAL | wxTB_FLAT
+};
+
+#if wxUSE_TOOLBAR
+ #include "wx/tbarbase.h" // the base class for all toolbars
+
+ #if defined(__WXUNIVERSAL__)
+ #include "wx/univ/toolbar.h"
+ #elif defined(__WXMSW__) && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__)))
+ #include "wx/msw/toolbar.h"
+ #elif defined(__WXWINCE__)
+ #include "wx/msw/wince/tbarwce.h"
+ #elif defined(__WXMOTIF__)
+ #include "wx/motif/toolbar.h"
+ #elif defined(__WXGTK20__)
+ #include "wx/gtk/toolbar.h"
+ #elif defined(__WXGTK__)
+ #include "wx/gtk1/toolbar.h"
+ #elif defined(__WXMAC__)
+ #include "wx/osx/toolbar.h"
+ #elif defined(__WXCOCOA__)
+ #include "wx/cocoa/toolbar.h"
+ #elif defined(__WXPM__)
+ #include "wx/os2/toolbar.h"
+ #endif
+#endif // wxUSE_TOOLBAR
+
+#endif
+ // _WX_TOOLBAR_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/toolbook.h
+// Purpose: wxToolbook: wxToolBar and wxNotebook combination
+// Author: Julian Smart
+// Modified by:
+// Created: 2006-01-29
+// Copyright: (c) 2006 Julian Smart
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TOOLBOOK_H_
+#define _WX_TOOLBOOK_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_TOOLBOOK
+
+#include "wx/bookctrl.h"
+#include "wx/containr.h"
+
+class WXDLLIMPEXP_FWD_CORE wxToolBarBase;
+class WXDLLIMPEXP_FWD_CORE wxCommandEvent;
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TOOLBOOK_PAGE_CHANGED, wxBookCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TOOLBOOK_PAGE_CHANGING, wxBookCtrlEvent );
+
+
+// Use wxButtonToolBar
+#define wxTBK_BUTTONBAR 0x0100
+
+// Use wxTB_HORZ_LAYOUT style for the controlling toolbar
+#define wxTBK_HORZ_LAYOUT 0x8000
+
+// deprecated synonym, don't use
+#if WXWIN_COMPATIBILITY_2_8
+ #define wxBK_BUTTONBAR wxTBK_BUTTONBAR
+#endif
+
+// ----------------------------------------------------------------------------
+// wxToolbook
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxToolbook : public wxNavigationEnabled<wxBookCtrlBase>
+{
+public:
+ wxToolbook()
+ {
+ Init();
+ }
+
+ wxToolbook(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxEmptyString)
+ {
+ Init();
+
+ (void)Create(parent, id, pos, size, style, name);
+ }
+
+ // quasi ctor
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxEmptyString);
+
+
+ // implement base class virtuals
+ virtual bool SetPageText(size_t n, const wxString& strText);
+ virtual wxString GetPageText(size_t n) const;
+ virtual int GetPageImage(size_t n) const;
+ virtual bool SetPageImage(size_t n, int imageId);
+ virtual bool InsertPage(size_t n,
+ wxWindow *page,
+ const wxString& text,
+ bool bSelect = false,
+ int imageId = NO_IMAGE);
+ virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); }
+ virtual int ChangeSelection(size_t n) { return DoSetSelection(n); }
+ virtual void SetImageList(wxImageList *imageList);
+
+ virtual bool DeleteAllPages();
+ virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
+
+
+ // methods which are not part of base wxBookctrl API
+
+ // get the underlying toolbar
+ wxToolBarBase* GetToolBar() const { return (wxToolBarBase*)m_bookctrl; }
+
+ // must be called in OnIdle or by application to realize the toolbar and
+ // select the initial page.
+ void Realize();
+
+protected:
+ virtual wxWindow *DoRemovePage(size_t page);
+
+ // event handlers
+ void OnToolSelected(wxCommandEvent& event);
+ void OnSize(wxSizeEvent& event);
+ void OnIdle(wxIdleEvent& event);
+
+ void UpdateSelectedPage(size_t newsel);
+
+ wxBookCtrlEvent* CreatePageChangingEvent() const;
+ void MakeChangedEvent(wxBookCtrlEvent &event);
+
+ // whether the toolbar needs to be realized
+ bool m_needsRealizing;
+
+ // maximum bitmap size
+ wxSize m_maxBitmapSize;
+
+private:
+ // common part of all constructors
+ void Init();
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxToolbook)
+};
+
+// ----------------------------------------------------------------------------
+// listbook event class and related stuff
+// ----------------------------------------------------------------------------
+
+// wxToolbookEvent is obsolete and defined for compatibility only
+#define wxToolbookEvent wxBookCtrlEvent
+typedef wxBookCtrlEventFunction wxToolbookEventFunction;
+#define wxToolbookEventHandler(func) wxBookCtrlEventHandler(func)
+
+
+#define EVT_TOOLBOOK_PAGE_CHANGED(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_TOOLBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn))
+
+#define EVT_TOOLBOOK_PAGE_CHANGING(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_TOOLBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn))
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED wxEVT_TOOLBOOK_PAGE_CHANGED
+#define wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING wxEVT_TOOLBOOK_PAGE_CHANGING
+
+#endif // wxUSE_TOOLBOOK
+
+#endif // _WX_TOOLBOOK_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/tooltip.h
+// Purpose: wxToolTip base header
+// Author: Robert Roebling
+// Modified by:
+// Created:
+// Copyright: (c) Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TOOLTIP_H_BASE_
+#define _WX_TOOLTIP_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_TOOLTIPS
+
+#if defined(__WXMSW__)
+#include "wx/msw/tooltip.h"
+#elif defined(__WXMOTIF__)
+// #include "wx/motif/tooltip.h"
+#elif defined(__WXGTK20__)
+#include "wx/gtk/tooltip.h"
+#elif defined(__WXGTK__)
+#include "wx/gtk1/tooltip.h"
+#elif defined(__WXMAC__)
+#include "wx/osx/tooltip.h"
+#elif defined(__WXCOCOA__)
+#include "wx/cocoa/tooltip.h"
+#elif defined(__WXPM__)
+#include "wx/os2/tooltip.h"
+#endif
+
+#endif
+ // wxUSE_TOOLTIPS
+
+#endif
+ // _WX_TOOLTIP_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/toplevel.h
+// Purpose: declares wxTopLevelWindow class, the base class for all
+// top level windows (such as frames and dialogs)
+// Author: Vadim Zeitlin, Vaclav Slavik
+// Modified by:
+// Created: 06.08.01
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Vaclav Slavik <vaclav@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TOPLEVEL_BASE_H_
+#define _WX_TOPLEVEL_BASE_H_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/nonownedwnd.h"
+#include "wx/iconbndl.h"
+#include "wx/weakref.h"
+
+// the default names for various classes
+extern WXDLLIMPEXP_DATA_CORE(const char) wxFrameNameStr[];
+
+class WXDLLIMPEXP_FWD_CORE wxTopLevelWindowBase;
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+/*
+ Summary of the bits used (some of them are defined in wx/frame.h and
+ wx/dialog.h and not here):
+
+ +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+ |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
+ +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+ | | | | | | | | | | | | | | | |
+ | | | | | | | | | | | | | | | \_ wxCENTRE
+ | | | | | | | | | | | | | | \____ wxFRAME_NO_TASKBAR
+ | | | | | | | | | | | | | \_______ wxFRAME_TOOL_WINDOW
+ | | | | | | | | | | | | \__________ wxFRAME_FLOAT_ON_PARENT
+ | | | | | | | | | | | \_____________ wxFRAME_SHAPED
+ | | | | | | | | | | \________________ wxDIALOG_NO_PARENT
+ | | | | | | | | | \___________________ wxRESIZE_BORDER
+ | | | | | | | | \______________________ wxTINY_CAPTION_VERT
+ | | | | | | | \_________________________
+ | | | | | | \____________________________ wxMAXIMIZE_BOX
+ | | | | | \_______________________________ wxMINIMIZE_BOX
+ | | | | \__________________________________ wxSYSTEM_MENU
+ | | | \_____________________________________ wxCLOSE_BOX
+ | | \________________________________________ wxMAXIMIZE
+ | \___________________________________________ wxMINIMIZE
+ \______________________________________________ wxSTAY_ON_TOP
+
+
+ Notice that the 8 lower bits overlap with wxCENTRE and the button selection
+ bits (wxYES, wxOK wxNO, wxCANCEL, wxAPPLY, wxCLOSE and wxNO_DEFAULT) which
+ can be combined with the dialog style for several standard dialogs and
+ hence shouldn't overlap with any styles which can be used for the dialogs.
+ Additionally, wxCENTRE can be used with frames also.
+ */
+
+// style common to both wxFrame and wxDialog
+#define wxSTAY_ON_TOP 0x8000
+#define wxICONIZE 0x4000
+#define wxMINIMIZE wxICONIZE
+#define wxMAXIMIZE 0x2000
+#define wxCLOSE_BOX 0x1000 // == wxHELP so can't be used with it
+
+#define wxSYSTEM_MENU 0x0800
+#define wxMINIMIZE_BOX 0x0400
+#define wxMAXIMIZE_BOX 0x0200
+
+#define wxTINY_CAPTION 0x0080 // clashes with wxNO_DEFAULT
+#define wxRESIZE_BORDER 0x0040 // == wxCLOSE
+
+#if WXWIN_COMPATIBILITY_2_8
+ // HORIZ and VERT styles are equivalent anyhow so don't use different names
+ // for them
+ #define wxTINY_CAPTION_HORIZ wxTINY_CAPTION
+ #define wxTINY_CAPTION_VERT wxTINY_CAPTION
+#endif
+
+#if WXWIN_COMPATIBILITY_2_6
+
+ // deprecated versions defined for compatibility reasons
+ #define wxRESIZE_BOX wxMAXIMIZE_BOX
+ #define wxTHICK_FRAME wxRESIZE_BORDER
+
+ // obsolete styles, unused any more
+ #define wxDIALOG_MODAL 0
+ #define wxDIALOG_MODELESS 0
+ #define wxNO_3D 0
+ #define wxUSER_COLOURS 0
+
+#endif // WXWIN_COMPATIBILITY_2_6
+
+// default style
+//
+// under Windows CE (at least when compiling with eVC 4) we should create
+// top level windows without any styles at all for them to appear
+// "correctly", i.e. as full screen windows with a "hide" button (same as
+// "close" but round instead of squared and just hides the applications
+// instead of closing it) in the title bar
+#if defined(__WXWINCE__)
+ #if defined(__SMARTPHONE__)
+ #define wxDEFAULT_FRAME_STYLE (wxMAXIMIZE)
+ #elif defined(__WINCE_STANDARDSDK__)
+ #define wxDEFAULT_FRAME_STYLE (wxMAXIMIZE|wxCLOSE_BOX)
+ #else
+ #define wxDEFAULT_FRAME_STYLE (wxNO_BORDER)
+ #endif
+#else // !__WXWINCE__
+ #define wxDEFAULT_FRAME_STYLE \
+ (wxSYSTEM_MENU | \
+ wxRESIZE_BORDER | \
+ wxMINIMIZE_BOX | \
+ wxMAXIMIZE_BOX | \
+ wxCLOSE_BOX | \
+ wxCAPTION | \
+ wxCLIP_CHILDREN)
+#endif
+
+
+// Dialogs are created in a special way
+#define wxTOPLEVEL_EX_DIALOG 0x00000008
+
+// Styles for ShowFullScreen
+// (note that wxTopLevelWindow only handles wxFULLSCREEN_NOBORDER and
+// wxFULLSCREEN_NOCAPTION; the rest is handled by wxTopLevelWindow)
+enum
+{
+ wxFULLSCREEN_NOMENUBAR = 0x0001,
+ wxFULLSCREEN_NOTOOLBAR = 0x0002,
+ wxFULLSCREEN_NOSTATUSBAR = 0x0004,
+ wxFULLSCREEN_NOBORDER = 0x0008,
+ wxFULLSCREEN_NOCAPTION = 0x0010,
+
+ wxFULLSCREEN_ALL = wxFULLSCREEN_NOMENUBAR | wxFULLSCREEN_NOTOOLBAR |
+ wxFULLSCREEN_NOSTATUSBAR | wxFULLSCREEN_NOBORDER |
+ wxFULLSCREEN_NOCAPTION
+};
+
+// Styles for RequestUserAttention
+enum
+{
+ wxUSER_ATTENTION_INFO = 1,
+ wxUSER_ATTENTION_ERROR = 2
+};
+
+// ----------------------------------------------------------------------------
+// wxTopLevelWindow: a top level (as opposed to child) window
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxTopLevelWindowBase : public wxNonOwnedWindow
+{
+public:
+ // construction
+ wxTopLevelWindowBase();
+ virtual ~wxTopLevelWindowBase();
+
+ // top level wnd state
+ // --------------------
+
+ // maximize = true => maximize, otherwise - restore
+ virtual void Maximize(bool maximize = true) = 0;
+
+ // undo Maximize() or Iconize()
+ virtual void Restore() = 0;
+
+ // iconize = true => iconize, otherwise - restore
+ virtual void Iconize(bool iconize = true) = 0;
+
+ // return true if the frame is maximized
+ virtual bool IsMaximized() const = 0;
+
+ // return true if the frame is always maximized
+ // due to native guidelines or current policy
+ virtual bool IsAlwaysMaximized() const;
+
+ // return true if the frame is iconized
+ virtual bool IsIconized() const = 0;
+
+ // get the frame icon
+ wxIcon GetIcon() const;
+
+ // get the frame icons
+ const wxIconBundle& GetIcons() const { return m_icons; }
+
+ // set the frame icon: implemented in terms of SetIcons()
+ void SetIcon(const wxIcon& icon);
+
+ // set the frame icons
+ virtual void SetIcons(const wxIconBundle& icons) { m_icons = icons; }
+
+ // maximize the window to cover entire screen
+ virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) = 0;
+
+ // shows the window, but doesn't activate it. If the base code is being run,
+ // it means the port doesn't implement this method yet and so alert the user.
+ virtual void ShowWithoutActivating() {
+ wxFAIL_MSG("ShowWithoutActivating not implemented on this platform.");
+ }
+
+ // return true if the frame is in fullscreen mode
+ virtual bool IsFullScreen() const = 0;
+
+ // the title of the top level window: the text which the
+ // window shows usually at the top of the frame/dialog in dedicated bar
+ virtual void SetTitle(const wxString& title) = 0;
+ virtual wxString GetTitle() const = 0;
+
+ // enable/disable close button [x]
+ virtual bool EnableCloseButton(bool WXUNUSED(enable) ) { return false; }
+
+ // Attracts the users attention to this window if the application is
+ // inactive (should be called when a background event occurs)
+ virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO);
+
+ // Is this the active frame (highlighted in the taskbar)?
+ //
+ // A TLW is active only if it contains the currently focused window.
+ virtual bool IsActive() { return IsDescendant(FindFocus()); }
+
+ // this function may be overridden to return false to allow closing the
+ // application even when this top level window is still open
+ //
+ // notice that the window is still closed prior to the application exit and
+ // so it can still veto it even if it returns false from here
+ virtual bool ShouldPreventAppExit() const { return true; }
+
+
+#if defined(__SMARTPHONE__)
+ virtual void SetLeftMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL) = 0;
+ virtual void SetRightMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL) = 0;
+#endif // __SMARTPHONE__
+
+ // centre the window on screen: this is just a shortcut
+ void CentreOnScreen(int dir = wxBOTH) { DoCentre(dir | wxCENTRE_ON_SCREEN); }
+ void CenterOnScreen(int dir = wxBOTH) { CentreOnScreen(dir); }
+
+ // Get the default size for a new top level window. This is used when
+ // creating a wxTLW under some platforms if no explicit size given.
+ static wxSize GetDefaultSize();
+
+
+ // default item access: we have a permanent default item which is the one
+ // set by the user code but we may also have a temporary default item which
+ // would be chosen if the user pressed "Enter" now but the default action
+ // reverts to the "permanent" default as soon as this temporary default
+ // item loses focus
+
+ // get the default item, temporary or permanent
+ wxWindow *GetDefaultItem() const
+ { return m_winTmpDefault ? m_winTmpDefault : m_winDefault; }
+
+ // set the permanent default item, return the old default
+ wxWindow *SetDefaultItem(wxWindow *win)
+ { wxWindow *old = GetDefaultItem(); m_winDefault = win; return old; }
+
+ // return the temporary default item, can be NULL
+ wxWindow *GetTmpDefaultItem() const { return m_winTmpDefault; }
+
+ // set a temporary default item, SetTmpDefaultItem(NULL) should be called
+ // soon after a call to SetTmpDefaultItem(window), return the old default
+ wxWindow *SetTmpDefaultItem(wxWindow *win)
+ { wxWindow *old = GetDefaultItem(); m_winTmpDefault = win; return old; }
+
+ // implementation only from now on
+ // -------------------------------
+
+ // override some base class virtuals
+ virtual bool Destroy();
+ virtual bool IsTopLevel() const { return true; }
+ virtual bool IsTopNavigationDomain() const { return true; }
+ virtual bool IsVisible() const { return IsShown(); }
+
+ // event handlers
+ void OnCloseWindow(wxCloseEvent& event);
+ void OnSize(wxSizeEvent& WXUNUSED(event)) { DoLayout(); }
+
+ // Get rect to be used to center top-level children
+ virtual void GetRectForTopLevelChildren(int *x, int *y, int *w, int *h);
+
+ // this should go away, but for now it's called from docview.cpp,
+ // so should be there for all platforms
+ void OnActivate(wxActivateEvent &WXUNUSED(event)) { }
+
+ // do the window-specific processing after processing the update event
+ virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) ;
+
+ // a different API for SetSizeHints
+ virtual void SetMinSize(const wxSize& minSize);
+ virtual void SetMaxSize(const wxSize& maxSize);
+
+ virtual void OSXSetModified(bool modified) { m_modified = modified; }
+ virtual bool OSXIsModified() const { return m_modified; }
+
+ virtual void SetRepresentedFilename(const wxString& WXUNUSED(filename)) { }
+
+#if wxUSE_MENUS || wxUSE_TOOLBAR
+ // show help text for the currently selected menu or toolbar item
+ // (typically in the status bar) or hide it and restore the status bar text
+ // originally shown before the menu was opened if show == false
+ virtual void DoGiveHelp(const wxString& WXUNUSED(text), bool WXUNUSED(show)) {}
+#endif
+
+protected:
+ // the frame client to screen translation should take account of the
+ // toolbar which may shift the origin of the client area
+ virtual void DoClientToScreen(int *x, int *y) const;
+ virtual void DoScreenToClient(int *x, int *y) const;
+
+ // add support for wxCENTRE_ON_SCREEN
+ virtual void DoCentre(int dir);
+
+ // no need to do client to screen translation to get our position in screen
+ // coordinates: this is already the case
+ virtual void DoGetScreenPosition(int *x, int *y) const
+ {
+ DoGetPosition(x, y);
+ }
+
+ // test whether this window makes part of the frame
+ // (menubar, toolbar and statusbar are excluded from automatic layout)
+ virtual bool IsOneOfBars(const wxWindow *WXUNUSED(win)) const
+ { return false; }
+
+ // check if we should exit the program after deleting this window
+ bool IsLastBeforeExit() const;
+
+ // send the iconize event, return true if processed
+ bool SendIconizeEvent(bool iconized = true);
+
+ // do TLW-specific layout: we resize our unique child to fill the entire
+ // client area
+ void DoLayout();
+
+ static int WidthDefault(int w) { return w == wxDefaultCoord ? GetDefaultSize().x : w; }
+ static int HeightDefault(int h) { return h == wxDefaultCoord ? GetDefaultSize().y : h; }
+
+
+ // the frame icon
+ wxIconBundle m_icons;
+
+ // a default window (usually a button) or NULL
+ wxWindowRef m_winDefault;
+
+ // a temporary override of m_winDefault, use the latter if NULL
+ wxWindowRef m_winTmpDefault;
+
+ bool m_modified;
+
+ wxDECLARE_NO_COPY_CLASS(wxTopLevelWindowBase);
+ DECLARE_EVENT_TABLE()
+};
+
+
+// include the real class declaration
+#if defined(__WXMSW__)
+ #include "wx/msw/toplevel.h"
+ #define wxTopLevelWindowNative wxTopLevelWindowMSW
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/toplevel.h"
+ #define wxTopLevelWindowNative wxTopLevelWindowGTK
+#elif defined(__WXGTK__)
+ #include "wx/gtk1/toplevel.h"
+ #define wxTopLevelWindowNative wxTopLevelWindowGTK
+#elif defined(__WXX11__)
+ #include "wx/x11/toplevel.h"
+ #define wxTopLevelWindowNative wxTopLevelWindowX11
+#elif defined(__WXDFB__)
+ #include "wx/dfb/toplevel.h"
+ #define wxTopLevelWindowNative wxTopLevelWindowDFB
+#elif defined(__WXMAC__)
+ #include "wx/osx/toplevel.h"
+ #define wxTopLevelWindowNative wxTopLevelWindowMac
+#elif defined(__WXCOCOA__)
+ #include "wx/cocoa/toplevel.h"
+ #define wxTopLevelWindowNative wxTopLevelWindowCocoa
+#elif defined(__WXPM__)
+ #include "wx/os2/toplevel.h"
+ #define wxTopLevelWindowNative wxTopLevelWindowOS2
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/toplevel.h"
+ #define wxTopLevelWindowNative wxTopLevelWindowMotif
+#endif
+
+#ifdef __WXUNIVERSAL__
+ #include "wx/univ/toplevel.h"
+#else // !__WXUNIVERSAL__
+ class WXDLLIMPEXP_CORE wxTopLevelWindow : public wxTopLevelWindowNative
+ {
+ public:
+ // construction
+ wxTopLevelWindow() { }
+ wxTopLevelWindow(wxWindow *parent,
+ wxWindowID winid,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr)
+ : wxTopLevelWindowNative(parent, winid, title,
+ pos, size, style, name)
+ {
+ }
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxTopLevelWindow)
+ };
+#endif // __WXUNIVERSAL__/!__WXUNIVERSAL__
+
+#endif // _WX_TOPLEVEL_BASE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/tracker.h
+// Purpose: Support class for object lifetime tracking (wxWeakRef<T>)
+// Author: Arne Steinarson
+// Created: 28 Dec 07
+// Copyright: (c) 2007 Arne Steinarson
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TRACKER_H_
+#define _WX_TRACKER_H_
+
+#include "wx/defs.h"
+
+class wxEventConnectionRef;
+
+// This class represents an object tracker and is stored in a linked list
+// in the tracked object. It is only used in one of its derived forms.
+class WXDLLIMPEXP_BASE wxTrackerNode
+{
+public:
+ wxTrackerNode() : m_nxt(NULL) { }
+ virtual ~wxTrackerNode() { }
+
+ virtual void OnObjectDestroy() = 0;
+
+ virtual wxEventConnectionRef *ToEventConnection() { return NULL; }
+
+private:
+ wxTrackerNode *m_nxt;
+
+ friend class wxTrackable; // For list access
+ friend class wxEvtHandler; // For list access
+};
+
+// Add-on base class for a trackable object.
+class WXDLLIMPEXP_BASE wxTrackable
+{
+public:
+ void AddNode(wxTrackerNode *prn)
+ {
+ prn->m_nxt = m_first;
+ m_first = prn;
+ }
+
+ void RemoveNode(wxTrackerNode *prn)
+ {
+ for ( wxTrackerNode **pprn = &m_first; *pprn; pprn = &(*pprn)->m_nxt )
+ {
+ if ( *pprn == prn )
+ {
+ *pprn = prn->m_nxt;
+ return;
+ }
+ }
+
+ wxFAIL_MSG( "removing invalid tracker node" );
+ }
+
+ wxTrackerNode *GetFirst() const { return m_first; }
+
+protected:
+ // this class is only supposed to be used as a base class but never be
+ // created nor destroyed directly so all ctors and dtor are protected
+
+ wxTrackable() : m_first(NULL) { }
+
+ // copy ctor and assignment operator intentionally do not copy m_first: the
+ // objects which track the original trackable shouldn't track the new copy
+ wxTrackable(const wxTrackable& WXUNUSED(other)) : m_first(NULL) { }
+ wxTrackable& operator=(const wxTrackable& WXUNUSED(other)) { return *this; }
+
+ // dtor is not virtual: this class is not supposed to be used
+ // polymorphically and adding a virtual table to it would add unwanted
+ // overhead
+ ~wxTrackable()
+ {
+ // Notify all registered refs
+ while ( m_first )
+ {
+ wxTrackerNode * const first = m_first;
+ m_first = first->m_nxt;
+ first->OnObjectDestroy();
+ }
+ }
+
+ wxTrackerNode *m_first;
+};
+
+#endif // _WX_TRACKER_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/translation.h
+// Purpose: Internationalization and localisation for wxWidgets
+// Author: Vadim Zeitlin, Vaclav Slavik,
+// Michael N. Filippov <michael@idisys.iae.nsk.su>
+// Created: 2010-04-23
+// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// (c) 2010 Vaclav Slavik <vslavik@fastmail.fm>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TRANSLATION_H_
+#define _WX_TRANSLATION_H_
+
+#include "wx/defs.h"
+#include "wx/string.h"
+
+#if wxUSE_INTL
+
+#include "wx/buffer.h"
+#include "wx/language.h"
+#include "wx/hashmap.h"
+#include "wx/strconv.h"
+#include "wx/scopedptr.h"
+
+// ============================================================================
+// global decls
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// macros
+// ----------------------------------------------------------------------------
+
+// gettext() style macros (notice that xgettext should be invoked with
+// --keyword="_" --keyword="wxPLURAL:1,2" options
+// to extract the strings from the sources)
+#ifndef WXINTL_NO_GETTEXT_MACRO
+ #define _(s) wxGetTranslation((s))
+ #define wxPLURAL(sing, plur, n) wxGetTranslation((sing), (plur), n)
+#endif
+
+// another one which just marks the strings for extraction, but doesn't
+// perform the translation (use -kwxTRANSLATE with xgettext!)
+#define wxTRANSLATE(str) str
+
+// ----------------------------------------------------------------------------
+// forward decls
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_BASE wxArrayString;
+class WXDLLIMPEXP_FWD_BASE wxTranslationsLoader;
+class WXDLLIMPEXP_FWD_BASE wxLocale;
+
+class wxPluralFormsCalculator;
+wxDECLARE_SCOPED_PTR(wxPluralFormsCalculator, wxPluralFormsCalculatorPtr)
+
+// ----------------------------------------------------------------------------
+// wxMsgCatalog corresponds to one loaded message catalog.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMsgCatalog
+{
+public:
+ // Ctor is protected, because CreateFromXXX functions must be used,
+ // but destruction should be unrestricted
+#if !wxUSE_UNICODE
+ ~wxMsgCatalog();
+#endif
+
+ // load the catalog from disk or from data; caller is responsible for
+ // deleting them if not NULL
+ static wxMsgCatalog *CreateFromFile(const wxString& filename,
+ const wxString& domain);
+
+ static wxMsgCatalog *CreateFromData(const wxScopedCharBuffer& data,
+ const wxString& domain);
+
+ // get name of the catalog
+ wxString GetDomain() const { return m_domain; }
+
+ // get the translated string: returns NULL if not found
+ const wxString *GetString(const wxString& sz, unsigned n = UINT_MAX) const;
+
+protected:
+ wxMsgCatalog(const wxString& domain)
+ : m_pNext(NULL), m_domain(domain)
+#if !wxUSE_UNICODE
+ , m_conv(NULL)
+#endif
+ {}
+
+private:
+ // variable pointing to the next element in a linked list (or NULL)
+ wxMsgCatalog *m_pNext;
+ friend class wxTranslations;
+
+ wxStringToStringHashMap m_messages; // all messages in the catalog
+ wxString m_domain; // name of the domain
+
+#if !wxUSE_UNICODE
+ // the conversion corresponding to this catalog charset if we installed it
+ // as the global one
+ wxCSConv *m_conv;
+#endif
+
+ wxPluralFormsCalculatorPtr m_pluralFormsCalculator;
+};
+
+// ----------------------------------------------------------------------------
+// wxTranslations: message catalogs
+// ----------------------------------------------------------------------------
+
+// this class allows to get translations for strings
+class WXDLLIMPEXP_BASE wxTranslations
+{
+public:
+ wxTranslations();
+ ~wxTranslations();
+
+ // returns current translations object, may return NULL
+ static wxTranslations *Get();
+ // sets current translations object (takes ownership; may be NULL)
+ static void Set(wxTranslations *t);
+
+ // changes loader to non-default one; takes ownership of 'loader'
+ void SetLoader(wxTranslationsLoader *loader);
+
+ void SetLanguage(wxLanguage lang);
+ void SetLanguage(const wxString& lang);
+
+ // get languages available for this app
+ wxArrayString GetAvailableTranslations(const wxString& domain) const;
+
+ // find best translation language for given domain
+ wxString GetBestTranslation(const wxString& domain, wxLanguage msgIdLanguage);
+ wxString GetBestTranslation(const wxString& domain,
+ const wxString& msgIdLanguage = "en");
+
+ // add standard wxWidgets catalog ("wxstd")
+ bool AddStdCatalog();
+
+ // add catalog with given domain name and language, looking it up via
+ // wxTranslationsLoader
+ bool AddCatalog(const wxString& domain);
+ bool AddCatalog(const wxString& domain, wxLanguage msgIdLanguage);
+#if !wxUSE_UNICODE
+ bool AddCatalog(const wxString& domain,
+ wxLanguage msgIdLanguage,
+ const wxString& msgIdCharset);
+#endif
+
+ // check if the given catalog is loaded
+ bool IsLoaded(const wxString& domain) const;
+
+ // access to translations
+ const wxString *GetTranslatedString(const wxString& origString,
+ const wxString& domain = wxEmptyString) const;
+ const wxString *GetTranslatedString(const wxString& origString,
+ unsigned n,
+ const wxString& domain = wxEmptyString) const;
+
+ wxString GetHeaderValue(const wxString& header,
+ const wxString& domain = wxEmptyString) const;
+
+ // this is hack to work around a problem with wxGetTranslation() which
+ // returns const wxString& and not wxString, so when it returns untranslated
+ // string, it needs to have a copy of it somewhere
+ static const wxString& GetUntranslatedString(const wxString& str);
+
+private:
+ // perform loading of the catalog via m_loader
+ bool LoadCatalog(const wxString& domain, const wxString& lang, const wxString& msgIdLang);
+
+ // find catalog by name in a linked list, return NULL if !found
+ wxMsgCatalog *FindCatalog(const wxString& domain) const;
+
+ // same as Set(), without taking ownership; only for wxLocale
+ static void SetNonOwned(wxTranslations *t);
+ friend class wxLocale;
+
+private:
+ wxString m_lang;
+ wxTranslationsLoader *m_loader;
+
+ wxMsgCatalog *m_pMsgCat; // pointer to linked list of catalogs
+};
+
+
+// abstraction of translations discovery and loading
+class WXDLLIMPEXP_BASE wxTranslationsLoader
+{
+public:
+ wxTranslationsLoader() {}
+ virtual ~wxTranslationsLoader() {}
+
+ virtual wxMsgCatalog *LoadCatalog(const wxString& domain,
+ const wxString& lang) = 0;
+
+ virtual wxArrayString GetAvailableTranslations(const wxString& domain) const = 0;
+};
+
+
+// standard wxTranslationsLoader implementation, using filesystem
+class WXDLLIMPEXP_BASE wxFileTranslationsLoader
+ : public wxTranslationsLoader
+{
+public:
+ static void AddCatalogLookupPathPrefix(const wxString& prefix);
+
+ virtual wxMsgCatalog *LoadCatalog(const wxString& domain,
+ const wxString& lang);
+
+ virtual wxArrayString GetAvailableTranslations(const wxString& domain) const;
+};
+
+
+#ifdef __WINDOWS__
+// loads translations from win32 resources
+class WXDLLIMPEXP_BASE wxResourceTranslationsLoader
+ : public wxTranslationsLoader
+{
+public:
+ virtual wxMsgCatalog *LoadCatalog(const wxString& domain,
+ const wxString& lang);
+
+ virtual wxArrayString GetAvailableTranslations(const wxString& domain) const;
+
+protected:
+ // returns resource type to use for translations
+ virtual wxString GetResourceType() const { return "MOFILE"; }
+
+ // returns module to load resources from
+ virtual WXHINSTANCE GetModule() const { return 0; }
+};
+#endif // __WINDOWS__
+
+
+// ----------------------------------------------------------------------------
+// global functions
+// ----------------------------------------------------------------------------
+
+// get the translation of the string in the current locale
+inline const wxString& wxGetTranslation(const wxString& str,
+ const wxString& domain = wxString())
+{
+ wxTranslations *trans = wxTranslations::Get();
+ const wxString *transStr = trans ? trans->GetTranslatedString(str, domain)
+ : NULL;
+ if ( transStr )
+ return *transStr;
+ else
+ // NB: this function returns reference to a string, so we have to keep
+ // a copy of it somewhere
+ return wxTranslations::GetUntranslatedString(str);
+}
+
+inline const wxString& wxGetTranslation(const wxString& str1,
+ const wxString& str2,
+ unsigned n,
+ const wxString& domain = wxString())
+{
+ wxTranslations *trans = wxTranslations::Get();
+ const wxString *transStr = trans ? trans->GetTranslatedString(str1, n, domain)
+ : NULL;
+ if ( transStr )
+ return *transStr;
+ else
+ // NB: this function returns reference to a string, so we have to keep
+ // a copy of it somewhere
+ return n == 1
+ ? wxTranslations::GetUntranslatedString(str1)
+ : wxTranslations::GetUntranslatedString(str2);
+}
+
+#else // !wxUSE_INTL
+
+// the macros should still be defined - otherwise compilation would fail
+
+#if !defined(WXINTL_NO_GETTEXT_MACRO)
+ #if !defined(_)
+ #define _(s) (s)
+ #endif
+ #define wxPLURAL(sing, plur, n) ((n) == 1 ? (sing) : (plur))
+#endif
+
+#define wxTRANSLATE(str) str
+
+// NB: we use a template here in order to avoid using
+// wxLocale::GetUntranslatedString() above, which would be required if
+// we returned const wxString&; this way, the compiler should be able to
+// optimize wxGetTranslation() away
+
+template<typename TString>
+inline TString wxGetTranslation(TString str)
+ { return str; }
+
+template<typename TString, typename TDomain>
+inline TString wxGetTranslation(TString str, TDomain WXUNUSED(domain))
+ { return str; }
+
+template<typename TString, typename TDomain>
+inline TString wxGetTranslation(TString str1, TString str2, size_t n)
+ { return n == 1 ? str1 : str2; }
+
+template<typename TString, typename TDomain>
+inline TString wxGetTranslation(TString str1, TString str2, size_t n,
+ TDomain WXUNUSED(domain))
+ { return n == 1 ? str1 : str2; }
+
+#endif // wxUSE_INTL/!wxUSE_INTL
+
+// define this one just in case it occurs somewhere (instead of preferred
+// wxTRANSLATE) too
+#if !defined(WXINTL_NO_GETTEXT_MACRO)
+ #if !defined(gettext_noop)
+ #define gettext_noop(str) (str)
+ #endif
+ #if !defined(N_)
+ #define N_(s) (s)
+ #endif
+#endif
+
+#endif // _WX_TRANSLATION_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/treebase.h
+// Purpose: wxTreeCtrl base classes and types
+// Author: Julian Smart et al
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) 1997,1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TREEBASE_H_
+#define _WX_TREEBASE_H_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_TREECTRL
+
+#include "wx/window.h" // for wxClientData
+#include "wx/event.h"
+#include "wx/dynarray.h"
+#include "wx/itemid.h"
+
+#if WXWIN_COMPATIBILITY_2_6
+
+// flags for deprecated `Expand(int action)', will be removed in next versions
+enum
+{
+ wxTREE_EXPAND_EXPAND,
+ wxTREE_EXPAND_COLLAPSE,
+ wxTREE_EXPAND_COLLAPSE_RESET,
+ wxTREE_EXPAND_TOGGLE
+};
+
+#endif // WXWIN_COMPATIBILITY_2_6
+
+// ----------------------------------------------------------------------------
+// wxTreeItemId identifies an element of the tree. It's opaque for the
+// application and the only method which can be used by user code is IsOk().
+// ----------------------------------------------------------------------------
+
+// This is a class and not a typedef because existing code may forward declare
+// wxTreeItemId as a class and we don't want to break it without good reason.
+class wxTreeItemId : public wxItemId<void*>
+{
+public:
+ wxTreeItemId() : wxItemId<void*>() { }
+ wxTreeItemId(void* pItem) : wxItemId<void*>(pItem) { }
+};
+
+// ----------------------------------------------------------------------------
+// wxTreeItemData is some (arbitrary) user class associated with some item. The
+// main advantage of having this class (compared to old untyped interface) is
+// that wxTreeItemData's are destroyed automatically by the tree and, as this
+// class has virtual dtor, it means that the memory will be automatically
+// freed. OTOH, we don't just use wxObject instead of wxTreeItemData because
+// the size of this class is critical: in any real application, each tree leaf
+// will have wxTreeItemData associated with it and number of leaves may be
+// quite big.
+//
+// Because the objects of this class are deleted by the tree, they should
+// always be allocated on the heap!
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxTreeItemData: public wxClientData
+{
+friend class WXDLLIMPEXP_FWD_CORE wxTreeCtrl;
+friend class WXDLLIMPEXP_FWD_CORE wxGenericTreeCtrl;
+public:
+ // creation/destruction
+ // --------------------
+ // default ctor
+ wxTreeItemData() { }
+
+ // default copy ctor/assignment operator are ok
+
+ // accessor: get the item associated with us
+ const wxTreeItemId& GetId() const { return m_pItem; }
+ void SetId(const wxTreeItemId& id) { m_pItem = id; }
+
+protected:
+ wxTreeItemId m_pItem;
+};
+
+typedef void *wxTreeItemIdValue;
+
+WX_DEFINE_EXPORTED_ARRAY_PTR(wxTreeItemIdValue, wxArrayTreeItemIdsBase);
+
+// this is a wrapper around the array class defined above which allow to wok
+// with values of natural wxTreeItemId type instead of using wxTreeItemIdValue
+// and does it without any loss of efficiency
+class WXDLLIMPEXP_CORE wxArrayTreeItemIds : public wxArrayTreeItemIdsBase
+{
+public:
+ void Add(const wxTreeItemId& id)
+ { wxArrayTreeItemIdsBase::Add(id.m_pItem); }
+ void Insert(const wxTreeItemId& id, size_t pos)
+ { wxArrayTreeItemIdsBase::Insert(id.m_pItem, pos); }
+ wxTreeItemId Item(size_t i) const
+ { return wxTreeItemId(wxArrayTreeItemIdsBase::Item(i)); }
+ wxTreeItemId operator[](size_t i) const { return Item(i); }
+};
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// enum for different images associated with a treectrl item
+enum wxTreeItemIcon
+{
+ wxTreeItemIcon_Normal, // not selected, not expanded
+ wxTreeItemIcon_Selected, // selected, not expanded
+ wxTreeItemIcon_Expanded, // not selected, expanded
+ wxTreeItemIcon_SelectedExpanded, // selected, expanded
+ wxTreeItemIcon_Max
+};
+
+// special values for the 'state' parameter of wxTreeCtrl::SetItemState()
+static const int wxTREE_ITEMSTATE_NONE = -1; // not state (no display state image)
+static const int wxTREE_ITEMSTATE_NEXT = -2; // cycle to the next state
+static const int wxTREE_ITEMSTATE_PREV = -3; // cycle to the previous state
+
+// ----------------------------------------------------------------------------
+// wxTreeCtrl flags
+// ----------------------------------------------------------------------------
+
+#define wxTR_NO_BUTTONS 0x0000 // for convenience
+#define wxTR_HAS_BUTTONS 0x0001 // draw collapsed/expanded btns
+#define wxTR_NO_LINES 0x0004 // don't draw lines at all
+#define wxTR_LINES_AT_ROOT 0x0008 // connect top-level nodes
+#define wxTR_TWIST_BUTTONS 0x0010 // still used by wxTreeListCtrl
+
+#define wxTR_SINGLE 0x0000 // for convenience
+#define wxTR_MULTIPLE 0x0020 // can select multiple items
+
+#if WXWIN_COMPATIBILITY_2_8
+ #define wxTR_EXTENDED 0x0040 // deprecated, don't use
+#endif // WXWIN_COMPATIBILITY_2_8
+
+#define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080 // what it says
+
+#define wxTR_EDIT_LABELS 0x0200 // can edit item labels
+#define wxTR_ROW_LINES 0x0400 // put border around items
+#define wxTR_HIDE_ROOT 0x0800 // don't display root node
+
+#define wxTR_FULL_ROW_HIGHLIGHT 0x2000 // highlight full horz space
+
+// make the default control appearance look more native-like depending on the
+// platform
+#if defined(__WXGTK20__)
+ #define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_NO_LINES)
+#elif defined(__WXMAC__)
+ #define wxTR_DEFAULT_STYLE \
+ (wxTR_HAS_BUTTONS | wxTR_NO_LINES | wxTR_FULL_ROW_HIGHLIGHT)
+#else
+ #define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT)
+#endif
+
+#if WXWIN_COMPATIBILITY_2_6
+// deprecated, don't use
+#define wxTR_MAC_BUTTONS 0
+#define wxTR_AQUA_BUTTONS 0
+#endif // WXWIN_COMPATIBILITY_2_6
+
+
+// values for the `flags' parameter of wxTreeCtrl::HitTest() which determine
+// where exactly the specified point is situated:
+
+static const int wxTREE_HITTEST_ABOVE = 0x0001;
+static const int wxTREE_HITTEST_BELOW = 0x0002;
+static const int wxTREE_HITTEST_NOWHERE = 0x0004;
+ // on the button associated with an item.
+static const int wxTREE_HITTEST_ONITEMBUTTON = 0x0008;
+ // on the bitmap associated with an item.
+static const int wxTREE_HITTEST_ONITEMICON = 0x0010;
+ // on the indent associated with an item.
+static const int wxTREE_HITTEST_ONITEMINDENT = 0x0020;
+ // on the label (string) associated with an item.
+static const int wxTREE_HITTEST_ONITEMLABEL = 0x0040;
+ // on the right of the label associated with an item.
+static const int wxTREE_HITTEST_ONITEMRIGHT = 0x0080;
+ // on the label (string) associated with an item.
+static const int wxTREE_HITTEST_ONITEMSTATEICON = 0x0100;
+ // on the left of the wxTreeCtrl.
+static const int wxTREE_HITTEST_TOLEFT = 0x0200;
+ // on the right of the wxTreeCtrl.
+static const int wxTREE_HITTEST_TORIGHT = 0x0400;
+ // on the upper part (first half) of the item.
+static const int wxTREE_HITTEST_ONITEMUPPERPART = 0x0800;
+ // on the lower part (second half) of the item.
+static const int wxTREE_HITTEST_ONITEMLOWERPART = 0x1000;
+
+ // anywhere on the item
+static const int wxTREE_HITTEST_ONITEM = wxTREE_HITTEST_ONITEMICON |
+ wxTREE_HITTEST_ONITEMLABEL;
+
+// tree ctrl default name
+extern WXDLLIMPEXP_DATA_CORE(const char) wxTreeCtrlNameStr[];
+
+// ----------------------------------------------------------------------------
+// wxTreeItemAttr: a structure containing the visual attributes of an item
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxTreeItemAttr
+{
+public:
+ // ctors
+ wxTreeItemAttr() { }
+ wxTreeItemAttr(const wxColour& colText,
+ const wxColour& colBack,
+ const wxFont& font)
+ : m_colText(colText), m_colBack(colBack), m_font(font) { }
+
+ // setters
+ void SetTextColour(const wxColour& colText) { m_colText = colText; }
+ void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; }
+ void SetFont(const wxFont& font) { m_font = font; }
+
+ // accessors
+ bool HasTextColour() const { return m_colText.IsOk(); }
+ bool HasBackgroundColour() const { return m_colBack.IsOk(); }
+ bool HasFont() const { return m_font.IsOk(); }
+
+ const wxColour& GetTextColour() const { return m_colText; }
+ const wxColour& GetBackgroundColour() const { return m_colBack; }
+ const wxFont& GetFont() const { return m_font; }
+
+private:
+ wxColour m_colText,
+ m_colBack;
+ wxFont m_font;
+};
+
+// ----------------------------------------------------------------------------
+// wxTreeEvent is a special class for all events associated with tree controls
+//
+// NB: note that not all accessors make sense for all events, see the event
+// descriptions below
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxTreeCtrlBase;
+
+class WXDLLIMPEXP_CORE wxTreeEvent : public wxNotifyEvent
+{
+public:
+ wxTreeEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
+ wxTreeEvent(wxEventType commandType,
+ wxTreeCtrlBase *tree,
+ const wxTreeItemId &item = wxTreeItemId());
+ wxTreeEvent(const wxTreeEvent& event);
+
+ virtual wxEvent *Clone() const { return new wxTreeEvent(*this); }
+
+ // accessors
+ // get the item on which the operation was performed or the newly
+ // selected item for wxEVT_TREE_SEL_CHANGED/ING events
+ wxTreeItemId GetItem() const { return m_item; }
+ void SetItem(const wxTreeItemId& item) { m_item = item; }
+
+ // for wxEVT_TREE_SEL_CHANGED/ING events, get the previously
+ // selected item
+ wxTreeItemId GetOldItem() const { return m_itemOld; }
+ void SetOldItem(const wxTreeItemId& item) { m_itemOld = item; }
+
+ // the point where the mouse was when the drag operation started (for
+ // wxEVT_TREE_BEGIN_(R)DRAG events only) or click position
+ wxPoint GetPoint() const { return m_pointDrag; }
+ void SetPoint(const wxPoint& pt) { m_pointDrag = pt; }
+
+ // keyboard data (for wxEVT_TREE_KEY_DOWN only)
+ const wxKeyEvent& GetKeyEvent() const { return m_evtKey; }
+ int GetKeyCode() const { return m_evtKey.GetKeyCode(); }
+ void SetKeyEvent(const wxKeyEvent& evt) { m_evtKey = evt; }
+
+ // label (for EVT_TREE_{BEGIN|END}_LABEL_EDIT only)
+ const wxString& GetLabel() const { return m_label; }
+ void SetLabel(const wxString& label) { m_label = label; }
+
+ // edit cancel flag (for EVT_TREE_{BEGIN|END}_LABEL_EDIT only)
+ bool IsEditCancelled() const { return m_editCancelled; }
+ void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; }
+
+ // Set the tooltip for the item (for EVT\_TREE\_ITEM\_GETTOOLTIP events)
+ void SetToolTip(const wxString& toolTip) { m_label = toolTip; }
+ wxString GetToolTip() { return m_label; }
+
+private:
+ // not all of the members are used (or initialized) for all events
+ wxKeyEvent m_evtKey;
+ wxTreeItemId m_item,
+ m_itemOld;
+ wxPoint m_pointDrag;
+ wxString m_label;
+ bool m_editCancelled;
+
+ friend class WXDLLIMPEXP_FWD_CORE wxTreeCtrl;
+ friend class WXDLLIMPEXP_FWD_CORE wxGenericTreeCtrl;
+
+ DECLARE_DYNAMIC_CLASS(wxTreeEvent)
+};
+
+typedef void (wxEvtHandler::*wxTreeEventFunction)(wxTreeEvent&);
+
+// ----------------------------------------------------------------------------
+// tree control events and macros for handling them
+// ----------------------------------------------------------------------------
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_BEGIN_DRAG, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_BEGIN_RDRAG, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_BEGIN_LABEL_EDIT, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_END_LABEL_EDIT, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_DELETE_ITEM, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_GET_INFO, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_SET_INFO, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_EXPANDED, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_EXPANDING, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_COLLAPSED, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_COLLAPSING, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_SEL_CHANGED, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_SEL_CHANGING, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_KEY_DOWN, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_ACTIVATED, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_RIGHT_CLICK, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_MIDDLE_CLICK, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_END_DRAG, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_STATE_IMAGE_CLICK, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_GETTOOLTIP, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_MENU, wxTreeEvent );
+
+#define wxTreeEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxTreeEventFunction, func)
+
+#define wx__DECLARE_TREEEVT(evt, id, fn) \
+ wx__DECLARE_EVT1(wxEVT_TREE_ ## evt, id, wxTreeEventHandler(fn))
+
+// GetItem() returns the item being dragged, GetPoint() the mouse coords
+//
+// if you call event.Allow(), the drag operation will start and a
+// EVT_TREE_END_DRAG event will be sent when the drag is over.
+#define EVT_TREE_BEGIN_DRAG(id, fn) wx__DECLARE_TREEEVT(BEGIN_DRAG, id, fn)
+#define EVT_TREE_BEGIN_RDRAG(id, fn) wx__DECLARE_TREEEVT(BEGIN_RDRAG, id, fn)
+
+// GetItem() is the item on which the drop occurred (if any) and GetPoint() the
+// current mouse coords
+#define EVT_TREE_END_DRAG(id, fn) wx__DECLARE_TREEEVT(END_DRAG, id, fn)
+
+// GetItem() returns the itme whose label is being edited, GetLabel() returns
+// the current item label for BEGIN and the would be new one for END.
+//
+// Vetoing BEGIN event means that label editing won't happen at all,
+// vetoing END means that the new value is discarded and the old one kept
+#define EVT_TREE_BEGIN_LABEL_EDIT(id, fn) wx__DECLARE_TREEEVT(BEGIN_LABEL_EDIT, id, fn)
+#define EVT_TREE_END_LABEL_EDIT(id, fn) wx__DECLARE_TREEEVT(END_LABEL_EDIT, id, fn)
+
+// provide/update information about GetItem() item
+#define EVT_TREE_GET_INFO(id, fn) wx__DECLARE_TREEEVT(GET_INFO, id, fn)
+#define EVT_TREE_SET_INFO(id, fn) wx__DECLARE_TREEEVT(SET_INFO, id, fn)
+
+// GetItem() is the item being expanded/collapsed, the "ING" versions can use
+#define EVT_TREE_ITEM_EXPANDED(id, fn) wx__DECLARE_TREEEVT(ITEM_EXPANDED, id, fn)
+#define EVT_TREE_ITEM_EXPANDING(id, fn) wx__DECLARE_TREEEVT(ITEM_EXPANDING, id, fn)
+#define EVT_TREE_ITEM_COLLAPSED(id, fn) wx__DECLARE_TREEEVT(ITEM_COLLAPSED, id, fn)
+#define EVT_TREE_ITEM_COLLAPSING(id, fn) wx__DECLARE_TREEEVT(ITEM_COLLAPSING, id, fn)
+
+// GetOldItem() is the item which had the selection previously, GetItem() is
+// the item which acquires selection
+#define EVT_TREE_SEL_CHANGED(id, fn) wx__DECLARE_TREEEVT(SEL_CHANGED, id, fn)
+#define EVT_TREE_SEL_CHANGING(id, fn) wx__DECLARE_TREEEVT(SEL_CHANGING, id, fn)
+
+// GetKeyCode() returns the key code
+// NB: this is the only message for which GetItem() is invalid (you may get the
+// item from GetSelection())
+#define EVT_TREE_KEY_DOWN(id, fn) wx__DECLARE_TREEEVT(KEY_DOWN, id, fn)
+
+// GetItem() returns the item being deleted, the associated data (if any) will
+// be deleted just after the return of this event handler (if any)
+#define EVT_TREE_DELETE_ITEM(id, fn) wx__DECLARE_TREEEVT(DELETE_ITEM, id, fn)
+
+// GetItem() returns the item that was activated (double click, enter, space)
+#define EVT_TREE_ITEM_ACTIVATED(id, fn) wx__DECLARE_TREEEVT(ITEM_ACTIVATED, id, fn)
+
+// GetItem() returns the item for which the context menu shall be shown
+#define EVT_TREE_ITEM_MENU(id, fn) wx__DECLARE_TREEEVT(ITEM_MENU, id, fn)
+
+// GetItem() returns the item that was clicked on
+#define EVT_TREE_ITEM_RIGHT_CLICK(id, fn) wx__DECLARE_TREEEVT(ITEM_RIGHT_CLICK, id, fn)
+#define EVT_TREE_ITEM_MIDDLE_CLICK(id, fn) wx__DECLARE_TREEEVT(ITEM_MIDDLE_CLICK, id, fn)
+
+// GetItem() returns the item whose state image was clicked on
+#define EVT_TREE_STATE_IMAGE_CLICK(id, fn) wx__DECLARE_TREEEVT(STATE_IMAGE_CLICK, id, fn)
+
+// GetItem() is the item for which the tooltip is being requested
+#define EVT_TREE_ITEM_GETTOOLTIP(id, fn) wx__DECLARE_TREEEVT(ITEM_GETTOOLTIP, id, fn)
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_TREE_BEGIN_DRAG wxEVT_TREE_BEGIN_DRAG
+#define wxEVT_COMMAND_TREE_BEGIN_RDRAG wxEVT_TREE_BEGIN_RDRAG
+#define wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT wxEVT_TREE_BEGIN_LABEL_EDIT
+#define wxEVT_COMMAND_TREE_END_LABEL_EDIT wxEVT_TREE_END_LABEL_EDIT
+#define wxEVT_COMMAND_TREE_DELETE_ITEM wxEVT_TREE_DELETE_ITEM
+#define wxEVT_COMMAND_TREE_GET_INFO wxEVT_TREE_GET_INFO
+#define wxEVT_COMMAND_TREE_SET_INFO wxEVT_TREE_SET_INFO
+#define wxEVT_COMMAND_TREE_ITEM_EXPANDED wxEVT_TREE_ITEM_EXPANDED
+#define wxEVT_COMMAND_TREE_ITEM_EXPANDING wxEVT_TREE_ITEM_EXPANDING
+#define wxEVT_COMMAND_TREE_ITEM_COLLAPSED wxEVT_TREE_ITEM_COLLAPSED
+#define wxEVT_COMMAND_TREE_ITEM_COLLAPSING wxEVT_TREE_ITEM_COLLAPSING
+#define wxEVT_COMMAND_TREE_SEL_CHANGED wxEVT_TREE_SEL_CHANGED
+#define wxEVT_COMMAND_TREE_SEL_CHANGING wxEVT_TREE_SEL_CHANGING
+#define wxEVT_COMMAND_TREE_KEY_DOWN wxEVT_TREE_KEY_DOWN
+#define wxEVT_COMMAND_TREE_ITEM_ACTIVATED wxEVT_TREE_ITEM_ACTIVATED
+#define wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK wxEVT_TREE_ITEM_RIGHT_CLICK
+#define wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK wxEVT_TREE_ITEM_MIDDLE_CLICK
+#define wxEVT_COMMAND_TREE_END_DRAG wxEVT_TREE_END_DRAG
+#define wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK wxEVT_TREE_STATE_IMAGE_CLICK
+#define wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP wxEVT_TREE_ITEM_GETTOOLTIP
+#define wxEVT_COMMAND_TREE_ITEM_MENU wxEVT_TREE_ITEM_MENU
+
+#endif // wxUSE_TREECTRL
+
+#endif // _WX_TREEBASE_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/treebook.h
+// Purpose: wxTreebook: wxNotebook-like control presenting pages in a tree
+// Author: Evgeniy Tarassov, Vadim Zeitlin
+// Modified by:
+// Created: 2005-09-15
+// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TREEBOOK_H_
+#define _WX_TREEBOOK_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_TREEBOOK
+
+#include "wx/bookctrl.h"
+#include "wx/containr.h"
+#include "wx/treectrl.h" // for wxArrayTreeItemIds
+
+typedef wxWindow wxTreebookPage;
+
+class WXDLLIMPEXP_FWD_CORE wxTreeEvent;
+
+// ----------------------------------------------------------------------------
+// wxTreebook
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxTreebook : public wxNavigationEnabled<wxBookCtrlBase>
+{
+public:
+ // Constructors and such
+ // ---------------------
+
+ // Default ctor doesn't create the control, use Create() afterwards
+ wxTreebook()
+ {
+ Init();
+ }
+
+ // This ctor creates the tree book control
+ wxTreebook(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxBK_DEFAULT,
+ const wxString& name = wxEmptyString)
+ {
+ Init();
+
+ (void)Create(parent, id, pos, size, style, name);
+ }
+
+ // Really creates the control
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxBK_DEFAULT,
+ const wxString& name = wxEmptyString);
+
+
+ // Page insertion operations
+ // -------------------------
+
+ // Notice that page pointer may be NULL in which case the next non NULL
+ // page (usually the first child page of a node) is shown when this page is
+ // selected
+
+ // Inserts a new page just before the page indicated by page.
+ // The new page is placed on the same level as page.
+ virtual bool InsertPage(size_t pos,
+ wxWindow *page,
+ const wxString& text,
+ bool bSelect = false,
+ int imageId = NO_IMAGE);
+
+ // Inserts a new sub-page to the end of children of the page at given pos.
+ virtual bool InsertSubPage(size_t pos,
+ wxWindow *page,
+ const wxString& text,
+ bool bSelect = false,
+ int imageId = NO_IMAGE);
+
+ // Adds a new page at top level after all other pages.
+ virtual bool AddPage(wxWindow *page,
+ const wxString& text,
+ bool bSelect = false,
+ int imageId = NO_IMAGE);
+
+ // Adds a new child-page to the last top-level page inserted.
+ // Useful when constructing 1 level tree structure.
+ virtual bool AddSubPage(wxWindow *page,
+ const wxString& text,
+ bool bSelect = false,
+ int imageId = NO_IMAGE);
+
+ // Deletes the page and ALL its children. Could trigger page selection
+ // change in a case when selected page is removed. In that case its parent
+ // is selected (or the next page if no parent).
+ virtual bool DeletePage(size_t pos);
+
+
+ // Tree operations
+ // ---------------
+
+ // Gets the page node state -- node is expanded or collapsed
+ virtual bool IsNodeExpanded(size_t pos) const;
+
+ // Expands or collapses the page node. Returns the previous state.
+ // May generate page changing events (if selected page
+ // is under the collapsed branch, then parent is autoselected).
+ virtual bool ExpandNode(size_t pos, bool expand = true);
+
+ // shortcut for ExpandNode(pos, false)
+ bool CollapseNode(size_t pos) { return ExpandNode(pos, false); }
+
+ // get the parent page or wxNOT_FOUND if this is a top level page
+ int GetPageParent(size_t pos) const;
+
+ // the tree control we use for showing the pages index tree
+ wxTreeCtrl* GetTreeCtrl() const { return (wxTreeCtrl*)m_bookctrl; }
+
+
+ // Standard operations inherited from wxBookCtrlBase
+ // -------------------------------------------------
+
+ virtual bool SetPageText(size_t n, const wxString& strText);
+ virtual wxString GetPageText(size_t n) const;
+ virtual int GetPageImage(size_t n) const;
+ virtual bool SetPageImage(size_t n, int imageId);
+ virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); }
+ virtual int ChangeSelection(size_t n) { return DoSetSelection(n); }
+ virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
+ virtual void SetImageList(wxImageList *imageList);
+ virtual void AssignImageList(wxImageList *imageList);
+ virtual bool DeleteAllPages();
+
+protected:
+ // Implementation of a page removal. See DeletPage for comments.
+ wxTreebookPage *DoRemovePage(size_t pos);
+
+ // This subclass of wxBookCtrlBase accepts NULL page pointers (empty pages)
+ virtual bool AllowNullPage() const { return true; }
+
+ // event handlers
+ void OnTreeSelectionChange(wxTreeEvent& event);
+ void OnTreeNodeExpandedCollapsed(wxTreeEvent& event);
+
+ // array of page ids and page windows
+ wxArrayTreeItemIds m_treeIds;
+
+ // in the situation when m_selection page is not wxNOT_FOUND but page is
+ // NULL this is the first (sub)child that has a non-NULL page
+ int m_actualSelection;
+
+private:
+ // common part of all constructors
+ void Init();
+
+ // The real implementations of page insertion functions
+ // ------------------------------------------------------
+ // All DoInsert/Add(Sub)Page functions add the page into :
+ // - the base class
+ // - the tree control
+ // - update the index/TreeItemId corespondance array
+ bool DoInsertPage(size_t pos,
+ wxWindow *page,
+ const wxString& text,
+ bool bSelect = false,
+ int imageId = NO_IMAGE);
+ bool DoInsertSubPage(size_t pos,
+ wxWindow *page,
+ const wxString& text,
+ bool bSelect = false,
+ int imageId = NO_IMAGE);
+ bool DoAddSubPage(wxWindow *page,
+ const wxString& text,
+ bool bSelect = false,
+ int imageId = NO_IMAGE);
+
+ // Sets selection in the tree control and updates the page being shown.
+ int DoSetSelection(size_t pos, int flags = 0);
+
+ // Returns currently shown page. In a case when selected the node
+ // has empty (NULL) page finds first (sub)child with not-empty page.
+ wxTreebookPage *DoGetCurrentPage() const;
+
+ // Does the selection update. Called from page insertion functions
+ // to update selection if the selected page was pushed by the newly inserted
+ void DoUpdateSelection(bool bSelect, int page);
+
+
+ // Operations on the internal private members of the class
+ // -------------------------------------------------------
+ // Returns the page TreeItemId for the page.
+ // Or, if the page index is incorrect, a fake one (fakePage.IsOk() == false)
+ wxTreeItemId DoInternalGetPage(size_t pos) const;
+
+ // Linear search for a page with the id specified. If no page
+ // found wxNOT_FOUND is returned. The function is used when we catch an event
+ // from m_tree (wxTreeCtrl) component.
+ int DoInternalFindPageById(wxTreeItemId page) const;
+
+ // Updates page and wxTreeItemId correspondance.
+ void DoInternalAddPage(size_t newPos, wxWindow *page, wxTreeItemId pageId);
+
+ // Removes the page from internal structure.
+ void DoInternalRemovePage(size_t pos)
+ { DoInternalRemovePageRange(pos, 0); }
+
+ // Removes the page and all its children designated by subCount
+ // from internal structures of the control.
+ void DoInternalRemovePageRange(size_t pos, size_t subCount);
+
+ // Returns internal number of pages which can be different from
+ // GetPageCount() while performing a page insertion or removal.
+ size_t DoInternalGetPageCount() const { return m_treeIds.GetCount(); }
+
+
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxTreebook)
+};
+
+
+// ----------------------------------------------------------------------------
+// treebook event class and related stuff
+// ----------------------------------------------------------------------------
+
+// wxTreebookEvent is obsolete and defined for compatibility only
+#define wxTreebookEvent wxBookCtrlEvent
+typedef wxBookCtrlEventFunction wxTreebookEventFunction;
+#define wxTreebookEventHandler(func) wxBookCtrlEventHandler(func)
+
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREEBOOK_PAGE_CHANGED, wxBookCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREEBOOK_PAGE_CHANGING, wxBookCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREEBOOK_NODE_COLLAPSED, wxBookCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREEBOOK_NODE_EXPANDED, wxBookCtrlEvent );
+
+#define EVT_TREEBOOK_PAGE_CHANGED(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_TREEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn))
+
+#define EVT_TREEBOOK_PAGE_CHANGING(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_TREEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn))
+
+#define EVT_TREEBOOK_NODE_COLLAPSED(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_TREEBOOK_NODE_COLLAPSED, winid, wxBookCtrlEventHandler(fn))
+
+#define EVT_TREEBOOK_NODE_EXPANDED(winid, fn) \
+ wx__DECLARE_EVT1(wxEVT_TREEBOOK_NODE_EXPANDED, winid, wxBookCtrlEventHandler(fn))
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED wxEVT_TREEBOOK_PAGE_CHANGED
+#define wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING wxEVT_TREEBOOK_PAGE_CHANGING
+#define wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED wxEVT_TREEBOOK_NODE_COLLAPSED
+#define wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED wxEVT_TREEBOOK_NODE_EXPANDED
+
+
+#endif // wxUSE_TREEBOOK
+
+#endif // _WX_TREEBOOK_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/treectrl.h
+// Purpose: wxTreeCtrl base header
+// Author: Karsten Ballueder
+// Modified by:
+// Created:
+// Copyright: (c) Karsten Ballueder
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TREECTRL_H_BASE_
+#define _WX_TREECTRL_H_BASE_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_TREECTRL
+
+#include "wx/control.h"
+#include "wx/treebase.h"
+#include "wx/textctrl.h" // wxTextCtrl::ms_classinfo used through wxCLASSINFO macro
+
+class WXDLLIMPEXP_FWD_CORE wxImageList;
+
+// ----------------------------------------------------------------------------
+// wxTreeCtrlBase
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxTreeCtrlBase : public wxControl
+{
+public:
+ wxTreeCtrlBase();
+ virtual ~wxTreeCtrlBase();
+
+ // accessors
+ // ---------
+
+ // get the total number of items in the control
+ virtual unsigned int GetCount() const = 0;
+
+ // indent is the number of pixels the children are indented relative to
+ // the parents position. SetIndent() also redraws the control
+ // immediately.
+ virtual unsigned int GetIndent() const = 0;
+ virtual void SetIndent(unsigned int indent) = 0;
+
+ // spacing is the number of pixels between the start and the Text
+ // (has no effect under wxMSW)
+ unsigned int GetSpacing() const { return m_spacing; }
+ void SetSpacing(unsigned int spacing) { m_spacing = spacing; }
+
+ // image list: these functions allow to associate an image list with
+ // the control and retrieve it. Note that the control does _not_ delete
+ // the associated image list when it's deleted in order to allow image
+ // lists to be shared between different controls.
+ //
+ // The normal image list is for the icons which correspond to the
+ // normal tree item state (whether it is selected or not).
+ // Additionally, the application might choose to show a state icon
+ // which corresponds to an app-defined item state (for example,
+ // checked/unchecked) which are taken from the state image list.
+ wxImageList *GetImageList() const { return m_imageListNormal; }
+ wxImageList *GetStateImageList() const { return m_imageListState; }
+
+ virtual void SetImageList(wxImageList *imageList) = 0;
+ virtual void SetStateImageList(wxImageList *imageList) = 0;
+ void AssignImageList(wxImageList *imageList)
+ {
+ SetImageList(imageList);
+ m_ownsImageListNormal = true;
+ }
+ void AssignStateImageList(wxImageList *imageList)
+ {
+ SetStateImageList(imageList);
+ m_ownsImageListState = true;
+ }
+
+
+ // Functions to work with tree ctrl items. Unfortunately, they can _not_ be
+ // member functions of wxTreeItem because they must know the tree the item
+ // belongs to for Windows implementation and storing the pointer to
+ // wxTreeCtrl in each wxTreeItem is just too much waste.
+
+ // accessors
+ // ---------
+
+ // retrieve items label
+ virtual wxString GetItemText(const wxTreeItemId& item) const = 0;
+ // get one of the images associated with the item (normal by default)
+ virtual int GetItemImage(const wxTreeItemId& item,
+ wxTreeItemIcon which = wxTreeItemIcon_Normal) const = 0;
+ // get the data associated with the item
+ virtual wxTreeItemData *GetItemData(const wxTreeItemId& item) const = 0;
+
+ // get the item's text colour
+ virtual wxColour GetItemTextColour(const wxTreeItemId& item) const = 0;
+
+ // get the item's background colour
+ virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const = 0;
+
+ // get the item's font
+ virtual wxFont GetItemFont(const wxTreeItemId& item) const = 0;
+
+ // get the items state
+ int GetItemState(const wxTreeItemId& item) const
+ {
+ return DoGetItemState(item);
+ }
+
+ // modifiers
+ // ---------
+
+ // set items label
+ virtual void SetItemText(const wxTreeItemId& item, const wxString& text) = 0;
+ // set one of the images associated with the item (normal by default)
+ virtual void SetItemImage(const wxTreeItemId& item,
+ int image,
+ wxTreeItemIcon which = wxTreeItemIcon_Normal) = 0;
+ // associate some data with the item
+ virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData *data) = 0;
+
+ // force appearance of [+] button near the item. This is useful to
+ // allow the user to expand the items which don't have any children now
+ // - but instead add them only when needed, thus minimizing memory
+ // usage and loading time.
+ virtual void SetItemHasChildren(const wxTreeItemId& item,
+ bool has = true) = 0;
+
+ // the item will be shown in bold
+ virtual void SetItemBold(const wxTreeItemId& item, bool bold = true) = 0;
+
+ // the item will be shown with a drop highlight
+ virtual void SetItemDropHighlight(const wxTreeItemId& item,
+ bool highlight = true) = 0;
+
+ // set the items text colour
+ virtual void SetItemTextColour(const wxTreeItemId& item,
+ const wxColour& col) = 0;
+
+ // set the items background colour
+ virtual void SetItemBackgroundColour(const wxTreeItemId& item,
+ const wxColour& col) = 0;
+
+ // set the items font (should be of the same height for all items)
+ virtual void SetItemFont(const wxTreeItemId& item,
+ const wxFont& font) = 0;
+
+ // set the items state (special state values: wxTREE_ITEMSTATE_NONE/NEXT/PREV)
+ void SetItemState(const wxTreeItemId& item, int state);
+
+ // item status inquiries
+ // ---------------------
+
+ // is the item visible (it might be outside the view or not expanded)?
+ virtual bool IsVisible(const wxTreeItemId& item) const = 0;
+ // does the item has any children?
+ virtual bool ItemHasChildren(const wxTreeItemId& item) const = 0;
+ // same as above
+ bool HasChildren(const wxTreeItemId& item) const
+ { return ItemHasChildren(item); }
+ // is the item expanded (only makes sense if HasChildren())?
+ virtual bool IsExpanded(const wxTreeItemId& item) const = 0;
+ // is this item currently selected (the same as has focus)?
+ virtual bool IsSelected(const wxTreeItemId& item) const = 0;
+ // is item text in bold font?
+ virtual bool IsBold(const wxTreeItemId& item) const = 0;
+ // is the control empty?
+ bool IsEmpty() const;
+
+
+ // number of children
+ // ------------------
+
+ // if 'recursively' is false, only immediate children count, otherwise
+ // the returned number is the number of all items in this branch
+ virtual size_t GetChildrenCount(const wxTreeItemId& item,
+ bool recursively = true) const = 0;
+
+ // navigation
+ // ----------
+
+ // wxTreeItemId.IsOk() will return false if there is no such item
+
+ // get the root tree item
+ virtual wxTreeItemId GetRootItem() const = 0;
+
+ // get the item currently selected (may return NULL if no selection)
+ virtual wxTreeItemId GetSelection() const = 0;
+
+ // get the items currently selected, return the number of such item
+ //
+ // NB: this operation is expensive and can take a long time for a
+ // control with a lot of items (~ O(number of items)).
+ virtual size_t GetSelections(wxArrayTreeItemIds& selections) const = 0;
+
+ // get the last item to be clicked when the control has wxTR_MULTIPLE
+ // equivalent to GetSelection() if not wxTR_MULTIPLE
+ virtual wxTreeItemId GetFocusedItem() const = 0;
+
+
+ // Clears the currently focused item
+ virtual void ClearFocusedItem() = 0;
+ // Sets the currently focused item. Item should be valid
+ virtual void SetFocusedItem(const wxTreeItemId& item) = 0;
+
+
+ // get the parent of this item (may return NULL if root)
+ virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const = 0;
+
+ // for this enumeration function you must pass in a "cookie" parameter
+ // which is opaque for the application but is necessary for the library
+ // to make these functions reentrant (i.e. allow more than one
+ // enumeration on one and the same object simultaneously). Of course,
+ // the "cookie" passed to GetFirstChild() and GetNextChild() should be
+ // the same!
+
+ // get the first child of this item
+ virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item,
+ wxTreeItemIdValue& cookie) const = 0;
+ // get the next child
+ virtual wxTreeItemId GetNextChild(const wxTreeItemId& item,
+ wxTreeItemIdValue& cookie) const = 0;
+ // get the last child of this item - this method doesn't use cookies
+ virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const = 0;
+
+ // get the next sibling of this item
+ virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const = 0;
+ // get the previous sibling
+ virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const = 0;
+
+ // get first visible item
+ virtual wxTreeItemId GetFirstVisibleItem() const = 0;
+ // get the next visible item: item must be visible itself!
+ // see IsVisible() and wxTreeCtrl::GetFirstVisibleItem()
+ virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const = 0;
+ // get the previous visible item: item must be visible itself!
+ virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const = 0;
+
+ // operations
+ // ----------
+
+ // add the root node to the tree
+ virtual wxTreeItemId AddRoot(const wxString& text,
+ int image = -1, int selImage = -1,
+ wxTreeItemData *data = NULL) = 0;
+
+ // insert a new item in as the first child of the parent
+ wxTreeItemId PrependItem(const wxTreeItemId& parent,
+ const wxString& text,
+ int image = -1, int selImage = -1,
+ wxTreeItemData *data = NULL)
+ {
+ return DoInsertItem(parent, 0u, text, image, selImage, data);
+ }
+
+ // insert a new item after a given one
+ wxTreeItemId InsertItem(const wxTreeItemId& parent,
+ const wxTreeItemId& idPrevious,
+ const wxString& text,
+ int image = -1, int selImage = -1,
+ wxTreeItemData *data = NULL)
+ {
+ return DoInsertAfter(parent, idPrevious, text, image, selImage, data);
+ }
+
+ // insert a new item before the one with the given index
+ wxTreeItemId InsertItem(const wxTreeItemId& parent,
+ size_t pos,
+ const wxString& text,
+ int image = -1, int selImage = -1,
+ wxTreeItemData *data = NULL)
+ {
+ return DoInsertItem(parent, pos, text, image, selImage, data);
+ }
+
+ // insert a new item in as the last child of the parent
+ wxTreeItemId AppendItem(const wxTreeItemId& parent,
+ const wxString& text,
+ int image = -1, int selImage = -1,
+ wxTreeItemData *data = NULL)
+ {
+ return DoInsertItem(parent, (size_t)-1, text, image, selImage, data);
+ }
+
+ // delete this item and associated data if any
+ virtual void Delete(const wxTreeItemId& item) = 0;
+ // delete all children (but don't delete the item itself)
+ // NB: this won't send wxEVT_TREE_ITEM_DELETED events
+ virtual void DeleteChildren(const wxTreeItemId& item) = 0;
+ // delete all items from the tree
+ // NB: this won't send wxEVT_TREE_ITEM_DELETED events
+ virtual void DeleteAllItems() = 0;
+
+ // expand this item
+ virtual void Expand(const wxTreeItemId& item) = 0;
+ // expand the item and all its children recursively
+ void ExpandAllChildren(const wxTreeItemId& item);
+ // expand all items
+ void ExpandAll();
+ // collapse the item without removing its children
+ virtual void Collapse(const wxTreeItemId& item) = 0;
+ // collapse the item and all its children
+ void CollapseAllChildren(const wxTreeItemId& item);
+ // collapse all items
+ void CollapseAll();
+ // collapse the item and remove all children
+ virtual void CollapseAndReset(const wxTreeItemId& item) = 0;
+ // toggles the current state
+ virtual void Toggle(const wxTreeItemId& item) = 0;
+
+ // remove the selection from currently selected item (if any)
+ virtual void Unselect() = 0;
+ // unselect all items (only makes sense for multiple selection control)
+ virtual void UnselectAll() = 0;
+ // select this item
+ virtual void SelectItem(const wxTreeItemId& item, bool select = true) = 0;
+ // selects all (direct) children for given parent (only for
+ // multiselection controls)
+ virtual void SelectChildren(const wxTreeItemId& parent) = 0;
+ // unselect this item
+ void UnselectItem(const wxTreeItemId& item) { SelectItem(item, false); }
+ // toggle item selection
+ void ToggleItemSelection(const wxTreeItemId& item)
+ {
+ SelectItem(item, !IsSelected(item));
+ }
+
+ // make sure this item is visible (expanding the parent item and/or
+ // scrolling to this item if necessary)
+ virtual void EnsureVisible(const wxTreeItemId& item) = 0;
+ // scroll to this item (but don't expand its parent)
+ virtual void ScrollTo(const wxTreeItemId& item) = 0;
+
+ // start editing the item label: this (temporarily) replaces the item
+ // with a one line edit control. The item will be selected if it hadn't
+ // been before. textCtrlClass parameter allows you to create an edit
+ // control of arbitrary user-defined class deriving from wxTextCtrl.
+ virtual wxTextCtrl *EditLabel(const wxTreeItemId& item,
+ wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl)) = 0;
+ // returns the same pointer as StartEdit() if the item is being edited,
+ // NULL otherwise (it's assumed that no more than one item may be
+ // edited simultaneously)
+ virtual wxTextCtrl *GetEditControl() const = 0;
+ // end editing and accept or discard the changes to item label
+ virtual void EndEditLabel(const wxTreeItemId& item,
+ bool discardChanges = false) = 0;
+
+ // Enable or disable beep when incremental match doesn't find any item.
+ // Only implemented in the generic version currently.
+ virtual void EnableBellOnNoMatch(bool WXUNUSED(on) = true) { }
+
+ // sorting
+ // -------
+
+ // this function is called to compare 2 items and should return -1, 0
+ // or +1 if the first item is less than, equal to or greater than the
+ // second one. The base class version performs alphabetic comparaison
+ // of item labels (GetText)
+ virtual int OnCompareItems(const wxTreeItemId& item1,
+ const wxTreeItemId& item2)
+ {
+ return wxStrcmp(GetItemText(item1), GetItemText(item2));
+ }
+
+ // sort the children of this item using OnCompareItems
+ //
+ // NB: this function is not reentrant and not MT-safe (FIXME)!
+ virtual void SortChildren(const wxTreeItemId& item) = 0;
+
+ // items geometry
+ // --------------
+
+ // determine to which item (if any) belongs the given point (the
+ // coordinates specified are relative to the client area of tree ctrl)
+ // and, in the second variant, fill the flags parameter with a bitmask
+ // of wxTREE_HITTEST_xxx constants.
+ wxTreeItemId HitTest(const wxPoint& point) const
+ { int dummy; return DoTreeHitTest(point, dummy); }
+ wxTreeItemId HitTest(const wxPoint& point, int& flags) const
+ { return DoTreeHitTest(point, flags); }
+
+ // get the bounding rectangle of the item (or of its label only)
+ virtual bool GetBoundingRect(const wxTreeItemId& item,
+ wxRect& rect,
+ bool textOnly = false) const = 0;
+
+
+ // implementation
+ // --------------
+
+ virtual bool ShouldInheritColours() const { return false; }
+
+ // hint whether to calculate best size quickly or accurately
+ void SetQuickBestSize(bool q) { m_quickBestSize = q; }
+ bool GetQuickBestSize() const { return m_quickBestSize; }
+
+protected:
+ virtual wxSize DoGetBestSize() const;
+
+ // common part of Get/SetItemState()
+ virtual int DoGetItemState(const wxTreeItemId& item) const = 0;
+ virtual void DoSetItemState(const wxTreeItemId& item, int state) = 0;
+
+ // common part of Append/Prepend/InsertItem()
+ //
+ // pos is the position at which to insert the item or (size_t)-1 to append
+ // it to the end
+ virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent,
+ size_t pos,
+ const wxString& text,
+ int image, int selImage,
+ wxTreeItemData *data) = 0;
+
+ // and this function implements overloaded InsertItem() taking wxTreeItemId
+ // (it can't be called InsertItem() as we'd have virtual function hiding
+ // problem in derived classes then)
+ virtual wxTreeItemId DoInsertAfter(const wxTreeItemId& parent,
+ const wxTreeItemId& idPrevious,
+ const wxString& text,
+ int image = -1, int selImage = -1,
+ wxTreeItemData *data = NULL) = 0;
+
+ // real HitTest() implementation: again, can't be called just HitTest()
+ // because it's overloaded and so the non-virtual overload would be hidden
+ // (and can't be called DoHitTest() because this is already in wxWindow)
+ virtual wxTreeItemId DoTreeHitTest(const wxPoint& point,
+ int& flags) const = 0;
+
+
+ wxImageList *m_imageListNormal, // images for tree elements
+ *m_imageListState; // special images for app defined states
+ bool m_ownsImageListNormal,
+ m_ownsImageListState;
+
+ // spacing between left border and the text
+ unsigned int m_spacing;
+
+ // whether full or quick calculation is done in DoGetBestSize
+ bool m_quickBestSize;
+
+
+private:
+ // Intercept Escape and Return keys to ensure that our in-place edit
+ // control always gets them before they're used for dialog navigation or
+ // anything else.
+ void OnCharHook(wxKeyEvent& event);
+
+
+ wxDECLARE_NO_COPY_CLASS(wxTreeCtrlBase);
+};
+
+// ----------------------------------------------------------------------------
+// include the platform-dependent wxTreeCtrl class
+// ----------------------------------------------------------------------------
+
+#if defined(__WXUNIVERSAL__)
+ #include "wx/generic/treectlg.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/treectrl.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/generic/treectlg.h"
+#elif defined(__WXGTK__)
+ #include "wx/generic/treectlg.h"
+#elif defined(__WXMAC__)
+ #include "wx/generic/treectlg.h"
+#elif defined(__WXCOCOA__)
+ #include "wx/generic/treectlg.h"
+#elif defined(__WXPM__)
+ #include "wx/generic/treectlg.h"
+#endif
+
+#endif // wxUSE_TREECTRL
+
+#endif // _WX_TREECTRL_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/treelist.h
+// Purpose: wxTreeListCtrl class declaration.
+// Author: Vadim Zeitlin
+// Created: 2011-08-17
+// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TREELIST_H_
+#define _WX_TREELIST_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_TREELISTCTRL
+
+#include "wx/compositewin.h"
+#include "wx/containr.h"
+#include "wx/headercol.h"
+#include "wx/itemid.h"
+#include "wx/vector.h"
+#include "wx/window.h"
+#include "wx/withimages.h"
+
+class WXDLLIMPEXP_FWD_ADV wxDataViewCtrl;
+class WXDLLIMPEXP_FWD_ADV wxDataViewEvent;
+
+extern WXDLLIMPEXP_DATA_ADV(const char) wxTreeListCtrlNameStr[];
+
+class wxTreeListCtrl;
+class wxTreeListModel;
+class wxTreeListModelNode;
+
+// ----------------------------------------------------------------------------
+// Constants.
+// ----------------------------------------------------------------------------
+
+// wxTreeListCtrl styles.
+//
+// Notice that using wxTL_USER_3STATE implies wxTL_3STATE and wxTL_3STATE in
+// turn implies wxTL_CHECKBOX.
+enum
+{
+ wxTL_SINGLE = 0x0000, // This is the default anyhow.
+ wxTL_MULTIPLE = 0x0001, // Allow multiple selection.
+ wxTL_CHECKBOX = 0x0002, // Show checkboxes in the first column.
+ wxTL_3STATE = 0x0004, // Allow 3rd state in checkboxes.
+ wxTL_USER_3STATE = 0x0008, // Allow user to set 3rd state.
+ wxTL_NO_HEADER = 0x0010, // Column titles not visible.
+
+ wxTL_DEFAULT_STYLE = wxTL_SINGLE,
+ wxTL_STYLE_MASK = wxTL_SINGLE |
+ wxTL_MULTIPLE |
+ wxTL_CHECKBOX |
+ wxTL_3STATE |
+ wxTL_USER_3STATE
+};
+
+// ----------------------------------------------------------------------------
+// wxTreeListItem: unique identifier of an item in wxTreeListCtrl.
+// ----------------------------------------------------------------------------
+
+// Make wxTreeListItem a forward-declarable class even though it's simple
+// enough to possibly be declared as a simple typedef.
+class wxTreeListItem : public wxItemId<wxTreeListModelNode*>
+{
+public:
+ wxTreeListItem(wxTreeListModelNode* item = NULL)
+ : wxItemId<wxTreeListModelNode*>(item)
+ {
+ }
+};
+
+// Container of multiple items.
+typedef wxVector<wxTreeListItem> wxTreeListItems;
+
+// Some special "items" that can be used with InsertItem():
+extern WXDLLIMPEXP_DATA_ADV(const wxTreeListItem) wxTLI_FIRST;
+extern WXDLLIMPEXP_DATA_ADV(const wxTreeListItem) wxTLI_LAST;
+
+// ----------------------------------------------------------------------------
+// wxTreeListItemComparator: defines order of wxTreeListCtrl items.
+// ----------------------------------------------------------------------------
+
+class wxTreeListItemComparator
+{
+public:
+ wxTreeListItemComparator() { }
+
+ // The comparison function should return negative, null or positive value
+ // depending on whether the first item is less than, equal to or greater
+ // than the second one. The items should be compared using their values for
+ // the given column.
+ virtual int
+ Compare(wxTreeListCtrl* treelist,
+ unsigned column,
+ wxTreeListItem first,
+ wxTreeListItem second) = 0;
+
+ // Although this class is not used polymorphically by wxWidgets itself,
+ // provide virtual dtor in case it's used like this in the user code.
+ virtual ~wxTreeListItemComparator() { }
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxTreeListItemComparator);
+};
+
+// ----------------------------------------------------------------------------
+// wxTreeListCtrl: a control combining wxTree- and wxListCtrl features.
+// ----------------------------------------------------------------------------
+
+// This control also provides easy to use high level interface. Although the
+// implementation uses wxDataViewCtrl internally, this class is intentionally
+// simpler than wxDataViewCtrl and doesn't provide all of its functionality.
+//
+// If you need extra features you can always use GetDataView() accessor to work
+// with wxDataViewCtrl directly but doing this makes your unportable to possible
+// future non-wxDataViewCtrl-based implementations of this class.
+
+class WXDLLIMPEXP_ADV wxTreeListCtrl
+ : public wxCompositeWindow< wxNavigationEnabled<wxWindow> >,
+ public wxWithImages
+{
+public:
+ // Constructors and such
+ // ---------------------
+
+ wxTreeListCtrl() { Init(); }
+ wxTreeListCtrl(wxWindow* parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxTL_DEFAULT_STYLE,
+ const wxString& name = wxTreeListCtrlNameStr)
+ {
+ Init();
+
+ Create(parent, id, pos, size, style, name);
+ }
+
+ bool Create(wxWindow* parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxTL_DEFAULT_STYLE,
+ const wxString& name = wxTreeListCtrlNameStr);
+
+
+ virtual ~wxTreeListCtrl();
+
+ // Columns methods
+ // ---------------
+
+ // Add a column with the given title and attributes, returns the index of
+ // the new column or -1 on failure.
+ int AppendColumn(const wxString& title,
+ int width = wxCOL_WIDTH_AUTOSIZE,
+ wxAlignment align = wxALIGN_LEFT,
+ int flags = wxCOL_RESIZABLE)
+ {
+ return DoInsertColumn(title, -1, width, align, flags);
+ }
+
+ // Return the total number of columns.
+ unsigned GetColumnCount() const;
+
+ // Delete the column with the given index, returns false if index is
+ // invalid or deleting the column failed for some other reason.
+ bool DeleteColumn(unsigned col);
+
+ // Delete all columns.
+ void ClearColumns();
+
+ // Set column width to either the given value in pixels or to the value
+ // large enough to fit all of the items if width == wxCOL_WIDTH_AUTOSIZE.
+ void SetColumnWidth(unsigned col, int width);
+
+ // Get the current width of the given column in pixels.
+ int GetColumnWidth(unsigned col) const;
+
+ // Get the width appropriate for showing the given text. This is typically
+ // used as second argument for AppendColumn() or with SetColumnWidth().
+ int WidthFor(const wxString& text) const;
+
+
+ // Item methods
+ // ------------
+
+ // Adding items. The parent and text of the first column of the new item
+ // must always be specified, the rest is optional.
+ //
+ // Each item can have two images: one used for closed state and another for
+ // opened one. Only the first one is ever used for the items that don't
+ // have children. And both are not set by default.
+ //
+ // It is also possible to associate arbitrary client data pointer with the
+ // new item. It will be deleted by the control when the item is deleted
+ // (either by an explicit DeleteItem() call or because the entire control
+ // is destroyed).
+
+ wxTreeListItem AppendItem(wxTreeListItem parent,
+ const wxString& text,
+ int imageClosed = NO_IMAGE,
+ int imageOpened = NO_IMAGE,
+ wxClientData* data = NULL)
+ {
+ return DoInsertItem(parent, wxTLI_LAST, text,
+ imageClosed, imageOpened, data);
+ }
+
+ wxTreeListItem InsertItem(wxTreeListItem parent,
+ wxTreeListItem previous,
+ const wxString& text,
+ int imageClosed = NO_IMAGE,
+ int imageOpened = NO_IMAGE,
+ wxClientData* data = NULL)
+ {
+ return DoInsertItem(parent, previous, text,
+ imageClosed, imageOpened, data);
+ }
+
+ wxTreeListItem PrependItem(wxTreeListItem parent,
+ const wxString& text,
+ int imageClosed = NO_IMAGE,
+ int imageOpened = NO_IMAGE,
+ wxClientData* data = NULL)
+ {
+ return DoInsertItem(parent, wxTLI_FIRST, text,
+ imageClosed, imageOpened, data);
+ }
+
+ // Deleting items.
+ void DeleteItem(wxTreeListItem item);
+ void DeleteAllItems();
+
+
+ // Tree navigation
+ // ---------------
+
+ // Return the (never shown) root item.
+ wxTreeListItem GetRootItem() const;
+
+ // The parent item may be invalid for the root-level items.
+ wxTreeListItem GetItemParent(wxTreeListItem item) const;
+
+ // Iterate over the given item children: start by calling GetFirstChild()
+ // and then call GetNextSibling() for as long as it returns valid item.
+ wxTreeListItem GetFirstChild(wxTreeListItem item) const;
+ wxTreeListItem GetNextSibling(wxTreeListItem item) const;
+
+ // Return the first child of the root item, which is also the first item of
+ // the tree in depth-first traversal order.
+ wxTreeListItem GetFirstItem() const { return GetFirstChild(GetRootItem()); }
+
+ // Get item after the given one in the depth-first tree-traversal order.
+ // Calling this function starting with the result of GetFirstItem() allows
+ // iterating over all items in the tree.
+ wxTreeListItem GetNextItem(wxTreeListItem item) const;
+
+
+ // Items attributes
+ // ----------------
+
+ const wxString& GetItemText(wxTreeListItem item, unsigned col = 0) const;
+
+ // The convenience overload below sets the text for the first column.
+ void SetItemText(wxTreeListItem item, unsigned col, const wxString& text);
+ void SetItemText(wxTreeListItem item, const wxString& text)
+ {
+ SetItemText(item, 0, text);
+ }
+
+ // By default the opened image is the same as the normal, closed one (if
+ // it's used at all).
+ void SetItemImage(wxTreeListItem item, int closed, int opened = NO_IMAGE);
+
+ // Retrieve or set the data associated with the item.
+ wxClientData* GetItemData(wxTreeListItem item) const;
+ void SetItemData(wxTreeListItem item, wxClientData* data);
+
+
+ // Expanding and collapsing
+ // ------------------------
+
+ void Expand(wxTreeListItem item);
+ void Collapse(wxTreeListItem item);
+ bool IsExpanded(wxTreeListItem item) const;
+
+
+ // Selection handling
+ // ------------------
+
+ // This function can be used with single selection controls, use
+ // GetSelections() with the multi-selection ones.
+ wxTreeListItem GetSelection() const;
+
+ // This one can be used with either single or multi-selection controls.
+ unsigned GetSelections(wxTreeListItems& selections) const;
+
+ // In single selection mode Select() deselects any other selected items, in
+ // multi-selection case it adds to the selection.
+ void Select(wxTreeListItem item);
+
+ // Can be used in multiple selection mode only, single selected item in the
+ // single selection mode can't be unselected.
+ void Unselect(wxTreeListItem item);
+
+ // Return true if the item is selected, can be used in both single and
+ // multiple selection modes.
+ bool IsSelected(wxTreeListItem item) const;
+
+ // Select or unselect all items, only valid in multiple selection mode.
+ void SelectAll();
+ void UnselectAll();
+
+
+ // Checkbox handling
+ // -----------------
+
+ // Methods in this section can only be used with the controls created with
+ // wxTL_CHECKBOX style.
+
+ // Simple set, unset or query the checked state.
+ void CheckItem(wxTreeListItem item, wxCheckBoxState state = wxCHK_CHECKED);
+ void UncheckItem(wxTreeListItem item) { CheckItem(item, wxCHK_UNCHECKED); }
+
+ // The same but do it recursively for this item itself and its children.
+ void CheckItemRecursively(wxTreeListItem item,
+ wxCheckBoxState state = wxCHK_CHECKED);
+
+ // Update the parent of this item recursively: if this item and all its
+ // siblings are checked, the parent will become checked as well. If this
+ // item and all its siblings are unchecked, the parent will be unchecked.
+ // And if the siblings of this item are not all in the same state, the
+ // parent will be switched to indeterminate state. And then the same logic
+ // will be applied to the parents parent and so on recursively.
+ //
+ // This is typically called when the state of the given item has changed
+ // from EVT_TREELIST_ITEM_CHECKED() handler in the controls which have
+ // wxTL_3STATE flag. Notice that without this flag this function can't work
+ // as it would be unable to set the state of a parent with both checked and
+ // unchecked items so it's only allowed to call it when this flag is set.
+ void UpdateItemParentStateRecursively(wxTreeListItem item);
+
+ // Return the current state.
+ wxCheckBoxState GetCheckedState(wxTreeListItem item) const;
+
+ // Return true if all item children (if any) are in the given state.
+ bool AreAllChildrenInState(wxTreeListItem item,
+ wxCheckBoxState state) const;
+
+
+
+ // Sorting.
+ // --------
+
+ // Sort by the given column, either in ascending (default) or descending
+ // sort order.
+ //
+ // By default, simple alphabetical sorting is done by this column contents
+ // but SetItemComparator() may be called to perform comparison in some
+ // other way.
+ void SetSortColumn(unsigned col, bool ascendingOrder = true);
+
+ // If the control contents is sorted, return true and fill the output
+ // parameters with the column which is currently used for sorting and
+ // whether we sort using ascending or descending order. Otherwise, i.e. if
+ // the control contents is unsorted, simply return false.
+ bool GetSortColumn(unsigned* col, bool* ascendingOrder = NULL);
+
+ // Set the object to use for comparing the items. It will be called when
+ // the control is being sorted because the user clicked on a sortable
+ // column.
+ //
+ // The provided pointer is stored by the control so the object it points to
+ // must have a life-time equal or greater to that of the control itself. In
+ // addition, the pointer can be NULL to stop using custom comparator and
+ // revert to the default alphabetical comparison.
+ void SetItemComparator(wxTreeListItemComparator* comparator);
+
+
+ // View window functions.
+ // ----------------------
+
+ // This control itself is entirely covered by the "view window" which is
+ // currently a wxDataViewCtrl but if you want to avoid relying on this to
+ // allow your code to work with later versions which might not be
+ // wxDataViewCtrl-based, use the first function only and only use the
+ // second one if you really need to call wxDataViewCtrl methods on it.
+ wxWindow* GetView() const;
+ wxDataViewCtrl* GetDataView() const { return m_view; }
+
+private:
+ // Common part of all ctors.
+ void Init();
+
+ // Pure virtual method inherited from wxCompositeWindow.
+ virtual wxWindowList GetCompositeWindowParts() const;
+
+ // Implementation of AppendColumn().
+ int DoInsertColumn(const wxString& title,
+ int pos, // May be -1 meaning "append".
+ int width,
+ wxAlignment align,
+ int flags);
+
+ // Common part of {Append,Insert,Prepend}Item().
+ wxTreeListItem DoInsertItem(wxTreeListItem parent,
+ wxTreeListItem previous,
+ const wxString& text,
+ int imageClosed,
+ int imageOpened,
+ wxClientData* data);
+
+ // Send wxTreeListEvent corresponding to the given wxDataViewEvent for an
+ // item (as opposed for column-oriented events).
+ //
+ // Also updates the original event "skipped" and "vetoed" flags.
+ void SendItemEvent(wxEventType evt, wxDataViewEvent& event);
+
+ // Send wxTreeListEvent corresponding to the given column wxDataViewEvent.
+ void SendColumnEvent(wxEventType evt, wxDataViewEvent& event);
+
+
+ // Called by wxTreeListModel when an item is toggled by the user.
+ void OnItemToggled(wxTreeListItem item, wxCheckBoxState stateOld);
+
+ // Event handlers.
+ void OnSelectionChanged(wxDataViewEvent& event);
+ void OnItemExpanding(wxDataViewEvent& event);
+ void OnItemExpanded(wxDataViewEvent& event);
+ void OnItemActivated(wxDataViewEvent& event);
+ void OnItemContextMenu(wxDataViewEvent& event);
+ void OnColumnSorted(wxDataViewEvent& event);
+ void OnSize(wxSizeEvent& event);
+
+ wxDECLARE_EVENT_TABLE();
+
+
+ wxDataViewCtrl* m_view;
+ wxTreeListModel* m_model;
+
+ wxTreeListItemComparator* m_comparator;
+
+
+ // It calls our inherited protected wxWithImages::GetImage() method.
+ friend class wxTreeListModel;
+
+ wxDECLARE_NO_COPY_CLASS(wxTreeListCtrl);
+};
+
+// ----------------------------------------------------------------------------
+// wxTreeListEvent: event generated by wxTreeListCtrl.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxTreeListEvent : public wxNotifyEvent
+{
+public:
+ // Default ctor is provided for wxRTTI needs only but should never be used.
+ wxTreeListEvent() { Init(); }
+
+ // The item affected by the event. Valid for all events except
+ // column-specific ones such as COLUMN_SORTED.
+ wxTreeListItem GetItem() const { return m_item; }
+
+ // The previous state of the item checkbox for ITEM_CHECKED events only.
+ wxCheckBoxState GetOldCheckedState() const { return m_oldCheckedState; }
+
+ // The index of the column affected by the event. Currently only used by
+ // COLUMN_SORTED event.
+ unsigned GetColumn() const { return m_column; }
+
+ virtual wxEvent* Clone() const { return new wxTreeListEvent(*this); }
+
+private:
+ // Common part of all ctors.
+ void Init()
+ {
+ m_column = static_cast<unsigned>(-1);
+
+ m_oldCheckedState = wxCHK_UNDETERMINED;
+ }
+
+ // Ctor is private, only wxTreeListCtrl can create events of this type.
+ wxTreeListEvent(wxEventType evtType,
+ wxTreeListCtrl* treelist,
+ wxTreeListItem item)
+ : wxNotifyEvent(evtType, treelist->GetId()),
+ m_item(item)
+ {
+ SetEventObject(treelist);
+
+ Init();
+ }
+
+ // Set the checkbox state before this event for ITEM_CHECKED events.
+ void SetOldCheckedState(wxCheckBoxState state)
+ {
+ m_oldCheckedState = state;
+ }
+
+ // Set the column affected by this event for COLUMN_SORTED events.
+ void SetColumn(unsigned column)
+ {
+ m_column = column;
+ }
+
+
+ const wxTreeListItem m_item;
+
+ wxCheckBoxState m_oldCheckedState;
+
+ unsigned m_column;
+
+ friend class wxTreeListCtrl;
+
+ wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTreeListEvent);
+};
+
+// Event types and event table macros.
+
+typedef void (wxEvtHandler::*wxTreeListEventFunction)(wxTreeListEvent&);
+
+#define wxTreeListEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxTreeListEventFunction, func)
+
+#define wxEVT_TREELIST_GENERIC(name, id, fn) \
+ wx__DECLARE_EVT1(wxEVT_TREELIST_##name, id, wxTreeListEventHandler(fn))
+
+#define wxDECLARE_TREELIST_EVENT(name) \
+ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, \
+ wxEVT_TREELIST_##name, \
+ wxTreeListEvent)
+
+wxDECLARE_TREELIST_EVENT(SELECTION_CHANGED);
+#define EVT_TREELIST_SELECTION_CHANGED(id, fn) \
+ wxEVT_TREELIST_GENERIC(SELECTION_CHANGED, id, fn)
+
+wxDECLARE_TREELIST_EVENT(ITEM_EXPANDING);
+#define EVT_TREELIST_ITEM_EXPANDING(id, fn) \
+ wxEVT_TREELIST_GENERIC(ITEM_EXPANDING, id, fn)
+
+wxDECLARE_TREELIST_EVENT(ITEM_EXPANDED);
+#define EVT_TREELIST_ITEM_EXPANDED(id, fn) \
+ wxEVT_TREELIST_GENERIC(ITEM_EXPANDED, id, fn)
+
+wxDECLARE_TREELIST_EVENT(ITEM_CHECKED);
+#define EVT_TREELIST_ITEM_CHECKED(id, fn) \
+ wxEVT_TREELIST_GENERIC(ITEM_CHECKED, id, fn)
+
+wxDECLARE_TREELIST_EVENT(ITEM_ACTIVATED);
+#define EVT_TREELIST_ITEM_ACTIVATED(id, fn) \
+ wxEVT_TREELIST_GENERIC(ITEM_ACTIVATED, id, fn)
+
+wxDECLARE_TREELIST_EVENT(ITEM_CONTEXT_MENU);
+#define EVT_TREELIST_ITEM_CONTEXT_MENU(id, fn) \
+ wxEVT_TREELIST_GENERIC(ITEM_CONTEXT_MENU, id, fn)
+
+wxDECLARE_TREELIST_EVENT(COLUMN_SORTED);
+#define EVT_TREELIST_COLUMN_SORTED(id, fn) \
+ wxEVT_TREELIST_GENERIC(COLUMN_SORTED, id, fn)
+
+#undef wxDECLARE_TREELIST_EVENT
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_TREELIST_SELECTION_CHANGED wxEVT_TREELIST_SELECTION_CHANGED
+#define wxEVT_COMMAND_TREELIST_ITEM_EXPANDING wxEVT_TREELIST_ITEM_EXPANDING
+#define wxEVT_COMMAND_TREELIST_ITEM_EXPANDED wxEVT_TREELIST_ITEM_EXPANDED
+#define wxEVT_COMMAND_TREELIST_ITEM_CHECKED wxEVT_TREELIST_ITEM_CHECKED
+#define wxEVT_COMMAND_TREELIST_ITEM_ACTIVATED wxEVT_TREELIST_ITEM_ACTIVATED
+#define wxEVT_COMMAND_TREELIST_ITEM_CONTEXT_MENU wxEVT_TREELIST_ITEM_CONTEXT_MENU
+#define wxEVT_COMMAND_TREELIST_COLUMN_SORTED wxEVT_TREELIST_COLUMN_SORTED
+
+#endif // wxUSE_TREELISTCTRL
+
+#endif // _WX_TREELIST_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/txtstrm.h
+// Purpose: Text stream classes
+// Author: Guilhem Lavaux
+// Modified by:
+// Created: 28/06/1998
+// Copyright: (c) Guilhem Lavaux
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TXTSTREAM_H_
+#define _WX_TXTSTREAM_H_
+
+#include "wx/stream.h"
+#include "wx/convauto.h"
+
+#if wxUSE_STREAMS
+
+class WXDLLIMPEXP_FWD_BASE wxTextInputStream;
+class WXDLLIMPEXP_FWD_BASE wxTextOutputStream;
+
+typedef wxTextInputStream& (*__wxTextInputManip)(wxTextInputStream&);
+typedef wxTextOutputStream& (*__wxTextOutputManip)(wxTextOutputStream&);
+
+WXDLLIMPEXP_BASE wxTextOutputStream &endl( wxTextOutputStream &stream );
+
+
+#define wxEOT wxT('\4') // the End-Of-Text control code (used only inside wxTextInputStream)
+
+// If you're scanning through a file using wxTextInputStream, you should check for EOF _before_
+// reading the next item (word / number), because otherwise the last item may get lost.
+// You should however be prepared to receive an empty item (empty string / zero number) at the
+// end of file, especially on Windows systems. This is unavoidable because most (but not all) files end
+// with whitespace (i.e. usually a newline).
+class WXDLLIMPEXP_BASE wxTextInputStream
+{
+public:
+#if wxUSE_UNICODE
+ wxTextInputStream(wxInputStream& s,
+ const wxString &sep=wxT(" \t"),
+ const wxMBConv& conv = wxConvAuto());
+#else
+ wxTextInputStream(wxInputStream& s, const wxString &sep=wxT(" \t"));
+#endif
+ ~wxTextInputStream();
+
+ const wxInputStream& GetInputStream() const { return m_input; }
+
+ wxUint32 Read32(int base = 10); // base may be between 2 and 36, inclusive, or the special 0 (= C format)
+ wxUint16 Read16(int base = 10);
+ wxUint8 Read8(int base = 10);
+ wxInt32 Read32S(int base = 10);
+ wxInt16 Read16S(int base = 10);
+ wxInt8 Read8S(int base = 10);
+ double ReadDouble();
+ wxString ReadLine();
+ wxString ReadWord();
+ wxChar GetChar() { wxChar c = NextChar(); return (wxChar)(c != wxEOT ? c : 0); }
+
+ wxString GetStringSeparators() const { return m_separators; }
+ void SetStringSeparators(const wxString &c) { m_separators = c; }
+
+ // Operators
+ wxTextInputStream& operator>>(wxString& word);
+ wxTextInputStream& operator>>(char& c);
+#if wxUSE_UNICODE && wxWCHAR_T_IS_REAL_TYPE
+ wxTextInputStream& operator>>(wchar_t& wc);
+#endif // wxUSE_UNICODE
+ wxTextInputStream& operator>>(wxInt16& i);
+ wxTextInputStream& operator>>(wxInt32& i);
+ wxTextInputStream& operator>>(wxUint16& i);
+ wxTextInputStream& operator>>(wxUint32& i);
+ wxTextInputStream& operator>>(double& i);
+ wxTextInputStream& operator>>(float& f);
+
+ wxTextInputStream& operator>>( __wxTextInputManip func) { return func(*this); }
+
+#if WXWIN_COMPATIBILITY_2_6
+ wxDEPRECATED( wxString ReadString() ); // use ReadLine or ReadWord instead
+#endif // WXWIN_COMPATIBILITY_2_6
+
+protected:
+ wxInputStream &m_input;
+ wxString m_separators;
+ char m_lastBytes[10]; // stores the bytes that were read for the last character
+
+#if wxUSE_UNICODE
+ wxMBConv *m_conv;
+#endif
+
+ bool EatEOL(const wxChar &c);
+ void UngetLast(); // should be used instead of wxInputStream::Ungetch() because of Unicode issues
+ // returns EOT (\4) if there is a stream error, or end of file
+ wxChar NextChar(); // this should be used instead of GetC() because of Unicode issues
+ wxChar NextNonSeparators();
+
+ wxDECLARE_NO_COPY_CLASS(wxTextInputStream);
+};
+
+typedef enum
+{
+ wxEOL_NATIVE,
+ wxEOL_UNIX,
+ wxEOL_MAC,
+ wxEOL_DOS
+} wxEOL;
+
+class WXDLLIMPEXP_BASE wxTextOutputStream
+{
+public:
+#if wxUSE_UNICODE
+ wxTextOutputStream(wxOutputStream& s,
+ wxEOL mode = wxEOL_NATIVE,
+ const wxMBConv& conv = wxConvAuto());
+#else
+ wxTextOutputStream(wxOutputStream& s, wxEOL mode = wxEOL_NATIVE);
+#endif
+ virtual ~wxTextOutputStream();
+
+ const wxOutputStream& GetOutputStream() const { return m_output; }
+
+ void SetMode( wxEOL mode = wxEOL_NATIVE );
+ wxEOL GetMode() { return m_mode; }
+
+ void Write32(wxUint32 i);
+ void Write16(wxUint16 i);
+ void Write8(wxUint8 i);
+ virtual void WriteDouble(double d);
+ virtual void WriteString(const wxString& string);
+
+ wxTextOutputStream& PutChar(wxChar c);
+
+ void Flush();
+
+ wxTextOutputStream& operator<<(const wxString& string);
+ wxTextOutputStream& operator<<(char c);
+#if wxUSE_UNICODE && wxWCHAR_T_IS_REAL_TYPE
+ wxTextOutputStream& operator<<(wchar_t wc);
+#endif // wxUSE_UNICODE
+ wxTextOutputStream& operator<<(wxInt16 c);
+ wxTextOutputStream& operator<<(wxInt32 c);
+ wxTextOutputStream& operator<<(wxUint16 c);
+ wxTextOutputStream& operator<<(wxUint32 c);
+ wxTextOutputStream& operator<<(double f);
+ wxTextOutputStream& operator<<(float f);
+
+ wxTextOutputStream& operator<<( __wxTextOutputManip func) { return func(*this); }
+
+protected:
+ wxOutputStream &m_output;
+ wxEOL m_mode;
+
+#if wxUSE_UNICODE
+ wxMBConv *m_conv;
+#endif
+
+ wxDECLARE_NO_COPY_CLASS(wxTextOutputStream);
+};
+
+#endif
+ // wxUSE_STREAMS
+
+#endif
+ // _WX_DATSTREAM_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/typeinfo.h
+// Purpose: wxTypeId implementation
+// Author: Jaakko Salli
+// Created: 2009-11-19
+// Copyright: (c) wxWidgets Team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TYPEINFO_H_
+#define _WX_TYPEINFO_H_
+
+//
+// This file defines wxTypeId macro that should be used internally in
+// wxWidgets instead of typeid(), for compatibility with builds that do
+// not implement C++ RTTI. Also, type defining macros in this file are
+// intended for internal use only at this time and may change in future
+// versions.
+//
+// The reason why we need this simple RTTI system in addition to the older
+// wxObject-based one is that the latter does not work in template
+// classes.
+//
+
+#include "wx/defs.h"
+
+#ifndef wxNO_RTTI
+
+//
+// Let's trust that Visual C++ versions 9.0 and later implement C++
+// RTTI well enough, so we can use it and work around harmless memory
+// leaks reported by the static run-time libraries.
+//
+#if wxCHECK_VISUALC_VERSION(9)
+ #define wxTRUST_CPP_RTTI 1
+#else
+ #define wxTRUST_CPP_RTTI 0
+#endif
+
+#include <typeinfo>
+#include <string.h>
+
+#define _WX_DECLARE_TYPEINFO_CUSTOM(CLS, IDENTFUNC)
+#define WX_DECLARE_TYPEINFO_INLINE(CLS)
+#define WX_DECLARE_TYPEINFO(CLS)
+#define WX_DEFINE_TYPEINFO(CLS)
+#define WX_DECLARE_ABSTRACT_TYPEINFO(CLS)
+
+#if wxTRUST_CPP_RTTI
+
+#define wxTypeId typeid
+
+#else /* !wxTRUST_CPP_RTTI */
+
+//
+// For improved type-safety, let's make the check using class name
+// comparison. Most modern compilers already do this, but we cannot
+// rely on all supported compilers to work this well. However, in
+// cases where we'd know that typeid() would be flawless (as such),
+// wxTypeId could of course simply be defined as typeid.
+//
+
+class wxTypeIdentifier
+{
+public:
+ wxTypeIdentifier(const char* className)
+ {
+ m_className = className;
+ }
+
+ bool operator==(const wxTypeIdentifier& other)
+ {
+ return strcmp(m_className, other.m_className) == 0;
+ }
+
+ bool operator!=(const wxTypeIdentifier& other)
+ {
+ return strcmp(m_className, other.m_className) != 0;
+ }
+private:
+ const char* m_className;
+};
+
+#define wxTypeId(OBJ) wxTypeIdentifier(typeid(OBJ).name())
+
+#endif /* wxTRUST_CPP_RTTI/!wxTRUST_CPP_RTTI */
+
+#else // if !wxNO_RTTI
+
+#define wxTRUST_CPP_RTTI 0
+
+//
+// When C++ RTTI is not available, we will have to make the type comparison
+// using pointer to a dummy static member function. This will fail if
+// declared type is used across DLL boundaries, although using
+// WX_DECLARE_TYPEINFO() and WX_DEFINE_TYPEINFO() pair instead of
+// WX_DECLARE_TYPEINFO_INLINE() should fix this. However, that approach is
+// usually not possible when type info needs to be declared for a template
+// class.
+//
+
+typedef void (*wxTypeIdentifier)();
+
+// Use this macro to declare type info with specified static function
+// IDENTFUNC used as type identifier. Usually you should only use
+// WX_DECLARE_TYPEINFO() or WX_DECLARE_TYPEINFO_INLINE() however.
+#define _WX_DECLARE_TYPEINFO_CUSTOM(CLS, IDENTFUNC) \
+public: \
+ virtual wxTypeIdentifier GetWxTypeId() const \
+ { \
+ return reinterpret_cast<wxTypeIdentifier> \
+ (&IDENTFUNC); \
+ }
+
+// Use this macro to declare type info with externally specified
+// type identifier, defined with WX_DEFINE_TYPEINFO().
+#define WX_DECLARE_TYPEINFO(CLS) \
+private: \
+ static CLS sm_wxClassInfo(); \
+_WX_DECLARE_TYPEINFO_CUSTOM(CLS, sm_wxClassInfo)
+
+// Use this macro to implement type identifier function required by
+// WX_DECLARE_TYPEINFO().
+// NOTE: CLS is required to have default ctor. If it doesn't
+// already, you should provide a private dummy one.
+#define WX_DEFINE_TYPEINFO(CLS) \
+CLS CLS::sm_wxClassInfo() { return CLS(); }
+
+// Use this macro to declare type info fully inline in class.
+// NOTE: CLS is required to have default ctor. If it doesn't
+// already, you should provide a private dummy one.
+#define WX_DECLARE_TYPEINFO_INLINE(CLS) \
+private: \
+ static CLS sm_wxClassInfo() { return CLS(); } \
+_WX_DECLARE_TYPEINFO_CUSTOM(CLS, sm_wxClassInfo)
+
+#define wxTypeId(OBJ) (OBJ).GetWxTypeId()
+
+// Because abstract classes cannot be instantiated, we use
+// this macro to define pure virtual type interface for them.
+#define WX_DECLARE_ABSTRACT_TYPEINFO(CLS) \
+public: \
+ virtual wxTypeIdentifier GetWxTypeId() const = 0;
+
+#endif // wxNO_RTTI/!wxNO_RTTI
+
+#endif // _WX_TYPEINFO_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/types.h
+// Purpose: Type identifiers, used by resource system
+// Author: Julian Smart
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TYPESH__
+#define _WX_TYPESH__
+
+// Types of objects
+#define wxTYPE_ANY 0
+#define wxTYPE_OBJECT wxTYPE_ANY
+#define wxTYPE_WINDOW 1
+#define wxTYPE_DIALOG_BOX 2
+#define wxTYPE_ITEM 3
+#define wxTYPE_PANEL 4
+#define wxTYPE_CANVAS 5
+#define wxTYPE_TEXT_WINDOW 6
+#define wxTYPE_FRAME 7
+
+#define wxTYPE_BUTTON 8
+#define wxTYPE_TEXT 9
+#define wxTYPE_MESSAGE 10
+#define wxTYPE_CHOICE 11
+#define wxTYPE_LIST_BOX 12
+#define wxTYPE_SLIDER 13
+#define wxTYPE_CHECK_BOX 14
+#define wxTYPE_MENU 15
+#define wxTYPE_MENU_BAR 16
+#define wxTYPE_MULTI_TEXT 17
+#define wxTYPE_RADIO_BOX 18
+#define wxTYPE_GROUP_BOX 19
+#define wxTYPE_GAUGE 20
+#define wxTYPE_SCROLL_BAR 21
+#define wxTYPE_VIRT_LIST_BOX 22
+#define wxTYPE_COMBO_BOX 23
+#define wxTYPE_RADIO_BUTTON 24
+
+#define wxTYPE_EVENT 25
+#define wxTYPE_DC 26
+#define wxTYPE_DC_CANVAS 27
+#define wxTYPE_DC_POSTSCRIPT 28
+#define wxTYPE_DC_PRINTER 29
+#define wxTYPE_DC_METAFILE 30
+#define wxTYPE_DC_MEMORY 31
+#define wxTYPE_MOUSE_EVENT 32
+#define wxTYPE_KEY_EVENT 33
+#define wxTYPE_COMMAND_EVENT 34
+#define wxTYPE_DC_PANEL 35
+
+#define wxTYPE_PEN 40
+#define wxTYPE_BRUSH 41
+#define wxTYPE_FONT 42
+#define wxTYPE_ICON 42
+#define wxTYPE_BITMAP 43
+#define wxTYPE_METAFILE 44
+#define wxTYPE_TIMER 45
+#define wxTYPE_COLOUR 46
+#define wxTYPE_COLOURMAP 47
+#define wxTYPE_CURSOR 48
+
+#define wxTYPE_DDE_CLIENT 60
+#define wxTYPE_DDE_SERVER 61
+#define wxTYPE_DDE_CONNECTION 62
+
+#define wxTYPE_HELP_INSTANCE 63
+
+#define wxTYPE_LIST 70
+#define wxTYPE_STRING_LIST 71
+#define wxTYPE_HASH_TABLE 72
+#define wxTYPE_NODE 73
+#define wxTYPE_APP 74
+#define wxTYPE_DATE 75
+
+#define wxTYPE_ENHANCED_DIALOG 80
+#define wxTYPE_TOOLBAR 81
+#define wxTYPE_BUTTONBAR 82
+
+#define wxTYPE_DATABASE 90
+#define wxTYPE_QUERY_FIELD 91
+#define wxTYPE_QUERY_COL 92
+#define wxTYPE_RECORDSET 93
+
+#define wxTYPE_USER 500
+
+#endif
+ // _WX_TYPESH__
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/uiaction.h
+// Purpose: wxUIActionSimulator interface
+// Author: Kevin Ollivier, Steven Lamerton, Vadim Zeitlin
+// Modified by:
+// Created: 2010-03-06
+// Copyright: (c) Kevin Ollivier
+// (c) 2010 Steven Lamerton
+// (c) 2010 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UIACTIONSIMULATOR_H_
+#define _WX_UIACTIONSIMULATOR_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_UIACTIONSIMULATOR
+
+#include "wx/mousestate.h" // for wxMOUSE_BTN_XXX constants
+
+class WXDLLIMPEXP_CORE wxUIActionSimulator
+{
+public:
+ wxUIActionSimulator() { }
+
+
+ // Default dtor, copy ctor and assignment operator are ok (even though the
+ // last two don't make much sense for this class).
+
+
+ // Mouse simulation
+ // ----------------
+
+ // Low level methods
+ bool MouseMove(long x, long y);
+ bool MouseMove(const wxPoint& point) { return MouseMove(point.x, point.y); }
+
+ bool MouseDown(int button = wxMOUSE_BTN_LEFT);
+ bool MouseUp(int button = wxMOUSE_BTN_LEFT);
+
+ // Higher level interface, use it if possible instead
+ bool MouseClick(int button = wxMOUSE_BTN_LEFT);
+ bool MouseDblClick(int button = wxMOUSE_BTN_LEFT);
+ bool MouseDragDrop(long x1, long y1, long x2, long y2,
+ int button = wxMOUSE_BTN_LEFT);
+ bool MouseDragDrop(const wxPoint& p1, const wxPoint& p2,
+ int button = wxMOUSE_BTN_LEFT)
+ { return MouseDragDrop(p1.x, p1.y, p2.x, p2.y, button); }
+
+ // Keyboard simulation
+ // -------------------
+
+ // Low level methods for generating key presses and releases
+ bool KeyDown(int keycode, int modifiers = wxMOD_NONE)
+ { return Key(keycode, modifiers, true); }
+
+ bool KeyUp(int keycode, int modifiers = wxMOD_NONE)
+ { return Key(keycode, modifiers, false); }
+
+ // Higher level methods for generating both the key press and release for a
+ // single key or for all characters in the ASCII string "text" which can currently
+ // contain letters, digits and characters for the definition of numbers [+-., ].
+ bool Char(int keycode, int modifiers = wxMOD_NONE);
+
+ bool Text(const char *text);
+
+private:
+ // This is the common part of Key{Down,Up}() methods: while we keep them
+ // separate at public API level for consistency with Mouse{Down,Up}(), at
+ // implementation level it makes more sense to have them in a single
+ // function.
+ //
+ // It calls DoModifiers() to simulate pressing the modifier keys if
+ // necessary and then DoKey() for the key itself.
+ bool Key(int keycode, int modifiers, bool isDown);
+
+ // Call DoKey() for all modifier keys whose bits are set in the parameter.
+ void SimulateModifiers(int modifier, bool isDown);
+
+
+ // The low-level port-specific function which really generates the key
+ // presses. It should generate exactly one key event with the given
+ // parameters.
+ bool DoKey(int keycode, int modifiers, bool isDown);
+};
+
+#endif // wxUSE_UIACTIONSIMULATOR
+
+#endif // _WX_UIACTIONSIMULATOR_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/unichar.h
+// Purpose: wxUniChar and wxUniCharRef classes
+// Author: Vaclav Slavik
+// Created: 2007-03-19
+// Copyright: (c) 2007 REA Elektronik GmbH
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNICHAR_H_
+#define _WX_UNICHAR_H_
+
+#include "wx/defs.h"
+#include "wx/chartype.h"
+#include "wx/stringimpl.h"
+
+class WXDLLIMPEXP_FWD_BASE wxUniCharRef;
+class WXDLLIMPEXP_FWD_BASE wxString;
+
+// This class represents single Unicode character. It can be converted to
+// and from char or wchar_t and implements commonly used character operations.
+class WXDLLIMPEXP_BASE wxUniChar
+{
+public:
+ // NB: this is not wchar_t on purpose, it needs to represent the entire
+ // Unicode code points range and wchar_t may be too small for that
+ // (e.g. on Win32 where wchar_t* is encoded in UTF-16)
+ typedef wxUint32 value_type;
+
+ wxUniChar() : m_value(0) {}
+
+ // Create the character from 8bit character value encoded in the current
+ // locale's charset.
+ wxUniChar(char c) { m_value = From8bit(c); }
+ wxUniChar(unsigned char c) { m_value = From8bit((char)c); }
+
+#define wxUNICHAR_DEFINE_CTOR(type) \
+ wxUniChar(type c) { m_value = (value_type)c; }
+ wxDO_FOR_INT_TYPES(wxUNICHAR_DEFINE_CTOR)
+#undef wxUNICHAR_DEFINE_CTOR
+
+ wxUniChar(const wxUniCharRef& c);
+
+ // Returns Unicode code point value of the character
+ value_type GetValue() const { return m_value; }
+
+#if wxUSE_UNICODE_UTF8
+ // buffer for single UTF-8 character
+ struct Utf8CharBuffer
+ {
+ char data[5];
+ operator const char*() const { return data; }
+ };
+
+ // returns the character encoded as UTF-8
+ // (NB: implemented in stringops.cpp)
+ Utf8CharBuffer AsUTF8() const;
+#endif // wxUSE_UNICODE_UTF8
+
+ // Returns true if the character is an ASCII character:
+ bool IsAscii() const { return m_value < 0x80; }
+
+ // Returns true if the character is representable as a single byte in the
+ // current locale encoding and return this byte in output argument c (which
+ // must be non-NULL)
+ bool GetAsChar(char *c) const
+ {
+#if wxUSE_UNICODE
+ if ( !IsAscii() )
+ {
+#if !wxUSE_UTF8_LOCALE_ONLY
+ if ( GetAsHi8bit(m_value, c) )
+ return true;
+#endif // !wxUSE_UTF8_LOCALE_ONLY
+
+ return false;
+ }
+#endif // wxUSE_UNICODE
+
+ *c = wx_truncate_cast(char, m_value);
+ return true;
+ }
+
+ // Conversions to char and wchar_t types: all of those are needed to be
+ // able to pass wxUniChars to verious standard narrow and wide character
+ // functions
+ operator char() const { return To8bit(m_value); }
+ operator unsigned char() const { return (unsigned char)To8bit(m_value); }
+
+#define wxUNICHAR_DEFINE_OPERATOR_PAREN(type) \
+ operator type() const { return (type)m_value; }
+ wxDO_FOR_INT_TYPES(wxUNICHAR_DEFINE_OPERATOR_PAREN)
+#undef wxUNICHAR_DEFINE_OPERATOR_PAREN
+
+ // We need this operator for the "*p" part of expressions like "for (
+ // const_iterator p = begin() + nStart; *p; ++p )". In this case,
+ // compilation would fail without it because the conversion to bool would
+ // be ambiguous (there are all these int types conversions...). (And adding
+ // operator unspecified_bool_type() would only makes the ambiguity worse.)
+ operator bool() const { return m_value != 0; }
+ bool operator!() const { return !((bool)*this); }
+
+ // And this one is needed by some (not all, but not using ifdefs makes the
+ // code easier) compilers to parse "str[0] && *p" successfully
+ bool operator&&(bool v) const { return (bool)*this && v; }
+
+ // Assignment operators:
+ wxUniChar& operator=(const wxUniChar& c) { if (&c != this) m_value = c.m_value; return *this; }
+ wxUniChar& operator=(const wxUniCharRef& c);
+ wxUniChar& operator=(char c) { m_value = From8bit(c); return *this; }
+ wxUniChar& operator=(unsigned char c) { m_value = From8bit((char)c); return *this; }
+
+#define wxUNICHAR_DEFINE_OPERATOR_EQUAL(type) \
+ wxUniChar& operator=(type c) { m_value = (value_type)c; return *this; }
+ wxDO_FOR_INT_TYPES(wxUNICHAR_DEFINE_OPERATOR_EQUAL)
+#undef wxUNICHAR_DEFINE_OPERATOR_EQUAL
+
+ // Comparison operators:
+#define wxDEFINE_UNICHAR_CMP_WITH_INT(T, op) \
+ bool operator op(T c) const { return m_value op (value_type)c; }
+
+ // define the given comparison operator for all the types
+#define wxDEFINE_UNICHAR_OPERATOR(op) \
+ bool operator op(const wxUniChar& c) const { return m_value op c.m_value; }\
+ bool operator op(char c) const { return m_value op From8bit(c); } \
+ bool operator op(unsigned char c) const { return m_value op From8bit((char)c); } \
+ wxDO_FOR_INT_TYPES_1(wxDEFINE_UNICHAR_CMP_WITH_INT, op)
+
+ wxFOR_ALL_COMPARISONS(wxDEFINE_UNICHAR_OPERATOR)
+
+#undef wxDEFINE_UNICHAR_OPERATOR
+#undef wxDEFINE_UNCHAR_CMP_WITH_INT
+
+ // this is needed for expressions like 'Z'-c
+ int operator-(const wxUniChar& c) const { return m_value - c.m_value; }
+ int operator-(char c) const { return m_value - From8bit(c); }
+ int operator-(unsigned char c) const { return m_value - From8bit((char)c); }
+ int operator-(wchar_t c) const { return m_value - (value_type)c; }
+
+
+private:
+ // notice that we implement these functions inline for 7-bit ASCII
+ // characters purely for performance reasons
+ static value_type From8bit(char c)
+ {
+#if wxUSE_UNICODE
+ if ( (unsigned char)c < 0x80 )
+ return c;
+
+ return FromHi8bit(c);
+#else
+ return c;
+#endif
+ }
+
+ static char To8bit(value_type c)
+ {
+#if wxUSE_UNICODE
+ if ( c < 0x80 )
+ return wx_truncate_cast(char, c);
+
+ return ToHi8bit(c);
+#else
+ return wx_truncate_cast(char, c);
+#endif
+ }
+
+ // helpers of the functions above called to deal with non-ASCII chars
+ static value_type FromHi8bit(char c);
+ static char ToHi8bit(value_type v);
+ static bool GetAsHi8bit(value_type v, char *c);
+
+private:
+ value_type m_value;
+};
+
+
+// Writeable reference to a character in wxString.
+//
+// This class can be used in the same way wxChar is used, except that changing
+// its value updates the underlying string object.
+class WXDLLIMPEXP_BASE wxUniCharRef
+{
+private:
+ typedef wxStringImpl::iterator iterator;
+
+ // create the reference
+#if wxUSE_UNICODE_UTF8
+ wxUniCharRef(wxString& str, iterator pos) : m_str(str), m_pos(pos) {}
+#else
+ wxUniCharRef(iterator pos) : m_pos(pos) {}
+#endif
+
+public:
+ // NB: we have to make this public, because we don't have wxString
+ // declaration available here and so can't declare wxString::iterator
+ // as friend; so at least don't use a ctor but a static function
+ // that must be used explicitly (this is more than using 'explicit'
+ // keyword on ctor!):
+#if wxUSE_UNICODE_UTF8
+ static wxUniCharRef CreateForString(wxString& str, iterator pos)
+ { return wxUniCharRef(str, pos); }
+#else
+ static wxUniCharRef CreateForString(iterator pos)
+ { return wxUniCharRef(pos); }
+#endif
+
+ wxUniChar::value_type GetValue() const { return UniChar().GetValue(); }
+
+#if wxUSE_UNICODE_UTF8
+ wxUniChar::Utf8CharBuffer AsUTF8() const { return UniChar().AsUTF8(); }
+#endif // wxUSE_UNICODE_UTF8
+
+ bool IsAscii() const { return UniChar().IsAscii(); }
+ bool GetAsChar(char *c) const { return UniChar().GetAsChar(c); }
+
+ // Assignment operators:
+#if wxUSE_UNICODE_UTF8
+ wxUniCharRef& operator=(const wxUniChar& c);
+#else
+ wxUniCharRef& operator=(const wxUniChar& c) { *m_pos = c; return *this; }
+#endif
+
+ wxUniCharRef& operator=(const wxUniCharRef& c)
+ { if (&c != this) *this = c.UniChar(); return *this; }
+
+#define wxUNICHAR_REF_DEFINE_OPERATOR_EQUAL(type) \
+ wxUniCharRef& operator=(type c) { return *this = wxUniChar(c); }
+ wxDO_FOR_CHAR_INT_TYPES(wxUNICHAR_REF_DEFINE_OPERATOR_EQUAL)
+#undef wxUNICHAR_REF_DEFINE_OPERATOR_EQUAL
+
+ // Conversions to the same types as wxUniChar is convertible too:
+#define wxUNICHAR_REF_DEFINE_OPERATOR_PAREN(type) \
+ operator type() const { return UniChar(); }
+ wxDO_FOR_CHAR_INT_TYPES(wxUNICHAR_REF_DEFINE_OPERATOR_PAREN)
+#undef wxUNICHAR_REF_DEFINE_OPERATOR_PAREN
+
+ // see wxUniChar::operator bool etc. for explanation
+ operator bool() const { return (bool)UniChar(); }
+ bool operator!() const { return !UniChar(); }
+ bool operator&&(bool v) const { return UniChar() && v; }
+
+#define wxDEFINE_UNICHARREF_CMP_WITH_INT(T, op) \
+ bool operator op(T c) const { return UniChar() op c; }
+
+ // Comparison operators:
+#define wxDEFINE_UNICHARREF_OPERATOR(op) \
+ bool operator op(const wxUniCharRef& c) const { return UniChar() op c.UniChar(); }\
+ bool operator op(const wxUniChar& c) const { return UniChar() op c; } \
+ wxDO_FOR_CHAR_INT_TYPES_1(wxDEFINE_UNICHARREF_CMP_WITH_INT, op)
+
+ wxFOR_ALL_COMPARISONS(wxDEFINE_UNICHARREF_OPERATOR)
+
+#undef wxDEFINE_UNICHARREF_OPERATOR
+#undef wxDEFINE_UNICHARREF_CMP_WITH_INT
+
+ // for expressions like c-'A':
+ int operator-(const wxUniCharRef& c) const { return UniChar() - c.UniChar(); }
+ int operator-(const wxUniChar& c) const { return UniChar() - c; }
+ int operator-(char c) const { return UniChar() - c; }
+ int operator-(unsigned char c) const { return UniChar() - c; }
+ int operator-(wchar_t c) const { return UniChar() - c; }
+
+private:
+#if wxUSE_UNICODE_UTF8
+ wxUniChar UniChar() const;
+#else
+ wxUniChar UniChar() const { return *m_pos; }
+#endif
+
+ friend class WXDLLIMPEXP_FWD_BASE wxUniChar;
+
+private:
+ // reference to the string and pointer to the character in string
+#if wxUSE_UNICODE_UTF8
+ wxString& m_str;
+#endif
+ iterator m_pos;
+};
+
+inline wxUniChar::wxUniChar(const wxUniCharRef& c)
+{
+ m_value = c.UniChar().m_value;
+}
+
+inline wxUniChar& wxUniChar::operator=(const wxUniCharRef& c)
+{
+ m_value = c.UniChar().m_value;
+ return *this;
+}
+
+// Comparison operators for the case when wxUniChar(Ref) is the second operand
+// implemented in terms of member comparison functions
+
+wxDEFINE_COMPARISONS_BY_REV(char, const wxUniChar&)
+wxDEFINE_COMPARISONS_BY_REV(char, const wxUniCharRef&)
+
+wxDEFINE_COMPARISONS_BY_REV(wchar_t, const wxUniChar&)
+wxDEFINE_COMPARISONS_BY_REV(wchar_t, const wxUniCharRef&)
+
+wxDEFINE_COMPARISONS_BY_REV(const wxUniChar&, const wxUniCharRef&)
+
+// for expressions like c-'A':
+inline int operator-(char c1, const wxUniCharRef& c2) { return -(c2 - c1); }
+inline int operator-(const wxUniChar& c1, const wxUniCharRef& c2) { return -(c2 - c1); }
+inline int operator-(wchar_t c1, const wxUniCharRef& c2) { return -(c2 - c1); }
+
+#endif /* _WX_UNICHAR_H_ */
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/unix/app.h
+// Purpose: wxAppConsole implementation for Unix
+// Author: Lukasz Michalski
+// Created: 28/01/2005
+// Copyright: (c) Lukasz Michalski
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+//Ensure that sigset_t is being defined
+#include <signal.h>
+
+class wxFDIODispatcher;
+class wxFDIOHandler;
+class wxWakeUpPipe;
+
+// wxApp subclass implementing event processing for console applications
+class WXDLLIMPEXP_BASE wxAppConsole : public wxAppConsoleBase
+{
+public:
+ wxAppConsole();
+ virtual ~wxAppConsole();
+
+ // override base class initialization
+ virtual bool Initialize(int& argc, wxChar** argv);
+
+
+ // Unix-specific: Unix signal handling
+ // -----------------------------------
+
+ // type of the function which can be registered as signal handler: notice
+ // that it isn't really a signal handler, i.e. it's not subject to the
+ // usual signal handlers constraints, because it is called later from
+ // CheckSignal() and not when the signal really occurs
+ typedef void (*SignalHandler)(int);
+
+ // Set signal handler for the given signal, SIG_DFL or SIG_IGN can be used
+ // instead of a function pointer
+ //
+ // Return true if handler was installed, false on error
+ bool SetSignalHandler(int signal, SignalHandler handler);
+
+ // Check if any Unix signals arrived since the last call and execute
+ // handlers for them
+ void CheckSignal();
+
+ // Register the signal wake up pipe with the given dispatcher.
+ //
+ // This is used by wxExecute(wxEXEC_NOEVENTS) implementation only.
+ //
+ // The pointer to the handler used for processing events on this descriptor
+ // is returned so that it can be deleted when we no longer needed it.
+ wxFDIOHandler* RegisterSignalWakeUpPipe(wxFDIODispatcher& dispatcher);
+
+private:
+ // signal handler set up by SetSignalHandler() for all signals we handle,
+ // it just adds the signal to m_signalsCaught -- the real processing is
+ // done later, when CheckSignal() is called
+ static void HandleSignal(int signal);
+
+
+ // signals for which HandleSignal() had been called (reset from
+ // CheckSignal())
+ sigset_t m_signalsCaught;
+
+ // the signal handlers
+ WX_DECLARE_HASH_MAP(int, SignalHandler, wxIntegerHash, wxIntegerEqual, SignalHandlerHash);
+ SignalHandlerHash m_signalHandlerHash;
+
+ // pipe used for wake up signal handling: if a signal arrives while we're
+ // blocking for input, writing to this pipe triggers a call to our CheckSignal()
+ wxWakeUpPipe *m_signalWakeUpPipe;
+};
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/unix/apptbase.h
+// Purpose: declaration of wxAppTraits for Unix systems
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 23.06.2003
+// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIX_APPTBASE_H_
+#define _WX_UNIX_APPTBASE_H_
+
+#include "wx/evtloop.h"
+#include "wx/evtloopsrc.h"
+
+class wxExecuteData;
+class wxFDIOManager;
+class wxEventLoopSourcesManagerBase;
+
+// ----------------------------------------------------------------------------
+// wxAppTraits: the Unix version adds extra hooks needed by Unix code
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxAppTraits : public wxAppTraitsBase
+{
+public:
+ // wxExecute() support methods
+ // ---------------------------
+
+ // Wait for the process termination and return its exit code or -1 on error.
+ //
+ // Notice that this is only used when execData.flags contains wxEXEC_SYNC
+ // and does not contain wxEXEC_NOEVENTS, i.e. when we need to really wait
+ // until the child process exit and dispatch the events while doing it.
+ virtual int WaitForChild(wxExecuteData& execData);
+
+#if wxUSE_SOCKETS
+ // return a pointer to the object which should be used to integrate
+ // monitoring of the file descriptors to the event loop (currently this is
+ // used for the sockets only but should be used for arbitrary event loop
+ // sources in the future)
+ //
+ // this object may be different for the console and GUI applications
+ //
+ // the pointer is not deleted by the caller as normally it points to a
+ // static variable
+ virtual wxFDIOManager *GetFDIOManager();
+#endif // wxUSE_SOCKETS
+
+#if wxUSE_CONSOLE_EVENTLOOP
+ // Return a non-NULL pointer to the object responsible for managing the
+ // event loop sources in this kind of application.
+ virtual wxEventLoopSourcesManagerBase* GetEventLoopSourcesManager();
+#endif // wxUSE_CONSOLE_EVENTLOOP
+
+protected:
+ // Wait for the process termination by running the given event loop until
+ // this happens.
+ //
+ // This is used by the public WaitForChild() after creating the event loop
+ // of the appropriate kind.
+ int RunLoopUntilChildExit(wxExecuteData& execData, wxEventLoopBase& loop);
+};
+
+#endif // _WX_UNIX_APPTBASE_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/unix/apptrait.h
+// Purpose: standard implementations of wxAppTraits for Unix
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 23.06.2003
+// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIX_APPTRAIT_H_
+#define _WX_UNIX_APPTRAIT_H_
+
+// ----------------------------------------------------------------------------
+// wxGUI/ConsoleAppTraits: must derive from wxAppTraits, not wxAppTraitsBase
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxConsoleAppTraits : public wxConsoleAppTraitsBase
+{
+public:
+#if wxUSE_CONSOLE_EVENTLOOP
+ virtual wxEventLoopBase *CreateEventLoop();
+#endif // wxUSE_CONSOLE_EVENTLOOP
+#if wxUSE_TIMER
+ virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer);
+#endif
+};
+
+#if wxUSE_GUI
+
+// GTK+ and Motif integrate sockets and child processes monitoring directly in
+// their main loop, the other Unix ports do it at wxEventLoop level and so use
+// the non-GUI traits and don't need anything here
+//
+// TODO: Should we use XtAddInput() for wxX11 too? Or, vice versa, if there is
+// no advantage in doing this compared to the generic way currently used
+// by wxX11, should we continue to use GTK/Motif-specific stuff?
+#if defined(__WXGTK__) || defined(__WXMOTIF__)
+ #define wxHAS_GUI_FDIOMANAGER
+ #define wxHAS_GUI_PROCESS_CALLBACKS
+#endif // ports using wxFDIOManager
+
+#if defined(__WXMAC__)
+ #define wxHAS_GUI_PROCESS_CALLBACKS
+ #define wxHAS_GUI_SOCKET_MANAGER
+#endif
+
+class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase
+{
+public:
+ virtual wxEventLoopBase *CreateEventLoop();
+ virtual int WaitForChild(wxExecuteData& execData);
+#if wxUSE_TIMER
+ virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer);
+#endif
+#if wxUSE_THREADS && defined(__WXGTK20__)
+ virtual void MutexGuiEnter();
+ virtual void MutexGuiLeave();
+#endif
+
+#if (defined(__WXMAC__) || defined(__WXCOCOA__)) && wxUSE_STDPATHS
+ virtual wxStandardPaths& GetStandardPaths();
+#endif
+ virtual wxPortId GetToolkitVersion(int *majVer = NULL, int *minVer = NULL) const;
+
+#ifdef __WXGTK20__
+ virtual wxString GetDesktopEnvironment() const;
+ virtual wxString GetStandardCmdLineOptions(wxArrayString& names,
+ wxArrayString& desc) const;
+#endif // __WXGTK20____
+
+#if defined(__WXGTK20__)
+ virtual bool ShowAssertDialog(const wxString& msg);
+#endif
+
+#if wxUSE_SOCKETS
+
+#ifdef wxHAS_GUI_SOCKET_MANAGER
+ virtual wxSocketManager *GetSocketManager();
+#endif
+
+#ifdef wxHAS_GUI_FDIOMANAGER
+ virtual wxFDIOManager *GetFDIOManager();
+#endif
+
+#endif // wxUSE_SOCKETS
+
+ virtual wxEventLoopSourcesManagerBase* GetEventLoopSourcesManager();
+};
+
+#endif // wxUSE_GUI
+
+#endif // _WX_UNIX_APPTRAIT_H_
+
--- /dev/null
+/*
+ * Name: wx/unix/chkconf.h
+ * Purpose: Unix-specific config settings consistency checks
+ * Author: Vadim Zeitlin
+ * Created: 2007-07-14
+ * Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwidgets.org>
+ * Licence: wxWindows licence
+ */
+
+/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
+
+#if wxUSE_CONSOLE_EVENTLOOP
+# if !wxUSE_SELECT_DISPATCHER && !wxUSE_EPOLL_DISPATCHER
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxSelect/EpollDispatcher needed for console event loop"
+# else
+# undef wxUSE_SELECT_DISPATCHER
+# define wxUSE_SELECT_DISPATCHER 1
+# endif
+# endif
+#endif /* wxUSE_CONSOLE_EVENTLOOP */
+
+#if wxUSE_FSWATCHER
+# if !defined(wxHAS_INOTIFY) && !defined(wxHAS_KQUEUE)
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxFileSystemWatcher requires either inotify() or kqueue()"
+# else
+# undef wxUSE_FSWATCHER
+# define wxUSE_FSWATCHER 0
+# endif
+# endif
+#endif /* wxUSE_FSWATCHER */
+
+#if wxUSE_GSTREAMER
+# if !wxUSE_THREADS
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "GStreamer requires threads"
+# else
+# undef wxUSE_GSTREAMER
+# define wxUSE_GSTREAMER 0
+# endif
+# endif
+#endif /* wxUSE_GSTREAMER */
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/unix/evtloop.h
+// Purpose: declares wxEventLoop class
+// Author: Lukasz Michalski (lm@zork.pl)
+// Created: 2007-05-07
+// Copyright: (c) 2007 Lukasz Michalski
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIX_EVTLOOP_H_
+#define _WX_UNIX_EVTLOOP_H_
+
+#if wxUSE_CONSOLE_EVENTLOOP
+
+// ----------------------------------------------------------------------------
+// wxConsoleEventLoop
+// ----------------------------------------------------------------------------
+
+class wxEventLoopSource;
+class wxFDIODispatcher;
+class wxWakeUpPipeMT;
+
+class WXDLLIMPEXP_BASE wxConsoleEventLoop
+#ifdef __WXOSX__
+: public wxCFEventLoop
+#else
+: public wxEventLoopManual
+#endif
+{
+public:
+ // initialize the event loop, use IsOk() to check if we were successful
+ wxConsoleEventLoop();
+ virtual ~wxConsoleEventLoop();
+
+ // implement base class pure virtuals
+ virtual bool Pending() const;
+ virtual bool Dispatch();
+ virtual int DispatchTimeout(unsigned long timeout);
+ virtual void WakeUp();
+ virtual bool IsOk() const { return m_dispatcher != NULL; }
+ virtual bool YieldFor(long WXUNUSED(eventsToProcess)) { return true; }
+
+protected:
+ virtual void OnNextIteration();
+
+private:
+ // pipe used for wake up messages: when a child thread wants to wake up
+ // the event loop in the main thread it writes to this pipe
+ wxWakeUpPipeMT *m_wakeupPipe;
+
+ // the event loop source used to monitor this pipe
+ wxEventLoopSource* m_wakeupSource;
+
+ // either wxSelectDispatcher or wxEpollDispatcher
+ wxFDIODispatcher *m_dispatcher;
+
+ wxDECLARE_NO_COPY_CLASS(wxConsoleEventLoop);
+};
+
+#endif // wxUSE_CONSOLE_EVENTLOOP
+
+#endif // _WX_UNIX_EVTLOOP_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/unix/evtloopsrc.h
+// Purpose: wxUnixEventLoopSource class
+// Author: Vadim Zeitlin
+// Created: 2009-10-21
+// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIX_EVTLOOPSRC_H_
+#define _WX_UNIX_EVTLOOPSRC_H_
+
+class wxFDIODispatcher;
+class wxFDIOHandler;
+
+// ----------------------------------------------------------------------------
+// wxUnixEventLoopSource: wxEventLoopSource for Unix-like toolkits using fds
+// ----------------------------------------------------------------------------
+
+class wxUnixEventLoopSource : public wxEventLoopSource
+{
+public:
+ // dispatcher and fdioHandler are only used here to allow us to unregister
+ // from the event loop when we're destroyed
+ wxUnixEventLoopSource(wxFDIODispatcher *dispatcher,
+ wxFDIOHandler *fdioHandler,
+ int fd,
+ wxEventLoopSourceHandler *handler,
+ int flags)
+ : wxEventLoopSource(handler, flags),
+ m_dispatcher(dispatcher),
+ m_fdioHandler(fdioHandler),
+ m_fd(fd)
+ {
+ }
+
+ virtual ~wxUnixEventLoopSource();
+
+private:
+ wxFDIODispatcher * const m_dispatcher;
+ wxFDIOHandler * const m_fdioHandler;
+ const int m_fd;
+
+ wxDECLARE_NO_COPY_CLASS(wxUnixEventLoopSource);
+};
+
+#endif // _WX_UNIX_EVTLOOPSRC_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/unix/execute.h
+// Purpose: private details of wxExecute() implementation
+// Author: Vadim Zeitlin
+// Copyright: (c) 1998 Robert Roebling, Julian Smart, Vadim Zeitlin
+// (c) 2013 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIX_EXECUTE_H
+#define _WX_UNIX_EXECUTE_H
+
+#include "wx/app.h"
+#include "wx/hashmap.h"
+#include "wx/process.h"
+
+#if wxUSE_STREAMS
+ #include "wx/unix/pipe.h"
+ #include "wx/private/streamtempinput.h"
+#endif
+
+class wxEventLoopBase;
+
+// Information associated with a running child process.
+class wxExecuteData
+{
+public:
+ wxExecuteData()
+ {
+ flags =
+ pid = 0;
+ exitcode = -1;
+
+ process = NULL;
+
+ syncEventLoop = NULL;
+
+#if wxUSE_STREAMS
+ fdOut =
+ fdErr = wxPipe::INVALID_FD;
+#endif // wxUSE_STREAMS
+ }
+
+ // This must be called in the parent process as soon as fork() returns to
+ // update us with the effective child PID. It also ensures that we handle
+ // SIGCHLD to be able to detect when this PID exits, so wxTheApp must be
+ // available.
+ void OnStart(int pid);
+
+ // Called when the child process exits.
+ void OnExit(int exitcode);
+
+ // Return true if we should (or already did) redirect the child IO.
+ bool IsRedirected() const { return process && process->IsRedirected(); }
+
+
+ // wxExecute() flags
+ int flags;
+
+ // the pid of the child process
+ int pid;
+
+ // The exit code of the process, set once the child terminates.
+ int exitcode;
+
+ // the associated process object or NULL
+ wxProcess *process;
+
+ // Local event loop used to wait for the child process termination in
+ // synchronous execution case. We can't create it ourselves as its exact
+ // type depends on the application kind (console/GUI), so we rely on
+ // wxAppTraits setting up this pointer to point to the appropriate object.
+ wxEventLoopBase *syncEventLoop;
+
+#if wxUSE_STREAMS
+ // the input buffer bufOut is connected to stdout, this is why it is
+ // called bufOut and not bufIn
+ wxStreamTempInputBuffer bufOut,
+ bufErr;
+
+ // the corresponding FDs, -1 if not redirected
+ int fdOut,
+ fdErr;
+#endif // wxUSE_STREAMS
+
+
+private:
+ // SIGCHLD signal handler that checks whether any of the currently running
+ // children have exited.
+ static void OnSomeChildExited(int sig);
+
+ // All currently running child processes indexed by their PID.
+ //
+ // Notice that the container doesn't own its elements.
+ WX_DECLARE_HASH_MAP(int, wxExecuteData*, wxIntegerHash, wxIntegerEqual,
+ ChildProcessesData);
+ static ChildProcessesData ms_childProcesses;
+
+ wxDECLARE_NO_COPY_CLASS(wxExecuteData);
+};
+
+#endif // _WX_UNIX_EXECUTE_H
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/unix/fontutil.h
+// Purpose: font-related helper functions for Unix/X11
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 05.11.99
+// Copyright: (c) wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIX_FONTUTIL_H_
+#define _WX_UNIX_FONTUTIL_H_
+
+#ifdef __X__
+ typedef WXFontStructPtr wxNativeFont;
+#elif defined(__WXGTK__)
+ typedef GdkFont *wxNativeFont;
+#else
+ #error "Unsupported toolkit"
+#endif
+
+// returns the handle of the nearest available font or 0
+extern wxNativeFont
+wxLoadQueryNearestFont(int pointSize,
+ int family,
+ int style,
+ int weight,
+ bool underlined,
+ const wxString &facename,
+ wxFontEncoding encoding,
+ wxString* xFontName = NULL);
+
+// returns the font specified by the given XLFD
+extern wxNativeFont wxLoadFont(const wxString& fontSpec);
+
+#endif // _WX_UNIX_FONTUTIL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/unix/fswatcher_inotify.h
+// Purpose: wxInotifyFileSystemWatcher
+// Author: Bartosz Bekier
+// Created: 2009-05-26
+// Copyright: (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FSWATCHER_UNIX_H_
+#define _WX_FSWATCHER_UNIX_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_FSWATCHER
+
+class WXDLLIMPEXP_BASE wxInotifyFileSystemWatcher :
+ public wxFileSystemWatcherBase
+{
+public:
+ wxInotifyFileSystemWatcher();
+
+ wxInotifyFileSystemWatcher(const wxFileName& path,
+ int events = wxFSW_EVENT_ALL);
+
+ virtual ~wxInotifyFileSystemWatcher();
+
+ void OnDirDeleted(const wxString& path);
+
+protected:
+ bool Init();
+};
+
+#endif
+
+#endif /* _WX_FSWATCHER_UNIX_H_ */
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/unix/fswatcher_kqueue.h
+// Purpose: wxKqueueFileSystemWatcher
+// Author: Bartosz Bekier
+// Created: 2009-05-26
+// Copyright: (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FSWATCHER_KQUEUE_H_
+#define _WX_FSWATCHER_KQUEUE_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_FSWATCHER
+
+class WXDLLIMPEXP_BASE wxKqueueFileSystemWatcher :
+ public wxFileSystemWatcherBase
+{
+public:
+ wxKqueueFileSystemWatcher();
+
+ wxKqueueFileSystemWatcher(const wxFileName& path,
+ int events = wxFSW_EVENT_ALL);
+
+ virtual ~wxKqueueFileSystemWatcher();
+
+protected:
+ bool Init();
+};
+
+#endif
+
+#endif /* _WX_FSWATCHER_OSX_H_ */
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/unix/glx11.h
+// Purpose: class common for all X11-based wxGLCanvas implementations
+// Author: Vadim Zeitlin
+// Created: 2007-04-15
+// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIX_GLX11_H_
+#define _WX_UNIX_GLX11_H_
+
+#include <GL/glx.h>
+
+// ----------------------------------------------------------------------------
+// wxGLContext
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase
+{
+public:
+ wxGLContext(wxGLCanvas *win, const wxGLContext *other = NULL);
+ virtual ~wxGLContext();
+
+ virtual bool SetCurrent(const wxGLCanvas& win) const;
+
+private:
+ // attach context to the drawable or unset it (if NULL)
+ static bool MakeCurrent(GLXDrawable drawable, GLXContext context);
+
+ GLXContext m_glContext;
+
+ DECLARE_CLASS(wxGLContext)
+};
+
+// ----------------------------------------------------------------------------
+// wxGLCanvasX11
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_GL wxGLCanvasX11 : public wxGLCanvasBase
+{
+public:
+ // initialization and dtor
+ // -----------------------
+
+ // default ctor doesn't do anything, InitVisual() must be called
+ wxGLCanvasX11();
+
+ // initializes the XVisualInfo corresponding to the given attributes
+ bool InitVisual(const int *attribList);
+
+ // frees XVisualInfo info
+ virtual ~wxGLCanvasX11();
+
+
+ // implement wxGLCanvasBase methods
+ // --------------------------------
+
+ virtual bool SwapBuffers();
+
+
+ // X11-specific methods
+ // --------------------
+
+ // return GLX version: 13 means 1.3 &c
+ static int GetGLXVersion();
+
+ // return true if multisample extension is available
+ static bool IsGLXMultiSampleAvailable();
+
+ // get the X11 handle of this window
+ virtual Window GetXWindow() const = 0;
+
+
+ // override some wxWindow methods
+ // ------------------------------
+
+ // return true only if the window is realized: OpenGL context can't be
+ // created until we are
+ virtual bool IsShownOnScreen() const;
+
+
+ // implementation only from now on
+ // -------------------------------
+
+ // get the GLXFBConfig/XVisualInfo we use
+ GLXFBConfig *GetGLXFBConfig() const { return m_fbc; }
+ XVisualInfo *GetXVisualInfo() const { return m_vi; }
+
+ // initialize the global default GL visual, return false if matching visual
+ // not found
+ static bool InitDefaultVisualInfo(const int *attribList);
+
+ // get the default GL X11 visual (may be NULL, shouldn't be freed by caller)
+ static XVisualInfo *GetDefaultXVisualInfo() { return ms_glVisualInfo; }
+
+ // free the global GL visual, called by wxGLApp
+ static void FreeDefaultVisualInfo();
+
+ // initializes XVisualInfo (in any case) and, if supported, GLXFBConfig
+ //
+ // returns false if XVisualInfo couldn't be initialized, otherwise caller
+ // is responsible for freeing the pointers
+ static bool InitXVisualInfo(const int *attribList,
+ GLXFBConfig **pFBC, XVisualInfo **pXVisual);
+
+private:
+ // fills in glattrs with attributes defined by wxattrs which must be
+ // 0-terminated if it is non-NULL
+ //
+ // n is the max size of glattrs, false is returned if we overflow it, it
+ // should be at least 16 to accommodate the default attributes
+ static bool ConvertWXAttrsToGL(const int *wxattrs, int *glattrs, size_t n);
+
+
+ // this is only used if it's supported i.e. if GL >= 1.3
+ GLXFBConfig *m_fbc;
+
+ // used for all GL versions, obtained from GLXFBConfig for GL >= 1.3
+ XVisualInfo *m_vi;
+
+ // the global/default versions of the above
+ static GLXFBConfig *ms_glFBCInfo;
+ static XVisualInfo *ms_glVisualInfo;
+};
+
+// ----------------------------------------------------------------------------
+// wxGLApp
+// ----------------------------------------------------------------------------
+
+// this is used in wx/glcanvas.h, prevent it from defining a generic wxGLApp
+#define wxGL_APP_DEFINED
+
+class WXDLLIMPEXP_GL wxGLApp : public wxGLAppBase
+{
+public:
+ wxGLApp() : wxGLAppBase() { }
+
+ // implement wxGLAppBase method
+ virtual bool InitGLVisual(const int *attribList)
+ {
+ return wxGLCanvasX11::InitDefaultVisualInfo(attribList);
+ }
+
+ // and implement this wxGTK::wxApp method too
+ virtual void *GetXVisualInfo()
+ {
+ return wxGLCanvasX11::GetDefaultXVisualInfo();
+ }
+
+ // and override this wxApp method to clean up
+ virtual int OnExit()
+ {
+ wxGLCanvasX11::FreeDefaultVisualInfo();
+
+ return wxGLAppBase::OnExit();
+ }
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxGLApp)
+};
+
+#endif // _WX_UNIX_GLX11_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/unix/joystick.h
+// Purpose: wxJoystick class
+// Author: Guilhem Lavaux
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) Guilhem Lavaux
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIX_JOYSTICK_H_
+#define _WX_UNIX_JOYSTICK_H_
+
+#include "wx/event.h"
+
+class WXDLLIMPEXP_FWD_CORE wxJoystickThread;
+
+class WXDLLIMPEXP_ADV wxJoystick: public wxObject
+{
+ DECLARE_DYNAMIC_CLASS(wxJoystick)
+ public:
+ /*
+ * Public interface
+ */
+
+ wxJoystick(int joystick = wxJOYSTICK1);
+ virtual ~wxJoystick();
+
+ // Attributes
+ ////////////////////////////////////////////////////////////////////////////
+
+ wxPoint GetPosition() const;
+ int GetPosition(unsigned axis) const;
+ bool GetButtonState(unsigned button) const;
+ int GetZPosition() const;
+ int GetButtonState() const;
+ int GetPOVPosition() const;
+ int GetPOVCTSPosition() const;
+ int GetRudderPosition() const;
+ int GetUPosition() const;
+ int GetVPosition() const;
+ int GetMovementThreshold() const;
+ void SetMovementThreshold(int threshold) ;
+
+ // Capabilities
+ ////////////////////////////////////////////////////////////////////////////
+
+ bool IsOk() const; // Checks that the joystick is functioning
+ static int GetNumberJoysticks() ;
+ int GetManufacturerId() const ;
+ int GetProductId() const ;
+ wxString GetProductName() const ;
+ int GetXMin() const;
+ int GetYMin() const;
+ int GetZMin() const;
+ int GetXMax() const;
+ int GetYMax() const;
+ int GetZMax() const;
+ int GetNumberButtons() const;
+ int GetNumberAxes() const;
+ int GetMaxButtons() const;
+ int GetMaxAxes() const;
+ int GetPollingMin() const;
+ int GetPollingMax() const;
+ int GetRudderMin() const;
+ int GetRudderMax() const;
+ int GetUMin() const;
+ int GetUMax() const;
+ int GetVMin() const;
+ int GetVMax() const;
+
+ bool HasRudder() const;
+ bool HasZ() const;
+ bool HasU() const;
+ bool HasV() const;
+ bool HasPOV() const;
+ bool HasPOV4Dir() const;
+ bool HasPOVCTS() const;
+
+ // Operations
+ ////////////////////////////////////////////////////////////////////////////
+
+ // pollingFreq = 0 means that movement events are sent when above the threshold.
+ // If pollingFreq > 0, events are received every this many milliseconds.
+ bool SetCapture(wxWindow* win, int pollingFreq = 0);
+ bool ReleaseCapture();
+
+protected:
+ int m_device;
+ int m_joystick;
+ wxJoystickThread* m_thread;
+};
+
+#endif // _WX_UNIX_JOYSTICK_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/unix/mimetype.h
+// Purpose: classes and functions to manage MIME types
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 23.09.98
+// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence (part of wxExtra library)
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _MIMETYPE_IMPL_H
+#define _MIMETYPE_IMPL_H
+
+#include "wx/mimetype.h"
+
+#if wxUSE_MIMETYPE
+
+class wxMimeTypeCommands;
+
+WX_DEFINE_ARRAY_PTR(wxMimeTypeCommands *, wxMimeCommandsArray);
+
+// this is the real wxMimeTypesManager for Unix
+class WXDLLIMPEXP_BASE wxMimeTypesManagerImpl
+{
+public:
+ // ctor and dtor
+ wxMimeTypesManagerImpl();
+ virtual ~wxMimeTypesManagerImpl();
+
+ // load all data into memory - done when it is needed for the first time
+ void Initialize(int mailcapStyles = wxMAILCAP_ALL,
+ const wxString& extraDir = wxEmptyString);
+
+ // and delete the data here
+ void ClearData();
+
+ // implement containing class functions
+ wxFileType *GetFileTypeFromExtension(const wxString& ext);
+ wxFileType *GetFileTypeFromMimeType(const wxString& mimeType);
+
+ size_t EnumAllFileTypes(wxArrayString& mimetypes);
+
+ void AddFallback(const wxFileTypeInfo& filetype);
+
+ // add information about the given mimetype
+ void AddMimeTypeInfo(const wxString& mimetype,
+ const wxString& extensions,
+ const wxString& description);
+ void AddMailcapInfo(const wxString& strType,
+ const wxString& strOpenCmd,
+ const wxString& strPrintCmd,
+ const wxString& strTest,
+ const wxString& strDesc);
+
+ // add a new record to the user .mailcap/.mime.types files
+ wxFileType *Associate(const wxFileTypeInfo& ftInfo);
+ // remove association
+ bool Unassociate(wxFileType *ft);
+
+ // accessors
+ // get the string containing space separated extensions for the given
+ // file type
+ wxString GetExtension(size_t index) { return m_aExtensions[index]; }
+
+protected:
+ void InitIfNeeded();
+
+ wxArrayString m_aTypes, // MIME types
+ m_aDescriptions, // descriptions (just some text)
+ m_aExtensions, // space separated list of extensions
+ m_aIcons; // Icon filenames
+
+ // verb=command pairs for this file type
+ wxMimeCommandsArray m_aEntries;
+
+ // are we initialized?
+ bool m_initialized;
+
+ wxString GetCommand(const wxString &verb, size_t nIndex) const;
+
+ // Read XDG *.desktop file
+ void LoadXDGApp(const wxString& filename);
+ // Scan XDG directory
+ void LoadXDGAppsFilesFromDir(const wxString& dirname);
+
+ // Load XDG globs files
+ void LoadXDGGlobs(const wxString& filename);
+
+ // functions used to do associations
+ virtual int AddToMimeData(const wxString& strType,
+ const wxString& strIcon,
+ wxMimeTypeCommands *entry,
+ const wxArrayString& strExtensions,
+ const wxString& strDesc,
+ bool replaceExisting = true);
+ virtual bool DoAssociation(const wxString& strType,
+ const wxString& strIcon,
+ wxMimeTypeCommands *entry,
+ const wxArrayString& strExtensions,
+ const wxString& strDesc);
+
+ // give it access to m_aXXX variables
+ friend class WXDLLIMPEXP_FWD_BASE wxFileTypeImpl;
+};
+
+class WXDLLIMPEXP_BASE wxFileTypeImpl
+{
+public:
+ // initialization functions
+ // this is used to construct a list of mimetypes which match;
+ // if built with GetFileTypeFromMimetype index 0 has the exact match and
+ // index 1 the type / * match
+ // if built with GetFileTypeFromExtension, index 0 has the mimetype for
+ // the first extension found, index 1 for the second and so on
+
+ void Init(wxMimeTypesManagerImpl *manager, size_t index)
+ { m_manager = manager; m_index.Add(index); }
+
+ // accessors
+ bool GetExtensions(wxArrayString& extensions);
+ bool GetMimeType(wxString *mimeType) const
+ { *mimeType = m_manager->m_aTypes[m_index[0]]; return true; }
+ bool GetMimeTypes(wxArrayString& mimeTypes) const;
+ bool GetIcon(wxIconLocation *iconLoc) const;
+
+ bool GetDescription(wxString *desc) const
+ { *desc = m_manager->m_aDescriptions[m_index[0]]; return true; }
+
+ bool GetOpenCommand(wxString *openCmd,
+ const wxFileType::MessageParameters& params) const
+ {
+ *openCmd = GetExpandedCommand(wxT("open"), params);
+ return (! openCmd -> IsEmpty() );
+ }
+
+ bool GetPrintCommand(wxString *printCmd,
+ const wxFileType::MessageParameters& params) const
+ {
+ *printCmd = GetExpandedCommand(wxT("print"), params);
+ return (! printCmd -> IsEmpty() );
+ }
+
+ // return the number of commands defined for this file type, 0 if none
+ size_t GetAllCommands(wxArrayString *verbs, wxArrayString *commands,
+ const wxFileType::MessageParameters& params) const;
+
+
+ // remove the record for this file type
+ // probably a mistake to come here, use wxMimeTypesManager.Unassociate (ft) instead
+ bool Unassociate(wxFileType *ft)
+ {
+ return m_manager->Unassociate(ft);
+ }
+
+ // set an arbitrary command, ask confirmation if it already exists and
+ // overwriteprompt is TRUE
+ bool SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt = true);
+ bool SetDefaultIcon(const wxString& strIcon = wxEmptyString, int index = 0);
+
+private:
+ wxString
+ GetExpandedCommand(const wxString & verb,
+ const wxFileType::MessageParameters& params) const;
+
+ wxMimeTypesManagerImpl *m_manager;
+ wxArrayInt m_index; // in the wxMimeTypesManagerImpl arrays
+};
+
+#endif // wxUSE_MIMETYPE
+
+#endif // _MIMETYPE_IMPL_H
+
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/unix/pipe.h
+// Purpose: wxPipe class
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 24.06.2003 (extracted from src/unix/utilsunx.cpp)
+// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIX_PIPE_H_
+#define _WX_UNIX_PIPE_H_
+
+#include <unistd.h>
+#include <fcntl.h>
+
+#include "wx/log.h"
+#include "wx/intl.h"
+
+// ----------------------------------------------------------------------------
+// wxPipe: this class encapsulates pipe() system call
+// ----------------------------------------------------------------------------
+
+class wxPipe
+{
+public:
+ // the symbolic names for the pipe ends
+ enum Direction
+ {
+ Read,
+ Write
+ };
+
+ enum
+ {
+ INVALID_FD = -1
+ };
+
+ // default ctor doesn't do anything
+ wxPipe() { m_fds[Read] = m_fds[Write] = INVALID_FD; }
+
+ // create the pipe, return TRUE if ok, FALSE on error
+ bool Create()
+ {
+ if ( pipe(m_fds) == -1 )
+ {
+ wxLogSysError(wxGetTranslation("Pipe creation failed"));
+
+ return false;
+ }
+
+ return true;
+ }
+
+ // switch the given end of the pipe to non-blocking IO
+ bool MakeNonBlocking(Direction which)
+ {
+ const int flags = fcntl(m_fds[which], F_GETFL, 0);
+ if ( flags == -1 )
+ return false;
+
+ return fcntl(m_fds[which], F_SETFL, flags | O_NONBLOCK) == 0;
+ }
+
+ // return TRUE if we were created successfully
+ bool IsOk() const { return m_fds[Read] != INVALID_FD; }
+
+ // return the descriptor for one of the pipe ends
+ int operator[](Direction which) const { return m_fds[which]; }
+
+ // detach a descriptor, meaning that the pipe dtor won't close it, and
+ // return it
+ int Detach(Direction which)
+ {
+ int fd = m_fds[which];
+ m_fds[which] = INVALID_FD;
+
+ return fd;
+ }
+
+ // close the pipe descriptors
+ void Close()
+ {
+ for ( size_t n = 0; n < WXSIZEOF(m_fds); n++ )
+ {
+ if ( m_fds[n] != INVALID_FD )
+ {
+ close(m_fds[n]);
+ m_fds[n] = INVALID_FD;
+ }
+ }
+ }
+
+ // dtor closes the pipe descriptors
+ ~wxPipe() { Close(); }
+
+private:
+ int m_fds[2];
+};
+
+#endif // _WX_UNIX_PIPE_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/unix/sound.h
+// Purpose: wxSound class
+// Author: Julian Smart, Vaclav Slavik
+// Modified by:
+// Created: 25/10/98
+// Copyright: (c) Julian Smart, Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SOUND_H_
+#define _WX_SOUND_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_SOUND
+
+#include "wx/object.h"
+
+// ----------------------------------------------------------------------------
+// wxSound: simple audio playback class
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_ADV wxSoundBackend;
+class WXDLLIMPEXP_FWD_ADV wxSound;
+class WXDLLIMPEXP_FWD_BASE wxDynamicLibrary;
+
+/// Sound data, as loaded from .wav file:
+class WXDLLIMPEXP_ADV wxSoundData
+{
+public:
+ wxSoundData() : m_refCnt(1) {}
+ void IncRef();
+ void DecRef();
+
+ // .wav header information:
+ unsigned m_channels; // num of channels (mono:1, stereo:2)
+ unsigned m_samplingRate;
+ unsigned m_bitsPerSample; // if 8, then m_data contains unsigned 8bit
+ // samples (wxUint8), if 16 then signed 16bit
+ // (wxInt16)
+ unsigned m_samples; // length in samples:
+
+ // wave data:
+ size_t m_dataBytes;
+ wxUint8 *m_data; // m_dataBytes bytes of data
+
+private:
+ ~wxSoundData();
+ unsigned m_refCnt;
+ wxUint8 *m_dataWithHeader; // ditto, but prefixed with .wav header
+ friend class wxSound;
+};
+
+
+/// Simple sound class:
+class WXDLLIMPEXP_ADV wxSound : public wxSoundBase
+{
+public:
+ wxSound();
+ wxSound(const wxString& fileName, bool isResource = false);
+ wxSound(size_t size, const void* data);
+ virtual ~wxSound();
+
+ // Create from resource or file
+ bool Create(const wxString& fileName, bool isResource = false);
+ // Create from data
+ bool Create(size_t size, const void* data);
+
+ bool IsOk() const { return m_data != NULL; }
+
+ // Stop playing any sound
+ static void Stop();
+
+ // Returns true if a sound is being played
+ static bool IsPlaying();
+
+ // for internal use
+ static void UnloadBackend();
+
+protected:
+ bool DoPlay(unsigned flags) const;
+
+ static void EnsureBackend();
+ void Free();
+ bool LoadWAV(const void* data, size_t length, bool copyData);
+
+ static wxSoundBackend *ms_backend;
+#if wxUSE_LIBSDL && wxUSE_PLUGINS
+ // FIXME - temporary, until we have plugins architecture
+ static wxDynamicLibrary *ms_backendSDL;
+#endif
+
+private:
+ wxSoundData *m_data;
+};
+
+
+// ----------------------------------------------------------------------------
+// wxSoundBackend:
+// ----------------------------------------------------------------------------
+
+// This is interface to sound playing implementation. There are multiple
+// sound architectures in use on Unix platforms and wxWidgets can use several
+// of them for playback, depending on their availability at runtime; hence
+// the need for backends. This class is for use by wxWidgets and people writing
+// additional backends only, it is _not_ for use by applications!
+
+// Structure that holds playback status information
+struct wxSoundPlaybackStatus
+{
+ // playback is in progress
+ bool m_playing;
+ // main thread called wxSound::Stop()
+ bool m_stopRequested;
+};
+
+// Audio backend interface
+class WXDLLIMPEXP_ADV wxSoundBackend
+{
+public:
+ virtual ~wxSoundBackend() {}
+
+ // Returns the name of the backend (e.g. "Open Sound System")
+ virtual wxString GetName() const = 0;
+
+ // Returns priority (higher priority backends are tried first)
+ virtual int GetPriority() const = 0;
+
+ // Checks if the backend's audio system is available and the backend can
+ // be used for playback
+ virtual bool IsAvailable() const = 0;
+
+ // Returns true if the backend is capable of playing sound asynchronously.
+ // If false, then wxWidgets creates a playback thread and handles async
+ // playback, otherwise it is left up to the backend (will usually be more
+ // effective).
+ virtual bool HasNativeAsyncPlayback() const = 0;
+
+ // Plays the sound. flags are same flags as those passed to wxSound::Play.
+ // The function should periodically check the value of
+ // status->m_stopRequested and terminate if it is set to true (it may
+ // be modified by another thread)
+ virtual bool Play(wxSoundData *data, unsigned flags,
+ volatile wxSoundPlaybackStatus *status) = 0;
+
+ // Stops playback (if something is played).
+ virtual void Stop() = 0;
+
+ // Returns true if the backend is playing anything at the moment.
+ // (This method is never called for backends that don't support async
+ // playback.)
+ virtual bool IsPlaying() const = 0;
+};
+
+
+#endif // wxUSE_SOUND
+
+#endif // _WX_SOUND_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/unix/stackwalk.h
+// Purpose: declaration of wxStackWalker for Unix
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 2005-01-19
+// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIX_STACKWALK_H_
+#define _WX_UNIX_STACKWALK_H_
+
+// ----------------------------------------------------------------------------
+// wxStackFrame
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxStackFrame : public wxStackFrameBase
+{
+ friend class wxStackWalker;
+
+public:
+ // arguments are the stack depth of this frame, its address and the return
+ // value of backtrace_symbols() for it
+ //
+ // NB: we don't copy syminfo pointer so it should have lifetime at least as
+ // long as ours
+ wxStackFrame(size_t level = 0, void *address = NULL, const char *syminfo = NULL)
+ : wxStackFrameBase(level, address)
+ {
+ m_syminfo = syminfo;
+ }
+
+protected:
+ virtual void OnGetName();
+
+ // optimized for the 2 step initialization done by wxStackWalker
+ void Set(const wxString &name, const wxString &filename, const char* syminfo,
+ size_t level, size_t numLine, void *address)
+ {
+ m_level = level;
+ m_name = name;
+ m_filename = filename;
+ m_syminfo = syminfo;
+
+ m_line = numLine;
+ m_address = address;
+ }
+
+private:
+ const char *m_syminfo;
+};
+
+// ----------------------------------------------------------------------------
+// wxStackWalker
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxStackWalker : public wxStackWalkerBase
+{
+public:
+ // we need the full path to the program executable to be able to use
+ // addr2line, normally we can retrieve it from wxTheApp but if wxTheApp
+ // doesn't exist or doesn't have the correct value, the path may be given
+ // explicitly
+ wxStackWalker(const char *argv0 = NULL)
+ {
+ ms_exepath = wxString::FromAscii(argv0);
+ }
+
+ ~wxStackWalker()
+ {
+ FreeStack();
+ }
+
+ virtual void Walk(size_t skip = 1, size_t maxDepth = wxSTACKWALKER_MAX_DEPTH);
+#if wxUSE_ON_FATAL_EXCEPTION
+ virtual void WalkFromException(size_t maxDepth = wxSTACKWALKER_MAX_DEPTH) { Walk(2, maxDepth); }
+#endif // wxUSE_ON_FATAL_EXCEPTION
+
+ static const wxString& GetExePath() { return ms_exepath; }
+
+
+ // these two may be used to save the stack at some point (fast operation)
+ // and then process it later (slow operation)
+ void SaveStack(size_t maxDepth);
+ void ProcessFrames(size_t skip);
+ void FreeStack();
+
+private:
+ int InitFrames(wxStackFrame *arr, size_t n, void **addresses, char **syminfo);
+
+ static wxString ms_exepath;
+ static void *ms_addresses[];
+ static char **ms_symbols;
+ static int m_depth;
+};
+
+#endif // _WX_UNIX_STACKWALK_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/unix/stdpaths.h
+// Purpose: wxStandardPaths for Unix systems
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 2004-10-19
+// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIX_STDPATHS_H_
+#define _WX_UNIX_STDPATHS_H_
+
+// ----------------------------------------------------------------------------
+// wxStandardPaths
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase
+{
+public:
+ // tries to determine the installation prefix automatically (Linux only right
+ // now) and returns /usr/local if it failed
+ void DetectPrefix();
+
+ // set the program installation directory which is /usr/local by default
+ //
+ // under some systems (currently only Linux) the program directory can be
+ // determined automatically but for portable programs you should always set
+ // it explicitly
+ void SetInstallPrefix(const wxString& prefix);
+
+ // get the program installation prefix
+ //
+ // if the prefix had been previously by SetInstallPrefix, returns that
+ // value, otherwise calls DetectPrefix()
+ wxString GetInstallPrefix() const;
+
+
+ // implement base class pure virtuals
+ virtual wxString GetExecutablePath() const;
+ virtual wxString GetConfigDir() const;
+ virtual wxString GetUserConfigDir() const;
+ virtual wxString GetDataDir() const;
+ virtual wxString GetLocalDataDir() const;
+ virtual wxString GetUserDataDir() const;
+ virtual wxString GetPluginsDir() const;
+ virtual wxString GetLocalizedResourcesDir(const wxString& lang,
+ ResourceCat category) const;
+#ifndef __VMS
+ virtual wxString GetDocumentsDir() const;
+#endif
+
+protected:
+ // Ctor is protected, use wxStandardPaths::Get() instead of instantiating
+ // objects of this class directly.
+ wxStandardPaths() { }
+
+private:
+ wxString m_prefix;
+};
+
+#endif // _WX_UNIX_STDPATHS_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////
+// File: wx/unix/taskbarx11.h
+// Purpose: Defines wxTaskBarIcon class for most common X11 desktops
+// Author: Vaclav Slavik
+// Modified by:
+// Created: 04/04/2003
+// Copyright: (c) Vaclav Slavik, 2003
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIX_TASKBAR_H_
+#define _WX_UNIX_TASKBAR_H_
+
+class WXDLLIMPEXP_FWD_ADV wxTaskBarIconArea;
+
+class WXDLLIMPEXP_ADV wxTaskBarIcon: public wxTaskBarIconBase
+{
+public:
+ wxTaskBarIcon();
+ virtual ~wxTaskBarIcon();
+
+ // Accessors:
+ bool IsOk() const;
+ bool IsIconInstalled() const;
+
+ // Operations:
+ bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxEmptyString);
+ bool RemoveIcon();
+ bool PopupMenu(wxMenu *menu);
+
+protected:
+ wxTaskBarIconArea *m_iconWnd;
+
+private:
+ void OnDestroy(wxWindowDestroyEvent&);
+
+ DECLARE_DYNAMIC_CLASS(wxTaskBarIcon)
+};
+
+#endif // _WX_UNIX_TASKBAR_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/unix/tls.h
+// Purpose: Pthreads implementation of wxTlsValue<>
+// Author: Vadim Zeitlin
+// Created: 2008-08-08
+// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIX_TLS_H_
+#define _WX_UNIX_TLS_H_
+
+#include <pthread.h>
+
+// ----------------------------------------------------------------------------
+// wxTlsKey is a helper class encapsulating the TLS value index
+// ----------------------------------------------------------------------------
+
+class wxTlsKey
+{
+public:
+ // ctor allocates a new key and possibly registering a destructor function
+ // for it
+ wxTlsKey(wxTlsDestructorFunction destructor)
+ {
+ m_destructor = destructor;
+ if ( pthread_key_create(&m_key, destructor) != 0 )
+ m_key = 0;
+ }
+
+ // return true if the key was successfully allocated
+ bool IsOk() const { return m_key != 0; }
+
+ // get the key value, there is no error return
+ void *Get() const
+ {
+ return pthread_getspecific(m_key);
+ }
+
+ // change the key value, return true if ok
+ bool Set(void *value)
+ {
+ void *old = Get();
+ if ( old )
+ m_destructor(old);
+
+ return pthread_setspecific(m_key, value) == 0;
+ }
+
+ // free the key
+ ~wxTlsKey()
+ {
+ if ( IsOk() )
+ pthread_key_delete(m_key);
+ }
+
+private:
+ wxTlsDestructorFunction m_destructor;
+ pthread_key_t m_key;
+
+ wxDECLARE_NO_COPY_CLASS(wxTlsKey);
+};
+
+#endif // _WX_UNIX_TLS_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/unix/utilsx11.h
+// Purpose: Miscellaneous X11 functions
+// Author: Mattia Barbon, Vaclav Slavik, Vadim Zeitlin
+// Modified by:
+// Created: 25.03.02
+// Copyright: (c) wxWidgets team
+// (c) 2010 Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIX_UTILSX11_H_
+#define _WX_UNIX_UTILSX11_H_
+
+#include "wx/defs.h"
+#include "wx/gdicmn.h"
+
+#include <X11/Xlib.h>
+
+// NB: Content of this header is for wxWidgets' private use! It is not
+// part of public API and may be modified or even disappear in the future!
+
+#if defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXX11__)
+
+#if defined(__WXGTK__)
+typedef void WXDisplay;
+typedef void* WXWindow;
+#endif
+typedef unsigned long WXKeySym;
+
+int wxCharCodeXToWX(WXKeySym keySym);
+WXKeySym wxCharCodeWXToX(int id);
+
+class wxIconBundle;
+
+void wxSetIconsX11( WXDisplay* display, WXWindow window,
+ const wxIconBundle& ib );
+
+
+enum wxX11FullScreenMethod
+{
+ wxX11_FS_AUTODETECT = 0,
+ wxX11_FS_WMSPEC,
+ wxX11_FS_KDE,
+ wxX11_FS_GENERIC
+};
+
+wxX11FullScreenMethod wxGetFullScreenMethodX11(WXDisplay* display,
+ WXWindow rootWindow);
+
+void wxSetFullScreenStateX11(WXDisplay* display, WXWindow rootWindow,
+ WXWindow window, bool show, wxRect *origSize,
+ wxX11FullScreenMethod method);
+
+
+// Class wrapping X11 Display: it opens it in ctor and closes it in dtor.
+class wxX11Display
+{
+public:
+ wxX11Display() { m_dpy = XOpenDisplay(NULL); }
+ ~wxX11Display() { if ( m_dpy ) XCloseDisplay(m_dpy); }
+
+ operator Display *() const { return m_dpy; }
+
+ // Using DefaultRootWindow() with an object of wxX11Display class doesn't
+ // compile because it is a macro which tries to cast wxX11Display so
+ // provide a convenient helper.
+ Window DefaultRoot() const { return DefaultRootWindow(m_dpy); }
+
+private:
+ Display *m_dpy;
+
+ wxDECLARE_NO_COPY_CLASS(wxX11Display);
+};
+
+#endif // __WXMOTIF__, __WXGTK__, __WXX11__
+
+#endif // _WX_UNIX_UTILSX11_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/uri.h
+// Purpose: wxURI - Class for parsing URIs
+// Author: Ryan Norton
+// Vadim Zeitlin (UTF-8 URI support, many other changes)
+// Created: 07/01/2004
+// Copyright: (c) 2004 Ryan Norton
+// 2008 Vadim Zeitlin
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_URI_H_
+#define _WX_URI_H_
+
+#include "wx/defs.h"
+#include "wx/object.h"
+#include "wx/string.h"
+#include "wx/arrstr.h"
+
+// Host Type that the server component can be
+enum wxURIHostType
+{
+ wxURI_REGNAME, // Host is a normal register name (www.mysite.com etc.)
+ wxURI_IPV4ADDRESS, // Host is a version 4 ip address (192.168.1.100)
+ wxURI_IPV6ADDRESS, // Host is a version 6 ip address [aa:aa:aa:aa::aa:aa]:5050
+ wxURI_IPVFUTURE // Host is a future ip address (wxURI is unsure what kind)
+};
+
+// Component Flags
+enum wxURIFieldType
+{
+ wxURI_SCHEME = 1,
+ wxURI_USERINFO = 2,
+ wxURI_SERVER = 4,
+ wxURI_PORT = 8,
+ wxURI_PATH = 16,
+ wxURI_QUERY = 32,
+ wxURI_FRAGMENT = 64
+};
+
+// Miscellaneous other flags
+enum wxURIFlags
+{
+ wxURI_STRICT = 1
+};
+
+
+// Generic class for parsing URIs.
+//
+// See RFC 3986
+class WXDLLIMPEXP_BASE wxURI : public wxObject
+{
+public:
+ wxURI();
+ wxURI(const wxString& uri);
+
+ // default copy ctor, assignment operator and dtor are ok
+
+ bool Create(const wxString& uri);
+
+ wxURI& operator=(const wxString& string)
+ {
+ Create(string);
+ return *this;
+ }
+
+ bool operator==(const wxURI& uri) const;
+
+ // various accessors
+
+ bool HasScheme() const { return (m_fields & wxURI_SCHEME) != 0; }
+ bool HasUserInfo() const { return (m_fields & wxURI_USERINFO) != 0; }
+ bool HasServer() const { return (m_fields & wxURI_SERVER) != 0; }
+ bool HasPort() const { return (m_fields & wxURI_PORT) != 0; }
+ bool HasPath() const { return (m_fields & wxURI_PATH) != 0; }
+ bool HasQuery() const { return (m_fields & wxURI_QUERY) != 0; }
+ bool HasFragment() const { return (m_fields & wxURI_FRAGMENT) != 0; }
+
+ const wxString& GetScheme() const { return m_scheme; }
+ const wxString& GetPath() const { return m_path; }
+ const wxString& GetQuery() const { return m_query; }
+ const wxString& GetFragment() const { return m_fragment; }
+ const wxString& GetPort() const { return m_port; }
+ const wxString& GetUserInfo() const { return m_userinfo; }
+ const wxString& GetServer() const { return m_server; }
+ wxURIHostType GetHostType() const { return m_hostType; }
+
+ // these functions only work if the user information part of the URI is in
+ // the usual (but insecure and hence explicitly recommended against by the
+ // RFC) "user:password" form
+ wxString GetUser() const;
+ wxString GetPassword() const;
+
+
+ // combine all URI components into a single string
+ //
+ // BuildURI() returns the real URI suitable for use with network libraries,
+ // for example, while BuildUnescapedURI() returns a string suitable to be
+ // shown to the user.
+ wxString BuildURI() const { return DoBuildURI(&wxURI::Nothing); }
+ wxString BuildUnescapedURI() const { return DoBuildURI(&wxURI::Unescape); }
+
+ // the escaped URI should contain only ASCII characters, including possible
+ // escape sequences
+ static wxString Unescape(const wxString& escapedURI);
+
+
+ void Resolve(const wxURI& base, int flags = wxURI_STRICT);
+ bool IsReference() const;
+
+protected:
+ void Clear();
+
+ // common part of BuildURI() and BuildUnescapedURI()
+ wxString DoBuildURI(wxString (*funcDecode)(const wxString&)) const;
+
+ // function which returns its argument unmodified, this is used by
+ // BuildURI() to tell DoBuildURI() that nothing needs to be done with the
+ // URI components
+ static wxString Nothing(const wxString& value) { return value; }
+
+ bool Parse(const char* uri);
+
+ const char* ParseAuthority (const char* uri);
+ const char* ParseScheme (const char* uri);
+ const char* ParseUserInfo (const char* uri);
+ const char* ParseServer (const char* uri);
+ const char* ParsePort (const char* uri);
+ const char* ParsePath (const char* uri);
+ const char* ParseQuery (const char* uri);
+ const char* ParseFragment (const char* uri);
+
+
+ static bool ParseH16(const char*& uri);
+ static bool ParseIPv4address(const char*& uri);
+ static bool ParseIPv6address(const char*& uri);
+ static bool ParseIPvFuture(const char*& uri);
+
+ // should be called with i pointing to '%', returns the encoded character
+ // following it or -1 if invalid and advances i past it (so that it points
+ // to the last character consumed on return)
+ static int DecodeEscape(wxString::const_iterator& i);
+
+ // append next character pointer to by p to the string in an escaped form
+ // and advance p past it
+ //
+ // if the next character is '%' and it's followed by 2 hex digits, they are
+ // not escaped (again) by this function, this allows to keep (backwards-
+ // compatible) ambiguity about the input format to wxURI::Create(): it can
+ // be either already escaped or not
+ void AppendNextEscaped(wxString& s, const char *& p);
+
+ // convert hexadecimal digit to its value; return -1 if c isn't valid
+ static int CharToHex(char c);
+
+ // split an URI path string in its component segments (including empty and
+ // "." ones, no post-processing is done)
+ static wxArrayString SplitInSegments(const wxString& path);
+
+ // various URI grammar helpers
+ static bool IsUnreserved(char c);
+ static bool IsReserved(char c);
+ static bool IsGenDelim(char c);
+ static bool IsSubDelim(char c);
+ static bool IsHex(char c);
+ static bool IsAlpha(char c);
+ static bool IsDigit(char c);
+ static bool IsEndPath(char c);
+
+ wxString m_scheme;
+ wxString m_path;
+ wxString m_query;
+ wxString m_fragment;
+
+ wxString m_userinfo;
+ wxString m_server;
+ wxString m_port;
+
+ wxURIHostType m_hostType;
+
+ size_t m_fields;
+
+ DECLARE_DYNAMIC_CLASS(wxURI)
+};
+
+#endif // _WX_URI_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/url.h
+// Purpose: URL parser
+// Author: Guilhem Lavaux
+// Modified by: Ryan Norton
+// Created: 20/07/1997
+// Copyright: (c) 1997, 1998 Guilhem Lavaux
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_URL_H
+#define _WX_URL_H
+
+#include "wx/defs.h"
+
+#if wxUSE_URL
+
+#include "wx/uri.h"
+#include "wx/protocol/protocol.h"
+
+#if wxUSE_PROTOCOL_HTTP
+ #include "wx/protocol/http.h"
+#endif
+
+typedef enum {
+ wxURL_NOERR = 0,
+ wxURL_SNTXERR,
+ wxURL_NOPROTO,
+ wxURL_NOHOST,
+ wxURL_NOPATH,
+ wxURL_CONNERR,
+ wxURL_PROTOERR
+} wxURLError;
+
+#if wxUSE_URL_NATIVE
+class WXDLLIMPEXP_FWD_NET wxURL;
+
+class WXDLLIMPEXP_NET wxURLNativeImp : public wxObject
+{
+public:
+ virtual ~wxURLNativeImp() { }
+ virtual wxInputStream *GetInputStream(wxURL *owner) = 0;
+};
+#endif // wxUSE_URL_NATIVE
+
+class WXDLLIMPEXP_NET wxURL : public wxURI
+{
+public:
+ wxURL(const wxString& sUrl = wxEmptyString);
+ wxURL(const wxURI& uri);
+ wxURL(const wxURL& url);
+ virtual ~wxURL();
+
+ wxURL& operator = (const wxString& url);
+ wxURL& operator = (const wxURI& uri);
+ wxURL& operator = (const wxURL& url);
+
+ wxProtocol& GetProtocol() { return *m_protocol; }
+ wxURLError GetError() const { return m_error; }
+ wxString GetURL() const { return m_url; }
+
+ wxURLError SetURL(const wxString &url)
+ { *this = url; return m_error; }
+
+ bool IsOk() const
+ { return m_error == wxURL_NOERR; }
+
+ wxInputStream *GetInputStream();
+
+#if wxUSE_PROTOCOL_HTTP
+ static void SetDefaultProxy(const wxString& url_proxy);
+ void SetProxy(const wxString& url_proxy);
+#endif // wxUSE_PROTOCOL_HTTP
+
+protected:
+ static wxProtoInfo *ms_protocols;
+
+#if wxUSE_PROTOCOL_HTTP
+ static wxHTTP *ms_proxyDefault;
+ static bool ms_useDefaultProxy;
+ wxHTTP *m_proxy;
+ bool m_useProxy;
+#endif // wxUSE_PROTOCOL_HTTP
+
+#if wxUSE_URL_NATIVE
+ friend class wxURLNativeImp;
+ // pointer to a native URL implementation object
+ wxURLNativeImp *m_nativeImp;
+ // Creates on the heap and returns a native
+ // implementation object for the current platform.
+ static wxURLNativeImp *CreateNativeImpObject();
+#endif // wxUSE_URL_NATIVE
+
+ wxProtoInfo *m_protoinfo;
+ wxProtocol *m_protocol;
+
+ wxURLError m_error;
+ wxString m_url;
+
+ void Init(const wxString&);
+ bool ParseURL();
+ void CleanData();
+ void Free();
+ bool FetchProtocol();
+
+ friend class wxProtoInfo;
+ friend class wxURLModule;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxURL)
+};
+
+#endif // wxUSE_URL
+
+#endif // _WX_URL_H
+
--- /dev/null
+
+// Name: wx/ustring.h
+// Purpose: 32-bit string (UCS-4)
+// Author: Robert Roebling
+// Copyright: (c) Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_USTRING_H_
+#define _WX_USTRING_H_
+
+#include "wx/defs.h"
+#include "wx/string.h"
+
+#include <string>
+
+#if SIZEOF_WCHAR_T == 2
+typedef wxWCharBuffer wxU16CharBuffer;
+typedef wxScopedWCharBuffer wxScopedU16CharBuffer;
+#else
+typedef wxCharTypeBuffer<wxChar16> wxU16CharBuffer;
+typedef wxScopedCharTypeBuffer<wxChar16> wxScopedU16CharBuffer;
+#endif
+
+#if SIZEOF_WCHAR_T == 4
+typedef wxWCharBuffer wxU32CharBuffer;
+typedef wxScopedWCharBuffer wxScopedU32CharBuffer;
+#else
+typedef wxCharTypeBuffer<wxChar32> wxU32CharBuffer;
+typedef wxScopedCharTypeBuffer<wxChar32> wxScopedU32CharBuffer;
+#endif
+
+#ifdef __VISUALC__
+ // "non dll-interface class 'std::basic_string<wxChar32>' used as base
+ // interface for dll-interface class 'wxString'" -- this is OK in our case
+ // (and warning is unavoidable anyhow)
+ #pragma warning(push)
+ #pragma warning(disable:4275)
+#endif
+
+class WXDLLIMPEXP_BASE wxUString: public std::basic_string<wxChar32>
+{
+public:
+ wxUString() { }
+
+ wxUString( const wxChar32 *str ) { assign(str); }
+ wxUString( const wxScopedU32CharBuffer &buf ) { assign(buf); }
+
+ wxUString( const char *str ) { assign(str); }
+ wxUString( const wxScopedCharBuffer &buf ) { assign(buf); }
+ wxUString( const char *str, const wxMBConv &conv ) { assign(str,conv); }
+ wxUString( const wxScopedCharBuffer &buf, const wxMBConv &conv ) { assign(buf,conv); }
+
+ wxUString( const wxChar16 *str ) { assign(str); }
+ wxUString( const wxScopedU16CharBuffer &buf ) { assign(buf); }
+
+ wxUString( const wxCStrData *cstr ) { assign(cstr); }
+ wxUString( const wxString &str ) { assign(str); }
+
+ wxUString( char ch ) { assign(ch); }
+ wxUString( wxChar16 ch ) { assign(ch); }
+ wxUString( wxChar32 ch ) { assign(ch); }
+ wxUString( wxUniChar ch ) { assign(ch); }
+ wxUString( wxUniCharRef ch ) { assign(ch); }
+ wxUString( size_type n, char ch ) { assign(n,ch); }
+ wxUString( size_type n, wxChar16 ch ) { assign(n,ch); }
+ wxUString( size_type n, wxChar32 ch ) { assign(n,ch); }
+ wxUString( size_type n, wxUniChar ch ) { assign(n,ch); }
+ wxUString( size_type n, wxUniCharRef ch ) { assign(n,ch); }
+
+ // static construction
+
+ static wxUString FromAscii( const char *str, size_type n )
+ {
+ wxUString ret;
+ ret.assignFromAscii( str, n );
+ return ret;
+ }
+
+ static wxUString FromAscii( const char *str )
+ {
+ wxUString ret;
+ ret.assignFromAscii( str );
+ return ret;
+ }
+
+ static wxUString FromUTF8( const char *str, size_type n )
+ {
+ wxUString ret;
+ ret.assignFromUTF8( str, n );
+ return ret;
+ }
+
+ static wxUString FromUTF8( const char *str )
+ {
+ wxUString ret;
+ ret.assignFromUTF8( str );
+ return ret;
+ }
+
+ static wxUString FromUTF16( const wxChar16 *str, size_type n )
+ {
+ wxUString ret;
+ ret.assignFromUTF16( str, n );
+ return ret;
+ }
+
+ static wxUString FromUTF16( const wxChar16 *str )
+ {
+ wxUString ret;
+ ret.assignFromUTF16( str );
+ return ret;
+ }
+
+ // assign from encoding
+
+ wxUString &assignFromAscii( const char *str );
+ wxUString &assignFromAscii( const char *str, size_type n );
+ wxUString &assignFromUTF8( const char *str );
+ wxUString &assignFromUTF8( const char *str, size_type n );
+ wxUString &assignFromUTF16( const wxChar16* str );
+ wxUString &assignFromUTF16( const wxChar16* str, size_type n );
+ wxUString &assignFromCString( const char* str );
+ wxUString &assignFromCString( const char* str, const wxMBConv &conv );
+
+ // conversions
+
+ wxScopedCharBuffer utf8_str() const;
+ wxScopedU16CharBuffer utf16_str() const;
+
+#if SIZEOF_WCHAR_T == 2
+ wxScopedWCharBuffer wc_str() const
+ {
+ return utf16_str();
+ }
+#else
+ wchar_t *wc_str() const
+ {
+ return (wchar_t*) c_str();
+ }
+#endif
+
+ operator wxString() const
+ {
+#if wxUSE_UNICODE_UTF8
+ return wxString::FromUTF8( utf8_str() );
+#else
+#if SIZEOF_WCHAR_T == 2
+ return wxString( utf16_str() );
+#else
+ return wxString( c_str() );
+#endif
+#endif
+ }
+
+#if wxUSE_UNICODE_UTF8
+ wxScopedCharBuffer wx_str()
+ {
+ return utf8_str();
+ }
+#else
+#if SIZEOF_WCHAR_T == 2
+ wxScopedWCharBuffer wx_str()
+ {
+ return utf16_str();
+ }
+#else
+ const wchar_t* wx_str()
+ {
+ return c_str();
+ }
+#endif
+#endif
+
+ // assign
+
+ wxUString &assign( const wxChar32* str )
+ {
+ std::basic_string<wxChar32> *base = this;
+ return (wxUString &) base->assign( str );
+ }
+
+ wxUString &assign( const wxChar32* str, size_type n )
+ {
+ std::basic_string<wxChar32> *base = this;
+ return (wxUString &) base->assign( str, n );
+ }
+
+ wxUString &assign( const wxUString &str )
+ {
+ std::basic_string<wxChar32> *base = this;
+ return (wxUString &) base->assign( str );
+ }
+
+ wxUString &assign( const wxUString &str, size_type pos, size_type n )
+ {
+ std::basic_string<wxChar32> *base = this;
+ return (wxUString &) base->assign( str, pos, n );
+ }
+
+ // FIXME-VC6: VC 6.0 stl does not support all types of assign functions
+ #ifdef __VISUALC6__
+ wxUString &assign( wxChar32 ch )
+ {
+ wxChar32 chh[1];
+ chh[0] = ch;
+ std::basic_string<wxChar32> *base = this;
+ return (wxUString &)base->assign(chh);
+ }
+
+ wxUString &assign( size_type n, wxChar32 ch )
+ {
+ wxU32CharBuffer buffer(n);
+ wxChar32 *p = buffer.data();
+ size_type i;
+ for (i = 0; i < n; i++)
+ {
+ *p = ch;
+ p++;
+ }
+
+ std::basic_string<wxChar32> *base = this;
+ return (wxUString &)base->assign(buffer.data());
+ }
+ #else
+ wxUString &assign( wxChar32 ch )
+ {
+ std::basic_string<wxChar32> *base = this;
+ return (wxUString &) base->assign( (size_type) 1, ch );
+ }
+
+ wxUString &assign( size_type n, wxChar32 ch )
+ {
+ std::basic_string<wxChar32> *base = this;
+ return (wxUString &) base->assign( n, ch );
+ }
+ #endif // __VISUALC6__
+
+ wxUString &assign( const wxScopedU32CharBuffer &buf )
+ {
+ return assign( buf.data() );
+ }
+
+ wxUString &assign( const char *str )
+ {
+ return assignFromCString( str );
+ }
+
+ wxUString &assign( const wxScopedCharBuffer &buf )
+ {
+ return assignFromCString( buf.data() );
+ }
+
+ wxUString &assign( const char *str, const wxMBConv &conv )
+ {
+ return assignFromCString( str, conv );
+ }
+
+ wxUString &assign( const wxScopedCharBuffer &buf, const wxMBConv &conv )
+ {
+ return assignFromCString( buf.data(), conv );
+ }
+
+ wxUString &assign( const wxChar16 *str )
+ {
+ return assignFromUTF16( str );
+ }
+
+ wxUString &assign( const wxScopedU16CharBuffer &buf )
+ {
+ return assignFromUTF16( buf.data() );
+ }
+
+ wxUString &assign( const wxCStrData *cstr )
+ {
+#if SIZEOF_WCHAR_T == 2
+ return assignFromUTF16( cstr->AsWChar() );
+#else
+ return assign( cstr->AsWChar() );
+#endif
+ }
+
+ wxUString &assign( const wxString &str )
+ {
+#if wxUSE_UNICODE_UTF8
+ return assignFromUTF8( str.wx_str() );
+#else
+ #if SIZEOF_WCHAR_T == 2
+ return assignFromUTF16( str.wc_str() );
+ #else
+ return assign( str.wc_str() );
+ #endif
+#endif
+ }
+
+ wxUString &assign( char ch )
+ {
+ char buf[2];
+ buf[0] = ch;
+ buf[1] = 0;
+ return assignFromCString( buf );
+ }
+
+ wxUString &assign( size_type n, char ch )
+ {
+ wxCharBuffer buffer(n);
+ char *p = buffer.data();
+ size_type i;
+ for (i = 0; i < n; i++)
+ {
+ *p = ch;
+ p++;
+ }
+ return assignFromCString( buffer.data() );
+ }
+
+ wxUString &assign( wxChar16 ch )
+ {
+ wxChar16 buf[2];
+ buf[0] = ch;
+ buf[1] = 0;
+ return assignFromUTF16( buf );
+ }
+
+ wxUString &assign( size_type n, wxChar16 ch )
+ {
+ wxU16CharBuffer buffer(n);
+ wxChar16 *p = buffer.data();
+ size_type i;
+ for (i = 0; i < n; i++)
+ {
+ *p = ch;
+ p++;
+ }
+ return assignFromUTF16( buffer.data() );
+ }
+
+ wxUString &assign( wxUniChar ch )
+ {
+ return assign( (wxChar32) ch.GetValue() );
+ }
+
+ wxUString &assign( size_type n, wxUniChar ch )
+ {
+ return assign( n, (wxChar32) ch.GetValue() );
+ }
+
+ wxUString &assign( wxUniCharRef ch )
+ {
+ return assign( (wxChar32) ch.GetValue() );
+ }
+
+ wxUString &assign( size_type n, wxUniCharRef ch )
+ {
+ return assign( n, (wxChar32) ch.GetValue() );
+ }
+
+ // append [STL overload]
+
+ wxUString &append( const wxUString &s )
+ {
+ std::basic_string<wxChar32> *base = this;
+ return (wxUString &) base->append( s );
+ }
+
+ wxUString &append( const wxUString &s, size_type pos, size_type n )
+ {
+ std::basic_string<wxChar32> *base = this;
+ return (wxUString &) base->append( s, pos, n );
+ }
+
+ wxUString &append( const wxChar32* s )
+ {
+ std::basic_string<wxChar32> *base = this;
+ return (wxUString &) base->append( s );
+ }
+
+ wxUString &append( const wxChar32* s, size_type n )
+ {
+ std::basic_string<wxChar32> *base = this;
+ return (wxUString &) base->append( s, n );
+ }
+
+ // FIXME-VC6: VC 6.0 stl does not support all types of append functions
+ #ifdef __VISUALC6__
+ wxUString &append( size_type n, wxChar32 c )
+ {
+ wxU32CharBuffer buffer(n);
+ wxChar32 *p = buffer.data();
+ size_type i;
+ for (i = 0; i < n; i++)
+ {
+ *p = c;
+ p++;
+ }
+
+ std::basic_string<wxChar32> *base = this;
+ return (wxUString &) base->append(buffer.data());
+ }
+ #else
+ wxUString &append( size_type n, wxChar32 c )
+ {
+ std::basic_string<wxChar32> *base = this;
+ return (wxUString &) base->append( n, c );
+ }
+ #endif // __VISUALC6__
+
+ wxUString &append( wxChar32 c )
+ {
+ std::basic_string<wxChar32> *base = this;
+ return (wxUString &) base->append( 1, c );
+ }
+
+ // append [wx overload]
+
+ wxUString &append( const wxScopedU16CharBuffer &buf )
+ {
+ return append( buf.data() );
+ }
+
+ wxUString &append( const wxScopedU32CharBuffer &buf )
+ {
+ return append( buf.data() );
+ }
+
+ wxUString &append( const char *str )
+ {
+ return append( wxUString( str ) );
+ }
+
+ wxUString &append( const wxScopedCharBuffer &buf )
+ {
+ return append( wxUString( buf ) );
+ }
+
+ wxUString &append( const wxChar16 *str )
+ {
+ return append( wxUString( str ) );
+ }
+
+ wxUString &append( const wxString &str )
+ {
+ return append( wxUString( str ) );
+ }
+
+ wxUString &append( const wxCStrData *cstr )
+ {
+ return append( wxUString( cstr ) );
+ }
+
+ wxUString &append( char ch )
+ {
+ char buf[2];
+ buf[0] = ch;
+ buf[1] = 0;
+ return append( buf );
+ }
+
+ wxUString &append( wxChar16 ch )
+ {
+ wxChar16 buf[2];
+ buf[0] = ch;
+ buf[1] = 0;
+ return append( buf );
+ }
+
+ wxUString &append( wxUniChar ch )
+ {
+ return append( (size_type) 1, (wxChar32) ch.GetValue() );
+ }
+
+ wxUString &append( wxUniCharRef ch )
+ {
+ return append( (size_type) 1, (wxChar32) ch.GetValue() );
+ }
+
+
+ // insert [STL overloads]
+
+ wxUString &insert( size_type pos, const wxUString &s )
+ {
+ std::basic_string<wxChar32> *base = this;
+ return (wxUString &) base->insert( pos, s );
+ }
+
+ wxUString &insert( size_type pos, const wxUString &s, size_type pos1, size_type n )
+ {
+ std::basic_string<wxChar32> *base = this;
+ return (wxUString &) base->insert( pos, s, pos1, n );
+ }
+
+ wxUString &insert( size_type pos, const wxChar32 *s )
+ {
+ std::basic_string<wxChar32> *base = this;
+ return (wxUString &) base->insert( pos, s );
+ }
+
+ wxUString &insert( size_type pos, const wxChar32 *s, size_type n )
+ {
+ std::basic_string<wxChar32> *base = this;
+ return (wxUString &) base->insert( pos, s, n );
+ }
+
+ wxUString &insert( size_type pos, size_type n, wxChar32 c )
+ {
+ std::basic_string<wxChar32> *base = this;
+ return (wxUString &) base->insert( pos, n, c );
+ }
+
+
+ // insert [STL overloads]
+
+ wxUString &insert( size_type n, const char *s )
+ {
+ return insert( n, wxUString( s ) );
+ }
+
+ wxUString &insert( size_type n, const wxChar16 *s )
+ {
+ return insert( n, wxUString( s ) );
+ }
+
+ wxUString &insert( size_type n, const wxScopedCharBuffer &buf )
+ {
+ return insert( n, wxUString( buf ) );
+ }
+
+ wxUString &insert( size_type n, const wxScopedU16CharBuffer &buf )
+ {
+ return insert( n, wxUString( buf ) );
+ }
+
+ wxUString &insert( size_type n, const wxScopedU32CharBuffer &buf )
+ {
+ return insert( n, buf.data() );
+ }
+
+ wxUString &insert( size_type n, const wxString &s )
+ {
+ return insert( n, wxUString( s ) );
+ }
+
+ wxUString &insert( size_type n, const wxCStrData *cstr )
+ {
+ return insert( n, wxUString( cstr ) );
+ }
+
+ wxUString &insert( size_type n, char ch )
+ {
+ char buf[2];
+ buf[0] = ch;
+ buf[1] = 0;
+ return insert( n, buf );
+ }
+
+ wxUString &insert( size_type n, wchar_t ch )
+ {
+ wchar_t buf[2];
+ buf[0] = ch;
+ buf[1] = 0;
+ return insert( n, buf );
+ }
+
+ // insert iterator
+
+ iterator insert( iterator it, wxChar32 ch )
+ {
+ std::basic_string<wxChar32> *base = this;
+ return base->insert( it, ch );
+ }
+
+ void insert(iterator it, const_iterator first, const_iterator last)
+ {
+ std::basic_string<wxChar32> *base = this;
+ base->insert( it, first, last );
+ }
+
+
+ // operator =
+ wxUString& operator=(const wxString& s)
+ { return assign( s ); }
+ wxUString& operator=(const wxCStrData* s)
+ { return assign( s ); }
+ wxUString& operator=(const char *s)
+ { return assign( s ); }
+ wxUString& operator=(const wxChar16 *s)
+ { return assign( s ); }
+ wxUString& operator=(const wxChar32 *s)
+ { return assign( s ); }
+ wxUString& operator=(const wxScopedCharBuffer &s)
+ { return assign( s ); }
+ wxUString& operator=(const wxScopedU16CharBuffer &s)
+ { return assign( s ); }
+ wxUString& operator=(const wxScopedU32CharBuffer &s)
+ { return assign( s ); }
+ wxUString& operator=(const char ch)
+ { return assign( ch ); }
+ wxUString& operator=(const wxChar16 ch)
+ { return assign( ch ); }
+ wxUString& operator=(const wxChar32 ch)
+ { return assign( ch ); }
+ wxUString& operator=(const wxUniChar ch)
+ { return assign( ch ); }
+ wxUString& operator=(const wxUniCharRef ch)
+ { return assign( ch ); }
+
+ // operator +=
+ wxUString& operator+=(const wxUString& s)
+ { return append( s ); }
+ wxUString& operator+=(const wxString& s)
+ { return append( s ); }
+ wxUString& operator+=(const wxCStrData* s)
+ { return append( s ); }
+ wxUString& operator+=(const char *s)
+ { return append( s ); }
+ wxUString& operator+=(const wxChar16 *s)
+ { return append( s ); }
+ wxUString& operator+=(const wxChar32 *s)
+ { return append( s ); }
+ wxUString& operator+=(const wxScopedCharBuffer &s)
+ { return append( s ); }
+ wxUString& operator+=(const wxScopedU16CharBuffer &s)
+ { return append( s ); }
+ wxUString& operator+=(const wxScopedU32CharBuffer &s)
+ { return append( s ); }
+ wxUString& operator+=(const char ch)
+ { return append( ch ); }
+ wxUString& operator+=(const wxChar16 ch)
+ { return append( ch ); }
+ wxUString& operator+=(const wxChar32 ch)
+ { return append( ch ); }
+ wxUString& operator+=(const wxUniChar ch)
+ { return append( ch ); }
+ wxUString& operator+=(const wxUniCharRef ch)
+ { return append( ch ); }
+
+};
+
+#ifdef __VISUALC__
+ #pragma warning(pop)
+#endif
+
+inline wxUString operator+(const wxUString &s1, const wxUString &s2)
+ { wxUString ret( s1 ); ret.append( s2 ); return ret; }
+inline wxUString operator+(const wxUString &s1, const char *s2)
+ { return s1 + wxUString(s2); }
+inline wxUString operator+(const wxUString &s1, const wxString &s2)
+ { return s1 + wxUString(s2); }
+inline wxUString operator+(const wxUString &s1, const wxCStrData *s2)
+ { return s1 + wxUString(s2); }
+inline wxUString operator+(const wxUString &s1, const wxChar16* s2)
+ { return s1 + wxUString(s2); }
+inline wxUString operator+(const wxUString &s1, const wxChar32 *s2)
+ { return s1 + wxUString(s2); }
+inline wxUString operator+(const wxUString &s1, const wxScopedCharBuffer &s2)
+ { return s1 + wxUString(s2); }
+inline wxUString operator+(const wxUString &s1, const wxScopedU16CharBuffer &s2)
+ { return s1 + wxUString(s2); }
+inline wxUString operator+(const wxUString &s1, const wxScopedU32CharBuffer &s2)
+ { return s1 + wxUString(s2); }
+inline wxUString operator+(const wxUString &s1, char s2)
+ { return s1 + wxUString(s2); }
+inline wxUString operator+(const wxUString &s1, wxChar32 s2)
+ { wxUString ret( s1 ); ret.append( s2 ); return ret; }
+inline wxUString operator+(const wxUString &s1, wxChar16 s2)
+ { wxUString ret( s1 ); ret.append( (wxChar32) s2 ); return ret; }
+inline wxUString operator+(const wxUString &s1, wxUniChar s2)
+ { wxUString ret( s1 ); ret.append( (wxChar32) s2.GetValue() ); return ret; }
+inline wxUString operator+(const wxUString &s1, wxUniCharRef s2)
+ { wxUString ret( s1 ); ret.append( (wxChar32) s2.GetValue() ); return ret; }
+
+inline wxUString operator+(const char *s1, const wxUString &s2)
+ { return wxUString(s1) + s2; }
+inline wxUString operator+(const wxString &s1, const wxUString &s2)
+ { return wxUString(s1) + s2; }
+inline wxUString operator+(const wxCStrData *s1, const wxUString &s2)
+ { return wxUString(s1) + s2; }
+inline wxUString operator+(const wxChar16* s1, const wxUString &s2)
+ { return wxUString(s1) + s2; }
+inline wxUString operator+(const wxChar32 *s1, const wxUString &s2)
+ { return wxUString(s1) + s2; }
+inline wxUString operator+(const wxScopedCharBuffer &s1, const wxUString &s2)
+ { return wxUString(s1) + s2; }
+inline wxUString operator+(const wxScopedU16CharBuffer &s1, const wxUString &s2)
+ { return wxUString(s1) + s2; }
+inline wxUString operator+(const wxScopedU32CharBuffer &s1, const wxUString &s2)
+ { return wxUString(s1) + s2; }
+inline wxUString operator+(char s1, const wxUString &s2)
+ { return wxUString(s1) + s2; }
+inline wxUString operator+(wxChar32 s1, const wxUString &s2 )
+ { return wxUString(s1) + s2; }
+inline wxUString operator+(wxChar16 s1, const wxUString &s2)
+ { return wxUString(s1) + s2; }
+inline wxUString operator+(wxUniChar s1, const wxUString &s2)
+ { return wxUString(s1) + s2; }
+inline wxUString operator+(wxUniCharRef s1, const wxUString &s2)
+ { return wxUString(s1) + s2; }
+
+
+inline bool operator==(const wxUString& s1, const wxUString& s2)
+ { return s1.compare( s2 ) == 0; }
+inline bool operator!=(const wxUString& s1, const wxUString& s2)
+ { return s1.compare( s2 ) != 0; }
+inline bool operator< (const wxUString& s1, const wxUString& s2)
+ { return s1.compare( s2 ) < 0; }
+inline bool operator> (const wxUString& s1, const wxUString& s2)
+ { return s1.compare( s2 ) > 0; }
+inline bool operator<=(const wxUString& s1, const wxUString& s2)
+ { return s1.compare( s2 ) <= 0; }
+inline bool operator>=(const wxUString& s1, const wxUString& s2)
+ { return s1.compare( s2 ) >= 0; }
+
+#define wxUSTRING_COMP_OPERATORS( T ) \
+inline bool operator==(const wxUString& s1, T s2) \
+ { return s1.compare( wxUString(s2) ) == 0; } \
+inline bool operator!=(const wxUString& s1, T s2) \
+ { return s1.compare( wxUString(s2) ) != 0; } \
+inline bool operator< (const wxUString& s1, T s2) \
+ { return s1.compare( wxUString(s2) ) < 0; } \
+inline bool operator> (const wxUString& s1, T s2) \
+ { return s1.compare( wxUString(s2) ) > 0; } \
+inline bool operator<=(const wxUString& s1, T s2) \
+ { return s1.compare( wxUString(s2) ) <= 0; } \
+inline bool operator>=(const wxUString& s1, T s2) \
+ { return s1.compare( wxUString(s2) ) >= 0; } \
+\
+inline bool operator==(T s2, const wxUString& s1) \
+ { return s1.compare( wxUString(s2) ) == 0; } \
+inline bool operator!=(T s2, const wxUString& s1) \
+ { return s1.compare( wxUString(s2) ) != 0; } \
+inline bool operator< (T s2, const wxUString& s1) \
+ { return s1.compare( wxUString(s2) ) > 0; } \
+inline bool operator> (T s2, const wxUString& s1) \
+ { return s1.compare( wxUString(s2) ) < 0; } \
+inline bool operator<=(T s2, const wxUString& s1) \
+ { return s1.compare( wxUString(s2) ) >= 0; } \
+inline bool operator>=(T s2, const wxUString& s1) \
+ { return s1.compare( wxUString(s2) ) <= 0; }
+
+wxUSTRING_COMP_OPERATORS( const wxString & )
+wxUSTRING_COMP_OPERATORS( const char * )
+wxUSTRING_COMP_OPERATORS( const wxChar16 * )
+wxUSTRING_COMP_OPERATORS( const wxChar32 * )
+wxUSTRING_COMP_OPERATORS( const wxScopedCharBuffer & )
+wxUSTRING_COMP_OPERATORS( const wxScopedU16CharBuffer & )
+wxUSTRING_COMP_OPERATORS( const wxScopedU32CharBuffer & )
+wxUSTRING_COMP_OPERATORS( const wxCStrData * )
+
+#endif // _WX_USTRING_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/utils.h
+// Purpose: Miscellaneous utilities
+// Author: Julian Smart
+// Modified by:
+// Created: 29/01/98
+// Copyright: (c) 1998 Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UTILS_H_
+#define _WX_UTILS_H_
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/object.h"
+#include "wx/list.h"
+#include "wx/filefn.h"
+#include "wx/hashmap.h"
+#include "wx/versioninfo.h"
+#include "wx/meta/implicitconversion.h"
+
+#if wxUSE_GUI
+ #include "wx/gdicmn.h"
+ #include "wx/mousestate.h"
+#endif
+
+class WXDLLIMPEXP_FWD_BASE wxArrayString;
+class WXDLLIMPEXP_FWD_BASE wxArrayInt;
+
+// need this for wxGetDiskSpace() as we can't, unfortunately, forward declare
+// wxLongLong
+#include "wx/longlong.h"
+
+// needed for wxOperatingSystemId, wxLinuxDistributionInfo
+#include "wx/platinfo.h"
+
+#ifdef __WATCOMC__
+ #include <direct.h>
+#elif defined(__X__)
+ #include <dirent.h>
+ #include <unistd.h>
+#endif
+
+#include <stdio.h>
+
+// ----------------------------------------------------------------------------
+// Forward declaration
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_BASE wxProcess;
+class WXDLLIMPEXP_FWD_CORE wxFrame;
+class WXDLLIMPEXP_FWD_CORE wxWindow;
+class wxWindowList;
+class WXDLLIMPEXP_FWD_CORE wxEventLoop;
+
+// ----------------------------------------------------------------------------
+// Arithmetic functions
+// ----------------------------------------------------------------------------
+
+template<typename T1, typename T2>
+inline typename wxImplicitConversionType<T1,T2>::value
+wxMax(T1 a, T2 b)
+{
+ typedef typename wxImplicitConversionType<T1,T2>::value ResultType;
+
+ // Cast both operands to the same type before comparing them to avoid
+ // warnings about signed/unsigned comparisons from some compilers:
+ return static_cast<ResultType>(a) > static_cast<ResultType>(b) ? a : b;
+}
+
+template<typename T1, typename T2>
+inline typename wxImplicitConversionType<T1,T2>::value
+wxMin(T1 a, T2 b)
+{
+ typedef typename wxImplicitConversionType<T1,T2>::value ResultType;
+
+ return static_cast<ResultType>(a) < static_cast<ResultType>(b) ? a : b;
+}
+
+template<typename T1, typename T2, typename T3>
+inline typename wxImplicitConversionType3<T1,T2,T3>::value
+wxClip(T1 a, T2 b, T3 c)
+{
+ typedef typename wxImplicitConversionType3<T1,T2,T3>::value ResultType;
+
+ if ( static_cast<ResultType>(a) < static_cast<ResultType>(b) )
+ return b;
+
+ if ( static_cast<ResultType>(a) > static_cast<ResultType>(c) )
+ return c;
+
+ return a;
+}
+
+// ----------------------------------------------------------------------------
+// wxMemorySize
+// ----------------------------------------------------------------------------
+
+// wxGetFreeMemory can return huge amount of memory on 32-bit platforms as well
+// so to always use long long for its result type on all platforms which
+// support it
+#if wxUSE_LONGLONG
+ typedef wxLongLong wxMemorySize;
+#else
+ typedef long wxMemorySize;
+#endif
+
+// ----------------------------------------------------------------------------
+// String functions (deprecated, use wxString)
+// ----------------------------------------------------------------------------
+
+#if WXWIN_COMPATIBILITY_2_8
+// A shorter way of using strcmp
+wxDEPRECATED_INLINE(inline bool wxStringEq(const char *s1, const char *s2),
+ return wxCRT_StrcmpA(s1, s2) == 0; )
+
+#if wxUSE_UNICODE
+wxDEPRECATED_INLINE(inline bool wxStringEq(const wchar_t *s1, const wchar_t *s2),
+ return wxCRT_StrcmpW(s1, s2) == 0; )
+#endif // wxUSE_UNICODE
+
+#endif // WXWIN_COMPATIBILITY_2_8
+
+// ----------------------------------------------------------------------------
+// Miscellaneous functions
+// ----------------------------------------------------------------------------
+
+// Sound the bell
+WXDLLIMPEXP_CORE void wxBell();
+
+#if wxUSE_MSGDLG
+// Show wxWidgets information
+WXDLLIMPEXP_CORE void wxInfoMessageBox(wxWindow* parent);
+#endif // wxUSE_MSGDLG
+
+WXDLLIMPEXP_CORE wxVersionInfo wxGetLibraryVersionInfo();
+
+// Get OS description as a user-readable string
+WXDLLIMPEXP_BASE wxString wxGetOsDescription();
+
+// Get OS version
+WXDLLIMPEXP_BASE wxOperatingSystemId wxGetOsVersion(int *majorVsn = NULL,
+ int *minorVsn = NULL);
+
+// Get platform endianness
+WXDLLIMPEXP_BASE bool wxIsPlatformLittleEndian();
+
+// Get platform architecture
+WXDLLIMPEXP_BASE bool wxIsPlatform64Bit();
+
+#ifdef __LINUX__
+// Get linux-distro informations
+WXDLLIMPEXP_BASE wxLinuxDistributionInfo wxGetLinuxDistributionInfo();
+#endif
+
+// Return a string with the current date/time
+WXDLLIMPEXP_BASE wxString wxNow();
+
+// Return path where wxWidgets is installed (mostly useful in Unices)
+WXDLLIMPEXP_BASE const wxChar *wxGetInstallPrefix();
+// Return path to wxWin data (/usr/share/wx/%{version}) (Unices)
+WXDLLIMPEXP_BASE wxString wxGetDataDir();
+
+#if wxUSE_GUI
+
+// Get the state of a key (true if pressed, false if not)
+// This is generally most useful getting the state of
+// the modifier or toggle keys.
+WXDLLIMPEXP_CORE bool wxGetKeyState(wxKeyCode key);
+
+// Don't synthesize KeyUp events holding down a key and producing
+// KeyDown events with autorepeat. On by default and always on
+// in wxMSW.
+WXDLLIMPEXP_CORE bool wxSetDetectableAutoRepeat( bool flag );
+
+// Returns the current state of the mouse position, buttons and modifers
+WXDLLIMPEXP_CORE wxMouseState wxGetMouseState();
+
+#endif // wxUSE_GUI
+
+// ----------------------------------------------------------------------------
+// wxPlatform
+// ----------------------------------------------------------------------------
+
+/*
+ * Class to make it easier to specify platform-dependent values
+ *
+ * Examples:
+ * long val = wxPlatform::If(wxMac, 1).ElseIf(wxGTK, 2).ElseIf(stPDA, 5).Else(3);
+ * wxString strVal = wxPlatform::If(wxMac, wxT("Mac")).ElseIf(wxMSW, wxT("MSW")).Else(wxT("Other"));
+ *
+ * A custom platform symbol:
+ *
+ * #define stPDA 100
+ * #ifdef __WXWINCE__
+ * wxPlatform::AddPlatform(stPDA);
+ * #endif
+ *
+ * long windowStyle = wxCAPTION | (long) wxPlatform::IfNot(stPDA, wxRESIZE_BORDER);
+ *
+ */
+
+class WXDLLIMPEXP_BASE wxPlatform
+{
+public:
+ wxPlatform() { Init(); }
+ wxPlatform(const wxPlatform& platform) { Copy(platform); }
+ void operator = (const wxPlatform& platform) { if (&platform != this) Copy(platform); }
+ void Copy(const wxPlatform& platform);
+
+ // Specify an optional default value
+ wxPlatform(int defValue) { Init(); m_longValue = (long)defValue; }
+ wxPlatform(long defValue) { Init(); m_longValue = defValue; }
+ wxPlatform(const wxString& defValue) { Init(); m_stringValue = defValue; }
+ wxPlatform(double defValue) { Init(); m_doubleValue = defValue; }
+
+ static wxPlatform If(int platform, long value);
+ static wxPlatform IfNot(int platform, long value);
+ wxPlatform& ElseIf(int platform, long value);
+ wxPlatform& ElseIfNot(int platform, long value);
+ wxPlatform& Else(long value);
+
+ static wxPlatform If(int platform, int value) { return If(platform, (long)value); }
+ static wxPlatform IfNot(int platform, int value) { return IfNot(platform, (long)value); }
+ wxPlatform& ElseIf(int platform, int value) { return ElseIf(platform, (long) value); }
+ wxPlatform& ElseIfNot(int platform, int value) { return ElseIfNot(platform, (long) value); }
+ wxPlatform& Else(int value) { return Else((long) value); }
+
+ static wxPlatform If(int platform, double value);
+ static wxPlatform IfNot(int platform, double value);
+ wxPlatform& ElseIf(int platform, double value);
+ wxPlatform& ElseIfNot(int platform, double value);
+ wxPlatform& Else(double value);
+
+ static wxPlatform If(int platform, const wxString& value);
+ static wxPlatform IfNot(int platform, const wxString& value);
+ wxPlatform& ElseIf(int platform, const wxString& value);
+ wxPlatform& ElseIfNot(int platform, const wxString& value);
+ wxPlatform& Else(const wxString& value);
+
+ long GetInteger() const { return m_longValue; }
+ const wxString& GetString() const { return m_stringValue; }
+ double GetDouble() const { return m_doubleValue; }
+
+ operator int() const { return (int) GetInteger(); }
+ operator long() const { return GetInteger(); }
+ operator double() const { return GetDouble(); }
+ operator const wxString&() const { return GetString(); }
+
+ static void AddPlatform(int platform);
+ static bool Is(int platform);
+ static void ClearPlatforms();
+
+private:
+
+ void Init() { m_longValue = 0; m_doubleValue = 0.0; }
+
+ long m_longValue;
+ double m_doubleValue;
+ wxString m_stringValue;
+ static wxArrayInt* sm_customPlatforms;
+};
+
+/// Function for testing current platform
+inline bool wxPlatformIs(int platform) { return wxPlatform::Is(platform); }
+
+// ----------------------------------------------------------------------------
+// Window ID management
+// ----------------------------------------------------------------------------
+
+// Ensure subsequent IDs don't clash with this one
+WXDLLIMPEXP_BASE void wxRegisterId(int id);
+
+// Return the current ID
+WXDLLIMPEXP_BASE int wxGetCurrentId();
+
+// Generate a unique ID
+WXDLLIMPEXP_BASE int wxNewId();
+
+// ----------------------------------------------------------------------------
+// Various conversions
+// ----------------------------------------------------------------------------
+
+// Convert 2-digit hex number to decimal
+WXDLLIMPEXP_BASE int wxHexToDec(const wxString& buf);
+
+// Convert 2-digit hex number to decimal
+inline int wxHexToDec(const char* buf)
+{
+ int firstDigit, secondDigit;
+
+ if (buf[0] >= 'A')
+ firstDigit = buf[0] - 'A' + 10;
+ else
+ firstDigit = buf[0] - '0';
+
+ if (buf[1] >= 'A')
+ secondDigit = buf[1] - 'A' + 10;
+ else
+ secondDigit = buf[1] - '0';
+
+ return (firstDigit & 0xF) * 16 + (secondDigit & 0xF );
+}
+
+
+// Convert decimal integer to 2-character hex string
+WXDLLIMPEXP_BASE void wxDecToHex(int dec, wxChar *buf);
+WXDLLIMPEXP_BASE void wxDecToHex(int dec, char* ch1, char* ch2);
+WXDLLIMPEXP_BASE wxString wxDecToHex(int dec);
+
+// ----------------------------------------------------------------------------
+// Process management
+// ----------------------------------------------------------------------------
+
+// NB: for backwards compatibility reasons the values of wxEXEC_[A]SYNC *must*
+// be 0 and 1, don't change!
+
+enum
+{
+ // execute the process asynchronously
+ wxEXEC_ASYNC = 0,
+
+ // execute it synchronously, i.e. wait until it finishes
+ wxEXEC_SYNC = 1,
+
+ // under Windows, don't hide the child even if it's IO is redirected (this
+ // is done by default)
+ wxEXEC_SHOW_CONSOLE = 2,
+
+ // deprecated synonym for wxEXEC_SHOW_CONSOLE, use the new name as it's
+ // more clear
+ wxEXEC_NOHIDE = wxEXEC_SHOW_CONSOLE,
+
+ // under Unix, if the process is the group leader then passing wxKILL_CHILDREN to wxKill
+ // kills all children as well as pid
+ // under Windows (NT family only), sets the CREATE_NEW_PROCESS_GROUP flag,
+ // which allows to target Ctrl-Break signal to the spawned process.
+ // applies to console processes only.
+ wxEXEC_MAKE_GROUP_LEADER = 4,
+
+ // by default synchronous execution disables all program windows to avoid
+ // that the user interacts with the program while the child process is
+ // running, you can use this flag to prevent this from happening
+ wxEXEC_NODISABLE = 8,
+
+ // by default, the event loop is run while waiting for synchronous execution
+ // to complete and this flag can be used to simply block the main process
+ // until the child process finishes
+ wxEXEC_NOEVENTS = 16,
+
+ // under Windows, hide the console of the child process if it has one, even
+ // if its IO is not redirected
+ wxEXEC_HIDE_CONSOLE = 32,
+
+ // convenient synonym for flags given system()-like behaviour
+ wxEXEC_BLOCK = wxEXEC_SYNC | wxEXEC_NOEVENTS
+};
+
+// Map storing environment variables.
+typedef wxStringToStringHashMap wxEnvVariableHashMap;
+
+// Used to pass additional parameters for child process to wxExecute(). Could
+// be extended with other fields later.
+struct wxExecuteEnv
+{
+ wxString cwd; // If empty, CWD is not changed.
+ wxEnvVariableHashMap env; // If empty, environment is unchanged.
+};
+
+// Execute another program.
+//
+// If flags contain wxEXEC_SYNC, return -1 on failure and the exit code of the
+// process if everything was ok. Otherwise (i.e. if wxEXEC_ASYNC), return 0 on
+// failure and the PID of the launched process if ok.
+WXDLLIMPEXP_BASE long wxExecute(const wxString& command,
+ int flags = wxEXEC_ASYNC,
+ wxProcess *process = NULL,
+ const wxExecuteEnv *env = NULL);
+WXDLLIMPEXP_BASE long wxExecute(char **argv,
+ int flags = wxEXEC_ASYNC,
+ wxProcess *process = NULL,
+ const wxExecuteEnv *env = NULL);
+#if wxUSE_UNICODE
+WXDLLIMPEXP_BASE long wxExecute(wchar_t **argv,
+ int flags = wxEXEC_ASYNC,
+ wxProcess *process = NULL,
+ const wxExecuteEnv *env = NULL);
+#endif // wxUSE_UNICODE
+
+// execute the command capturing its output into an array line by line, this is
+// always synchronous
+WXDLLIMPEXP_BASE long wxExecute(const wxString& command,
+ wxArrayString& output,
+ int flags = 0,
+ const wxExecuteEnv *env = NULL);
+
+// also capture stderr (also synchronous)
+WXDLLIMPEXP_BASE long wxExecute(const wxString& command,
+ wxArrayString& output,
+ wxArrayString& error,
+ int flags = 0,
+ const wxExecuteEnv *env = NULL);
+
+#if defined(__WINDOWS__) && wxUSE_IPC
+// ask a DDE server to execute the DDE request with given parameters
+WXDLLIMPEXP_BASE bool wxExecuteDDE(const wxString& ddeServer,
+ const wxString& ddeTopic,
+ const wxString& ddeCommand);
+#endif // __WINDOWS__ && wxUSE_IPC
+
+enum wxSignal
+{
+ wxSIGNONE = 0, // verify if the process exists under Unix
+ wxSIGHUP,
+ wxSIGINT,
+ wxSIGQUIT,
+ wxSIGILL,
+ wxSIGTRAP,
+ wxSIGABRT,
+ wxSIGIOT = wxSIGABRT, // another name
+ wxSIGEMT,
+ wxSIGFPE,
+ wxSIGKILL,
+ wxSIGBUS,
+ wxSIGSEGV,
+ wxSIGSYS,
+ wxSIGPIPE,
+ wxSIGALRM,
+ wxSIGTERM
+
+ // further signals are different in meaning between different Unix systems
+};
+
+enum wxKillError
+{
+ wxKILL_OK, // no error
+ wxKILL_BAD_SIGNAL, // no such signal
+ wxKILL_ACCESS_DENIED, // permission denied
+ wxKILL_NO_PROCESS, // no such process
+ wxKILL_ERROR // another, unspecified error
+};
+
+enum wxKillFlags
+{
+ wxKILL_NOCHILDREN = 0, // don't kill children
+ wxKILL_CHILDREN = 1 // kill children
+};
+
+enum wxShutdownFlags
+{
+ wxSHUTDOWN_FORCE = 1,// can be combined with other flags (MSW-only)
+ wxSHUTDOWN_POWEROFF = 2,// power off the computer
+ wxSHUTDOWN_REBOOT = 4,// shutdown and reboot
+ wxSHUTDOWN_LOGOFF = 8 // close session (currently MSW-only)
+};
+
+// Shutdown or reboot the PC
+WXDLLIMPEXP_BASE bool wxShutdown(int flags = wxSHUTDOWN_POWEROFF);
+
+// send the given signal to the process (only NONE and KILL are supported under
+// Windows, all others mean TERM), return 0 if ok and -1 on error
+//
+// return detailed error in rc if not NULL
+WXDLLIMPEXP_BASE int wxKill(long pid,
+ wxSignal sig = wxSIGTERM,
+ wxKillError *rc = NULL,
+ int flags = wxKILL_NOCHILDREN);
+
+// Execute a command in an interactive shell window (always synchronously)
+// If no command then just the shell
+WXDLLIMPEXP_BASE bool wxShell(const wxString& command = wxEmptyString);
+
+// As wxShell(), but must give a (non interactive) command and its output will
+// be returned in output array
+WXDLLIMPEXP_BASE bool wxShell(const wxString& command, wxArrayString& output);
+
+// Sleep for nSecs seconds
+WXDLLIMPEXP_BASE void wxSleep(int nSecs);
+
+// Sleep for a given amount of milliseconds
+WXDLLIMPEXP_BASE void wxMilliSleep(unsigned long milliseconds);
+
+// Sleep for a given amount of microseconds
+WXDLLIMPEXP_BASE void wxMicroSleep(unsigned long microseconds);
+
+#if WXWIN_COMPATIBILITY_2_8
+// Sleep for a given amount of milliseconds (old, bad name), use wxMilliSleep
+wxDEPRECATED( WXDLLIMPEXP_BASE void wxUsleep(unsigned long milliseconds) );
+#endif
+
+// Get the process id of the current process
+WXDLLIMPEXP_BASE unsigned long wxGetProcessId();
+
+// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
+WXDLLIMPEXP_BASE wxMemorySize wxGetFreeMemory();
+
+#if wxUSE_ON_FATAL_EXCEPTION
+
+// should wxApp::OnFatalException() be called?
+WXDLLIMPEXP_BASE bool wxHandleFatalExceptions(bool doit = true);
+
+#endif // wxUSE_ON_FATAL_EXCEPTION
+
+// ----------------------------------------------------------------------------
+// Environment variables
+// ----------------------------------------------------------------------------
+
+// returns true if variable exists (value may be NULL if you just want to check
+// for this)
+WXDLLIMPEXP_BASE bool wxGetEnv(const wxString& var, wxString *value);
+
+// set the env var name to the given value, return true on success
+WXDLLIMPEXP_BASE bool wxSetEnv(const wxString& var, const wxString& value);
+
+// remove the env var from environment
+WXDLLIMPEXP_BASE bool wxUnsetEnv(const wxString& var);
+
+#if WXWIN_COMPATIBILITY_2_8
+inline bool wxSetEnv(const wxString& var, const char *value)
+ { return wxSetEnv(var, wxString(value)); }
+inline bool wxSetEnv(const wxString& var, const wchar_t *value)
+ { return wxSetEnv(var, wxString(value)); }
+template<typename T>
+inline bool wxSetEnv(const wxString& var, const wxScopedCharTypeBuffer<T>& value)
+ { return wxSetEnv(var, wxString(value)); }
+inline bool wxSetEnv(const wxString& var, const wxCStrData& value)
+ { return wxSetEnv(var, wxString(value)); }
+
+// this one is for passing NULL directly - don't use it, use wxUnsetEnv instead
+wxDEPRECATED( inline bool wxSetEnv(const wxString& var, int value) );
+inline bool wxSetEnv(const wxString& var, int value)
+{
+ wxASSERT_MSG( value == 0, "using non-NULL integer as string?" );
+
+ wxUnusedVar(value); // fix unused parameter warning in release build
+
+ return wxUnsetEnv(var);
+}
+#endif // WXWIN_COMPATIBILITY_2_8
+
+// Retrieve the complete environment by filling specified map.
+// Returns true on success or false if an error occurred.
+WXDLLIMPEXP_BASE bool wxGetEnvMap(wxEnvVariableHashMap *map);
+
+// ----------------------------------------------------------------------------
+// Network and username functions.
+// ----------------------------------------------------------------------------
+
+// NB: "char *" functions are deprecated, use wxString ones!
+
+// Get eMail address
+WXDLLIMPEXP_BASE bool wxGetEmailAddress(wxChar *buf, int maxSize);
+WXDLLIMPEXP_BASE wxString wxGetEmailAddress();
+
+// Get hostname.
+WXDLLIMPEXP_BASE bool wxGetHostName(wxChar *buf, int maxSize);
+WXDLLIMPEXP_BASE wxString wxGetHostName();
+
+// Get FQDN
+WXDLLIMPEXP_BASE wxString wxGetFullHostName();
+WXDLLIMPEXP_BASE bool wxGetFullHostName(wxChar *buf, int maxSize);
+
+// Get user ID e.g. jacs (this is known as login name under Unix)
+WXDLLIMPEXP_BASE bool wxGetUserId(wxChar *buf, int maxSize);
+WXDLLIMPEXP_BASE wxString wxGetUserId();
+
+// Get user name e.g. Julian Smart
+WXDLLIMPEXP_BASE bool wxGetUserName(wxChar *buf, int maxSize);
+WXDLLIMPEXP_BASE wxString wxGetUserName();
+
+// Get current Home dir and copy to dest (returns pstr->c_str())
+WXDLLIMPEXP_BASE wxString wxGetHomeDir();
+WXDLLIMPEXP_BASE const wxChar* wxGetHomeDir(wxString *pstr);
+
+// Get the user's (by default use the current user name) home dir,
+// return empty string on error
+WXDLLIMPEXP_BASE wxString wxGetUserHome(const wxString& user = wxEmptyString);
+
+
+#if wxUSE_LONGLONG
+ typedef wxLongLong wxDiskspaceSize_t;
+#else
+ typedef long wxDiskspaceSize_t;
+#endif
+
+// get number of total/free bytes on the disk where path belongs
+WXDLLIMPEXP_BASE bool wxGetDiskSpace(const wxString& path,
+ wxDiskspaceSize_t *pTotal = NULL,
+ wxDiskspaceSize_t *pFree = NULL);
+
+
+
+typedef int (*wxSortCallback)(const void* pItem1,
+ const void* pItem2,
+ const void* user_data);
+
+
+WXDLLIMPEXP_BASE void wxQsort(void* pbase, size_t total_elems,
+ size_t size, wxSortCallback cmp,
+ const void* user_data);
+
+
+#if wxUSE_GUI // GUI only things from now on
+
+// ----------------------------------------------------------------------------
+// Launch default browser
+// ----------------------------------------------------------------------------
+
+// flags for wxLaunchDefaultBrowser
+enum
+{
+ wxBROWSER_NEW_WINDOW = 0x01,
+ wxBROWSER_NOBUSYCURSOR = 0x02
+};
+
+// Launch url in the user's default internet browser
+WXDLLIMPEXP_CORE bool wxLaunchDefaultBrowser(const wxString& url, int flags = 0);
+
+// Launch document in the user's default application
+WXDLLIMPEXP_CORE bool wxLaunchDefaultApplication(const wxString& path, int flags = 0);
+
+// ----------------------------------------------------------------------------
+// Menu accelerators related things
+// ----------------------------------------------------------------------------
+
+// flags for wxStripMenuCodes
+enum
+{
+ // strip '&' characters
+ wxStrip_Mnemonics = 1,
+
+ // strip everything after '\t'
+ wxStrip_Accel = 2,
+
+ // strip everything (this is the default)
+ wxStrip_All = wxStrip_Mnemonics | wxStrip_Accel
+};
+
+// strip mnemonics and/or accelerators from the label
+WXDLLIMPEXP_CORE wxString
+wxStripMenuCodes(const wxString& str, int flags = wxStrip_All);
+
+#if WXWIN_COMPATIBILITY_2_6
+// obsolete and deprecated version, do not use, use the above overload instead
+wxDEPRECATED(
+ WXDLLIMPEXP_CORE wxChar* wxStripMenuCodes(const wxChar *in, wxChar *out = NULL)
+);
+
+#if wxUSE_ACCEL
+class WXDLLIMPEXP_FWD_CORE wxAcceleratorEntry;
+
+// use wxAcceleratorEntry::Create() or FromString() methods instead
+wxDEPRECATED(
+ WXDLLIMPEXP_CORE wxAcceleratorEntry *wxGetAccelFromString(const wxString& label)
+);
+#endif // wxUSE_ACCEL
+
+#endif // WXWIN_COMPATIBILITY_2_6
+
+// ----------------------------------------------------------------------------
+// Window search
+// ----------------------------------------------------------------------------
+
+// Returns menu item id or wxNOT_FOUND if none.
+WXDLLIMPEXP_CORE int wxFindMenuItemId(wxFrame *frame, const wxString& menuString, const wxString& itemString);
+
+// Find the wxWindow at the given point. wxGenericFindWindowAtPoint
+// is always present but may be less reliable than a native version.
+WXDLLIMPEXP_CORE wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
+WXDLLIMPEXP_CORE wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
+
+// NB: this function is obsolete, use wxWindow::FindWindowByLabel() instead
+//
+// Find the window/widget with the given title or label.
+// Pass a parent to begin the search from, or NULL to look through
+// all windows.
+WXDLLIMPEXP_CORE wxWindow* wxFindWindowByLabel(const wxString& title, wxWindow *parent = NULL);
+
+// NB: this function is obsolete, use wxWindow::FindWindowByName() instead
+//
+// Find window by name, and if that fails, by label.
+WXDLLIMPEXP_CORE wxWindow* wxFindWindowByName(const wxString& name, wxWindow *parent = NULL);
+
+// ----------------------------------------------------------------------------
+// Message/event queue helpers
+// ----------------------------------------------------------------------------
+
+// Yield to other apps/messages and disable user input
+WXDLLIMPEXP_CORE bool wxSafeYield(wxWindow *win = NULL, bool onlyIfNeeded = false);
+
+// Enable or disable input to all top level windows
+WXDLLIMPEXP_CORE void wxEnableTopLevelWindows(bool enable = true);
+
+// Check whether this window wants to process messages, e.g. Stop button
+// in long calculations.
+WXDLLIMPEXP_CORE bool wxCheckForInterrupt(wxWindow *wnd);
+
+// Consume all events until no more left
+WXDLLIMPEXP_CORE void wxFlushEvents();
+
+// a class which disables all windows (except, may be, the given one) in its
+// ctor and enables them back in its dtor
+class WXDLLIMPEXP_CORE wxWindowDisabler
+{
+public:
+ // this ctor conditionally disables all windows: if the argument is false,
+ // it doesn't do anything
+ wxWindowDisabler(bool disable = true);
+
+ // ctor disables all windows except winToSkip
+ wxWindowDisabler(wxWindow *winToSkip);
+
+ // dtor enables back all windows disabled by the ctor
+ ~wxWindowDisabler();
+
+private:
+ // disable all windows except the given one (used by both ctors)
+ void DoDisable(wxWindow *winToSkip = NULL);
+
+#if defined(__WXOSX__) && wxOSX_USE_COCOA
+ wxEventLoop* m_modalEventLoop;
+#endif
+ wxWindowList *m_winDisabled;
+ bool m_disabled;
+
+ wxDECLARE_NO_COPY_CLASS(wxWindowDisabler);
+};
+
+// ----------------------------------------------------------------------------
+// Cursors
+// ----------------------------------------------------------------------------
+
+// Set the cursor to the busy cursor for all windows
+WXDLLIMPEXP_CORE void wxBeginBusyCursor(const wxCursor *cursor = wxHOURGLASS_CURSOR);
+
+// Restore cursor to normal
+WXDLLIMPEXP_CORE void wxEndBusyCursor();
+
+// true if we're between the above two calls
+WXDLLIMPEXP_CORE bool wxIsBusy();
+
+// Convenience class so we can just create a wxBusyCursor object on the stack
+class WXDLLIMPEXP_CORE wxBusyCursor
+{
+public:
+ wxBusyCursor(const wxCursor* cursor = wxHOURGLASS_CURSOR)
+ { wxBeginBusyCursor(cursor); }
+ ~wxBusyCursor()
+ { wxEndBusyCursor(); }
+
+ // FIXME: These two methods are currently only implemented (and needed?)
+ // in wxGTK. BusyCursor handling should probably be moved to
+ // common code since the wxGTK and wxMSW implementations are very
+ // similar except for wxMSW using HCURSOR directly instead of
+ // wxCursor.. -- RL.
+ static const wxCursor &GetStoredCursor();
+ static const wxCursor GetBusyCursor();
+};
+
+void WXDLLIMPEXP_CORE wxGetMousePosition( int* x, int* y );
+
+// ----------------------------------------------------------------------------
+// X11 Display access
+// ----------------------------------------------------------------------------
+
+#if defined(__X__) || defined(__WXGTK__)
+
+#ifdef __WXGTK__
+ WXDLLIMPEXP_CORE void *wxGetDisplay();
+#endif
+
+#ifdef __X__
+ WXDLLIMPEXP_CORE WXDisplay *wxGetDisplay();
+ WXDLLIMPEXP_CORE bool wxSetDisplay(const wxString& display_name);
+ WXDLLIMPEXP_CORE wxString wxGetDisplayName();
+#endif // X or GTK+
+
+// use this function instead of the functions above in implementation code
+inline struct _XDisplay *wxGetX11Display()
+{
+ return (_XDisplay *)wxGetDisplay();
+}
+
+#endif // X11 || wxGTK
+
+#endif // wxUSE_GUI
+
+// ----------------------------------------------------------------------------
+// wxYield(): these functions are obsolete, please use wxApp methods instead!
+// ----------------------------------------------------------------------------
+
+// avoid redeclaring this function here if it had been already declated by
+// wx/app.h, this results in warnings from g++ with -Wredundant-decls
+#ifndef wx_YIELD_DECLARED
+#define wx_YIELD_DECLARED
+
+// Yield to other apps/messages
+WXDLLIMPEXP_CORE bool wxYield();
+
+#endif // wx_YIELD_DECLARED
+
+// Like wxYield, but fails silently if the yield is recursive.
+WXDLLIMPEXP_CORE bool wxYieldIfNeeded();
+
+// ----------------------------------------------------------------------------
+// Windows resources access
+// ----------------------------------------------------------------------------
+
+// Windows only: get user-defined resource from the .res file.
+#ifdef __WINDOWS__
+ // default resource type for wxLoadUserResource()
+ extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxUserResourceStr;
+
+ // Return the pointer to the resource data. This pointer is read-only, use
+ // the overload below if you need to modify the data.
+ //
+ // Notice that the resource type can be either a real string or an integer
+ // produced by MAKEINTRESOURCE(). In particular, any standard resource type,
+ // i.e any RT_XXX constant, could be passed here.
+ //
+ // Returns true on success, false on failure. Doesn't log an error message
+ // if the resource is not found (because this could be expected) but does
+ // log one if any other error occurs.
+ WXDLLIMPEXP_BASE bool
+ wxLoadUserResource(const void **outData,
+ size_t *outLen,
+ const wxString& resourceName,
+ const wxChar* resourceType = wxUserResourceStr,
+ WXHINSTANCE module = 0);
+
+ // This function allocates a new buffer and makes a copy of the resource
+ // data, remember to delete[] the buffer. And avoid using it entirely if
+ // the overload above can be used.
+ //
+ // Returns NULL on failure.
+ WXDLLIMPEXP_BASE char*
+ wxLoadUserResource(const wxString& resourceName,
+ const wxChar* resourceType = wxUserResourceStr,
+ int* pLen = NULL,
+ WXHINSTANCE module = 0);
+#endif // __WINDOWS__
+
+#endif
+ // _WX_UTILSH__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/valgen.h
+// Purpose: wxGenericValidator class
+// Author: Kevin Smith
+// Created: Jan 22 1999
+// Copyright: (c) 1999 Julian Smart (assigned from Kevin)
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_VALGENH__
+#define _WX_VALGENH__
+
+#include "wx/validate.h"
+
+#if wxUSE_VALIDATORS
+
+class WXDLLIMPEXP_FWD_BASE wxDateTime;
+class WXDLLIMPEXP_FWD_BASE wxFileName;
+
+// ----------------------------------------------------------------------------
+// wxGenericValidator performs data transfer between many standard controls and
+// variables of the type corresponding to their values.
+//
+// It doesn't do any validation so its name is a slight misnomer.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxGenericValidator: public wxValidator
+{
+public:
+ // Different constructors: each of them creates a validator which can only
+ // be used with some controls, the comments before each constructor
+ // indicate which ones:
+ // wxCheckBox, wxRadioButton, wx(Bitmap)ToggleButton
+ wxGenericValidator(bool* val);
+ // wxChoice, wxGauge, wxRadioBox, wxScrollBar, wxSlider, wxSpinButton
+ wxGenericValidator(int* val);
+ // wxComboBox, wxTextCtrl, wxButton, wxStaticText (read-only)
+ wxGenericValidator(wxString* val);
+ // wxListBox, wxCheckListBox
+ wxGenericValidator(wxArrayInt* val);
+#if wxUSE_DATETIME
+ // wxDatePickerCtrl
+ wxGenericValidator(wxDateTime* val);
+#endif // wxUSE_DATETIME
+ // wxTextCtrl
+ wxGenericValidator(wxFileName* val);
+ // wxTextCtrl
+ wxGenericValidator(float* val);
+ // wxTextCtrl
+ wxGenericValidator(double* val);
+
+ wxGenericValidator(const wxGenericValidator& copyFrom);
+
+ virtual ~wxGenericValidator(){}
+
+ // Make a clone of this validator (or return NULL) - currently necessary
+ // if you're passing a reference to a validator.
+ // Another possibility is to always pass a pointer to a new validator
+ // (so the calling code can use a copy constructor of the relevant class).
+ virtual wxObject *Clone() const { return new wxGenericValidator(*this); }
+ bool Copy(const wxGenericValidator& val);
+
+ // Called when the value in the window must be validated: this is not used
+ // by this class
+ virtual bool Validate(wxWindow * WXUNUSED(parent)) { return true; }
+
+ // Called to transfer data to the window
+ virtual bool TransferToWindow();
+
+ // Called to transfer data to the window
+ virtual bool TransferFromWindow();
+
+protected:
+ void Initialize();
+
+ bool* m_pBool;
+ int* m_pInt;
+ wxString* m_pString;
+ wxArrayInt* m_pArrayInt;
+#if wxUSE_DATETIME
+ wxDateTime* m_pDateTime;
+#endif // wxUSE_DATETIME
+ wxFileName* m_pFileName;
+ float* m_pFloat;
+ double* m_pDouble;
+
+private:
+ DECLARE_CLASS(wxGenericValidator)
+ wxDECLARE_NO_ASSIGN_CLASS(wxGenericValidator);
+};
+
+#endif // wxUSE_VALIDATORS
+
+#endif // _WX_VALGENH__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/validate.h
+// Purpose: wxValidator class
+// Author: Julian Smart
+// Modified by:
+// Created: 29/01/98
+// Copyright: (c) 1998 Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_VALIDATE_H_
+#define _WX_VALIDATE_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_VALIDATORS
+
+#include "wx/event.h"
+
+class WXDLLIMPEXP_FWD_CORE wxWindow;
+class WXDLLIMPEXP_FWD_CORE wxWindowBase;
+
+/*
+ A validator has up to three purposes:
+
+ 1) To validate the data in the window that's associated
+ with the validator.
+ 2) To transfer data to and from the window.
+ 3) To filter input, using its role as a wxEvtHandler
+ to intercept e.g. OnChar.
+
+ Note that wxValidator and derived classes use reference counting.
+*/
+
+class WXDLLIMPEXP_CORE wxValidator : public wxEvtHandler
+{
+public:
+ wxValidator();
+ wxValidator(const wxValidator& other)
+ : wxEvtHandler()
+ , m_validatorWindow(other.m_validatorWindow)
+ {
+ }
+ virtual ~wxValidator();
+
+ // Make a clone of this validator (or return NULL) - currently necessary
+ // if you're passing a reference to a validator.
+ // Another possibility is to always pass a pointer to a new validator
+ // (so the calling code can use a copy constructor of the relevant class).
+ virtual wxObject *Clone() const
+ { return NULL; }
+ bool Copy(const wxValidator& val)
+ { m_validatorWindow = val.m_validatorWindow; return true; }
+
+ // Called when the value in the window must be validated.
+ // This function can pop up an error message.
+ virtual bool Validate(wxWindow *WXUNUSED(parent)) { return false; }
+
+ // Called to transfer data to the window
+ virtual bool TransferToWindow() { return false; }
+
+ // Called to transfer data from the window
+ virtual bool TransferFromWindow() { return false; }
+
+ // accessors
+ wxWindow *GetWindow() const { return (wxWindow *)m_validatorWindow; }
+ void SetWindow(wxWindowBase *win) { m_validatorWindow = win; }
+
+ // validators beep by default if invalid key is pressed, this function
+ // allows to change this
+ static void SuppressBellOnError(bool suppress = true)
+ { ms_isSilent = suppress; }
+
+ // test if beep is currently disabled
+ static bool IsSilent() { return ms_isSilent; }
+
+ // this function is deprecated because it handled its parameter
+ // unnaturally: it disabled the bell when it was true, not false as could
+ // be expected; use SuppressBellOnError() instead
+#if WXWIN_COMPATIBILITY_2_8
+ static wxDEPRECATED_INLINE(
+ void SetBellOnError(bool doIt = true),
+ ms_isSilent = doIt;
+ )
+#endif
+
+protected:
+ wxWindowBase *m_validatorWindow;
+
+private:
+ static bool ms_isSilent;
+
+ DECLARE_DYNAMIC_CLASS(wxValidator)
+ wxDECLARE_NO_ASSIGN_CLASS(wxValidator);
+};
+
+extern WXDLLIMPEXP_DATA_CORE(const wxValidator) wxDefaultValidator;
+
+#define wxVALIDATOR_PARAM(val) val
+
+#else // !wxUSE_VALIDATORS
+ // wxWidgets is compiled without support for wxValidator, but we still
+ // want to be able to pass wxDefaultValidator to the functions which take
+ // a wxValidator parameter to avoid using "#if wxUSE_VALIDATORS"
+ // everywhere
+ class WXDLLIMPEXP_FWD_CORE wxValidator;
+ #define wxDefaultValidator (*reinterpret_cast<wxValidator*>(NULL))
+
+ // this macro allows to avoid warnings about unused parameters when
+ // wxUSE_VALIDATORS == 0
+ #define wxVALIDATOR_PARAM(val)
+#endif // wxUSE_VALIDATORS/!wxUSE_VALIDATORS
+
+#endif // _WX_VALIDATE_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/valnum.h
+// Purpose: Numeric validator classes.
+// Author: Vadim Zeitlin based on the submission of Fulvio Senore
+// Created: 2010-11-06
+// Copyright: (c) 2010 wxWidgets team
+// (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_VALNUM_H_
+#define _WX_VALNUM_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_VALIDATORS
+
+#include "wx/validate.h"
+
+#include <limits>
+
+// Bit masks used for numeric validator styles.
+enum wxNumValidatorStyle
+{
+ wxNUM_VAL_DEFAULT = 0x0,
+ wxNUM_VAL_THOUSANDS_SEPARATOR = 0x1,
+ wxNUM_VAL_ZERO_AS_BLANK = 0x2,
+ wxNUM_VAL_NO_TRAILING_ZEROES = 0x4
+};
+
+// ----------------------------------------------------------------------------
+// Base class for all numeric validators.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxNumValidatorBase : public wxValidator
+{
+public:
+ // Change the validator style. Usually it's specified during construction.
+ void SetStyle(int style) { m_style = style; }
+
+
+ // Override base class method to not do anything but always return success:
+ // we don't need this as we do our validation on the fly here.
+ virtual bool Validate(wxWindow * WXUNUSED(parent)) { return true; }
+
+protected:
+ wxNumValidatorBase(int style)
+ {
+ m_style = style;
+ }
+
+ wxNumValidatorBase(const wxNumValidatorBase& other) : wxValidator()
+ {
+ m_style = other.m_style;
+ }
+
+ bool HasFlag(wxNumValidatorStyle style) const
+ {
+ return (m_style & style) != 0;
+ }
+
+ // Get the text entry of the associated control. Normally shouldn't ever
+ // return NULL (and will assert if it does return it) but the caller should
+ // still test the return value for safety.
+ wxTextEntry *GetTextEntry() const;
+
+ // Convert wxNUM_VAL_THOUSANDS_SEPARATOR and wxNUM_VAL_NO_TRAILING_ZEROES
+ // bits of our style to the corresponding wxNumberFormatter::Style values.
+ int GetFormatFlags() const;
+
+ // Return true if pressing a '-' key is acceptable for the current control
+ // contents and insertion point. This is meant to be called from the
+ // derived class IsCharOk() implementation.
+ bool IsMinusOk(const wxString& val, int pos) const;
+
+ // Return the string which would result from inserting the given character
+ // at the specified position.
+ wxString GetValueAfterInsertingChar(wxString val, int pos, wxChar ch) const
+ {
+ val.insert(pos, ch);
+ return val;
+ }
+
+private:
+ // Check whether the specified character can be inserted in the control at
+ // the given position in the string representing the current controls
+ // contents.
+ //
+ // Notice that the base class checks for '-' itself so it's never passed to
+ // this function.
+ virtual bool IsCharOk(const wxString& val, int pos, wxChar ch) const = 0;
+
+ // NormalizeString the contents of the string if it's a valid number, return
+ // empty string otherwise.
+ virtual wxString NormalizeString(const wxString& s) const = 0;
+
+
+ // Event handlers.
+ void OnChar(wxKeyEvent& event);
+ void OnKillFocus(wxFocusEvent& event);
+
+
+ // Determine the current insertion point and text in the associated control.
+ void GetCurrentValueAndInsertionPoint(wxString& val, int& pos) const;
+
+
+ // Combination of wxVAL_NUM_XXX values.
+ int m_style;
+
+
+ wxDECLARE_EVENT_TABLE();
+
+ wxDECLARE_NO_ASSIGN_CLASS(wxNumValidatorBase);
+};
+
+namespace wxPrivate
+{
+
+// This is a helper class used by wxIntegerValidator and wxFloatingPointValidator
+// below that implements Transfer{To,From}Window() adapted to the type of the
+// variable.
+//
+// The template argument B is the name of the base class which must derive from
+// wxNumValidatorBase and define LongestValueType type and {To,As}String()
+// methods i.e. basically be one of wx{Integer,Number}ValidatorBase classes.
+//
+// The template argument T is just the type handled by the validator that will
+// inherit from this one.
+template <class B, typename T>
+class wxNumValidator : public B
+{
+public:
+ typedef B BaseValidator;
+ typedef T ValueType;
+
+ typedef typename BaseValidator::LongestValueType LongestValueType;
+
+ // FIXME-VC6: This compiler fails to compile the assert below with a
+ // nonsensical error C2248: "'LongestValueType' : cannot access protected
+ // typedef declared in class 'wxIntegerValidatorBase'" so just disable the
+ // check for it.
+#ifndef __VISUALC6__
+ wxCOMPILE_TIME_ASSERT
+ (
+ sizeof(ValueType) <= sizeof(LongestValueType),
+ UnsupportedType
+ );
+#endif // __VISUALC6__
+
+ void SetMin(ValueType min)
+ {
+ this->DoSetMin(min);
+ }
+
+ void SetMax(ValueType max)
+ {
+ this->DoSetMax(max);
+ }
+
+ void SetRange(ValueType min, ValueType max)
+ {
+ SetMin(min);
+ SetMax(max);
+ }
+
+ virtual bool TransferToWindow()
+ {
+ if ( m_value )
+ {
+ wxTextEntry * const control = BaseValidator::GetTextEntry();
+ if ( !control )
+ return false;
+
+ control->SetValue(NormalizeValue(*m_value));
+ }
+
+ return true;
+ }
+
+ virtual bool TransferFromWindow()
+ {
+ if ( m_value )
+ {
+ wxTextEntry * const control = BaseValidator::GetTextEntry();
+ if ( !control )
+ return false;
+
+ const wxString s(control->GetValue());
+ LongestValueType value;
+ if ( s.empty() && BaseValidator::HasFlag(wxNUM_VAL_ZERO_AS_BLANK) )
+ value = 0;
+ else if ( !BaseValidator::FromString(s, &value) )
+ return false;
+
+ if ( !this->IsInRange(value) )
+ return false;
+
+ *m_value = static_cast<ValueType>(value);
+ }
+
+ return true;
+ }
+
+protected:
+ wxNumValidator(ValueType *value, int style)
+ : BaseValidator(style),
+ m_value(value)
+ {
+ }
+
+ // Implement wxNumValidatorBase virtual method which is the same for
+ // both integer and floating point numbers.
+ virtual wxString NormalizeString(const wxString& s) const
+ {
+ LongestValueType value;
+ return BaseValidator::FromString(s, &value) ? NormalizeValue(value)
+ : wxString();
+ }
+
+private:
+ // Just a helper which is a common part of TransferToWindow() and
+ // NormalizeString(): returns string representation of a number honouring
+ // wxNUM_VAL_ZERO_AS_BLANK flag.
+ wxString NormalizeValue(LongestValueType value) const
+ {
+ wxString s;
+ if ( value != 0 || !BaseValidator::HasFlag(wxNUM_VAL_ZERO_AS_BLANK) )
+ s = this->ToString(value);
+
+ return s;
+ }
+
+
+ ValueType * const m_value;
+
+ wxDECLARE_NO_ASSIGN_CLASS(wxNumValidator);
+};
+
+} // namespace wxPrivate
+
+// ----------------------------------------------------------------------------
+// Validators for integer numbers.
+// ----------------------------------------------------------------------------
+
+// Base class for integer numbers validator. This class contains all non
+// type-dependent code of wxIntegerValidator<> and always works with values of
+// type LongestValueType. It is not meant to be used directly, please use
+// wxIntegerValidator<> only instead.
+class WXDLLIMPEXP_CORE wxIntegerValidatorBase : public wxNumValidatorBase
+{
+protected:
+ // Define the type we use here, it should be the maximal-sized integer type
+ // we support to make it possible to base wxIntegerValidator<> for any type
+ // on it.
+#ifdef wxLongLong_t
+ typedef wxLongLong_t LongestValueType;
+#else
+ typedef long LongestValueType;
+#endif
+
+ wxIntegerValidatorBase(int style)
+ : wxNumValidatorBase(style)
+ {
+ wxASSERT_MSG( !(style & wxNUM_VAL_NO_TRAILING_ZEROES),
+ "This style doesn't make sense for integers." );
+ }
+
+ wxIntegerValidatorBase(const wxIntegerValidatorBase& other)
+ : wxNumValidatorBase(other)
+ {
+ m_min = other.m_min;
+ m_max = other.m_max;
+ }
+
+ // Provide methods for wxNumValidator use.
+ wxString ToString(LongestValueType value) const;
+ static bool FromString(const wxString& s, LongestValueType *value);
+
+ void DoSetMin(LongestValueType min) { m_min = min; }
+ void DoSetMax(LongestValueType max) { m_max = max; }
+
+ bool IsInRange(LongestValueType value) const
+ {
+ return m_min <= value && value <= m_max;
+ }
+
+ // Implement wxNumValidatorBase pure virtual method.
+ virtual bool IsCharOk(const wxString& val, int pos, wxChar ch) const;
+
+private:
+ // Minimal and maximal values accepted (inclusive).
+ LongestValueType m_min, m_max;
+
+ wxDECLARE_NO_ASSIGN_CLASS(wxIntegerValidatorBase);
+};
+
+// Validator for integer numbers. It can actually work with any integer type
+// (short, int or long and long long if supported) and their unsigned versions
+// as well.
+template <typename T>
+class wxIntegerValidator
+ : public wxPrivate::wxNumValidator<wxIntegerValidatorBase, T>
+{
+public:
+ typedef T ValueType;
+
+ typedef
+ wxPrivate::wxNumValidator<wxIntegerValidatorBase, T> Base;
+
+ // Ctor for an integer validator.
+ //
+ // Sets the range appropriately for the type, including setting 0 as the
+ // minimal value for the unsigned types.
+ wxIntegerValidator(ValueType *value = NULL, int style = wxNUM_VAL_DEFAULT)
+ : Base(value, style)
+ {
+ this->DoSetMin(std::numeric_limits<ValueType>::min());
+ this->DoSetMax(std::numeric_limits<ValueType>::max());
+ }
+
+ virtual wxObject *Clone() const { return new wxIntegerValidator(*this); }
+
+private:
+ wxDECLARE_NO_ASSIGN_CLASS(wxIntegerValidator);
+};
+
+// Helper function for creating integer validators which allows to avoid
+// explicitly specifying the type as it deduces it from its parameter.
+template <typename T>
+inline wxIntegerValidator<T>
+wxMakeIntegerValidator(T *value, int style = wxNUM_VAL_DEFAULT)
+{
+ return wxIntegerValidator<T>(value, style);
+}
+
+// ----------------------------------------------------------------------------
+// Validators for floating point numbers.
+// ----------------------------------------------------------------------------
+
+// Similar to wxIntegerValidatorBase, this class is not meant to be used
+// directly, only wxFloatingPointValidator<> should be used in the user code.
+class WXDLLIMPEXP_CORE wxFloatingPointValidatorBase : public wxNumValidatorBase
+{
+public:
+ // Set precision i.e. the number of digits shown (and accepted on input)
+ // after the decimal point. By default this is set to the maximal precision
+ // supported by the type handled by the validator.
+ void SetPrecision(unsigned precision) { m_precision = precision; }
+
+protected:
+ // Notice that we can't use "long double" here because it's not supported
+ // by wxNumberFormatter yet, so restrict ourselves to just double (and
+ // float).
+ typedef double LongestValueType;
+
+ wxFloatingPointValidatorBase(int style)
+ : wxNumValidatorBase(style)
+ {
+ }
+
+ wxFloatingPointValidatorBase(const wxFloatingPointValidatorBase& other)
+ : wxNumValidatorBase(other)
+ {
+ m_precision = other.m_precision;
+
+ m_min = other.m_min;
+ m_max = other.m_max;
+ }
+
+ // Provide methods for wxNumValidator use.
+ wxString ToString(LongestValueType value) const;
+ static bool FromString(const wxString& s, LongestValueType *value);
+
+ void DoSetMin(LongestValueType min) { m_min = min; }
+ void DoSetMax(LongestValueType max) { m_max = max; }
+
+ bool IsInRange(LongestValueType value) const
+ {
+ return m_min <= value && value <= m_max;
+ }
+
+ // Implement wxNumValidatorBase pure virtual method.
+ virtual bool IsCharOk(const wxString& val, int pos, wxChar ch) const;
+
+private:
+ // Maximum number of decimals digits after the decimal separator.
+ unsigned m_precision;
+
+ // Minimal and maximal values accepted (inclusive).
+ LongestValueType m_min, m_max;
+
+ wxDECLARE_NO_ASSIGN_CLASS(wxFloatingPointValidatorBase);
+};
+
+// Validator for floating point numbers. It can be used with float, double or
+// long double values.
+template <typename T>
+class wxFloatingPointValidator
+ : public wxPrivate::wxNumValidator<wxFloatingPointValidatorBase, T>
+{
+public:
+ typedef T ValueType;
+ typedef wxPrivate::wxNumValidator<wxFloatingPointValidatorBase, T> Base;
+
+ // Ctor using implicit (maximal) precision for this type.
+ wxFloatingPointValidator(ValueType *value = NULL,
+ int style = wxNUM_VAL_DEFAULT)
+ : Base(value, style)
+ {
+ DoSetMinMax();
+
+ this->SetPrecision(std::numeric_limits<ValueType>::digits10);
+ }
+
+ // Ctor specifying an explicit precision.
+ wxFloatingPointValidator(int precision,
+ ValueType *value = NULL,
+ int style = wxNUM_VAL_DEFAULT)
+ : Base(value, style)
+ {
+ DoSetMinMax();
+
+ this->SetPrecision(precision);
+ }
+
+ virtual wxObject *Clone() const
+ {
+ return new wxFloatingPointValidator(*this);
+ }
+
+private:
+ void DoSetMinMax()
+ {
+ // NB: Do not use min(), it's not the smallest representable value for
+ // the floating point types but rather the smallest representable
+ // positive value.
+ this->DoSetMin(-std::numeric_limits<ValueType>::max());
+ this->DoSetMax( std::numeric_limits<ValueType>::max());
+ }
+};
+
+// Helper similar to wxMakeIntValidator().
+//
+// NB: Unfortunately we can't just have a wxMakeNumericValidator() which would
+// return either wxIntegerValidator<> or wxFloatingPointValidator<> so we
+// do need two different functions.
+template <typename T>
+inline wxFloatingPointValidator<T>
+wxMakeFloatingPointValidator(T *value, int style = wxNUM_VAL_DEFAULT)
+{
+ return wxFloatingPointValidator<T>(value, style);
+}
+
+template <typename T>
+inline wxFloatingPointValidator<T>
+wxMakeFloatingPointValidator(int precision, T *value, int style = wxNUM_VAL_DEFAULT)
+{
+ return wxFloatingPointValidator<T>(precision, value, style);
+}
+
+#endif // wxUSE_VALIDATORS
+
+#endif // _WX_VALNUM_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/valtext.h
+// Purpose: wxTextValidator class
+// Author: Julian Smart
+// Modified by: Francesco Montorsi
+// Created: 29/01/98
+// Copyright: (c) 1998 Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_VALTEXT_H_
+#define _WX_VALTEXT_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_VALIDATORS && (wxUSE_TEXTCTRL || wxUSE_COMBOBOX)
+
+class WXDLLIMPEXP_FWD_CORE wxTextEntry;
+
+#include "wx/validate.h"
+
+enum wxTextValidatorStyle
+{
+ wxFILTER_NONE = 0x0,
+ wxFILTER_EMPTY = 0x1,
+ wxFILTER_ASCII = 0x2,
+ wxFILTER_ALPHA = 0x4,
+ wxFILTER_ALPHANUMERIC = 0x8,
+ wxFILTER_DIGITS = 0x10,
+ wxFILTER_NUMERIC = 0x20,
+ wxFILTER_INCLUDE_LIST = 0x40,
+ wxFILTER_INCLUDE_CHAR_LIST = 0x80,
+ wxFILTER_EXCLUDE_LIST = 0x100,
+ wxFILTER_EXCLUDE_CHAR_LIST = 0x200
+};
+
+class WXDLLIMPEXP_CORE wxTextValidator: public wxValidator
+{
+public:
+ wxTextValidator(long style = wxFILTER_NONE, wxString *val = NULL);
+ wxTextValidator(const wxTextValidator& val);
+
+ virtual ~wxTextValidator(){}
+
+ // Make a clone of this validator (or return NULL) - currently necessary
+ // if you're passing a reference to a validator.
+ // Another possibility is to always pass a pointer to a new validator
+ // (so the calling code can use a copy constructor of the relevant class).
+ virtual wxObject *Clone() const { return new wxTextValidator(*this); }
+ bool Copy(const wxTextValidator& val);
+
+ // Called when the value in the window must be validated.
+ // This function can pop up an error message.
+ virtual bool Validate(wxWindow *parent);
+
+ // Called to transfer data to the window
+ virtual bool TransferToWindow();
+
+ // Called to transfer data from the window
+ virtual bool TransferFromWindow();
+
+ // Filter keystrokes
+ void OnChar(wxKeyEvent& event);
+
+ // ACCESSORS
+ inline long GetStyle() const { return m_validatorStyle; }
+ void SetStyle(long style);
+
+ wxTextEntry *GetTextEntry();
+
+ void SetCharIncludes(const wxString& chars);
+ void SetIncludes(const wxArrayString& includes) { m_includes = includes; }
+ inline wxArrayString& GetIncludes() { return m_includes; }
+
+ void SetCharExcludes(const wxString& chars);
+ void SetExcludes(const wxArrayString& excludes) { m_excludes = excludes; }
+ inline wxArrayString& GetExcludes() { return m_excludes; }
+
+ bool HasFlag(wxTextValidatorStyle style) const
+ { return (m_validatorStyle & style) != 0; }
+
+protected:
+
+ // returns true if all characters of the given string are present in m_includes
+ bool ContainsOnlyIncludedCharacters(const wxString& val) const;
+
+ // returns true if at least one character of the given string is present in m_excludes
+ bool ContainsExcludedCharacters(const wxString& val) const;
+
+ // returns the error message if the contents of 'val' are invalid
+ virtual wxString IsValid(const wxString& val) const;
+
+protected:
+ long m_validatorStyle;
+ wxString* m_stringValue;
+ wxArrayString m_includes;
+ wxArrayString m_excludes;
+
+private:
+ wxDECLARE_NO_ASSIGN_CLASS(wxTextValidator);
+ DECLARE_DYNAMIC_CLASS(wxTextValidator)
+ DECLARE_EVENT_TABLE()
+};
+
+#endif
+ // wxUSE_VALIDATORS && (wxUSE_TEXTCTRL || wxUSE_COMBOBOX)
+
+#endif // _WX_VALTEXT_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/variant.h
+// Purpose: wxVariant class, container for any type
+// Author: Julian Smart
+// Modified by:
+// Created: 10/09/98
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_VARIANT_H_
+#define _WX_VARIANT_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_VARIANT
+
+#include "wx/object.h"
+#include "wx/string.h"
+#include "wx/arrstr.h"
+#include "wx/list.h"
+#include "wx/cpp.h"
+#include "wx/longlong.h"
+
+#if wxUSE_DATETIME
+ #include "wx/datetime.h"
+#endif // wxUSE_DATETIME
+
+#include "wx/iosfwrap.h"
+
+class wxAny;
+
+/*
+ * wxVariantData stores the actual data in a wxVariant object,
+ * to allow it to store any type of data.
+ * Derive from this to provide custom data handling.
+ *
+ * NB: When you construct a wxVariantData, it will have refcount
+ * of one. Refcount will not be further increased when
+ * it is passed to wxVariant. This simulates old common
+ * scenario where wxVariant took ownership of wxVariantData
+ * passed to it.
+ * If you create wxVariantData for other reasons than passing
+ * it to wxVariant, technically you are not required to call
+ * DecRef() before deleting it.
+ *
+ * TODO: in order to replace wxPropertyValue, we would need
+ * to consider adding constructors that take pointers to C++ variables,
+ * or removing that functionality from the wxProperty library.
+ * Essentially wxPropertyValue takes on some of the wxValidator functionality
+ * by storing pointers and not just actual values, allowing update of C++ data
+ * to be handled automatically. Perhaps there's another way of doing this without
+ * overloading wxVariant with unnecessary functionality.
+ */
+
+class WXDLLIMPEXP_BASE wxVariantData : public wxObjectRefData
+{
+ friend class wxVariant;
+public:
+ wxVariantData() { }
+
+ // Override these to provide common functionality
+ virtual bool Eq(wxVariantData& data) const = 0;
+
+#if wxUSE_STD_IOSTREAM
+ virtual bool Write(wxSTD ostream& WXUNUSED(str)) const { return false; }
+#endif
+ virtual bool Write(wxString& WXUNUSED(str)) const { return false; }
+#if wxUSE_STD_IOSTREAM
+ virtual bool Read(wxSTD istream& WXUNUSED(str)) { return false; }
+#endif
+ virtual bool Read(wxString& WXUNUSED(str)) { return false; }
+ // What type is it? Return a string name.
+ virtual wxString GetType() const = 0;
+ // If it based on wxObject return the ClassInfo.
+ virtual wxClassInfo* GetValueClassInfo() { return NULL; }
+
+ // Implement this to make wxVariant::UnShare work. Returns
+ // a copy of the data.
+ virtual wxVariantData* Clone() const { return NULL; }
+
+#if wxUSE_ANY
+ // Converts value to wxAny, if possible. Return true if successful.
+ virtual bool GetAsAny(wxAny* WXUNUSED(any)) const { return false; }
+#endif
+
+protected:
+ // Protected dtor should make some incompatible code
+ // break more louder. That is, they should do data->DecRef()
+ // instead of delete data.
+ virtual ~wxVariantData() { }
+};
+
+/*
+ * wxVariant can store any kind of data, but has some basic types
+ * built in.
+ */
+
+class WXDLLIMPEXP_FWD_BASE wxVariant;
+
+WX_DECLARE_LIST_WITH_DECL(wxVariant, wxVariantList, class WXDLLIMPEXP_BASE);
+
+class WXDLLIMPEXP_BASE wxVariant: public wxObject
+{
+public:
+ wxVariant();
+
+ wxVariant(const wxVariant& variant);
+ wxVariant(wxVariantData* data, const wxString& name = wxEmptyString);
+#if wxUSE_ANY
+ wxVariant(const wxAny& any);
+#endif
+ virtual ~wxVariant();
+
+ // generic assignment
+ void operator= (const wxVariant& variant);
+
+ // Assignment using data, e.g.
+ // myVariant = new wxStringVariantData("hello");
+ void operator= (wxVariantData* variantData);
+
+ bool operator== (const wxVariant& variant) const;
+ bool operator!= (const wxVariant& variant) const;
+
+ // Sets/gets name
+ inline void SetName(const wxString& name) { m_name = name; }
+ inline const wxString& GetName() const { return m_name; }
+
+ // Tests whether there is data
+ bool IsNull() const;
+
+ // For compatibility with wxWidgets <= 2.6, this doesn't increase
+ // reference count.
+ wxVariantData* GetData() const
+ {
+ return (wxVariantData*) m_refData;
+ }
+ void SetData(wxVariantData* data) ;
+
+ // make a 'clone' of the object
+ void Ref(const wxVariant& clone) { wxObject::Ref(clone); }
+
+ // ensure that the data is exclusive to this variant, and not shared
+ bool Unshare();
+
+ // Make NULL (i.e. delete the data)
+ void MakeNull();
+
+ // Delete data and name
+ void Clear();
+
+ // Returns a string representing the type of the variant,
+ // e.g. "string", "bool", "stringlist", "list", "double", "long"
+ wxString GetType() const;
+
+ bool IsType(const wxString& type) const;
+ bool IsValueKindOf(const wxClassInfo* type) const;
+
+ // write contents to a string (e.g. for debugging)
+ wxString MakeString() const;
+
+#if wxUSE_ANY
+ wxAny GetAny() const;
+#endif
+
+ // double
+ wxVariant(double val, const wxString& name = wxEmptyString);
+ bool operator== (double value) const;
+ bool operator!= (double value) const;
+ void operator= (double value) ;
+ inline operator double () const { return GetDouble(); }
+ inline double GetReal() const { return GetDouble(); }
+ double GetDouble() const;
+
+ // long
+ wxVariant(long val, const wxString& name = wxEmptyString);
+ wxVariant(int val, const wxString& name = wxEmptyString);
+ wxVariant(short val, const wxString& name = wxEmptyString);
+ bool operator== (long value) const;
+ bool operator!= (long value) const;
+ void operator= (long value) ;
+ inline operator long () const { return GetLong(); }
+ inline long GetInteger() const { return GetLong(); }
+ long GetLong() const;
+
+ // bool
+ wxVariant(bool val, const wxString& name = wxEmptyString);
+ bool operator== (bool value) const;
+ bool operator!= (bool value) const;
+ void operator= (bool value) ;
+ inline operator bool () const { return GetBool(); }
+ bool GetBool() const ;
+
+ // wxDateTime
+#if wxUSE_DATETIME
+ wxVariant(const wxDateTime& val, const wxString& name = wxEmptyString);
+ bool operator== (const wxDateTime& value) const;
+ bool operator!= (const wxDateTime& value) const;
+ void operator= (const wxDateTime& value) ;
+ inline operator wxDateTime () const { return GetDateTime(); }
+ wxDateTime GetDateTime() const;
+#endif
+
+ // wxString
+ wxVariant(const wxString& val, const wxString& name = wxEmptyString);
+ // these overloads are necessary to prevent the compiler from using bool
+ // version instead of wxString one:
+ wxVariant(const char* val, const wxString& name = wxEmptyString);
+ wxVariant(const wchar_t* val, const wxString& name = wxEmptyString);
+ wxVariant(const wxCStrData& val, const wxString& name = wxEmptyString);
+ wxVariant(const wxScopedCharBuffer& val, const wxString& name = wxEmptyString);
+ wxVariant(const wxScopedWCharBuffer& val, const wxString& name = wxEmptyString);
+
+ bool operator== (const wxString& value) const;
+ bool operator!= (const wxString& value) const;
+ wxVariant& operator=(const wxString& value);
+ // these overloads are necessary to prevent the compiler from using bool
+ // version instead of wxString one:
+ wxVariant& operator=(const char* value)
+ { return *this = wxString(value); }
+ wxVariant& operator=(const wchar_t* value)
+ { return *this = wxString(value); }
+ wxVariant& operator=(const wxCStrData& value)
+ { return *this = value.AsString(); }
+ template<typename T>
+ wxVariant& operator=(const wxScopedCharTypeBuffer<T>& value)
+ { return *this = value.data(); }
+
+ inline operator wxString () const { return MakeString(); }
+ wxString GetString() const;
+
+#if wxUSE_STD_STRING
+ wxVariant(const std::string& val, const wxString& name = wxEmptyString);
+ bool operator==(const std::string& value) const
+ { return operator==(wxString(value)); }
+ bool operator!=(const std::string& value) const
+ { return operator!=(wxString(value)); }
+ wxVariant& operator=(const std::string& value)
+ { return operator=(wxString(value)); }
+ operator std::string() const { return (operator wxString()).ToStdString(); }
+
+ wxVariant(const wxStdWideString& val, const wxString& name = wxEmptyString);
+ bool operator==(const wxStdWideString& value) const
+ { return operator==(wxString(value)); }
+ bool operator!=(const wxStdWideString& value) const
+ { return operator!=(wxString(value)); }
+ wxVariant& operator=(const wxStdWideString& value)
+ { return operator=(wxString(value)); }
+ operator wxStdWideString() const { return (operator wxString()).ToStdWstring(); }
+#endif // wxUSE_STD_STRING
+
+ // wxUniChar
+ wxVariant(const wxUniChar& val, const wxString& name = wxEmptyString);
+ wxVariant(const wxUniCharRef& val, const wxString& name = wxEmptyString);
+ wxVariant(char val, const wxString& name = wxEmptyString);
+ wxVariant(wchar_t val, const wxString& name = wxEmptyString);
+ bool operator==(const wxUniChar& value) const;
+ bool operator==(const wxUniCharRef& value) const { return *this == wxUniChar(value); }
+ bool operator==(char value) const { return *this == wxUniChar(value); }
+ bool operator==(wchar_t value) const { return *this == wxUniChar(value); }
+ bool operator!=(const wxUniChar& value) const { return !(*this == value); }
+ bool operator!=(const wxUniCharRef& value) const { return !(*this == value); }
+ bool operator!=(char value) const { return !(*this == value); }
+ bool operator!=(wchar_t value) const { return !(*this == value); }
+ wxVariant& operator=(const wxUniChar& value);
+ wxVariant& operator=(const wxUniCharRef& value) { return *this = wxUniChar(value); }
+ wxVariant& operator=(char value) { return *this = wxUniChar(value); }
+ wxVariant& operator=(wchar_t value) { return *this = wxUniChar(value); }
+ operator wxUniChar() const { return GetChar(); }
+ operator char() const { return GetChar(); }
+ operator wchar_t() const { return GetChar(); }
+ wxUniChar GetChar() const;
+
+ // wxArrayString
+ wxVariant(const wxArrayString& val, const wxString& name = wxEmptyString);
+ bool operator== (const wxArrayString& value) const;
+ bool operator!= (const wxArrayString& value) const;
+ void operator= (const wxArrayString& value);
+ operator wxArrayString () const { return GetArrayString(); }
+ wxArrayString GetArrayString() const;
+
+ // void*
+ wxVariant(void* ptr, const wxString& name = wxEmptyString);
+ bool operator== (void* value) const;
+ bool operator!= (void* value) const;
+ void operator= (void* value);
+ operator void* () const { return GetVoidPtr(); }
+ void* GetVoidPtr() const;
+
+ // wxObject*
+ wxVariant(wxObject* ptr, const wxString& name = wxEmptyString);
+ bool operator== (wxObject* value) const;
+ bool operator!= (wxObject* value) const;
+ void operator= (wxObject* value);
+ wxObject* GetWxObjectPtr() const;
+
+#if wxUSE_LONGLONG
+ // wxLongLong
+ wxVariant(wxLongLong, const wxString& name = wxEmptyString);
+ bool operator==(wxLongLong value) const;
+ bool operator!=(wxLongLong value) const;
+ void operator=(wxLongLong value);
+ operator wxLongLong() const { return GetLongLong(); }
+ wxLongLong GetLongLong() const;
+
+ // wxULongLong
+ wxVariant(wxULongLong, const wxString& name = wxEmptyString);
+ bool operator==(wxULongLong value) const;
+ bool operator!=(wxULongLong value) const;
+ void operator=(wxULongLong value);
+ operator wxULongLong() const { return GetULongLong(); }
+ wxULongLong GetULongLong() const;
+#endif
+
+ // ------------------------------
+ // list operations
+ // ------------------------------
+
+ wxVariant(const wxVariantList& val, const wxString& name = wxEmptyString); // List of variants
+ bool operator== (const wxVariantList& value) const;
+ bool operator!= (const wxVariantList& value) const;
+ void operator= (const wxVariantList& value) ;
+ // Treat a list variant as an array
+ wxVariant operator[] (size_t idx) const;
+ wxVariant& operator[] (size_t idx) ;
+ wxVariantList& GetList() const ;
+
+ // Return the number of elements in a list
+ size_t GetCount() const;
+
+ // Make empty list
+ void NullList();
+
+ // Append to list
+ void Append(const wxVariant& value);
+
+ // Insert at front of list
+ void Insert(const wxVariant& value);
+
+ // Returns true if the variant is a member of the list
+ bool Member(const wxVariant& value) const;
+
+ // Deletes the nth element of the list
+ bool Delete(size_t item);
+
+ // Clear list
+ void ClearList();
+
+public:
+ // Type conversion
+ bool Convert(long* value) const;
+ bool Convert(bool* value) const;
+ bool Convert(double* value) const;
+ bool Convert(wxString* value) const;
+ bool Convert(wxUniChar* value) const;
+ bool Convert(char* value) const;
+ bool Convert(wchar_t* value) const;
+#if wxUSE_DATETIME
+ bool Convert(wxDateTime* value) const;
+#endif // wxUSE_DATETIME
+#if wxUSE_LONGLONG
+ bool Convert(wxLongLong* value) const;
+ bool Convert(wxULongLong* value) const;
+ #ifdef wxLongLong_t
+ bool Convert(wxLongLong_t* value) const
+ {
+ wxLongLong temp;
+ if ( !Convert(&temp) )
+ return false;
+ *value = temp.GetValue();
+ return true;
+ }
+ bool Convert(wxULongLong_t* value) const
+ {
+ wxULongLong temp;
+ if ( !Convert(&temp) )
+ return false;
+ *value = temp.GetValue();
+ return true;
+ }
+ #endif // wxLongLong_t
+#endif // wxUSE_LONGLONG
+
+// Attributes
+protected:
+ virtual wxObjectRefData *CreateRefData() const;
+ virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
+
+ wxString m_name;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxVariant)
+};
+
+
+//
+// wxVariant <-> wxAny conversion code
+//
+#if wxUSE_ANY
+
+#include "wx/any.h"
+
+// In order to convert wxAny to wxVariant, we need to be able to associate
+// wxAnyValueType with a wxVariantData factory function.
+typedef wxVariantData* (*wxVariantDataFactory)(const wxAny& any);
+
+// Actual Any-to-Variant registration must be postponed to a time when all
+// global variables have been initialized. Hence this arrangement.
+// wxAnyToVariantRegistration instances are kept in global scope and
+// wxAnyValueTypeGlobals in any.cpp will use their data when the time is
+// right.
+class WXDLLIMPEXP_BASE wxAnyToVariantRegistration
+{
+public:
+ wxAnyToVariantRegistration(wxVariantDataFactory factory);
+ virtual ~wxAnyToVariantRegistration();
+
+ virtual wxAnyValueType* GetAssociatedType() = 0;
+ wxVariantDataFactory GetFactory() const { return m_factory; }
+private:
+ wxVariantDataFactory m_factory;
+};
+
+template<typename T>
+class wxAnyToVariantRegistrationImpl : public wxAnyToVariantRegistration
+{
+public:
+ wxAnyToVariantRegistrationImpl(wxVariantDataFactory factory)
+ : wxAnyToVariantRegistration(factory)
+ {
+ }
+
+ virtual wxAnyValueType* GetAssociatedType()
+ {
+ return wxAnyValueTypeImpl<T>::GetInstance();
+ }
+private:
+};
+
+#define DECLARE_WXANY_CONVERSION() \
+virtual bool GetAsAny(wxAny* any) const; \
+static wxVariantData* VariantDataFactory(const wxAny& any);
+
+#define _REGISTER_WXANY_CONVERSION(T, CLASSNAME, FUNC) \
+static wxAnyToVariantRegistrationImpl<T> \
+ gs_##CLASSNAME##AnyToVariantRegistration = \
+ wxAnyToVariantRegistrationImpl<T>(&FUNC);
+
+#define REGISTER_WXANY_CONVERSION(T, CLASSNAME) \
+_REGISTER_WXANY_CONVERSION(T, CLASSNAME, CLASSNAME::VariantDataFactory)
+
+#define IMPLEMENT_TRIVIAL_WXANY_CONVERSION(T, CLASSNAME) \
+bool CLASSNAME::GetAsAny(wxAny* any) const \
+{ \
+ *any = m_value; \
+ return true; \
+} \
+wxVariantData* CLASSNAME::VariantDataFactory(const wxAny& any) \
+{ \
+ return new CLASSNAME(wxANY_AS(any, T)); \
+} \
+REGISTER_WXANY_CONVERSION(T, CLASSNAME)
+
+#else // if !wxUSE_ANY
+
+#define DECLARE_WXANY_CONVERSION()
+#define REGISTER_WXANY_CONVERSION(T, CLASSNAME)
+#define IMPLEMENT_TRIVIAL_WXANY_CONVERSION(T, CLASSNAME)
+
+#endif // wxUSE_ANY/!wxUSE_ANY
+
+
+#define DECLARE_VARIANT_OBJECT(classname) \
+ DECLARE_VARIANT_OBJECT_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
+
+#define DECLARE_VARIANT_OBJECT_EXPORTED(classname,expdecl) \
+expdecl classname& operator << ( classname &object, const wxVariant &variant ); \
+expdecl wxVariant& operator << ( wxVariant &variant, const classname &object );
+
+#define IMPLEMENT_VARIANT_OBJECT(classname) \
+ IMPLEMENT_VARIANT_OBJECT_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
+
+#define IMPLEMENT_VARIANT_OBJECT_EXPORTED_NO_EQ(classname,expdecl) \
+class classname##VariantData: public wxVariantData \
+{ \
+public:\
+ classname##VariantData() {} \
+ classname##VariantData( const classname &value ) { m_value = value; } \
+\
+ classname &GetValue() { return m_value; } \
+\
+ virtual bool Eq(wxVariantData& data) const; \
+\
+ virtual wxString GetType() const; \
+ virtual wxClassInfo* GetValueClassInfo(); \
+\
+ virtual wxVariantData* Clone() const { return new classname##VariantData(m_value); } \
+\
+ DECLARE_WXANY_CONVERSION() \
+protected:\
+ classname m_value; \
+};\
+\
+wxString classname##VariantData::GetType() const\
+{\
+ return m_value.GetClassInfo()->GetClassName();\
+}\
+\
+wxClassInfo* classname##VariantData::GetValueClassInfo()\
+{\
+ return m_value.GetClassInfo();\
+}\
+\
+expdecl classname& operator << ( classname &value, const wxVariant &variant )\
+{\
+ wxASSERT( variant.GetType() == #classname );\
+ \
+ classname##VariantData *data = (classname##VariantData*) variant.GetData();\
+ value = data->GetValue();\
+ return value;\
+}\
+\
+expdecl wxVariant& operator << ( wxVariant &variant, const classname &value )\
+{\
+ classname##VariantData *data = new classname##VariantData( value );\
+ variant.SetData( data );\
+ return variant;\
+} \
+IMPLEMENT_TRIVIAL_WXANY_CONVERSION(classname, classname##VariantData)
+
+// implements a wxVariantData-derived class using for the Eq() method the
+// operator== which must have been provided by "classname"
+#define IMPLEMENT_VARIANT_OBJECT_EXPORTED(classname,expdecl) \
+IMPLEMENT_VARIANT_OBJECT_EXPORTED_NO_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
+\
+bool classname##VariantData::Eq(wxVariantData& data) const \
+{\
+ wxASSERT( GetType() == data.GetType() );\
+\
+ classname##VariantData & otherData = (classname##VariantData &) data;\
+\
+ return otherData.m_value == m_value;\
+}\
+
+
+// implements a wxVariantData-derived class using for the Eq() method a shallow
+// comparison (through wxObject::IsSameAs function)
+#define IMPLEMENT_VARIANT_OBJECT_SHALLOWCMP(classname) \
+ IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(classname, wxEMPTY_PARAMETER_VALUE)
+#define IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(classname,expdecl) \
+IMPLEMENT_VARIANT_OBJECT_EXPORTED_NO_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
+\
+bool classname##VariantData::Eq(wxVariantData& data) const \
+{\
+ wxASSERT( GetType() == data.GetType() );\
+\
+ classname##VariantData & otherData = (classname##VariantData &) data;\
+\
+ return (otherData.m_value.IsSameAs(m_value));\
+}\
+
+
+// Since we want type safety wxVariant we need to fetch and dynamic_cast
+// in a seemingly safe way so the compiler can check, so we define
+// a dynamic_cast /wxDynamicCast analogue.
+
+#define wxGetVariantCast(var,classname) \
+ ((classname*)(var.IsValueKindOf(&classname::ms_classInfo) ?\
+ var.GetWxObjectPtr() : NULL));
+
+// Replacement for using wxDynamicCast on a wxVariantData object
+#ifndef wxNO_RTTI
+ #define wxDynamicCastVariantData(data, classname) dynamic_cast<classname*>(data)
+#endif
+
+#define wxStaticCastVariantData(data, classname) static_cast<classname*>(data)
+
+extern wxVariant WXDLLIMPEXP_BASE wxNullVariant;
+
+#endif // wxUSE_VARIANT
+
+#endif // _WX_VARIANT_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/vector.h
+// Purpose: STL vector clone
+// Author: Lindsay Mathieson
+// Modified by: Vaclav Slavik - make it a template
+// Created: 30.07.2001
+// Copyright: (c) 2001 Lindsay Mathieson <lindsay@mathieson.org>,
+// 2007 Vaclav Slavik <vslavik@fastmail.fm>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_VECTOR_H_
+#define _WX_VECTOR_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_STD_CONTAINERS
+
+#include <vector>
+#include <algorithm>
+
+#define wxVector std::vector
+template<typename T>
+inline void wxVectorSort(wxVector<T>& v)
+{
+ std::sort(v.begin(), v.end());
+}
+
+#else // !wxUSE_STD_CONTAINERS
+
+#include "wx/scopeguard.h"
+#include "wx/meta/movable.h"
+#include "wx/meta/if.h"
+
+#include "wx/beforestd.h"
+#include <new> // for placement new
+#include "wx/afterstd.h"
+
+// wxQsort is declared in wx/utils.h, but can't include that file here,
+// it indirectly includes this file. Just lovely...
+typedef int (*wxSortCallback)(const void* pItem1,
+ const void* pItem2,
+ const void* user_data);
+WXDLLIMPEXP_BASE void wxQsort(void* pbase, size_t total_elems,
+ size_t size, wxSortCallback cmp,
+ const void* user_data);
+
+namespace wxPrivate
+{
+
+// These templates encapsulate memory operations for use by wxVector; there are
+// two implementations, both in generic way for any C++ types and as an
+// optimized version for "movable" types that uses realloc() and memmove().
+
+// version for movable types:
+template<typename T>
+struct wxVectorMemOpsMovable
+{
+ static void Free(T* array)
+ { free(array); }
+
+ static T* Realloc(T* old, size_t newCapacity, size_t WXUNUSED(occupiedSize))
+ { return (T*)realloc(old, newCapacity * sizeof(T)); }
+
+ static void MemmoveBackward(T* dest, T* source, size_t count)
+ { memmove(dest, source, count * sizeof(T)); }
+
+ static void MemmoveForward(T* dest, T* source, size_t count)
+ { memmove(dest, source, count * sizeof(T)); }
+};
+
+// generic version for non-movable types:
+template<typename T>
+struct wxVectorMemOpsGeneric
+{
+ static void Free(T* array)
+ { ::operator delete(array); }
+
+ static T* Realloc(T* old, size_t newCapacity, size_t occupiedSize)
+ {
+ T *mem = (T*)::operator new(newCapacity * sizeof(T));
+ for ( size_t i = 0; i < occupiedSize; i++ )
+ {
+ ::new(mem + i) T(old[i]);
+ old[i].~T();
+ }
+ ::operator delete(old);
+ return mem;
+ }
+
+ static void MemmoveBackward(T* dest, T* source, size_t count)
+ {
+ wxASSERT( dest < source );
+ T* destptr = dest;
+ T* sourceptr = source;
+ for ( size_t i = count; i > 0; --i, ++destptr, ++sourceptr )
+ {
+ ::new(destptr) T(*sourceptr);
+ sourceptr->~T();
+ }
+ }
+
+ static void MemmoveForward(T* dest, T* source, size_t count)
+ {
+ wxASSERT( dest > source );
+ T* destptr = dest + count - 1;
+ T* sourceptr = source + count - 1;
+ for ( size_t i = count; i > 0; --i, --destptr, --sourceptr )
+ {
+ ::new(destptr) T(*sourceptr);
+ sourceptr->~T();
+ }
+ }
+};
+
+
+} // namespace wxPrivate
+
+template<typename T>
+class wxVector
+{
+private:
+ // This cryptic expression means "typedef Ops to wxVectorMemOpsMovable if
+ // type T is movable type, otherwise to wxVectorMemOpsGeneric".
+ //
+ // Note that we use typedef instead of privately deriving from this (which
+ // would allowed us to omit "Ops::" prefixes below) to keep VC6 happy,
+ // it can't compile code that derives from wxIf<...>::value.
+ //
+ // Note that bcc needs the extra parentheses for non-type template
+ // arguments to compile this expression.
+ typedef typename wxIf< (wxIsMovable<T>::value),
+ wxPrivate::wxVectorMemOpsMovable<T>,
+ wxPrivate::wxVectorMemOpsGeneric<T> >::value
+ Ops;
+
+public:
+ typedef size_t size_type;
+ typedef size_t difference_type;
+ typedef T value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type* iterator;
+ typedef const value_type* const_iterator;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
+ class reverse_iterator
+ {
+ public:
+ reverse_iterator() : m_ptr(NULL) { }
+ wxEXPLICIT reverse_iterator(iterator it) : m_ptr(it) { }
+ reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { }
+
+ reference operator*() const { return *m_ptr; }
+ pointer operator->() const { return m_ptr; }
+
+ iterator base() const { return m_ptr; }
+
+ reverse_iterator& operator++()
+ { --m_ptr; return *this; }
+ reverse_iterator operator++(int)
+ { reverse_iterator tmp = *this; --m_ptr; return tmp; }
+ reverse_iterator& operator--()
+ { ++m_ptr; return *this; }
+ reverse_iterator operator--(int)
+ { reverse_iterator tmp = *this; ++m_ptr; return tmp; }
+
+ reverse_iterator operator+(difference_type n) const
+ { return reverse_iterator(m_ptr - n); }
+ reverse_iterator& operator+=(difference_type n)
+ { m_ptr -= n; return *this; }
+ reverse_iterator operator-(difference_type n) const
+ { return reverse_iterator(m_ptr + n); }
+ reverse_iterator& operator-=(difference_type n)
+ { m_ptr += n; return *this; }
+
+ reference operator[](difference_type n) const
+ { return *(*this + n); }
+
+ bool operator ==(const reverse_iterator& it) const
+ { return m_ptr == it.m_ptr; }
+ bool operator !=(const reverse_iterator& it) const
+ { return m_ptr != it.m_ptr; }
+
+ private:
+ value_type *m_ptr;
+
+ friend class const_reverse_iterator;
+ };
+
+ class const_reverse_iterator
+ {
+ public:
+ const_reverse_iterator() : m_ptr(NULL) { }
+ wxEXPLICIT const_reverse_iterator(const_iterator it) : m_ptr(it) { }
+ const_reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { }
+ const_reverse_iterator(const const_reverse_iterator& it) : m_ptr(it.m_ptr) { }
+
+ const_reference operator*() const { return *m_ptr; }
+ const_pointer operator->() const { return m_ptr; }
+
+ const_iterator base() const { return m_ptr; }
+
+ const_reverse_iterator& operator++()
+ { --m_ptr; return *this; }
+ const_reverse_iterator operator++(int)
+ { const_reverse_iterator tmp = *this; --m_ptr; return tmp; }
+ const_reverse_iterator& operator--()
+ { ++m_ptr; return *this; }
+ const_reverse_iterator operator--(int)
+ { const_reverse_iterator tmp = *this; ++m_ptr; return tmp; }
+
+ const_reverse_iterator operator+(difference_type n) const
+ { return const_reverse_iterator(m_ptr - n); }
+ const_reverse_iterator& operator+=(difference_type n)
+ { m_ptr -= n; return *this; }
+ const_reverse_iterator operator-(difference_type n) const
+ { return const_reverse_iterator(m_ptr + n); }
+ const_reverse_iterator& operator-=(difference_type n)
+ { m_ptr += n; return *this; }
+
+ const_reference operator[](difference_type n) const
+ { return *(*this + n); }
+
+ bool operator ==(const const_reverse_iterator& it) const
+ { return m_ptr == it.m_ptr; }
+ bool operator !=(const const_reverse_iterator& it) const
+ { return m_ptr != it.m_ptr; }
+
+ protected:
+ const value_type *m_ptr;
+ };
+
+ wxVector() : m_size(0), m_capacity(0), m_values(NULL) {}
+
+ wxVector(size_type p_size)
+ : m_size(0), m_capacity(0), m_values(NULL)
+ {
+ reserve(p_size);
+ for ( size_t n = 0; n < p_size; n++ )
+ push_back(value_type());
+ }
+
+ wxVector(size_type p_size, const value_type& v)
+ : m_size(0), m_capacity(0), m_values(NULL)
+ {
+ reserve(p_size);
+ for ( size_t n = 0; n < p_size; n++ )
+ push_back(v);
+ }
+
+ wxVector(const wxVector& c) : m_size(0), m_capacity(0), m_values(NULL)
+ {
+ Copy(c);
+ }
+
+ template <class InputIterator>
+ wxVector(InputIterator first, InputIterator last)
+ : m_size(0), m_capacity(0), m_values(NULL)
+ {
+ assign(first, last);
+ }
+
+ ~wxVector()
+ {
+ clear();
+ }
+
+ void assign(size_type p_size, const value_type& v)
+ {
+ clear();
+ reserve(p_size);
+ for ( size_t n = 0; n < p_size; n++ )
+ push_back(v);
+ }
+
+ template <class InputIterator>
+ void assign(InputIterator first, InputIterator last)
+ {
+ clear();
+
+ // Notice that it would be nice to call reserve() here but we can't do
+ // it for arbitrary input iterators, we should have a dispatch on
+ // iterator type and call it if possible.
+
+ for ( InputIterator it = first; it != last; ++it )
+ push_back(*it);
+ }
+
+ void swap(wxVector& v)
+ {
+ wxSwap(m_size, v.m_size);
+ wxSwap(m_capacity, v.m_capacity);
+ wxSwap(m_values, v.m_values);
+ }
+
+ void clear()
+ {
+ // call destructors of stored objects:
+ for ( size_type i = 0; i < m_size; i++ )
+ {
+ m_values[i].~T();
+ }
+
+ Ops::Free(m_values);
+ m_values = NULL;
+ m_size =
+ m_capacity = 0;
+ }
+
+ void reserve(size_type n)
+ {
+ if ( n <= m_capacity )
+ return;
+
+ // increase the size twice, unless we're already too big or unless
+ // more is requested
+ //
+ // NB: casts to size_type are needed to suppress warnings about
+ // mixing enumeral and non-enumeral type in conditional expression
+ const size_type increment = m_size > 0
+ ? m_size < ALLOC_MAX_SIZE
+ ? m_size
+ : (size_type)ALLOC_MAX_SIZE
+ : (size_type)ALLOC_INITIAL_SIZE;
+ if ( m_capacity + increment > n )
+ n = m_capacity + increment;
+
+ m_values = Ops::Realloc(m_values, n * sizeof(value_type), m_size);
+ m_capacity = n;
+ }
+
+ void resize(size_type n)
+ {
+ if ( n < m_size )
+ Shrink(n);
+ else if ( n > m_size )
+ Extend(n, value_type());
+ }
+
+ void resize(size_type n, const value_type& v)
+ {
+ if ( n < m_size )
+ Shrink(n);
+ else if ( n > m_size )
+ Extend(n, v);
+ }
+
+ size_type size() const
+ {
+ return m_size;
+ }
+
+ size_type capacity() const
+ {
+ return m_capacity;
+ }
+
+ bool empty() const
+ {
+ return size() == 0;
+ }
+
+ wxVector& operator=(const wxVector& vb)
+ {
+ if (this != &vb)
+ {
+ clear();
+ Copy(vb);
+ }
+ return *this;
+ }
+
+ void push_back(const value_type& v)
+ {
+ reserve(size() + 1);
+
+ // use placement new to initialize new object in preallocated place in
+ // m_values and store 'v' in it:
+ void* const place = m_values + m_size;
+ ::new(place) value_type(v);
+
+ // only increase m_size if the ctor didn't throw an exception; notice
+ // that if it _did_ throw, everything is OK, because we only increased
+ // vector's capacity so far and possibly written some data to
+ // uninitialized memory at the end of m_values
+ m_size++;
+ }
+
+ void pop_back()
+ {
+ erase(end() - 1);
+ }
+
+ const value_type& at(size_type idx) const
+ {
+ wxASSERT(idx < m_size);
+ return m_values[idx];
+ }
+
+ value_type& at(size_type idx)
+ {
+ wxASSERT(idx < m_size);
+ return m_values[idx];
+ }
+
+ const value_type& operator[](size_type idx) const { return at(idx); }
+ value_type& operator[](size_type idx) { return at(idx); }
+ const value_type& front() const { return at(0); }
+ value_type& front() { return at(0); }
+ const value_type& back() const { return at(size() - 1); }
+ value_type& back() { return at(size() - 1); }
+
+ const_iterator begin() const { return m_values; }
+ iterator begin() { return m_values; }
+ const_iterator end() const { return m_values + size(); }
+ iterator end() { return m_values + size(); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end() - 1); }
+ reverse_iterator rend() { return reverse_iterator(begin() - 1); }
+
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end() - 1); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin() - 1); }
+
+ iterator insert(iterator it, const value_type& v = value_type())
+ {
+ // NB: this must be done before reserve(), because reserve()
+ // invalidates iterators!
+ const size_t idx = it - begin();
+ const size_t after = end() - it;
+
+ reserve(size() + 1);
+
+ // the place where the new element is going to be inserted
+ value_type * const place = m_values + idx;
+
+ // unless we're inserting at the end, move following elements out of
+ // the way:
+ if ( after > 0 )
+ Ops::MemmoveForward(place + 1, place, after);
+
+ // if the ctor called below throws an exception, we need to move all
+ // the elements back to their original positions in m_values
+ wxScopeGuard moveBack = wxMakeGuard(
+ Ops::MemmoveBackward, place, place + 1, after);
+ if ( !after )
+ moveBack.Dismiss();
+
+ // use placement new to initialize new object in preallocated place in
+ // m_values and store 'v' in it:
+ ::new(place) value_type(v);
+
+ // now that we did successfully add the new element, increment the size
+ // and disable moving the items back
+ moveBack.Dismiss();
+ m_size++;
+
+ return begin() + idx;
+ }
+
+ iterator erase(iterator it)
+ {
+ return erase(it, it + 1);
+ }
+
+ iterator erase(iterator first, iterator last)
+ {
+ if ( first == last )
+ return first;
+ wxASSERT( first < end() && last <= end() );
+
+ const size_type idx = first - begin();
+ const size_type count = last - first;
+ const size_type after = end() - last;
+
+ // erase elements by calling their destructors:
+ for ( iterator i = first; i < last; ++i )
+ i->~T();
+
+ // once that's done, move following elements over to the freed space:
+ if ( after > 0 )
+ {
+ Ops::MemmoveBackward(m_values + idx, m_values + idx + count, after);
+ }
+
+ m_size -= count;
+
+ return begin() + idx;
+ }
+
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED( size_type erase(size_type n) );
+#endif // WXWIN_COMPATIBILITY_2_8
+
+private:
+ // VC6 can't compile static const int members
+ enum { ALLOC_INITIAL_SIZE = 16 };
+ enum { ALLOC_MAX_SIZE = 4096 };
+
+ void Copy(const wxVector& vb)
+ {
+ reserve(vb.size());
+
+ for ( const_iterator i = vb.begin(); i != vb.end(); ++i )
+ push_back(*i);
+ }
+
+private:
+ void Shrink(size_type n)
+ {
+ for ( size_type i = n; i < m_size; i++ )
+ m_values[i].~T();
+ m_size = n;
+ }
+
+ void Extend(size_type n, const value_type& v)
+ {
+ reserve(n);
+ for ( size_type i = m_size; i < n; i++ )
+ push_back(v);
+ }
+
+ size_type m_size,
+ m_capacity;
+ value_type *m_values;
+};
+
+#if WXWIN_COMPATIBILITY_2_8
+template<typename T>
+inline typename wxVector<T>::size_type wxVector<T>::erase(size_type n)
+{
+ erase(begin() + n);
+ return n;
+}
+#endif // WXWIN_COMPATIBILITY_2_8
+
+
+
+namespace wxPrivate
+{
+
+// This is a helper for the wxVectorSort function, and should not be used
+// directly in user's code.
+template<typename T>
+struct wxVectorComparator
+{
+ static int
+ Compare(const void* pitem1, const void* pitem2, const void* )
+ {
+ const T& item1 = *reinterpret_cast<const T*>(pitem1);
+ const T& item2 = *reinterpret_cast<const T*>(pitem2);
+
+ if (item1 < item2)
+ return -1;
+ else if (item2 < item1)
+ return 1;
+ else
+ return 0;
+ }
+};
+
+} // namespace wxPrivate
+
+
+
+template<typename T>
+void wxVectorSort(wxVector<T>& v)
+{
+ wxQsort(v.begin(), v.size(), sizeof(T),
+ wxPrivate::wxVectorComparator<T>::Compare, NULL);
+}
+
+
+
+#endif // wxUSE_STD_CONTAINERS/!wxUSE_STD_CONTAINERS
+
+#if WXWIN_COMPATIBILITY_2_8
+ #define WX_DECLARE_VECTORBASE(obj, cls) typedef wxVector<obj> cls
+ #define _WX_DECLARE_VECTOR(obj, cls, exp) WX_DECLARE_VECTORBASE(obj, cls)
+ #define WX_DECLARE_VECTOR(obj, cls) WX_DECLARE_VECTORBASE(obj, cls)
+#endif // WXWIN_COMPATIBILITY_2_8
+
+#endif // _WX_VECTOR_H_
--- /dev/null
+/*
+ * Name: wx/version.h
+ * Purpose: wxWidgets version numbers
+ * Author: Julian Smart
+ * Modified by: Ryan Norton (Converted to C)
+ * Created: 29/01/98
+ * Copyright: (c) 1998 Julian Smart
+ * Licence: wxWindows licence
+ */
+
+/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
+
+#ifndef _WX_VERSION_H_
+#define _WX_VERSION_H_
+
+#include "wx/cpp.h" /* for wxSTRINGIZE */
+
+/* the constants below must be changed with each new version */
+/* ---------------------------------------------------------------------------- */
+
+/*
+ Don't forget to update WX_CURRENT, WX_REVISION and WX_AGE in
+ build/bakefiles/version.bkl and regenerate the makefiles when you change
+ this!
+ */
+
+/* NB: this file is parsed by automatic tools so don't change its format! */
+#define wxMAJOR_VERSION 3
+#define wxMINOR_VERSION 0
+#define wxRELEASE_NUMBER 0
+#define wxSUBRELEASE_NUMBER 0
+#define wxVERSION_STRING wxT("wxWidgets 3.0.0")
+
+/* nothing to update below this line when updating the version */
+/* ---------------------------------------------------------------------------- */
+
+/* Users can pre-define wxABI_VERSION to a lower value in their
+ * makefile/project settings to compile code that will be binary compatible
+ * with earlier versions of the ABI within the same minor version (between
+ * minor versions binary compatibility breaks anyway). The default is the
+ * version of wxWidgets being used. A single number with two decimal digits
+ * for each component, e.g. 20601 for 2.6.1 */
+#ifndef wxABI_VERSION
+#define wxABI_VERSION ( wxMAJOR_VERSION * 10000 + wxMINOR_VERSION * 100 + 99 )
+#endif
+
+/* helpers for wxVERSION_NUM_XXX */
+#define wxMAKE_VERSION_STRING(x, y, z) \
+ wxSTRINGIZE(x) wxSTRINGIZE(y) wxSTRINGIZE(z)
+#define wxMAKE_VERSION_DOT_STRING(x, y, z) \
+ wxSTRINGIZE(x) "." wxSTRINGIZE(y) "." wxSTRINGIZE(z)
+
+#define wxMAKE_VERSION_STRING_T(x, y, z) \
+ wxSTRINGIZE_T(x) wxSTRINGIZE_T(y) wxSTRINGIZE_T(z)
+#define wxMAKE_VERSION_DOT_STRING_T(x, y, z) \
+ wxSTRINGIZE_T(x) wxT(".") wxSTRINGIZE_T(y) wxT(".") wxSTRINGIZE_T(z)
+
+/* these are used by src/msw/version.rc and should always be ASCII, not Unicode */
+#define wxVERSION_NUM_STRING \
+ wxMAKE_VERSION_STRING(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER)
+#define wxVERSION_NUM_DOT_STRING \
+ wxMAKE_VERSION_DOT_STRING(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER)
+
+/* those are Unicode-friendly */
+#define wxVERSION_NUM_STRING_T \
+ wxMAKE_VERSION_STRING_T(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER)
+#define wxVERSION_NUM_DOT_STRING_T \
+ wxMAKE_VERSION_DOT_STRING_T(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER)
+
+/* some more defines, not really sure if they're [still] useful */
+#define wxVERSION_NUMBER ( (wxMAJOR_VERSION * 1000) + (wxMINOR_VERSION * 100) + wxRELEASE_NUMBER )
+#define wxBETA_NUMBER 0
+#define wxVERSION_FLOAT ( wxMAJOR_VERSION + (wxMINOR_VERSION/10.0) + (wxRELEASE_NUMBER/100.0) + (wxBETA_NUMBER/10000.0) )
+
+/* check if the current version is at least major.minor.release */
+#define wxCHECK_VERSION(major,minor,release) \
+ (wxMAJOR_VERSION > (major) || \
+ (wxMAJOR_VERSION == (major) && wxMINOR_VERSION > (minor)) || \
+ (wxMAJOR_VERSION == (major) && wxMINOR_VERSION == (minor) && wxRELEASE_NUMBER >= (release)))
+
+/* the same but check the subrelease also */
+#define wxCHECK_VERSION_FULL(major,minor,release,subrel) \
+ (wxCHECK_VERSION(major, minor, release) && \
+ ((major) != wxMAJOR_VERSION || \
+ (minor) != wxMINOR_VERSION || \
+ (release) != wxRELEASE_NUMBER || \
+ (subrel) <= wxSUBRELEASE_NUMBER))
+
+#endif /* _WX_VERSION_H_ */
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/versioninfo.h
+// Purpose: declaration of wxVersionInfo class
+// Author: Troels K
+// Created: 2010-11-22
+// Copyright: (c) 2010 wxWidgets team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_VERSIONINFO_H_
+#define _WX_VERSIONINFO_H_
+
+#include "wx/string.h"
+
+// ----------------------------------------------------------------------------
+// wxVersionInfo: represents version information
+// ----------------------------------------------------------------------------
+
+class wxVersionInfo
+{
+public:
+ wxVersionInfo(const wxString& name = wxString(),
+ int major = 0,
+ int minor = 0,
+ int micro = 0,
+ const wxString& description = wxString(),
+ const wxString& copyright = wxString())
+ {
+ m_name = name;
+ m_major = major;
+ m_minor = minor;
+ m_micro = micro;
+ m_description = description;
+ m_copyright = copyright;
+ }
+
+ // Default copy ctor, assignment operator and dtor are ok.
+
+
+ const wxString& GetName() const { return m_name; }
+
+ int GetMajor() const { return m_major; }
+ int GetMinor() const { return m_minor; }
+ int GetMicro() const { return m_micro; }
+
+ wxString ToString() const
+ {
+ return HasDescription() ? GetDescription() : GetVersionString();
+ }
+
+ wxString GetVersionString() const
+ {
+ wxString str;
+ str << m_name << ' ' << GetMajor() << '.' << GetMinor();
+ if ( GetMicro() )
+ str << '.' << GetMicro();
+
+ return str;
+ }
+
+ bool HasDescription() const { return !m_description.empty(); }
+ const wxString& GetDescription() const { return m_description; }
+
+ bool HasCopyright() const { return !m_copyright.empty(); }
+ const wxString& GetCopyright() const { return m_copyright; }
+
+private:
+ wxString m_name,
+ m_description,
+ m_copyright;
+
+ int m_major,
+ m_minor,
+ m_micro;
+};
+
+#endif // _WX_VERSIONINFO_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/vidmode.h
+// Purpose: declares wxVideoMode class used by both wxDisplay and wxApp
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 27.09.2003 (extracted from wx/display.h)
+// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_VMODE_H_
+#define _WX_VMODE_H_
+
+// ----------------------------------------------------------------------------
+// wxVideoMode: a simple struct containing video mode parameters for a display
+// ----------------------------------------------------------------------------
+
+struct WXDLLIMPEXP_CORE wxVideoMode
+{
+ wxVideoMode(int width = 0, int height = 0, int depth = 0, int freq = 0)
+ {
+ w = width;
+ h = height;
+
+ bpp = depth;
+
+ refresh = freq;
+ }
+
+ // default copy ctor and assignment operator are ok
+
+ bool operator==(const wxVideoMode& m) const
+ {
+ return w == m.w && h == m.h && bpp == m.bpp && refresh == m.refresh;
+ }
+ bool operator!=(const wxVideoMode& mode) const
+ {
+ return !operator==(mode);
+ }
+
+ // returns true if this mode matches the other one in the sense that all
+ // non zero fields of the other mode have the same value in this one
+ // (except for refresh which is allowed to have a greater value)
+ bool Matches(const wxVideoMode& other) const
+ {
+ return (!other.w || w == other.w) &&
+ (!other.h || h == other.h) &&
+ (!other.bpp || bpp == other.bpp) &&
+ (!other.refresh || refresh >= other.refresh);
+ }
+
+ // trivial accessors
+ int GetWidth() const { return w; }
+ int GetHeight() const { return h; }
+ int GetDepth() const { return bpp; }
+ int GetRefresh() const { return refresh; }
+
+ // returns true if the object has been initialized
+ bool IsOk() const { return w && h; }
+
+
+ // the screen size in pixels (e.g. 640*480), 0 means unspecified
+ int w, h;
+
+ // bits per pixel (e.g. 32), 1 is monochrome and 0 means unspecified/known
+ int bpp;
+
+ // refresh frequency in Hz, 0 means unspecified/unknown
+ int refresh;
+};
+
+#endif // _WX_VMODE_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/vlbox.h
+// Purpose: wxVListBox is a virtual listbox with lines of variable height
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 31.05.03
+// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_VLBOX_H_
+#define _WX_VLBOX_H_
+
+#include "wx/vscroll.h" // base class
+#include "wx/bitmap.h"
+
+class WXDLLIMPEXP_FWD_CORE wxSelectionStore;
+extern WXDLLIMPEXP_DATA_CORE(const char) wxVListBoxNameStr[];
+
+// ----------------------------------------------------------------------------
+// wxVListBox
+// ----------------------------------------------------------------------------
+
+/*
+ This class has two main differences from a regular listbox: it can have an
+ arbitrarily huge number of items because it doesn't store them itself but
+ uses OnDrawItem() callback to draw them and its items can have variable
+ height as determined by OnMeasureItem().
+
+ It emits the same events as wxListBox and the same event macros may be used
+ with it.
+ */
+class WXDLLIMPEXP_CORE wxVListBox : public wxVScrolledWindow
+{
+public:
+ // constructors and such
+ // ---------------------
+
+ // default constructor, you must call Create() later
+ wxVListBox() { Init(); }
+
+ // normal constructor which calls Create() internally
+ wxVListBox(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxVListBoxNameStr)
+ {
+ Init();
+
+ (void)Create(parent, id, pos, size, style, name);
+ }
+
+ // really creates the control and sets the initial number of items in it
+ // (which may be changed later with SetItemCount())
+ //
+ // the only special style which may be specified here is wxLB_MULTIPLE
+ //
+ // returns true on success or false if the control couldn't be created
+ bool Create(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxVListBoxNameStr);
+
+ // dtor does some internal cleanup (deletes m_selStore if any)
+ virtual ~wxVListBox();
+
+
+ // accessors
+ // ---------
+
+ // get the number of items in the control
+ size_t GetItemCount() const { return GetRowCount(); }
+
+ // does this control use multiple selection?
+ bool HasMultipleSelection() const { return m_selStore != NULL; }
+
+ // get the currently selected item or wxNOT_FOUND if there is no selection
+ //
+ // this method is only valid for the single selection listboxes
+ int GetSelection() const
+ {
+ wxASSERT_MSG( !HasMultipleSelection(),
+ wxT("GetSelection() can't be used with wxLB_MULTIPLE") );
+
+ return m_current;
+ }
+
+ // is this item the current one?
+ bool IsCurrent(size_t item) const { return item == (size_t)m_current; }
+ #ifdef __WXUNIVERSAL__
+ bool IsCurrent() const { return wxVScrolledWindow::IsCurrent(); }
+ #endif
+
+ // is this item selected?
+ bool IsSelected(size_t item) const;
+
+ // get the number of the selected items (maybe 0)
+ //
+ // this method is valid for both single and multi selection listboxes
+ size_t GetSelectedCount() const;
+
+ // get the first selected item, returns wxNOT_FOUND if none
+ //
+ // cookie is an opaque parameter which should be passed to
+ // GetNextSelected() later
+ //
+ // this method is only valid for the multi selection listboxes
+ int GetFirstSelected(unsigned long& cookie) const;
+
+ // get next selection item, return wxNOT_FOUND if no more
+ //
+ // cookie must be the same parameter that was passed to GetFirstSelected()
+ // before
+ //
+ // this method is only valid for the multi selection listboxes
+ int GetNextSelected(unsigned long& cookie) const;
+
+ // get the margins around each item
+ wxPoint GetMargins() const { return m_ptMargins; }
+
+ // get the background colour of selected cells
+ const wxColour& GetSelectionBackground() const { return m_colBgSel; }
+
+ // get the item rect, returns empty rect if the item is not visible
+ wxRect GetItemRect(size_t n) const;
+
+ // operations
+ // ----------
+
+ // set the number of items to be shown in the control
+ //
+ // this is just a synonym for wxVScrolledWindow::SetRowCount()
+ virtual void SetItemCount(size_t count);
+
+ // delete all items from the control
+ void Clear() { SetItemCount(0); }
+
+ // set the selection to the specified item, if it is wxNOT_FOUND the
+ // selection is unset
+ //
+ // this function is only valid for the single selection listboxes
+ void SetSelection(int selection);
+
+ // selects or deselects the specified item which must be valid (i.e. not
+ // equal to wxNOT_FOUND)
+ //
+ // return true if the items selection status has changed or false
+ // otherwise
+ //
+ // this function is only valid for the multiple selection listboxes
+ bool Select(size_t item, bool select = true);
+
+ // selects the items in the specified range whose end points may be given
+ // in any order
+ //
+ // return true if any items selection status has changed, false otherwise
+ //
+ // this function is only valid for the single selection listboxes
+ bool SelectRange(size_t from, size_t to);
+
+ // toggle the selection of the specified item (must be valid)
+ //
+ // this function is only valid for the multiple selection listboxes
+ void Toggle(size_t item) { Select(item, !IsSelected(item)); }
+
+ // select all items in the listbox
+ //
+ // the return code indicates if any items were affected by this operation
+ // (true) or if nothing has changed (false)
+ bool SelectAll() { return DoSelectAll(true); }
+
+ // unselect all items in the listbox
+ //
+ // the return code has the same meaning as for SelectAll()
+ bool DeselectAll() { return DoSelectAll(false); }
+
+ // set the margins: horizontal margin is the distance between the window
+ // border and the item contents while vertical margin is half of the
+ // distance between items
+ //
+ // by default both margins are 0
+ void SetMargins(const wxPoint& pt);
+ void SetMargins(wxCoord x, wxCoord y) { SetMargins(wxPoint(x, y)); }
+
+ // change the background colour of the selected cells
+ void SetSelectionBackground(const wxColour& col);
+
+ // refreshes only the selected items
+ void RefreshSelected();
+
+
+ virtual wxVisualAttributes GetDefaultAttributes() const
+ {
+ return GetClassDefaultAttributes(GetWindowVariant());
+ }
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+protected:
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_THEME; }
+
+ // the derived class must implement this function to actually draw the item
+ // with the given index on the provided DC
+ virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const = 0;
+
+ // the derived class must implement this method to return the height of the
+ // specified item
+ virtual wxCoord OnMeasureItem(size_t n) const = 0;
+
+ // this method may be used to draw separators between the lines; note that
+ // the rectangle may be modified, typically to deflate it a bit before
+ // passing to OnDrawItem()
+ //
+ // the base class version doesn't do anything
+ virtual void OnDrawSeparator(wxDC& dc, wxRect& rect, size_t n) const;
+
+ // this method is used to draw the items background and, maybe, a border
+ // around it
+ //
+ // the base class version implements a reasonable default behaviour which
+ // consists in drawing the selected item with the standard background
+ // colour and drawing a border around the item if it is either selected or
+ // current
+ virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const;
+
+ // we implement OnGetRowHeight() in terms of OnMeasureItem() because this
+ // allows us to add borders to the items easily
+ //
+ // this function is not supposed to be overridden by the derived classes
+ virtual wxCoord OnGetRowHeight(size_t line) const;
+
+
+ // event handlers
+ void OnPaint(wxPaintEvent& event);
+ void OnKeyDown(wxKeyEvent& event);
+ void OnLeftDown(wxMouseEvent& event);
+ void OnLeftDClick(wxMouseEvent& event);
+ void OnSetOrKillFocus(wxFocusEvent& event);
+ void OnSize(wxSizeEvent& event);
+
+ // common part of all ctors
+ void Init();
+
+ // send the wxEVT_LISTBOX event
+ void SendSelectedEvent();
+ virtual void InitEvent(wxCommandEvent& event, int n);
+
+ // common implementation of SelectAll() and DeselectAll()
+ bool DoSelectAll(bool select);
+
+ // change the current item (in single selection listbox it also implicitly
+ // changes the selection); current may be wxNOT_FOUND in which case there
+ // will be no current item any more
+ //
+ // return true if the current item changed, false otherwise
+ bool DoSetCurrent(int current);
+
+ // flags for DoHandleItemClick
+ enum
+ {
+ ItemClick_Shift = 1, // item shift-clicked
+ ItemClick_Ctrl = 2, // ctrl
+ ItemClick_Kbd = 4 // item selected from keyboard
+ };
+
+ // common part of keyboard and mouse handling processing code
+ void DoHandleItemClick(int item, int flags);
+
+ // paint the background of the given item using the provided colour if it's
+ // valid, otherwise just return false and do nothing (this is used by
+ // OnDrawBackground())
+ bool DoDrawSolidBackground(const wxColour& col,
+ wxDC& dc,
+ const wxRect& rect,
+ size_t n) const;
+
+private:
+ // the current item or wxNOT_FOUND
+ //
+ // if m_selStore == NULL this is also the selected item, otherwise the
+ // selections are managed by m_selStore
+ int m_current;
+
+ // the anchor of the selection for the multiselection listboxes:
+ // shift-clicking an item extends the selection from m_anchor to the item
+ // clicked, for example
+ //
+ // always wxNOT_FOUND for single selection listboxes
+ int m_anchor;
+
+ // the object managing our selected items if not NULL
+ wxSelectionStore *m_selStore;
+
+ // margins
+ wxPoint m_ptMargins;
+
+ // the selection bg colour
+ wxColour m_colBgSel;
+
+ DECLARE_EVENT_TABLE()
+ wxDECLARE_NO_COPY_CLASS(wxVListBox);
+ DECLARE_ABSTRACT_CLASS(wxVListBox)
+};
+
+#endif // _WX_VLBOX_H_
+
--- /dev/null
+/***************************************************************************
+ * *
+ * Author : Jouk Jansen (joukj@hrem.stm.tudelft.nl) *
+ * *
+ * Last revision : 7 October 2005 *
+ * *
+ * Repair definitions of Runtime library functions when compiling with *
+ * /name=(as_is) on OpenVMS *
+ * *
+ ***************************************************************************/
+
+#ifndef VMS_X_FIX
+#define VMS_X_FIX
+
+#define decw$_select DECW$_SELECT
+#define DtSaverGetWindows DTSAVERGETWINDOWS
+#define MrmFetchWidget MRMFETCHWIDGET
+#define MrmInitialize MRMINITIALIZE
+#define MrmOpenHierarchy MRMOPENHIERARCHY
+#define MrmRegisterNames MRMREGISTERNAMES
+#define XAddExtension XADDEXTENSION
+#define XAddHosts XADDHOSTS
+#define XAllocClassHint XALLOCCLASSHINT
+#define XAllocColor XALLOCCOLOR
+#define XAllocColorCells XALLOCCOLORCELLS
+#define XAllocIconSize XALLOCICONSIZE
+#define XAllocNamedColor XALLOCNAMEDCOLOR
+#define XAllocSizeHints XALLOCSIZEHINTS
+#define XAllocStandardColormap XALLOCSTANDARDCOLORMAP
+#define XAllocWMHints XALLOCWMHINTS
+#define XAllowEvents XALLOWEVENTS
+#define XAutoRepeatOff XAUTOREPEATOFF
+#define XAutoRepeatOn XAUTOREPEATON
+#define XBaseFontNameListOfFontSet XBASEFONTNAMELISTOFFONTSET
+#define XBell XBELL
+#define XBitmapPad XBITMAPPAD
+#define XBlackPixel XBLACKPIXEL
+#define XBlackPixelOfScreen XBLACKPIXELOFSCREEN
+#define XCellsOfScreen XCELLSOFSCREEN
+#define XChangeActivePointerGrab XCHANGEACTIVEPOINTERGRAB
+#define XChangeGC XCHANGEGC
+#define XChangeKeyboardControl XCHANGEKEYBOARDCONTROL
+#define XChangePointerControl XCHANGEPOINTERCONTROL
+#define XChangeProperty XCHANGEPROPERTY
+#define XChangeWindowAttributes XCHANGEWINDOWATTRIBUTES
+#define XCheckIfEvent XCHECKIFEVENT
+#define XCheckMaskEvent XCHECKMASKEVENT
+#define XCheckTypedEvent XCHECKTYPEDEVENT
+#define XCheckTypedWindowEvent XCHECKTYPEDWINDOWEVENT
+#define XCheckWindowEvent XCHECKWINDOWEVENT
+#define XClearArea XCLEARAREA
+#define XClearWindow XCLEARWINDOW
+#define XClipBox XCLIPBOX
+#define XCloseDisplay XCLOSEDISPLAY
+#define XCloseIM XCLOSEIM
+#define XConfigureWindow XCONFIGUREWINDOW
+#define XConvertSelection XCONVERTSELECTION
+#define XCopyArea XCOPYAREA
+#define XCopyColormapAndFree XCOPYCOLORMAPANDFREE
+#define XCopyGC XCOPYGC
+#define XCopyPlane XCOPYPLANE
+#define XCreateBitmapFromData XCREATEBITMAPFROMDATA
+#define XCreateColormap XCREATECOLORMAP
+#define XCreateFontCursor XCREATEFONTCURSOR
+#define XCreateFontSet XCREATEFONTSET
+#define XCreateGC XCREATEGC
+#define XCreateGlyphCursor XCREATEGLYPHCURSOR
+#define XCreateIC XCREATEIC
+#define XCreateImage XCREATEIMAGE
+#define XCreatePixmap XCREATEPIXMAP
+#define XCreatePixmapCursor XCREATEPIXMAPCURSOR
+#define XCreatePixmapFromBitmapData XCREATEPIXMAPFROMBITMAPDATA
+#define XCreateRegion XCREATEREGION
+#define XCreateSimpleWindow XCREATESIMPLEWINDOW
+#define XCreateWindow XCREATEWINDOW
+#define XDefaultColormap XDEFAULTCOLORMAP
+#define XDefaultColormapOfScreen XDEFAULTCOLORMAPOFSCREEN
+#define XDefaultDepth XDEFAULTDEPTH
+#define XDefaultDepthOfScreen XDEFAULTDEPTHOFSCREEN
+#define XDefaultGC XDEFAULTGC
+#define XDefaultRootWindow XDEFAULTROOTWINDOW
+#define XDefaultScreen XDEFAULTSCREEN
+#define XDefaultScreenOfDisplay XDEFAULTSCREENOFDISPLAY
+#define XDefaultVisual XDEFAULTVISUAL
+#define XDefaultVisualOfScreen XDEFAULTVISUALOFSCREEN
+#define XDefineCursor XDEFINECURSOR
+#define XDeleteContext XDELETECONTEXT
+#define XDeleteProperty XDELETEPROPERTY
+#define XDestroyIC XDESTROYIC
+#define XDestroyRegion XDESTROYREGION
+#define XDestroySubwindows XDESTROYSUBWINDOWS
+#define XDestroyWindow XDESTROYWINDOW
+#define XDisableAccessControl XDISABLEACCESSCONTROL
+#define XDisplayCells XDISPLAYCELLS
+#define XDisplayHeight XDISPLAYHEIGHT
+#define XDisplayKeycodes XDISPLAYKEYCODES
+#define XDisplayName XDISPLAYNAME
+#define XDisplayOfIM XDISPLAYOFIM
+#define XDisplayOfScreen XDISPLAYOFSCREEN
+#define XDisplayString XDISPLAYSTRING
+#define XDisplayWidth XDISPLAYWIDTH
+#define XDoesBackingStore XDOESBACKINGSTORE
+#define XDrawArc XDRAWARC
+#define XDrawArcs XDRAWARCS
+#define XDrawImageString XDRAWIMAGESTRING
+#define XDrawImageString16 XDRAWIMAGESTRING16
+#define XDrawLine XDRAWLINE
+#define XDrawLines XDRAWLINES
+#define XDrawPoint XDRAWPOINT
+#define XDrawPoints XDRAWPOINTS
+#define XDrawRectangle XDRAWRECTANGLE
+#define XDrawRectangles XDRAWRECTANGLES
+#define XDrawSegments XDRAWSEGMENTS
+#define XDrawString XDRAWSTRING
+#define XDrawString16 XDRAWSTRING16
+#define XDrawText XDRAWTEXT
+#define XDrawText16 XDRAWTEXT16
+#define XESetCloseDisplay XESETCLOSEDISPLAY
+#define XEmptyRegion XEMPTYREGION
+#define XEnableAccessControl XENABLEACCESSCONTROL
+#define XEqualRegion XEQUALREGION
+#define XEventsQueued XEVENTSQUEUED
+#define XExtendedMaxRequestSize XEXTENDEDMAXREQUESTSIZE
+#define XExtentsOfFontSet XEXTENTSOFFONTSET
+#define XFetchBuffer XFETCHBUFFER
+#define XFetchBytes XFETCHBYTES
+#define XFetchName XFETCHNAME
+#define XFillArc XFILLARC
+#define XFillArcs XFILLARCS
+#define XFillPolygon XFILLPOLYGON
+#define XFillRectangle XFILLRECTANGLE
+#define XFillRectangles XFILLRECTANGLES
+#define XFilterEvent XFILTEREVENT
+#define XFindContext XFINDCONTEXT
+#define XFlush XFLUSH
+#define XFontsOfFontSet XFONTSOFFONTSET
+#define XForceScreenSaver XFORCESCREENSAVER
+#define XFree XFREE
+#define XFreeColormap XFREECOLORMAP
+#define XFreeColors XFREECOLORS
+#define XFreeCursor XFREECURSOR
+#define XFreeDeviceList XFREEDEVICELIST
+#define XFreeDeviceState XFREEDEVICESTATE
+#define XFreeFont XFREEFONT
+#define XFreeFontInfo XFREEFONTINFO
+#define XFreeFontNames XFREEFONTNAMES
+#define XFreeFontSet XFREEFONTSET
+#define XFreeGC XFREEGC
+#define XFreeModifiermap XFREEMODIFIERMAP
+#define XFreePixmap XFREEPIXMAP
+#define XFreeStringList XFREESTRINGLIST
+#define XGContextFromGC XGCONTEXTFROMGC
+#define XGeometry XGEOMETRY
+#define XGetAtomName XGETATOMNAME
+#define XGetCommand XGETCOMMAND
+#define XGetDefault XGETDEFAULT
+#define XGetErrorDatabaseText XGETERRORDATABASETEXT
+#define XGetErrorText XGETERRORTEXT
+#define XGetExtensionVersion XGETEXTENSIONVERSION
+#define XGetFontProperty XGETFONTPROPERTY
+#define XGetGCValues XGETGCVALUES
+#define XGetGeometry XGETGEOMETRY
+#define XGetICValues XGETICVALUES
+#define XGetIMValues XGETIMVALUES
+#define XGetIconName XGETICONNAME
+#define XGetIconSizes XGETICONSIZES
+#define XGetImage XGETIMAGE
+#define XGetInputFocus XGETINPUTFOCUS
+#define XGetKeyboardControl XGETKEYBOARDCONTROL
+#define XGetKeyboardMapping XGETKEYBOARDMAPPING
+#define XGetModifierMapping XGETMODIFIERMAPPING
+#define XGetMotionEvents XGETMOTIONEVENTS
+#define XGetNormalHints XGETNORMALHINTS
+#define XGetPointerMapping XGETPOINTERMAPPING
+#define XGetRGBColormaps XGETRGBCOLORMAPS
+#define XGetScreenSaver XGETSCREENSAVER
+#define XGetSelectionOwner XGETSELECTIONOWNER
+#define XGetStandardColormap XGETSTANDARDCOLORMAP
+#define XGetSubImage XGETSUBIMAGE
+#define XGetTextProperty XGETTEXTPROPERTY
+#define XGetVisualInfo XGETVISUALINFO
+#define XGetWMColormapWindows XGETWMCOLORMAPWINDOWS
+#define XGetWMHints XGETWMHINTS
+#define XGetWMIconName XGETWMICONNAME
+#define XGetWMName XGETWMNAME
+#define XGetWMNormalHints XGETWMNORMALHINTS
+#define XGetWindowAttributes XGETWINDOWATTRIBUTES
+#define XGetWindowProperty XGETWINDOWPROPERTY
+#define XGrabButton XGRABBUTTON
+#define XGrabKeyboard XGRABKEYBOARD
+#define XGrabPointer XGRABPOINTER
+#define XGrabServer XGRABSERVER
+#define XHeightMMOfScreen XHEIGHTMMOFSCREEN
+#define XHeightOfScreen XHEIGHTOFSCREEN
+#define XIconifyWindow XICONIFYWINDOW
+#define XIfEvent XIFEVENT
+#define XInitExtension XINITEXTENSION
+#define XInitImage XINITIMAGE
+#define XInstallColormap XINSTALLCOLORMAP
+#define XInternAtom XINTERNATOM
+#define XInternAtoms XINTERNATOMS
+#define XIntersectRegion XINTERSECTREGION
+#define XKeycodeToKeysym XKEYCODETOKEYSYM
+#define XKeysymToKeycode XKEYSYMTOKEYCODE
+#define XKeysymToString XKEYSYMTOSTRING
+#define XKillClient XKILLCLIENT
+#define XListDepths XLISTDEPTHS
+#define XListFonts XLISTFONTS
+#define XListFontsWithInfo XLISTFONTSWITHINFO
+#define XListHosts XLISTHOSTS
+#define XListInputDevices XLISTINPUTDEVICES
+#define XListInstalledColormaps XLISTINSTALLEDCOLORMAPS
+#define XListPixmapFormats XLISTPIXMAPFORMATS
+#define XListProperties XLISTPROPERTIES
+#define XLoadFont XLOADFONT
+#define XLoadQueryFont XLOADQUERYFONT
+#define XLookupColor XLOOKUPCOLOR
+#define XLookupKeysym XLOOKUPKEYSYM
+#define XLookupString XLOOKUPSTRING
+#define XLowerWindow XLOWERWINDOW
+#define XMapRaised XMAPRAISED
+#define XMapSubwindows XMAPSUBWINDOWS
+#define XMapWindow XMAPWINDOW
+#define XMatchVisualInfo XMATCHVISUALINFO
+#define XMaxRequestSize XMAXREQUESTSIZE
+#define XMissingExtension XMISSINGEXTENSION
+#define XMoveResizeWindow XMOVERESIZEWINDOW
+#define XMoveWindow XMOVEWINDOW
+#define XNextEvent XNEXTEVENT
+#define XNextRequest XNEXTREQUEST
+#define XNoOp XNOOP
+#define XOffsetRegion XOFFSETREGION
+#define XOpenDevice XOPENDEVICE
+#define XOpenDisplay XOPENDISPLAY
+#define XOpenIM XOPENIM
+#define XParseColor XPARSECOLOR
+#define XParseGeometry XPARSEGEOMETRY
+#define XPeekEvent XPEEKEVENT
+#define XPeekIfEvent XPEEKIFEVENT
+#define XPending XPENDING
+#define XPointInRegion XPOINTINREGION
+#define XPolygonRegion XPOLYGONREGION
+#define XPutBackEvent XPUTBACKEVENT
+#define XPutImage XPUTIMAGE
+#define XQLength XQLENGTH
+#define XQueryBestCursor XQUERYBESTCURSOR
+#define XQueryBestStipple XQUERYBESTSTIPPLE
+#define XQueryColor XQUERYCOLOR
+#define XQueryColors XQUERYCOLORS
+#define XQueryDeviceState XQUERYDEVICESTATE
+#define XQueryExtension XQUERYEXTENSION
+#define XQueryFont XQUERYFONT
+#define XQueryKeymap XQUERYKEYMAP
+#define XQueryPointer XQUERYPOINTER
+#define XQueryTree XQUERYTREE
+#define XRaiseWindow XRAISEWINDOW
+#define XReadBitmapFile XREADBITMAPFILE
+#define XRecolorCursor XRECOLORCURSOR
+#define XReconfigureWMWindow XRECONFIGUREWMWINDOW
+#define XRectInRegion XRECTINREGION
+#define XRefreshKeyboardMapping XREFRESHKEYBOARDMAPPING
+#define XRemoveHosts XREMOVEHOSTS
+#define XReparentWindow XREPARENTWINDOW
+#define XResetScreenSaver XRESETSCREENSAVER
+#define XResizeWindow XRESIZEWINDOW
+#define XResourceManagerString XRESOURCEMANAGERSTRING
+#define XRestackWindows XRESTACKWINDOWS
+#define XRotateBuffers XROTATEBUFFERS
+#define XRootWindow XROOTWINDOW
+#define XRootWindowOfScreen XROOTWINDOWOFSCREEN
+#define XSaveContext XSAVECONTEXT
+#define XScreenNumberOfScreen XSCREENNUMBEROFSCREEN
+#define XScreenOfDisplay XSCREENOFDISPLAY
+#define XSelectAsyncEvent XSELECTASYNCEVENT
+#define XSelectAsyncInput XSELECTASYNCINPUT
+#define XSelectExtensionEvent XSELECTEXTENSIONEVENT
+#define XSelectInput XSELECTINPUT
+#define XSendEvent XSENDEVENT
+#define XServerVendor XSERVERVENDOR
+#define XSetArcMode XSETARCMODE
+#define XSetBackground XSETBACKGROUND
+#define XSetClassHint XSETCLASSHINT
+#define XSetClipMask XSETCLIPMASK
+#define XSetClipOrigin XSETCLIPORIGIN
+#define XSetClipRectangles XSETCLIPRECTANGLES
+#define XSetCloseDownMode XSETCLOSEDOWNMODE
+#define XSetCommand XSETCOMMAND
+#define XSetDashes XSETDASHES
+#define XSetErrorHandler XSETERRORHANDLER
+#define XSetFillRule XSETFILLRULE
+#define XSetFillStyle XSETFILLSTYLE
+#define XSetFont XSETFONT
+#define XSetForeground XSETFOREGROUND
+#define XSetFunction XSETFUNCTION
+#define XSetGraphicsExposures XSETGRAPHICSEXPOSURES
+#define XSetICFocus XSETICFOCUS
+#define XSetICValues XSETICVALUES
+#define XSetIOErrorHandler XSETIOERRORHANDLER
+#define XSetIconName XSETICONNAME
+#define XSetInputFocus XSETINPUTFOCUS
+#define XSetLineAttributes XSETLINEATTRIBUTES
+#define XSetLocaleModifiers XSETLOCALEMODIFIERS
+#define XSetNormalHints XSETNORMALHINTS
+#define XSetPlaneMask XSETPLANEMASK
+#define XSetRegion XSETREGION
+#define XSetRGBColormaps XSETRGBCOLORMAPS
+#define XSetScreenSaver XSETSCREENSAVER
+#define XSetSelectionOwner XSETSELECTIONOWNER
+#define XSetStandardProperties XSETSTANDARDPROPERTIES
+#define XSetState XSETSTATE
+#define XSetStipple XSETSTIPPLE
+#define XSetSubwindowMode XSETSUBWINDOWMODE
+#define XSetTSOrigin XSETTSORIGIN
+#define XSetTextProperty XSETTEXTPROPERTY
+#define XSetTile XSETTILE
+#define XSetTransientForHint XSETTRANSIENTFORHINT
+#define XSetWMClientMachine XSETWMCLIENTMACHINE
+#define XSetWMColormapWindows XSETWMCOLORMAPWINDOWS
+#define XSetWMHints XSETWMHINTS
+#define XSetWMIconName XSETWMICONNAME
+#define XSetWMName XSETWMNAME
+#define XSetWMNormalHints XSETWMNORMALHINTS
+#define XSetWMProperties XSETWMPROPERTIES
+#define XSetWMProtocols XSETWMPROTOCOLS
+#define XSetWMSizeHints XSETWMSIZEHINTS
+#define XSetWindowBackground XSETWINDOWBACKGROUND
+#define XSetWindowBackgroundPixmap XSETWINDOWBACKGROUNDPIXMAP
+#define XSetWindowBorder XSETWINDOWBORDER
+#define XSetWindowBorderPixmap XSETWINDOWBORDERPIXMAP
+#define XSetWindowBorderWidth XSETWINDOWBORDERWIDTH
+#define XSetWindowColormap XSETWINDOWCOLORMAP
+#define XShapeCombineMask XSHAPECOMBINEMASK
+#define XShapeCombineRectangles XSHAPECOMBINERECTANGLES
+#define XShapeGetRectangles XSHAPEGETRECTANGLES
+#define XShapeQueryExtension XSHAPEQUERYEXTENSION
+#define XShmAttach XSHMATTACH
+#define XShmCreateImage XSHMCREATEIMAGE
+#define XShmCreatePixmap XSHMCREATEPIXMAP
+#define XShmDetach XSHMDETACH
+#define XShmGetEventBase XSHMGETEVENTBASE
+#define XShmPutImage XSHMPUTIMAGE
+#define XShmQueryExtension XSHMQUERYEXTENSION
+#define XShmQueryVersion XSHMQUERYVERSION
+#define XShrinkRegion XSHRINKREGION
+#define XStoreBuffer XSTOREBUFFER
+#define XStoreBytes XSTOREBYTES
+#define XStoreColor XSTORECOLOR
+#define XStoreColors XSTORECOLORS
+#define XStoreName XSTORENAME
+#define XStringListToTextProperty XSTRINGLISTTOTEXTPROPERTY
+#define XStringToKeysym XSTRINGTOKEYSYM
+#define XSubtractRegion XSUBTRACTREGION
+#define XSupportsLocale XSUPPORTSLOCALE
+#define XSync XSYNC
+#define XSynchronize XSYNCHRONIZE
+#define XTextExtents XTEXTEXTENTS
+#define XTextExtents16 XTEXTEXTENTS16
+#define XTextPropertyToStringList XTEXTPROPERTYTOSTRINGLIST
+#define XTextWidth XTEXTWIDTH
+#define XTextWidth16 XTEXTWIDTH16
+#define XTranslateCoordinates XTRANSLATECOORDINATES
+#define XUndefineCursor XUNDEFINECURSOR
+#define XUngrabButton XUNGRABBUTTON
+#define XUngrabKeyboard XUNGRABKEYBOARD
+#define XUngrabPointer XUNGRABPOINTER
+#define XUngrabServer XUNGRABSERVER
+#define XUninstallColormap XUNINSTALLCOLORMAP
+#define XUnionRectWithRegion XUNIONRECTWITHREGION
+#define XUnionRegion XUNIONREGION
+#define XUniqueContext XUNIQUECONTEXT
+#define XUnmapWindow XUNMAPWINDOW
+#define XUnsetICFocus XUNSETICFOCUS
+#define XVaCreateNestedList XVACREATENESTEDLIST
+#define XVisualIDFromVisual XVISUALIDFROMVISUAL
+#define XWMGeometry XWMGEOMETRY
+#define XWarpPointer XWARPPOINTER
+#define XWhitePixel XWHITEPIXEL
+#define XWhitePixelOfScreen XWHITEPIXELOFSCREEN
+#define XWidthMMOfScreen XWIDTHMMOFSCREEN
+#define XWidthOfScreen XWIDTHOFSCREEN
+#define XWindowEvent XWINDOWEVENT
+#define XWithdrawWindow XWITHDRAWWINDOW
+#define XXorRegion XXORREGION
+#define XcmsQueryColor XCMSQUERYCOLOR
+#define XdbeAllocateBackBufferName XDBEALLOCATEBACKBUFFERNAME
+#define XdbeFreeVisualInfo XDBEFREEVISUALINFO
+#define XdbeGetVisualInfo XDBEGETVISUALINFO
+#define XdbeQueryExtension XDBEQUERYEXTENSION
+#define XdbeSwapBuffers XDBESWAPBUFFERS
+#define XextAddDisplay XEXTADDDISPLAY
+#define XextFindDisplay XEXTFINDDISPLAY
+#define XextRemoveDisplay XEXTREMOVEDISPLAY
+#define XkbSetDetectableAutoRepeat XKBSETDETECTABLEAUTOREPEAT
+#define XmActivateProtocol XMACTIVATEPROTOCOL
+#define XmAddProtocolCallback XMADDPROTOCOLCALLBACK
+#define XmAddProtocols XMADDPROTOCOLS
+#define XmChangeColor XMCHANGECOLOR
+#define XmClipboardCopy XMCLIPBOARDCOPY
+#define XmClipboardCopyByName XMCLIPBOARDCOPYBYNAME
+#define XmClipboardEndCopy XMCLIPBOARDENDCOPY
+#define XmClipboardEndRetrieve XMCLIPBOARDENDRETRIEVE
+#define XmClipboardInquireCount XMCLIPBOARDINQUIRECOUNT
+#define XmClipboardInquireFormat XMCLIPBOARDINQUIREFORMAT
+#define XmClipboardInquireLength XMCLIPBOARDINQUIRELENGTH
+#define XmClipboardLock XMCLIPBOARDLOCK
+#define XmClipboardRetrieve XMCLIPBOARDRETRIEVE
+#define XmClipboardStartCopy XMCLIPBOARDSTARTCOPY
+#define XmClipboardStartRetrieve XMCLIPBOARDSTARTRETRIEVE
+#define XmClipboardUnlock XMCLIPBOARDUNLOCK
+#define XmCommandError XMCOMMANDERROR
+#define XmCommandGetChild XMCOMMANDGETCHILD
+#define XmCommandSetValue XMCOMMANDSETVALUE
+#define XmCreateArrowButton XMCREATEARROWBUTTON
+#define XmCreateArrowButtonGadget XMCREATEARROWBUTTONGADGET
+#define XmCreateBulletinBoardDialog XMCREATEBULLETINBOARDDIALOG
+#define XmCreateCascadeButton XMCREATECASCADEBUTTON
+#define XmCreateCascadeButtonGadget XMCREATECASCADEBUTTONGADGET
+#define XmCreateDialogShell XMCREATEDIALOGSHELL
+#define XmCreateDragIcon XMCREATEDRAGICON
+#define XmCreateDrawingArea XMCREATEDRAWINGAREA
+#define XmCreateDrawnButton XMCREATEDRAWNBUTTON
+#define XmCreateErrorDialog XMCREATEERRORDIALOG
+#define XmCreateFileSelectionBox XMCREATEFILESELECTIONBOX
+#define XmCreateFileSelectionDialog XMCREATEFILESELECTIONDIALOG
+#define XmCreateForm XMCREATEFORM
+#define XmCreateFormDialog XMCREATEFORMDIALOG
+#define XmCreateFrame XMCREATEFRAME
+#define XmCreateInformationDialog XMCREATEINFORMATIONDIALOG
+#define XmCreateLabel XMCREATELABEL
+#define XmCreateLabelGadget XMCREATELABELGADGET
+#define XmCreateList XMCREATELIST
+#define XmCreateMainWindow XMCREATEMAINWINDOW
+#define XmCreateMenuBar XMCREATEMENUBAR
+#define XmCreateMessageBox XMCREATEMESSAGEBOX
+#define XmCreateMessageDialog XMCREATEMESSAGEDIALOG
+#define XmCreateOptionMenu XMCREATEOPTIONMENU
+#define XmCreatePanedWindow XMCREATEPANEDWINDOW
+#define XmCreatePopupMenu XMCREATEPOPUPMENU
+#define XmCreatePromptDialog XMCREATEPROMPTDIALOG
+#define XmCreatePulldownMenu XMCREATEPULLDOWNMENU
+#define XmCreatePushButton XMCREATEPUSHBUTTON
+#define XmCreatePushButtonGadget XMCREATEPUSHBUTTONGADGET
+#define XmCreateQuestionDialog XMCREATEQUESTIONDIALOG
+#define XmCreateRadioBox XMCREATERADIOBOX
+#define XmCreateRowColumn XMCREATEROWCOLUMN
+#define XmCreateScale XMCREATESCALE
+#define XmCreateScrollBar XMCREATESCROLLBAR
+#define XmCreateScrolledList XMCREATESCROLLEDLIST
+#define XmCreateScrolledText XMCREATESCROLLEDTEXT
+#define XmCreateScrolledWindow XMCREATESCROLLEDWINDOW
+#define XmCreateSelectionDialog XMCREATESELECTIONDIALOG
+#define XmCreateSeparator XMCREATESEPARATOR
+#define XmCreateSeparatorGadget XMCREATESEPARATORGADGET
+#define XmCreateTemplateDialog XMCREATETEMPLATEDIALOG
+#define XmCreateText XMCREATETEXT
+#define XmCreateTextField XMCREATETEXTFIELD
+#define XmCreateToggleButton XMCREATETOGGLEBUTTON
+#define XmCreateToggleButtonGadget XMCREATETOGGLEBUTTONGADGET
+#define XmCreateWarningDialog XMCREATEWARNINGDIALOG
+#define XmCvtCTToXmString XMCVTCTTOXMSTRING
+#define XmDestroyPixmap XMDESTROYPIXMAP
+#define XmDragStart XMDRAGSTART
+#define XmDropSiteRegister XMDROPSITEREGISTER
+#define XmDropSiteUnregister XMDROPSITEUNREGISTER
+#define XmDropSiteUpdate XMDROPSITEUPDATE
+#define XmDropTransferStart XMDROPTRANSFERSTART
+#define XmFileSelectionBoxGetChild XMFILESELECTIONBOXGETCHILD
+#define XmFileSelectionDoSearch XMFILESELECTIONDOSEARCH
+#define XmFontListAppendEntry XMFONTLISTAPPENDENTRY
+#define XmFontListCopy XMFONTLISTCOPY
+#define XmFontListCreate XMFONTLISTCREATE
+#define XmFontListEntryCreate XMFONTLISTENTRYCREATE
+#define XmFontListEntryFree XMFONTLISTENTRYFREE
+#define XmFontListEntryGetFont XMFONTLISTENTRYGETFONT
+#define XmFontListEntryGetTag XMFONTLISTENTRYGETTAG
+#define XmFontListEntryLoad XMFONTLISTENTRYLOAD
+#define XmFontListFree XMFONTLISTFREE
+#define XmFontListFreeFontContext XMFONTLISTFREEFONTCONTEXT
+#define XmFontListGetNextFont XMFONTLISTGETNEXTFONT
+#define XmFontListInitFontContext XMFONTLISTINITFONTCONTEXT
+#define XmFontListNextEntry XMFONTLISTNEXTENTRY
+#define XmGetColors XMGETCOLORS
+#define XmGetColorCalculation XMGETCOLORCALCULATION
+#define XmGetFocusWidget XMGETFOCUSWIDGET
+#define XmGetMenuCursor XMGETMENUCURSOR
+#define XmGetPixmap XMGETPIXMAP
+#define XmGetPixmapByDepth XMGETPIXMAPBYDEPTH
+#define XmGetTearOffControl XMGETTEAROFFCONTROL
+#define XmGetXmDisplay XMGETXMDISPLAY
+#define XmImMbLookupString XMIMMBLOOKUPSTRING
+#define XmImRegister XMIMREGISTER
+#define XmImSetFocusValues XMIMSETFOCUSVALUES
+#define XmImSetValues XMIMSETVALUES
+#define XmImUnregister XMIMUNREGISTER
+#define XmImUnsetFocus XMIMUNSETFOCUS
+#define XmInstallImage XMINSTALLIMAGE
+#define XmInternAtom XMINTERNATOM
+#define XmIsMotifWMRunning XMISMOTIFWMRUNNING
+#define XmListAddItem XMLISTADDITEM
+#define XmListAddItemUnselected XMLISTADDITEMUNSELECTED
+#define XmListAddItems XMLISTADDITEMS
+#define XmListAddItemsUnselected XMLISTADDITEMSUNSELECTED
+#define XmListDeleteAllItems XMLISTDELETEALLITEMS
+#define XmListDeleteItem XMLISTDELETEITEM
+#define XmListDeleteItemsPos XMLISTDELETEITEMSPOS
+#define XmListDeletePos XMLISTDELETEPOS
+#define XmListDeselectAllItems XMLISTDESELECTALLITEMS
+#define XmListDeselectPos XMLISTDESELECTPOS
+#define XmListGetKbdItemPos XMLISTGETKBDITEMPOS
+#define XmListGetMatchPos XMLISTGETMATCHPOS
+#define XmListGetSelectedPos XMLISTGETSELECTEDPOS
+#define XmListItemExists XMLISTITEMEXISTS
+#define XmListItemPos XMLISTITEMPOS
+#define XmListPosSelected XMLISTPOSSELECTED
+#define XmListReplaceItems XMLISTREPLACEITEMS
+#define XmListReplaceItemsPos XMLISTREPLACEITEMSPOS
+#define XmListSelectItem XMLISTSELECTITEM
+#define XmListSelectPos XMLISTSELECTPOS
+#define XmListSetBottomPos XMLISTSETBOTTOMPOS
+#define XmListSetItem XMLISTSETITEM
+#define XmListSetKbdItemPos XMLISTSETKBDITEMPOS
+#define XmListSetPos XMLISTSETPOS
+#define XmMainWindowSetAreas XMMAINWINDOWSETAREAS
+#define XmMenuPosition XMMENUPOSITION
+#define XmMessageBoxGetChild XMMESSAGEBOXGETCHILD
+#define XmOptionButtonGadget XMOPTIONBUTTONGADGET
+#define XmOptionLabelGadget XMOPTIONLABELGADGET
+#define XmProcessTraversal XMPROCESSTRAVERSAL
+#define XmQmotif XMQMOTIF
+#define XmRemoveProtocolCallback XMREMOVEPROTOCOLCALLBACK
+#define XmRemoveProtocols XMREMOVEPROTOCOLS
+#define XmRemoveTabGroup XMREMOVETABGROUP
+#define XmRepTypeGetId XMREPTYPEGETID
+#define XmRepTypeGetRecord XMREPTYPEGETRECORD
+#define XmRepTypeInstallTearOffModelCon XMREPTYPEINSTALLTEAROFFMODELCON
+#define XmRepTypeRegister XMREPTYPEREGISTER
+#define XmRepTypeValidValue XMREPTYPEVALIDVALUE
+#define XmScrollBarGetValues XMSCROLLBARGETVALUES
+#define XmScrollBarSetValues XMSCROLLBARSETVALUES
+#define XmScrolledWindowSetAreas XMSCROLLEDWINDOWSETAREAS
+#define XmSelectionBoxGetChild XMSELECTIONBOXGETCHILD
+#define XmSetColorCalculation XMSETCOLORCALCULATION
+#define XmStringByteCompare XMSTRINGBYTECOMPARE
+#define XmStringCompare XMSTRINGCOMPARE
+#define XmStringConcat XMSTRINGCONCAT
+#define XmStringCopy XMSTRINGCOPY
+#define XmStringCreate XMSTRINGCREATE
+#define XmStringCreateLocalized XMSTRINGCREATELOCALIZED
+#define XmStringCreateLtoR XMSTRINGCREATELTOR
+#define XmStringCreateSimple XMSTRINGCREATESIMPLE
+#define XmStringDraw XMSTRINGDRAW
+#define XmStringDrawUnderline XMSTRINGDRAWUNDERLINE
+#define XmStringExtent XMSTRINGEXTENT
+#define XmStringFree XMSTRINGFREE
+#define XmStringFreeContext XMSTRINGFREECONTEXT
+#define XmStringGetLtoR XMSTRINGGETLTOR
+#define XmStringGetNextComponent XMSTRINGGETNEXTCOMPONENT
+#define XmStringGetNextSegment XMSTRINGGETNEXTSEGMENT
+#define XmStringInitContext XMSTRINGINITCONTEXT
+#define XmStringLength XMSTRINGLENGTH
+#define XmStringLtoRCreate XMSTRINGLTORCREATE
+#define XmStringNConcat XMSTRINGNCONCAT
+#define XmStringSegmentCreate XMSTRINGSEGMENTCREATE
+#define XmStringSeparatorCreate XMSTRINGSEPARATORCREATE
+#define XmStringWidth XMSTRINGWIDTH
+#define XmTextClearSelection XMTEXTCLEARSELECTION
+#define XmTextCopy XMTEXTCOPY
+#define XmTextCut XMTEXTCUT
+#define XmTextFieldClearSelection XMTEXTFIELDCLEARSELECTION
+#define XmTextFieldCopy XMTEXTFIELDCOPY
+#define XmTextFieldCut XMTEXTFIELDCUT
+#define XmTextFieldGetEditable XMTEXTFIELDGETEDITABLE
+#define XmTextFieldGetInsertionPosition XMTEXTFIELDGETINSERTIONPOSITION
+#define XmTextFieldGetLastPosition XMTEXTFIELDGETLASTPOSITION
+#define XmTextFieldGetMaxLength XMTEXTFIELDGETMAXLENGTH
+#define XmTextFieldGetSelection XMTEXTFIELDGETSELECTION
+#define XmTextFieldGetSelectionPosition XMTEXTFIELDGETSELECTIONPOSITION
+#define XmTextFieldGetString XMTEXTFIELDGETSTRING
+#define XmTextFieldInsert XMTEXTFIELDINSERT
+#define XmTextFieldPaste XMTEXTFIELDPASTE
+#define XmTextFieldRemove XMTEXTFIELDREMOVE
+#define XmTextFieldReplace XMTEXTFIELDREPLACE
+#define XmTextFieldSetAddMode XMTEXTFIELDSETADDMODE
+#define XmTextFieldSetHighlight XMTEXTFIELDSETHIGHLIGHT
+#define XmTextFieldSetInsertionPosition XMTEXTFIELDSETINSERTIONPOSITION
+#define XmTextFieldSetMaxLength XMTEXTFIELDSETMAXLENGTH
+#define XmTextFieldSetSelection XMTEXTFIELDSETSELECTION
+#define XmTextFieldSetString XMTEXTFIELDSETSTRING
+#define XmTextFieldShowPosition XMTEXTFIELDSHOWPOSITION
+#define XmTextGetCursorPosition XMTEXTGETCURSORPOSITION
+#define XmTextGetEditable XMTEXTGETEDITABLE
+#define XmTextGetInsertionPosition XMTEXTGETINSERTIONPOSITION
+#define XmTextGetLastPosition XMTEXTGETLASTPOSITION
+#define XmTextGetMaxLength XMTEXTGETMAXLENGTH
+#define XmTextGetSelection XMTEXTGETSELECTION
+#define XmTextGetSelectionPosition XMTEXTGETSELECTIONPOSITION
+#define XmTextGetString XMTEXTGETSTRING
+#define XmTextInsert XMTEXTINSERT
+#define XmTextPaste XMTEXTPASTE
+#define XmTextPosToXY XMTEXTPOSTOXY
+#define XmTextRemove XMTEXTREMOVE
+#define XmTextReplace XMTEXTREPLACE
+#define XmTextSetCursorPosition XMTEXTSETCURSORPOSITION
+#define XmTextSetEditable XMTEXTSETEDITABLE
+#define XmTextSetHighlight XMTEXTSETHIGHLIGHT
+#define XmTextSetInsertionPosition XMTEXTSETINSERTIONPOSITION
+#define XmTextSetSelection XMTEXTSETSELECTION
+#define XmTextSetString XMTEXTSETSTRING
+#define XmTextSetTopCharacter XMTEXTSETTOPCHARACTER
+#define XmTextShowPosition XMTEXTSHOWPOSITION
+#define XmToggleButtonGadgetGetState XMTOGGLEBUTTONGADGETGETSTATE
+#define XmToggleButtonGadgetSetState XMTOGGLEBUTTONGADGETSETSTATE
+#define XmToggleButtonGetState XMTOGGLEBUTTONGETSTATE
+#define XmToggleButtonSetState XMTOGGLEBUTTONSETSTATE
+#define XmUninstallImage XMUNINSTALLIMAGE
+#define XmUpdateDisplay XMUPDATEDISPLAY
+#define XmVaCreateSimpleRadioBox XMVACREATESIMPLERADIOBOX
+#define XmbDrawString XMBDRAWSTRING
+#define XmbLookupString XMBLOOKUPSTRING
+#define XmbResetIC XMBRESETIC
+#define XmbSetWMProperties XMBSETWMPROPERTIES
+#define XmbTextEscapement XMBTEXTESCAPEMENT
+#define XmbTextExtents XMBTEXTEXTENTS
+#define XmbTextListToTextProperty XMBTEXTLISTTOTEXTPROPERTY
+#define XmbTextPropertyToTextList XMBTEXTPROPERTYTOTEXTLIST
+#define XmbufCreateBuffers XMBUFCREATEBUFFERS
+#define XmbufDestroyBuffers XMBUFDESTROYBUFFERS
+#define XmbufDisplayBuffers XMBUFDISPLAYBUFFERS
+#define XmbufQueryExtension XMBUFQUERYEXTENSION
+#define Xmemory_free XMEMORY_FREE
+#define Xmemory_malloc XMEMORY_MALLOC
+#define XmuClientWindow XMUCLIENTWINDOW
+#define XmuConvertStandardSelection XMUCONVERTSTANDARDSELECTION
+#define XmuCvtStringToBitmap XMUCVTSTRINGTOBITMAP
+#define XmuInternAtom XMUINTERNATOM
+#define XmuInternStrings XMUINTERNSTRINGS
+#define XmuLookupStandardColormap XMULOOKUPSTANDARDCOLORMAP
+#define XmuPrintDefaultErrorMessage XMUPRINTDEFAULTERRORMESSAGE
+#define XrmCombineDatabase XRMCOMBINEDATABASE
+#define XrmCombineFileDatabase XRMCOMBINEFILEDATABASE
+#define XrmDestroyDatabase XRMDESTROYDATABASE
+#define XrmGetDatabase XRMGETDATABASE
+#define XrmGetFileDatabase XRMGETFILEDATABASE
+#define XrmGetResource XRMGETRESOURCE
+#define XrmGetStringDatabase XRMGETSTRINGDATABASE
+#define XrmInitialize XRMINITIALIZE
+#define XrmMergeDatabases XRMMERGEDATABASES
+#define XrmParseCommand XRMPARSECOMMAND
+#define XrmPermStringToQuark XRMPERMSTRINGTOQUARK
+#define XrmPutFileDatabase XRMPUTFILEDATABASE
+#define XrmPutLineResource XRMPUTLINERESOURCE
+#define XrmPutStringResource XRMPUTSTRINGRESOURCE
+#define XrmQGetResource XRMQGETRESOURCE
+#define XrmQPutStringResource XRMQPUTSTRINGRESOURCE
+#define XrmQuarkToString XRMQUARKTOSTRING
+#define XrmSetDatabase XRMSETDATABASE
+#define XrmStringToBindingQuarkList XRMSTRINGTOBINDINGQUARKLIST
+#define XrmStringToQuark XRMSTRINGTOQUARK
+#define XtAddCallback XTADDCALLBACK
+#define XtAddCallbacks XTADDCALLBACKS
+#define XtAddConverter XTADDCONVERTER
+#define XtAddEventHandler XTADDEVENTHANDLER
+#define XtAddExposureToRegion XTADDEXPOSURETOREGION
+#define XtAddGrab XTADDGRAB
+#define XtAddRawEventHandler XTADDRAWEVENTHANDLER
+#define XtAllocateGC XTALLOCATEGC
+#define XtAppAddActions XTAPPADDACTIONS
+#define XtAppAddInput XTAPPADDINPUT
+#define XtAppAddTimeOut XTAPPADDTIMEOUT
+#define XtAppAddWorkProc XTAPPADDWORKPROC
+#define XtAppCreateShell XTAPPCREATESHELL
+#define XtAppError XTAPPERROR
+#define XtAppErrorMsg XTAPPERRORMSG
+#define XtAppInitialize XTAPPINITIALIZE
+#define XtAppMainLoop XTAPPMAINLOOP
+#define XtAppNextEvent XTAPPNEXTEVENT
+#define XtAppPeekEvent XTAPPPEEKEVENT
+#define XtAppPending XTAPPPENDING
+#define XtAppProcessEvent XTAPPPROCESSEVENT
+#define XtAppSetErrorHandler XTAPPSETERRORHANDLER
+#define XtAppSetFallbackResources XTAPPSETFALLBACKRESOURCES
+#define XtAppSetTypeConverter XTAPPSETTYPECONVERTER
+#define XtAppSetWarningHandler XTAPPSETWARNINGHANDLER
+#define XtAppWarningMsg XTAPPWARNINGMSG
+#define XtAppSetWarningMsgHandler XTAPPSETWARNINGMSGHANDLER
+#define XtAppWarning XTAPPWARNING
+#define XtAugmentTranslations XTAUGMENTTRANSLATIONS
+#define XtCallActionProc XTCALLACTIONPROC
+#define XtCallCallbackList XTCALLCALLBACKLIST
+#define XtCallCallbacks XTCALLCALLBACKS
+#define XtCallConverter XTCALLCONVERTER
+#define XtCalloc XTCALLOC
+#ifndef NOXTDISPLAY
+#define XtClass XTCLASS
+#endif
+#define XtCloseDisplay XTCLOSEDISPLAY
+#define XtConfigureWidget XTCONFIGUREWIDGET
+#define XtConvert XTCONVERT
+#define XtConvertAndStore XTCONVERTANDSTORE
+#define XtCreateApplicationContext XTCREATEAPPLICATIONCONTEXT
+#define XtCreateManagedWidget XTCREATEMANAGEDWIDGET
+#define XtCreatePopupShell XTCREATEPOPUPSHELL
+#define XtCreateWidget XTCREATEWIDGET
+#define XtCreateWindow XTCREATEWINDOW
+#define XtCvtStringToFont XTCVTSTRINGTOFONT
+#define XtDatabase XTDATABASE
+#define XtDestroyApplicationContext XTDESTROYAPPLICATIONCONTEXT
+#define XtDestroyWidget XTDESTROYWIDGET
+#define XtDisownSelection XTDISOWNSELECTION
+#define XtDispatchEvent XTDISPATCHEVENT
+#ifndef NOXTDISPLAY
+#define XtDisplay XTDISPLAY
+#endif
+#define XtDisplayOfObject XTDISPLAYOFOBJECT
+#define XtDisplayStringConvWarning XTDISPLAYSTRINGCONVWARNING
+#define XtDisplayToApplicationContext XTDISPLAYTOAPPLICATIONCONTEXT
+#define XtError XTERROR
+#define XtErrorMsg XTERRORMSG
+#define XtFree XTFREE
+#define XtGetActionKeysym XTGETACTIONKEYSYM
+#define XtGetActionList XTGETACTIONLIST
+#define XtGetApplicationNameAndClass XTGETAPPLICATIONNAMEANDCLASS
+#define XtGetApplicationResources XTGETAPPLICATIONRESOURCES
+#define XtGetClassExtension XTGETCLASSEXTENSION
+#define XtGetConstraintResourceList XTGETCONSTRAINTRESOURCELIST
+#define XtGetGC XTGETGC
+#define XtGetMultiClickTime XTGETMULTICLICKTIME
+#define XtGetResourceList XTGETRESOURCELIST
+#define XtGetSelectionValue XTGETSELECTIONVALUE
+#define XtGetSelectionValues XTGETSELECTIONVALUES
+#define XtGetSubresources XTGETSUBRESOURCES
+#define XtGetValues XTGETVALUES
+#define XtGrabButton XTGRABBUTTON
+#define XtGrabKeyboard XTGRABKEYBOARD
+#define XtGrabPointer XTGRABPOINTER
+#define XtHasCallbacks XTHASCALLBACKS
+#define XtInitialize XTINITIALIZE
+#define XtInitializeWidgetClass XTINITIALIZEWIDGETCLASS
+#define XtInsertEventHandler XTINSERTEVENTHANDLER
+#define XtInsertRawEventHandler XTINSERTRAWEVENTHANDLER
+#define XtInstallAccelerators XTINSTALLACCELERATORS
+#define XtIsManaged XTISMANAGED
+#define XtIsObject XTISOBJECT
+#ifndef NOXTDISPLAY
+#define XtIsRealized XTISREALIZED
+#endif
+#define XtIsSensitive XTISSENSITIVE
+#define XtIsSubclass XTISSUBCLASS
+#define XtLastTimestampProcessed XTLASTTIMESTAMPPROCESSED
+#define XtMainLoop XTMAINLOOP
+#define XtMakeGeometryRequest XTMAKEGEOMETRYREQUEST
+#define XtMakeResizeRequest XTMAKERESIZEREQUEST
+#define XtMalloc XTMALLOC
+#define XtManageChild XTMANAGECHILD
+#define XtManageChildren XTMANAGECHILDREN
+#define XtMergeArgLists XTMERGEARGLISTS
+#define XtMoveWidget XTMOVEWIDGET
+#define XtName XTNAME
+#define XtNameToWidget XTNAMETOWIDGET
+#define XtOpenApplication XTOPENAPPLICATION
+#define XtOpenDisplay XTOPENDISPLAY
+#define XtOverrideTranslations XTOVERRIDETRANSLATIONS
+#define XtOwnSelection XTOWNSELECTION
+#ifndef NOXTDISPLAY
+#define XtParent XTPARENT
+#endif
+#define XtParseAcceleratorTable XTPARSEACCELERATORTABLE
+#define XtParseTranslationTable XTPARSETRANSLATIONTABLE
+#define XtPopdown XTPOPDOWN
+#define XtPopup XTPOPUP
+#define XtPopupSpringLoaded XTPOPUPSPRINGLOADED
+#define XtQueryGeometry XTQUERYGEOMETRY
+#define XtRealizeWidget XTREALIZEWIDGET
+#define XtRealloc XTREALLOC
+#define XtRegisterDrawable _XTREGISTERWINDOW
+#define XtRegisterGrabAction XTREGISTERGRABACTION
+#define XtReleaseGC XTRELEASEGC
+#define XtRemoveAllCallbacks XTREMOVEALLCALLBACKS
+#define XtRemoveCallback XTREMOVECALLBACK
+#define XtRemoveEventHandler XTREMOVEEVENTHANDLER
+#define XtRemoveGrab XTREMOVEGRAB
+#define XtRemoveInput XTREMOVEINPUT
+#define XtRemoveTimeOut XTREMOVETIMEOUT
+#define XtRemoveWorkProc XTREMOVEWORKPROC
+#define XtResizeWidget XTRESIZEWIDGET
+#define XtResolvePathname XTRESOLVEPATHNAME
+#ifndef NOXTDISPLAY
+#define XtScreen XTSCREEN
+#endif
+#define XtScreenDatabase XTSCREENDATABASE
+#define XtScreenOfObject XTSCREENOFOBJECT
+#define XtSessionReturnToken XTSESSIONRETURNTOKEN
+#define XtSetErrorHandler XTSETERRORHANDLER
+#define XtSetKeyboardFocus XTSETKEYBOARDFOCUS
+#define XtSetLanguageProc XTSETLANGUAGEPROC
+#define XtSetMappedWhenManaged XTSETMAPPEDWHENMANAGED
+#define XtSetSensitive XTSETSENSITIVE
+#define XtSetTypeConverter XTSETTYPECONVERTER
+#define XtSetValues XTSETVALUES
+#define XtShellStrings XTSHELLSTRINGS
+#define XtStringConversionWarning XTSTRINGCONVERSIONWARNING
+#define XtStrings XTSTRINGS
+#define XtToolkitInitialize XTTOOLKITINITIALIZE
+#define XtTranslateCoords XTTRANSLATECOORDS
+#define XtTranslateKeycode XTTRANSLATEKEYCODE
+#define XtUngrabButton XTUNGRABBUTTON
+#define XtUngrabKeyboard XTUNGRABKEYBOARD
+#define XtUngrabPointer XTUNGRABPOINTER
+#define XtUnmanageChild XTUNMANAGECHILD
+#define XtUnmanageChildren XTUNMANAGECHILDREN
+#define XtUnrealizeWidget XTUNREALIZEWIDGET
+#define XtUnregisterDrawable _XTUNREGISTERWINDOW
+#define XtVaCreateManagedWidget XTVACREATEMANAGEDWIDGET
+#define XtVaCreatePopupShell XTVACREATEPOPUPSHELL
+#define XtVaCreateWidget XTVACREATEWIDGET
+#define XtVaGetApplicationResources XTVAGETAPPLICATIONRESOURCES
+#define XtVaGetValues XTVAGETVALUES
+#define XtVaSetValues XTVASETVALUES
+#define XtWarning XTWARNING
+#define XtWarningMsg XTWARNINGMSG
+#define XtWidgetToApplicationContext XTWIDGETTOAPPLICATIONCONTEXT
+#ifndef NOXTDISPLAY
+#define XtWindow XTWINDOW
+#endif
+#define XtWindowOfObject XTWINDOWOFOBJECT
+#define XtWindowToWidget XTWINDOWTOWIDGET
+#define XwcDrawImageString XWCDRAWIMAGESTRING
+#define XwcDrawString XWCDRAWSTRING
+#define XwcFreeStringList XWCFREESTRINGLIST
+#define XwcTextEscapement XWCTEXTESCAPEMENT
+#define XwcTextExtents XWCTEXTEXTENTS
+#define XwcTextListToTextProperty XWCTEXTLISTTOTEXTPROPERTY
+#define XwcLookupString XWCLOOKUPSTRING
+#define XwcTextPropertyToTextList XWCTEXTPROPERTYTOTEXTLIST
+#define _XAllocTemp _XALLOCTEMP
+#define _XDeqAsyncHandler _XDEQASYNCHANDLER
+#define _XEatData _XEATDATA
+#define _XFlush _XFLUSH
+#define _XFreeTemp _XFREETEMP
+#define _XGetAsyncReply _XGETASYNCREPLY
+#define _XInitImageFuncPtrs _XINITIMAGEFUNCPTRS
+#define _XRead _XREAD
+#define _XReadPad _XREADPAD
+#define _XRegisterFilterByType _XREGISTERFILTERBYTYPE
+#define _XReply _XREPLY
+#define _XSend _XSEND
+#define _XUnregisterFilter _XUNREGISTERFILTER
+#define _XVIDtoVisual _XVIDTOVISUAL
+#define _XmBottomShadowColorDefault _XMBOTTOMSHADOWCOLORDEFAULT
+#define _XmClearBorder _XMCLEARBORDER
+#define _XmConfigureObject _XMCONFIGUREOBJECT
+#define _XmDestroyParentCallback _XMDESTROYPARENTCALLBACK
+#define _XmDrawArrow _XMDRAWARROW
+#define _XmDrawShadows _XMDRAWSHADOWS
+#define _XmFontListGetDefaultFont _XMFONTLISTGETDEFAULTFONT
+#define _XmFromHorizontalPixels _XMFROMHORIZONTALPIXELS
+#define _XmFromVerticalPixels _XMFROMVERTICALPIXELS
+#define _XmGetClassExtensionPtr _XMGETCLASSEXTENSIONPTR
+#define _XmGetDefaultFontList _XMGETDEFAULTFONTLIST
+#define _XmGetTextualDragIcon _XMGETTEXTUALDRAGICON
+#define _XmGetWidgetExtData _XMGETWIDGETEXTDATA
+#define _XmGrabKeyboard _XMGRABKEYBOARD
+#define _XmGrabPointer _XMGRABPOINTER
+#define _XmInheritClass _XMINHERITCLASS
+#define _XmInputForGadget _XMINPUTFORGADGET
+#define _XmInputInGadget _XMINPUTINGADGET
+#define _XmMakeGeometryRequest _XMMAKEGEOMETRYREQUEST
+#define _XmMenuPopDown _XMMENUPOPDOWN
+#define _XmMoveObject _XMMOVEOBJECT
+#define _XmNavigChangeManaged _XMNAVIGCHANGEMANAGED
+#define _XmOSBuildFileList _XMOSBUILDFILELIST
+#define _XmOSFileCompare _XMOSFILECOMPARE
+#define _XmOSFindPatternPart _XMOSFINDPATTERNPART
+#define _XmOSQualifyFileSpec _XMOSQUALIFYFILESPEC
+#define _XmPostPopupMenu _XMPOSTPOPUPMENU
+#define _XmPrimitiveEnter _XMPRIMITIVEENTER
+#define _XmPrimitiveLeave _XMPRIMITIVELEAVE
+#define _XmRedisplayGadgets _XMREDISPLAYGADGETS
+#define _XmShellIsExclusive _XMSHELLISEXCLUSIVE
+#define _XmStringDraw _XMSTRINGDRAW
+#define _XmStringGetTextConcat _XMSTRINGGETTEXTCONCAT
+#define _XmStrings _XMSTRINGS
+#define _XmToHorizontalPixels _XMTOHORIZONTALPIXELS
+#define _XmToVerticalPixels _XMTOVERTICALPIXELS
+#define _XmTopShadowColorDefault _XMTOPSHADOWCOLORDEFAULT
+#define _Xm_fastPtr _XM_FASTPTR
+#define _XtCheckSubclassFlag _XTCHECKSUBCLASSFLAG
+#define _XtCopyFromArg _XTCOPYFROMARG
+#define _XtCountVaList _XTCOUNTVALIST
+#define _XtInherit _XTINHERIT
+#define _XtInheritTranslations _XTINHERITTRANSLATIONS
+#define _XtIsSubclassOf _XTISSUBCLASSOF
+#define _XtVaToArgList _XTVATOARGLIST
+#define applicationShellWidgetClass APPLICATIONSHELLWIDGETCLASS
+#define cli$dcl_parse CLI$DCL_PARSE
+#define cli$get_value CLI$GET_VALUE
+#define cli$present CLI$PRESENT
+#define compositeClassRec COMPOSITECLASSREC
+#define compositeWidgetClass COMPOSITEWIDGETCLASS
+#define constraintClassRec CONSTRAINTCLASSREC
+#define constraintWidgetClass CONSTRAINTWIDGETCLASS
+#define coreWidgetClass COREWIDGETCLASS
+#define exe$getspi EXE$GETSPI
+#define lbr$close LBR$CLOSE
+#define lbr$get_header LBR$GET_HEADER
+#define lbr$get_index LBR$GET_INDEX
+#define lbr$get_record LBR$GET_RECORD
+#define lbr$ini_control LBR$INI_CONTROL
+#define lbr$lookup_key LBR$LOOKUP_KEY
+#define lbr$open LBR$OPEN
+#define lbr$output_help LBR$OUTPUT_HELP
+#define lib$add_times LIB$ADD_TIMES
+#define lib$addx LIB$ADDX
+#define lib$create_dir LIB$CREATE_DIR
+#define lib$create_vm_zone LIB$CREATE_VM_ZONE
+#define lib$cvt_from_internal_time LIB$CVT_FROM_INTERNAL_TIME
+#define lib$cvt_htb LIB$CVT_HTB
+#define lib$cvt_vectim LIB$CVT_VECTIM
+#define lib$day LIB$DAY
+#define lib$day_of_week LIB$DAY_OF_WEEK
+#define lib$delete_symbol LIB$DELETE_SYMBOL
+#define lib$delete_vm_zone LIB$DELETE_VM_ZONE
+#define lib$disable_ctrl LIB$DISABLE_CTRL
+#define lib$ediv LIB$EDIV
+#define lib$emul LIB$EMUL
+#define lib$enable_ctrl LIB$ENABLE_CTRL
+#define lib$find_vm_zone LIB$FIND_VM_ZONE
+#define lib$format_date_time LIB$FORMAT_DATE_TIME
+#define lib$free_timer LIB$FREE_TIMER
+#define lib$free_vm LIB$FREE_VM
+#define lib$get_ef LIB$GET_EF
+#define lib$get_foreign LIB$GET_FOREIGN
+#define lib$get_input LIB$GET_INPUT
+#define lib$get_users_language LIB$GET_USERS_LANGUAGE
+#define lib$get_vm LIB$GET_VM
+#define lib$get_symbol LIB$GET_SYMBOL
+#define lib$getdvi LIB$GETDVI
+#define lib$init_date_time_context LIB$INIT_DATE_TIME_CONTEXT
+#define lib$init_timer LIB$INIT_TIMER
+#define lib$find_file LIB$FIND_FILE
+#define lib$find_file_end LIB$FIND_FILE_END
+#define lib$find_image_symbol LIB$FIND_IMAGE_SYMBOL
+#define lib$mult_delta_time LIB$MULT_DELTA_TIME
+#define lib$put_output LIB$PUT_OUTPUT
+#define lib$rename_file LIB$RENAME_FILE
+#define lib$reset_vm_zone LIB$RESET_VM_ZONE
+#define lib$set_symbol LIB$SET_SYMBOL
+#define lib$sfree1_dd LIB$SFREE1_DD
+#define lib$show_vm LIB$SHOW_VM
+#define lib$show_vm_zone LIB$SHOW_VM_ZONE
+#define lib$spawn LIB$SPAWN
+#define lib$stat_timer LIB$STAT_TIMER
+#define lib$subx LIB$SUBX
+#define lib$sub_times LIB$SUB_TIMES
+#define lib$wait LIB$WAIT
+#define mail$send_add_address MAIL$SEND_ADD_ADDRESS
+#define mail$send_add_attribute MAIL$SEND_ADD_ATTRIBUTE
+#define mail$send_add_bodypart MAIL$SEND_ADD_BODYPART
+#define mail$send_begin MAIL$SEND_BEGIN
+#define mail$send_end MAIL$SEND_END
+#define mail$send_message MAIL$SEND_MESSAGE
+#define ncs$convert NCS$CONVERT
+#define ncs$get_cf NCS$GET_CF
+#define objectClass OBJECTCLASS
+#define objectClassRec OBJECTCLASSREC
+#define overrideShellClassRec OVERRIDESHELLCLASSREC
+#define overrideShellWidgetClass OVERRIDESHELLWIDGETCLASS
+#define pthread_attr_create PTHREAD_ATTR_CREATE
+#define pthread_attr_delete PTHREAD_ATTR_DELETE
+#define pthread_attr_destroy PTHREAD_ATTR_DESTROY
+#define pthread_attr_getdetach_np PTHREAD_ATTR_GETDETACH_NP
+#define pthread_attr_getguardsize_np PTHREAD_ATTR_GETGUARDSIZE_NP
+#define pthread_attr_getinheritsched PTHREAD_ATTR_GETINHERITSCHED
+#define pthread_attr_getprio PTHREAD_ATTR_GETPRIO
+#define pthread_attr_getsched PTHREAD_ATTR_GETSCHED
+#define pthread_attr_getschedparam PTHREAD_ATTR_GETSCHEDPARAM
+#define pthread_attr_getschedpolicy PTHREAD_ATTR_GETSCHEDPOLICY
+#define pthread_attr_getstacksize PTHREAD_ATTR_GETSTACKSIZE
+#define pthread_attr_init PTHREAD_ATTR_INIT
+#define pthread_attr_setdetach_np PTHREAD_ATTR_SETDETACH_NP
+#define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE
+#define pthread_attr_setguardsize_np PTHREAD_ATTR_SETGUARDSIZE_NP
+#define pthread_attr_setinheritsched PTHREAD_ATTR_SETINHERITSCHED
+#define pthread_attr_setprio PTHREAD_ATTR_SETPRIO
+#define pthread_attr_setsched PTHREAD_ATTR_SETSCHED
+#define pthread_attr_setschedparam PTHREAD_ATTR_SETSCHEDPARAM
+#define pthread_attr_setschedpolicy PTHREAD_ATTR_SETSCHEDPOLICY
+#ifndef pthread_attr_setscope
+# define pthread_attr_setscope PTHREAD_ATTR_SETSCOPE
+#endif
+#define pthread_attr_setstacksize PTHREAD_ATTR_SETSTACKSIZE
+#define pthread_cancel PTHREAD_CANCEL
+#define pthread_cancel_e PTHREAD_CANCEL_E
+#define pthread_cond_broadcast PTHREAD_COND_BROADCAST
+#define pthread_cond_destroy PTHREAD_COND_DESTROY
+#define pthread_cond_init PTHREAD_COND_INIT
+#define pthread_cond_sig_preempt_int_np PTHREAD_COND_SIG_PREEMPT_INT_NP
+#define pthread_cond_signal PTHREAD_COND_SIGNAL
+#define pthread_cond_signal_int_np PTHREAD_COND_SIGNAL_INT_NP
+#define pthread_cond_timedwait PTHREAD_COND_TIMEDWAIT
+#define pthread_cond_wait PTHREAD_COND_WAIT
+#define pthread_condattr_create PTHREAD_CONDATTR_CREATE
+#define pthread_condattr_delete PTHREAD_CONDATTR_DELETE
+#define pthread_condattr_init PTHREAD_CONDATTR_INIT
+#define pthread_create PTHREAD_CREATE
+#define pthread_delay_np PTHREAD_DELAY_NP
+#define pthread_detach PTHREAD_DETACH
+#define pthread_equal PTHREAD_EQUAL
+#define pthread_exc_fetch_fp_np PTHREAD_EXC_FETCH_FP_NP
+#define pthread_exc_handler_np PTHREAD_EXC_HANDLER_NP
+#define pthread_exc_matches_np PTHREAD_EXC_MATCHES_NP
+#define pthread_exc_pop_ctx_np PTHREAD_EXC_POP_CTX_NP
+#define pthread_exc_push_ctx_np PTHREAD_EXC_PUSH_CTX_NP
+#define pthread_exc_raise_np PTHREAD_EXC_RAISE_NP
+#define pthread_exc_savecontext_np PTHREAD_EXC_SAVECONTEXT_NP
+#define pthread_exit PTHREAD_EXIT
+#define pthread_get_expiration_np PTHREAD_GET_EXPIRATION_NP
+#define pthread_getprio PTHREAD_GETPRIO
+#define pthread_getschedparam PTHREAD_GETSCHEDPARAM
+#define pthread_getscheduler PTHREAD_GETSCHEDULER
+#define pthread_getspecific PTHREAD_GETSPECIFIC
+#define pthread_getunique_np PTHREAD_GETUNIQUE_NP
+#define pthread_join PTHREAD_JOIN
+#define pthread_join32 PTHREAD_JOIN32
+#define pthread_key_create PTHREAD_KEY_CREATE
+#define pthread_key_delete PTHREAD_KEY_DELETE
+#define pthread_keycreate PTHREAD_KEYCREATE
+#define pthread_kill PTHREAD_KILL
+#define pthread_lock_global_np PTHREAD_LOCK_GLOBAL_NP
+#define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY
+#define pthread_mutex_init PTHREAD_MUTEX_INIT
+#define pthread_mutex_lock PTHREAD_MUTEX_LOCK
+#define pthread_mutex_trylock PTHREAD_MUTEX_TRYLOCK
+#define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK
+#define pthread_mutexattr_create PTHREAD_MUTEXATTR_CREATE
+#define pthread_mutexattr_delete PTHREAD_MUTEXATTR_DELETE
+#define pthread_mutexattr_destroy PTHREAD_MUTEXATTR_DESTROY
+#define pthread_mutexattr_getkind_np PTHREAD_MUTEXATTR_GETKIND_NP
+#define pthread_mutexattr_init PTHREAD_MUTEXATTR_INIT
+#define pthread_mutexattr_setkind_np PTHREAD_MUTEXATTR_SETKIND_NP
+#define pthread_mutexattr_settype_np PTHREAD_MUTEXATTR_SETTYPE_NP
+#define pthread_once PTHREAD_ONCE
+#define pthread_resume_np PTHREAD_RESUME_NP
+#define pthread_self PTHREAD_SELF
+#define pthread_setasynccancel PTHREAD_SETASYNCCANCEL
+#define pthread_setcancel PTHREAD_SETCANCEL
+#define pthread_setcancelstate PTHREAD_SETCANCELSTATE
+#define pthread_setcanceltype PTHREAD_SETCANCELTYPE
+#define pthread_setprio PTHREAD_SETPRIO
+#define pthread_setschedparam PTHREAD_SETSCHEDPARAM
+#define pthread_setscheduler PTHREAD_SETSCHEDULER
+#define pthread_setspecific PTHREAD_SETSPECIFIC
+#define pthread_suspend_np PTHREAD_SUSPEND_NP
+#define pthread_testcancel PTHREAD_TESTCANCEL
+#define pthread_unlock_global_np PTHREAD_UNLOCK_GLOBAL_NP
+#define pthread_yield PTHREAD_YIELD
+#define pthread_yield_np PTHREAD_YIELD_NP
+#define rectObjClass RECTOBJCLASS
+#define rectObjClassRec RECTOBJCLASSREC
+#define sessionShellWidgetClass SESSIONSHELLWIDGETCLASS
+#define shellWidgetClass SHELLWIDGETCLASS
+#define shmat SHMAT
+#define shmctl SHMCTL
+#define shmdt SHMDT
+#define shmget SHMGET
+#define smg$create_key_table SMG$CREATE_KEY_TABLE
+#define smg$create_virtual_keyboard SMG$CREATE_VIRTUAL_KEYBOARD
+#define smg$read_composed_line SMG$READ_COMPOSED_LINE
+#define sys$add_ident SYS$ADD_IDENT
+#define sys$asctoid SYS$ASCTOID
+#define sys$assign SYS$ASSIGN
+#define sys$bintim SYS$BINTIM
+#define sys$cancel SYS$CANCEL
+#define sys$cantim SYS$CANTIM
+#define sys$check_access SYS$CHECK_ACCESS
+#define sys$close SYS$CLOSE
+#define sys$connect SYS$CONNECT
+#define sys$create SYS$CREATE
+#define sys$create_user_profile SYS$CREATE_USER_PROFILE
+#define sys$crembx SYS$CREMBX
+#define sys$creprc SYS$CREPRC
+#define sys$crmpsc SYS$CRMPSC
+#define sys$dassgn SYS$DASSGN
+#define sys$dclast SYS$DCLAST
+#define sys$dclexh SYS$DCLEXH
+#define sys$delprc SYS$DELPRC
+#define sys$deq SYS$DEQ
+#define sys$dgblsc SYS$DGBLSC
+#define sys$display SYS$DISPLAY
+#define sys$enq SYS$ENQ
+#define sys$enqw SYS$ENQW
+#define sys$erase SYS$ERASE
+#define sys$fao SYS$FAO
+#define sys$faol SYS$FAOL
+#define sys$find_held SYS$FIND_HELD
+#define sys$finish_rdb SYS$FINISH_RDB
+#define sys$flush SYS$FLUSH
+#define sys$forcex SYS$FORCEX
+#define sys$get SYS$GET
+#define sys$get_security SYS$GET_SECURITY
+#define sys$getdviw SYS$GETDVIW
+#define sys$getjpi SYS$GETJPI
+#define sys$getjpiw SYS$GETJPIW
+#define sys$getlkiw SYS$GETLKIW
+#define sys$getmsg SYS$GETMSG
+#define sys$getsyi SYS$GETSYI
+#define sys$getsyiw SYS$GETSYIW
+#define sys$gettim SYS$GETTIM
+#define sys$getuai SYS$GETUAI
+#define sys$grantid SYS$GRANTID
+#define sys$hash_password SYS$HASH_PASSWORD
+#define sys$hiber SYS$HIBER
+#define sys$mgblsc SYS$MGBLSC
+#define sys$numtim SYS$NUMTIM
+#define sys$open SYS$OPEN
+#define sys$parse SYS$PARSE
+#define sys$parse_acl SYS$PARSE_ACL
+#define sys$parse_acl SYS$PARSE_ACL
+#define sys$persona_assume SYS$PERSONA_ASSUME
+#define sys$persona_create SYS$PERSONA_CREATE
+#define sys$persona_delete SYS$PERSONA_DELETE
+#define sys$process_scan SYS$PROCESS_SCAN
+#define sys$put SYS$PUT
+#define sys$qio SYS$QIO
+#define sys$qiow SYS$QIOW
+#define sys$read SYS$READ
+#define sys$resched SYS$RESCHED
+#define sys$rewind SYS$REWIND
+#define sys$search SYS$SEARCH
+#define sys$set_security SYS$SET_SECURITY
+#define sys$setast SYS$SETAST
+#define sys$setef SYS$SETEF
+#define sys$setimr SYS$SETIMR
+#define sys$setpri SYS$SETPRI
+#define sys$setprn SYS$SETPRN
+#define sys$setprv SYS$SETPRV
+#define sys$setswm SYS$SETSWM
+#define sys$setuai SYS$SETUAI
+#define sys$sndopr SYS$SNDOPR
+#define sys$synch SYS$SYNCH
+#define sys$trnlnm SYS$TRNLNM
+#define sys$update SYS$UPDATE
+#define sys$wake SYS$WAKE
+#define sys$write SYS$WRITE
+#define topLevelShellClassRec TOPLEVELSHELLCLASSREC
+#define topLevelShellWidgetClass TOPLEVELSHELLWIDGETCLASS
+#define transientShellWidgetClass TRANSIENTSHELLWIDGETCLASS
+#define vendorShellClassRec VENDORSHELLCLASSREC
+#define vendorShellWidgetClass VENDORSHELLWIDGETCLASS
+#define widgetClass WIDGETCLASS
+#define widgetClassRec WIDGETCLASSREC
+#define wmShellClassRec WMSHELLCLASSREC
+#define wmShellWidgetClass WMSHELLWIDGETCLASS
+#define x$soft_ast_lib_lock X$SOFT_AST_LIB_LOCK
+#define x$soft_ast_lock_depth X$SOFT_AST_LOCK_DEPTH
+#define x$soft_reenable_asts X$SOFT_REENABLE_ASTS
+#define xmArrowButtonWidgetClass XMARROWBUTTONWIDGETCLASS
+#define xmBulletinBoardWidgetClass XMBULLETINBOARDWIDGETCLASS
+#define xmCascadeButtonClassRec XMCASCADEBUTTONCLASSREC
+#define xmCascadeButtonGadgetClass XMCASCADEBUTTONGADGETCLASS
+#define xmCascadeButtonWidgetClass XMCASCADEBUTTONWIDGETCLASS
+#define xmCommandWidgetClass XMCOMMANDWIDGETCLASS
+#define xmDialogShellWidgetClass XMDIALOGSHELLWIDGETCLASS
+#define xmDrawingAreaWidgetClass XMDRAWINGAREAWIDGETCLASS
+#define xmDrawnButtonWidgetClass XMDRAWNBUTTONWIDGETCLASS
+#define xmFileSelectionBoxWidgetClass XMFILESELECTIONBOXWIDGETCLASS
+#define xmFormWidgetClass XMFORMWIDGETCLASS
+#define xmFrameWidgetClass XMFRAMEWIDGETCLASS
+#define xmGadgetClass XMGADGETCLASS
+#define xmLabelGadgetClass XMLABELGADGETCLASS
+#define xmLabelWidgetClass XMLABELWIDGETCLASS
+#define xmListWidgetClass XMLISTWIDGETCLASS
+#define xmMainWindowWidgetClass XMMAINWINDOWWIDGETCLASS
+#define xmManagerClassRec XMMANAGERCLASSREC
+#define xmManagerWidgetClass XMMANAGERWIDGETCLASS
+#define xmMenuShellWidgetClass XMMENUSHELLWIDGETCLASS
+#define xmMessageBoxWidgetClass XMMESSAGEBOXWIDGETCLASS
+#define xmPrimitiveClassRec XMPRIMITIVECLASSREC
+#define xmPrimitiveWidgetClass XMPRIMITIVEWIDGETCLASS
+#define xmPushButtonClassRec XMPUSHBUTTONCLASSREC
+#define xmPushButtonGadgetClass XMPUSHBUTTONGADGETCLASS
+#define xmPushButtonWidgetClass XMPUSHBUTTONWIDGETCLASS
+#define xmRowColumnWidgetClass XMROWCOLUMNWIDGETCLASS
+#define xmSashWidgetClass XMSASHWIDGETCLASS
+#define xmScaleWidgetClass XMSCALEWIDGETCLASS
+#define xmScrollBarWidgetClass XMSCROLLBARWIDGETCLASS
+#define xmScrolledWindowClassRec XMSCROLLEDWINDOWCLASSREC
+#define xmScrolledWindowWidgetClass XMSCROLLEDWINDOWWIDGETCLASS
+#define xmSeparatorGadgetClass XMSEPARATORGADGETCLASS
+#define xmSeparatorWidgetClass XMSEPARATORWIDGETCLASS
+#define xmTextFieldWidgetClass XMTEXTFIELDWIDGETCLASS
+#define xmTextWidgetClass XMTEXTWIDGETCLASS
+#define xmToggleButtonGadgetClass XMTOGGLEBUTTONGADGETCLASS
+#define xmToggleButtonWidgetClass XMTOGGLEBUTTONWIDGETCLASS
+
+#if (__VMS_VER < 80200000)
+# define SetReqLen(req,n,badlen) \
+ if ((req->length + n) > (unsigned)65535) { \
+ n = badlen; \
+ req->length += n; \
+ } else \
+ req->length += n
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern void XtFree(char*);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/volume.h
+// Purpose: wxFSVolume - encapsulates system volume information
+// Author: George Policello
+// Modified by:
+// Created: 28 Jan 02
+// Copyright: (c) 2002 George Policello
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ----------------------------------------------------------------------------
+// wxFSVolume represents a volume/drive in a file system
+// ----------------------------------------------------------------------------
+
+#ifndef _WX_FSVOLUME_H_
+#define _WX_FSVOLUME_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_FSVOLUME
+
+#include "wx/arrstr.h"
+
+// the volume flags
+enum wxFSVolumeFlags
+{
+ // is the volume mounted?
+ wxFS_VOL_MOUNTED = 0x0001,
+
+ // is the volume removable (floppy, CD, ...)?
+ wxFS_VOL_REMOVABLE = 0x0002,
+
+ // read only? (otherwise read write)
+ wxFS_VOL_READONLY = 0x0004,
+
+ // network resources
+ wxFS_VOL_REMOTE = 0x0008
+};
+
+// the volume types
+enum wxFSVolumeKind
+{
+ wxFS_VOL_FLOPPY,
+ wxFS_VOL_DISK,
+ wxFS_VOL_CDROM,
+ wxFS_VOL_DVDROM,
+ wxFS_VOL_NETWORK,
+ wxFS_VOL_OTHER,
+ wxFS_VOL_MAX
+};
+
+class WXDLLIMPEXP_BASE wxFSVolumeBase
+{
+public:
+ // return the array containing the names of the volumes
+ //
+ // only the volumes with the flags such that
+ // (flags & flagsSet) == flagsSet && !(flags & flagsUnset)
+ // are returned (by default, all mounted ones)
+ static wxArrayString GetVolumes(int flagsSet = wxFS_VOL_MOUNTED,
+ int flagsUnset = 0);
+
+ // stop execution of GetVolumes() called previously (should be called from
+ // another thread, of course)
+ static void CancelSearch();
+
+ // create the volume object with this name (should be one of those returned
+ // by GetVolumes()).
+ wxFSVolumeBase();
+ wxFSVolumeBase(const wxString& name);
+ bool Create(const wxString& name);
+
+ // accessors
+ // ---------
+
+ // is this a valid volume?
+ bool IsOk() const;
+
+ // kind of this volume?
+ wxFSVolumeKind GetKind() const;
+
+ // flags of this volume?
+ int GetFlags() const;
+
+ // can we write to this volume?
+ bool IsWritable() const { return !(GetFlags() & wxFS_VOL_READONLY); }
+
+ // get the name of the volume and the name which should be displayed to the
+ // user
+ wxString GetName() const { return m_volName; }
+ wxString GetDisplayName() const { return m_dispName; }
+
+ // TODO: operatios (Mount(), Unmount(), Eject(), ...)?
+
+protected:
+ // the internal volume name
+ wxString m_volName;
+
+ // the volume name as it is displayed to the user
+ wxString m_dispName;
+
+ // have we been initialized correctly?
+ bool m_isOk;
+};
+
+#if wxUSE_GUI
+
+#include "wx/icon.h"
+#include "wx/iconbndl.h" // only for wxIconArray
+
+enum wxFSIconType
+{
+ wxFS_VOL_ICO_SMALL = 0,
+ wxFS_VOL_ICO_LARGE,
+ wxFS_VOL_ICO_SEL_SMALL,
+ wxFS_VOL_ICO_SEL_LARGE,
+ wxFS_VOL_ICO_MAX
+};
+
+// wxFSVolume adds GetIcon() to wxFSVolumeBase
+class WXDLLIMPEXP_CORE wxFSVolume : public wxFSVolumeBase
+{
+public:
+ wxFSVolume() : wxFSVolumeBase() { InitIcons(); }
+ wxFSVolume(const wxString& name) : wxFSVolumeBase(name) { InitIcons(); }
+
+ wxIcon GetIcon(wxFSIconType type) const;
+
+private:
+ void InitIcons();
+
+ // the different icons for this volume (created on demand)
+ wxIconArray m_icons;
+};
+
+#else // !wxUSE_GUI
+
+// wxFSVolume is the same thing as wxFSVolume in wxBase
+typedef wxFSVolumeBase wxFSVolume;
+
+#endif // wxUSE_GUI/!wxUSE_GUI
+
+#endif // wxUSE_FSVOLUME
+
+#endif // _WX_FSVOLUME_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/vscroll.h
+// Purpose: Variable scrolled windows (wx[V/H/HV]ScrolledWindow)
+// Author: Vadim Zeitlin
+// Modified by: Brad Anderson, Bryan Petty
+// Created: 30.05.03
+// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_VSCROLL_H_
+#define _WX_VSCROLL_H_
+
+#include "wx/panel.h"
+#include "wx/position.h"
+#include "wx/scrolwin.h"
+
+class WXDLLIMPEXP_FWD_CORE wxVarScrollHelperEvtHandler;
+
+
+// Using the same techniques as the wxScrolledWindow class |
+// hierarchy, the wx[V/H/HV]ScrolledWindow classes are slightly |
+// more complex (compare with the diagram outlined in |
+// scrolwin.h) for the purpose of reducing code duplication |
+// through the use of mix-in classes. |
+// |
+// wxAnyScrollHelperBase |
+// | |
+// | |
+// | |
+// V |
+// wxVarScrollHelperBase |
+// / \ |
+// / \ |
+// V V |
+// wxVarHScrollHelper wxVarVScrollHelper |
+// | \ / | |
+// | \ / | |
+// | V V | |
+// | wxVarHVScrollHelper | |
+// | | | |
+// | | V |
+// | wxPanel | wxVarVScrollLegacyAdaptor |
+// | / \ \ | | |
+// | / \ `-----|----------. | |
+// | / \ | \ | |
+// | / \ | \ | |
+// V V \ | V V |
+// wxHScrolledWindow \ | wxVScrolledWindow |
+// V V |
+// wxHVScrolledWindow |
+// |
+// |
+// Border added to suppress GCC multi-line comment warnings ->|
+
+
+// ===========================================================================
+// wxVarScrollHelperBase
+// ===========================================================================
+
+// Provides all base common scroll calculations needed for either orientation,
+// automatic scrollbar functionality, saved scroll positions, functionality
+// for changing the target window to be scrolled, as well as defining all
+// required virtual functions that need to be implemented for any orientation
+// specific work.
+
+class WXDLLIMPEXP_CORE wxVarScrollHelperBase : public wxAnyScrollHelperBase
+{
+public:
+ // constructors and such
+ // ---------------------
+
+ wxVarScrollHelperBase(wxWindow *winToScroll);
+ virtual ~wxVarScrollHelperBase();
+
+ // operations
+ // ----------
+
+ // with physical scrolling on, the device origin is changed properly when
+ // a wxPaintDC is prepared, children are actually moved and laid out
+ // properly, and the contents of the window (pixels) are actually moved
+ void EnablePhysicalScrolling(bool scrolling = true)
+ { m_physicalScrolling = scrolling; }
+
+ // wxNOT_FOUND if none, i.e. if it is below the last item
+ int VirtualHitTest(wxCoord coord) const;
+
+ // recalculate all our parameters and redisplay all units
+ virtual void RefreshAll();
+
+ // accessors
+ // ---------
+
+ // get the first currently visible unit
+ size_t GetVisibleBegin() const { return m_unitFirst; }
+
+ // get the last currently visible unit
+ size_t GetVisibleEnd() const
+ { return m_unitFirst + m_nUnitsVisible; }
+
+ // is this unit currently visible?
+ bool IsVisible(size_t unit) const
+ { return unit >= m_unitFirst && unit < GetVisibleEnd(); }
+
+ // translate between scrolled and unscrolled coordinates
+ int CalcScrolledPosition(int coord) const
+ { return DoCalcScrolledPosition(coord); }
+ int CalcUnscrolledPosition(int coord) const
+ { return DoCalcUnscrolledPosition(coord); }
+
+ virtual int DoCalcScrolledPosition(int coord) const;
+ virtual int DoCalcUnscrolledPosition(int coord) const;
+
+ // update the thumb size shown by the scrollbar
+ virtual void UpdateScrollbar();
+ void RemoveScrollbar();
+
+ // Normally the wxScrolledWindow will scroll itself, but in some rare
+ // occasions you might want it to scroll [part of] another window (e.g. a
+ // child of it in order to scroll only a portion the area between the
+ // scrollbars (spreadsheet: only cell area will move).
+ virtual void SetTargetWindow(wxWindow *target);
+
+ // change the DC origin according to the scroll position. To properly
+ // forward calls to wxWindow::Layout use WX_FORWARD_TO_SCROLL_HELPER()
+ // derived class
+ virtual void DoPrepareDC(wxDC& dc);
+
+ // the methods to be called from the window event handlers
+ void HandleOnScroll(wxScrollWinEvent& event);
+ void HandleOnSize(wxSizeEvent& event);
+#if wxUSE_MOUSEWHEEL
+ void HandleOnMouseWheel(wxMouseEvent& event);
+#endif // wxUSE_MOUSEWHEEL
+
+ // these functions must be overidden in the derived class to return
+ // orientation specific data (e.g. the width for vertically scrolling
+ // derivatives in the case of GetOrientationTargetSize())
+ virtual int GetOrientationTargetSize() const = 0;
+ virtual int GetNonOrientationTargetSize() const = 0;
+ virtual wxOrientation GetOrientation() const = 0;
+
+protected:
+ // all *Unit* functions are protected to be exposed by
+ // wxVarScrollHelperBase implementations (with appropriate names)
+
+ // get the number of units this window contains (previously set by
+ // SetUnitCount())
+ size_t GetUnitCount() const { return m_unitMax; }
+
+ // set the number of units the helper contains: the derived class must
+ // provide the sizes for all units with indices up to the one given here
+ // in its OnGetUnitSize()
+ void SetUnitCount(size_t count);
+
+ // redraw the specified unit
+ virtual void RefreshUnit(size_t unit);
+
+ // redraw all units in the specified range (inclusive)
+ virtual void RefreshUnits(size_t from, size_t to);
+
+ // scroll to the specified unit: it will become the first visible unit in
+ // the window
+ //
+ // return true if we scrolled the window, false if nothing was done
+ bool DoScrollToUnit(size_t unit);
+
+ // scroll by the specified number of units/pages
+ virtual bool DoScrollUnits(int units);
+ virtual bool DoScrollPages(int pages);
+
+ // this function must be overridden in the derived class and it should
+ // return the size of the given unit in pixels
+ virtual wxCoord OnGetUnitSize(size_t n) const = 0;
+
+ // this function doesn't have to be overridden but it may be useful to do
+ // it if calculating the units' sizes is a relatively expensive operation
+ // as it gives the user code a possibility to calculate several of them at
+ // once
+ //
+ // OnGetUnitsSizeHint() is normally called just before OnGetUnitSize() but
+ // you shouldn't rely on the latter being called for all units in the
+ // interval specified here. It is also possible that OnGetUnitHeight() will
+ // be called for the units outside of this interval, so this is really just
+ // a hint, not a promise.
+ //
+ // finally note that unitMin is inclusive, while unitMax is exclusive, as
+ // usual
+ virtual void OnGetUnitsSizeHint(size_t WXUNUSED(unitMin),
+ size_t WXUNUSED(unitMax)) const
+ { }
+
+ // when the number of units changes, we try to estimate the total size
+ // of all units which is a rather expensive operation in terms of unit
+ // access, so if the user code may estimate the average size
+ // better/faster than we do, it should override this function to implement
+ // its own logic
+ //
+ // this function should return the best guess for the total size it may
+ // make
+ virtual wxCoord EstimateTotalSize() const { return DoEstimateTotalSize(); }
+
+ wxCoord DoEstimateTotalSize() const;
+
+ // find the index of the unit we need to show to fit the specified unit on
+ // the opposite side either fully or partially (depending on fullyVisible)
+ size_t FindFirstVisibleFromLast(size_t last,
+ bool fullyVisible = false) const;
+
+ // get the total size of the units between unitMin (inclusive) and
+ // unitMax (exclusive)
+ wxCoord GetUnitsSize(size_t unitMin, size_t unitMax) const;
+
+ // get the offset of the first visible unit
+ wxCoord GetScrollOffset() const
+ { return GetUnitsSize(0, GetVisibleBegin()); }
+
+ // get the size of the target window
+ wxSize GetTargetSize() const { return m_targetWindow->GetClientSize(); }
+
+ void GetTargetSize(int *w, int *h)
+ {
+ wxSize size = GetTargetSize();
+ if ( w )
+ *w = size.x;
+ if ( h )
+ *h = size.y;
+ }
+
+ // calculate the new scroll position based on scroll event type
+ size_t GetNewScrollPosition(wxScrollWinEvent& event) const;
+
+ // replacement implementation of wxWindow::Layout virtual method. To
+ // properly forward calls to wxWindow::Layout use
+ // WX_FORWARD_TO_SCROLL_HELPER() derived class
+ bool ScrollLayout();
+
+#ifdef __WXMAC__
+ // queue mac window update after handling scroll event
+ virtual void UpdateMacScrollWindow() { }
+#endif // __WXMAC__
+
+ // change the target window
+ void DoSetTargetWindow(wxWindow *target);
+
+ // delete the event handler we installed
+ void DeleteEvtHandler();
+
+ // helper function abstracting the orientation test: with vertical
+ // orientation, it assigns the first value to x and the second one to y,
+ // with horizontal orientation it reverses them, i.e. the first value is
+ // assigned to y and the second one to x
+ void AssignOrient(wxCoord& x, wxCoord& y, wxCoord first, wxCoord second);
+
+ // similar to "oriented assignment" above but does "oriented increment":
+ // for vertical orientation, y is incremented by the given value and x if
+ // left unchanged, for horizontal orientation x is incremented
+ void IncOrient(wxCoord& x, wxCoord& y, wxCoord inc);
+
+private:
+ // the total number of (logical) units
+ size_t m_unitMax;
+
+ // the total (estimated) size
+ wxCoord m_sizeTotal;
+
+ // the first currently visible unit
+ size_t m_unitFirst;
+
+ // the number of currently visible units (including the last, possibly only
+ // partly, visible one)
+ size_t m_nUnitsVisible;
+
+ // accumulated mouse wheel rotation
+#if wxUSE_MOUSEWHEEL
+ int m_sumWheelRotation;
+#endif
+
+ // do child scrolling (used in DoPrepareDC())
+ bool m_physicalScrolling;
+
+ // handler injected into target window to forward some useful events to us
+ wxVarScrollHelperEvtHandler *m_handler;
+};
+
+
+
+// ===========================================================================
+// wxVarVScrollHelper
+// ===========================================================================
+
+// Provides public API functions targeted for vertical-specific scrolling,
+// wrapping the functionality of wxVarScrollHelperBase.
+
+class WXDLLIMPEXP_CORE wxVarVScrollHelper : public wxVarScrollHelperBase
+{
+public:
+ // constructors and such
+ // ---------------------
+
+ // ctor must be given the associated window
+ wxVarVScrollHelper(wxWindow *winToScroll)
+ : wxVarScrollHelperBase(winToScroll)
+ {
+ }
+
+ // operators
+
+ void SetRowCount(size_t rowCount) { SetUnitCount(rowCount); }
+ bool ScrollToRow(size_t row) { return DoScrollToUnit(row); }
+
+ virtual bool ScrollRows(int rows)
+ { return DoScrollUnits(rows); }
+ virtual bool ScrollRowPages(int pages)
+ { return DoScrollPages(pages); }
+
+ virtual void RefreshRow(size_t row)
+ { RefreshUnit(row); }
+ virtual void RefreshRows(size_t from, size_t to)
+ { RefreshUnits(from, to); }
+
+ // accessors
+
+ size_t GetRowCount() const { return GetUnitCount(); }
+ size_t GetVisibleRowsBegin() const { return GetVisibleBegin(); }
+ size_t GetVisibleRowsEnd() const { return GetVisibleEnd(); }
+ bool IsRowVisible(size_t row) const { return IsVisible(row); }
+
+ virtual int GetOrientationTargetSize() const
+ { return GetTargetWindow()->GetClientSize().y; }
+ virtual int GetNonOrientationTargetSize() const
+ { return GetTargetWindow()->GetClientSize().x; }
+ virtual wxOrientation GetOrientation() const { return wxVERTICAL; }
+
+protected:
+ // this function must be overridden in the derived class and it should
+ // return the size of the given row in pixels
+ virtual wxCoord OnGetRowHeight(size_t n) const = 0;
+ wxCoord OnGetUnitSize(size_t n) const { return OnGetRowHeight(n); }
+
+ virtual void OnGetRowsHeightHint(size_t WXUNUSED(rowMin),
+ size_t WXUNUSED(rowMax)) const { }
+
+ // forward calls to OnGetRowsHeightHint()
+ virtual void OnGetUnitsSizeHint(size_t unitMin, size_t unitMax) const
+ { OnGetRowsHeightHint(unitMin, unitMax); }
+
+ // again, if not overridden, it will fall back on default method
+ virtual wxCoord EstimateTotalHeight() const
+ { return DoEstimateTotalSize(); }
+
+ // forward calls to EstimateTotalHeight()
+ virtual wxCoord EstimateTotalSize() const { return EstimateTotalHeight(); }
+
+ wxCoord GetRowsHeight(size_t rowMin, size_t rowMax) const
+ { return GetUnitsSize(rowMin, rowMax); }
+};
+
+
+
+// ===========================================================================
+// wxVarHScrollHelper
+// ===========================================================================
+
+// Provides public API functions targeted for horizontal-specific scrolling,
+// wrapping the functionality of wxVarScrollHelperBase.
+
+class WXDLLIMPEXP_CORE wxVarHScrollHelper : public wxVarScrollHelperBase
+{
+public:
+ // constructors and such
+ // ---------------------
+
+ // ctor must be given the associated window
+ wxVarHScrollHelper(wxWindow *winToScroll)
+ : wxVarScrollHelperBase(winToScroll)
+ {
+ }
+
+ // operators
+
+ void SetColumnCount(size_t columnCount)
+ { SetUnitCount(columnCount); }
+
+ bool ScrollToColumn(size_t column)
+ { return DoScrollToUnit(column); }
+ virtual bool ScrollColumns(int columns)
+ { return DoScrollUnits(columns); }
+ virtual bool ScrollColumnPages(int pages)
+ { return DoScrollPages(pages); }
+
+ virtual void RefreshColumn(size_t column)
+ { RefreshUnit(column); }
+ virtual void RefreshColumns(size_t from, size_t to)
+ { RefreshUnits(from, to); }
+
+ // accessors
+
+ size_t GetColumnCount() const
+ { return GetUnitCount(); }
+ size_t GetVisibleColumnsBegin() const
+ { return GetVisibleBegin(); }
+ size_t GetVisibleColumnsEnd() const
+ { return GetVisibleEnd(); }
+ bool IsColumnVisible(size_t column) const
+ { return IsVisible(column); }
+
+
+ virtual int GetOrientationTargetSize() const
+ { return GetTargetWindow()->GetClientSize().x; }
+ virtual int GetNonOrientationTargetSize() const
+ { return GetTargetWindow()->GetClientSize().y; }
+ virtual wxOrientation GetOrientation() const { return wxHORIZONTAL; }
+
+protected:
+ // this function must be overridden in the derived class and it should
+ // return the size of the given column in pixels
+ virtual wxCoord OnGetColumnWidth(size_t n) const = 0;
+ wxCoord OnGetUnitSize(size_t n) const { return OnGetColumnWidth(n); }
+
+ virtual void OnGetColumnsWidthHint(size_t WXUNUSED(columnMin),
+ size_t WXUNUSED(columnMax)) const
+ { }
+
+ // forward calls to OnGetColumnsWidthHint()
+ virtual void OnGetUnitsSizeHint(size_t unitMin, size_t unitMax) const
+ { OnGetColumnsWidthHint(unitMin, unitMax); }
+
+ // again, if not overridden, it will fall back on default method
+ virtual wxCoord EstimateTotalWidth() const { return DoEstimateTotalSize(); }
+
+ // forward calls to EstimateTotalWidth()
+ virtual wxCoord EstimateTotalSize() const { return EstimateTotalWidth(); }
+
+ wxCoord GetColumnsWidth(size_t columnMin, size_t columnMax) const
+ { return GetUnitsSize(columnMin, columnMax); }
+};
+
+
+
+// ===========================================================================
+// wxVarHVScrollHelper
+// ===========================================================================
+
+// Provides public API functions targeted at functions with similar names in
+// both wxVScrollHelper and wxHScrollHelper so class scope doesn't need to be
+// specified (since we are using multiple inheritance). It also provides
+// functions to make changing values for both orientations at the same time
+// easier.
+
+class WXDLLIMPEXP_CORE wxVarHVScrollHelper : public wxVarVScrollHelper,
+ public wxVarHScrollHelper
+{
+public:
+ // constructors and such
+ // ---------------------
+
+ // ctor must be given the associated window
+ wxVarHVScrollHelper(wxWindow *winToScroll)
+ : wxVarVScrollHelper(winToScroll), wxVarHScrollHelper(winToScroll) { }
+
+ // operators
+ // ---------
+
+ // set the number of units the window contains for each axis: the derived
+ // class must provide the widths and heights for all units with indices up
+ // to each of the one given here in its OnGetColumnWidth() and
+ // OnGetRowHeight()
+ void SetRowColumnCount(size_t rowCount, size_t columnCount);
+
+
+ // with physical scrolling on, the device origin is changed properly when
+ // a wxPaintDC is prepared, children are actually moved and laid out
+ // properly, and the contents of the window (pixels) are actually moved
+ void EnablePhysicalScrolling(bool vscrolling = true, bool hscrolling = true)
+ {
+ wxVarVScrollHelper::EnablePhysicalScrolling(vscrolling);
+ wxVarHScrollHelper::EnablePhysicalScrolling(hscrolling);
+ }
+
+ // scroll to the specified row/column: it will become the first visible
+ // cell in the window
+ //
+ // return true if we scrolled the window, false if nothing was done
+ bool ScrollToRowColumn(size_t row, size_t column);
+ bool ScrollToRowColumn(const wxPosition &pos)
+ { return ScrollToRowColumn(pos.GetRow(), pos.GetColumn()); }
+
+ // redraw the specified cell
+ virtual void RefreshRowColumn(size_t row, size_t column);
+ virtual void RefreshRowColumn(const wxPosition &pos)
+ { RefreshRowColumn(pos.GetRow(), pos.GetColumn()); }
+
+ // redraw the specified regions (inclusive). If the target window for
+ // both orientations is the same the rectangle of cells is refreshed; if
+ // the target windows differ the entire client size opposite the
+ // orientation direction is refreshed between the specified limits
+ virtual void RefreshRowsColumns(size_t fromRow, size_t toRow,
+ size_t fromColumn, size_t toColumn);
+ virtual void RefreshRowsColumns(const wxPosition& from,
+ const wxPosition& to)
+ {
+ RefreshRowsColumns(from.GetRow(), to.GetRow(),
+ from.GetColumn(), to.GetColumn());
+ }
+
+ // locate the virtual position from the given device coordinates
+ wxPosition VirtualHitTest(wxCoord x, wxCoord y) const;
+ wxPosition VirtualHitTest(const wxPoint &pos) const
+ { return VirtualHitTest(pos.x, pos.y); }
+
+ // change the DC origin according to the scroll position. To properly
+ // forward calls to wxWindow::Layout use WX_FORWARD_TO_SCROLL_HELPER()
+ // derived class. We use this version to call both base classes'
+ // DoPrepareDC()
+ virtual void DoPrepareDC(wxDC& dc);
+
+ // replacement implementation of wxWindow::Layout virtual method. To
+ // properly forward calls to wxWindow::Layout use
+ // WX_FORWARD_TO_SCROLL_HELPER() derived class. We use this version to
+ // call both base classes' ScrollLayout()
+ bool ScrollLayout();
+
+ // accessors
+ // ---------
+
+ // get the number of units this window contains (previously set by
+ // Set[Column/Row/RowColumn/Unit]Count())
+ wxSize GetRowColumnCount() const;
+
+ // get the first currently visible units
+ wxPosition GetVisibleBegin() const;
+ wxPosition GetVisibleEnd() const;
+
+ // is this cell currently visible?
+ bool IsVisible(size_t row, size_t column) const;
+ bool IsVisible(const wxPosition &pos) const
+ { return IsVisible(pos.GetRow(), pos.GetColumn()); }
+};
+
+
+
+#if WXWIN_COMPATIBILITY_2_8
+
+// ===========================================================================
+// wxVarVScrollLegacyAdaptor
+// ===========================================================================
+
+// Provides backwards compatible API for applications originally built using
+// wxVScrolledWindow in 2.6 or 2.8. Originally, wxVScrolledWindow referred
+// to scrolling "lines". We use "units" in wxVarScrollHelperBase to avoid
+// implying any orientation (since the functions are used for both horizontal
+// and vertical scrolling in derived classes). And in the new
+// wxVScrolledWindow and wxHScrolledWindow classes, we refer to them as
+// "rows" and "columns", respectively. This is to help clear some confusion
+// in not only those classes, but also in wxHVScrolledWindow where functions
+// are inherited from both.
+
+class WXDLLIMPEXP_CORE wxVarVScrollLegacyAdaptor : public wxVarVScrollHelper
+{
+public:
+ // constructors and such
+ // ---------------------
+ wxVarVScrollLegacyAdaptor(wxWindow *winToScroll)
+ : wxVarVScrollHelper(winToScroll)
+ {
+ }
+
+ // accessors
+ // ---------
+
+ // this is the same as GetVisibleRowsBegin(), exists to match
+ // GetLastVisibleLine() and for backwards compatibility only
+ wxDEPRECATED( size_t GetFirstVisibleLine() const );
+
+ // get the last currently visible line
+ //
+ // this function is unsafe as it returns (size_t)-1 (i.e. a huge positive
+ // number) if the control is empty, use GetVisibleRowsEnd() instead, this
+ // one is kept for backwards compatibility
+ wxDEPRECATED( size_t GetLastVisibleLine() const );
+
+ // "line" to "unit" compatibility functions
+ // ----------------------------------------
+
+ // get the number of lines this window contains (set by SetLineCount())
+ wxDEPRECATED( size_t GetLineCount() const );
+
+ // set the number of lines the helper contains: the derived class must
+ // provide the sizes for all lines with indices up to the one given here
+ // in its OnGetLineHeight()
+ wxDEPRECATED( void SetLineCount(size_t count) );
+
+ // redraw the specified line
+ wxDEPRECATED( virtual void RefreshLine(size_t line) );
+
+ // redraw all lines in the specified range (inclusive)
+ wxDEPRECATED( virtual void RefreshLines(size_t from, size_t to) );
+
+ // scroll to the specified line: it will become the first visible line in
+ // the window
+ //
+ // return true if we scrolled the window, false if nothing was done
+ wxDEPRECATED( bool ScrollToLine(size_t line) );
+
+ // scroll by the specified number of lines/pages
+ wxDEPRECATED( virtual bool ScrollLines(int lines) );
+ wxDEPRECATED( virtual bool ScrollPages(int pages) );
+
+protected:
+ // unless the code has been updated to override OnGetRowHeight() instead,
+ // this function must be overridden in the derived class and it should
+ // return the height of the given row in pixels
+ wxDEPRECATED_BUT_USED_INTERNALLY(
+ virtual wxCoord OnGetLineHeight(size_t n) const );
+
+ // forwards the calls from base class pure virtual function to pure virtual
+ // OnGetLineHeight instead (backwards compatible name)
+ // note that we don't need to forward OnGetUnitSize() as it is already
+ // forwarded to OnGetRowHeight() in wxVarVScrollHelper
+ virtual wxCoord OnGetRowHeight(size_t n) const;
+
+ // this function doesn't have to be overridden but it may be useful to do
+ // it if calculating the lines heights is a relatively expensive operation
+ // as it gives the user code a possibility to calculate several of them at
+ // once
+ //
+ // OnGetLinesHint() is normally called just before OnGetLineHeight() but you
+ // shouldn't rely on the latter being called for all lines in the interval
+ // specified here. It is also possible that OnGetLineHeight() will be
+ // called for the lines outside of this interval, so this is really just a
+ // hint, not a promise.
+ //
+ // finally note that lineMin is inclusive, while lineMax is exclusive, as
+ // usual
+ wxDEPRECATED_BUT_USED_INTERNALLY( virtual void OnGetLinesHint(
+ size_t lineMin, size_t lineMax) const );
+
+ // forwards the calls from base class pure virtual function to pure virtual
+ // OnGetLinesHint instead (backwards compatible name)
+ void OnGetRowsHeightHint(size_t rowMin, size_t rowMax) const;
+};
+
+#else // !WXWIN_COMPATIBILITY_2_8
+
+// shortcut to avoid checking compatibility modes later
+// remove this and all references to wxVarVScrollLegacyAdaptor once
+// wxWidgets 2.6 and 2.8 compatibility is removed
+typedef wxVarVScrollHelper wxVarVScrollLegacyAdaptor;
+
+#endif // WXWIN_COMPATIBILITY_2_8/!WXWIN_COMPATIBILITY_2_8
+
+
+// this macro must be used in declaration of wxVarScrollHelperBase-derived
+// classes
+#define WX_FORWARD_TO_VAR_SCROLL_HELPER() \
+public: \
+ virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); } \
+ virtual bool Layout() { return ScrollLayout(); }
+
+
+
+// ===========================================================================
+// wxVScrolledWindow
+// ===========================================================================
+
+// In the name of this class, "V" may stand for "variable" because it can be
+// used for scrolling rows of variable heights; "virtual", because it is not
+// necessary to know the heights of all rows in advance -- only those which
+// are shown on the screen need to be measured; or even "vertical", because
+// this class only supports scrolling vertically.
+
+// In any case, this is a generalization of the wxScrolledWindow class which
+// can be only used when all rows have the same heights. It lacks some other
+// wxScrolledWindow features however, notably it can't scroll only a rectangle
+// of the window and not its entire client area.
+
+class WXDLLIMPEXP_CORE wxVScrolledWindow : public wxPanel,
+ public wxVarVScrollLegacyAdaptor
+{
+public:
+ // constructors and such
+ // ---------------------
+
+ // default ctor, you must call Create() later
+ wxVScrolledWindow() : wxVarVScrollLegacyAdaptor(this) { }
+
+ // normal ctor, no need to call Create() after this one
+ //
+ // note that wxVSCROLL is always automatically added to our style, there is
+ // no need to specify it explicitly
+ wxVScrolledWindow(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxPanelNameStr)
+ : wxVarVScrollLegacyAdaptor(this)
+ {
+ (void)Create(parent, id, pos, size, style, name);
+ }
+
+ // same as the previous ctor but returns status code: true if ok
+ //
+ // just as with the ctor above, wxVSCROLL style is always used, there is no
+ // need to specify it
+ bool Create(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxPanelNameStr)
+ {
+ return wxPanel::Create(parent, id, pos, size, style | wxVSCROLL, name);
+ }
+
+#if WXWIN_COMPATIBILITY_2_8
+ // Make sure we prefer our version of HitTest rather than wxWindow's
+ // These functions should no longer be masked in favor of VirtualHitTest()
+ int HitTest(wxCoord WXUNUSED(x), wxCoord y) const
+ { return wxVarVScrollHelper::VirtualHitTest(y); }
+ int HitTest(const wxPoint& pt) const
+ { return HitTest(pt.x, pt.y); }
+#endif // WXWIN_COMPATIBILITY_2_8
+
+ WX_FORWARD_TO_VAR_SCROLL_HELPER()
+
+#ifdef __WXMAC__
+protected:
+ virtual void UpdateMacScrollWindow() { Update(); }
+#endif // __WXMAC__
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxVScrolledWindow);
+ DECLARE_ABSTRACT_CLASS(wxVScrolledWindow)
+};
+
+
+
+// ===========================================================================
+// wxHScrolledWindow
+// ===========================================================================
+
+// In the name of this class, "H" stands for "horizontal" because it can be
+// used for scrolling columns of variable widths. It is not necessary to know
+// the widths of all columns in advance -- only those which are shown on the
+// screen need to be measured.
+
+// This is a generalization of the wxScrolledWindow class which can be only
+// used when all columns have the same width. It lacks some other
+// wxScrolledWindow features however, notably it can't scroll only a rectangle
+// of the window and not its entire client area.
+
+class WXDLLIMPEXP_CORE wxHScrolledWindow : public wxPanel,
+ public wxVarHScrollHelper
+{
+public:
+ // constructors and such
+ // ---------------------
+
+ // default ctor, you must call Create() later
+ wxHScrolledWindow() : wxVarHScrollHelper(this) { }
+
+ // normal ctor, no need to call Create() after this one
+ //
+ // note that wxHSCROLL is always automatically added to our style, there is
+ // no need to specify it explicitly
+ wxHScrolledWindow(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxPanelNameStr)
+ : wxVarHScrollHelper(this)
+ {
+ (void)Create(parent, id, pos, size, style, name);
+ }
+
+ // same as the previous ctor but returns status code: true if ok
+ //
+ // just as with the ctor above, wxHSCROLL style is always used, there is no
+ // need to specify it
+ bool Create(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxPanelNameStr)
+ {
+ return wxPanel::Create(parent, id, pos, size, style | wxHSCROLL, name);
+ }
+
+ WX_FORWARD_TO_VAR_SCROLL_HELPER()
+
+#ifdef __WXMAC__
+protected:
+ virtual void UpdateMacScrollWindow() { Update(); }
+#endif // __WXMAC__
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxHScrolledWindow);
+ DECLARE_ABSTRACT_CLASS(wxHScrolledWindow)
+};
+
+
+
+// ===========================================================================
+// wxHVScrolledWindow
+// ===========================================================================
+
+// This window inherits all functionality of both vertical and horizontal
+// scrolled windows automatically handling everything needed to scroll both
+// axis simultaneously.
+
+class WXDLLIMPEXP_CORE wxHVScrolledWindow : public wxPanel,
+ public wxVarHVScrollHelper
+{
+public:
+ // constructors and such
+ // ---------------------
+
+ // default ctor, you must call Create() later
+ wxHVScrolledWindow()
+ : wxPanel(),
+ wxVarHVScrollHelper(this) { }
+
+ // normal ctor, no need to call Create() after this one
+ //
+ // note that wxVSCROLL and wxHSCROLL are always automatically added to our
+ // style, there is no need to specify them explicitly
+ wxHVScrolledWindow(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxPanelNameStr)
+ : wxPanel(),
+ wxVarHVScrollHelper(this)
+ {
+ (void)Create(parent, id, pos, size, style, name);
+ }
+
+ // same as the previous ctor but returns status code: true if ok
+ //
+ // just as with the ctor above, wxVSCROLL and wxHSCROLL styles are always
+ // used, there is no need to specify them
+ bool Create(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxPanelNameStr)
+ {
+ return wxPanel::Create(parent, id, pos, size,
+ style | wxVSCROLL | wxHSCROLL, name);
+ }
+
+ WX_FORWARD_TO_VAR_SCROLL_HELPER()
+
+#ifdef __WXMAC__
+protected:
+ virtual void UpdateMacScrollWindow() { Update(); }
+#endif // __WXMAC__
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxHVScrolledWindow);
+ DECLARE_ABSTRACT_CLASS(wxHVScrolledWindow)
+};
+
+#endif // _WX_VSCROLL_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/weakref.h
+// Purpose: wxWeakRef - Generic weak references for wxWidgets
+// Author: Arne Steinarson
+// Created: 27 Dec 07
+// Copyright: (c) 2007 Arne Steinarson
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WEAKREF_H_
+#define _WX_WEAKREF_H_
+
+#include "wx/tracker.h"
+
+
+// Some compilers (VC6, Borland, g++ < 3.3) have problem with template specialization.
+// However, this is only used for optimization purposes (a smaller wxWeakRef pointer)
+// (and the corner case of wxWeakRef<wxObject>). So for those compilers, we can fall
+// back to the non-optimal case, where we use the same type of weak ref (static one)
+// in all cases. See defs.h for various setting these defines depending on compiler.
+
+#if !defined(HAVE_PARTIAL_SPECIALIZATION) || \
+ !defined(HAVE_TEMPLATE_OVERLOAD_RESOLUTION) || \
+ (defined(__GNUC__) && !wxCHECK_GCC_VERSION(3, 3))
+ #define USE_ONLY_STATIC_WEAKREF
+#endif
+
+
+#ifndef USE_ONLY_STATIC_WEAKREF
+
+// Avoid including this for simpler compilers
+#include "wx/meta/convertible.h"
+#include "wx/meta/int2type.h"
+
+template <class T>
+struct wxIsStaticTrackable
+{
+ enum { value = wxConvertibleTo<T, wxTrackable>::value };
+};
+
+#endif // !USE_ONLY_STATIC_WEAKREF
+
+
+// Weak ref implementation when T has wxTrackable as a known base class
+template <class T>
+class wxWeakRefStatic : public wxTrackerNode
+{
+public:
+ wxWeakRefStatic() : m_pobj(NULL) { }
+
+ void Release()
+ {
+ // Release old object if any
+ if ( m_pobj )
+ {
+ // Remove ourselves from object tracker list
+ wxTrackable *pt = static_cast<wxTrackable*>(m_pobj);
+ pt->RemoveNode(this);
+ m_pobj = NULL;
+ }
+ }
+
+ virtual void OnObjectDestroy()
+ {
+ // Tracked object itself removes us from list of trackers
+ wxASSERT(m_pobj != NULL);
+ m_pobj = NULL;
+ }
+
+protected:
+ void Assign(T* pobj)
+ {
+ if ( m_pobj == pobj )
+ return;
+
+ Release();
+
+ // Now set new trackable object
+ if ( pobj )
+ {
+ // Add ourselves to object tracker list
+ wxTrackable *pt = static_cast<wxTrackable*>(pobj);
+ pt->AddNode(this);
+ m_pobj = pobj;
+ }
+ }
+
+ void AssignCopy(const wxWeakRefStatic& wr)
+ {
+ Assign( wr.m_pobj );
+ }
+
+ T *m_pobj;
+};
+
+
+
+#ifndef USE_ONLY_STATIC_WEAKREF
+
+template<class T,bool use_static>
+struct wxWeakRefImpl;
+
+// Intermediate class, to select the static case above.
+template <class T>
+struct wxWeakRefImpl<T, true> : public wxWeakRefStatic<T>
+{
+ enum { value = 1 };
+};
+
+// Weak ref implementation when T does not have wxTrackable as known base class
+template<class T>
+struct wxWeakRefImpl<T, false> : public wxTrackerNode
+{
+ void Release()
+ {
+ // Release old object if any
+ if ( m_pobj )
+ {
+ // Remove ourselves from object tracker list
+ m_ptbase->RemoveNode(this);
+ m_pobj = NULL;
+ m_ptbase = NULL;
+ }
+ }
+
+ virtual void OnObjectDestroy()
+ {
+ // Tracked object itself removes us from list of trackers
+ wxASSERT(m_pobj != NULL);
+ m_pobj = NULL;
+ m_ptbase = NULL;
+ }
+
+protected:
+ wxWeakRefImpl() : m_pobj(NULL), m_ptbase(NULL) { }
+
+ // Assign receives most derived class here and can use that
+ template <class TDerived>
+ void Assign( TDerived* pobj )
+ {
+ AssignHelper( pobj, wxInt2Type<wxIsStaticTrackable<TDerived>::value>() );
+ }
+
+ template <class TDerived>
+ void AssignHelper(TDerived* pobj, wxInt2Type<true>)
+ {
+ wxTrackable *ptbase = static_cast<wxTrackable*>(pobj);
+ DoAssign( pobj, ptbase );
+ }
+
+#ifndef wxNO_RTTI
+ void AssignHelper(T* pobj, wxInt2Type<false>)
+ {
+ // A last way to get a trackable pointer
+ wxTrackable *ptbase = dynamic_cast<wxTrackable*>(pobj);
+ if ( ptbase )
+ {
+ DoAssign( pobj, ptbase );
+ }
+ else
+ {
+ wxFAIL_MSG( "Tracked class should inherit from wxTrackable" );
+
+ Release();
+ }
+ }
+#endif // RTTI enabled
+
+ void AssignCopy(const wxWeakRefImpl& wr)
+ {
+ DoAssign(wr.m_pobj, wr.m_ptbase);
+ }
+
+ void DoAssign( T* pobj, wxTrackable *ptbase ) {
+ if( m_pobj==pobj ) return;
+ Release();
+
+ // Now set new trackable object
+ if( pobj )
+ {
+ // Add ourselves to object tracker list
+ wxASSERT( ptbase );
+ ptbase->AddNode( this );
+ m_pobj = pobj;
+ m_ptbase = ptbase;
+ }
+ }
+
+ T *m_pobj;
+ wxTrackable *m_ptbase;
+};
+
+#endif // #ifndef USE_ONLY_STATIC_WEAKREF
+
+
+
+// A weak reference to an object of type T, where T has base wxTrackable
+// (usually statically but if not dynamic_cast<> is tried).
+template <class T>
+class wxWeakRef : public
+#ifdef USE_ONLY_STATIC_WEAKREF
+ wxWeakRefStatic<T>
+#else
+ wxWeakRefImpl<T, wxIsStaticTrackable<T>::value != 0>
+#endif
+{
+public:
+ typedef T element_type;
+
+ // Default ctor
+ wxWeakRef() { }
+
+ // Enabling this ctor for VC6 results in mysterious compilation failures in
+ // wx/window.h when assigning wxWindow pointers (FIXME-VC6)
+#ifndef __VISUALC6__
+ // Ctor from the object of this type: this is needed as the template ctor
+ // below is not used by at least g++4 when a literal NULL is used
+ wxWeakRef(T *pobj)
+ {
+ this->Assign(pobj);
+ }
+#endif // !__VISUALC6__
+
+ // When we have the full type here, static_cast<> will always work
+ // (or give a straight compiler error).
+ template <class TDerived>
+ wxWeakRef(TDerived* pobj)
+ {
+ this->Assign(pobj);
+ }
+
+ // We need this copy ctor, since otherwise a default compiler (binary) copy
+ // happens (if embedded as an object member).
+ wxWeakRef(const wxWeakRef<T>& wr)
+ {
+ this->Assign(wr.get());
+ }
+
+ wxWeakRef<T>& operator=(const wxWeakRef<T>& wr)
+ {
+ this->AssignCopy(wr);
+ return *this;
+ }
+
+ virtual ~wxWeakRef() { this->Release(); }
+
+ // Smart pointer functions
+ T& operator*() const { return *this->m_pobj; }
+ T* operator->() const { return this->m_pobj; }
+
+ T* get() const { return this->m_pobj; }
+ operator T*() const { return this->m_pobj; }
+};
+
+
+#ifndef wxNO_RTTI
+
+// Weak ref implementation assign objects are queried for wxTrackable
+// using dynamic_cast<>
+template <class T>
+class wxWeakRefDynamic : public wxTrackerNode
+{
+public:
+ wxWeakRefDynamic() : m_pobj(NULL) { }
+
+ wxWeakRefDynamic(T* pobj) : m_pobj(pobj)
+ {
+ Assign(pobj);
+ }
+
+ wxWeakRefDynamic(const wxWeakRef<T>& wr)
+ {
+ Assign(wr.get());
+ }
+
+ virtual ~wxWeakRefDynamic() { Release(); }
+
+ // Smart pointer functions
+ T& operator*() const { wxASSERT(m_pobj); return *m_pobj; }
+ T* operator->() const { wxASSERT(m_pobj); return m_pobj; }
+
+ T* get() const { return m_pobj; }
+ operator T* () const { return m_pobj; }
+
+ T* operator = (T* pobj) { Assign(pobj); return m_pobj; }
+
+ // Assign from another weak ref, point to same object
+ T* operator = (const wxWeakRef<T> &wr) { Assign( wr.get() ); return m_pobj; }
+
+ void Release()
+ {
+ // Release old object if any
+ if( m_pobj )
+ {
+ // Remove ourselves from object tracker list
+ wxTrackable *pt = dynamic_cast<wxTrackable*>(m_pobj);
+ wxASSERT(pt);
+ pt->RemoveNode(this);
+ m_pobj = NULL;
+ }
+ }
+
+ virtual void OnObjectDestroy()
+ {
+ wxASSERT_MSG(m_pobj, "tracked object should have removed us itself");
+
+ m_pobj = NULL;
+ }
+
+protected:
+ void Assign(T *pobj)
+ {
+ if ( m_pobj == pobj )
+ return;
+
+ Release();
+
+ // Now set new trackable object
+ if ( pobj )
+ {
+ // Add ourselves to object tracker list
+ wxTrackable *pt = dynamic_cast<wxTrackable*>(pobj);
+ if ( pt )
+ {
+ pt->AddNode(this);
+ m_pobj = pobj;
+ }
+ else
+ {
+ // If the object we want to track does not support wxTackable, then
+ // log a message and keep the NULL object pointer.
+ wxFAIL_MSG( "Tracked class should inherit from wxTrackable" );
+ }
+ }
+ }
+
+ T *m_pobj;
+};
+
+#endif // RTTI enabled
+
+
+// Provide some basic types of weak references
+class WXDLLIMPEXP_FWD_BASE wxEvtHandler;
+class WXDLLIMPEXP_FWD_CORE wxWindow;
+
+
+typedef wxWeakRef<wxEvtHandler> wxEvtHandlerRef;
+typedef wxWeakRef<wxWindow> wxWindowRef;
+
+#endif // _WX_WEAKREF_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: webview.h
+// Purpose: Common interface and events for web view component
+// Author: Marianne Gagnon
+// Copyright: (c) 2010 Marianne Gagnon, 2011 Steven Lamerton
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WEBVIEW_H_
+#define _WX_WEBVIEW_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_WEBVIEW
+
+#include "wx/control.h"
+#include "wx/event.h"
+#include "wx/sstream.h"
+#include "wx/sharedptr.h"
+#include "wx/vector.h"
+
+#if defined(__WXOSX__)
+ #include "wx/osx/webviewhistoryitem_webkit.h"
+#elif defined(__WXGTK__)
+ #include "wx/gtk/webviewhistoryitem_webkit.h"
+#elif defined(__WXMSW__)
+ #include "wx/msw/webviewhistoryitem_ie.h"
+#else
+ #error "wxWebView not implemented on this platform."
+#endif
+
+class wxFSFile;
+class wxFileSystem;
+class wxWebView;
+
+enum wxWebViewZoom
+{
+ wxWEBVIEW_ZOOM_TINY,
+ wxWEBVIEW_ZOOM_SMALL,
+ wxWEBVIEW_ZOOM_MEDIUM,
+ wxWEBVIEW_ZOOM_LARGE,
+ wxWEBVIEW_ZOOM_LARGEST
+};
+
+enum wxWebViewZoomType
+{
+ //Scales entire page, including images
+ wxWEBVIEW_ZOOM_TYPE_LAYOUT,
+ wxWEBVIEW_ZOOM_TYPE_TEXT
+};
+
+enum wxWebViewNavigationError
+{
+ wxWEBVIEW_NAV_ERR_CONNECTION,
+ wxWEBVIEW_NAV_ERR_CERTIFICATE,
+ wxWEBVIEW_NAV_ERR_AUTH,
+ wxWEBVIEW_NAV_ERR_SECURITY,
+ wxWEBVIEW_NAV_ERR_NOT_FOUND,
+ wxWEBVIEW_NAV_ERR_REQUEST,
+ wxWEBVIEW_NAV_ERR_USER_CANCELLED,
+ wxWEBVIEW_NAV_ERR_OTHER
+};
+
+enum wxWebViewReloadFlags
+{
+ //Default, may access cache
+ wxWEBVIEW_RELOAD_DEFAULT,
+ wxWEBVIEW_RELOAD_NO_CACHE
+};
+
+enum wxWebViewFindFlags
+{
+ wxWEBVIEW_FIND_WRAP = 0x0001,
+ wxWEBVIEW_FIND_ENTIRE_WORD = 0x0002,
+ wxWEBVIEW_FIND_MATCH_CASE = 0x0004,
+ wxWEBVIEW_FIND_HIGHLIGHT_RESULT = 0x0008,
+ wxWEBVIEW_FIND_BACKWARDS = 0x0010,
+ wxWEBVIEW_FIND_DEFAULT = 0
+};
+
+//Base class for custom scheme handlers
+class WXDLLIMPEXP_WEBVIEW wxWebViewHandler
+{
+public:
+ wxWebViewHandler(const wxString& scheme) : m_scheme(scheme) {}
+ virtual ~wxWebViewHandler() {}
+ virtual wxString GetName() const { return m_scheme; }
+ virtual wxFSFile* GetFile(const wxString &uri) = 0;
+private:
+ wxString m_scheme;
+};
+
+extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewNameStr[];
+extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewDefaultURLStr[];
+extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewBackendDefault[];
+extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewBackendIE[];
+extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewBackendWebKit[];
+
+class WXDLLIMPEXP_WEBVIEW wxWebViewFactory : public wxObject
+{
+public:
+ virtual wxWebView* Create() = 0;
+ virtual wxWebView* Create(wxWindow* parent,
+ wxWindowID id,
+ const wxString& url = wxWebViewDefaultURLStr,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxWebViewNameStr) = 0;
+};
+
+WX_DECLARE_STRING_HASH_MAP(wxSharedPtr<wxWebViewFactory>, wxStringWebViewFactoryMap);
+
+class WXDLLIMPEXP_WEBVIEW wxWebView : public wxControl
+{
+public:
+ wxWebView()
+ {
+ m_showMenu = true;
+ }
+
+ virtual ~wxWebView() {}
+
+ virtual bool Create(wxWindow* parent,
+ wxWindowID id,
+ const wxString& url = wxWebViewDefaultURLStr,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxWebViewNameStr) = 0;
+
+ // Factory methods allowing the use of custom factories registered with
+ // RegisterFactory
+ static wxWebView* New(const wxString& backend = wxWebViewBackendDefault);
+ static wxWebView* New(wxWindow* parent,
+ wxWindowID id,
+ const wxString& url = wxWebViewDefaultURLStr,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ const wxString& backend = wxWebViewBackendDefault,
+ long style = 0,
+ const wxString& name = wxWebViewNameStr);
+
+ static void RegisterFactory(const wxString& backend,
+ wxSharedPtr<wxWebViewFactory> factory);
+
+ // General methods
+ virtual void EnableContextMenu(bool enable = true)
+ {
+ m_showMenu = enable;
+ }
+ virtual wxString GetCurrentTitle() const = 0;
+ virtual wxString GetCurrentURL() const = 0;
+ // TODO: handle choosing a frame when calling GetPageSource()?
+ virtual wxString GetPageSource() const = 0;
+ virtual wxString GetPageText() const = 0;
+ virtual bool IsBusy() const = 0;
+ virtual bool IsContextMenuEnabled() const { return m_showMenu; }
+ virtual bool IsEditable() const = 0;
+ virtual void LoadURL(const wxString& url) = 0;
+ virtual void Print() = 0;
+ virtual void RegisterHandler(wxSharedPtr<wxWebViewHandler> handler) = 0;
+ virtual void Reload(wxWebViewReloadFlags flags = wxWEBVIEW_RELOAD_DEFAULT) = 0;
+ virtual void RunScript(const wxString& javascript) = 0;
+ virtual void SetEditable(bool enable = true) = 0;
+ void SetPage(const wxString& html, const wxString& baseUrl)
+ {
+ DoSetPage(html, baseUrl);
+ }
+ void SetPage(wxInputStream& html, wxString baseUrl)
+ {
+ wxStringOutputStream stream;
+ stream.Write(html);
+ DoSetPage(stream.GetString(), baseUrl);
+ }
+ virtual void Stop() = 0;
+
+ //History
+ virtual bool CanGoBack() const = 0;
+ virtual bool CanGoForward() const = 0;
+ virtual void GoBack() = 0;
+ virtual void GoForward() = 0;
+ virtual void ClearHistory() = 0;
+ virtual void EnableHistory(bool enable = true) = 0;
+ virtual wxVector<wxSharedPtr<wxWebViewHistoryItem> > GetBackwardHistory() = 0;
+ virtual wxVector<wxSharedPtr<wxWebViewHistoryItem> > GetForwardHistory() = 0;
+ virtual void LoadHistoryItem(wxSharedPtr<wxWebViewHistoryItem> item) = 0;
+
+ //Zoom
+ virtual bool CanSetZoomType(wxWebViewZoomType type) const = 0;
+ virtual wxWebViewZoom GetZoom() const = 0;
+ virtual wxWebViewZoomType GetZoomType() const = 0;
+ virtual void SetZoom(wxWebViewZoom zoom) = 0;
+ virtual void SetZoomType(wxWebViewZoomType zoomType) = 0;
+
+ //Selection
+ virtual void SelectAll() = 0;
+ virtual bool HasSelection() const = 0;
+ virtual void DeleteSelection() = 0;
+ virtual wxString GetSelectedText() const = 0;
+ virtual wxString GetSelectedSource() const = 0;
+ virtual void ClearSelection() = 0;
+
+ //Clipboard functions
+ virtual bool CanCut() const = 0;
+ virtual bool CanCopy() const = 0;
+ virtual bool CanPaste() const = 0;
+ virtual void Cut() = 0;
+ virtual void Copy() = 0;
+ virtual void Paste() = 0;
+
+ //Undo / redo functionality
+ virtual bool CanUndo() const = 0;
+ virtual bool CanRedo() const = 0;
+ virtual void Undo() = 0;
+ virtual void Redo() = 0;
+
+ //Get the pointer to the underlying native engine.
+ virtual void* GetNativeBackend() const = 0;
+ //Find function
+ virtual long Find(const wxString& text, int flags = wxWEBVIEW_FIND_DEFAULT) = 0;
+
+protected:
+ virtual void DoSetPage(const wxString& html, const wxString& baseUrl) = 0;
+
+private:
+ static void InitFactoryMap();
+ static wxStringWebViewFactoryMap::iterator FindFactory(const wxString &backend);
+
+ bool m_showMenu;
+ static wxStringWebViewFactoryMap m_factoryMap;
+
+ wxDECLARE_ABSTRACT_CLASS(wxWebView);
+};
+
+class WXDLLIMPEXP_WEBVIEW wxWebViewEvent : public wxNotifyEvent
+{
+public:
+ wxWebViewEvent() {}
+ wxWebViewEvent(wxEventType type, int id, const wxString url,
+ const wxString target)
+ : wxNotifyEvent(type, id), m_url(url), m_target(target)
+ {}
+
+
+ const wxString& GetURL() const { return m_url; }
+ const wxString& GetTarget() const { return m_target; }
+
+ virtual wxEvent* Clone() const { return new wxWebViewEvent(*this); }
+private:
+ wxString m_url;
+ wxString m_target;
+
+ wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWebViewEvent);
+};
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_WEBVIEW_NAVIGATING, wxWebViewEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_WEBVIEW_NAVIGATED, wxWebViewEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_WEBVIEW_LOADED, wxWebViewEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_WEBVIEW_ERROR, wxWebViewEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_WEBVIEW_NEWWINDOW, wxWebViewEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_WEBVIEW_TITLE_CHANGED, wxWebViewEvent );
+
+typedef void (wxEvtHandler::*wxWebViewEventFunction)
+ (wxWebViewEvent&);
+
+#define wxWebViewEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxWebViewEventFunction, func)
+
+#define EVT_WEBVIEW_NAVIGATING(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_WEBVIEW_NAVIGATING, id, \
+ wxWebViewEventHandler(fn))
+
+#define EVT_WEBVIEW_NAVIGATED(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_WEBVIEW_NAVIGATED, id, \
+ wxWebViewEventHandler(fn))
+
+#define EVT_WEBVIEW_LOADED(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_WEBVIEW_LOADED, id, \
+ wxWebViewEventHandler(fn))
+
+#define EVT_WEBVIEW_ERROR(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_WEBVIEW_ERROR, id, \
+ wxWebViewEventHandler(fn))
+
+#define EVT_WEBVIEW_NEWWINDOW(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_WEBVIEW_NEWWINDOW, id, \
+ wxWebViewEventHandler(fn))
+
+#define EVT_WEBVIEW_TITLE_CHANGED(id, fn) \
+ wx__DECLARE_EVT1(wxEVT_WEBVIEW_TITLE_CHANGED, id, \
+ wxWebViewEventHandler(fn))
+
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_WEBVIEW_NAVIGATING wxEVT_WEBVIEW_NAVIGATING
+#define wxEVT_COMMAND_WEBVIEW_NAVIGATED wxEVT_WEBVIEW_NAVIGATED
+#define wxEVT_COMMAND_WEBVIEW_LOADED wxEVT_WEBVIEW_LOADED
+#define wxEVT_COMMAND_WEBVIEW_ERROR wxEVT_WEBVIEW_ERROR
+#define wxEVT_COMMAND_WEBVIEW_NEWWINDOW wxEVT_WEBVIEW_NEWWINDOW
+#define wxEVT_COMMAND_WEBVIEW_TITLE_CHANGED wxEVT_WEBVIEW_TITLE_CHANGED
+
+#endif // wxUSE_WEBVIEW
+
+#endif // _WX_WEBVIEW_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: webviewarchivehandler.h
+// Purpose: Custom webview handler to allow archive browsing
+// Author: Steven Lamerton
+// Copyright: (c) 2011 Steven Lamerton
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WEBVIEW_FILE_HANDLER_H_
+#define _WX_WEBVIEW_FILE_HANDLER_H_
+
+#include "wx/setup.h"
+
+#if wxUSE_WEBVIEW
+
+class wxFSFile;
+class wxFileSystem;
+
+#include "wx/webview.h"
+
+//Loads from uris such as scheme:///C:/example/example.html or archives such as
+//scheme:///C:/example/example.zip;protocol=zip/example.html
+
+class WXDLLIMPEXP_WEBVIEW wxWebViewArchiveHandler : public wxWebViewHandler
+{
+public:
+ wxWebViewArchiveHandler(const wxString& scheme);
+ virtual ~wxWebViewArchiveHandler();
+ virtual wxFSFile* GetFile(const wxString &uri);
+private:
+ wxFileSystem* m_fileSystem;
+};
+
+#endif // wxUSE_WEBVIEW
+
+#endif // _WX_WEBVIEW_FILE_HANDLER_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: webviewfshandler.h
+// Purpose: Custom webview handler for virtual file system
+// Author: Nick Matthews
+// Copyright: (c) 2012 Steven Lamerton
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// Based on webviewarchivehandler.h file by Steven Lamerton
+
+#ifndef _WX_WEBVIEW_FS_HANDLER_H_
+#define _WX_WEBVIEW_FS_HANDLER_H_
+
+#include "wx/setup.h"
+
+#if wxUSE_WEBVIEW
+
+class wxFSFile;
+class wxFileSystem;
+
+#include "wx/webview.h"
+
+//Loads from uris such as scheme:example.html
+
+class WXDLLIMPEXP_WEBVIEW wxWebViewFSHandler : public wxWebViewHandler
+{
+public:
+ wxWebViewFSHandler(const wxString& scheme);
+ virtual ~wxWebViewFSHandler();
+ virtual wxFSFile* GetFile(const wxString &uri);
+private:
+ wxFileSystem* m_fileSystem;
+};
+
+#endif // wxUSE_WEBVIEW
+
+#endif // _WX_WEBVIEW_FS_HANDLER_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/wfstream.h
+// Purpose: File stream classes
+// Author: Guilhem Lavaux
+// Modified by:
+// Created: 11/07/98
+// Copyright: (c) Guilhem Lavaux
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WXFSTREAM_H__
+#define _WX_WXFSTREAM_H__
+
+#include "wx/defs.h"
+
+#if wxUSE_STREAMS
+
+#include "wx/object.h"
+#include "wx/string.h"
+#include "wx/stream.h"
+#include "wx/file.h"
+#include "wx/ffile.h"
+
+#if wxUSE_FILE
+
+// ----------------------------------------------------------------------------
+// wxFileStream using wxFile
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxFileInputStream : public wxInputStream
+{
+public:
+ wxFileInputStream(const wxString& ifileName);
+ wxFileInputStream(wxFile& file);
+ wxFileInputStream(int fd);
+ virtual ~wxFileInputStream();
+
+ wxFileOffset GetLength() const;
+
+ bool Ok() const { return IsOk(); }
+ virtual bool IsOk() const;
+ bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; }
+
+ wxFile* GetFile() const { return m_file; }
+
+protected:
+ wxFileInputStream();
+
+ size_t OnSysRead(void *buffer, size_t size);
+ wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
+ wxFileOffset OnSysTell() const;
+
+protected:
+ wxFile *m_file;
+ bool m_file_destroy;
+
+ wxDECLARE_NO_COPY_CLASS(wxFileInputStream);
+};
+
+class WXDLLIMPEXP_BASE wxFileOutputStream : public wxOutputStream
+{
+public:
+ wxFileOutputStream(const wxString& fileName);
+ wxFileOutputStream(wxFile& file);
+ wxFileOutputStream(int fd);
+ virtual ~wxFileOutputStream();
+
+ void Sync();
+ bool Close() { return m_file_destroy ? m_file->Close() : true; }
+ wxFileOffset GetLength() const;
+
+ bool Ok() const { return IsOk(); }
+ virtual bool IsOk() const;
+ bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; }
+
+ wxFile* GetFile() const { return m_file; }
+
+protected:
+ wxFileOutputStream();
+
+ size_t OnSysWrite(const void *buffer, size_t size);
+ wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
+ wxFileOffset OnSysTell() const;
+
+protected:
+ wxFile *m_file;
+ bool m_file_destroy;
+
+ wxDECLARE_NO_COPY_CLASS(wxFileOutputStream);
+};
+
+class WXDLLIMPEXP_BASE wxTempFileOutputStream : public wxOutputStream
+{
+public:
+ wxTempFileOutputStream(const wxString& fileName);
+ virtual ~wxTempFileOutputStream();
+
+ bool Close() { return Commit(); }
+ WXDLLIMPEXP_INLINE_BASE virtual bool Commit() { return m_file->Commit(); }
+ WXDLLIMPEXP_INLINE_BASE virtual void Discard() { m_file->Discard(); }
+
+ wxFileOffset GetLength() const { return m_file->Length(); }
+ bool IsSeekable() const { return true; }
+
+protected:
+ size_t OnSysWrite(const void *buffer, size_t size);
+ wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode)
+ { return m_file->Seek(pos, mode); }
+ wxFileOffset OnSysTell() const { return m_file->Tell(); }
+
+private:
+ wxTempFile *m_file;
+
+ wxDECLARE_NO_COPY_CLASS(wxTempFileOutputStream);
+};
+
+class WXDLLIMPEXP_BASE wxFileStream : public wxFileInputStream,
+ public wxFileOutputStream
+{
+public:
+ wxFileStream(const wxString& fileName);
+ virtual bool IsOk() const;
+
+ // override (some) virtual functions inherited from both classes to resolve
+ // ambiguities (this wouldn't be necessary if wxStreamBase were a virtual
+ // base class but it isn't)
+
+ virtual bool IsSeekable() const
+ {
+ return wxFileInputStream::IsSeekable();
+ }
+
+ virtual wxFileOffset GetLength() const
+ {
+ return wxFileInputStream::GetLength();
+ }
+
+protected:
+ virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode)
+ {
+ return wxFileInputStream::OnSysSeek(pos, mode);
+ }
+
+ virtual wxFileOffset OnSysTell() const
+ {
+ return wxFileInputStream::OnSysTell();
+ }
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxFileStream);
+};
+
+#endif //wxUSE_FILE
+
+#if wxUSE_FFILE
+
+// ----------------------------------------------------------------------------
+// wxFFileStream using wxFFile
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxFFileInputStream : public wxInputStream
+{
+public:
+ wxFFileInputStream(const wxString& fileName, const wxString& mode = "rb");
+ wxFFileInputStream(wxFFile& file);
+ wxFFileInputStream(FILE *file);
+ virtual ~wxFFileInputStream();
+
+ wxFileOffset GetLength() const;
+
+ bool Ok() const { return IsOk(); }
+ virtual bool IsOk() const;
+ bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; }
+
+ wxFFile* GetFile() const { return m_file; }
+
+protected:
+ wxFFileInputStream();
+
+ size_t OnSysRead(void *buffer, size_t size);
+ wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
+ wxFileOffset OnSysTell() const;
+
+protected:
+ wxFFile *m_file;
+ bool m_file_destroy;
+
+ wxDECLARE_NO_COPY_CLASS(wxFFileInputStream);
+};
+
+class WXDLLIMPEXP_BASE wxFFileOutputStream : public wxOutputStream
+{
+public:
+ wxFFileOutputStream(const wxString& fileName, const wxString& mode = "wb");
+ wxFFileOutputStream(wxFFile& file);
+ wxFFileOutputStream(FILE *file);
+ virtual ~wxFFileOutputStream();
+
+ void Sync();
+ bool Close() { return m_file_destroy ? m_file->Close() : true; }
+ wxFileOffset GetLength() const;
+
+ bool Ok() const { return IsOk(); }
+ virtual bool IsOk() const;
+ bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; }
+
+ wxFFile* GetFile() const { return m_file; }
+
+protected:
+ wxFFileOutputStream();
+
+ size_t OnSysWrite(const void *buffer, size_t size);
+ wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
+ wxFileOffset OnSysTell() const;
+
+protected:
+ wxFFile *m_file;
+ bool m_file_destroy;
+
+ wxDECLARE_NO_COPY_CLASS(wxFFileOutputStream);
+};
+
+class WXDLLIMPEXP_BASE wxFFileStream : public wxFFileInputStream,
+ public wxFFileOutputStream
+{
+public:
+ wxFFileStream(const wxString& fileName, const wxString& mode = "w+b");
+
+ // override some virtual functions to resolve ambiguities, just as in
+ // wxFileStream
+
+ virtual bool IsOk() const;
+
+ virtual bool IsSeekable() const
+ {
+ return wxFFileInputStream::IsSeekable();
+ }
+
+ virtual wxFileOffset GetLength() const
+ {
+ return wxFFileInputStream::GetLength();
+ }
+
+protected:
+ virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode)
+ {
+ return wxFFileInputStream::OnSysSeek(pos, mode);
+ }
+
+ virtual wxFileOffset OnSysTell() const
+ {
+ return wxFFileInputStream::OnSysTell();
+ }
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxFFileStream);
+};
+
+#endif //wxUSE_FFILE
+
+#endif // wxUSE_STREAMS
+
+#endif // _WX_WXFSTREAM_H__
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/window.h
+// Purpose: wxWindowBase class - the interface of wxWindow
+// Author: Vadim Zeitlin
+// Modified by: Ron Lee
+// Created: 01/02/97
+// Copyright: (c) Vadim Zeitlin
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WINDOW_H_BASE_
+#define _WX_WINDOW_H_BASE_
+
+// ----------------------------------------------------------------------------
+// headers which we must include here
+// ----------------------------------------------------------------------------
+
+#include "wx/event.h" // the base class
+
+#include "wx/list.h" // defines wxWindowList
+
+#include "wx/cursor.h" // we have member variables of these classes
+#include "wx/font.h" // so we can't do without them
+#include "wx/colour.h"
+#include "wx/region.h"
+#include "wx/utils.h"
+#include "wx/intl.h"
+
+#include "wx/validate.h" // for wxDefaultValidator (always include it)
+
+#if wxUSE_PALETTE
+ #include "wx/palette.h"
+#endif // wxUSE_PALETTE
+
+#if wxUSE_ACCEL
+ #include "wx/accel.h"
+#endif // wxUSE_ACCEL
+
+#if wxUSE_ACCESSIBILITY
+#include "wx/access.h"
+#endif
+
+// when building wxUniv/Foo we don't want the code for native menu use to be
+// compiled in - it should only be used when building real wxFoo
+#ifdef __WXUNIVERSAL__
+ #define wxUSE_MENUS_NATIVE 0
+#else // !__WXUNIVERSAL__
+ #define wxUSE_MENUS_NATIVE wxUSE_MENUS
+#endif // __WXUNIVERSAL__/!__WXUNIVERSAL__
+
+
+// Define this macro if the corresponding operating system handles the state
+// of children windows automatically when the parent is enabled/disabled.
+// Otherwise wx itself must ensure that when the parent is disabled its
+// children are disabled too, and their initial state is restored when the
+// parent is enabled back.
+#if defined(__WXMSW__) || defined(__WXPM__)
+ // must do everything ourselves
+ #undef wxHAS_NATIVE_ENABLED_MANAGEMENT
+#else
+ #define wxHAS_NATIVE_ENABLED_MANAGEMENT
+#endif
+
+// ----------------------------------------------------------------------------
+// forward declarations
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_CORE wxCaret;
+class WXDLLIMPEXP_FWD_CORE wxControl;
+class WXDLLIMPEXP_FWD_CORE wxCursor;
+class WXDLLIMPEXP_FWD_CORE wxDC;
+class WXDLLIMPEXP_FWD_CORE wxDropTarget;
+class WXDLLIMPEXP_FWD_CORE wxLayoutConstraints;
+class WXDLLIMPEXP_FWD_CORE wxSizer;
+class WXDLLIMPEXP_FWD_CORE wxToolTip;
+class WXDLLIMPEXP_FWD_CORE wxWindowBase;
+class WXDLLIMPEXP_FWD_CORE wxWindow;
+class WXDLLIMPEXP_FWD_CORE wxScrollHelper;
+
+#if wxUSE_ACCESSIBILITY
+class WXDLLIMPEXP_FWD_CORE wxAccessible;
+#endif
+
+// ----------------------------------------------------------------------------
+// helper stuff used by wxWindow
+// ----------------------------------------------------------------------------
+
+// struct containing all the visual attributes of a control
+struct WXDLLIMPEXP_CORE wxVisualAttributes
+{
+ // the font used for control label/text inside it
+ wxFont font;
+
+ // the foreground colour
+ wxColour colFg;
+
+ // the background colour, may be wxNullColour if the controls background
+ // colour is not solid
+ wxColour colBg;
+};
+
+// different window variants, on platforms like eg mac uses different
+// rendering sizes
+enum wxWindowVariant
+{
+ wxWINDOW_VARIANT_NORMAL, // Normal size
+ wxWINDOW_VARIANT_SMALL, // Smaller size (about 25 % smaller than normal)
+ wxWINDOW_VARIANT_MINI, // Mini size (about 33 % smaller than normal)
+ wxWINDOW_VARIANT_LARGE, // Large size (about 25 % larger than normal)
+ wxWINDOW_VARIANT_MAX
+};
+
+#if wxUSE_SYSTEM_OPTIONS
+ #define wxWINDOW_DEFAULT_VARIANT wxT("window-default-variant")
+#endif
+
+// valid values for Show/HideWithEffect()
+enum wxShowEffect
+{
+ wxSHOW_EFFECT_NONE,
+ wxSHOW_EFFECT_ROLL_TO_LEFT,
+ wxSHOW_EFFECT_ROLL_TO_RIGHT,
+ wxSHOW_EFFECT_ROLL_TO_TOP,
+ wxSHOW_EFFECT_ROLL_TO_BOTTOM,
+ wxSHOW_EFFECT_SLIDE_TO_LEFT,
+ wxSHOW_EFFECT_SLIDE_TO_RIGHT,
+ wxSHOW_EFFECT_SLIDE_TO_TOP,
+ wxSHOW_EFFECT_SLIDE_TO_BOTTOM,
+ wxSHOW_EFFECT_BLEND,
+ wxSHOW_EFFECT_EXPAND,
+ wxSHOW_EFFECT_MAX
+};
+
+// flags for SendSizeEvent()
+enum
+{
+ wxSEND_EVENT_POST = 1
+};
+
+// ----------------------------------------------------------------------------
+// (pseudo)template list classes
+// ----------------------------------------------------------------------------
+
+WX_DECLARE_LIST_3(wxWindow, wxWindowBase, wxWindowList, wxWindowListNode, class WXDLLIMPEXP_CORE);
+
+// ----------------------------------------------------------------------------
+// global variables
+// ----------------------------------------------------------------------------
+
+extern WXDLLIMPEXP_DATA_CORE(wxWindowList) wxTopLevelWindows;
+
+// declared here for compatibility only, main declaration is in wx/app.h
+extern WXDLLIMPEXP_DATA_BASE(wxList) wxPendingDelete;
+
+// ----------------------------------------------------------------------------
+// wxWindowBase is the base class for all GUI controls/widgets, this is the public
+// interface of this class.
+//
+// Event handler: windows have themselves as their event handlers by default,
+// but their event handlers could be set to another object entirely. This
+// separation can reduce the amount of derivation required, and allow
+// alteration of a window's functionality (e.g. by a resource editor that
+// temporarily switches event handlers).
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxWindowBase : public wxEvtHandler
+{
+public:
+ // creating the window
+ // -------------------
+
+ // default ctor, initializes everything which can be initialized before
+ // Create()
+ wxWindowBase() ;
+
+ virtual ~wxWindowBase();
+
+ // deleting the window
+ // -------------------
+
+ // ask the window to close itself, return true if the event handler
+ // honoured our request
+ bool Close( bool force = false );
+
+ // the following functions delete the C++ objects (the window itself
+ // or its children) as well as the GUI windows and normally should
+ // never be used directly
+
+ // delete window unconditionally (dangerous!), returns true if ok
+ virtual bool Destroy();
+ // delete all children of this window, returns true if ok
+ bool DestroyChildren();
+
+ // is the window being deleted?
+ bool IsBeingDeleted() const;
+
+ // window attributes
+ // -----------------
+
+ // label is just the same as the title (but for, e.g., buttons it
+ // makes more sense to speak about labels), title access
+ // is available from wxTLW classes only (frames, dialogs)
+ virtual void SetLabel(const wxString& label) = 0;
+ virtual wxString GetLabel() const = 0;
+
+ // the window name is used for ressource setting in X, it is not the
+ // same as the window title/label
+ virtual void SetName( const wxString &name ) { m_windowName = name; }
+ virtual wxString GetName() const { return m_windowName; }
+
+ // sets the window variant, calls internally DoSetVariant if variant
+ // has changed
+ void SetWindowVariant(wxWindowVariant variant);
+ wxWindowVariant GetWindowVariant() const { return m_windowVariant; }
+
+
+ // get or change the layout direction (LTR or RTL) for this window,
+ // wxLayout_Default is returned if layout direction is not supported
+ virtual wxLayoutDirection GetLayoutDirection() const
+ { return wxLayout_Default; }
+ virtual void SetLayoutDirection(wxLayoutDirection WXUNUSED(dir))
+ { }
+
+ // mirror coordinates for RTL layout if this window uses it and if the
+ // mirroring is not done automatically like Win32
+ virtual wxCoord AdjustForLayoutDirection(wxCoord x,
+ wxCoord width,
+ wxCoord widthTotal) const;
+
+
+ // window id uniquely identifies the window among its siblings unless
+ // it is wxID_ANY which means "don't care"
+ void SetId( wxWindowID winid ) { m_windowId = winid; }
+ wxWindowID GetId() const { return m_windowId; }
+
+ // generate a unique id (or count of them consecutively), returns a
+ // valid id in the auto-id range or wxID_NONE if failed. If using
+ // autoid management, it will mark the id as reserved until it is
+ // used (by assigning it to a wxWindowIDRef) or unreserved.
+ static wxWindowID NewControlId(int count = 1)
+ {
+ return wxIdManager::ReserveId(count);
+ }
+
+ // If an ID generated from NewControlId is not assigned to a wxWindowIDRef,
+ // it must be unreserved
+ static void UnreserveControlId(wxWindowID id, int count = 1)
+ {
+ wxIdManager::UnreserveId(id, count);
+ }
+
+
+ // moving/resizing
+ // ---------------
+
+ // set the window size and/or position
+ void SetSize( int x, int y, int width, int height,
+ int sizeFlags = wxSIZE_AUTO )
+ { DoSetSize(x, y, width, height, sizeFlags); }
+
+ void SetSize( int width, int height )
+ { DoSetSize( wxDefaultCoord, wxDefaultCoord, width, height, wxSIZE_USE_EXISTING ); }
+
+ void SetSize( const wxSize& size )
+ { SetSize( size.x, size.y); }
+
+ void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO)
+ { DoSetSize(rect.x, rect.y, rect.width, rect.height, sizeFlags); }
+
+ void Move(int x, int y, int flags = wxSIZE_USE_EXISTING)
+ { DoSetSize(x, y, wxDefaultCoord, wxDefaultCoord, flags); }
+
+ void Move(const wxPoint& pt, int flags = wxSIZE_USE_EXISTING)
+ { Move(pt.x, pt.y, flags); }
+
+ void SetPosition(const wxPoint& pt) { Move(pt); }
+
+ // Z-order
+ virtual void Raise() = 0;
+ virtual void Lower() = 0;
+
+ // client size is the size of area available for subwindows
+ void SetClientSize( int width, int height )
+ { DoSetClientSize(width, height); }
+
+ void SetClientSize( const wxSize& size )
+ { DoSetClientSize(size.x, size.y); }
+
+ void SetClientSize(const wxRect& rect)
+ { SetClientSize( rect.width, rect.height ); }
+
+ // get the window position (pointers may be NULL): notice that it is in
+ // client coordinates for child windows and screen coordinates for the
+ // top level ones, use GetScreenPosition() if you need screen
+ // coordinates for all kinds of windows
+ void GetPosition( int *x, int *y ) const { DoGetPosition(x, y); }
+ wxPoint GetPosition() const
+ {
+ int x, y;
+ DoGetPosition(&x, &y);
+
+ return wxPoint(x, y);
+ }
+
+ // get the window position in screen coordinates
+ void GetScreenPosition(int *x, int *y) const { DoGetScreenPosition(x, y); }
+ wxPoint GetScreenPosition() const
+ {
+ int x, y;
+ DoGetScreenPosition(&x, &y);
+
+ return wxPoint(x, y);
+ }
+
+ // get the window size (pointers may be NULL)
+ void GetSize( int *w, int *h ) const { DoGetSize(w, h); }
+ wxSize GetSize() const
+ {
+ int w, h;
+ DoGetSize(& w, & h);
+ return wxSize(w, h);
+ }
+
+ void GetClientSize( int *w, int *h ) const { DoGetClientSize(w, h); }
+ wxSize GetClientSize() const
+ {
+ int w, h;
+ DoGetClientSize(&w, &h);
+
+ return wxSize(w, h);
+ }
+
+ // get the position and size at once
+ wxRect GetRect() const
+ {
+ int x, y, w, h;
+ GetPosition(&x, &y);
+ GetSize(&w, &h);
+
+ return wxRect(x, y, w, h);
+ }
+
+ wxRect GetScreenRect() const
+ {
+ int x, y, w, h;
+ GetScreenPosition(&x, &y);
+ GetSize(&w, &h);
+
+ return wxRect(x, y, w, h);
+ }
+
+ // get the origin of the client area of the window relative to the
+ // window top left corner (the client area may be shifted because of
+ // the borders, scrollbars, other decorations...)
+ virtual wxPoint GetClientAreaOrigin() const;
+
+ // get the client rectangle in window (i.e. client) coordinates
+ wxRect GetClientRect() const
+ {
+ return wxRect(GetClientAreaOrigin(), GetClientSize());
+ }
+
+ // client<->window size conversion
+ virtual wxSize ClientToWindowSize(const wxSize& size) const;
+ virtual wxSize WindowToClientSize(const wxSize& size) const;
+
+ // get the size best suited for the window (in fact, minimal
+ // acceptable size using which it will still look "nice" in
+ // most situations)
+ wxSize GetBestSize() const;
+
+ void GetBestSize(int *w, int *h) const
+ {
+ wxSize s = GetBestSize();
+ if ( w )
+ *w = s.x;
+ if ( h )
+ *h = s.y;
+ }
+
+ // Determine the best size in the other direction if one of them is
+ // fixed. This is used with windows that can wrap their contents and
+ // returns input-independent best size for the others.
+ int GetBestHeight(int width) const;
+ int GetBestWidth(int height) const;
+
+
+ void SetScrollHelper( wxScrollHelper *sh ) { m_scrollHelper = sh; }
+ wxScrollHelper *GetScrollHelper() { return m_scrollHelper; }
+
+ // reset the cached best size value so it will be recalculated the
+ // next time it is needed.
+ void InvalidateBestSize();
+ void CacheBestSize(const wxSize& size) const
+ { wxConstCast(this, wxWindowBase)->m_bestSizeCache = size; }
+
+
+ // This function will merge the window's best size into the window's
+ // minimum size, giving priority to the min size components, and
+ // returns the results.
+ virtual wxSize GetEffectiveMinSize() const;
+
+ wxDEPRECATED_MSG("use GetEffectiveMinSize() instead")
+ wxSize GetBestFittingSize() const;
+ wxDEPRECATED_MSG("use GetEffectiveMinSize() instead")
+ wxSize GetAdjustedMinSize() const;
+
+ // A 'Smart' SetSize that will fill in default size values with 'best'
+ // size. Sets the minsize to what was passed in.
+ void SetInitialSize(const wxSize& size=wxDefaultSize);
+
+ wxDEPRECATED_MSG("use SetInitialSize() instead")
+ void SetBestFittingSize(const wxSize& size=wxDefaultSize);
+
+
+ // the generic centre function - centers the window on parent by`
+ // default or on screen if it doesn't have parent or
+ // wxCENTER_ON_SCREEN flag is given
+ void Centre(int dir = wxBOTH) { DoCentre(dir); }
+ void Center(int dir = wxBOTH) { DoCentre(dir); }
+
+ // centre with respect to the parent window
+ void CentreOnParent(int dir = wxBOTH) { DoCentre(dir); }
+ void CenterOnParent(int dir = wxBOTH) { CentreOnParent(dir); }
+
+ // set window size to wrap around its children
+ virtual void Fit();
+
+ // set virtual size to satisfy children
+ virtual void FitInside();
+
+
+ // SetSizeHints is actually for setting the size hints
+ // for the wxTLW for a Window Manager - hence the name -
+ // and it is therefore overridden in wxTLW to do that.
+ // In wxWindow(Base), it has (unfortunately) been abused
+ // to mean the same as SetMinSize() and SetMaxSize().
+
+ virtual void SetSizeHints( int minW, int minH,
+ int maxW = wxDefaultCoord, int maxH = wxDefaultCoord,
+ int incW = wxDefaultCoord, int incH = wxDefaultCoord )
+ { DoSetSizeHints(minW, minH, maxW, maxH, incW, incH); }
+
+ void SetSizeHints( const wxSize& minSize,
+ const wxSize& maxSize=wxDefaultSize,
+ const wxSize& incSize=wxDefaultSize)
+ { DoSetSizeHints(minSize.x, minSize.y, maxSize.x, maxSize.y, incSize.x, incSize.y); }
+
+
+#if WXWIN_COMPATIBILITY_2_8
+ // these are useless and do nothing since wxWidgets 2.9
+ wxDEPRECATED( virtual void SetVirtualSizeHints( int minW, int minH,
+ int maxW = wxDefaultCoord, int maxH = wxDefaultCoord ) );
+ wxDEPRECATED( void SetVirtualSizeHints( const wxSize& minSize,
+ const wxSize& maxSize=wxDefaultSize) );
+#endif // WXWIN_COMPATIBILITY_2_8
+
+
+ // Call these to override what GetBestSize() returns. This
+ // method is only virtual because it is overridden in wxTLW
+ // as a different API for SetSizeHints().
+ virtual void SetMinSize(const wxSize& minSize);
+ virtual void SetMaxSize(const wxSize& maxSize);
+
+ // Like Set*Size, but for client, not window, size
+ virtual void SetMinClientSize(const wxSize& size)
+ { SetMinSize(ClientToWindowSize(size)); }
+ virtual void SetMaxClientSize(const wxSize& size)
+ { SetMaxSize(ClientToWindowSize(size)); }
+
+ // Override these methods to impose restrictions on min/max size.
+ // The easier way is to call SetMinSize() and SetMaxSize() which
+ // will have the same effect. Doing both is non-sense.
+ virtual wxSize GetMinSize() const { return wxSize(m_minWidth, m_minHeight); }
+ virtual wxSize GetMaxSize() const { return wxSize(m_maxWidth, m_maxHeight); }
+
+ // Like Get*Size, but for client, not window, size
+ virtual wxSize GetMinClientSize() const
+ { return WindowToClientSize(GetMinSize()); }
+ virtual wxSize GetMaxClientSize() const
+ { return WindowToClientSize(GetMaxSize()); }
+
+ // Get the min and max values one by one
+ int GetMinWidth() const { return GetMinSize().x; }
+ int GetMinHeight() const { return GetMinSize().y; }
+ int GetMaxWidth() const { return GetMaxSize().x; }
+ int GetMaxHeight() const { return GetMaxSize().y; }
+
+
+ // Methods for accessing the virtual size of a window. For most
+ // windows this is just the client area of the window, but for
+ // some like scrolled windows it is more or less independent of
+ // the screen window size. You may override the DoXXXVirtual
+ // methods below for classes where that is the case.
+
+ void SetVirtualSize( const wxSize &size ) { DoSetVirtualSize( size.x, size.y ); }
+ void SetVirtualSize( int x, int y ) { DoSetVirtualSize( x, y ); }
+
+ wxSize GetVirtualSize() const { return DoGetVirtualSize(); }
+ void GetVirtualSize( int *x, int *y ) const
+ {
+ wxSize s( DoGetVirtualSize() );
+
+ if( x )
+ *x = s.GetWidth();
+ if( y )
+ *y = s.GetHeight();
+ }
+
+ // Override these methods for windows that have a virtual size
+ // independent of their client size. eg. the virtual area of a
+ // wxScrolledWindow.
+
+ virtual void DoSetVirtualSize( int x, int y );
+ virtual wxSize DoGetVirtualSize() const;
+
+ // Return the largest of ClientSize and BestSize (as determined
+ // by a sizer, interior children, or other means)
+
+ virtual wxSize GetBestVirtualSize() const
+ {
+ wxSize client( GetClientSize() );
+ wxSize best( GetBestSize() );
+
+ return wxSize( wxMax( client.x, best.x ), wxMax( client.y, best.y ) );
+ }
+
+ // returns the magnification of the content of this window
+ // eg 2.0 for a window on a retina screen
+ virtual double GetContentScaleFactor() const
+ { return 1.0; }
+
+ // return the size of the left/right and top/bottom borders in x and y
+ // components of the result respectively
+ virtual wxSize GetWindowBorderSize() const;
+
+ // wxSizer and friends use this to give a chance to a component to recalc
+ // its min size once one of the final size components is known. Override
+ // this function when that is useful (such as for wxStaticText which can
+ // stretch over several lines). Parameter availableOtherDir
+ // tells the item how much more space there is available in the opposite
+ // direction (-1 if unknown).
+ virtual bool
+ InformFirstDirection(int direction, int size, int availableOtherDir);
+
+ // sends a size event to the window using its current size -- this has an
+ // effect of refreshing the window layout
+ //
+ // by default the event is sent, i.e. processed immediately, but if flags
+ // value includes wxSEND_EVENT_POST then it's posted, i.e. only schedule
+ // for later processing
+ virtual void SendSizeEvent(int flags = 0);
+
+ // this is a safe wrapper for GetParent()->SendSizeEvent(): it checks that
+ // we have a parent window and it's not in process of being deleted
+ //
+ // this is used by controls such as tool/status bars changes to which must
+ // also result in parent re-layout
+ void SendSizeEventToParent(int flags = 0);
+
+ // this is a more readable synonym for SendSizeEvent(wxSEND_EVENT_POST)
+ void PostSizeEvent() { SendSizeEvent(wxSEND_EVENT_POST); }
+
+ // this is the same as SendSizeEventToParent() but using PostSizeEvent()
+ void PostSizeEventToParent() { SendSizeEventToParent(wxSEND_EVENT_POST); }
+
+ // These functions should be used before repositioning the children of
+ // this window to reduce flicker or, in MSW case, even avoid display
+ // corruption in some situations (so they're more than just optimization).
+ //
+ // EndRepositioningChildren() should be called if and only if
+ // BeginRepositioningChildren() returns true. To ensure that this is always
+ // done automatically, use ChildrenRepositioningGuard class below.
+ virtual bool BeginRepositioningChildren() { return false; }
+ virtual void EndRepositioningChildren() { }
+
+ // A simple helper which ensures that EndRepositioningChildren() is called
+ // from its dtor if and only if calling BeginRepositioningChildren() from
+ // the ctor returned true.
+ class ChildrenRepositioningGuard
+ {
+ public:
+ // Notice that window can be NULL here, for convenience. In this case
+ // this class simply doesn't do anything.
+ wxEXPLICIT ChildrenRepositioningGuard(wxWindowBase* win)
+ : m_win(win),
+ m_callEnd(win && win->BeginRepositioningChildren())
+ {
+ }
+
+ ~ChildrenRepositioningGuard()
+ {
+ if ( m_callEnd )
+ m_win->EndRepositioningChildren();
+ }
+
+ private:
+ wxWindowBase* const m_win;
+ const bool m_callEnd;
+
+ wxDECLARE_NO_COPY_CLASS(ChildrenRepositioningGuard);
+ };
+
+
+ // window state
+ // ------------
+
+ // returns true if window was shown/hidden, false if the nothing was
+ // done (window was already shown/hidden)
+ virtual bool Show( bool show = true );
+ bool Hide() { return Show(false); }
+
+ // show or hide the window with a special effect, not implemented on
+ // most platforms (where it is the same as Show()/Hide() respectively)
+ //
+ // timeout specifies how long the animation should take, in ms, the
+ // default value of 0 means to use the default (system-dependent) value
+ virtual bool ShowWithEffect(wxShowEffect WXUNUSED(effect),
+ unsigned WXUNUSED(timeout) = 0)
+ {
+ return Show();
+ }
+
+ virtual bool HideWithEffect(wxShowEffect WXUNUSED(effect),
+ unsigned WXUNUSED(timeout) = 0)
+ {
+ return Hide();
+ }
+
+ // returns true if window was enabled/disabled, false if nothing done
+ virtual bool Enable( bool enable = true );
+ bool Disable() { return Enable(false); }
+
+ virtual bool IsShown() const { return m_isShown; }
+ // returns true if the window is really enabled and false otherwise,
+ // whether because it had been explicitly disabled itself or because
+ // its parent is currently disabled -- then this method returns false
+ // whatever is the intrinsic state of this window, use IsThisEnabled(0
+ // to retrieve it. In other words, this relation always holds:
+ //
+ // IsEnabled() == IsThisEnabled() && parent.IsEnabled()
+ //
+ bool IsEnabled() const;
+
+ // returns the internal window state independently of the parent(s)
+ // state, i.e. the state in which the window would be if all its
+ // parents were enabled (use IsEnabled() above to get the effective
+ // window state)
+ bool IsThisEnabled() const { return m_isEnabled; }
+
+ // returns true if the window is visible, i.e. IsShown() returns true
+ // if called on it and all its parents up to the first TLW
+ virtual bool IsShownOnScreen() const;
+
+ // get/set window style (setting style won't update the window and so
+ // is only useful for internal usage)
+ virtual void SetWindowStyleFlag( long style ) { m_windowStyle = style; }
+ virtual long GetWindowStyleFlag() const { return m_windowStyle; }
+
+ // just some (somewhat shorter) synonyms
+ void SetWindowStyle( long style ) { SetWindowStyleFlag(style); }
+ long GetWindowStyle() const { return GetWindowStyleFlag(); }
+
+ // check if the flag is set
+ bool HasFlag(int flag) const { return (m_windowStyle & flag) != 0; }
+ virtual bool IsRetained() const { return HasFlag(wxRETAINED); }
+
+ // turn the flag on if it had been turned off before and vice versa,
+ // return true if the flag is currently turned on
+ bool ToggleWindowStyle(int flag);
+
+ // extra style: the less often used style bits which can't be set with
+ // SetWindowStyleFlag()
+ virtual void SetExtraStyle(long exStyle) { m_exStyle = exStyle; }
+ long GetExtraStyle() const { return m_exStyle; }
+
+ bool HasExtraStyle(int exFlag) const { return (m_exStyle & exFlag) != 0; }
+
+#if WXWIN_COMPATIBILITY_2_8
+ // make the window modal (all other windows unresponsive)
+ wxDEPRECATED( virtual void MakeModal(bool modal = true) );
+#endif
+
+ // (primitive) theming support
+ // ---------------------------
+
+ virtual void SetThemeEnabled(bool enableTheme) { m_themeEnabled = enableTheme; }
+ virtual bool GetThemeEnabled() const { return m_themeEnabled; }
+
+
+ // focus and keyboard handling
+ // ---------------------------
+
+ // set focus to this window
+ virtual void SetFocus() = 0;
+
+ // set focus to this window as the result of a keyboard action
+ virtual void SetFocusFromKbd() { SetFocus(); }
+
+ // return the window which currently has the focus or NULL
+ static wxWindow *FindFocus();
+
+ static wxWindow *DoFindFocus() /* = 0: implement in derived classes */;
+
+ // return true if the window has focus (handles composite windows
+ // correctly - returns true if GetMainWindowOfCompositeControl()
+ // has focus)
+ virtual bool HasFocus() const;
+
+ // can this window have focus in principle?
+ //
+ // the difference between AcceptsFocus[FromKeyboard]() and CanAcceptFocus
+ // [FromKeyboard]() is that the former functions are meant to be
+ // overridden in the derived classes to simply return false if the
+ // control can't have focus, while the latter are meant to be used by
+ // this class clients and take into account the current window state
+ virtual bool AcceptsFocus() const { return true; }
+
+ // can this window or one of its children accept focus?
+ //
+ // usually it's the same as AcceptsFocus() but is overridden for
+ // container windows
+ virtual bool AcceptsFocusRecursively() const { return AcceptsFocus(); }
+
+ // can this window be given focus by keyboard navigation? if not, the
+ // only way to give it focus (provided it accepts it at all) is to
+ // click it
+ virtual bool AcceptsFocusFromKeyboard() const { return AcceptsFocus(); }
+
+
+ // Can this window be focused right now, in its current state? This
+ // shouldn't be called at all if AcceptsFocus() returns false.
+ //
+ // It is a convenient helper for the various functions using it below
+ // but also a hook allowing to override the default logic for some rare
+ // cases (currently just wxRadioBox in wxMSW) when it's inappropriate.
+ virtual bool CanBeFocused() const { return IsShown() && IsEnabled(); }
+
+ // can this window itself have focus?
+ bool IsFocusable() const { return AcceptsFocus() && CanBeFocused(); }
+
+ // can this window have focus right now?
+ //
+ // if this method returns true, it means that calling SetFocus() will
+ // put focus either to this window or one of its children, if you need
+ // to know whether this window accepts focus itself, use IsFocusable()
+ bool CanAcceptFocus() const
+ { return AcceptsFocusRecursively() && CanBeFocused(); }
+
+ // can this window be assigned focus from keyboard right now?
+ bool CanAcceptFocusFromKeyboard() const
+ { return AcceptsFocusFromKeyboard() && CanBeFocused(); }
+
+ // call this when the return value of AcceptsFocus() changes
+ virtual void SetCanFocus(bool WXUNUSED(canFocus)) { }
+
+ // navigates inside this window
+ bool NavigateIn(int flags = wxNavigationKeyEvent::IsForward)
+ { return DoNavigateIn(flags); }
+
+ // navigates in the specified direction from this window, this is
+ // equivalent to GetParent()->NavigateIn()
+ bool Navigate(int flags = wxNavigationKeyEvent::IsForward)
+ { return m_parent && ((wxWindowBase *)m_parent)->DoNavigateIn(flags); }
+
+ // this function will generate the appropriate call to Navigate() if the
+ // key event is one normally used for keyboard navigation and return true
+ // in this case
+ bool HandleAsNavigationKey(const wxKeyEvent& event);
+
+ // move this window just before/after the specified one in tab order
+ // (the other window must be our sibling!)
+ void MoveBeforeInTabOrder(wxWindow *win)
+ { DoMoveInTabOrder(win, OrderBefore); }
+ void MoveAfterInTabOrder(wxWindow *win)
+ { DoMoveInTabOrder(win, OrderAfter); }
+
+
+ // parent/children relations
+ // -------------------------
+
+ // get the list of children
+ const wxWindowList& GetChildren() const { return m_children; }
+ wxWindowList& GetChildren() { return m_children; }
+
+ // needed just for extended runtime
+ const wxWindowList& GetWindowChildren() const { return GetChildren() ; }
+
+ // get the window before/after this one in the parents children list,
+ // returns NULL if this is the first/last window
+ wxWindow *GetPrevSibling() const { return DoGetSibling(OrderBefore); }
+ wxWindow *GetNextSibling() const { return DoGetSibling(OrderAfter); }
+
+ // get the parent or the parent of the parent
+ wxWindow *GetParent() const { return m_parent; }
+ inline wxWindow *GetGrandParent() const;
+
+ // is this window a top level one?
+ virtual bool IsTopLevel() const;
+
+ // is this window a child or grand child of this one (inside the same
+ // TLW)?
+ bool IsDescendant(wxWindowBase* win) const;
+
+ // it doesn't really change parent, use Reparent() instead
+ void SetParent( wxWindowBase *parent );
+ // change the real parent of this window, return true if the parent
+ // was changed, false otherwise (error or newParent == oldParent)
+ virtual bool Reparent( wxWindowBase *newParent );
+
+ // implementation mostly
+ virtual void AddChild( wxWindowBase *child );
+ virtual void RemoveChild( wxWindowBase *child );
+
+ // returns true if the child is in the client area of the window, i.e. is
+ // not scrollbar, toolbar etc.
+ virtual bool IsClientAreaChild(const wxWindow *WXUNUSED(child)) const
+ { return true; }
+
+ // looking for windows
+ // -------------------
+
+ // find window among the descendants of this one either by id or by
+ // name (return NULL if not found)
+ wxWindow *FindWindow(long winid) const;
+ wxWindow *FindWindow(const wxString& name) const;
+
+ // Find a window among any window (all return NULL if not found)
+ static wxWindow *FindWindowById( long winid, const wxWindow *parent = NULL );
+ static wxWindow *FindWindowByName( const wxString& name,
+ const wxWindow *parent = NULL );
+ static wxWindow *FindWindowByLabel( const wxString& label,
+ const wxWindow *parent = NULL );
+
+ // event handler stuff
+ // -------------------
+
+ // get the current event handler
+ wxEvtHandler *GetEventHandler() const { return m_eventHandler; }
+
+ // replace the event handler (allows to completely subclass the
+ // window)
+ void SetEventHandler( wxEvtHandler *handler );
+
+ // push/pop event handler: allows to chain a custom event handler to
+ // alreasy existing ones
+ void PushEventHandler( wxEvtHandler *handler );
+ wxEvtHandler *PopEventHandler( bool deleteHandler = false );
+
+ // find the given handler in the event handler chain and remove (but
+ // not delete) it from the event handler chain, return true if it was
+ // found and false otherwise (this also results in an assert failure so
+ // this function should only be called when the handler is supposed to
+ // be there)
+ bool RemoveEventHandler(wxEvtHandler *handler);
+
+ // Process an event by calling GetEventHandler()->ProcessEvent(): this
+ // is a straightforward replacement for ProcessEvent() itself which
+ // shouldn't be used directly with windows as it doesn't take into
+ // account any event handlers associated with the window
+ bool ProcessWindowEvent(wxEvent& event)
+ { return GetEventHandler()->ProcessEvent(event); }
+
+ // Call GetEventHandler()->ProcessEventLocally(): this should be used
+ // instead of calling ProcessEventLocally() directly on the window
+ // itself as this wouldn't take any pushed event handlers into account
+ // correctly
+ bool ProcessWindowEventLocally(wxEvent& event)
+ { return GetEventHandler()->ProcessEventLocally(event); }
+
+ // Process an event by calling GetEventHandler()->ProcessEvent() and
+ // handling any exceptions thrown by event handlers. It's mostly useful
+ // when processing wx events when called from C code (e.g. in GTK+
+ // callback) when the exception wouldn't correctly propagate to
+ // wxEventLoop.
+ bool HandleWindowEvent(wxEvent& event) const;
+
+ // disable wxEvtHandler double-linked list mechanism:
+ virtual void SetNextHandler(wxEvtHandler *handler);
+ virtual void SetPreviousHandler(wxEvtHandler *handler);
+
+
+ // Watcom doesn't allow reducing access with using access declaration, see
+ // #10749
+#ifndef __WATCOMC__
+protected:
+
+ // NOTE: we change the access specifier of the following wxEvtHandler functions
+ // so that the user won't be able to call them directly.
+ // Calling wxWindow::ProcessEvent in fact only works when there are NO
+ // event handlers pushed on the window.
+ // To ensure correct operation, instead of wxWindow::ProcessEvent
+ // you must always call wxWindow::GetEventHandler()->ProcessEvent()
+ // or HandleWindowEvent().
+ // The same holds for all other wxEvtHandler functions.
+
+ using wxEvtHandler::ProcessEvent;
+ using wxEvtHandler::ProcessEventLocally;
+#if wxUSE_THREADS
+ using wxEvtHandler::ProcessThreadEvent;
+#endif
+ using wxEvtHandler::SafelyProcessEvent;
+ using wxEvtHandler::ProcessPendingEvents;
+ using wxEvtHandler::AddPendingEvent;
+ using wxEvtHandler::QueueEvent;
+#endif // __WATCOMC__
+
+public:
+
+ // validators
+ // ----------
+
+#if wxUSE_VALIDATORS
+ // a window may have an associated validator which is used to control
+ // user input
+ virtual void SetValidator( const wxValidator &validator );
+ virtual wxValidator *GetValidator() { return m_windowValidator; }
+#endif // wxUSE_VALIDATORS
+
+
+ // dialog oriented functions
+ // -------------------------
+
+ // validate the correctness of input, return true if ok
+ virtual bool Validate();
+
+ // transfer data between internal and GUI representations
+ virtual bool TransferDataToWindow();
+ virtual bool TransferDataFromWindow();
+
+ virtual void InitDialog();
+
+#if wxUSE_ACCEL
+ // accelerators
+ // ------------
+ virtual void SetAcceleratorTable( const wxAcceleratorTable& accel )
+ { m_acceleratorTable = accel; }
+ wxAcceleratorTable *GetAcceleratorTable()
+ { return &m_acceleratorTable; }
+
+#endif // wxUSE_ACCEL
+
+#if wxUSE_HOTKEY
+ // hot keys (system wide accelerators)
+ // -----------------------------------
+
+ virtual bool RegisterHotKey(int hotkeyId, int modifiers, int keycode);
+ virtual bool UnregisterHotKey(int hotkeyId);
+#endif // wxUSE_HOTKEY
+
+
+ // dialog units translations
+ // -------------------------
+
+ wxPoint ConvertPixelsToDialog( const wxPoint& pt ) const;
+ wxPoint ConvertDialogToPixels( const wxPoint& pt ) const;
+ wxSize ConvertPixelsToDialog( const wxSize& sz ) const
+ {
+ wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y)));
+
+ return wxSize(pt.x, pt.y);
+ }
+
+ wxSize ConvertDialogToPixels( const wxSize& sz ) const
+ {
+ wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y)));
+
+ return wxSize(pt.x, pt.y);
+ }
+
+ // mouse functions
+ // ---------------
+
+ // move the mouse to the specified position
+ virtual void WarpPointer(int x, int y) = 0;
+
+ // start or end mouse capture, these functions maintain the stack of
+ // windows having captured the mouse and after calling ReleaseMouse()
+ // the mouse is not released but returns to the window which had had
+ // captured it previously (if any)
+ void CaptureMouse();
+ void ReleaseMouse();
+
+ // get the window which currently captures the mouse or NULL
+ static wxWindow *GetCapture();
+
+ // does this window have the capture?
+ virtual bool HasCapture() const
+ { return (wxWindow *)this == GetCapture(); }
+
+ // painting the window
+ // -------------------
+
+ // mark the specified rectangle (or the whole window) as "dirty" so it
+ // will be repainted
+ virtual void Refresh( bool eraseBackground = true,
+ const wxRect *rect = (const wxRect *) NULL ) = 0;
+
+ // a less awkward wrapper for Refresh
+ void RefreshRect(const wxRect& rect, bool eraseBackground = true)
+ {
+ Refresh(eraseBackground, &rect);
+ }
+
+ // repaint all invalid areas of the window immediately
+ virtual void Update() { }
+
+ // clear the window background
+ virtual void ClearBackground();
+
+ // freeze the window: don't redraw it until it is thawed
+ void Freeze();
+
+ // thaw the window: redraw it after it had been frozen
+ void Thaw();
+
+ // return true if window had been frozen and not unthawed yet
+ bool IsFrozen() const { return m_freezeCount != 0; }
+
+ // adjust DC for drawing on this window
+ virtual void PrepareDC( wxDC & WXUNUSED(dc) ) { }
+
+ // return true if the window contents is double buffered by the system
+ virtual bool IsDoubleBuffered() const { return false; }
+
+ // the update region of the window contains the areas which must be
+ // repainted by the program
+ const wxRegion& GetUpdateRegion() const { return m_updateRegion; }
+ wxRegion& GetUpdateRegion() { return m_updateRegion; }
+
+ // get the update rectangleregion bounding box in client coords
+ wxRect GetUpdateClientRect() const;
+
+ // these functions verify whether the given point/rectangle belongs to
+ // (or at least intersects with) the update region
+ virtual bool DoIsExposed( int x, int y ) const;
+ virtual bool DoIsExposed( int x, int y, int w, int h ) const;
+
+ bool IsExposed( int x, int y ) const
+ { return DoIsExposed(x, y); }
+ bool IsExposed( int x, int y, int w, int h ) const
+ { return DoIsExposed(x, y, w, h); }
+ bool IsExposed( const wxPoint& pt ) const
+ { return DoIsExposed(pt.x, pt.y); }
+ bool IsExposed( const wxRect& rect ) const
+ { return DoIsExposed(rect.x, rect.y, rect.width, rect.height); }
+
+ // colours, fonts and cursors
+ // --------------------------
+
+ // get the default attributes for the controls of this class: we
+ // provide a virtual function which can be used to query the default
+ // attributes of an existing control and a static function which can
+ // be used even when no existing object of the given class is
+ // available, but which won't return any styles specific to this
+ // particular control, of course (e.g. "Ok" button might have
+ // different -- bold for example -- font)
+ virtual wxVisualAttributes GetDefaultAttributes() const
+ {
+ return GetClassDefaultAttributes(GetWindowVariant());
+ }
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ // set/retrieve the window colours (system defaults are used by
+ // default): SetXXX() functions return true if colour was changed,
+ // SetDefaultXXX() reset the "m_inheritXXX" flag after setting the
+ // value to prevent it from being inherited by our children
+ virtual bool SetBackgroundColour(const wxColour& colour);
+ void SetOwnBackgroundColour(const wxColour& colour)
+ {
+ if ( SetBackgroundColour(colour) )
+ m_inheritBgCol = false;
+ }
+ wxColour GetBackgroundColour() const;
+ bool InheritsBackgroundColour() const
+ {
+ return m_inheritBgCol;
+ }
+ bool UseBgCol() const
+ {
+ return m_hasBgCol;
+ }
+
+ virtual bool SetForegroundColour(const wxColour& colour);
+ void SetOwnForegroundColour(const wxColour& colour)
+ {
+ if ( SetForegroundColour(colour) )
+ m_inheritFgCol = false;
+ }
+ wxColour GetForegroundColour() const;
+
+ // Set/get the background style.
+ virtual bool SetBackgroundStyle(wxBackgroundStyle style);
+ wxBackgroundStyle GetBackgroundStyle() const
+ { return m_backgroundStyle; }
+
+ // returns true if the control has "transparent" areas such as a
+ // wxStaticText and wxCheckBox and the background should be adapted
+ // from a parent window
+ virtual bool HasTransparentBackground() { return false; }
+
+ // Returns true if background transparency is supported for this
+ // window, i.e. if calling SetBackgroundStyle(wxBG_STYLE_TRANSPARENT)
+ // has a chance of succeeding. If reason argument is non-NULL, returns a
+ // user-readable explanation of why it isn't supported if the return
+ // value is false.
+ virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const;
+
+ // set/retrieve the font for the window (SetFont() returns true if the
+ // font really changed)
+ virtual bool SetFont(const wxFont& font) = 0;
+ void SetOwnFont(const wxFont& font)
+ {
+ if ( SetFont(font) )
+ m_inheritFont = false;
+ }
+ wxFont GetFont() const;
+
+ // set/retrieve the cursor for this window (SetCursor() returns true
+ // if the cursor was really changed)
+ virtual bool SetCursor( const wxCursor &cursor );
+ const wxCursor& GetCursor() const { return m_cursor; }
+
+#if wxUSE_CARET
+ // associate a caret with the window
+ void SetCaret(wxCaret *caret);
+ // get the current caret (may be NULL)
+ wxCaret *GetCaret() const { return m_caret; }
+#endif // wxUSE_CARET
+
+ // get the (average) character size for the current font
+ virtual int GetCharHeight() const = 0;
+ virtual int GetCharWidth() const = 0;
+
+ // get the width/height/... of the text using current or specified
+ // font
+ void GetTextExtent(const wxString& string,
+ int *x, int *y,
+ int *descent = NULL,
+ int *externalLeading = NULL,
+ const wxFont *font = NULL) const
+ {
+ DoGetTextExtent(string, x, y, descent, externalLeading, font);
+ }
+
+ wxSize GetTextExtent(const wxString& string) const
+ {
+ wxCoord w, h;
+ GetTextExtent(string, &w, &h);
+ return wxSize(w, h);
+ }
+
+ // client <-> screen coords
+ // ------------------------
+
+ // translate to/from screen/client coordinates (pointers may be NULL)
+ void ClientToScreen( int *x, int *y ) const
+ { DoClientToScreen(x, y); }
+ void ScreenToClient( int *x, int *y ) const
+ { DoScreenToClient(x, y); }
+
+ // wxPoint interface to do the same thing
+ wxPoint ClientToScreen(const wxPoint& pt) const
+ {
+ int x = pt.x, y = pt.y;
+ DoClientToScreen(&x, &y);
+
+ return wxPoint(x, y);
+ }
+
+ wxPoint ScreenToClient(const wxPoint& pt) const
+ {
+ int x = pt.x, y = pt.y;
+ DoScreenToClient(&x, &y);
+
+ return wxPoint(x, y);
+ }
+
+ // test where the given (in client coords) point lies
+ wxHitTest HitTest(wxCoord x, wxCoord y) const
+ { return DoHitTest(x, y); }
+
+ wxHitTest HitTest(const wxPoint& pt) const
+ { return DoHitTest(pt.x, pt.y); }
+
+ // misc
+ // ----
+
+ // get the window border style from the given flags: this is different from
+ // simply doing flags & wxBORDER_MASK because it uses GetDefaultBorder() to
+ // translate wxBORDER_DEFAULT to something reasonable
+ wxBorder GetBorder(long flags) const;
+
+ // get border for the flags of this window
+ wxBorder GetBorder() const { return GetBorder(GetWindowStyleFlag()); }
+
+ // send wxUpdateUIEvents to this window, and children if recurse is true
+ virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE);
+
+ // do the window-specific processing after processing the update event
+ virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) ;
+
+#if wxUSE_MENUS
+ // show popup menu at the given position, generate events for the items
+ // selected in it
+ bool PopupMenu(wxMenu *menu, const wxPoint& pos = wxDefaultPosition)
+ { return PopupMenu(menu, pos.x, pos.y); }
+ bool PopupMenu(wxMenu *menu, int x, int y);
+
+ // simply return the id of the selected item or wxID_NONE without
+ // generating any events
+ int GetPopupMenuSelectionFromUser(wxMenu& menu,
+ const wxPoint& pos = wxDefaultPosition)
+ { return DoGetPopupMenuSelectionFromUser(menu, pos.x, pos.y); }
+ int GetPopupMenuSelectionFromUser(wxMenu& menu, int x, int y)
+ { return DoGetPopupMenuSelectionFromUser(menu, x, y); }
+#endif // wxUSE_MENUS
+
+ // override this method to return true for controls having multiple pages
+ virtual bool HasMultiplePages() const { return false; }
+
+
+ // scrollbars
+ // ----------
+
+ // can the window have the scrollbar in this orientation?
+ virtual bool CanScroll(int orient) const;
+
+ // does the window have the scrollbar in this orientation?
+ bool HasScrollbar(int orient) const;
+
+ // configure the window scrollbars
+ virtual void SetScrollbar( int orient,
+ int pos,
+ int thumbvisible,
+ int range,
+ bool refresh = true ) = 0;
+ virtual void SetScrollPos( int orient, int pos, bool refresh = true ) = 0;
+ virtual int GetScrollPos( int orient ) const = 0;
+ virtual int GetScrollThumb( int orient ) const = 0;
+ virtual int GetScrollRange( int orient ) const = 0;
+
+ // scroll window to the specified position
+ virtual void ScrollWindow( int dx, int dy,
+ const wxRect* rect = NULL ) = 0;
+
+ // scrolls window by line/page: note that not all controls support this
+ //
+ // return true if the position changed, false otherwise
+ virtual bool ScrollLines(int WXUNUSED(lines)) { return false; }
+ virtual bool ScrollPages(int WXUNUSED(pages)) { return false; }
+
+ // convenient wrappers for ScrollLines/Pages
+ bool LineUp() { return ScrollLines(-1); }
+ bool LineDown() { return ScrollLines(1); }
+ bool PageUp() { return ScrollPages(-1); }
+ bool PageDown() { return ScrollPages(1); }
+
+ // call this to always show one or both scrollbars, even if the window
+ // is big enough to not require them
+ virtual void AlwaysShowScrollbars(bool WXUNUSED(horz) = true,
+ bool WXUNUSED(vert) = true)
+ {
+ }
+
+ // return true if AlwaysShowScrollbars() had been called before for the
+ // corresponding orientation
+ virtual bool IsScrollbarAlwaysShown(int WXUNUSED(orient)) const
+ {
+ return false;
+ }
+
+ // context-sensitive help
+ // ----------------------
+
+ // these are the convenience functions wrapping wxHelpProvider methods
+
+#if wxUSE_HELP
+ // associate this help text with this window
+ void SetHelpText(const wxString& text);
+
+#if WXWIN_COMPATIBILITY_2_8
+ // Associate this help text with all windows with the same id as this one.
+ // Don't use this, do wxHelpProvider::Get()->AddHelp(id, text);
+ wxDEPRECATED( void SetHelpTextForId(const wxString& text) );
+#endif // WXWIN_COMPATIBILITY_2_8
+
+ // get the help string associated with the given position in this window
+ //
+ // notice that pt may be invalid if event origin is keyboard or unknown
+ // and this method should return the global window help text then
+ virtual wxString GetHelpTextAtPoint(const wxPoint& pt,
+ wxHelpEvent::Origin origin) const;
+ // returns the position-independent help text
+ wxString GetHelpText() const
+ {
+ return GetHelpTextAtPoint(wxDefaultPosition, wxHelpEvent::Origin_Unknown);
+ }
+
+#else // !wxUSE_HELP
+ // silently ignore SetHelpText() calls
+ void SetHelpText(const wxString& WXUNUSED(text)) { }
+ void SetHelpTextForId(const wxString& WXUNUSED(text)) { }
+#endif // wxUSE_HELP
+
+ // tooltips
+ // --------
+
+#if wxUSE_TOOLTIPS
+ // the easiest way to set a tooltip for a window is to use this method
+ void SetToolTip( const wxString &tip );
+ // attach a tooltip to the window, pointer can be NULL to remove
+ // existing tooltip
+ void SetToolTip( wxToolTip *tip ) { DoSetToolTip(tip); }
+ // more readable synonym for SetToolTip(NULL)
+ void UnsetToolTip() { SetToolTip(NULL); }
+ // get the associated tooltip or NULL if none
+ wxToolTip* GetToolTip() const { return m_tooltip; }
+ wxString GetToolTipText() const;
+
+ // Use the same tool tip as the given one (which can be NULL to indicate
+ // that no tooltip should be used) for this window. This is currently only
+ // used by wxCompositeWindow::DoSetToolTip() implementation and is not part
+ // of the public wx API.
+ //
+ // Returns true if tip was valid and we copied it or false if it was NULL
+ // and we reset our own tooltip too.
+ bool CopyToolTip(wxToolTip *tip);
+#else // !wxUSE_TOOLTIPS
+ // make it much easier to compile apps in an environment
+ // that doesn't support tooltips, such as PocketPC
+ void SetToolTip(const wxString & WXUNUSED(tip)) { }
+ void UnsetToolTip() { }
+#endif // wxUSE_TOOLTIPS/!wxUSE_TOOLTIPS
+
+ // drag and drop
+ // -------------
+#if wxUSE_DRAG_AND_DROP
+ // set/retrieve the drop target associated with this window (may be
+ // NULL; it's owned by the window and will be deleted by it)
+ virtual void SetDropTarget( wxDropTarget *dropTarget ) = 0;
+ virtual wxDropTarget *GetDropTarget() const { return m_dropTarget; }
+
+ // Accept files for dragging
+ virtual void DragAcceptFiles(bool accept)
+#ifdef __WXMSW__
+ // it does have common implementation but not for MSW which has its own
+ // native version of it
+ = 0
+#endif // __WXMSW__
+ ;
+
+#endif // wxUSE_DRAG_AND_DROP
+
+ // constraints and sizers
+ // ----------------------
+#if wxUSE_CONSTRAINTS
+ // set the constraints for this window or retrieve them (may be NULL)
+ void SetConstraints( wxLayoutConstraints *constraints );
+ wxLayoutConstraints *GetConstraints() const { return m_constraints; }
+
+ // implementation only
+ void UnsetConstraints(wxLayoutConstraints *c);
+ wxWindowList *GetConstraintsInvolvedIn() const
+ { return m_constraintsInvolvedIn; }
+ void AddConstraintReference(wxWindowBase *otherWin);
+ void RemoveConstraintReference(wxWindowBase *otherWin);
+ void DeleteRelatedConstraints();
+ void ResetConstraints();
+
+ // these methods may be overridden for special layout algorithms
+ virtual void SetConstraintSizes(bool recurse = true);
+ virtual bool LayoutPhase1(int *noChanges);
+ virtual bool LayoutPhase2(int *noChanges);
+ virtual bool DoPhase(int phase);
+
+ // these methods are virtual but normally won't be overridden
+ virtual void SetSizeConstraint(int x, int y, int w, int h);
+ virtual void MoveConstraint(int x, int y);
+ virtual void GetSizeConstraint(int *w, int *h) const ;
+ virtual void GetClientSizeConstraint(int *w, int *h) const ;
+ virtual void GetPositionConstraint(int *x, int *y) const ;
+
+#endif // wxUSE_CONSTRAINTS
+
+ // when using constraints or sizers, it makes sense to update
+ // children positions automatically whenever the window is resized
+ // - this is done if autoLayout is on
+ void SetAutoLayout( bool autoLayout ) { m_autoLayout = autoLayout; }
+ bool GetAutoLayout() const { return m_autoLayout; }
+
+ // lay out the window and its children
+ virtual bool Layout();
+
+ // sizers
+ void SetSizer(wxSizer *sizer, bool deleteOld = true );
+ void SetSizerAndFit( wxSizer *sizer, bool deleteOld = true );
+
+ wxSizer *GetSizer() const { return m_windowSizer; }
+
+ // Track if this window is a member of a sizer
+ void SetContainingSizer(wxSizer* sizer);
+ wxSizer *GetContainingSizer() const { return m_containingSizer; }
+
+ // accessibility
+ // ----------------------
+#if wxUSE_ACCESSIBILITY
+ // Override to create a specific accessible object.
+ virtual wxAccessible* CreateAccessible();
+
+ // Sets the accessible object.
+ void SetAccessible(wxAccessible* accessible) ;
+
+ // Returns the accessible object.
+ wxAccessible* GetAccessible() { return m_accessible; }
+
+ // Returns the accessible object, creating if necessary.
+ wxAccessible* GetOrCreateAccessible() ;
+#endif
+
+
+ // Set window transparency if the platform supports it
+ virtual bool SetTransparent(wxByte WXUNUSED(alpha)) { return false; }
+ virtual bool CanSetTransparent() { return false; }
+
+
+ // implementation
+ // --------------
+
+ // event handlers
+ void OnSysColourChanged( wxSysColourChangedEvent& event );
+ void OnInitDialog( wxInitDialogEvent &event );
+ void OnMiddleClick( wxMouseEvent& event );
+#if wxUSE_HELP
+ void OnHelp(wxHelpEvent& event);
+#endif // wxUSE_HELP
+
+ // virtual function for implementing internal idle
+ // behaviour
+ virtual void OnInternalIdle();
+
+ // Send idle event to window and all subwindows
+ // Returns true if more idle time is requested.
+ virtual bool SendIdleEvents(wxIdleEvent& event);
+
+ // get the handle of the window for the underlying window system: this
+ // is only used for wxWin itself or for user code which wants to call
+ // platform-specific APIs
+ virtual WXWidget GetHandle() const = 0;
+ // associate the window with a new native handle
+ virtual void AssociateHandle(WXWidget WXUNUSED(handle)) { }
+ // dissociate the current native handle from the window
+ virtual void DissociateHandle() { }
+
+#if wxUSE_PALETTE
+ // Store the palette used by DCs in wxWindow so that the dcs can share
+ // a palette. And we can respond to palette messages.
+ wxPalette GetPalette() const { return m_palette; }
+
+ // When palette is changed tell the DC to set the system palette to the
+ // new one.
+ void SetPalette(const wxPalette& pal);
+
+ // return true if we have a specific palette
+ bool HasCustomPalette() const { return m_hasCustomPalette; }
+
+ // return the first parent window with a custom palette or NULL
+ wxWindow *GetAncestorWithCustomPalette() const;
+#endif // wxUSE_PALETTE
+
+ // inherit the parents visual attributes if they had been explicitly set
+ // by the user (i.e. we don't inherit default attributes) and if we don't
+ // have our own explicitly set
+ virtual void InheritAttributes();
+
+ // returns false from here if this window doesn't want to inherit the
+ // parents colours even if InheritAttributes() would normally do it
+ //
+ // this just provides a simple way to customize InheritAttributes()
+ // behaviour in the most common case
+ virtual bool ShouldInheritColours() const { return false; }
+
+ // returns true if the window can be positioned outside of parent's client
+ // area (normal windows can't, but e.g. menubar or statusbar can):
+ virtual bool CanBeOutsideClientArea() const { return false; }
+
+ // returns true if the platform should explicitly apply a theme border. Currently
+ // used only by Windows
+ virtual bool CanApplyThemeBorder() const { return true; }
+
+ // returns the main window of composite control; this is the window
+ // that FindFocus returns if the focus is in one of composite control's
+ // windows
+ virtual wxWindow *GetMainWindowOfCompositeControl()
+ { return (wxWindow*)this; }
+
+ // If this function returns true, keyboard navigation events shouldn't
+ // escape from it. A typical example of such "navigation domain" is a top
+ // level window because pressing TAB in one of them must not transfer focus
+ // to a different top level window. But it's not limited to them, e.g. MDI
+ // children frames are not top level windows (and their IsTopLevel()
+ // returns false) but still are self-contained navigation domains as well.
+ virtual bool IsTopNavigationDomain() const { return false; }
+
+
+protected:
+ // helper for the derived class Create() methods: the first overload, with
+ // validator parameter, should be used for child windows while the second
+ // one is used for top level ones
+ bool CreateBase(wxWindowBase *parent,
+ wxWindowID winid,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxPanelNameStr);
+
+ bool CreateBase(wxWindowBase *parent,
+ wxWindowID winid,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxString& name);
+
+ // event handling specific to wxWindow
+ virtual bool TryBefore(wxEvent& event);
+ virtual bool TryAfter(wxEvent& event);
+
+ enum WindowOrder
+ {
+ OrderBefore, // insert before the given window
+ OrderAfter // insert after the given window
+ };
+
+ // common part of GetPrev/NextSibling()
+ wxWindow *DoGetSibling(WindowOrder order) const;
+
+ // common part of MoveBefore/AfterInTabOrder()
+ virtual void DoMoveInTabOrder(wxWindow *win, WindowOrder move);
+
+ // implementation of Navigate() and NavigateIn()
+ virtual bool DoNavigateIn(int flags);
+
+#if wxUSE_CONSTRAINTS
+ // satisfy the constraints for the windows but don't set the window sizes
+ void SatisfyConstraints();
+#endif // wxUSE_CONSTRAINTS
+
+ // Send the wxWindowDestroyEvent if not done yet and sets m_isBeingDeleted
+ // to true
+ void SendDestroyEvent();
+
+ // this method should be implemented to use operating system specific code
+ // to really enable/disable the widget, it will only be called when we
+ // really need to enable/disable window and so no additional checks on the
+ // widgets state are necessary
+ virtual void DoEnable(bool WXUNUSED(enable)) { }
+
+
+ // the window id - a number which uniquely identifies a window among
+ // its siblings unless it is wxID_ANY
+ wxWindowIDRef m_windowId;
+
+ // the parent window of this window (or NULL) and the list of the children
+ // of this window
+ wxWindow *m_parent;
+ wxWindowList m_children;
+
+ // the minimal allowed size for the window (no minimal size if variable(s)
+ // contain(s) wxDefaultCoord)
+ int m_minWidth,
+ m_minHeight,
+ m_maxWidth,
+ m_maxHeight;
+
+ // event handler for this window: usually is just 'this' but may be
+ // changed with SetEventHandler()
+ wxEvtHandler *m_eventHandler;
+
+#if wxUSE_VALIDATORS
+ // associated validator or NULL if none
+ wxValidator *m_windowValidator;
+#endif // wxUSE_VALIDATORS
+
+#if wxUSE_DRAG_AND_DROP
+ wxDropTarget *m_dropTarget;
+#endif // wxUSE_DRAG_AND_DROP
+
+ // visual window attributes
+ wxCursor m_cursor;
+ wxFont m_font; // see m_hasFont
+ wxColour m_backgroundColour, // m_hasBgCol
+ m_foregroundColour; // m_hasFgCol
+
+#if wxUSE_CARET
+ wxCaret *m_caret;
+#endif // wxUSE_CARET
+
+ // the region which should be repainted in response to paint event
+ wxRegion m_updateRegion;
+
+#if wxUSE_ACCEL
+ // the accelerator table for the window which translates key strokes into
+ // command events
+ wxAcceleratorTable m_acceleratorTable;
+#endif // wxUSE_ACCEL
+
+ // the tooltip for this window (may be NULL)
+#if wxUSE_TOOLTIPS
+ wxToolTip *m_tooltip;
+#endif // wxUSE_TOOLTIPS
+
+ // constraints and sizers
+#if wxUSE_CONSTRAINTS
+ // the constraints for this window or NULL
+ wxLayoutConstraints *m_constraints;
+
+ // constraints this window is involved in
+ wxWindowList *m_constraintsInvolvedIn;
+#endif // wxUSE_CONSTRAINTS
+
+ // this window's sizer
+ wxSizer *m_windowSizer;
+
+ // The sizer this window is a member of, if any
+ wxSizer *m_containingSizer;
+
+ // Layout() window automatically when its size changes?
+ bool m_autoLayout:1;
+
+ // window state
+ bool m_isShown:1;
+ bool m_isEnabled:1;
+ bool m_isBeingDeleted:1;
+
+ // was the window colours/font explicitly changed by user?
+ bool m_hasBgCol:1;
+ bool m_hasFgCol:1;
+ bool m_hasFont:1;
+
+ // and should it be inherited by children?
+ bool m_inheritBgCol:1;
+ bool m_inheritFgCol:1;
+ bool m_inheritFont:1;
+
+ // window attributes
+ long m_windowStyle,
+ m_exStyle;
+ wxString m_windowName;
+ bool m_themeEnabled;
+ wxBackgroundStyle m_backgroundStyle;
+#if wxUSE_PALETTE
+ wxPalette m_palette;
+ bool m_hasCustomPalette;
+#endif // wxUSE_PALETTE
+
+#if wxUSE_ACCESSIBILITY
+ wxAccessible* m_accessible;
+#endif
+
+ // Virtual size (scrolling)
+ wxSize m_virtualSize;
+
+ wxScrollHelper *m_scrollHelper;
+
+ wxWindowVariant m_windowVariant ;
+
+ // override this to change the default (i.e. used when no style is
+ // specified) border for the window class
+ virtual wxBorder GetDefaultBorder() const;
+
+ // this allows you to implement standard control borders without
+ // repeating the code in different classes that are not derived from
+ // wxControl
+ virtual wxBorder GetDefaultBorderForControl() const { return wxBORDER_THEME; }
+
+ // Get the default size for the new window if no explicit size given. TLWs
+ // have their own default size so this is just for non top-level windows.
+ static int WidthDefault(int w) { return w == wxDefaultCoord ? 20 : w; }
+ static int HeightDefault(int h) { return h == wxDefaultCoord ? 20 : h; }
+
+
+ // Used to save the results of DoGetBestSize so it doesn't need to be
+ // recalculated each time the value is needed.
+ wxSize m_bestSizeCache;
+
+ wxDEPRECATED_MSG("use SetInitialSize() instead.")
+ void SetBestSize(const wxSize& size);
+ wxDEPRECATED_MSG("use SetInitialSize() instead.")
+ virtual void SetInitialBestSize(const wxSize& size);
+
+
+
+ // more pure virtual functions
+ // ---------------------------
+
+ // NB: we must have DoSomething() function when Something() is an overloaded
+ // method: indeed, we can't just have "virtual Something()" in case when
+ // the function is overloaded because then we'd have to make virtual all
+ // the variants (otherwise only the virtual function may be called on a
+ // pointer to derived class according to C++ rules) which is, in
+ // general, absolutely not needed. So instead we implement all
+ // overloaded Something()s in terms of DoSomething() which will be the
+ // only one to be virtual.
+
+ // text extent
+ virtual void DoGetTextExtent(const wxString& string,
+ int *x, int *y,
+ int *descent = NULL,
+ int *externalLeading = NULL,
+ const wxFont *font = NULL) const = 0;
+
+ // coordinates translation
+ virtual void DoClientToScreen( int *x, int *y ) const = 0;
+ virtual void DoScreenToClient( int *x, int *y ) const = 0;
+
+ virtual wxHitTest DoHitTest(wxCoord x, wxCoord y) const;
+
+ // capture/release the mouse, used by Capture/ReleaseMouse()
+ virtual void DoCaptureMouse() = 0;
+ virtual void DoReleaseMouse() = 0;
+
+ // retrieve the position/size of the window
+ virtual void DoGetPosition(int *x, int *y) const = 0;
+ virtual void DoGetScreenPosition(int *x, int *y) const;
+ virtual void DoGetSize(int *width, int *height) const = 0;
+ virtual void DoGetClientSize(int *width, int *height) const = 0;
+
+ // get the size which best suits the window: for a control, it would be
+ // the minimal size which doesn't truncate the control, for a panel - the
+ // same size as it would have after a call to Fit()
+ virtual wxSize DoGetBestSize() const;
+
+ // this method can be overridden instead of DoGetBestSize() if it computes
+ // the best size of the client area of the window only, excluding borders
+ // (GetBorderSize() will be used to add them)
+ virtual wxSize DoGetBestClientSize() const { return wxDefaultSize; }
+
+ // These two methods can be overridden to implement intelligent
+ // width-for-height and/or height-for-width best size determination for the
+ // window. By default the fixed best size is used.
+ virtual int DoGetBestClientHeight(int WXUNUSED(width)) const
+ { return wxDefaultCoord; }
+ virtual int DoGetBestClientWidth(int WXUNUSED(height)) const
+ { return wxDefaultCoord; }
+
+ // this is the virtual function to be overridden in any derived class which
+ // wants to change how SetSize() or Move() works - it is called by all
+ // versions of these functions in the base class
+ virtual void DoSetSize(int x, int y,
+ int width, int height,
+ int sizeFlags = wxSIZE_AUTO) = 0;
+
+ // same as DoSetSize() for the client size
+ virtual void DoSetClientSize(int width, int height) = 0;
+
+ virtual void DoSetSizeHints( int minW, int minH,
+ int maxW, int maxH,
+ int incW, int incH );
+
+ // return the total size of the window borders, i.e. the sum of the widths
+ // of the left and the right border in the x component of the returned size
+ // and the sum of the heights of the top and bottom borders in the y one
+ //
+ // NB: this is currently only implemented properly for wxMSW, wxGTK and
+ // wxUniv and doesn't behave correctly in the presence of scrollbars in
+ // the other ports
+ virtual wxSize DoGetBorderSize() const;
+
+ // move the window to the specified location and resize it: this is called
+ // from both DoSetSize() and DoSetClientSize() and would usually just
+ // reposition this window except for composite controls which will want to
+ // arrange themselves inside the given rectangle
+ //
+ // Important note: the coordinates passed to this method are in parent's
+ // *window* coordinates and not parent's client coordinates (as the values
+ // passed to DoSetSize and returned by DoGetPosition are)!
+ virtual void DoMoveWindow(int x, int y, int width, int height) = 0;
+
+ // centre the window in the specified direction on parent, note that
+ // wxCENTRE_ON_SCREEN shouldn't be specified here, it only makes sense for
+ // TLWs
+ virtual void DoCentre(int dir);
+
+#if wxUSE_TOOLTIPS
+ virtual void DoSetToolTip( wxToolTip *tip );
+#endif // wxUSE_TOOLTIPS
+
+#if wxUSE_MENUS
+ virtual bool DoPopupMenu(wxMenu *menu, int x, int y) = 0;
+#endif // wxUSE_MENUS
+
+ // Makes an adjustment to the window position to make it relative to the
+ // parents client area, e.g. if the parent is a frame with a toolbar, its
+ // (0, 0) is just below the toolbar
+ virtual void AdjustForParentClientOrigin(int& x, int& y,
+ int sizeFlags = 0) const;
+
+ // implements the window variants
+ virtual void DoSetWindowVariant( wxWindowVariant variant ) ;
+
+
+ // really freeze/thaw the window (should have port-specific implementation)
+ virtual void DoFreeze() { }
+ virtual void DoThaw() { }
+
+
+ // Must be called when mouse capture is lost to send
+ // wxMouseCaptureLostEvent to windows on capture stack.
+ static void NotifyCaptureLost();
+
+private:
+ // recursively call our own and our children DoEnable() when the
+ // enabled/disabled status changed because a parent window had been
+ // enabled/disabled
+ void NotifyWindowOnEnableChange(bool enabled);
+
+#if wxUSE_MENUS
+ // temporary event handlers used by GetPopupMenuSelectionFromUser()
+ void InternalOnPopupMenu(wxCommandEvent& event);
+ void InternalOnPopupMenuUpdate(wxUpdateUIEvent& event);
+
+ // implementation of the public GetPopupMenuSelectionFromUser() method
+ int DoGetPopupMenuSelectionFromUser(wxMenu& menu, int x, int y);
+#endif // wxUSE_MENUS
+
+ // layout the window children when its size changes unless this was
+ // explicitly disabled with SetAutoLayout(false)
+ void InternalOnSize(wxSizeEvent& event);
+
+ // base for dialog unit conversion, i.e. average character size
+ wxSize GetDlgUnitBase() const;
+
+
+ // number of Freeze() calls minus the number of Thaw() calls: we're frozen
+ // (i.e. not being updated) if it is positive
+ unsigned int m_freezeCount;
+
+
+ DECLARE_ABSTRACT_CLASS(wxWindowBase)
+ wxDECLARE_NO_COPY_CLASS(wxWindowBase);
+ DECLARE_EVENT_TABLE()
+};
+
+
+
+// Inlines for some deprecated methods
+inline wxSize wxWindowBase::GetBestFittingSize() const
+{
+ return GetEffectiveMinSize();
+}
+
+inline void wxWindowBase::SetBestFittingSize(const wxSize& size)
+{
+ SetInitialSize(size);
+}
+
+inline void wxWindowBase::SetBestSize(const wxSize& size)
+{
+ SetInitialSize(size);
+}
+
+inline void wxWindowBase::SetInitialBestSize(const wxSize& size)
+{
+ SetInitialSize(size);
+}
+
+
+// ----------------------------------------------------------------------------
+// now include the declaration of wxWindow class
+// ----------------------------------------------------------------------------
+
+// include the declaration of the platform-specific class
+#if defined(__WXMSW__)
+ #ifdef __WXUNIVERSAL__
+ #define wxWindowNative wxWindowMSW
+ #else // !wxUniv
+ #define wxWindowMSW wxWindow
+ #endif // wxUniv/!wxUniv
+ #include "wx/msw/window.h"
+#elif defined(__WXMOTIF__)
+ #include "wx/motif/window.h"
+#elif defined(__WXGTK20__)
+ #ifdef __WXUNIVERSAL__
+ #define wxWindowNative wxWindowGTK
+ #else // !wxUniv
+ #define wxWindowGTK wxWindow
+ #endif // wxUniv
+ #include "wx/gtk/window.h"
+#elif defined(__WXGTK__)
+ #ifdef __WXUNIVERSAL__
+ #define wxWindowNative wxWindowGTK
+ #else // !wxUniv
+ #define wxWindowGTK wxWindow
+ #endif // wxUniv
+ #include "wx/gtk1/window.h"
+#elif defined(__WXX11__)
+ #ifdef __WXUNIVERSAL__
+ #define wxWindowNative wxWindowX11
+ #else // !wxUniv
+ #define wxWindowX11 wxWindow
+ #endif // wxUniv
+ #include "wx/x11/window.h"
+#elif defined(__WXDFB__)
+ #define wxWindowNative wxWindowDFB
+ #include "wx/dfb/window.h"
+#elif defined(__WXMAC__)
+ #ifdef __WXUNIVERSAL__
+ #define wxWindowNative wxWindowMac
+ #else // !wxUniv
+ #define wxWindowMac wxWindow
+ #endif // wxUniv
+ #include "wx/osx/window.h"
+#elif defined(__WXCOCOA__)
+ #ifdef __WXUNIVERSAL__
+ #define wxWindowNative wxWindowCocoa
+ #else // !wxUniv
+ #define wxWindowCocoa wxWindow
+ #endif // wxUniv
+ #include "wx/cocoa/window.h"
+#elif defined(__WXPM__)
+ #ifdef __WXUNIVERSAL__
+ #define wxWindowNative wxWindowOS2
+ #else // !wxUniv
+ #define wxWindowOS2 wxWindow
+ #endif // wxUniv/!wxUniv
+ #include "wx/os2/window.h"
+#endif
+
+// for wxUniversal, we now derive the real wxWindow from wxWindow<platform>,
+// for the native ports we already have defined it above
+#if defined(__WXUNIVERSAL__)
+ #ifndef wxWindowNative
+ #error "wxWindowNative must be defined above!"
+ #endif
+
+ #include "wx/univ/window.h"
+#endif // wxUniv
+
+// ----------------------------------------------------------------------------
+// inline functions which couldn't be declared in the class body because of
+// forward dependencies
+// ----------------------------------------------------------------------------
+
+inline wxWindow *wxWindowBase::GetGrandParent() const
+{
+ return m_parent ? m_parent->GetParent() : NULL;
+}
+
+// ----------------------------------------------------------------------------
+// global functions
+// ----------------------------------------------------------------------------
+
+// Find the wxWindow at the current mouse position, also returning the mouse
+// position.
+extern WXDLLIMPEXP_CORE wxWindow* wxFindWindowAtPointer(wxPoint& pt);
+
+// Get the current mouse position.
+extern WXDLLIMPEXP_CORE wxPoint wxGetMousePosition();
+
+// get the currently active window of this application or NULL
+extern WXDLLIMPEXP_CORE wxWindow *wxGetActiveWindow();
+
+// get the (first) top level parent window
+WXDLLIMPEXP_CORE wxWindow* wxGetTopLevelParent(wxWindow *win);
+
+#if WXWIN_COMPATIBILITY_2_6
+ wxDEPRECATED_MSG("use wxWindow::NewControlId() instead")
+ inline wxWindowID NewControlId() { return wxWindowBase::NewControlId(); }
+#endif // WXWIN_COMPATIBILITY_2_6
+
+#if wxUSE_ACCESSIBILITY
+// ----------------------------------------------------------------------------
+// accessible object for windows
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxWindowAccessible: public wxAccessible
+{
+public:
+ wxWindowAccessible(wxWindow* win): wxAccessible(win) { if (win) win->SetAccessible(this); }
+ virtual ~wxWindowAccessible() {}
+
+// Overridables
+
+ // Can return either a child object, or an integer
+ // representing the child element, starting from 1.
+ virtual wxAccStatus HitTest(const wxPoint& pt, int* childId, wxAccessible** childObject);
+
+ // Returns the rectangle for this object (id = 0) or a child element (id > 0).
+ virtual wxAccStatus GetLocation(wxRect& rect, int elementId);
+
+ // Navigates from fromId to toId/toObject.
+ virtual wxAccStatus Navigate(wxNavDir navDir, int fromId,
+ int* toId, wxAccessible** toObject);
+
+ // Gets the name of the specified object.
+ virtual wxAccStatus GetName(int childId, wxString* name);
+
+ // Gets the number of children.
+ virtual wxAccStatus GetChildCount(int* childCount);
+
+ // Gets the specified child (starting from 1).
+ // If *child is NULL and return value is wxACC_OK,
+ // this means that the child is a simple element and
+ // not an accessible object.
+ virtual wxAccStatus GetChild(int childId, wxAccessible** child);
+
+ // Gets the parent, or NULL.
+ virtual wxAccStatus GetParent(wxAccessible** parent);
+
+ // Performs the default action. childId is 0 (the action for this object)
+ // or > 0 (the action for a child).
+ // Return wxACC_NOT_SUPPORTED if there is no default action for this
+ // window (e.g. an edit control).
+ virtual wxAccStatus DoDefaultAction(int childId);
+
+ // Gets the default action for this object (0) or > 0 (the action for a child).
+ // Return wxACC_OK even if there is no action. actionName is the action, or the empty
+ // string if there is no action.
+ // The retrieved string describes the action that is performed on an object,
+ // not what the object does as a result. For example, a toolbar button that prints
+ // a document has a default action of "Press" rather than "Prints the current document."
+ virtual wxAccStatus GetDefaultAction(int childId, wxString* actionName);
+
+ // Returns the description for this object or a child.
+ virtual wxAccStatus GetDescription(int childId, wxString* description);
+
+ // Returns help text for this object or a child, similar to tooltip text.
+ virtual wxAccStatus GetHelpText(int childId, wxString* helpText);
+
+ // Returns the keyboard shortcut for this object or child.
+ // Return e.g. ALT+K
+ virtual wxAccStatus GetKeyboardShortcut(int childId, wxString* shortcut);
+
+ // Returns a role constant.
+ virtual wxAccStatus GetRole(int childId, wxAccRole* role);
+
+ // Returns a state constant.
+ virtual wxAccStatus GetState(int childId, long* state);
+
+ // Returns a localized string representing the value for the object
+ // or child.
+ virtual wxAccStatus GetValue(int childId, wxString* strValue);
+
+ // Selects the object or child.
+ virtual wxAccStatus Select(int childId, wxAccSelectionFlags selectFlags);
+
+ // Gets the window with the keyboard focus.
+ // If childId is 0 and child is NULL, no object in
+ // this subhierarchy has the focus.
+ // If this object has the focus, child should be 'this'.
+ virtual wxAccStatus GetFocus(int* childId, wxAccessible** child);
+
+#if wxUSE_VARIANT
+ // Gets a variant representing the selected children
+ // of this object.
+ // Acceptable values:
+ // - a null variant (IsNull() returns true)
+ // - a list variant (GetType() == wxT("list")
+ // - an integer representing the selected child element,
+ // or 0 if this object is selected (GetType() == wxT("long")
+ // - a "void*" pointer to a wxAccessible child object
+ virtual wxAccStatus GetSelections(wxVariant* selections);
+#endif // wxUSE_VARIANT
+};
+
+#endif // wxUSE_ACCESSIBILITY
+
+
+#endif // _WX_WINDOW_H_BASE_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/windowid.h
+// Purpose: wxWindowID class - a class for managing window ids
+// Author: Brian Vanderburg II
+// Created: 2007-09-21
+// Copyright: (c) 2007 Brian Vanderburg II
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WINDOWID_H_
+#define _WX_WINDOWID_H_
+
+// NB: do not include defs.h as we are included from it
+
+typedef int wxWindowID;
+
+// ----------------------------------------------------------------------------
+// wxWindowIDRef: reference counted id value
+// ----------------------------------------------------------------------------
+
+// A wxWindowIDRef object wraps an id value and marks it as (un)used as
+// necessary. All ids returned from wxWindow::NewControlId() should be assigned
+// to an instance of this class to ensure that the id is marked as being in
+// use.
+//
+// This class is always defined but it is trivial if wxUSE_AUTOID_MANAGEMENT is
+// off.
+class WXDLLIMPEXP_CORE wxWindowIDRef
+{
+public:
+ // default ctor
+ wxWindowIDRef()
+ {
+ m_id = wxID_NONE;
+ }
+
+ // ctor taking id values
+ wxWindowIDRef(int id)
+ {
+ Init(id);
+ }
+
+ wxWindowIDRef(long id)
+ {
+ Init(wxWindowID(id));
+ }
+
+ wxWindowIDRef(const wxWindowIDRef& id)
+ {
+ Init(id.m_id);
+ }
+
+ // dtor
+ ~wxWindowIDRef()
+ {
+ Assign(wxID_NONE);
+ }
+
+ // assignment
+ wxWindowIDRef& operator=(int id)
+ {
+ Assign(id);
+ return *this;
+ }
+
+ wxWindowIDRef& operator=(long id)
+ {
+ Assign(wxWindowID(id));
+ return *this;
+ }
+
+ wxWindowIDRef& operator=(const wxWindowIDRef& id)
+ {
+ if (&id != this)
+ Assign(id.m_id);
+ return *this;
+ }
+
+ // access to the stored id value
+ wxWindowID GetValue() const
+ {
+ return m_id;
+ }
+
+ operator wxWindowID() const
+ {
+ return m_id;
+ }
+
+private:
+#if wxUSE_AUTOID_MANAGEMENT
+ // common part of all ctors: call Assign() for our new id
+ void Init(wxWindowID id)
+ {
+ // m_id must be initialized before calling Assign()
+ m_id = wxID_NONE;
+ Assign(id);
+ }
+
+ // increase reference count of id, decrease the one of m_id
+ void Assign(wxWindowID id);
+#else // !wxUSE_AUTOID_MANAGEMENT
+ // trivial stubs for the functions above
+ void Init(wxWindowID id)
+ {
+ m_id = id;
+ }
+
+ void Assign(wxWindowID id)
+ {
+ m_id = id;
+ }
+#endif // wxUSE_AUTOID_MANAGEMENT/!wxUSE_AUTOID_MANAGEMENT
+
+
+ wxWindowID m_id;
+};
+
+// comparison operators
+inline bool operator==(const wxWindowIDRef& lhs, const wxWindowIDRef& rhs)
+{
+ return lhs.GetValue() == rhs.GetValue();
+}
+
+inline bool operator==(const wxWindowIDRef& lhs, int rhs)
+{
+ return lhs.GetValue() == rhs;
+}
+
+inline bool operator==(const wxWindowIDRef& lhs, long rhs)
+{
+ return lhs.GetValue() == rhs;
+}
+
+inline bool operator==(int lhs, const wxWindowIDRef& rhs)
+{
+ return rhs == lhs;
+}
+
+inline bool operator==(long lhs, const wxWindowIDRef& rhs)
+{
+ return rhs == lhs;
+}
+
+inline bool operator!=(const wxWindowIDRef& lhs, const wxWindowIDRef& rhs)
+{
+ return !(lhs == rhs);
+}
+
+inline bool operator!=(const wxWindowIDRef& lhs, int rhs)
+{
+ return !(lhs == rhs);
+}
+
+inline bool operator!=(const wxWindowIDRef& lhs, long rhs)
+{
+ return !(lhs == rhs);
+}
+
+inline bool operator!=(int lhs, const wxWindowIDRef& rhs)
+{
+ return !(lhs == rhs);
+}
+
+inline bool operator!=(long lhs, const wxWindowIDRef& rhs)
+{
+ return !(lhs == rhs);
+}
+
+// ----------------------------------------------------------------------------
+// wxIdManager
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxIdManager
+{
+public:
+ // This returns an id value and not an wxWindowIDRef. The returned value
+ // should be assigned a.s.a.p to a wxWindowIDRef. The IDs are marked as
+ // reserved so that another call to ReserveId before assigning the id to a
+ // wxWindowIDRef will not use the same ID
+ static wxWindowID ReserveId(int count = 1);
+
+ // This will release an unused reserved ID. This should only be called
+ // if the ID returned by ReserveId was NOT assigned to a wxWindowIDRef
+ // for some purpose, maybe an early return from a function
+ static void UnreserveId(wxWindowID id, int count = 1);
+};
+
+#endif // _WX_WINDOWID_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/windowptr.h
+// Purpose: smart pointer for holding wxWindow instances
+// Author: Vaclav Slavik
+// Created: 2013-09-01
+// Copyright: (c) 2013 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WINDOWPTR_H_
+#define _WX_WINDOWPTR_H_
+
+#include "wx/sharedptr.h"
+
+// ----------------------------------------------------------------------------
+// wxWindowPtr: A smart pointer with correct wxWindow destruction.
+// ----------------------------------------------------------------------------
+
+namespace wxPrivate
+{
+
+struct wxWindowDeleter
+{
+ void operator()(wxWindow *win)
+ {
+ win->Destroy();
+ }
+};
+
+} // namespace wxPrivate
+
+template<typename T>
+class wxWindowPtr : public wxSharedPtr<T>
+{
+public:
+ typedef T element_type;
+
+ wxEXPLICIT wxWindowPtr(element_type* win)
+ : wxSharedPtr<T>(win, wxPrivate::wxWindowDeleter())
+ {
+ }
+
+ wxWindowPtr() {}
+ wxWindowPtr(const wxWindowPtr& tocopy) : wxSharedPtr<T>(tocopy) {}
+
+ wxWindowPtr& operator=(const wxWindowPtr& tocopy)
+ {
+ wxSharedPtr<T>::operator=(tocopy);
+ return *this;
+ }
+
+ wxWindowPtr& operator=(element_type* win)
+ {
+ return operator=(wxWindowPtr(win));
+ }
+
+ void reset(T* ptr = NULL)
+ {
+ wxSharedPtr<T>::reset(ptr, wxPrivate::wxWindowDeleter());
+ }
+};
+
+#endif // _WX_WINDOWPTR_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/withimages.h
+// Purpose: Declaration of a simple wxWithImages class.
+// Author: Vadim Zeitlin
+// Created: 2011-08-17
+// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WITHIMAGES_H_
+#define _WX_WITHIMAGES_H_
+
+#include "wx/defs.h"
+#include "wx/icon.h"
+#include "wx/imaglist.h"
+
+// ----------------------------------------------------------------------------
+// wxWithImages: mix-in class providing access to wxImageList.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxWithImages
+{
+public:
+ enum
+ {
+ NO_IMAGE = -1
+ };
+
+ wxWithImages()
+ {
+ m_imageList = NULL;
+ m_ownsImageList = false;
+ }
+
+ virtual ~wxWithImages()
+ {
+ FreeIfNeeded();
+ }
+
+ // Sets the image list to use, it is *not* deleted by the control.
+ virtual void SetImageList(wxImageList* imageList)
+ {
+ FreeIfNeeded();
+ m_imageList = imageList;
+ }
+
+ // As SetImageList() but we will delete the image list ourselves.
+ void AssignImageList(wxImageList* imageList)
+ {
+ SetImageList(imageList);
+ m_ownsImageList = true;
+ }
+
+ // Get pointer (may be NULL) to the associated image list.
+ wxImageList* GetImageList() const { return m_imageList; }
+
+protected:
+ // Return true if we have a valid image list.
+ bool HasImageList() const { return m_imageList != NULL; }
+
+ // Return the image with the given index from the image list.
+ //
+ // If there is no image list or if index == NO_IMAGE, silently returns
+ // wxNullIcon.
+ wxIcon GetImage(int iconIndex) const
+ {
+ return m_imageList && iconIndex != NO_IMAGE
+ ? m_imageList->GetIcon(iconIndex)
+ : wxNullIcon;
+ }
+
+private:
+ // Free the image list if necessary, i.e. if we own it.
+ void FreeIfNeeded()
+ {
+ if ( m_ownsImageList )
+ {
+ delete m_imageList;
+ m_imageList = NULL;
+
+ // We don't own it any more.
+ m_ownsImageList = false;
+ }
+ }
+
+
+ // The associated image list or NULL.
+ wxImageList* m_imageList;
+
+ // False by default, if true then we delete m_imageList.
+ bool m_ownsImageList;
+
+ wxDECLARE_NO_COPY_CLASS(wxWithImages);
+};
+
+#endif // _WX_WITHIMAGES_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/wizard.h
+// Purpose: wxWizard class: a GUI control presenting the user with a
+// sequence of dialogs which allows to simply perform some task
+// Author: Vadim Zeitlin (partly based on work by Ron Kuris and Kevin B.
+// Smith)
+// Modified by: Robert Cavanaugh
+// Added capability to use .WXR resource files in Wizard pages
+// Added wxWIZARD_HELP event
+// Robert Vazan (sizers)
+// Created: 15.08.99
+// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WIZARD_H_
+#define _WX_WIZARD_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_WIZARDDLG
+
+// ----------------------------------------------------------------------------
+// headers and other simple declarations
+// ----------------------------------------------------------------------------
+
+#include "wx/dialog.h" // the base class
+#include "wx/panel.h" // ditto
+#include "wx/event.h" // wxEVT_XXX constants
+#include "wx/bitmap.h"
+
+// Extended style to specify a help button
+#define wxWIZARD_EX_HELPBUTTON 0x00000010
+
+// Placement flags
+#define wxWIZARD_VALIGN_TOP 0x01
+#define wxWIZARD_VALIGN_CENTRE 0x02
+#define wxWIZARD_VALIGN_BOTTOM 0x04
+#define wxWIZARD_HALIGN_LEFT 0x08
+#define wxWIZARD_HALIGN_CENTRE 0x10
+#define wxWIZARD_HALIGN_RIGHT 0x20
+#define wxWIZARD_TILE 0x40
+
+// forward declarations
+class WXDLLIMPEXP_FWD_ADV wxWizard;
+
+// ----------------------------------------------------------------------------
+// wxWizardPage is one of the wizards screen: it must know what are the
+// following and preceding pages (which may be NULL for the first/last page).
+//
+// Other than GetNext/Prev() functions, wxWizardPage is just a panel and may be
+// used as such (i.e. controls may be placed directly on it &c).
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxWizardPage : public wxPanel
+{
+public:
+ wxWizardPage() { Init(); }
+
+ // ctor accepts an optional bitmap which will be used for this page instead
+ // of the default one for this wizard (should be of the same size). Notice
+ // that no other parameters are needed because the wizard will resize and
+ // reposition the page anyhow
+ wxWizardPage(wxWizard *parent,
+ const wxBitmap& bitmap = wxNullBitmap);
+
+ bool Create(wxWizard *parent,
+ const wxBitmap& bitmap = wxNullBitmap);
+
+ // these functions are used by the wizard to show another page when the
+ // user chooses "Back" or "Next" button
+ virtual wxWizardPage *GetPrev() const = 0;
+ virtual wxWizardPage *GetNext() const = 0;
+
+ // default GetBitmap() will just return m_bitmap which is ok in 99% of
+ // cases - override this method if you want to create the bitmap to be used
+ // dynamically or to do something even more fancy. It's ok to return
+ // wxNullBitmap from here - the default one will be used then.
+ virtual wxBitmap GetBitmap() const { return m_bitmap; }
+
+#if wxUSE_VALIDATORS
+ // Override the base functions to allow a validator to be assigned to this page.
+ virtual bool TransferDataToWindow()
+ {
+ return GetValidator() ? GetValidator()->TransferToWindow()
+ : wxPanel::TransferDataToWindow();
+ }
+
+ virtual bool TransferDataFromWindow()
+ {
+ return GetValidator() ? GetValidator()->TransferFromWindow()
+ : wxPanel::TransferDataFromWindow();
+ }
+
+ virtual bool Validate()
+ {
+ return GetValidator() ? GetValidator()->Validate(this)
+ : wxPanel::Validate();
+ }
+#endif // wxUSE_VALIDATORS
+
+protected:
+ // common part of ctors:
+ void Init();
+
+ wxBitmap m_bitmap;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxWizardPage)
+};
+
+// ----------------------------------------------------------------------------
+// wxWizardPageSimple just returns the pointers given to the ctor and is useful
+// to create a simple wizard where the order of pages never changes.
+//
+// OTOH, it is also possible to dynamically decide which page to return (i.e.
+// depending on the user's choices) as the wizard sample shows - in order to do
+// this, you must derive from wxWizardPage directly.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxWizardPageSimple : public wxWizardPage
+{
+public:
+ wxWizardPageSimple() { Init(); }
+
+ // ctor takes the previous and next pages
+ wxWizardPageSimple(wxWizard *parent,
+ wxWizardPage *prev = NULL,
+ wxWizardPage *next = NULL,
+ const wxBitmap& bitmap = wxNullBitmap)
+ {
+ Create(parent, prev, next, bitmap);
+ }
+
+ bool Create(wxWizard *parent = NULL, // let it be default ctor too
+ wxWizardPage *prev = NULL,
+ wxWizardPage *next = NULL,
+ const wxBitmap& bitmap = wxNullBitmap)
+ {
+ m_prev = prev;
+ m_next = next;
+ return wxWizardPage::Create(parent, bitmap);
+ }
+
+ // the pointers may be also set later - but before starting the wizard
+ void SetPrev(wxWizardPage *prev) { m_prev = prev; }
+ void SetNext(wxWizardPage *next) { m_next = next; }
+
+ // Convenience functions to make the pages follow each other without having
+ // to call their SetPrev() or SetNext() explicitly.
+ wxWizardPageSimple& Chain(wxWizardPageSimple* next)
+ {
+ SetNext(next);
+ next->SetPrev(this);
+ return *next;
+ }
+
+ static void Chain(wxWizardPageSimple *first, wxWizardPageSimple *second)
+ {
+ wxCHECK_RET( first && second,
+ wxT("NULL passed to wxWizardPageSimple::Chain") );
+
+ first->SetNext(second);
+ second->SetPrev(first);
+ }
+
+ // base class pure virtuals
+ virtual wxWizardPage *GetPrev() const;
+ virtual wxWizardPage *GetNext() const;
+
+private:
+ // common part of ctors:
+ void Init()
+ {
+ m_prev = m_next = NULL;
+ }
+
+ // pointers are private, the derived classes shouldn't mess with them -
+ // just derive from wxWizardPage directly to implement different behaviour
+ wxWizardPage *m_prev,
+ *m_next;
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxWizardPageSimple)
+};
+
+// ----------------------------------------------------------------------------
+// wxWizard
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxWizardBase : public wxDialog
+{
+public:
+ /*
+ The derived class (i.e. the real wxWizard) has a ctor and Create()
+ function taking the following arguments:
+
+ wxWizard(wxWindow *parent,
+ int id = wxID_ANY,
+ const wxString& title = wxEmptyString,
+ const wxBitmap& bitmap = wxNullBitmap,
+ const wxPoint& pos = wxDefaultPosition,
+ long style = wxDEFAULT_DIALOG_STYLE);
+ */
+ wxWizardBase() { }
+
+ // executes the wizard starting from the given page, returns true if it was
+ // successfully finished, false if user cancelled it
+ virtual bool RunWizard(wxWizardPage *firstPage) = 0;
+
+ // get the current page (NULL if RunWizard() isn't running)
+ virtual wxWizardPage *GetCurrentPage() const = 0;
+
+ // set the min size which should be available for the pages: a
+ // wizard will take into account the size of the bitmap (if any)
+ // itself and will never be less than some predefined fixed size
+ virtual void SetPageSize(const wxSize& size) = 0;
+
+ // get the size available for the page
+ virtual wxSize GetPageSize() const = 0;
+
+ // set the best size for the wizard, i.e. make it big enough to contain all
+ // of the pages starting from the given one
+ //
+ // this function may be called several times and possible with different
+ // pages in which case it will only increase the page size if needed (this
+ // may be useful if not all pages are accessible from the first one by
+ // default)
+ virtual void FitToPage(const wxWizardPage *firstPage) = 0;
+
+ // Adding pages to page area sizer enlarges wizard
+ virtual wxSizer *GetPageAreaSizer() const = 0;
+
+ // Set border around page area. Default is 0 if you add at least one
+ // page to GetPageAreaSizer and 5 if you don't.
+ virtual void SetBorder(int border) = 0;
+
+ // the methods below may be overridden by the derived classes to provide
+ // custom logic for determining the pages order
+
+ virtual bool HasNextPage(wxWizardPage *page)
+ { return page->GetNext() != NULL; }
+
+ virtual bool HasPrevPage(wxWizardPage *page)
+ { return page->GetPrev() != NULL; }
+
+ /// Override these functions to stop InitDialog from calling TransferDataToWindow
+ /// for _all_ pages when the wizard starts. Instead 'ShowPage' will call
+ /// TransferDataToWindow for the first page only.
+ bool TransferDataToWindow() { return true; }
+ bool TransferDataFromWindow() { return true; }
+ bool Validate() { return true; }
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxWizardBase);
+};
+
+// include the real class declaration
+#include "wx/generic/wizard.h"
+
+// ----------------------------------------------------------------------------
+// wxWizardEvent class represents an event generated by the wizard: this event
+// is first sent to the page itself and, if not processed there, goes up the
+// window hierarchy as usual
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxWizardEvent : public wxNotifyEvent
+{
+public:
+ wxWizardEvent(wxEventType type = wxEVT_NULL,
+ int id = wxID_ANY,
+ bool direction = true,
+ wxWizardPage* page = NULL);
+
+ // for EVT_WIZARD_PAGE_CHANGING, return true if we're going forward or
+ // false otherwise and for EVT_WIZARD_PAGE_CHANGED return true if we came
+ // from the previous page and false if we returned from the next one
+ // (this function doesn't make sense for CANCEL events)
+ bool GetDirection() const { return m_direction; }
+
+ wxWizardPage* GetPage() const { return m_page; }
+
+ virtual wxEvent *Clone() const { return new wxWizardEvent(*this); }
+
+private:
+ bool m_direction;
+ wxWizardPage* m_page;
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWizardEvent)
+};
+
+// ----------------------------------------------------------------------------
+// macros for handling wxWizardEvents
+// ----------------------------------------------------------------------------
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_WIZARD_PAGE_CHANGED, wxWizardEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_WIZARD_PAGE_CHANGING, wxWizardEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_WIZARD_CANCEL, wxWizardEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_WIZARD_HELP, wxWizardEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_WIZARD_FINISHED, wxWizardEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_WIZARD_PAGE_SHOWN, wxWizardEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_WIZARD_BEFORE_PAGE_CHANGED, wxWizardEvent );
+
+typedef void (wxEvtHandler::*wxWizardEventFunction)(wxWizardEvent&);
+
+#define wxWizardEventHandler(func) \
+ wxEVENT_HANDLER_CAST(wxWizardEventFunction, func)
+
+#define wx__DECLARE_WIZARDEVT(evt, id, fn) \
+ wx__DECLARE_EVT1(wxEVT_WIZARD_ ## evt, id, wxWizardEventHandler(fn))
+
+// notifies that the page has just been changed (can't be vetoed)
+#define EVT_WIZARD_PAGE_CHANGED(id, fn) wx__DECLARE_WIZARDEVT(PAGE_CHANGED, id, fn)
+
+// the user pressed "<Back" or "Next>" button and the page is going to be
+// changed - unless the event handler vetoes the event
+#define EVT_WIZARD_PAGE_CHANGING(id, fn) wx__DECLARE_WIZARDEVT(PAGE_CHANGING, id, fn)
+
+// Called before GetNext/GetPrev is called, so that the handler can change state that will be
+// used when GetNext/GetPrev is called. PAGE_CHANGING is called too late to influence GetNext/GetPrev.
+#define EVT_WIZARD_BEFORE_PAGE_CHANGED(id, fn) wx__DECLARE_WIZARDEVT(BEFORE_PAGE_CHANGED, id, fn)
+
+// the user pressed "Cancel" button and the wizard is going to be dismissed -
+// unless the event handler vetoes the event
+#define EVT_WIZARD_CANCEL(id, fn) wx__DECLARE_WIZARDEVT(CANCEL, id, fn)
+
+// the user pressed "Finish" button and the wizard is going to be dismissed -
+#define EVT_WIZARD_FINISHED(id, fn) wx__DECLARE_WIZARDEVT(FINISHED, id, fn)
+
+// the user pressed "Help" button
+#define EVT_WIZARD_HELP(id, fn) wx__DECLARE_WIZARDEVT(HELP, id, fn)
+
+// the page was just shown and laid out
+#define EVT_WIZARD_PAGE_SHOWN(id, fn) wx__DECLARE_WIZARDEVT(PAGE_SHOWN, id, fn)
+
+#endif // wxUSE_WIZARDDLG
+
+#endif // _WX_WIZARD_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/wrapsizer.h
+// Purpose: provide wrapping sizer for layout (wxWrapSizer)
+// Author: Arne Steinarson
+// Created: 2008-05-08
+// Copyright: (c) Arne Steinarson
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WRAPSIZER_H_
+#define _WX_WRAPSIZER_H_
+
+#include "wx/sizer.h"
+
+// flags for wxWrapSizer
+enum
+{
+ wxEXTEND_LAST_ON_EACH_LINE = 1,
+ // don't leave spacers in the beginning of a new row
+ wxREMOVE_LEADING_SPACES = 2,
+
+ wxWRAPSIZER_DEFAULT_FLAGS = wxEXTEND_LAST_ON_EACH_LINE |
+ wxREMOVE_LEADING_SPACES
+};
+
+// ----------------------------------------------------------------------------
+// A box sizer that can wrap items on several lines when sum of widths exceed
+// available line width.
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxWrapSizer : public wxBoxSizer
+{
+public:
+ wxWrapSizer(int orient = wxHORIZONTAL, int flags = wxWRAPSIZER_DEFAULT_FLAGS);
+ virtual ~wxWrapSizer();
+
+ // override base class virtual methods
+ virtual wxSize CalcMin();
+ virtual void RecalcSizes();
+
+ virtual bool InformFirstDirection(int direction,
+ int size,
+ int availableOtherDir);
+
+protected:
+ // This method is called to decide if an item represents empty space or
+ // not. We do this to avoid having space-only items first or last on a
+ // wrapped line (left alignment).
+ //
+ // By default only spacers are considered to be empty items but a derived
+ // class may override this item if some other kind of sizer elements should
+ // be also considered empty for some reason.
+ virtual bool IsSpaceItem(wxSizerItem *item) const
+ {
+ return item->IsSpacer();
+ }
+
+ // helpers of CalcMin()
+ void CalcMinFromMinor(int totMinor);
+ void CalcMinFromMajor(int totMajor);
+ void CalcMinUsingCurrentLayout();
+ void CalcMinFittingSize(const wxSize& szBoundary);
+ void CalcMaxSingleItemSize();
+
+ // temporarily change the proportion of the last item of the N-th row to
+ // extend to the end of line if the appropriate flag is set
+ void AdjustLastRowItemProp(size_t n, wxSizerItem *itemLast);
+
+ // remove all the items from m_rows
+ void ClearRows();
+
+ // return the N-th row sizer from m_rows creating it if necessary
+ wxSizer *GetRowSizer(size_t n);
+
+ // should be called after completion of each row
+ void FinishRow(size_t n, int rowMajor, int rowMinor, wxSizerItem *itemLast);
+
+
+ const int m_flags; // Flags specified in the ctor
+
+ int m_dirInform; // Direction for size information
+ int m_availSize; // Size available in m_dirInform direction
+ int m_availableOtherDir; // Size available in the other direction
+ bool m_lastUsed; // Indicates whether value from InformFirst... has
+ // been used yet
+
+ // The sizes below are computed by RecalcSizes(), i.e. they don't have
+ // valid values during the initial call to CalcMin() and they are only
+ // valid for the current layout (i.e. the current number of rows)
+ int m_minSizeMinor; // Min size in minor direction
+ int m_maxSizeMajor; // Size of longest row
+ int m_minItemMajor; // Size of smallest item in major direction
+
+ wxBoxSizer m_rows; // Sizer containing multiple rows of our items
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxWrapSizer)
+};
+
+#endif // _WX_WRAPSIZER_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/wupdlock.h
+// Purpose: wxWindowUpdateLocker prevents window redrawing
+// Author: Vadim Zeitlin
+// Created: 2006-03-06
+// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WUPDLOCK_H_
+#define _WX_WUPDLOCK_H_
+
+#include "wx/window.h"
+
+// ----------------------------------------------------------------------------
+// wxWindowUpdateLocker prevents updates to the window during its lifetime
+// ----------------------------------------------------------------------------
+
+class wxWindowUpdateLocker
+{
+public:
+ // create an object preventing updates of the given window (which must have
+ // a lifetime at least as great as ours)
+ wxWindowUpdateLocker(wxWindow *win) : m_win(win) { win->Freeze(); }
+
+ // dtor thaws the window to permit updates again
+ ~wxWindowUpdateLocker() { m_win->Thaw(); }
+
+private:
+ wxWindow *m_win;
+
+ wxDECLARE_NO_COPY_CLASS(wxWindowUpdateLocker);
+};
+
+#endif // _WX_WUPDLOCK_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/wx.h
+// Purpose: wxWidgets central header including the most often used ones
+// Author: Julian Smart
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WX_H_
+#define _WX_WX_H_
+
+#include "wx/defs.h"
+#include "wx/object.h"
+#include "wx/dynarray.h"
+#include "wx/list.h"
+#include "wx/hash.h"
+#include "wx/string.h"
+#include "wx/hashmap.h"
+#include "wx/arrstr.h"
+#include "wx/intl.h"
+#include "wx/log.h"
+#include "wx/event.h"
+#include "wx/app.h"
+#include "wx/utils.h"
+#include "wx/stream.h"
+#include "wx/memory.h"
+#include "wx/math.h"
+#include "wx/stopwatch.h"
+#include "wx/timer.h"
+#include "wx/module.h"
+#include "wx/wxcrt.h"
+#include "wx/wxcrtvararg.h"
+
+#if wxUSE_GUI
+
+#include "wx/window.h"
+#include "wx/containr.h"
+#include "wx/panel.h"
+#include "wx/toplevel.h"
+#include "wx/frame.h"
+#include "wx/gdicmn.h"
+#include "wx/gdiobj.h"
+#include "wx/region.h"
+#include "wx/bitmap.h"
+#include "wx/image.h"
+#include "wx/colour.h"
+#include "wx/font.h"
+#include "wx/dc.h"
+#include "wx/dcclient.h"
+#include "wx/dcmemory.h"
+#include "wx/dcprint.h"
+#include "wx/dcscreen.h"
+#include "wx/button.h"
+#include "wx/menuitem.h"
+#include "wx/menu.h"
+#include "wx/pen.h"
+#include "wx/brush.h"
+#include "wx/palette.h"
+#include "wx/icon.h"
+#include "wx/cursor.h"
+#include "wx/dialog.h"
+#include "wx/settings.h"
+#include "wx/msgdlg.h"
+#include "wx/dataobj.h"
+
+#include "wx/control.h"
+#include "wx/ctrlsub.h"
+#include "wx/bmpbuttn.h"
+#include "wx/checkbox.h"
+#include "wx/checklst.h"
+#include "wx/choice.h"
+#include "wx/scrolbar.h"
+#include "wx/stattext.h"
+#include "wx/statbmp.h"
+#include "wx/statbox.h"
+#include "wx/listbox.h"
+#include "wx/radiobox.h"
+#include "wx/radiobut.h"
+#include "wx/textctrl.h"
+#include "wx/slider.h"
+#include "wx/gauge.h"
+#include "wx/scrolwin.h"
+#include "wx/dirdlg.h"
+#include "wx/toolbar.h"
+#include "wx/combobox.h"
+#include "wx/layout.h"
+#include "wx/sizer.h"
+#include "wx/statusbr.h"
+#include "wx/choicdlg.h"
+#include "wx/textdlg.h"
+#include "wx/filedlg.h"
+
+// this one is included by exactly one file (mdi.cpp) during wx build so even
+// although we keep it here for the library users, don't include it to avoid
+// bloating the PCH and (worse) rebuilding the entire library when it changes
+// when building the library itself
+#ifndef WXBUILDING
+ #include "wx/mdi.h"
+#endif
+
+// always include, even if !wxUSE_VALIDATORS because we need wxDefaultValidator
+#include "wx/validate.h"
+
+#if wxUSE_VALIDATORS
+ #include "wx/valtext.h"
+#endif // wxUSE_VALIDATORS
+
+#endif // wxUSE_GUI
+
+#endif // _WX_WX_H_
--- /dev/null
+//////////////////////////////////////////////////////////////////////////////
+// Name: wx/wxchar.h
+// Purpose: Declarations common to wx char/wchar_t usage (wide chars)
+// Author: Joel Farley, Ove KÃ¥ven
+// Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee
+// Created: 1998/06/12
+// Copyright: (c) 1998-2006 wxWidgets dev team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WXCHAR_H_
+#define _WX_WXCHAR_H_
+
+// This header used to define CRT functions wrappers in wxWidgets 2.8. This is
+// now done in (headers included by) wx/crt.h, so include it for compatibility:
+#include "wx/crt.h"
+
+#endif /* _WX_WXCHAR_H_ */
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/wxcrt.h
+// Purpose: Type-safe ANSI and Unicode builds compatible wrappers for
+// CRT functions
+// Author: Joel Farley, Ove Kaaven
+// Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee, Vaclav Slavik
+// Created: 1998/06/12
+// Copyright: (c) 1998-2006 wxWidgets dev team
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WXCRT_H_
+#define _WX_WXCRT_H_
+
+#include "wx/wxcrtbase.h"
+#include "wx/string.h"
+
+#ifndef __WX_SETUP_H__
+// For non-configure builds assume vsscanf is available, if not Visual C or DMC
+#if !defined (__VISUALC__) && !defined (__DMC__)
+ #define HAVE_VSSCANF 1
+#endif
+#endif
+
+// ============================================================================
+// misc functions
+// ============================================================================
+
+/* checks whether the passed in pointer is NULL and if the string is empty */
+inline bool wxIsEmpty(const char *s) { return !s || !*s; }
+inline bool wxIsEmpty(const wchar_t *s) { return !s || !*s; }
+inline bool wxIsEmpty(const wxScopedCharBuffer& s) { return wxIsEmpty(s.data()); }
+inline bool wxIsEmpty(const wxScopedWCharBuffer& s) { return wxIsEmpty(s.data()); }
+inline bool wxIsEmpty(const wxString& s) { return s.empty(); }
+inline bool wxIsEmpty(const wxCStrData& s) { return s.AsString().empty(); }
+
+
+
+/* multibyte to wide char conversion functions and macros */
+
+/* multibyte<->widechar conversion */
+WXDLLIMPEXP_BASE size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n);
+WXDLLIMPEXP_BASE size_t wxWC2MB(char *buf, const wchar_t *psz, size_t n);
+
+#if wxUSE_UNICODE
+ #define wxMB2WX wxMB2WC
+ #define wxWX2MB wxWC2MB
+ #define wxWC2WX wxStrncpy
+ #define wxWX2WC wxStrncpy
+#else
+ #define wxMB2WX wxStrncpy
+ #define wxWX2MB wxStrncpy
+ #define wxWC2WX wxWC2MB
+ #define wxWX2WC wxMB2WC
+#endif
+
+
+// RN: We could do the usual tricky compiler detection here,
+// and use their variant (such as wmemchr, etc.). The problem
+// is that these functions are quite rare, even though they are
+// part of the current POSIX standard. In addition, most compilers
+// (including even MSC) inline them just like we do right in their
+// headers.
+//
+#include <string.h>
+
+#if wxUSE_UNICODE
+ //implement our own wmem variants
+ inline wxChar* wxTmemchr(const wxChar* s, wxChar c, size_t l)
+ {
+ for(;l && *s != c;--l, ++s) {}
+
+ if(l)
+ return const_cast<wxChar*>(s);
+ return NULL;
+ }
+
+ inline int wxTmemcmp(const wxChar* sz1, const wxChar* sz2, size_t len)
+ {
+ for(; *sz1 == *sz2 && len; --len, ++sz1, ++sz2) {}
+
+ if(len)
+ return *sz1 < *sz2 ? -1 : *sz1 > *sz2;
+ else
+ return 0;
+ }
+
+ inline wxChar* wxTmemcpy(wxChar* szOut, const wxChar* szIn, size_t len)
+ {
+ return (wxChar*) memcpy(szOut, szIn, len * sizeof(wxChar));
+ }
+
+ inline wxChar* wxTmemmove(wxChar* szOut, const wxChar* szIn, size_t len)
+ {
+ return (wxChar*) memmove(szOut, szIn, len * sizeof(wxChar));
+ }
+
+ inline wxChar* wxTmemset(wxChar* szOut, const wxChar cIn, size_t len)
+ {
+ wxChar* szRet = szOut;
+
+ while (len--)
+ *szOut++ = cIn;
+
+ return szRet;
+ }
+#endif /* wxUSE_UNICODE */
+
+// provide trivial wrappers for char* versions for both ANSI and Unicode builds
+// (notice that these intentionally return "char *" and not "void *" unlike the
+// standard memxxx() for symmetry with the wide char versions):
+inline char* wxTmemchr(const char* s, char c, size_t len)
+ { return (char*)memchr(s, c, len); }
+inline int wxTmemcmp(const char* sz1, const char* sz2, size_t len)
+ { return memcmp(sz1, sz2, len); }
+inline char* wxTmemcpy(char* szOut, const char* szIn, size_t len)
+ { return (char*)memcpy(szOut, szIn, len); }
+inline char* wxTmemmove(char* szOut, const char* szIn, size_t len)
+ { return (char*)memmove(szOut, szIn, len); }
+inline char* wxTmemset(char* szOut, const char cIn, size_t len)
+ { return (char*)memset(szOut, cIn, len); }
+
+
+// ============================================================================
+// wx wrappers for CRT functions in both char* and wchar_t* versions
+// ============================================================================
+
+// A few notes on implementation of these wrappers:
+//
+// We need both char* and wchar_t* versions of functions like wxStrlen() for
+// compatibility with both ANSI and Unicode builds.
+//
+// This makes passing wxString or c_str()/mb_str()/wc_str() result to them
+// ambiguous, so we need to provide overrides for that as well (in cases where
+// it makes sense).
+//
+// We can do this without problems for some functions (wxStrlen()), but in some
+// cases, we can't stay compatible with both ANSI and Unicode builds, e.g. for
+// wxStrcpy(const wxString&), which can only return either char* or wchar_t*.
+// In these cases, we preserve ANSI build compatibility by returning char*.
+
+// ----------------------------------------------------------------------------
+// locale functions
+// ----------------------------------------------------------------------------
+
+// NB: we can't provide const wchar_t* (= wxChar*) overload, because calling
+// wxSetlocale(category, NULL) -- which is a common thing to do -- would be
+// ambiguous
+WXDLLIMPEXP_BASE char* wxSetlocale(int category, const char *locale);
+inline char* wxSetlocale(int category, const wxScopedCharBuffer& locale)
+ { return wxSetlocale(category, locale.data()); }
+inline char* wxSetlocale(int category, const wxString& locale)
+ { return wxSetlocale(category, locale.mb_str()); }
+inline char* wxSetlocale(int category, const wxCStrData& locale)
+ { return wxSetlocale(category, locale.AsCharBuf()); }
+
+// ----------------------------------------------------------------------------
+// string functions
+// ----------------------------------------------------------------------------
+
+/* safe version of strlen() (returns 0 if passed NULL pointer) */
+// NB: these are defined in wxcrtbase.h, see the comment there
+// inline size_t wxStrlen(const char *s) { return s ? strlen(s) : 0; }
+// inline size_t wxStrlen(const wchar_t *s) { return s ? wxCRT_Strlen_(s) : 0; }
+inline size_t wxStrlen(const wxScopedCharBuffer& s) { return wxStrlen(s.data()); }
+inline size_t wxStrlen(const wxScopedWCharBuffer& s) { return wxStrlen(s.data()); }
+inline size_t wxStrlen(const wxString& s) { return s.length(); }
+inline size_t wxStrlen(const wxCStrData& s) { return s.AsString().length(); }
+
+// this is a function new in 2.9 so we don't care about backwards compatibility and
+// so don't need to support wxScopedCharBuffer/wxScopedWCharBuffer overloads
+#if defined(wxCRT_StrnlenA)
+inline size_t wxStrnlen(const char *str, size_t maxlen) { return wxCRT_StrnlenA(str, maxlen); }
+#else
+inline size_t wxStrnlen(const char *str, size_t maxlen)
+{
+ size_t n;
+ for ( n = 0; n < maxlen; n++ )
+ if ( !str[n] )
+ break;
+
+ return n;
+}
+#endif
+
+#if defined(wxCRT_StrnlenW)
+inline size_t wxStrnlen(const wchar_t *str, size_t maxlen) { return wxCRT_StrnlenW(str, maxlen); }
+#else
+inline size_t wxStrnlen(const wchar_t *str, size_t maxlen)
+{
+ size_t n;
+ for ( n = 0; n < maxlen; n++ )
+ if ( !str[n] )
+ break;
+
+ return n;
+}
+#endif
+
+// NB: these are defined in wxcrtbase.h, see the comment there
+// inline char* wxStrdup(const char *s) { return wxStrdupA(s); }
+// inline wchar_t* wxStrdup(const wchar_t *s) { return wxStrdupW(s); }
+inline char* wxStrdup(const wxScopedCharBuffer& s) { return wxStrdup(s.data()); }
+inline wchar_t* wxStrdup(const wxScopedWCharBuffer& s) { return wxStrdup(s.data()); }
+inline char* wxStrdup(const wxString& s) { return wxStrdup(s.mb_str()); }
+inline char* wxStrdup(const wxCStrData& s) { return wxStrdup(s.AsCharBuf()); }
+
+inline char *wxStrcpy(char *dest, const char *src)
+ { return wxCRT_StrcpyA(dest, src); }
+inline wchar_t *wxStrcpy(wchar_t *dest, const wchar_t *src)
+ { return wxCRT_StrcpyW(dest, src); }
+inline char *wxStrcpy(char *dest, const wxString& src)
+ { return wxCRT_StrcpyA(dest, src.mb_str()); }
+inline char *wxStrcpy(char *dest, const wxCStrData& src)
+ { return wxCRT_StrcpyA(dest, src.AsCharBuf()); }
+inline char *wxStrcpy(char *dest, const wxScopedCharBuffer& src)
+ { return wxCRT_StrcpyA(dest, src.data()); }
+inline wchar_t *wxStrcpy(wchar_t *dest, const wxString& src)
+ { return wxCRT_StrcpyW(dest, src.wc_str()); }
+inline wchar_t *wxStrcpy(wchar_t *dest, const wxCStrData& src)
+ { return wxCRT_StrcpyW(dest, src.AsWCharBuf()); }
+inline wchar_t *wxStrcpy(wchar_t *dest, const wxScopedWCharBuffer& src)
+ { return wxCRT_StrcpyW(dest, src.data()); }
+inline char *wxStrcpy(char *dest, const wchar_t *src)
+ { return wxCRT_StrcpyA(dest, wxConvLibc.cWC2MB(src)); }
+inline wchar_t *wxStrcpy(wchar_t *dest, const char *src)
+ { return wxCRT_StrcpyW(dest, wxConvLibc.cMB2WC(src)); }
+
+inline char *wxStrncpy(char *dest, const char *src, size_t n)
+ { return wxCRT_StrncpyA(dest, src, n); }
+inline wchar_t *wxStrncpy(wchar_t *dest, const wchar_t *src, size_t n)
+ { return wxCRT_StrncpyW(dest, src, n); }
+inline char *wxStrncpy(char *dest, const wxString& src, size_t n)
+ { return wxCRT_StrncpyA(dest, src.mb_str(), n); }
+inline char *wxStrncpy(char *dest, const wxCStrData& src, size_t n)
+ { return wxCRT_StrncpyA(dest, src.AsCharBuf(), n); }
+inline char *wxStrncpy(char *dest, const wxScopedCharBuffer& src, size_t n)
+ { return wxCRT_StrncpyA(dest, src.data(), n); }
+inline wchar_t *wxStrncpy(wchar_t *dest, const wxString& src, size_t n)
+ { return wxCRT_StrncpyW(dest, src.wc_str(), n); }
+inline wchar_t *wxStrncpy(wchar_t *dest, const wxCStrData& src, size_t n)
+ { return wxCRT_StrncpyW(dest, src.AsWCharBuf(), n); }
+inline wchar_t *wxStrncpy(wchar_t *dest, const wxScopedWCharBuffer& src, size_t n)
+ { return wxCRT_StrncpyW(dest, src.data(), n); }
+inline char *wxStrncpy(char *dest, const wchar_t *src, size_t n)
+ { return wxCRT_StrncpyA(dest, wxConvLibc.cWC2MB(src), n); }
+inline wchar_t *wxStrncpy(wchar_t *dest, const char *src, size_t n)
+ { return wxCRT_StrncpyW(dest, wxConvLibc.cMB2WC(src), n); }
+
+// this is a function new in 2.9 so we don't care about backwards compatibility and
+// so don't need to support wchar_t/char overloads
+inline size_t wxStrlcpy(char *dest, const char *src, size_t n)
+{
+ const size_t len = wxCRT_StrlenA(src);
+
+ if ( n )
+ {
+ if ( n-- > len )
+ n = len;
+ wxCRT_StrncpyA(dest, src, n);
+ dest[n] = '\0';
+ }
+
+ return len;
+}
+inline size_t wxStrlcpy(wchar_t *dest, const wchar_t *src, size_t n)
+{
+ const size_t len = wxCRT_StrlenW(src);
+ if ( n )
+ {
+ if ( n-- > len )
+ n = len;
+ wxCRT_StrncpyW(dest, src, n);
+ dest[n] = L'\0';
+ }
+
+ return len;
+}
+
+inline char *wxStrcat(char *dest, const char *src)
+ { return wxCRT_StrcatA(dest, src); }
+inline wchar_t *wxStrcat(wchar_t *dest, const wchar_t *src)
+ { return wxCRT_StrcatW(dest, src); }
+inline char *wxStrcat(char *dest, const wxString& src)
+ { return wxCRT_StrcatA(dest, src.mb_str()); }
+inline char *wxStrcat(char *dest, const wxCStrData& src)
+ { return wxCRT_StrcatA(dest, src.AsCharBuf()); }
+inline char *wxStrcat(char *dest, const wxScopedCharBuffer& src)
+ { return wxCRT_StrcatA(dest, src.data()); }
+inline wchar_t *wxStrcat(wchar_t *dest, const wxString& src)
+ { return wxCRT_StrcatW(dest, src.wc_str()); }
+inline wchar_t *wxStrcat(wchar_t *dest, const wxCStrData& src)
+ { return wxCRT_StrcatW(dest, src.AsWCharBuf()); }
+inline wchar_t *wxStrcat(wchar_t *dest, const wxScopedWCharBuffer& src)
+ { return wxCRT_StrcatW(dest, src.data()); }
+inline char *wxStrcat(char *dest, const wchar_t *src)
+ { return wxCRT_StrcatA(dest, wxConvLibc.cWC2MB(src)); }
+inline wchar_t *wxStrcat(wchar_t *dest, const char *src)
+ { return wxCRT_StrcatW(dest, wxConvLibc.cMB2WC(src)); }
+
+inline char *wxStrncat(char *dest, const char *src, size_t n)
+ { return wxCRT_StrncatA(dest, src, n); }
+inline wchar_t *wxStrncat(wchar_t *dest, const wchar_t *src, size_t n)
+ { return wxCRT_StrncatW(dest, src, n); }
+inline char *wxStrncat(char *dest, const wxString& src, size_t n)
+ { return wxCRT_StrncatA(dest, src.mb_str(), n); }
+inline char *wxStrncat(char *dest, const wxCStrData& src, size_t n)
+ { return wxCRT_StrncatA(dest, src.AsCharBuf(), n); }
+inline char *wxStrncat(char *dest, const wxScopedCharBuffer& src, size_t n)
+ { return wxCRT_StrncatA(dest, src.data(), n); }
+inline wchar_t *wxStrncat(wchar_t *dest, const wxString& src, size_t n)
+ { return wxCRT_StrncatW(dest, src.wc_str(), n); }
+inline wchar_t *wxStrncat(wchar_t *dest, const wxCStrData& src, size_t n)
+ { return wxCRT_StrncatW(dest, src.AsWCharBuf(), n); }
+inline wchar_t *wxStrncat(wchar_t *dest, const wxScopedWCharBuffer& src, size_t n)
+ { return wxCRT_StrncatW(dest, src.data(), n); }
+inline char *wxStrncat(char *dest, const wchar_t *src, size_t n)
+ { return wxCRT_StrncatA(dest, wxConvLibc.cWC2MB(src), n); }
+inline wchar_t *wxStrncat(wchar_t *dest, const char *src, size_t n)
+ { return wxCRT_StrncatW(dest, wxConvLibc.cMB2WC(src), n); }
+
+
+#define WX_STR_DECL(name, T1, T2) name(T1 s1, T2 s2)
+#define WX_STR_CALL(func, a1, a2) func(a1, a2)
+
+// This macro defines string function for all possible variants of arguments,
+// except for those taking wxString or wxCStrData as second argument.
+// Parameters:
+// rettype - return type
+// name - name of the (overloaded) function to define
+// crtA - function to call for char* versions (takes two arguments)
+// crtW - ditto for wchar_t* function
+// forString - function to call when the *first* argument is wxString;
+// the second argument can be any string type, so this is
+// typically a template
+#define WX_STR_FUNC_NO_INVERT(rettype, name, crtA, crtW, forString) \
+ inline rettype WX_STR_DECL(name, const char *, const char *) \
+ { return WX_STR_CALL(crtA, s1, s2); } \
+ inline rettype WX_STR_DECL(name, const char *, const wchar_t *) \
+ { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \
+ inline rettype WX_STR_DECL(name, const char *, const wxScopedCharBuffer&) \
+ { return WX_STR_CALL(crtA, s1, s2.data()); } \
+ inline rettype WX_STR_DECL(name, const char *, const wxScopedWCharBuffer&) \
+ { return WX_STR_CALL(forString, wxString(s1), s2.data()); } \
+ \
+ inline rettype WX_STR_DECL(name, const wchar_t *, const wchar_t *) \
+ { return WX_STR_CALL(crtW, s1, s2); } \
+ inline rettype WX_STR_DECL(name, const wchar_t *, const char *) \
+ { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \
+ inline rettype WX_STR_DECL(name, const wchar_t *, const wxScopedWCharBuffer&) \
+ { return WX_STR_CALL(crtW, s1, s2.data()); } \
+ inline rettype WX_STR_DECL(name, const wchar_t *, const wxScopedCharBuffer&) \
+ { return WX_STR_CALL(forString, wxString(s1), s2.data()); } \
+ \
+ inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const char *) \
+ { return WX_STR_CALL(crtA, s1.data(), s2); } \
+ inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wchar_t *) \
+ { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \
+ inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxScopedCharBuffer&)\
+ { return WX_STR_CALL(crtA, s1.data(), s2.data()); } \
+ inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxScopedWCharBuffer&) \
+ { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \
+ \
+ inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wchar_t *) \
+ { return WX_STR_CALL(crtW, s1.data(), s2); } \
+ inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const char *) \
+ { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \
+ inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxScopedWCharBuffer&) \
+ { return WX_STR_CALL(crtW, s1.data(), s2.data()); } \
+ inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxScopedCharBuffer&) \
+ { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \
+ \
+ inline rettype WX_STR_DECL(name, const wxString&, const char*) \
+ { return WX_STR_CALL(forString, s1, s2); } \
+ inline rettype WX_STR_DECL(name, const wxString&, const wchar_t*) \
+ { return WX_STR_CALL(forString, s1, s2); } \
+ inline rettype WX_STR_DECL(name, const wxString&, const wxScopedCharBuffer&) \
+ { return WX_STR_CALL(forString, s1, s2); } \
+ inline rettype WX_STR_DECL(name, const wxString&, const wxScopedWCharBuffer&) \
+ { return WX_STR_CALL(forString, s1, s2); } \
+ inline rettype WX_STR_DECL(name, const wxString&, const wxString&) \
+ { return WX_STR_CALL(forString, s1, s2); } \
+ inline rettype WX_STR_DECL(name, const wxString&, const wxCStrData&) \
+ { return WX_STR_CALL(forString, s1, s2); } \
+ \
+ inline rettype WX_STR_DECL(name, const wxCStrData&, const char*) \
+ { return WX_STR_CALL(forString, s1.AsString(), s2); } \
+ inline rettype WX_STR_DECL(name, const wxCStrData&, const wchar_t*) \
+ { return WX_STR_CALL(forString, s1.AsString(), s2); } \
+ inline rettype WX_STR_DECL(name, const wxCStrData&, const wxScopedCharBuffer&) \
+ { return WX_STR_CALL(forString, s1.AsString(), s2); } \
+ inline rettype WX_STR_DECL(name, const wxCStrData&, const wxScopedWCharBuffer&) \
+ { return WX_STR_CALL(forString, s1.AsString(), s2); } \
+ inline rettype WX_STR_DECL(name, const wxCStrData&, const wxString&) \
+ { return WX_STR_CALL(forString, s1.AsString(), s2); } \
+ inline rettype WX_STR_DECL(name, const wxCStrData&, const wxCStrData&) \
+ { return WX_STR_CALL(forString, s1.AsString(), s2); }
+
+// This defines strcmp-like function, i.e. one returning the result of
+// comparison; see WX_STR_FUNC_NO_INVERT for explanation of the arguments
+#define WX_STRCMP_FUNC(name, crtA, crtW, forString) \
+ WX_STR_FUNC_NO_INVERT(int, name, crtA, crtW, forString) \
+ \
+ inline int WX_STR_DECL(name, const char *, const wxCStrData&) \
+ { return -WX_STR_CALL(forString, s2.AsString(), s1); } \
+ inline int WX_STR_DECL(name, const char *, const wxString&) \
+ { return -WX_STR_CALL(forString, s2, s1); } \
+ \
+ inline int WX_STR_DECL(name, const wchar_t *, const wxCStrData&) \
+ { return -WX_STR_CALL(forString, s2.AsString(), s1); } \
+ inline int WX_STR_DECL(name, const wchar_t *, const wxString&) \
+ { return -WX_STR_CALL(forString, s2, s1); } \
+ \
+ inline int WX_STR_DECL(name, const wxScopedCharBuffer&, const wxCStrData&) \
+ { return -WX_STR_CALL(forString, s2.AsString(), s1.data()); } \
+ inline int WX_STR_DECL(name, const wxScopedCharBuffer&, const wxString&) \
+ { return -WX_STR_CALL(forString, s2, s1.data()); } \
+ \
+ inline int WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxCStrData&) \
+ { return -WX_STR_CALL(forString, s2.AsString(), s1.data()); } \
+ inline int WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxString&) \
+ { return -WX_STR_CALL(forString, s2, s1.data()); }
+
+
+// This defines a string function that is *not* strcmp-like, i.e. doesn't
+// return the result of comparison and so if the second argument is a string,
+// it has to be converted to char* or wchar_t*
+#define WX_STR_FUNC(rettype, name, crtA, crtW, forString) \
+ WX_STR_FUNC_NO_INVERT(rettype, name, crtA, crtW, forString) \
+ \
+ inline rettype WX_STR_DECL(name, const char *, const wxCStrData&) \
+ { return WX_STR_CALL(crtA, s1, s2.AsCharBuf()); } \
+ inline rettype WX_STR_DECL(name, const char *, const wxString&) \
+ { return WX_STR_CALL(crtA, s1, s2.mb_str()); } \
+ \
+ inline rettype WX_STR_DECL(name, const wchar_t *, const wxCStrData&) \
+ { return WX_STR_CALL(crtW, s1, s2.AsWCharBuf()); } \
+ inline rettype WX_STR_DECL(name, const wchar_t *, const wxString&) \
+ { return WX_STR_CALL(crtW, s1, s2.wc_str()); } \
+ \
+ inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxCStrData&) \
+ { return WX_STR_CALL(crtA, s1.data(), s2.AsCharBuf()); } \
+ inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxString&) \
+ { return WX_STR_CALL(crtA, s1.data(), s2.mb_str()); } \
+ \
+ inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxCStrData&) \
+ { return WX_STR_CALL(crtW, s1.data(), s2.AsWCharBuf()); } \
+ inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxString&) \
+ { return WX_STR_CALL(crtW, s1.data(), s2.wc_str()); }
+
+template<typename T>
+inline int wxStrcmp_String(const wxString& s1, const T& s2)
+ { return s1.compare(s2); }
+WX_STRCMP_FUNC(wxStrcmp, wxCRT_StrcmpA, wxCRT_StrcmpW, wxStrcmp_String)
+
+template<typename T>
+inline int wxStricmp_String(const wxString& s1, const T& s2)
+ { return s1.CmpNoCase(s2); }
+WX_STRCMP_FUNC(wxStricmp, wxCRT_StricmpA, wxCRT_StricmpW, wxStricmp_String)
+
+#if defined(wxCRT_StrcollA) && defined(wxCRT_StrcollW)
+
+// GCC 3.4 and other compilers have a bug that causes it to fail compilation if
+// the template's implementation uses overloaded function declared later (see
+// the wxStrcoll() call in wxStrcoll_String<T>()), so we have to
+// forward-declare the template and implement it below WX_STRCMP_FUNC. OTOH,
+// this fails to compile with VC6, so don't do it for VC. It also causes
+// problems with GCC visibility in newer GCC versions.
+#if !(defined(__VISUALC__) || (wxCHECK_GCC_VERSION(3,5) && !wxCHECK_GCC_VERSION(4,7))) || defined(__clang__)
+ #define wxNEEDS_DECL_BEFORE_TEMPLATE
+#endif
+
+#ifdef wxNEEDS_DECL_BEFORE_TEMPLATE
+template<typename T>
+inline int wxStrcoll_String(const wxString& s1, const T& s2);
+WX_STRCMP_FUNC(wxStrcoll, wxCRT_StrcollA, wxCRT_StrcollW, wxStrcoll_String)
+#endif // wxNEEDS_DECL_BEFORE_TEMPLATE
+
+template<typename T>
+inline int wxStrcoll_String(const wxString& s1, const T& s2)
+{
+#if wxUSE_UNICODE
+ // NB: strcoll() doesn't work correctly on UTF-8 strings, so we have to use
+ // wc_str() even if wxUSE_UNICODE_UTF8; the (const wchar_t*) cast is
+ // there just as optimization to avoid going through
+ // wxStrcoll<wxScopedWCharBuffer>:
+ return wxStrcoll((const wchar_t*)s1.wc_str(), s2);
+#else
+ return wxStrcoll((const char*)s1.mb_str(), s2);
+#endif
+}
+
+#ifndef wxNEEDS_DECL_BEFORE_TEMPLATE
+// this is exactly the same WX_STRCMP_FUNC line as above, insde the
+// wxNEEDS_DECL_BEFORE_TEMPLATE case
+WX_STRCMP_FUNC(wxStrcoll, wxCRT_StrcollA, wxCRT_StrcollW, wxStrcoll_String)
+#endif
+
+#endif // defined(wxCRT_Strcoll[AW])
+
+template<typename T>
+inline size_t wxStrspn_String(const wxString& s1, const T& s2)
+{
+ size_t pos = s1.find_first_not_of(s2);
+ return pos == wxString::npos ? s1.length() : pos;
+}
+WX_STR_FUNC(size_t, wxStrspn, wxCRT_StrspnA, wxCRT_StrspnW, wxStrspn_String)
+
+template<typename T>
+inline size_t wxStrcspn_String(const wxString& s1, const T& s2)
+{
+ size_t pos = s1.find_first_of(s2);
+ return pos == wxString::npos ? s1.length() : pos;
+}
+WX_STR_FUNC(size_t, wxStrcspn, wxCRT_StrcspnA, wxCRT_StrcspnW, wxStrcspn_String)
+
+#undef WX_STR_DECL
+#undef WX_STR_CALL
+#define WX_STR_DECL(name, T1, T2) name(T1 s1, T2 s2, size_t n)
+#define WX_STR_CALL(func, a1, a2) func(a1, a2, n)
+
+template<typename T>
+inline int wxStrncmp_String(const wxString& s1, const T& s2, size_t n)
+ { return s1.compare(0, n, s2, 0, n); }
+WX_STRCMP_FUNC(wxStrncmp, wxCRT_StrncmpA, wxCRT_StrncmpW, wxStrncmp_String)
+
+template<typename T>
+inline int wxStrnicmp_String(const wxString& s1, const T& s2, size_t n)
+ { return s1.substr(0, n).CmpNoCase(wxString(s2).substr(0, n)); }
+WX_STRCMP_FUNC(wxStrnicmp, wxCRT_StrnicmpA, wxCRT_StrnicmpW, wxStrnicmp_String)
+
+#undef WX_STR_DECL
+#undef WX_STR_CALL
+#undef WX_STRCMP_FUNC
+#undef WX_STR_FUNC
+#undef WX_STR_FUNC_NO_INVERT
+
+#if defined(wxCRT_StrxfrmA) && defined(wxCRT_StrxfrmW)
+
+inline size_t wxStrxfrm(char *dest, const char *src, size_t n)
+ { return wxCRT_StrxfrmA(dest, src, n); }
+inline size_t wxStrxfrm(wchar_t *dest, const wchar_t *src, size_t n)
+ { return wxCRT_StrxfrmW(dest, src, n); }
+template<typename T>
+inline size_t wxStrxfrm(T *dest, const wxScopedCharTypeBuffer<T>& src, size_t n)
+ { return wxStrxfrm(dest, src.data(), n); }
+inline size_t wxStrxfrm(char *dest, const wxString& src, size_t n)
+ { return wxCRT_StrxfrmA(dest, src.mb_str(), n); }
+inline size_t wxStrxfrm(wchar_t *dest, const wxString& src, size_t n)
+ { return wxCRT_StrxfrmW(dest, src.wc_str(), n); }
+inline size_t wxStrxfrm(char *dest, const wxCStrData& src, size_t n)
+ { return wxCRT_StrxfrmA(dest, src.AsCharBuf(), n); }
+inline size_t wxStrxfrm(wchar_t *dest, const wxCStrData& src, size_t n)
+ { return wxCRT_StrxfrmW(dest, src.AsWCharBuf(), n); }
+
+#endif // defined(wxCRT_Strxfrm[AW])
+
+inline char *wxStrtok(char *str, const char *delim, char **saveptr)
+ { return wxCRT_StrtokA(str, delim, saveptr); }
+inline wchar_t *wxStrtok(wchar_t *str, const wchar_t *delim, wchar_t **saveptr)
+ { return wxCRT_StrtokW(str, delim, saveptr); }
+template<typename T>
+inline T *wxStrtok(T *str, const wxScopedCharTypeBuffer<T>& delim, T **saveptr)
+ { return wxStrtok(str, delim.data(), saveptr); }
+inline char *wxStrtok(char *str, const wxCStrData& delim, char **saveptr)
+ { return wxCRT_StrtokA(str, delim.AsCharBuf(), saveptr); }
+inline wchar_t *wxStrtok(wchar_t *str, const wxCStrData& delim, wchar_t **saveptr)
+ { return wxCRT_StrtokW(str, delim.AsWCharBuf(), saveptr); }
+inline char *wxStrtok(char *str, const wxString& delim, char **saveptr)
+ { return wxCRT_StrtokA(str, delim.mb_str(), saveptr); }
+inline wchar_t *wxStrtok(wchar_t *str, const wxString& delim, wchar_t **saveptr)
+ { return wxCRT_StrtokW(str, delim.wc_str(), saveptr); }
+
+inline const char *wxStrstr(const char *haystack, const char *needle)
+ { return wxCRT_StrstrA(haystack, needle); }
+inline const wchar_t *wxStrstr(const wchar_t *haystack, const wchar_t *needle)
+ { return wxCRT_StrstrW(haystack, needle); }
+inline const char *wxStrstr(const char *haystack, const wxString& needle)
+ { return wxCRT_StrstrA(haystack, needle.mb_str()); }
+inline const wchar_t *wxStrstr(const wchar_t *haystack, const wxString& needle)
+ { return wxCRT_StrstrW(haystack, needle.wc_str()); }
+// these functions return char* pointer into the non-temporary conversion buffer
+// used by c_str()'s implicit conversion to char*, for ANSI build compatibility
+inline const char *wxStrstr(const wxString& haystack, const wxString& needle)
+ { return wxCRT_StrstrA(haystack.c_str(), needle.mb_str()); }
+inline const char *wxStrstr(const wxCStrData& haystack, const wxString& needle)
+ { return wxCRT_StrstrA(haystack, needle.mb_str()); }
+inline const char *wxStrstr(const wxCStrData& haystack, const wxCStrData& needle)
+ { return wxCRT_StrstrA(haystack, needle.AsCharBuf()); }
+// if 'needle' is char/wchar_t, then the same is probably wanted as return value
+inline const char *wxStrstr(const wxString& haystack, const char *needle)
+ { return wxCRT_StrstrA(haystack.c_str(), needle); }
+inline const char *wxStrstr(const wxCStrData& haystack, const char *needle)
+ { return wxCRT_StrstrA(haystack, needle); }
+inline const wchar_t *wxStrstr(const wxString& haystack, const wchar_t *needle)
+ { return wxCRT_StrstrW(haystack.c_str(), needle); }
+inline const wchar_t *wxStrstr(const wxCStrData& haystack, const wchar_t *needle)
+ { return wxCRT_StrstrW(haystack, needle); }
+
+inline const char *wxStrchr(const char *s, char c)
+ { return wxCRT_StrchrA(s, c); }
+inline const wchar_t *wxStrchr(const wchar_t *s, wchar_t c)
+ { return wxCRT_StrchrW(s, c); }
+inline const char *wxStrrchr(const char *s, char c)
+ { return wxCRT_StrrchrA(s, c); }
+inline const wchar_t *wxStrrchr(const wchar_t *s, wchar_t c)
+ { return wxCRT_StrrchrW(s, c); }
+inline const char *wxStrchr(const char *s, const wxUniChar& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; }
+inline const wchar_t *wxStrchr(const wchar_t *s, const wxUniChar& c)
+ { return wxCRT_StrchrW(s, (wchar_t)c); }
+inline const char *wxStrrchr(const char *s, const wxUniChar& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; }
+inline const wchar_t *wxStrrchr(const wchar_t *s, const wxUniChar& c)
+ { return wxCRT_StrrchrW(s, (wchar_t)c); }
+inline const char *wxStrchr(const char *s, const wxUniCharRef& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; }
+inline const wchar_t *wxStrchr(const wchar_t *s, const wxUniCharRef& c)
+ { return wxCRT_StrchrW(s, (wchar_t)c); }
+inline const char *wxStrrchr(const char *s, const wxUniCharRef& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; }
+inline const wchar_t *wxStrrchr(const wchar_t *s, const wxUniCharRef& c)
+ { return wxCRT_StrrchrW(s, (wchar_t)c); }
+template<typename T>
+inline const T* wxStrchr(const wxScopedCharTypeBuffer<T>& s, T c)
+ { return wxStrchr(s.data(), c); }
+template<typename T>
+inline const T* wxStrrchr(const wxScopedCharTypeBuffer<T>& s, T c)
+ { return wxStrrchr(s.data(), c); }
+template<typename T>
+inline const T* wxStrchr(const wxScopedCharTypeBuffer<T>& s, const wxUniChar& c)
+ { return wxStrchr(s.data(), (T)c); }
+template<typename T>
+inline const T* wxStrrchr(const wxScopedCharTypeBuffer<T>& s, const wxUniChar& c)
+ { return wxStrrchr(s.data(), (T)c); }
+template<typename T>
+inline const T* wxStrchr(const wxScopedCharTypeBuffer<T>& s, const wxUniCharRef& c)
+ { return wxStrchr(s.data(), (T)c); }
+template<typename T>
+inline const T* wxStrrchr(const wxScopedCharTypeBuffer<T>& s, const wxUniCharRef& c)
+ { return wxStrrchr(s.data(), (T)c); }
+// these functions return char* pointer into the non-temporary conversion buffer
+// used by c_str()'s implicit conversion to char*, for ANSI build compatibility
+inline const char* wxStrchr(const wxString& s, char c)
+ { return wxCRT_StrchrA((const char*)s.c_str(), c); }
+inline const char* wxStrrchr(const wxString& s, char c)
+ { return wxCRT_StrrchrA((const char*)s.c_str(), c); }
+inline const char* wxStrchr(const wxString& s, int c)
+ { return wxCRT_StrchrA((const char*)s.c_str(), c); }
+inline const char* wxStrrchr(const wxString& s, int c)
+ { return wxCRT_StrrchrA((const char*)s.c_str(), c); }
+inline const char* wxStrchr(const wxString& s, const wxUniChar& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s.c_str(), c) : NULL; }
+inline const char* wxStrrchr(const wxString& s, const wxUniChar& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s.c_str(), c) : NULL; }
+inline const char* wxStrchr(const wxString& s, const wxUniCharRef& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s.c_str(), c) : NULL; }
+inline const char* wxStrrchr(const wxString& s, const wxUniCharRef& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s.c_str(), c) : NULL; }
+inline const wchar_t* wxStrchr(const wxString& s, wchar_t c)
+ { return wxCRT_StrchrW((const wchar_t*)s.c_str(), c); }
+inline const wchar_t* wxStrrchr(const wxString& s, wchar_t c)
+ { return wxCRT_StrrchrW((const wchar_t*)s.c_str(), c); }
+inline const char* wxStrchr(const wxCStrData& s, char c)
+ { return wxCRT_StrchrA(s.AsChar(), c); }
+inline const char* wxStrrchr(const wxCStrData& s, char c)
+ { return wxCRT_StrrchrA(s.AsChar(), c); }
+inline const char* wxStrchr(const wxCStrData& s, int c)
+ { return wxCRT_StrchrA(s.AsChar(), c); }
+inline const char* wxStrrchr(const wxCStrData& s, int c)
+ { return wxCRT_StrrchrA(s.AsChar(), c); }
+inline const char* wxStrchr(const wxCStrData& s, const wxUniChar& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; }
+inline const char* wxStrrchr(const wxCStrData& s, const wxUniChar& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; }
+inline const char* wxStrchr(const wxCStrData& s, const wxUniCharRef& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; }
+inline const char* wxStrrchr(const wxCStrData& s, const wxUniCharRef& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; }
+inline const wchar_t* wxStrchr(const wxCStrData& s, wchar_t c)
+ { return wxCRT_StrchrW(s.AsWChar(), c); }
+inline const wchar_t* wxStrrchr(const wxCStrData& s, wchar_t c)
+ { return wxCRT_StrrchrW(s.AsWChar(), c); }
+
+inline const char *wxStrpbrk(const char *s, const char *accept)
+ { return wxCRT_StrpbrkA(s, accept); }
+inline const wchar_t *wxStrpbrk(const wchar_t *s, const wchar_t *accept)
+ { return wxCRT_StrpbrkW(s, accept); }
+inline const char *wxStrpbrk(const char *s, const wxString& accept)
+ { return wxCRT_StrpbrkA(s, accept.mb_str()); }
+inline const char *wxStrpbrk(const char *s, const wxCStrData& accept)
+ { return wxCRT_StrpbrkA(s, accept.AsCharBuf()); }
+inline const wchar_t *wxStrpbrk(const wchar_t *s, const wxString& accept)
+ { return wxCRT_StrpbrkW(s, accept.wc_str()); }
+inline const wchar_t *wxStrpbrk(const wchar_t *s, const wxCStrData& accept)
+ { return wxCRT_StrpbrkW(s, accept.AsWCharBuf()); }
+inline const char *wxStrpbrk(const wxString& s, const wxString& accept)
+ { return wxCRT_StrpbrkA(s.c_str(), accept.mb_str()); }
+inline const char *wxStrpbrk(const wxString& s, const char *accept)
+ { return wxCRT_StrpbrkA(s.c_str(), accept); }
+inline const wchar_t *wxStrpbrk(const wxString& s, const wchar_t *accept)
+ { return wxCRT_StrpbrkW(s.wc_str(), accept); }
+inline const char *wxStrpbrk(const wxString& s, const wxCStrData& accept)
+ { return wxCRT_StrpbrkA(s.c_str(), accept.AsCharBuf()); }
+inline const char *wxStrpbrk(const wxCStrData& s, const wxString& accept)
+ { return wxCRT_StrpbrkA(s.AsChar(), accept.mb_str()); }
+inline const char *wxStrpbrk(const wxCStrData& s, const char *accept)
+ { return wxCRT_StrpbrkA(s.AsChar(), accept); }
+inline const wchar_t *wxStrpbrk(const wxCStrData& s, const wchar_t *accept)
+ { return wxCRT_StrpbrkW(s.AsWChar(), accept); }
+inline const char *wxStrpbrk(const wxCStrData& s, const wxCStrData& accept)
+ { return wxCRT_StrpbrkA(s.AsChar(), accept.AsCharBuf()); }
+template <typename S, typename T>
+inline const T *wxStrpbrk(const S& s, const wxScopedCharTypeBuffer<T>& accept)
+ { return wxStrpbrk(s, accept.data()); }
+
+
+/* inlined non-const versions */
+template <typename T>
+inline char *wxStrstr(char *haystack, T needle)
+ { return const_cast<char*>(wxStrstr(const_cast<const char*>(haystack), needle)); }
+template <typename T>
+inline wchar_t *wxStrstr(wchar_t *haystack, T needle)
+ { return const_cast<wchar_t*>(wxStrstr(const_cast<const wchar_t*>(haystack), needle)); }
+
+template <typename T>
+inline char * wxStrchr(char *s, T c)
+ { return const_cast<char*>(wxStrchr(const_cast<const char*>(s), c)); }
+template <typename T>
+inline wchar_t * wxStrchr(wchar_t *s, T c)
+ { return (wchar_t *)wxStrchr((const wchar_t *)s, c); }
+template <typename T>
+inline char * wxStrrchr(char *s, T c)
+ { return const_cast<char*>(wxStrrchr(const_cast<const char*>(s), c)); }
+template <typename T>
+inline wchar_t * wxStrrchr(wchar_t *s, T c)
+ { return const_cast<wchar_t*>(wxStrrchr(const_cast<const wchar_t*>(s), c)); }
+
+template <typename T>
+inline char * wxStrpbrk(char *s, T accept)
+ { return const_cast<char*>(wxStrpbrk(const_cast<const char*>(s), accept)); }
+template <typename T>
+inline wchar_t * wxStrpbrk(wchar_t *s, T accept)
+ { return const_cast<wchar_t*>(wxStrpbrk(const_cast<const wchar_t*>(s), accept)); }
+
+
+// ----------------------------------------------------------------------------
+// stdio.h functions
+// ----------------------------------------------------------------------------
+
+// NB: using fn_str() for mode is a hack to get the same type (char*/wchar_t*)
+// as needed, the conversion itself doesn't matter, it's ASCII
+inline FILE *wxFopen(const wxString& path, const wxString& mode)
+ { return wxCRT_Fopen(path.fn_str(), mode.fn_str()); }
+inline FILE *wxFreopen(const wxString& path, const wxString& mode, FILE *stream)
+ { return wxCRT_Freopen(path.fn_str(), mode.fn_str(), stream); }
+inline int wxRemove(const wxString& path)
+ { return wxCRT_Remove(path.fn_str()); }
+inline int wxRename(const wxString& oldpath, const wxString& newpath)
+ { return wxCRT_Rename(oldpath.fn_str(), newpath.fn_str()); }
+
+extern WXDLLIMPEXP_BASE int wxPuts(const wxString& s);
+extern WXDLLIMPEXP_BASE int wxFputs(const wxString& s, FILE *stream);
+extern WXDLLIMPEXP_BASE void wxPerror(const wxString& s);
+
+extern WXDLLIMPEXP_BASE int wxFputc(const wxUniChar& c, FILE *stream);
+
+#define wxPutc(c, stream) wxFputc(c, stream)
+#define wxPutchar(c) wxFputc(c, stdout)
+#define wxFputchar(c) wxPutchar(c)
+
+// NB: We only provide ANSI version of fgets() because fgetws() interprets the
+// stream according to current locale, which is rarely what is desired.
+inline char *wxFgets(char *s, int size, FILE *stream)
+ { return wxCRT_FgetsA(s, size, stream); }
+// This version calls ANSI version and converts the string using wxConvLibc
+extern WXDLLIMPEXP_BASE wchar_t *wxFgets(wchar_t *s, int size, FILE *stream);
+
+#define wxGets(s) wxGets_is_insecure_and_dangerous_use_wxFgets_instead
+
+// NB: We only provide ANSI versions of this for the same reasons as in the
+// case of wxFgets() above
+inline int wxFgetc(FILE *stream) { return wxCRT_FgetcA(stream); }
+inline int wxUngetc(int c, FILE *stream) { return wxCRT_UngetcA(c, stream); }
+
+#define wxGetc(stream) wxFgetc(stream)
+#define wxGetchar() wxFgetc(stdin)
+#define wxFgetchar() wxGetchar()
+
+// ----------------------------------------------------------------------------
+// stdlib.h functions
+// ----------------------------------------------------------------------------
+
+#ifdef wxCRT_AtoiW
+inline int wxAtoi(const wxString& str) { return wxCRT_AtoiW(str.wc_str()); }
+#else
+inline int wxAtoi(const wxString& str) { return wxCRT_AtoiA(str.mb_str()); }
+#endif
+
+#ifdef wxCRT_AtolW
+inline long wxAtol(const wxString& str) { return wxCRT_AtolW(str.wc_str()); }
+#else
+inline long wxAtol(const wxString& str) { return wxCRT_AtolA(str.mb_str()); }
+#endif
+
+#ifdef wxCRT_AtofW
+inline double wxAtof(const wxString& str) { return wxCRT_AtofW(str.wc_str()); }
+#else
+inline double wxAtof(const wxString& str) { return wxCRT_AtofA(str.mb_str()); }
+#endif
+
+inline double wxStrtod(const char *nptr, char **endptr)
+ { return wxCRT_StrtodA(nptr, endptr); }
+inline double wxStrtod(const wchar_t *nptr, wchar_t **endptr)
+ { return wxCRT_StrtodW(nptr, endptr); }
+template<typename T>
+inline double wxStrtod(const wxScopedCharTypeBuffer<T>& nptr, T **endptr)
+ { return wxStrtod(nptr.data(), endptr); }
+
+// We implement wxStrto*() like this so that the code compiles when NULL is
+// passed in - - if we had just char** and wchar_t** overloads for 'endptr', it
+// would be ambiguous. The solution is to use a template so that endptr can be
+// any type: when NULL constant is used, the type will be int and we can handle
+// that case specially. Otherwise, we infer the type that 'nptr' should be
+// converted to from the type of 'endptr'. We need wxStrtoxCharType<T> template
+// to make the code compile even for T=int (that's the case when it's not going
+// to be ever used, but it still has to compile).
+template<typename T> struct wxStrtoxCharType {};
+template<> struct wxStrtoxCharType<char**>
+{
+ typedef const char* Type;
+ static char** AsPointer(char **p) { return p; }
+};
+template<> struct wxStrtoxCharType<wchar_t**>
+{
+ typedef const wchar_t* Type;
+ static wchar_t** AsPointer(wchar_t **p) { return p; }
+};
+template<> struct wxStrtoxCharType<int>
+{
+ typedef const char* Type; /* this one is never used */
+ static char** AsPointer(int WXUNUSED_UNLESS_DEBUG(p))
+ {
+ wxASSERT_MSG( p == 0, "passing non-NULL int is invalid" );
+ return NULL;
+ }
+};
+
+template<typename T>
+inline double wxStrtod(const wxString& nptr, T endptr)
+{
+ if ( endptr == 0 )
+ {
+ // when we don't care about endptr, use the string representation that
+ // doesn't require any conversion (it doesn't matter for this function
+ // even if its UTF-8):
+ return wxStrtod(nptr.wx_str(), (wxStringCharType**)NULL);
+ }
+ else
+ {
+ // note that it is important to use c_str() here and not mb_str() or
+ // wc_str(), because we store the pointer into (possibly converted)
+ // buffer in endptr and so it must be valid even when wxStrtod() returns
+ typedef typename wxStrtoxCharType<T>::Type CharType;
+ return wxStrtod((CharType)nptr.c_str(),
+ wxStrtoxCharType<T>::AsPointer(endptr));
+ }
+}
+template<typename T>
+inline double wxStrtod(const wxCStrData& nptr, T endptr)
+ { return wxStrtod(nptr.AsString(), endptr); }
+
+
+#define WX_STRTOX_FUNC(rettype, name, implA, implW) \
+ /* see wxStrtod() above for explanation of this code: */ \
+ inline rettype name(const char *nptr, char **endptr, int base) \
+ { return implA(nptr, endptr, base); } \
+ inline rettype name(const wchar_t *nptr, wchar_t **endptr, int base) \
+ { return implW(nptr, endptr, base); } \
+ template<typename T> \
+ inline rettype name(const wxScopedCharTypeBuffer<T>& nptr, T **endptr, int)\
+ { return name(nptr.data(), endptr); } \
+ template<typename T> \
+ inline rettype name(const wxString& nptr, T endptr, int base) \
+ { \
+ if ( endptr == 0 ) \
+ return name(nptr.wx_str(), (wxStringCharType**)NULL, base); \
+ else \
+ { \
+ typedef typename wxStrtoxCharType<T>::Type CharType; \
+ return name((CharType)nptr.c_str(), \
+ wxStrtoxCharType<T>::AsPointer(endptr), \
+ base); \
+ } \
+ } \
+ template<typename T> \
+ inline rettype name(const wxCStrData& nptr, T endptr, int base) \
+ { return name(nptr.AsString(), endptr, base); }
+
+WX_STRTOX_FUNC(long, wxStrtol, wxCRT_StrtolA, wxCRT_StrtolW)
+WX_STRTOX_FUNC(unsigned long, wxStrtoul, wxCRT_StrtoulA, wxCRT_StrtoulW)
+#ifdef wxLongLong_t
+WX_STRTOX_FUNC(wxLongLong_t, wxStrtoll, wxCRT_StrtollA, wxCRT_StrtollW)
+WX_STRTOX_FUNC(wxULongLong_t, wxStrtoull, wxCRT_StrtoullA, wxCRT_StrtoullW)
+#endif // wxLongLong_t
+
+#undef WX_STRTOX_FUNC
+
+
+// there is no command interpreter under CE, hence no system()
+#ifndef __WXWINCE__
+
+// mingw32 doesn't provide _tsystem() even though it provides other stdlib.h
+// functions in their wide versions
+#ifdef wxCRT_SystemW
+inline int wxSystem(const wxString& str) { return wxCRT_SystemW(str.wc_str()); }
+#else
+inline int wxSystem(const wxString& str) { return wxCRT_SystemA(str.mb_str()); }
+#endif
+
+#endif // !__WXWINCE__/__WXWINCE__
+
+inline char* wxGetenv(const char *name) { return wxCRT_GetenvA(name); }
+inline wchar_t* wxGetenv(const wchar_t *name) { return wxCRT_GetenvW(name); }
+inline char* wxGetenv(const wxString& name) { return wxCRT_GetenvA(name.mb_str()); }
+inline char* wxGetenv(const wxCStrData& name) { return wxCRT_GetenvA(name.AsCharBuf()); }
+inline char* wxGetenv(const wxScopedCharBuffer& name) { return wxCRT_GetenvA(name.data()); }
+inline wchar_t* wxGetenv(const wxScopedWCharBuffer& name) { return wxCRT_GetenvW(name.data()); }
+
+// ----------------------------------------------------------------------------
+// time.h functions
+// ----------------------------------------------------------------------------
+
+inline size_t wxStrftime(char *s, size_t max,
+ const wxString& format, const struct tm *tm)
+ { return wxCRT_StrftimeA(s, max, format.mb_str(), tm); }
+
+inline size_t wxStrftime(wchar_t *s, size_t max,
+ const wxString& format, const struct tm *tm)
+ { return wxCRT_StrftimeW(s, max, format.wc_str(), tm); }
+
+// NB: we can't provide both char* and wchar_t* versions for obvious reasons
+// and returning wxString wouldn't work either (it would be immediately
+// destroyed and if assigned to char*/wchar_t*, the pointer would be
+// invalid), so we only keep ASCII version, because the returned value
+// is always ASCII anyway
+#define wxAsctime asctime
+#define wxCtime ctime
+
+
+// ----------------------------------------------------------------------------
+// ctype.h functions
+// ----------------------------------------------------------------------------
+
+// FIXME-UTF8: we'd be better off implementing these ourselves, as the CRT
+// version is locale-dependent
+// FIXME-UTF8: these don't work when EOF is passed in because of wxUniChar,
+// is this OK or not?
+
+inline bool wxIsalnum(const wxUniChar& c) { return wxCRT_IsalnumW(c) != 0; }
+inline bool wxIsalpha(const wxUniChar& c) { return wxCRT_IsalphaW(c) != 0; }
+inline bool wxIscntrl(const wxUniChar& c) { return wxCRT_IscntrlW(c) != 0; }
+inline bool wxIsdigit(const wxUniChar& c) { return wxCRT_IsdigitW(c) != 0; }
+inline bool wxIsgraph(const wxUniChar& c) { return wxCRT_IsgraphW(c) != 0; }
+inline bool wxIslower(const wxUniChar& c) { return wxCRT_IslowerW(c) != 0; }
+inline bool wxIsprint(const wxUniChar& c) { return wxCRT_IsprintW(c) != 0; }
+inline bool wxIspunct(const wxUniChar& c) { return wxCRT_IspunctW(c) != 0; }
+inline bool wxIsspace(const wxUniChar& c) { return wxCRT_IsspaceW(c) != 0; }
+inline bool wxIsupper(const wxUniChar& c) { return wxCRT_IsupperW(c) != 0; }
+inline bool wxIsxdigit(const wxUniChar& c) { return wxCRT_IsxdigitW(c) != 0; }
+
+inline wxUniChar wxTolower(const wxUniChar& c) { return wxCRT_TolowerW(c); }
+inline wxUniChar wxToupper(const wxUniChar& c) { return wxCRT_ToupperW(c); }
+
+#if WXWIN_COMPATIBILITY_2_8
+// we had goofed and defined wxIsctrl() instead of (correct) wxIscntrl() in the
+// initial versions of this header -- now it is too late to remove it so
+// although we fixed the function/macro name above, still provide the
+// backwards-compatible synonym.
+wxDEPRECATED( inline int wxIsctrl(const wxUniChar& c) );
+inline int wxIsctrl(const wxUniChar& c) { return wxIscntrl(c); }
+#endif // WXWIN_COMPATIBILITY_2_8
+
+inline bool wxIsascii(const wxUniChar& c) { return c.IsAscii(); }
+
+#endif /* _WX_WXCRT_H_ */
--- /dev/null
+/*
+ * Name: wx/wxcrtbase.h
+ * Purpose: Type-safe ANSI and Unicode builds compatible wrappers for
+ * CRT functions
+ * Author: Joel Farley, Ove Kaaven
+ * Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee
+ * Created: 1998/06/12
+ * Copyright: (c) 1998-2006 wxWidgets dev team
+ * Licence: wxWindows licence
+ */
+
+/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
+
+#ifndef _WX_WXCRTBASE_H_
+#define _WX_WXCRTBASE_H_
+
+/* -------------------------------------------------------------------------
+ headers and missing declarations
+ ------------------------------------------------------------------------- */
+
+#include "wx/chartype.h"
+
+/*
+ Standard headers we need here.
+
+ NB: don't include any wxWidgets headers here because almost all of them
+ include this one!
+
+ NB2: User code should include wx/crt.h instead of including this
+ header directly.
+
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <wctype.h>
+#include <time.h>
+
+#if defined(__WINDOWS__) && !defined(__WXWINCE__)
+ #include <io.h>
+#endif
+
+#if defined(HAVE_STRTOK_R) && defined(__DARWIN__) && defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS
+ char *strtok_r(char *, const char *, char **);
+#endif
+
+/*
+ Using -std=c++{98,0x} option with mingw32 disables most of standard
+ library extensions, so we can't rely on the presence of common non-ANSI
+ functions, define a special symbol to test for this. Notice that this
+ doesn't need to be done for g++ under Linux where _GNU_SOURCE (which is
+ defined by default) still makes all common extensions available even in
+ ANSI mode.
+ */
+#if defined(__MINGW32__) && defined(__STRICT_ANSI__)
+ #define __WX_STRICT_ANSI_GCC__
+#endif
+
+/*
+ a few compilers don't have the (non standard but common) isascii function,
+ define it ourselves for them
+ */
+#ifndef isascii
+ #if defined(__WX_STRICT_ANSI_GCC__)
+ #define wxNEED_ISASCII
+ #elif defined(_WIN32_WCE)
+ #if _WIN32_WCE <= 211
+ #define wxNEED_ISASCII
+ #endif
+ #endif
+#endif /* isascii */
+
+#ifdef wxNEED_ISASCII
+ inline int isascii(int c) { return (unsigned)c < 0x80; }
+#endif
+
+#ifdef _WIN32_WCE
+ #if _WIN32_WCE <= 211
+ #define isspace(c) ((c) == wxT(' ') || (c) == wxT('\t'))
+ #endif
+#endif /* _WIN32_WCE */
+
+/* string.h functions */
+#ifndef strdup
+ #if defined(__WXWINCE__)
+ #if _WIN32_WCE <= 211
+ #define wxNEED_STRDUP
+ #endif
+ #endif
+#endif /* strdup */
+
+#ifdef wxNEED_STRDUP
+ WXDLLIMPEXP_BASE char *strdup(const char* s);
+#endif
+
+/* missing functions in some WinCE versions */
+#ifdef _WIN32_WCE
+#if (_WIN32_WCE < 300)
+WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size );
+#endif
+#endif /* _WIN32_WCE */
+
+
+/* -------------------------------------------------------------------------
+ UTF-8 locale handling
+ ------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+ #if wxUSE_UNICODE_UTF8
+ /* flag indicating whether the current locale uses UTF-8 or not; must be
+ updated every time the locale is changed! */
+ #if wxUSE_UTF8_LOCALE_ONLY
+ #define wxLocaleIsUtf8 true
+ #else
+ extern WXDLLIMPEXP_BASE bool wxLocaleIsUtf8;
+ #endif
+ /* function used to update the flag: */
+ extern WXDLLIMPEXP_BASE void wxUpdateLocaleIsUtf8();
+ #else /* !wxUSE_UNICODE_UTF8 */
+ inline void wxUpdateLocaleIsUtf8() {}
+ #endif /* wxUSE_UNICODE_UTF8/!wxUSE_UNICODE_UTF8 */
+#endif /* __cplusplus */
+
+
+/* -------------------------------------------------------------------------
+ string.h
+ ------------------------------------------------------------------------- */
+
+#define wxCRT_StrcatA strcat
+#define wxCRT_StrchrA strchr
+#define wxCRT_StrcmpA strcmp
+#define wxCRT_StrcpyA strcpy
+#define wxCRT_StrcspnA strcspn
+#define wxCRT_StrlenA strlen
+#define wxCRT_StrncatA strncat
+#define wxCRT_StrncmpA strncmp
+#define wxCRT_StrncpyA strncpy
+#define wxCRT_StrpbrkA strpbrk
+#define wxCRT_StrrchrA strrchr
+#define wxCRT_StrspnA strspn
+#define wxCRT_StrstrA strstr
+
+#define wxCRT_StrcatW wcscat
+#define wxCRT_StrchrW wcschr
+#define wxCRT_StrcmpW wcscmp
+#define wxCRT_StrcpyW wcscpy
+#define wxCRT_StrcspnW wcscspn
+#define wxCRT_StrncatW wcsncat
+#define wxCRT_StrncmpW wcsncmp
+#define wxCRT_StrncpyW wcsncpy
+#define wxCRT_StrpbrkW wcspbrk
+#define wxCRT_StrrchrW wcsrchr
+#define wxCRT_StrspnW wcsspn
+#define wxCRT_StrstrW wcsstr
+
+/* these functions are not defined under CE, at least in VC8 CRT */
+#if !defined(__WXWINCE__)
+ #define wxCRT_StrcollA strcoll
+ #define wxCRT_StrxfrmA strxfrm
+
+ #define wxCRT_StrcollW wcscoll
+ #define wxCRT_StrxfrmW wcsxfrm
+#endif /* __WXWINCE__ */
+
+/* Almost all compilers have strdup(), but VC++ and MinGW call it _strdup().
+ And it's not available in MinGW strict ANSI mode nor under Windows CE. */
+#if (defined(__VISUALC__) && __VISUALC__ >= 1400)
+ #define wxCRT_StrdupA _strdup
+#elif defined(__MINGW32__)
+ #ifndef __WX_STRICT_ANSI_GCC__
+ #define wxCRT_StrdupA _strdup
+ #endif
+#elif !defined(__WXWINCE__)
+ #define wxCRT_StrdupA strdup
+#endif
+
+/* most Windows compilers provide _wcsdup() */
+#if defined(__WINDOWS__) && \
+ !(defined(__CYGWIN__) || defined(__WX_STRICT_ANSI_GCC__))
+ #define wxCRT_StrdupW _wcsdup
+#elif defined(HAVE_WCSDUP)
+ #define wxCRT_StrdupW wcsdup
+#endif
+
+#ifdef wxHAVE_TCHAR_SUPPORT
+ /* we surely have wchar_t if we have TCHAR have wcslen() */
+ #ifndef HAVE_WCSLEN
+ #define HAVE_WCSLEN
+ #endif
+#endif /* wxHAVE_TCHAR_SUPPORT */
+
+#ifdef HAVE_WCSLEN
+ #define wxCRT_StrlenW wcslen
+#endif
+
+#define wxCRT_StrtodA strtod
+#define wxCRT_StrtolA strtol
+#define wxCRT_StrtoulA strtoul
+#define wxCRT_StrtodW wcstod
+#define wxCRT_StrtolW wcstol
+#define wxCRT_StrtoulW wcstoul
+
+#ifdef __VISUALC__
+ #if __VISUALC__ >= 1300 && !defined(__WXWINCE__)
+ #define wxCRT_StrtollA _strtoi64
+ #define wxCRT_StrtoullA _strtoui64
+ #define wxCRT_StrtollW _wcstoi64
+ #define wxCRT_StrtoullW _wcstoui64
+ #endif /* VC++ 7+ */
+#else
+ #ifdef HAVE_STRTOULL
+ #define wxCRT_StrtollA strtoll
+ #define wxCRT_StrtoullA strtoull
+ #endif /* HAVE_STRTOULL */
+ #ifdef HAVE_WCSTOULL
+ /* assume that we have wcstoull(), which is also C99, too */
+ #define wxCRT_StrtollW wcstoll
+ #define wxCRT_StrtoullW wcstoull
+ #endif /* HAVE_WCSTOULL */
+#endif
+
+/*
+ Only VC8 and later provide strnlen() and wcsnlen() functions under Windows
+ and it's also only available starting from Windows CE 6.0 only in CE build.
+ */
+#if wxCHECK_VISUALC_VERSION(8) && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 0x600))
+ #ifndef HAVE_STRNLEN
+ #define HAVE_STRNLEN
+ #endif
+ #ifndef HAVE_WCSNLEN
+ #define HAVE_WCSNLEN
+ #endif
+#endif
+
+#ifdef HAVE_STRNLEN
+ #define wxCRT_StrnlenA strnlen
+#endif
+
+#ifdef HAVE_WCSNLEN
+ #define wxCRT_StrnlenW wcsnlen
+#endif
+
+/* define wxCRT_StricmpA/W and wxCRT_StrnicmpA/W for various compilers */
+
+#if defined(__BORLANDC__) || defined(__WATCOMC__) || \
+ defined(__VISAGECPP__) || \
+ defined(__EMX__) || defined(__DJGPP__)
+ #define wxCRT_StricmpA stricmp
+ #define wxCRT_StrnicmpA strnicmp
+#elif defined(__SYMANTEC__) || (defined(__VISUALC__) && !defined(__WXWINCE__))
+ #define wxCRT_StricmpA _stricmp
+ #define wxCRT_StrnicmpA _strnicmp
+#elif defined(__UNIX__) || (defined(__GNUWIN32__) && !defined(__WX_STRICT_ANSI_GCC__))
+ #define wxCRT_StricmpA strcasecmp
+ #define wxCRT_StrnicmpA strncasecmp
+/* #else -- use wxWidgets implementation */
+#endif
+
+#ifdef __VISUALC__
+ #define wxCRT_StricmpW _wcsicmp
+ #define wxCRT_StrnicmpW _wcsnicmp
+#elif defined(__UNIX__)
+ #ifdef HAVE_WCSCASECMP
+ #define wxCRT_StricmpW wcscasecmp
+ #endif
+ #ifdef HAVE_WCSNCASECMP
+ #define wxCRT_StrnicmpW wcsncasecmp
+ #endif
+/* #else -- use wxWidgets implementation */
+#endif
+
+#ifdef HAVE_STRTOK_R
+ #define wxCRT_StrtokA(str, sep, last) strtok_r(str, sep, last)
+#endif
+/* FIXME-UTF8: detect and use wcstok() if available for wxCRT_StrtokW */
+
+/* these are extern "C" because they are used by regex lib: */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef wxCRT_StrlenW
+WXDLLIMPEXP_BASE size_t wxCRT_StrlenW(const wchar_t *s);
+#endif
+
+#ifndef wxCRT_StrncmpW
+WXDLLIMPEXP_BASE int wxCRT_StrncmpW(const wchar_t *s1, const wchar_t *s2, size_t n);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+/* FIXME-UTF8: remove this once we are Unicode only */
+#if wxUSE_UNICODE
+ #define wxCRT_StrlenNative wxCRT_StrlenW
+ #define wxCRT_StrncmpNative wxCRT_StrncmpW
+ #define wxCRT_ToupperNative wxCRT_ToupperW
+ #define wxCRT_TolowerNative wxCRT_TolowerW
+#else
+ #define wxCRT_StrlenNative wxCRT_StrlenA
+ #define wxCRT_StrncmpNative wxCRT_StrncmpA
+ #define wxCRT_ToupperNative toupper
+ #define wxCRT_TolowerNative tolower
+#endif
+
+#ifndef wxCRT_StrcatW
+WXDLLIMPEXP_BASE wchar_t *wxCRT_StrcatW(wchar_t *dest, const wchar_t *src);
+#endif
+
+#ifndef wxCRT_StrchrW
+WXDLLIMPEXP_BASE const wchar_t *wxCRT_StrchrW(const wchar_t *s, wchar_t c);
+#endif
+
+#ifndef wxCRT_StrcmpW
+WXDLLIMPEXP_BASE int wxCRT_StrcmpW(const wchar_t *s1, const wchar_t *s2);
+#endif
+
+#ifndef wxCRT_StrcollW
+WXDLLIMPEXP_BASE int wxCRT_StrcollW(const wchar_t *s1, const wchar_t *s2);
+#endif
+
+#ifndef wxCRT_StrcpyW
+WXDLLIMPEXP_BASE wchar_t *wxCRT_StrcpyW(wchar_t *dest, const wchar_t *src);
+#endif
+
+#ifndef wxCRT_StrcspnW
+WXDLLIMPEXP_BASE size_t wxCRT_StrcspnW(const wchar_t *s, const wchar_t *reject);
+#endif
+
+#ifndef wxCRT_StrncatW
+WXDLLIMPEXP_BASE wchar_t *wxCRT_StrncatW(wchar_t *dest, const wchar_t *src, size_t n);
+#endif
+
+#ifndef wxCRT_StrncpyW
+WXDLLIMPEXP_BASE wchar_t *wxCRT_StrncpyW(wchar_t *dest, const wchar_t *src, size_t n);
+#endif
+
+#ifndef wxCRT_StrpbrkW
+WXDLLIMPEXP_BASE const wchar_t *wxCRT_StrpbrkW(const wchar_t *s, const wchar_t *accept);
+#endif
+
+#ifndef wxCRT_StrrchrW
+WXDLLIMPEXP_BASE const wchar_t *wxCRT_StrrchrW(const wchar_t *s, wchar_t c);
+#endif
+
+#ifndef wxCRT_StrspnW
+WXDLLIMPEXP_BASE size_t wxCRT_StrspnW(const wchar_t *s, const wchar_t *accept);
+#endif
+
+#ifndef wxCRT_StrstrW
+WXDLLIMPEXP_BASE const wchar_t *wxCRT_StrstrW(const wchar_t *haystack, const wchar_t *needle);
+#endif
+
+#ifndef wxCRT_StrtodW
+WXDLLIMPEXP_BASE double wxCRT_StrtodW(const wchar_t *nptr, wchar_t **endptr);
+#endif
+
+#ifndef wxCRT_StrtolW
+WXDLLIMPEXP_BASE long int wxCRT_StrtolW(const wchar_t *nptr, wchar_t **endptr, int base);
+#endif
+
+#ifndef wxCRT_StrtoulW
+WXDLLIMPEXP_BASE unsigned long int wxCRT_StrtoulW(const wchar_t *nptr, wchar_t **endptr, int base);
+#endif
+
+#ifndef wxCRT_StrxfrmW
+WXDLLIMPEXP_BASE size_t wxCRT_StrxfrmW(wchar_t *dest, const wchar_t *src, size_t n);
+#endif
+
+#ifndef wxCRT_StrdupA
+WXDLLIMPEXP_BASE char *wxCRT_StrdupA(const char *psz);
+#endif
+
+#ifndef wxCRT_StrdupW
+WXDLLIMPEXP_BASE wchar_t *wxCRT_StrdupW(const wchar_t *pwz);
+#endif
+
+#ifndef wxCRT_StricmpA
+WXDLLIMPEXP_BASE int wxCRT_StricmpA(const char *psz1, const char *psz2);
+#endif
+
+#ifndef wxCRT_StricmpW
+WXDLLIMPEXP_BASE int wxCRT_StricmpW(const wchar_t *psz1, const wchar_t *psz2);
+#endif
+
+#ifndef wxCRT_StrnicmpA
+WXDLLIMPEXP_BASE int wxCRT_StrnicmpA(const char *psz1, const char *psz2, size_t len);
+#endif
+
+#ifndef wxCRT_StrnicmpW
+WXDLLIMPEXP_BASE int wxCRT_StrnicmpW(const wchar_t *psz1, const wchar_t *psz2, size_t len);
+#endif
+
+#ifndef wxCRT_StrtokA
+WXDLLIMPEXP_BASE char *wxCRT_StrtokA(char *psz, const char *delim, char **save_ptr);
+#endif
+
+#ifndef wxCRT_StrtokW
+WXDLLIMPEXP_BASE wchar_t *wxCRT_StrtokW(wchar_t *psz, const wchar_t *delim, wchar_t **save_ptr);
+#endif
+
+/* supply strtoll and strtoull, if needed */
+#ifdef wxLongLong_t
+ #ifndef wxCRT_StrtollA
+ WXDLLIMPEXP_BASE wxLongLong_t wxCRT_StrtollA(const char* nptr,
+ char** endptr,
+ int base);
+ WXDLLIMPEXP_BASE wxULongLong_t wxCRT_StrtoullA(const char* nptr,
+ char** endptr,
+ int base);
+ #endif
+ #ifndef wxCRT_StrtollW
+ WXDLLIMPEXP_BASE wxLongLong_t wxCRT_StrtollW(const wchar_t* nptr,
+ wchar_t** endptr,
+ int base);
+ WXDLLIMPEXP_BASE wxULongLong_t wxCRT_StrtoullW(const wchar_t* nptr,
+ wchar_t** endptr,
+ int base);
+ #endif
+#endif /* wxLongLong_t */
+
+
+/* -------------------------------------------------------------------------
+ stdio.h
+ ------------------------------------------------------------------------- */
+
+#if defined(__UNIX__) || defined(__WXMAC__)
+ #define wxMBFILES 1
+#else
+ #define wxMBFILES 0
+#endif
+
+
+/* these functions are only needed in the form used for filenames (i.e. char*
+ on Unix, wchar_t* on Windows), so we don't need to use A/W suffix: */
+#if wxMBFILES || !wxUSE_UNICODE /* ANSI filenames */
+
+ #define wxCRT_Fopen fopen
+ #define wxCRT_Freopen freopen
+ #define wxCRT_Remove remove
+ #define wxCRT_Rename rename
+
+#else /* Unicode filenames */
+ /* special case: these functions are missing under Win9x with Unicows so we
+ have to implement them ourselves */
+ #if wxUSE_UNICODE_MSLU || defined(__WX_STRICT_ANSI_GCC__)
+ WXDLLIMPEXP_BASE FILE* wxMSLU__wfopen(const wchar_t *name, const wchar_t *mode);
+ WXDLLIMPEXP_BASE FILE* wxMSLU__wfreopen(const wchar_t *name, const wchar_t *mode, FILE *stream);
+ WXDLLIMPEXP_BASE int wxMSLU__wrename(const wchar_t *oldname, const wchar_t *newname);
+ WXDLLIMPEXP_BASE int wxMSLU__wremove(const wchar_t *name);
+ #define wxCRT_Fopen wxMSLU__wfopen
+ #define wxCRT_Freopen wxMSLU__wfreopen
+ #define wxCRT_Remove wxMSLU__wremove
+ #define wxCRT_Rename wxMSLU__wrename
+ #else
+ /* WinCE CRT doesn't provide these functions so use our own */
+ #ifdef __WXWINCE__
+ WXDLLIMPEXP_BASE int wxCRT_Rename(const wchar_t *src,
+ const wchar_t *dst);
+ WXDLLIMPEXP_BASE int wxCRT_Remove(const wchar_t *path);
+ #else
+ #define wxCRT_Rename _wrename
+ #define wxCRT_Remove _wremove
+ #endif
+ #define wxCRT_Fopen _wfopen
+ #define wxCRT_Freopen _wfreopen
+ #endif
+
+#endif /* wxMBFILES/!wxMBFILES */
+
+#define wxCRT_PutsA puts
+#define wxCRT_FputsA fputs
+#define wxCRT_FgetsA fgets
+#define wxCRT_FputcA fputc
+#define wxCRT_FgetcA fgetc
+#define wxCRT_UngetcA ungetc
+
+#ifdef wxHAVE_TCHAR_SUPPORT
+ #define wxCRT_PutsW _putws
+ #define wxCRT_FputsW fputws
+ #define wxCRT_FputcW fputwc
+#endif
+#ifdef HAVE_FPUTWS
+ #define wxCRT_FputsW fputws
+#endif
+#ifdef HAVE_PUTWS
+ #define wxCRT_PutsW putws
+#endif
+#ifdef HAVE_FPUTWC
+ #define wxCRT_FputcW fputwc
+#endif
+#define wxCRT_FgetsW fgetws
+
+#ifndef wxCRT_PutsW
+WXDLLIMPEXP_BASE int wxCRT_PutsW(const wchar_t *ws);
+#endif
+
+#ifndef wxCRT_FputsW
+WXDLLIMPEXP_BASE int wxCRT_FputsW(const wchar_t *ch, FILE *stream);
+#endif
+
+#ifndef wxCRT_FputcW
+WXDLLIMPEXP_BASE int wxCRT_FputcW(wchar_t wc, FILE *stream);
+#endif
+
+/*
+ NB: tmpnam() is unsafe and thus is not wrapped!
+ Use other wxWidgets facilities instead:
+ wxFileName::CreateTempFileName, wxTempFile, or wxTempFileOutputStream
+*/
+#define wxTmpnam(x) wxTmpnam_is_insecure_use_wxTempFile_instead
+
+/* FIXME-CE: provide our own perror() using ::GetLastError() */
+#ifndef __WXWINCE__
+
+#define wxCRT_PerrorA perror
+#ifdef wxHAVE_TCHAR_SUPPORT
+ #define wxCRT_PerrorW _wperror
+#endif
+
+#endif /* !__WXWINCE__ */
+
+/* -------------------------------------------------------------------------
+ stdlib.h
+ ------------------------------------------------------------------------- */
+
+/* there are no env vars at all under CE, so no _tgetenv neither */
+#ifdef __WXWINCE__
+ /* can't define as inline function as this is a C file... */
+ #define wxCRT_GetenvA(name) (name, NULL)
+ #define wxCRT_GetenvW(name) (name, NULL)
+#else
+ #define wxCRT_GetenvA getenv
+ #ifdef _tgetenv
+ #define wxCRT_GetenvW _wgetenv
+ #endif
+#endif
+
+#ifndef wxCRT_GetenvW
+WXDLLIMPEXP_BASE wchar_t * wxCRT_GetenvW(const wchar_t *name);
+#endif
+
+
+#define wxCRT_SystemA system
+/* mingw32 doesn't provide _tsystem() or _wsystem(): */
+#if defined(_tsystem)
+ #define wxCRT_SystemW _wsystem
+#endif
+
+#define wxCRT_AtofA atof
+#define wxCRT_AtoiA atoi
+#define wxCRT_AtolA atol
+
+#if defined(wxHAVE_TCHAR_SUPPORT) && !defined(__WX_STRICT_ANSI_GCC__)
+ #define wxCRT_AtoiW _wtoi
+ #define wxCRT_AtolW _wtol
+ /* _wtof doesn't exist */
+#else
+#ifndef __VMS
+ #define wxCRT_AtofW(s) wcstod(s, NULL)
+#endif
+ #define wxCRT_AtolW(s) wcstol(s, NULL, 10)
+ /* wcstoi doesn't exist */
+#endif
+
+/* -------------------------------------------------------------------------
+ time.h
+ ------------------------------------------------------------------------- */
+
+#define wxCRT_StrftimeA strftime
+#ifdef __SGI__
+ /*
+ IRIX provides not one but two versions of wcsftime(): XPG4 one which
+ uses "const char*" for the third parameter and so can't be used and the
+ correct, XPG5, one. Unfortunately we can't just define _XOPEN_SOURCE
+ high enough to get XPG5 version as this undefines other symbols which
+ make other functions we use unavailable (see <standards.h> for gory
+ details). So just declare the XPG5 version ourselves, we're extremely
+ unlikely to ever be compiled on a system without it. But if we ever do,
+ a configure test would need to be added for it (and _MIPS_SYMBOL_PRESENT
+ should be used to check for its presence during run-time, i.e. it would
+ probably be simpler to just always use our own wxCRT_StrftimeW() below
+ if it does ever become a problem).
+ */
+#ifdef __cplusplus
+ extern "C"
+#endif
+ size_t
+ _xpg5_wcsftime(wchar_t *, size_t, const wchar_t *, const struct tm * );
+ #define wxCRT_StrftimeW _xpg5_wcsftime
+#else
+ /*
+ Assume it's always available under non-Unix systems as this does seem
+ to be the case for now. And under Unix we trust configure to detect it
+ (except for SGI special case above).
+ */
+ #if defined(HAVE_WCSFTIME) || !defined(__UNIX__)
+ #define wxCRT_StrftimeW wcsftime
+ #endif
+#endif
+
+#ifndef wxCRT_StrftimeW
+WXDLLIMPEXP_BASE size_t wxCRT_StrftimeW(wchar_t *s, size_t max,
+ const wchar_t *fmt,
+ const struct tm *tm);
+#endif
+
+
+
+/* -------------------------------------------------------------------------
+ ctype.h
+ ------------------------------------------------------------------------- */
+
+#ifdef __WATCOMC__
+ #define WXWCHAR_T_CAST(c) (wint_t)(c)
+#else
+ #define WXWCHAR_T_CAST(c) c
+#endif
+
+#define wxCRT_IsalnumW(c) iswalnum(WXWCHAR_T_CAST(c))
+#define wxCRT_IsalphaW(c) iswalpha(WXWCHAR_T_CAST(c))
+#define wxCRT_IscntrlW(c) iswcntrl(WXWCHAR_T_CAST(c))
+#define wxCRT_IsdigitW(c) iswdigit(WXWCHAR_T_CAST(c))
+#define wxCRT_IsgraphW(c) iswgraph(WXWCHAR_T_CAST(c))
+#define wxCRT_IslowerW(c) iswlower(WXWCHAR_T_CAST(c))
+#define wxCRT_IsprintW(c) iswprint(WXWCHAR_T_CAST(c))
+#define wxCRT_IspunctW(c) iswpunct(WXWCHAR_T_CAST(c))
+#define wxCRT_IsspaceW(c) iswspace(WXWCHAR_T_CAST(c))
+#define wxCRT_IsupperW(c) iswupper(WXWCHAR_T_CAST(c))
+#define wxCRT_IsxdigitW(c) iswxdigit(WXWCHAR_T_CAST(c))
+
+#ifdef __GLIBC__
+ #if defined(__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)
+ /* /usr/include/wctype.h incorrectly declares translations */
+ /* tables which provokes tons of compile-time warnings -- try */
+ /* to correct this */
+ #define wxCRT_TolowerW(wc) towctrans((wc), (wctrans_t)__ctype_tolower)
+ #define wxCRT_ToupperW(wc) towctrans((wc), (wctrans_t)__ctype_toupper)
+ #else /* !glibc 2.0 */
+ #define wxCRT_TolowerW towlower
+ #define wxCRT_ToupperW towupper
+ #endif
+#else /* !__GLIBC__ */
+ /* There is a bug in VC6 C RTL: toxxx() functions dosn't do anything
+ with signed chars < 0, so "fix" it here. */
+ #define wxCRT_TolowerW(c) towlower((wxUChar)(wxChar)(c))
+ #define wxCRT_ToupperW(c) towupper((wxUChar)(wxChar)(c))
+#endif /* __GLIBC__/!__GLIBC__ */
+
+
+
+
+
+/* -------------------------------------------------------------------------
+ wx wrappers for CRT functions in both char* and wchar_t* versions
+ ------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+
+/* NB: this belongs to wxcrt.h and not this header, but it makes life easier
+ * for buffer.h and stringimpl.h (both of which must be included before
+ * string.h, which is required by wxcrt.h) to have them here: */
+
+/* safe version of strlen() (returns 0 if passed NULL pointer) */
+inline size_t wxStrlen(const char *s) { return s ? wxCRT_StrlenA(s) : 0; }
+inline size_t wxStrlen(const wchar_t *s) { return s ? wxCRT_StrlenW(s) : 0; }
+#ifndef wxWCHAR_T_IS_WXCHAR16
+ WXDLLIMPEXP_BASE size_t wxStrlen(const wxChar16 *s );
+#endif
+#ifndef wxWCHAR_T_IS_WXCHAR32
+ WXDLLIMPEXP_BASE size_t wxStrlen(const wxChar32 *s );
+#endif
+#define wxWcslen wxCRT_StrlenW
+
+#define wxStrdupA wxCRT_StrdupA
+#define wxStrdupW wxCRT_StrdupW
+inline char* wxStrdup(const char *s) { return wxCRT_StrdupA(s); }
+inline wchar_t* wxStrdup(const wchar_t *s) { return wxCRT_StrdupW(s); }
+#ifndef wxWCHAR_T_IS_WXCHAR16
+ WXDLLIMPEXP_BASE wxChar16* wxStrdup(const wxChar16* s);
+#endif
+#ifndef wxWCHAR_T_IS_WXCHAR32
+ WXDLLIMPEXP_BASE wxChar32* wxStrdup(const wxChar32* s);
+#endif
+
+#endif /* __cplusplus */
+
+#endif /* _WX_WXCRTBASE_H_ */
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/wxcrtvararg.h
+// Purpose: Type-safe ANSI and Unicode builds compatible wrappers for
+// printf(), scanf() and related CRT functions
+// Author: Joel Farley, Ove KÃ¥ven
+// Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee
+// Created: 2007-02-19
+// Copyright: (c) 2007 REA Elektronik GmbH
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WXCRTVARARG_H_
+#define _WX_WXCRTVARARG_H_
+
+// NB: User code should include wx/crt.h instead of including this
+// header directly.
+
+#include "wx/wxcrt.h"
+#include "wx/strvararg.h"
+
+#include "wx/string.h"
+
+// ----------------------------------------------------------------------------
+// CRT functions aliases
+// ----------------------------------------------------------------------------
+
+/* Required for wxPrintf() etc */
+#include <stdarg.h>
+
+/* printf() family saga */
+
+/*
+ For many old Unix systems [v]snprintf()/vsscanf() exists in the system
+ libraries but not in the headers, so we need to declare it ourselves to be
+ able to use it.
+ */
+#ifdef __UNIX__
+
+#if defined(HAVE_VSNPRINTF) && !defined(HAVE_VSNPRINTF_DECL)
+#ifdef __cplusplus
+ extern "C"
+#else
+ extern
+#endif
+ int vsnprintf(char *str, size_t size, const char *format, va_list ap);
+#endif /* !HAVE_VSNPRINTF_DECL */
+
+#if defined(HAVE_SNPRINTF) && !defined(HAVE_SNPRINTF_DECL)
+#ifdef __cplusplus
+ extern "C"
+#else
+ extern
+#endif
+ int snprintf(char *str, size_t size, const char *format, ...);
+#endif /* !HAVE_SNPRINTF_DECL */
+
+#if defined(HAVE_VSSCANF) && !defined(HAVE_VSSCANF_DECL)
+#ifdef __cplusplus
+ extern "C"
+#else
+ extern
+#endif
+ int vsscanf(const char *str, const char *format, va_list ap);
+#endif /* !HAVE_VSSCANF_DECL */
+
+/* Wrapper for vsnprintf if it's 3rd parameter is non-const. Note: the
+ * same isn't done for snprintf below, the builtin wxSnprintf_ is used
+ * instead since it's already a simple wrapper */
+#if defined __cplusplus && defined HAVE_BROKEN_VSNPRINTF_DECL
+ inline int wx_fixed_vsnprintf(char *str, size_t size, const char *format, va_list ap)
+ {
+ return vsnprintf(str, size, (char*)format, ap);
+ }
+#endif
+
+#endif /* __UNIX__ */
+
+/*
+ mingw32 normally uses MSVCRT which has non-standard vswprintf() and so
+ normally _vsnwprintf() is used instead, the only exception is when mingw32
+ is used with STLPort which does have a standard vswprintf() starting from
+ version 5.1 which we can use.
+ */
+#ifdef __MINGW32__
+ #if defined(_STLPORT_VERSION) && _STLPORT_VERSION >= 0x510
+ #ifndef HAVE_VSWPRINTF
+ #define HAVE_VSWPRINTF
+ #endif
+ #elif defined(HAVE_VSWPRINTF)
+ /* can't use non-standard vswprintf() */
+ #undef HAVE_VSWPRINTF
+ #endif
+#endif /* __MINGW32__ */
+
+#if defined(__WATCOMC__)
+ #define HAVE_VSWPRINTF 1
+#endif
+
+#if wxUSE_PRINTF_POS_PARAMS
+ /*
+ The systems where vsnprintf() supports positional parameters should
+ define the HAVE_UNIX98_PRINTF symbol.
+
+ On systems which don't (e.g. Windows) we are forced to use
+ our wxVsnprintf() implementation.
+ */
+ #if defined(HAVE_UNIX98_PRINTF)
+ #ifdef HAVE_VSWPRINTF
+ #define wxCRT_VsnprintfW vswprintf
+ #endif
+ #ifdef HAVE_BROKEN_VSNPRINTF_DECL
+ #define wxCRT_VsnprintfA wx_fixed_vsnprintf
+ #else
+ #define wxCRT_VsnprintfA vsnprintf
+ #endif
+ #else /* !HAVE_UNIX98_PRINTF */
+ /*
+ The only compiler with positional parameters support under Windows
+ is VC++ 8.0 which provides a new xxprintf_p() functions family.
+ The 2003 PSDK includes a slightly earlier version of VC8 than the
+ main release and does not have the printf_p functions.
+ */
+ #if defined _MSC_FULL_VER && _MSC_FULL_VER >= 140050727 && !defined __WXWINCE__
+ #define wxCRT_VsnprintfA _vsprintf_p
+ #define wxCRT_VsnprintfW _vswprintf_p
+ #endif
+ #endif /* HAVE_UNIX98_PRINTF/!HAVE_UNIX98_PRINTF */
+#else /* !wxUSE_PRINTF_POS_PARAMS */
+ /*
+ We always want to define safe snprintf() function to be used instead of
+ sprintf(). Some compilers already have it (or rather vsnprintf() which
+ we really need...), otherwise we implement it using our own printf()
+ code.
+
+ We define function with a trailing underscore here because the real one
+ is a wrapper around it as explained below
+ */
+
+ #if defined(__VISUALC__) || \
+ (defined(__BORLANDC__) && __BORLANDC__ >= 0x540)
+ #define wxCRT_VsnprintfA _vsnprintf
+ #define wxCRT_VsnprintfW _vsnwprintf
+ #else
+ #if defined(HAVE__VSNWPRINTF)
+ #define wxCRT_VsnprintfW _vsnwprintf
+ #elif defined(HAVE_VSWPRINTF)
+ #define wxCRT_VsnprintfW vswprintf
+ #elif defined(__WATCOMC__)
+ #define wxCRT_VsnprintfW _vsnwprintf
+ #endif
+
+ #if defined(HAVE_VSNPRINTF) \
+ || defined(__WATCOMC__)
+ #ifdef HAVE_BROKEN_VSNPRINTF_DECL
+ #define wxCRT_VsnprintfA wx_fixed_vsnprintf
+ #else
+ #define wxCRT_VsnprintfA vsnprintf
+ #endif
+ #endif
+ #endif
+#endif /* wxUSE_PRINTF_POS_PARAMS/!wxUSE_PRINTF_POS_PARAMS */
+
+#ifndef wxCRT_VsnprintfW
+ /* no (suitable) vsnprintf(), cook our own */
+ WXDLLIMPEXP_BASE int
+ wxCRT_VsnprintfW(wchar_t *buf, size_t len, const wchar_t *format, va_list argptr);
+ #define wxUSE_WXVSNPRINTFW 1
+#else
+ #define wxUSE_WXVSNPRINTFW 0
+#endif
+
+#ifndef wxCRT_VsnprintfA
+ /* no (suitable) vsnprintf(), cook our own */
+ WXDLLIMPEXP_BASE int
+ wxCRT_VsnprintfA(char *buf, size_t len, const char *format, va_list argptr);
+ #define wxUSE_WXVSNPRINTFA 1
+#else
+ #define wxUSE_WXVSNPRINTFA 0
+#endif
+
+// for wxString code, define wxUSE_WXVSNPRINTF to indicate that wx
+// implementation is used no matter what (in UTF-8 build, either *A or *W
+// version may be called):
+#if !wxUSE_UNICODE
+ #define wxUSE_WXVSNPRINTF wxUSE_WXVSNPRINTFA
+#elif wxUSE_UNICODE_WCHAR
+ #define wxUSE_WXVSNPRINTF wxUSE_WXVSNPRINTFW
+#elif wxUSE_UTF8_LOCALE_ONLY
+ #define wxUSE_WXVSNPRINTF wxUSE_WXVSNPRINTFA
+#else // UTF-8 under any locale
+ #define wxUSE_WXVSNPRINTF (wxUSE_WXVSNPRINTFA && wxUSE_WXVSNPRINTFW)
+#endif
+
+#define wxCRT_FprintfA fprintf
+#define wxCRT_PrintfA printf
+#define wxCRT_VfprintfA vfprintf
+#define wxCRT_VprintfA vprintf
+#define wxCRT_VsprintfA vsprintf
+
+/*
+ In Unicode mode we need to have all standard functions such as wprintf() and
+ so on but not all systems have them so use our own implementations in this
+ case.
+ */
+#if wxUSE_UNICODE && !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_WPRINTF)
+ #define wxNEED_WPRINTF
+#endif
+#if wxUSE_UNICODE && !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_VSWSCANF)
+ #define wxNEED_VSWSCANF
+#endif
+
+
+#if defined(wxNEED_WPRINTF)
+ /*
+ we need to implement all wide character printf functions either because
+ we don't have them at all or because they don't have the semantics we
+ need
+ */
+ int wxCRT_PrintfW( const wchar_t *format, ... );
+ int wxCRT_FprintfW( FILE *stream, const wchar_t *format, ... );
+ int wxCRT_VfprintfW( FILE *stream, const wchar_t *format, va_list ap );
+ int wxCRT_VprintfW( const wchar_t *format, va_list ap );
+ int wxCRT_VsprintfW( wchar_t *str, const wchar_t *format, va_list ap );
+#else /* !wxNEED_WPRINTF */
+ #define wxCRT_FprintfW fwprintf
+ #define wxCRT_PrintfW wprintf
+ #define wxCRT_VfprintfW vfwprintf
+ #define wxCRT_VprintfW vwprintf
+
+ #if defined(__WINDOWS__) && !defined(HAVE_VSWPRINTF)
+ // only non-standard vswprintf() without buffer size argument can be used here
+ #define wxCRT_VsprintfW vswprintf
+ #endif
+#endif /* wxNEED_WPRINTF */
+
+
+/* Required for wxScanf() etc. */
+#define wxCRT_ScanfA scanf
+#define wxCRT_SscanfA sscanf
+#define wxCRT_FscanfA fscanf
+#define wxCRT_VsscanfA vsscanf
+
+#if defined(wxNEED_WPRINTF)
+ int wxCRT_ScanfW(const wchar_t *format, ...);
+ int wxCRT_SscanfW(const wchar_t *str, const wchar_t *format, ...);
+ int wxCRT_FscanfW(FILE *stream, const wchar_t *format, ...);
+#else
+ #define wxCRT_ScanfW wxVMS_USE_STD wscanf
+ #define wxCRT_SscanfW wxVMS_USE_STD swscanf
+ #define wxCRT_FscanfW wxVMS_USE_STD fwscanf
+#endif
+#ifdef wxNEED_VSWSCANF
+ int wxCRT_VsscanfW(const wchar_t *str, const wchar_t *format, va_list ap);
+#else
+ #define wxCRT_VsscanfW wxVMS_USE_STD vswscanf
+#endif
+
+// ----------------------------------------------------------------------------
+// user-friendly wrappers to CRT functions
+// ----------------------------------------------------------------------------
+
+#ifdef __WATCOMC__
+ // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
+ #define wxPrintf wxPrintf_Impl
+ #define wxFprintf wxFprintf_Impl
+ #define wxSprintf wxSprintf_Impl
+ #define wxSnprintf wxSnprintf_Impl
+#endif
+
+ // FIXME-UTF8: remove this
+#if wxUSE_UNICODE
+ #define wxCRT_PrintfNative wxCRT_PrintfW
+ #define wxCRT_FprintfNative wxCRT_FprintfW
+#else
+ #define wxCRT_PrintfNative wxCRT_PrintfA
+ #define wxCRT_FprintfNative wxCRT_FprintfA
+#endif
+
+
+WX_DEFINE_VARARG_FUNC_SANS_N0(int, wxPrintf, 1, (const wxFormatString&),
+ wxCRT_PrintfNative, wxCRT_PrintfA)
+inline int wxPrintf(const wxFormatString& s)
+{
+ return wxPrintf("%s", s.InputAsString());
+}
+
+WX_DEFINE_VARARG_FUNC_SANS_N0(int, wxFprintf, 2, (FILE*, const wxFormatString&),
+ wxCRT_FprintfNative, wxCRT_FprintfA)
+inline int wxFprintf(FILE *f, const wxFormatString& s)
+{
+ return wxFprintf(f, "%s", s.InputAsString());
+}
+
+// va_list versions of printf functions simply forward to the respective
+// CRT function; note that they assume that va_list was created using
+// wxArgNormalizer<T>!
+#if wxUSE_UNICODE_UTF8
+ #if wxUSE_UTF8_LOCALE_ONLY
+ #define WX_VARARG_VFOO_IMPL(args, implW, implA) \
+ return implA args
+ #else
+ #define WX_VARARG_VFOO_IMPL(args, implW, implA) \
+ if ( wxLocaleIsUtf8 ) return implA args; \
+ else return implW args
+ #endif
+#elif wxUSE_UNICODE_WCHAR
+ #define WX_VARARG_VFOO_IMPL(args, implW, implA) \
+ return implW args
+#else // ANSI
+ #define WX_VARARG_VFOO_IMPL(args, implW, implA) \
+ return implA args
+#endif
+
+inline int
+wxVprintf(const wxString& format, va_list ap)
+{
+ WX_VARARG_VFOO_IMPL((wxFormatString(format), ap),
+ wxCRT_VprintfW, wxCRT_VprintfA);
+}
+
+inline int
+wxVfprintf(FILE *f, const wxString& format, va_list ap)
+{
+ WX_VARARG_VFOO_IMPL((f, wxFormatString(format), ap),
+ wxCRT_VfprintfW, wxCRT_VfprintfA);
+}
+
+#undef WX_VARARG_VFOO_IMPL
+
+
+// wxSprintf() and friends have to be implemented in two forms, one for
+// writing to char* buffer and one for writing to wchar_t*:
+
+#if !wxUSE_UTF8_LOCALE_ONLY
+int WXDLLIMPEXP_BASE wxDoSprintfWchar(char *str, const wxChar *format, ...);
+#endif
+#if wxUSE_UNICODE_UTF8
+int WXDLLIMPEXP_BASE wxDoSprintfUtf8(char *str, const char *format, ...);
+#endif
+WX_DEFINE_VARARG_FUNC(int, wxSprintf, 2, (char*, const wxFormatString&),
+ wxDoSprintfWchar, wxDoSprintfUtf8)
+
+int WXDLLIMPEXP_BASE
+wxVsprintf(char *str, const wxString& format, va_list argptr);
+
+#if !wxUSE_UTF8_LOCALE_ONLY
+int WXDLLIMPEXP_BASE wxDoSnprintfWchar(char *str, size_t size, const wxChar *format, ...);
+#endif
+#if wxUSE_UNICODE_UTF8
+int WXDLLIMPEXP_BASE wxDoSnprintfUtf8(char *str, size_t size, const char *format, ...);
+#endif
+WX_DEFINE_VARARG_FUNC(int, wxSnprintf, 3, (char*, size_t, const wxFormatString&),
+ wxDoSnprintfWchar, wxDoSnprintfUtf8)
+
+int WXDLLIMPEXP_BASE
+wxVsnprintf(char *str, size_t size, const wxString& format, va_list argptr);
+
+#if wxUSE_UNICODE
+
+#if !wxUSE_UTF8_LOCALE_ONLY
+int WXDLLIMPEXP_BASE wxDoSprintfWchar(wchar_t *str, const wxChar *format, ...);
+#endif
+#if wxUSE_UNICODE_UTF8
+int WXDLLIMPEXP_BASE wxDoSprintfUtf8(wchar_t *str, const char *format, ...);
+#endif
+WX_DEFINE_VARARG_FUNC(int, wxSprintf, 2, (wchar_t*, const wxFormatString&),
+ wxDoSprintfWchar, wxDoSprintfUtf8)
+
+int WXDLLIMPEXP_BASE
+wxVsprintf(wchar_t *str, const wxString& format, va_list argptr);
+
+#if !wxUSE_UTF8_LOCALE_ONLY
+int WXDLLIMPEXP_BASE wxDoSnprintfWchar(wchar_t *str, size_t size, const wxChar *format, ...);
+#endif
+#if wxUSE_UNICODE_UTF8
+int WXDLLIMPEXP_BASE wxDoSnprintfUtf8(wchar_t *str, size_t size, const char *format, ...);
+#endif
+WX_DEFINE_VARARG_FUNC(int, wxSnprintf, 3, (wchar_t*, size_t, const wxFormatString&),
+ wxDoSnprintfWchar, wxDoSnprintfUtf8)
+
+int WXDLLIMPEXP_BASE
+wxVsnprintf(wchar_t *str, size_t size, const wxString& format, va_list argptr);
+
+#endif // wxUSE_UNICODE
+
+#ifdef __WATCOMC__
+ // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
+ //
+ // fortunately, OpenWatcom implements __VA_ARGS__, so we can provide macros
+ // that cast the format argument to wxString:
+ #undef wxPrintf
+ #undef wxFprintf
+ #undef wxSprintf
+ #undef wxSnprintf
+
+ #define wxPrintf(fmt, ...) \
+ wxPrintf_Impl(wxFormatString(fmt), __VA_ARGS__)
+ #define wxFprintf(f, fmt, ...) \
+ wxFprintf_Impl(f, wxFormatString(fmt), __VA_ARGS__)
+ #define wxSprintf(s, fmt, ...) \
+ wxSprintf_Impl(s, wxFormatString(fmt), __VA_ARGS__)
+ #define wxSnprintf(s, n, fmt, ...) \
+ wxSnprintf_Impl(s, n, wxFormatString(fmt), __VA_ARGS__)
+#endif // __WATCOMC__
+
+
+// We can't use wxArgNormalizer<T> for variadic arguments to wxScanf() etc.
+// because they are writable, so instead of providing friendly template
+// vararg-like functions, we just provide both char* and wchar_t* variants
+// of these functions. The type of output variadic arguments for %s must match
+// the type of 'str' and 'format' arguments.
+//
+// For compatibility with earlier wx versions, we also provide wxSscanf()
+// version with the first argument (input string) wxString; for this version,
+// the type of output string values is determined by the type of format string
+// only.
+
+#define _WX_SCANFUNC_EXTRACT_ARGS_1(x) x
+#define _WX_SCANFUNC_EXTRACT_ARGS_2(x,y) x, y
+#define _WX_SCANFUNC_EXTRACT_ARGS(N, args) _WX_SCANFUNC_EXTRACT_ARGS_##N args
+
+#define _WX_VARARG_PASS_WRITABLE(i) a##i
+
+#define _WX_DEFINE_SCANFUNC(N, dummy1, name, impl, passfixed, numfixed, fixed)\
+ template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \
+ int name(_WX_SCANFUNC_EXTRACT_ARGS(numfixed, fixed), \
+ _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \
+ { \
+ return impl(_WX_SCANFUNC_EXTRACT_ARGS(numfixed, passfixed), \
+ _WX_VARARG_JOIN(N, _WX_VARARG_PASS_WRITABLE)); \
+ }
+
+#define WX_DEFINE_SCANFUNC(name, numfixed, fixed, impl, passfixed) \
+ _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \
+ _WX_DEFINE_SCANFUNC, \
+ dummy1, name, impl, passfixed, numfixed, fixed)
+
+// this is needed to normalize the format string, see src/common/strvararg.cpp
+// for more details
+#ifdef __WINDOWS__
+ #define wxScanfConvertFormatW(fmt) fmt
+#else
+ const wxScopedWCharBuffer
+ WXDLLIMPEXP_BASE wxScanfConvertFormatW(const wchar_t *format);
+#endif
+
+WX_DEFINE_SCANFUNC(wxScanf, 1, (const char *format),
+ wxCRT_ScanfA, (format))
+WX_DEFINE_SCANFUNC(wxScanf, 1, (const wchar_t *format),
+ wxCRT_ScanfW, (wxScanfConvertFormatW(format)))
+
+WX_DEFINE_SCANFUNC(wxFscanf, 2, (FILE *stream, const char *format),
+ wxCRT_FscanfA, (stream, format))
+WX_DEFINE_SCANFUNC(wxFscanf, 2, (FILE *stream, const wchar_t *format),
+ wxCRT_FscanfW, (stream, wxScanfConvertFormatW(format)))
+
+WX_DEFINE_SCANFUNC(wxSscanf, 2, (const char *str, const char *format),
+ wxCRT_SscanfA, (str, format))
+WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wchar_t *str, const wchar_t *format),
+ wxCRT_SscanfW, (str, wxScanfConvertFormatW(format)))
+WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxScopedCharBuffer& str, const char *format),
+ wxCRT_SscanfA, (str.data(), format))
+WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxScopedWCharBuffer& str, const wchar_t *format),
+ wxCRT_SscanfW, (str.data(), wxScanfConvertFormatW(format)))
+WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxString& str, const char *format),
+ wxCRT_SscanfA, (str.mb_str(), format))
+WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxString& str, const wchar_t *format),
+ wxCRT_SscanfW, (str.wc_str(), wxScanfConvertFormatW(format)))
+WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxCStrData& str, const char *format),
+ wxCRT_SscanfA, (str.AsCharBuf(), format))
+WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxCStrData& str, const wchar_t *format),
+ wxCRT_SscanfW, (str.AsWCharBuf(), wxScanfConvertFormatW(format)))
+
+// Visual C++ doesn't provide vsscanf()
+#ifndef __VISUALC___
+int WXDLLIMPEXP_BASE wxVsscanf(const char *str, const char *format, va_list ap);
+int WXDLLIMPEXP_BASE wxVsscanf(const wchar_t *str, const wchar_t *format, va_list ap);
+int WXDLLIMPEXP_BASE wxVsscanf(const wxScopedCharBuffer& str, const char *format, va_list ap);
+int WXDLLIMPEXP_BASE wxVsscanf(const wxScopedWCharBuffer& str, const wchar_t *format, va_list ap);
+int WXDLLIMPEXP_BASE wxVsscanf(const wxString& str, const char *format, va_list ap);
+int WXDLLIMPEXP_BASE wxVsscanf(const wxString& str, const wchar_t *format, va_list ap);
+int WXDLLIMPEXP_BASE wxVsscanf(const wxCStrData& str, const char *format, va_list ap);
+int WXDLLIMPEXP_BASE wxVsscanf(const wxCStrData& str, const wchar_t *format, va_list ap);
+#endif // !__VISUALC__
+
+#endif /* _WX_WXCRTVARARG_H_ */
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/wxhtml.h
+// Purpose: wxHTML library for wxWidgets
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_HTML_H_
+#define _WX_HTML_H_
+
+#include "wx/html/htmldefs.h"
+#include "wx/html/htmltag.h"
+#include "wx/html/htmlcell.h"
+#include "wx/html/htmlpars.h"
+#include "wx/html/htmlwin.h"
+#include "wx/html/winpars.h"
+#include "wx/filesys.h"
+#include "wx/html/helpctrl.h"
+
+#endif // __WXHTML_H__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/wxprec.h
+// Purpose: Includes the appropriate files for precompiled headers
+// Author: Julian Smart
+// Modified by:
+// Created: 01/02/97
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// compiler detection; includes setup.h
+#include "wx/defs.h"
+
+// check if to use precompiled headers: do it for most Windows compilers unless
+// explicitly disabled by defining NOPCH
+#if defined(__VISUALC__) || \
+ defined(__DMC__) || \
+ defined(__VISAGECPP__) || \
+ defined(__WATCOMC__) || \
+ defined(__BORLANDC__)
+
+
+ // If user did not request NOCPH and we're not building using configure
+ // then assume user wants precompiled headers.
+ #if !defined(NOPCH) && !defined(__WX_SETUP_H__)
+ #define WX_PRECOMP
+ #endif
+#endif
+
+// For some reason, this must be defined for common dialogs to work.
+#ifdef __WATCOMC__
+ #define INCLUDE_COMMDLG_H 1
+#endif
+
+#ifdef WX_PRECOMP
+
+// include "wx/chartype.h" first to ensure that UNICODE macro is correctly set
+// _before_ including <windows.h>
+#include "wx/chartype.h"
+
+// include standard Windows headers
+#if defined(__WINDOWS__)
+ #include "wx/msw/wrapwin.h"
+ #include "wx/msw/private.h"
+#endif
+#if defined(__WXMSW__)
+ #include "wx/msw/wrapcctl.h"
+ #include "wx/msw/wrapcdlg.h"
+ #include "wx/msw/missing.h"
+#endif
+
+// include <os2.h>
+#ifdef __OS2__
+# include "wx/os2/private.h"
+#endif
+
+// include the most common wx headers
+#include "wx/wx.h"
+
+#endif // WX_PRECOMP
--- /dev/null
+//////////////////////////////////////////////////////////////////////////////
+// Name: wx/xlocale.h
+// Purpose: Header to provide some xlocale wrappers
+// Author: Brian Vanderburg II, Vadim Zeitlin
+// Created: 2008-01-07
+// Copyright: (c) 2008 Brian Vanderburg II
+// 2008 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+/*
+ This header defines portable wrappers around xlocale foo_l() functions or
+ their MSVC proprietary _foo_l() equivalents when they are available and
+ implements these functions for the "C" locale [only] if they are not. This
+ allows the program running under the default user locale to still use "C"
+ locale for operations such as reading data from files where they are stored
+ using decimal point &c.
+
+ TODO: Currently only the character classification and transformation
+ functions and number <-> string functions, are implemented,
+ we also need at least
+ - formatted IO: scanf_l(), printf_l() &c
+ - time: strftime_l(), strptime_l()
+ */
+
+#ifndef _WX_XLOCALE_H_
+#define _WX_XLOCALE_H_
+
+#include "wx/defs.h" // wxUSE_XLOCALE
+
+#if wxUSE_XLOCALE
+
+#include "wx/crt.h" // Includes wx/chartype.h, wx/wxcrt.h(wx/string.h)
+#include "wx/intl.h" // wxLanguage
+
+// The platform-specific locale type
+// If wxXLocale_t is not defined, then only "C" locale support is provided
+#ifdef wxHAS_XLOCALE_SUPPORT
+ #if wxCHECK_VISUALC_VERSION(8) && !defined(__WXWINCE__)
+ typedef _locale_t wxXLocale_t;
+ #define wxXLOCALE_IDENT(name) _ ## name
+ #elif defined(HAVE_LOCALE_T)
+ #include <locale.h>
+ #include <xlocale.h>
+ #include <ctype.h>
+ #include <stdlib.h>
+
+ #if wxUSE_UNICODE
+ #include <wctype.h>
+ #endif
+
+ // Locale type and identifier name
+ typedef locale_t wxXLocale_t;
+
+ #define wxXLOCALE_IDENT(name) name
+ #else
+ #error "Unknown xlocale support"
+ #endif
+#endif // wxHAS_XLOCALE_SUPPORT
+
+
+// wxXLocale is a wrapper around the native type representing a locale.
+//
+// It is not to be confused with wxLocale, which handles actually changing the
+// locale, loading message catalogs, etc. This just stores a locale value.
+// The similarity of names is unfortunate, but there doesn't seem to be any
+// better alternative right now. Perhaps by wxWidgets 4.0 better naming could
+// be used, or this class could become wxLocale (a wrapper for the value), and
+// some other class could be used to load the language catalogs or something
+// that would be clearer
+#ifdef wxHAS_XLOCALE_SUPPORT
+
+class WXDLLIMPEXP_BASE wxXLocale
+{
+public:
+ // Construct an uninitialized locale
+ wxXLocale() { m_locale = NULL; }
+
+ // Construct from a symbolic language constant
+ wxXLocale(wxLanguage lang);
+
+ // Construct from the given language string
+ wxXLocale(const char *loc) { Init(loc); }
+
+ // Destroy the locale
+ ~wxXLocale() { Free(); }
+
+
+ // Get the global "C" locale object
+ static wxXLocale& GetCLocale();
+
+ // Check if the object represents a valid locale (notice that without
+ // wxHAS_XLOCALE_SUPPORT the only valid locale is the "C" one)
+ bool IsOk() const { return m_locale != NULL; }
+
+ // Get the type
+ wxXLocale_t Get() const { return m_locale; }
+
+ bool operator== (const wxXLocale& loc) const
+ { return m_locale == loc.m_locale; }
+
+private:
+ // Special ctor for the "C" locale, it's only used internally as the user
+ // code is supposed to use GetCLocale()
+ wxXLocale(struct wxXLocaleCTag * WXUNUSED(dummy)) { Init("C"); }
+
+ // Create from the given language string (called from ctors)
+ void Init(const char *loc);
+
+ // Free the locale if it's non-NULL
+ void Free();
+
+
+ // The corresponding locale handle, NULL if invalid
+ wxXLocale_t m_locale;
+
+
+ // POSIX xlocale API provides a duplocale() function but MSVC locale API
+ // doesn't give us any means to copy a _locale_t object so we reduce the
+ // functionality to least common denominator here -- it shouldn't be a
+ // problem as copying the locale objects shouldn't be often needed
+ wxDECLARE_NO_COPY_CLASS(wxXLocale);
+};
+
+#else // !wxHAS_XLOCALE_SUPPORT
+
+// Skeleton version supporting only the "C" locale for the systems without
+// xlocale support
+class WXDLLIMPEXP_BASE wxXLocale
+{
+public:
+ // Construct an uninitialized locale
+ wxXLocale() { m_isC = false; }
+
+ // Construct from a symbolic language constant: unless the language is
+ // wxLANGUAGE_ENGLISH_US (which we suppose to be the same as "C" locale)
+ // the object will be invalid
+ wxXLocale(wxLanguage lang)
+ {
+ m_isC = lang == wxLANGUAGE_ENGLISH_US;
+ }
+
+ // Construct from the given language string: unless the string is "C" or
+ // "POSIX" the object will be invalid
+ wxXLocale(const char *loc)
+ {
+ m_isC = loc && (strcmp(loc, "C") == 0 || strcmp(loc, "POSIX") == 0);
+ }
+
+ // Default copy ctor, assignment operator and dtor are ok (or would be if
+ // we didn't use DECLARE_NO_COPY_CLASS() for consistency with the xlocale
+ // version)
+
+
+ // Get the global "C" locale object
+ static wxXLocale& GetCLocale();
+
+ // Check if the object represents a valid locale (notice that without
+ // wxHAS_XLOCALE_SUPPORT the only valid locale is the "C" one)
+ bool IsOk() const { return m_isC; }
+
+private:
+ // Special ctor for the "C" locale, it's only used internally as the user
+ // code is supposed to use GetCLocale()
+ wxXLocale(struct wxXLocaleCTag * WXUNUSED(dummy)) { m_isC = true; }
+
+ // Without xlocale support this class can only represent "C" locale, if
+ // this is false the object is invalid
+ bool m_isC;
+
+
+ // although it's not a problem to copy the objects of this class, we use
+ // this macro in this implementation for consistency with the xlocale-based
+ // one which can't be copied when using MSVC locale API
+ wxDECLARE_NO_COPY_CLASS(wxXLocale);
+};
+
+#endif // wxHAS_XLOCALE_SUPPORT/!wxHAS_XLOCALE_SUPPORT
+
+
+// A shorter synonym for the most commonly used locale object
+#define wxCLocale (wxXLocale::GetCLocale())
+extern WXDLLIMPEXP_DATA_BASE(wxXLocale) wxNullXLocale;
+
+// Wrappers for various functions:
+#ifdef wxHAS_XLOCALE_SUPPORT
+
+ // ctype functions
+ #define wxCRT_Isalnum_lA wxXLOCALE_IDENT(isalnum_l)
+ #define wxCRT_Isalpha_lA wxXLOCALE_IDENT(isalpha_l)
+ #define wxCRT_Iscntrl_lA wxXLOCALE_IDENT(iscntrl_l)
+ #define wxCRT_Isdigit_lA wxXLOCALE_IDENT(isdigit_l)
+ #define wxCRT_Isgraph_lA wxXLOCALE_IDENT(isgraph_l)
+ #define wxCRT_Islower_lA wxXLOCALE_IDENT(islower_l)
+ #define wxCRT_Isprint_lA wxXLOCALE_IDENT(isprint_l)
+ #define wxCRT_Ispunct_lA wxXLOCALE_IDENT(ispunct_l)
+ #define wxCRT_Isspace_lA wxXLOCALE_IDENT(isspace_l)
+ #define wxCRT_Isupper_lA wxXLOCALE_IDENT(isupper_l)
+ #define wxCRT_Isxdigit_lA wxXLOCALE_IDENT(isxdigit_l)
+ #define wxCRT_Tolower_lA wxXLOCALE_IDENT(tolower_l)
+ #define wxCRT_Toupper_lA wxXLOCALE_IDENT(toupper_l)
+
+ inline int wxIsalnum_l(char c, const wxXLocale& loc)
+ { return wxCRT_Isalnum_lA(static_cast<unsigned char>(c), loc.Get()); }
+ inline int wxIsalpha_l(char c, const wxXLocale& loc)
+ { return wxCRT_Isalpha_lA(static_cast<unsigned char>(c), loc.Get()); }
+ inline int wxIscntrl_l(char c, const wxXLocale& loc)
+ { return wxCRT_Iscntrl_lA(static_cast<unsigned char>(c), loc.Get()); }
+ inline int wxIsdigit_l(char c, const wxXLocale& loc)
+ { return wxCRT_Isdigit_lA(static_cast<unsigned char>(c), loc.Get()); }
+ inline int wxIsgraph_l(char c, const wxXLocale& loc)
+ { return wxCRT_Isgraph_lA(static_cast<unsigned char>(c), loc.Get()); }
+ inline int wxIslower_l(char c, const wxXLocale& loc)
+ { return wxCRT_Islower_lA(static_cast<unsigned char>(c), loc.Get()); }
+ inline int wxIsprint_l(char c, const wxXLocale& loc)
+ { return wxCRT_Isprint_lA(static_cast<unsigned char>(c), loc.Get()); }
+ inline int wxIspunct_l(char c, const wxXLocale& loc)
+ { return wxCRT_Ispunct_lA(static_cast<unsigned char>(c), loc.Get()); }
+ inline int wxIsspace_l(char c, const wxXLocale& loc)
+ { return wxCRT_Isspace_lA(static_cast<unsigned char>(c), loc.Get()); }
+ inline int wxIsupper_l(char c, const wxXLocale& loc)
+ { return wxCRT_Isupper_lA(static_cast<unsigned char>(c), loc.Get()); }
+ inline int wxIsxdigit_l(char c, const wxXLocale& loc)
+ { return wxCRT_Isxdigit_lA(static_cast<unsigned char>(c), loc.Get()); }
+ inline int wxTolower_l(char c, const wxXLocale& loc)
+ { return wxCRT_Tolower_lA(static_cast<unsigned char>(c), loc.Get()); }
+ inline int wxToupper_l(char c, const wxXLocale& loc)
+ { return wxCRT_Toupper_lA(static_cast<unsigned char>(c), loc.Get()); }
+
+
+ // stdlib functions for numeric <-> string conversion
+ // NOTE: GNU libc does not have ato[fil]_l functions;
+ // MSVC++8 does not have _strto[u]ll_l functions;
+ // thus we take the minimal set of functions provided in both environments:
+
+ #define wxCRT_Strtod_lA wxXLOCALE_IDENT(strtod_l)
+ #define wxCRT_Strtol_lA wxXLOCALE_IDENT(strtol_l)
+ #define wxCRT_Strtoul_lA wxXLOCALE_IDENT(strtoul_l)
+
+ inline double wxStrtod_lA(const char *c, char **endptr, const wxXLocale& loc)
+ { return wxCRT_Strtod_lA(c, endptr, loc.Get()); }
+ inline long wxStrtol_lA(const char *c, char **endptr, int base, const wxXLocale& loc)
+ { return wxCRT_Strtol_lA(c, endptr, base, loc.Get()); }
+ inline unsigned long wxStrtoul_lA(const char *c, char **endptr, int base, const wxXLocale& loc)
+ { return wxCRT_Strtoul_lA(c, endptr, base, loc.Get()); }
+
+ #if wxUSE_UNICODE
+
+ // ctype functions
+ #define wxCRT_Isalnum_lW wxXLOCALE_IDENT(iswalnum_l)
+ #define wxCRT_Isalpha_lW wxXLOCALE_IDENT(iswalpha_l)
+ #define wxCRT_Iscntrl_lW wxXLOCALE_IDENT(iswcntrl_l)
+ #define wxCRT_Isdigit_lW wxXLOCALE_IDENT(iswdigit_l)
+ #define wxCRT_Isgraph_lW wxXLOCALE_IDENT(iswgraph_l)
+ #define wxCRT_Islower_lW wxXLOCALE_IDENT(iswlower_l)
+ #define wxCRT_Isprint_lW wxXLOCALE_IDENT(iswprint_l)
+ #define wxCRT_Ispunct_lW wxXLOCALE_IDENT(iswpunct_l)
+ #define wxCRT_Isspace_lW wxXLOCALE_IDENT(iswspace_l)
+ #define wxCRT_Isupper_lW wxXLOCALE_IDENT(iswupper_l)
+ #define wxCRT_Isxdigit_lW wxXLOCALE_IDENT(iswxdigit_l)
+ #define wxCRT_Tolower_lW wxXLOCALE_IDENT(towlower_l)
+ #define wxCRT_Toupper_lW wxXLOCALE_IDENT(towupper_l)
+
+ inline int wxIsalnum_l(wchar_t c, const wxXLocale& loc)
+ { return wxCRT_Isalnum_lW(c, loc.Get()); }
+ inline int wxIsalpha_l(wchar_t c, const wxXLocale& loc)
+ { return wxCRT_Isalpha_lW(c, loc.Get()); }
+ inline int wxIscntrl_l(wchar_t c, const wxXLocale& loc)
+ { return wxCRT_Iscntrl_lW(c, loc.Get()); }
+ inline int wxIsdigit_l(wchar_t c, const wxXLocale& loc)
+ { return wxCRT_Isdigit_lW(c, loc.Get()); }
+ inline int wxIsgraph_l(wchar_t c, const wxXLocale& loc)
+ { return wxCRT_Isgraph_lW(c, loc.Get()); }
+ inline int wxIslower_l(wchar_t c, const wxXLocale& loc)
+ { return wxCRT_Islower_lW(c, loc.Get()); }
+ inline int wxIsprint_l(wchar_t c, const wxXLocale& loc)
+ { return wxCRT_Isprint_lW(c, loc.Get()); }
+ inline int wxIspunct_l(wchar_t c, const wxXLocale& loc)
+ { return wxCRT_Ispunct_lW(c, loc.Get()); }
+ inline int wxIsspace_l(wchar_t c, const wxXLocale& loc)
+ { return wxCRT_Isspace_lW(c, loc.Get()); }
+ inline int wxIsupper_l(wchar_t c, const wxXLocale& loc)
+ { return wxCRT_Isupper_lW(c, loc.Get()); }
+ inline int wxIsxdigit_l(wchar_t c, const wxXLocale& loc)
+ { return wxCRT_Isxdigit_lW(c, loc.Get()); }
+ inline wchar_t wxTolower_l(wchar_t c, const wxXLocale& loc)
+ { return wxCRT_Tolower_lW(c, loc.Get()); }
+ inline wchar_t wxToupper_l(wchar_t c, const wxXLocale& loc)
+ { return wxCRT_Toupper_lW(c, loc.Get()); }
+
+
+ // stdlib functions for numeric <-> string conversion
+ // (see notes above about missing functions)
+ #define wxCRT_Strtod_lW wxXLOCALE_IDENT(wcstod_l)
+ #define wxCRT_Strtol_lW wxXLOCALE_IDENT(wcstol_l)
+ #define wxCRT_Strtoul_lW wxXLOCALE_IDENT(wcstoul_l)
+
+ inline double wxStrtod_l(const wchar_t *c, wchar_t **endptr, const wxXLocale& loc)
+ { return wxCRT_Strtod_lW(c, endptr, loc.Get()); }
+ inline long wxStrtol_l(const wchar_t *c, wchar_t **endptr, int base, const wxXLocale& loc)
+ { return wxCRT_Strtol_lW(c, endptr, base, loc.Get()); }
+ inline unsigned long wxStrtoul_l(const wchar_t *c, wchar_t **endptr, int base, const wxXLocale& loc)
+ { return wxCRT_Strtoul_lW(c, endptr, base, loc.Get()); }
+ #else // !wxUSE_UNICODE
+ inline double wxStrtod_l(const char *c, char **endptr, const wxXLocale& loc)
+ { return wxCRT_Strtod_lA(c, endptr, loc.Get()); }
+ inline long wxStrtol_l(const char *c, char **endptr, int base, const wxXLocale& loc)
+ { return wxCRT_Strtol_lA(c, endptr, base, loc.Get()); }
+ inline unsigned long wxStrtoul_l(const char *c, char **endptr, int base, const wxXLocale& loc)
+ { return wxCRT_Strtoul_lA(c, endptr, base, loc.Get()); }
+ #endif // wxUSE_UNICODE
+#else // !wxHAS_XLOCALE_SUPPORT
+ // ctype functions
+ int WXDLLIMPEXP_BASE wxIsalnum_l(const wxUniChar& c, const wxXLocale& loc);
+ int WXDLLIMPEXP_BASE wxIsalpha_l(const wxUniChar& c, const wxXLocale& loc);
+ int WXDLLIMPEXP_BASE wxIscntrl_l(const wxUniChar& c, const wxXLocale& loc);
+ int WXDLLIMPEXP_BASE wxIsdigit_l(const wxUniChar& c, const wxXLocale& loc);
+ int WXDLLIMPEXP_BASE wxIsgraph_l(const wxUniChar& c, const wxXLocale& loc);
+ int WXDLLIMPEXP_BASE wxIslower_l(const wxUniChar& c, const wxXLocale& loc);
+ int WXDLLIMPEXP_BASE wxIsprint_l(const wxUniChar& c, const wxXLocale& loc);
+ int WXDLLIMPEXP_BASE wxIspunct_l(const wxUniChar& c, const wxXLocale& loc);
+ int WXDLLIMPEXP_BASE wxIsspace_l(const wxUniChar& c, const wxXLocale& loc);
+ int WXDLLIMPEXP_BASE wxIsupper_l(const wxUniChar& c, const wxXLocale& loc);
+ int WXDLLIMPEXP_BASE wxIsxdigit_l(const wxUniChar& c, const wxXLocale& loc);
+ int WXDLLIMPEXP_BASE wxTolower_l(const wxUniChar& c, const wxXLocale& loc);
+ int WXDLLIMPEXP_BASE wxToupper_l(const wxUniChar& c, const wxXLocale& loc);
+
+ // stdlib functions
+ double WXDLLIMPEXP_BASE wxStrtod_l(const wchar_t* str, wchar_t **endptr, const wxXLocale& loc);
+ double WXDLLIMPEXP_BASE wxStrtod_l(const char* str, char **endptr, const wxXLocale& loc);
+ long WXDLLIMPEXP_BASE wxStrtol_l(const wchar_t* str, wchar_t **endptr, int base, const wxXLocale& loc);
+ long WXDLLIMPEXP_BASE wxStrtol_l(const char* str, char **endptr, int base, const wxXLocale& loc);
+ unsigned long WXDLLIMPEXP_BASE wxStrtoul_l(const wchar_t* str, wchar_t **endptr, int base, const wxXLocale& loc);
+ unsigned long WXDLLIMPEXP_BASE wxStrtoul_l(const char* str, char **endptr, int base, const wxXLocale& loc);
+
+#endif // wxHAS_XLOCALE_SUPPORT/!wxHAS_XLOCALE_SUPPORT
+
+#endif // wxUSE_XLOCALE
+
+#endif // _WX_XLOCALE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xml/xml.h
+// Purpose: wxXmlDocument - XML parser & data holder class
+// Author: Vaclav Slavik
+// Created: 2000/03/05
+// Copyright: (c) 2000 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef _WX_XML_H_
+#define _WX_XML_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_XML
+
+#include "wx/string.h"
+#include "wx/object.h"
+#include "wx/list.h"
+#include "wx/versioninfo.h"
+
+#ifdef WXMAKINGDLL_XML
+ #define WXDLLIMPEXP_XML WXEXPORT
+#elif defined(WXUSINGDLL)
+ #define WXDLLIMPEXP_XML WXIMPORT
+#else // not making nor using DLL
+ #define WXDLLIMPEXP_XML
+#endif
+
+class WXDLLIMPEXP_FWD_XML wxXmlNode;
+class WXDLLIMPEXP_FWD_XML wxXmlAttribute;
+class WXDLLIMPEXP_FWD_XML wxXmlDocument;
+class WXDLLIMPEXP_FWD_XML wxXmlIOHandler;
+class WXDLLIMPEXP_FWD_BASE wxInputStream;
+class WXDLLIMPEXP_FWD_BASE wxOutputStream;
+
+// Represents XML node type.
+enum wxXmlNodeType
+{
+ // note: values are synchronized with xmlElementType from libxml
+ wxXML_ELEMENT_NODE = 1,
+ wxXML_ATTRIBUTE_NODE = 2,
+ wxXML_TEXT_NODE = 3,
+ wxXML_CDATA_SECTION_NODE = 4,
+ wxXML_ENTITY_REF_NODE = 5,
+ wxXML_ENTITY_NODE = 6,
+ wxXML_PI_NODE = 7,
+ wxXML_COMMENT_NODE = 8,
+ wxXML_DOCUMENT_NODE = 9,
+ wxXML_DOCUMENT_TYPE_NODE = 10,
+ wxXML_DOCUMENT_FRAG_NODE = 11,
+ wxXML_NOTATION_NODE = 12,
+ wxXML_HTML_DOCUMENT_NODE = 13
+};
+
+
+// Represents node property(ies).
+// Example: in <img src="hello.gif" id="3"/> "src" is property with value
+// "hello.gif" and "id" is prop. with value "3".
+
+class WXDLLIMPEXP_XML wxXmlAttribute
+{
+public:
+ wxXmlAttribute() : m_next(NULL) {}
+ wxXmlAttribute(const wxString& name, const wxString& value,
+ wxXmlAttribute *next = NULL)
+ : m_name(name), m_value(value), m_next(next) {}
+ virtual ~wxXmlAttribute() {}
+
+ const wxString& GetName() const { return m_name; }
+ const wxString& GetValue() const { return m_value; }
+ wxXmlAttribute *GetNext() const { return m_next; }
+
+ void SetName(const wxString& name) { m_name = name; }
+ void SetValue(const wxString& value) { m_value = value; }
+ void SetNext(wxXmlAttribute *next) { m_next = next; }
+
+private:
+ wxString m_name;
+ wxString m_value;
+ wxXmlAttribute *m_next;
+};
+
+#if WXWIN_COMPATIBILITY_2_8
+ // NB: #define is used instead of typedef so that forward declarations
+ // continue to work
+ #define wxXmlProperty wxXmlAttribute
+#endif
+
+
+// Represents node in XML document. Node has name and may have content and
+// attributes. Most common node types are wxXML_TEXT_NODE (name and attributes
+// are irrelevant) and wxXML_ELEMENT_NODE (e.g. in <title>hi</title> there is
+// element with name="title", irrelevant content and one child (wxXML_TEXT_NODE
+// with content="hi").
+//
+// If wxUSE_UNICODE is 0, all strings are encoded in the encoding given to Load
+// (default is UTF-8).
+
+class WXDLLIMPEXP_XML wxXmlNode
+{
+public:
+ wxXmlNode()
+ : m_attrs(NULL), m_parent(NULL), m_children(NULL), m_next(NULL),
+ m_lineNo(-1), m_noConversion(false)
+ {
+ }
+
+ wxXmlNode(wxXmlNode *parent, wxXmlNodeType type,
+ const wxString& name, const wxString& content = wxEmptyString,
+ wxXmlAttribute *attrs = NULL, wxXmlNode *next = NULL,
+ int lineNo = -1);
+
+ virtual ~wxXmlNode();
+
+ // copy ctor & operator=. Note that this does NOT copy siblings
+ // and parent pointer, i.e. m_parent and m_next will be NULL
+ // after using copy ctor and are never unmodified by operator=.
+ // On the other hand, it DOES copy children and attributes.
+ wxXmlNode(const wxXmlNode& node);
+ wxXmlNode& operator=(const wxXmlNode& node);
+
+ // user-friendly creation:
+ wxXmlNode(wxXmlNodeType type, const wxString& name,
+ const wxString& content = wxEmptyString,
+ int lineNo = -1);
+ virtual void AddChild(wxXmlNode *child);
+ virtual bool InsertChild(wxXmlNode *child, wxXmlNode *followingNode);
+ virtual bool InsertChildAfter(wxXmlNode *child, wxXmlNode *precedingNode);
+ virtual bool RemoveChild(wxXmlNode *child);
+ virtual void AddAttribute(const wxString& name, const wxString& value);
+ virtual bool DeleteAttribute(const wxString& name);
+
+ // access methods:
+ wxXmlNodeType GetType() const { return m_type; }
+ const wxString& GetName() const { return m_name; }
+ const wxString& GetContent() const { return m_content; }
+
+ bool IsWhitespaceOnly() const;
+ int GetDepth(wxXmlNode *grandparent = NULL) const;
+
+ // Gets node content from wxXML_ENTITY_NODE
+ // The problem is, <tag>content<tag> is represented as
+ // wxXML_ENTITY_NODE name="tag", content=""
+ // |-- wxXML_TEXT_NODE or
+ // wxXML_CDATA_SECTION_NODE name="" content="content"
+ wxString GetNodeContent() const;
+
+ wxXmlNode *GetParent() const { return m_parent; }
+ wxXmlNode *GetNext() const { return m_next; }
+ wxXmlNode *GetChildren() const { return m_children; }
+
+ wxXmlAttribute *GetAttributes() const { return m_attrs; }
+ bool GetAttribute(const wxString& attrName, wxString *value) const;
+ wxString GetAttribute(const wxString& attrName,
+ const wxString& defaultVal = wxEmptyString) const;
+ bool HasAttribute(const wxString& attrName) const;
+
+ int GetLineNumber() const { return m_lineNo; }
+
+ void SetType(wxXmlNodeType type) { m_type = type; }
+ void SetName(const wxString& name) { m_name = name; }
+ void SetContent(const wxString& con) { m_content = con; }
+
+ void SetParent(wxXmlNode *parent) { m_parent = parent; }
+ void SetNext(wxXmlNode *next) { m_next = next; }
+ void SetChildren(wxXmlNode *child) { m_children = child; }
+
+ void SetAttributes(wxXmlAttribute *attr) { m_attrs = attr; }
+ virtual void AddAttribute(wxXmlAttribute *attr);
+
+ // If true, don't do encoding conversion to improve efficiency - node content is ACII text
+ bool GetNoConversion() const { return m_noConversion; }
+ void SetNoConversion(bool noconversion) { m_noConversion = noconversion; }
+
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED( inline wxXmlAttribute *GetProperties() const );
+ wxDEPRECATED( inline bool GetPropVal(const wxString& propName,
+ wxString *value) const );
+ wxDEPRECATED( inline wxString GetPropVal(const wxString& propName,
+ const wxString& defaultVal) const );
+ wxDEPRECATED( inline bool HasProp(const wxString& propName) const );
+
+ wxDEPRECATED( inline void SetProperties(wxXmlAttribute *prop) );
+#endif // WXWIN_COMPATIBILITY_2_8
+
+ // The following three functions are backward compatibility, but because
+ // they were virtual, we must make it possible to override them. This
+ // is done by calling e.g. AddProperty() from AddAttribute(), so we have
+ // to keep AddProperty() even if 2.8 compatibility is off. To prevent
+ // old code from compiling in that case, we make them private and
+ // non-virtual. (This can be removed when WXWIN_COMPATIBILITY_2_8 is
+ // removed, we'll have just *Attribute versions then.)
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED_BUT_USED_INTERNALLY(
+ virtual void AddProperty(const wxString& name, const wxString& value) );
+ wxDEPRECATED_BUT_USED_INTERNALLY(
+ virtual bool DeleteProperty(const wxString& name) );
+ wxDEPRECATED_BUT_USED_INTERNALLY(
+ virtual void AddProperty(wxXmlAttribute *attr) );
+#else
+private:
+ void AddProperty(const wxString& name, const wxString& value);
+ bool DeleteProperty(const wxString& name);
+ void AddProperty(wxXmlAttribute *attr);
+#endif // WXWIN_COMPATIBILITY_2_8/!WXWIN_COMPATIBILITY_2_8
+
+private:
+ wxXmlNodeType m_type;
+ wxString m_name;
+ wxString m_content;
+ wxXmlAttribute *m_attrs;
+ wxXmlNode *m_parent, *m_children, *m_next;
+ int m_lineNo; // line number in original file, or -1
+ bool m_noConversion; // don't do encoding conversion - node is plain text
+
+ void DoFree();
+ void DoCopy(const wxXmlNode& node);
+};
+
+#if WXWIN_COMPATIBILITY_2_8
+inline wxXmlAttribute *wxXmlNode::GetProperties() const
+ { return GetAttributes(); }
+inline bool wxXmlNode::GetPropVal(const wxString& propName,
+ wxString *value) const
+ { return GetAttribute(propName, value); }
+inline wxString wxXmlNode::GetPropVal(const wxString& propName,
+ const wxString& defaultVal) const
+ { return GetAttribute(propName, defaultVal); }
+inline bool wxXmlNode::HasProp(const wxString& propName) const
+ { return HasAttribute(propName); }
+inline void wxXmlNode::SetProperties(wxXmlAttribute *prop)
+ { SetAttributes(prop); }
+#endif // WXWIN_COMPATIBILITY_2_8
+
+
+
+// special indentation value for wxXmlDocument::Save
+#define wxXML_NO_INDENTATION (-1)
+
+// flags for wxXmlDocument::Load
+enum wxXmlDocumentLoadFlag
+{
+ wxXMLDOC_NONE = 0,
+ wxXMLDOC_KEEP_WHITESPACE_NODES = 1
+};
+
+
+// This class holds XML data/document as parsed by XML parser.
+
+class WXDLLIMPEXP_XML wxXmlDocument : public wxObject
+{
+public:
+ wxXmlDocument();
+ wxXmlDocument(const wxString& filename,
+ const wxString& encoding = wxT("UTF-8"));
+ wxXmlDocument(wxInputStream& stream,
+ const wxString& encoding = wxT("UTF-8"));
+ virtual ~wxXmlDocument() { wxDELETE(m_docNode); }
+
+ wxXmlDocument(const wxXmlDocument& doc);
+ wxXmlDocument& operator=(const wxXmlDocument& doc);
+
+ // Parses .xml file and loads data. Returns TRUE on success, FALSE
+ // otherwise.
+ virtual bool Load(const wxString& filename,
+ const wxString& encoding = wxT("UTF-8"), int flags = wxXMLDOC_NONE);
+ virtual bool Load(wxInputStream& stream,
+ const wxString& encoding = wxT("UTF-8"), int flags = wxXMLDOC_NONE);
+
+ // Saves document as .xml file.
+ virtual bool Save(const wxString& filename, int indentstep = 2) const;
+ virtual bool Save(wxOutputStream& stream, int indentstep = 2) const;
+
+ bool IsOk() const { return GetRoot() != NULL; }
+
+ // Returns root node of the document.
+ wxXmlNode *GetRoot() const;
+ // Returns the document node.
+ wxXmlNode *GetDocumentNode() const { return m_docNode; }
+
+
+ // Returns version of document (may be empty).
+ const wxString& GetVersion() const { return m_version; }
+ // Returns encoding of document (may be empty).
+ // Note: this is the encoding original file was saved in, *not* the
+ // encoding of in-memory representation!
+ const wxString& GetFileEncoding() const { return m_fileEncoding; }
+
+ // Write-access methods:
+ wxXmlNode *DetachDocumentNode() { wxXmlNode *old=m_docNode; m_docNode=NULL; return old; }
+ void SetDocumentNode(wxXmlNode *node) { wxDELETE(m_docNode); m_docNode = node; }
+ wxXmlNode *DetachRoot();
+ void SetRoot(wxXmlNode *node);
+ void SetVersion(const wxString& version) { m_version = version; }
+ void SetFileEncoding(const wxString& encoding) { m_fileEncoding = encoding; }
+ void AppendToProlog(wxXmlNode *node);
+
+#if !wxUSE_UNICODE
+ // Returns encoding of in-memory representation of the document
+ // (same as passed to Load or ctor, defaults to UTF-8).
+ // NB: this is meaningless in Unicode build where data are stored as wchar_t*
+ wxString GetEncoding() const { return m_encoding; }
+ void SetEncoding(const wxString& enc) { m_encoding = enc; }
+#endif
+
+ static wxVersionInfo GetLibraryVersionInfo();
+
+private:
+ wxString m_version;
+ wxString m_fileEncoding;
+#if !wxUSE_UNICODE
+ wxString m_encoding;
+#endif
+ wxXmlNode *m_docNode;
+
+ void DoCopy(const wxXmlDocument& doc);
+
+ DECLARE_CLASS(wxXmlDocument)
+};
+
+#endif // wxUSE_XML
+
+#endif // _WX_XML_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xpmdecod.h
+// Purpose: wxXPMDecoder, XPM reader for wxImage and wxBitmap
+// Author: Vaclav Slavik
+// Copyright: (c) 2001 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XPMDECOD_H_
+#define _WX_XPMDECOD_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_IMAGE && wxUSE_XPM
+
+class WXDLLIMPEXP_FWD_CORE wxImage;
+class WXDLLIMPEXP_FWD_BASE wxInputStream;
+
+// --------------------------------------------------------------------------
+// wxXPMDecoder class
+// --------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxXPMDecoder
+{
+public:
+ // constructor, destructor, etc.
+ wxXPMDecoder() {}
+ ~wxXPMDecoder() {}
+
+#if wxUSE_STREAMS
+ // Is the stream XPM file?
+ // NOTE: this function modifies the current stream position
+ bool CanRead(wxInputStream& stream);
+
+ // Read XPM file from the stream, parse it and create image from it
+ wxImage ReadFile(wxInputStream& stream);
+#endif
+
+ // Read directly from XPM data (as passed to wxBitmap ctor):
+ wxImage ReadData(const char* const* xpm_data);
+
+#ifdef __BORLANDC__
+ // needed for Borland 5.5
+ wxImage ReadData(char** xpm_data)
+ { return ReadData(const_cast<const char* const*>(xpm_data)); }
+#endif
+};
+
+#endif // wxUSE_IMAGE && wxUSE_XPM
+
+#endif // _WX_XPM_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xpmhand.h
+// Purpose: XPM handler base header
+// Author: Julian Smart
+// Modified by:
+// Created:
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XPMHAND_H_BASE_
+#define _WX_XPMHAND_H_BASE_
+
+// Only wxMSW and wxPM currently defines a separate XPM handler, since
+// mostly Windows and Presentation Manager apps won't need XPMs.
+#if defined(__WXMSW__)
+#error xpmhand.h is no longer needed since wxImage now handles XPMs.
+#endif
+#if defined(__WXPM__)
+#include "wx/os2/xpmhand.h"
+#endif
+
+#endif
+ // _WX_XPMHAND_H_BASE_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_all.h
+// Purpose: includes all xh_*.h files
+// Author: Vaclav Slavik
+// Created: 2000/03/05
+// Copyright: (c) 2000 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_ALL_H_
+#define _WX_XH_ALL_H_
+
+
+// Existing handlers:
+
+#include "wx/xrc/xh_animatctrl.h"
+#include "wx/xrc/xh_bannerwindow.h"
+#include "wx/xrc/xh_bmp.h"
+#include "wx/xrc/xh_bmpbt.h"
+#include "wx/xrc/xh_bmpcbox.h"
+#include "wx/xrc/xh_bttn.h"
+#include "wx/xrc/xh_cald.h"
+#include "wx/xrc/xh_chckb.h"
+#include "wx/xrc/xh_chckl.h"
+#include "wx/xrc/xh_choic.h"
+#include "wx/xrc/xh_choicbk.h"
+#include "wx/xrc/xh_clrpicker.h"
+#include "wx/xrc/xh_cmdlinkbn.h"
+#include "wx/xrc/xh_collpane.h"
+#include "wx/xrc/xh_combo.h"
+#include "wx/xrc/xh_comboctrl.h"
+#include "wx/xrc/xh_datectrl.h"
+#include "wx/xrc/xh_dirpicker.h"
+#include "wx/xrc/xh_dlg.h"
+#include "wx/xrc/xh_editlbox.h"
+#include "wx/xrc/xh_filectrl.h"
+#include "wx/xrc/xh_filepicker.h"
+#include "wx/xrc/xh_fontpicker.h"
+#include "wx/xrc/xh_frame.h"
+#include "wx/xrc/xh_gauge.h"
+#include "wx/xrc/xh_gdctl.h"
+#include "wx/xrc/xh_grid.h"
+#include "wx/xrc/xh_html.h"
+#include "wx/xrc/xh_htmllbox.h"
+#include "wx/xrc/xh_hyperlink.h"
+#include "wx/xrc/xh_listb.h"
+#include "wx/xrc/xh_listc.h"
+#include "wx/xrc/xh_listbk.h"
+#include "wx/xrc/xh_mdi.h"
+#include "wx/xrc/xh_menu.h"
+#include "wx/xrc/xh_notbk.h"
+#include "wx/xrc/xh_odcombo.h"
+#include "wx/xrc/xh_panel.h"
+#include "wx/xrc/xh_propdlg.h"
+#include "wx/xrc/xh_radbt.h"
+#include "wx/xrc/xh_radbx.h"
+#include "wx/xrc/xh_scrol.h"
+#include "wx/xrc/xh_scwin.h"
+#include "wx/xrc/xh_sizer.h"
+#include "wx/xrc/xh_slidr.h"
+#include "wx/xrc/xh_spin.h"
+#include "wx/xrc/xh_split.h"
+#include "wx/xrc/xh_srchctrl.h"
+#include "wx/xrc/xh_statbar.h"
+#include "wx/xrc/xh_stbox.h"
+#include "wx/xrc/xh_stbmp.h"
+#include "wx/xrc/xh_sttxt.h"
+#include "wx/xrc/xh_stlin.h"
+#include "wx/xrc/xh_text.h"
+#include "wx/xrc/xh_tglbtn.h"
+#include "wx/xrc/xh_timectrl.h"
+#include "wx/xrc/xh_toolb.h"
+#include "wx/xrc/xh_toolbk.h"
+#include "wx/xrc/xh_tree.h"
+#include "wx/xrc/xh_treebk.h"
+#include "wx/xrc/xh_unkwn.h"
+#include "wx/xrc/xh_wizrd.h"
+
+#endif // _WX_XH_ALL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_animatctrl.h
+// Purpose: XML resource handler for wxAnimationCtrl
+// Author: Francesco Montorsi
+// Created: 2006-10-15
+// Copyright: (c) 2006 Francesco Montorsi
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_ANIMATIONCTRL_H_
+#define _WX_XH_ANIMATIONCTRL_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_ANIMATIONCTRL
+
+class WXDLLIMPEXP_XRC wxAnimationCtrlXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxAnimationCtrlXmlHandler)
+
+public:
+ wxAnimationCtrlXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_ANIMATIONCTRL
+
+#endif // _WX_XH_ANIMATIONCTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_auinotbk.h
+// Purpose: XML resource handler for wxAuiNotebook
+// Author: Steve Lamerton
+// Created: 2009-06-12
+// Copyright: (c) 2009 Steve Lamerton
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XRC_XH_AUINOTEBOOK_H_
+#define _WX_XRC_XH_AUINOTEBOOK_H_
+
+#include "wx/xrc/xmlres.h"
+
+class WXDLLIMPEXP_FWD_AUI wxAuiNotebook;
+
+#if wxUSE_XRC && wxUSE_AUI
+
+class WXDLLIMPEXP_AUI wxAuiNotebookXmlHandler : public wxXmlResourceHandler
+{
+public:
+ wxAuiNotebookXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ bool m_isInside;
+ wxAuiNotebook *m_notebook;
+
+ wxDECLARE_DYNAMIC_CLASS(wxAuiNotebookXmlHandler);
+};
+
+#endif // wxUSE_XRC && wxUSE_AUI
+
+#endif // _WX_XRC_XH_AUINOTEBOOK_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_bannerwindow.h
+// Purpose: Declaration of wxBannerWindow XRC handler.
+// Author: Vadim Zeitlin
+// Created: 2011-08-16
+// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_BANNERWINDOW_H_
+#define _WX_XH_BANNERWINDOW_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_BANNERWINDOW
+
+class WXDLLIMPEXP_XRC wxBannerWindowXmlHandler : public wxXmlResourceHandler
+{
+public:
+ wxBannerWindowXmlHandler();
+
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+ wxDECLARE_DYNAMIC_CLASS(wxBannerWindowXmlHandler);
+};
+
+#endif // wxUSE_XRC && wxUSE_BANNERWINDOW
+
+#endif // _WX_XH_BANNERWINDOW_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_bmp.h
+// Purpose: XML resource handler for wxBitmap and wxIcon
+// Author: Vaclav Slavik
+// Created: 2000/09/00
+// Copyright: (c) 2000 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_BMP_H_
+#define _WX_XH_BMP_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC
+
+class WXDLLIMPEXP_XRC wxBitmapXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxBitmapXmlHandler)
+
+public:
+ wxBitmapXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+class WXDLLIMPEXP_XRC wxIconXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxIconXmlHandler)
+
+public:
+ wxIconXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC
+
+#endif // _WX_XH_BMP_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_bmpbt.h
+// Purpose: XML resource handler for bitmap buttons
+// Author: Brian Gavin
+// Created: 2000/03/05
+// Copyright: (c) 2000 Brian Gavin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_BMPBT_H_
+#define _WX_XH_BMPBT_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_BMPBUTTON
+
+class WXDLLIMPEXP_XRC wxBitmapButtonXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxBitmapButtonXmlHandler)
+
+public:
+ wxBitmapButtonXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_BMPBUTTON
+
+#endif // _WX_XH_BMPBT_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_bmpcbox.h
+// Purpose: XML resource handler for wxBitmapComboBox
+// Author: Jaakko Salli
+// Created: Sep-10-2006
+// Copyright: (c) 2006 Jaakko Salli
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_BMPCBOX_H_
+#define _WX_XH_BMPCBOX_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_BITMAPCOMBOBOX
+
+class WXDLLIMPEXP_FWD_ADV wxBitmapComboBox;
+
+class WXDLLIMPEXP_XRC wxBitmapComboBoxXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxBitmapComboBoxXmlHandler)
+
+public:
+ wxBitmapComboBoxXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ wxBitmapComboBox* m_combobox;
+ bool m_isInside;
+};
+
+#endif // wxUSE_XRC && wxUSE_BITMAPCOMBOBOX
+
+#endif // _WX_XH_BMPCBOX_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_bttn.h
+// Purpose: XML resource handler for buttons
+// Author: Vaclav Slavik
+// Created: 2000/03/05
+// Copyright: (c) 2000 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_BTTN_H_
+#define _WX_XH_BTTN_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_BUTTON
+
+class WXDLLIMPEXP_XRC wxButtonXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxButtonXmlHandler)
+
+public:
+ wxButtonXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_BUTTON
+
+#endif // _WX_XH_BTTN_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_cald.h
+// Purpose: XML resource handler for wxCalendarCtrl
+// Author: Brian Gavin
+// Created: 2000/09/09
+// Copyright: (c) 2000 Brian Gavin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_CALD_H_
+#define _WX_XH_CALD_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_CALENDARCTRL
+
+class WXDLLIMPEXP_XRC wxCalendarCtrlXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxCalendarCtrlXmlHandler)
+
+public:
+ wxCalendarCtrlXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_CALENDARCTRL
+
+#endif // _WX_XH_CALD_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_chckb.h
+// Purpose: XML resource handler for wxCheckBox
+// Author: Bob Mitchell
+// Created: 2000/03/21
+// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_CHCKB_H_
+#define _WX_XH_CHCKB_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_CHECKBOX
+
+class WXDLLIMPEXP_XRC wxCheckBoxXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxCheckBoxXmlHandler)
+
+public:
+ wxCheckBoxXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_CHECKBOX
+
+#endif // _WX_XH_CHECKBOX_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_chckl.h
+// Purpose: XML resource handler for wxCheckListBox
+// Author: Bob Mitchell
+// Created: 2000/03/21
+// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_CHCKL_H_
+#define _WX_XH_CHCKL_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_CHECKLISTBOX
+
+class WXDLLIMPEXP_XRC wxCheckListBoxXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxCheckListBoxXmlHandler)
+
+public:
+ wxCheckListBoxXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ bool m_insideBox;
+ wxArrayString strList;
+};
+
+#endif // wxUSE_XRC && wxUSE_CHECKLISTBOX
+
+#endif // _WX_XH_CHECKLIST_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_choic.h
+// Purpose: XML resource handler for wxChoice
+// Author: Bob Mitchell
+// Created: 2000/03/21
+// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_CHOIC_H_
+#define _WX_XH_CHOIC_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_CHOICE
+
+class WXDLLIMPEXP_XRC wxChoiceXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxChoiceXmlHandler)
+
+public:
+ wxChoiceXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ bool m_insideBox;
+ wxArrayString strList;
+};
+
+#endif // wxUSE_XRC && wxUSE_CHOICE
+
+#endif // _WX_XH_CHOIC_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_choicbk.h
+// Purpose: XML resource handler for wxChoicebook
+// Author: Vaclav Slavik
+// Copyright: (c) 2000 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_CHOICEBK_H_
+#define _WX_XH_CHOICEBK_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_CHOICEBOOK
+
+class WXDLLIMPEXP_FWD_CORE wxChoicebook;
+
+class WXDLLIMPEXP_XRC wxChoicebookXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxChoicebookXmlHandler)
+
+public:
+ wxChoicebookXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ bool m_isInside;
+ wxChoicebook *m_choicebook;
+};
+
+#endif // wxUSE_XRC && wxUSE_CHOICEBOOK
+
+#endif // _WX_XH_CHOICEBK_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_clrpicker.h
+// Purpose: XML resource handler for wxColourPickerCtrl
+// Author: Francesco Montorsi
+// Created: 2006-04-17
+// Copyright: (c) 2006 Francesco Montorsi
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_CLRPICKERCTRL_H_
+#define _WX_XH_CLRPICKERCTRL_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_COLOURPICKERCTRL
+
+class WXDLLIMPEXP_XRC wxColourPickerCtrlXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxColourPickerCtrlXmlHandler)
+
+public:
+ wxColourPickerCtrlXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_COLOURPICKERCTRL
+
+#endif // _WX_XH_CLRPICKERCTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_cmdlinkbn.h
+// Purpose: XML resource handler for command link buttons
+// Author: Kinaou Herve
+// Created: 2010-10-20
+// Copyright: (c) 2010 wxWidgets development team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_CMDLINKBN_H_
+#define _WX_XH_CMDLINKBN_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_COMMANDLINKBUTTON
+
+class WXDLLIMPEXP_XRC wxCommandLinkButtonXmlHandler : public wxXmlResourceHandler
+{
+public:
+ wxCommandLinkButtonXmlHandler();
+
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ wxDECLARE_DYNAMIC_CLASS(wxCommandLinkButtonXmlHandler);
+};
+
+#endif // wxUSE_XRC && wxUSE_COMMANDLINKBUTTON
+
+#endif // _WX_XH_CMDLINKBN_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_collpane.h
+// Purpose: XML resource handler for wxCollapsiblePane
+// Author: Francesco Montorsi
+// Created: 2006-10-27
+// Copyright: (c) 2006 Francesco Montorsi
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_COLLPANE_H_
+#define _WX_XH_COLLPANE_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_COLLPANE
+
+class WXDLLIMPEXP_FWD_CORE wxCollapsiblePane;
+
+class WXDLLIMPEXP_XRC wxCollapsiblePaneXmlHandler : public wxXmlResourceHandler
+{
+public:
+ wxCollapsiblePaneXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ bool m_isInside;
+ wxCollapsiblePane *m_collpane;
+
+ DECLARE_DYNAMIC_CLASS(wxCollapsiblePaneXmlHandler)
+};
+
+#endif // wxUSE_XRC && wxUSE_COLLPANE
+
+#endif // _WX_XH_COLLPANE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_combo.h
+// Purpose: XML resource handler for wxComboBox
+// Author: Bob Mitchell
+// Created: 2000/03/21
+// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_COMBO_H_
+#define _WX_XH_COMBO_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_COMBOBOX
+
+class WXDLLIMPEXP_XRC wxComboBoxXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxComboBoxXmlHandler)
+
+public:
+ wxComboBoxXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ bool m_insideBox;
+ wxArrayString strList;
+};
+
+#endif // wxUSE_XRC && wxUSE_COMBOBOX
+
+#endif // _WX_XH_COMBO_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_comboctrl.h
+// Purpose: XML resource handler for wxComboBox
+// Author: Jaakko Salli
+// Created: 2009/01/25
+// Copyright: (c) 2009 Jaakko Salli
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_COMBOCTRL_H_
+#define _WX_XH_COMBOCTRL_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_COMBOCTRL
+
+class WXDLLIMPEXP_XRC wxComboCtrlXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxComboCtrlXmlHandler)
+
+public:
+ wxComboCtrlXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+};
+
+#endif // wxUSE_XRC && wxUSE_COMBOCTRL
+
+#endif // _WX_XH_COMBOCTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_datectrl.h
+// Purpose: XML resource handler for wxDatePickerCtrl
+// Author: Vaclav Slavik
+// Created: 2005-02-07
+// Copyright: (c) 2005 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_DATECTRL_H_
+#define _WX_XH_DATECTRL_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_DATEPICKCTRL
+
+class WXDLLIMPEXP_XRC wxDateCtrlXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxDateCtrlXmlHandler)
+
+public:
+ wxDateCtrlXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_DATEPICKCTRL
+
+#endif // _WX_XH_DATECTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_dirpicker.h
+// Purpose: XML resource handler for wxDirPickerCtrl
+// Author: Francesco Montorsi
+// Created: 2006-04-17
+// Copyright: (c) 2006 Francesco Montorsi
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_DIRPICKERCTRL_H_
+#define _WX_XH_DIRPICKERCTRL_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_DIRPICKERCTRL
+
+class WXDLLIMPEXP_XRC wxDirPickerCtrlXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxDirPickerCtrlXmlHandler)
+
+public:
+ wxDirPickerCtrlXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_DIRPICKERCTRL
+
+#endif // _WX_XH_DIRPICKERCTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_dlg.h
+// Purpose: XML resource handler for dialogs
+// Author: Vaclav Slavik
+// Created: 2000/03/05
+// Copyright: (c) 2000 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_DLG_H_
+#define _WX_XH_DLG_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC
+
+class WXDLLIMPEXP_XRC wxDialogXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxDialogXmlHandler)
+
+public:
+ wxDialogXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC
+
+#endif // _WX_XH_DLG_H_
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_editlbox.h
+// Purpose: declaration of wxEditableListBox XRC handler
+// Author: Vadim Zeitlin
+// Created: 2009-06-04
+// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XRC_XH_EDITLBOX_H_
+#define _WX_XRC_XH_EDITLBOX_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_EDITABLELISTBOX
+
+// ----------------------------------------------------------------------------
+// wxEditableListBoxXmlHandler: XRC handler for wxEditableListBox
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_XRC wxEditableListBoxXmlHandler : public wxXmlResourceHandler
+{
+public:
+ wxEditableListBoxXmlHandler();
+
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ bool m_insideBox;
+ wxArrayString m_items;
+
+ DECLARE_DYNAMIC_CLASS(wxEditableListBoxXmlHandler)
+};
+
+#endif // wxUSE_XRC && wxUSE_EDITABLELISTBOX
+
+#endif // _WX_XRC_XH_EDITLBOX_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_filectrl.h
+// Purpose: XML resource handler for wxFileCtrl
+// Author: Kinaou Hervé
+// Created: 2009-05-11
+// Copyright: (c) 2009 wxWidgets development team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_FILECTRL_H_
+#define _WX_XH_FILECTRL_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_FILECTRL
+
+class WXDLLIMPEXP_XRC wxFileCtrlXmlHandler : public wxXmlResourceHandler
+{
+public:
+ wxFileCtrlXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxFileCtrlXmlHandler)
+};
+
+#endif // wxUSE_XRC && wxUSE_FILECTRL
+
+#endif // _WX_XH_FILEPICKERCTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_filepicker.h
+// Purpose: XML resource handler for wxFilePickerCtrl
+// Author: Francesco Montorsi
+// Created: 2006-04-17
+// Copyright: (c) 2006 Francesco Montorsi
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_FILEPICKERCTRL_H_
+#define _WX_XH_FILEPICKERCTRL_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_FILEPICKERCTRL
+
+class WXDLLIMPEXP_XRC wxFilePickerCtrlXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxFilePickerCtrlXmlHandler)
+
+public:
+ wxFilePickerCtrlXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_FILEPICKERCTRL
+
+#endif // _WX_XH_FILEPICKERCTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_fontpicker.h
+// Purpose: XML resource handler for wxFontPickerCtrl
+// Author: Francesco Montorsi
+// Created: 2006-04-17
+// Copyright: (c) 2006 Francesco Montorsi
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_FONTPICKERCTRL_H_
+#define _WX_XH_FONTPICKERCTRL_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_FONTPICKERCTRL
+
+class WXDLLIMPEXP_XRC wxFontPickerCtrlXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxFontPickerCtrlXmlHandler)
+
+public:
+ wxFontPickerCtrlXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_FONTPICKERCTRL
+
+#endif // _WX_XH_FONTPICKERCTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_frame.h
+// Purpose: XML resource handler for wxFrame
+// Author: Vaclav Slavik & Aleks.
+// Created: 2000/03/05
+// Copyright: (c) 2000 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_FRAME_H_
+#define _WX_XH_FRAME_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC
+
+class WXDLLIMPEXP_XRC wxFrameXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxFrameXmlHandler)
+
+public:
+ wxFrameXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC
+
+#endif // _WX_XH_FRAME_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_gauge.h
+// Purpose: XML resource handler for wxGauge
+// Author: Bob Mitchell
+// Created: 2000/03/21
+// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_GAUGE_H_
+#define _WX_XH_GAUGE_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_GAUGE
+
+class WXDLLIMPEXP_XRC wxGaugeXmlHandler : public wxXmlResourceHandler
+{
+public:
+ wxGaugeXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+ DECLARE_DYNAMIC_CLASS(wxGaugeXmlHandler)
+};
+
+#endif // wxUSE_XRC && wxUSE_GAUGE
+
+#endif // _WX_XH_GAUGE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_gdctl.h
+// Purpose: XML resource handler for wxGenericDirCtrl
+// Author: Markus Greither
+// Created: 2002/01/20
+// Copyright: (c) 2002 Markus Greither
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_GDCTL_H_
+#define _WX_XH_GDCTL_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_DIRDLG
+
+class WXDLLIMPEXP_XRC wxGenericDirCtrlXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxGenericDirCtrlXmlHandler)
+
+public:
+ wxGenericDirCtrlXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_DIRDLG
+
+#endif // _WX_XH_GDCTL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_grid.h
+// Purpose: XML resource handler for wxGrid
+// Author: Agron Selimaj
+// Created: 2005/08/11
+// Copyright: (c) 2005 Agron Selimaj, Freepour Controls Inc.
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_GRD_H_
+#define _WX_XH_GRD_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_GRID
+
+class WXDLLIMPEXP_XRC wxGridXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxGridXmlHandler)
+
+public:
+ wxGridXmlHandler();
+
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_GRID
+
+#endif // _WX_XH_GRD_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_html.h
+// Purpose: XML resource handler for wxHtmlWindow
+// Author: Bob Mitchell
+// Created: 2000/03/21
+// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_HTML_H_
+#define _WX_XH_HTML_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_HTML
+
+class WXDLLIMPEXP_XRC wxHtmlWindowXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxHtmlWindowXmlHandler)
+
+public:
+ wxHtmlWindowXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_HTML
+
+#endif // _WX_XH_HTML_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_htmllbox.h
+// Purpose: XML resource handler for wxSimpleHtmlListBox
+// Author: Francesco Montorsi
+// Created: 2006/10/21
+// Copyright: (c) 2006 Francesco Montorsi
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_SIMPLEHTMLLISTBOX_H_
+#define _WX_XH_SIMPLEHTMLLISTBOX_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_HTML
+
+class WXDLLIMPEXP_XRC wxSimpleHtmlListBoxXmlHandler : public wxXmlResourceHandler
+{
+public:
+ wxSimpleHtmlListBoxXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ bool m_insideBox;
+ wxArrayString strList;
+
+ DECLARE_DYNAMIC_CLASS(wxSimpleHtmlListBoxXmlHandler)
+};
+
+#endif // wxUSE_XRC && wxUSE_HTML
+
+#endif // _WX_XH_SIMPLEHTMLLISTBOX_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_hyperlink.h
+// Purpose: Hyperlink control (wxAdv)
+// Author: David Norris <danorris@gmail.com>
+// Modified by: Ryan Norton, Francesco Montorsi
+// Created: 04/02/2005
+// Copyright: (c) 2005 David Norris
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_HYPERLINKH__
+#define _WX_XH_HYPERLINKH__
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_HYPERLINKCTRL
+
+class WXDLLIMPEXP_XRC wxHyperlinkCtrlXmlHandler : public wxXmlResourceHandler
+{
+ // Register with wxWindows' dynamic class subsystem.
+ DECLARE_DYNAMIC_CLASS(wxHyperlinkCtrlXmlHandler)
+
+public:
+ // Constructor.
+ wxHyperlinkCtrlXmlHandler();
+
+ // Creates the control and returns a pointer to it.
+ virtual wxObject *DoCreateResource();
+
+ // Returns true if we know how to create a control for the given node.
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_HYPERLINKCTRL
+
+#endif // _WX_XH_HYPERLINKH__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_listb.h
+// Purpose: XML resource handler for wxListbox
+// Author: Bob Mitchell & Vaclav Slavik
+// Created: 2000/07/29
+// Copyright: (c) 2000 Bob Mitchell & Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_LISTB_H_
+#define _WX_XH_LISTB_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_LISTBOX
+
+class WXDLLIMPEXP_XRC wxListBoxXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxListBoxXmlHandler)
+
+public:
+ wxListBoxXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ bool m_insideBox;
+ wxArrayString strList;
+};
+
+#endif // wxUSE_XRC && wxUSE_LISTBOX
+
+#endif // _WX_XH_LISTB_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_listbk.h
+// Purpose: XML resource handler for wxListbook
+// Author: Vaclav Slavik
+// Copyright: (c) 2000 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_LISTBK_H_
+#define _WX_XH_LISTBK_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_LISTBOOK
+
+class WXDLLIMPEXP_FWD_CORE wxListbook;
+
+class WXDLLIMPEXP_XRC wxListbookXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxListbookXmlHandler)
+
+public:
+ wxListbookXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ bool m_isInside;
+ wxListbook *m_listbook;
+};
+
+#endif // wxUSE_XRC && wxUSE_LISTBOOK
+
+#endif // _WX_XH_LISTBK_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_listc.h
+// Purpose: XML resource handler for wxListCtrl
+// Author: Brian Gavin
+// Created: 2000/09/09
+// Copyright: (c) 2000 Brian Gavin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_LISTC_H_
+#define _WX_XH_LISTC_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_LISTCTRL
+
+class WXDLLIMPEXP_FWD_CORE wxListCtrl;
+class WXDLLIMPEXP_FWD_CORE wxListItem;
+
+class WXDLLIMPEXP_XRC wxListCtrlXmlHandler : public wxXmlResourceHandler
+{
+public:
+ wxListCtrlXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ // handlers for wxListCtrl itself and its listcol and listitem children
+ wxListCtrl *HandleListCtrl();
+ void HandleListCol();
+ void HandleListItem();
+
+ // common part to HandleList{Col,Item}()
+ void HandleCommonItemAttrs(wxListItem& item);
+
+ // gets the items image index in the corresponding image list (normal if
+ // which is wxIMAGE_LIST_NORMAL or small if it is wxIMAGE_LIST_SMALL)
+ long GetImageIndex(wxListCtrl *listctrl, int which);
+
+ DECLARE_DYNAMIC_CLASS(wxListCtrlXmlHandler)
+};
+
+#endif // wxUSE_XRC && wxUSE_LISTCTRL
+
+#endif // _WX_XH_LISTC_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_mdi.h
+// Purpose: XML resource handler for wxMDI
+// Author: David M. Falkinder & Vaclav Slavik
+// Created: 14/02/2005
+// Copyright: (c) 2005 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_MDI_H_
+#define _WX_XH_MDI_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_MDI
+
+class WXDLLIMPEXP_FWD_CORE wxWindow;
+
+class WXDLLIMPEXP_XRC wxMdiXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxMdiXmlHandler)
+
+public:
+ wxMdiXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ wxWindow *CreateFrame();
+};
+
+#endif // wxUSE_XRC && wxUSE_MDI
+
+#endif // _WX_XH_MDI_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_menu.h
+// Purpose: XML resource handler for menus/menubars
+// Author: Vaclav Slavik
+// Created: 2000/03/05
+// Copyright: (c) 2000 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_MENU_H_
+#define _WX_XH_MENU_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_MENUS
+
+class WXDLLIMPEXP_XRC wxMenuXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxMenuXmlHandler)
+
+public:
+ wxMenuXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ bool m_insideMenu;
+};
+
+class WXDLLIMPEXP_XRC wxMenuBarXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxMenuBarXmlHandler)
+
+public:
+ wxMenuBarXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_MENUS
+
+#endif // _WX_XH_MENU_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_notbk.h
+// Purpose: XML resource handler for wxNotebook
+// Author: Vaclav Slavik
+// Copyright: (c) 2000 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_NOTBK_H_
+#define _WX_XH_NOTBK_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_NOTEBOOK
+
+class WXDLLIMPEXP_FWD_CORE wxNotebook;
+
+class WXDLLIMPEXP_XRC wxNotebookXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxNotebookXmlHandler)
+
+public:
+ wxNotebookXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ bool m_isInside;
+ wxNotebook *m_notebook;
+};
+
+#endif // wxUSE_XRC && wxUSE_NOTEBOOK
+
+#endif // _WX_XH_NOTBK_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_odcombo.h
+// Purpose: XML resource handler for wxOwnerDrawnComboBox
+// Author: Alex Bligh - based on wx/xrc/xh_combo.h
+// Created: 2006/06/19
+// Copyright: (c) 2006 Alex Bligh
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_ODCOMBO_H_
+#define _WX_XH_ODCOMBO_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_ODCOMBOBOX
+
+class WXDLLIMPEXP_XRC wxOwnerDrawnComboBoxXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxOwnerDrawnComboBoxXmlHandler)
+
+public:
+ wxOwnerDrawnComboBoxXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ bool m_insideBox;
+ wxArrayString strList;
+};
+
+#endif // wxUSE_XRC && wxUSE_ODCOMBOBOX
+
+#endif // _WX_XH_ODCOMBO_H_
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_panel.h
+// Purpose: XML resource handler for wxPanel
+// Author: Vaclav Slavik
+// Created: 2000/03/05
+// Copyright: (c) 2000 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_PANEL_H_
+#define _WX_XH_PANEL_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC
+
+class WXDLLIMPEXP_XRC wxPanelXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxPanelXmlHandler)
+
+public:
+ wxPanelXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC
+
+#endif // _WX_XH_PANEL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_propdlg.h
+// Purpose: XML resource handler for wxPropertySheetDialog
+// Author: Sander Berents
+// Created: 2007/07/12
+// Copyright: (c) 2007 Sander Berents
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_PROPDLG_H_
+#define _WX_XH_PROPDLG_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC
+
+class WXDLLIMPEXP_FWD_ADV wxPropertySheetDialog;
+
+class WXDLLIMPEXP_XRC wxPropertySheetDialogXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxPropertySheetDialogXmlHandler)
+
+public:
+ wxPropertySheetDialogXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ bool m_isInside;
+ wxPropertySheetDialog *m_dialog;
+};
+
+#endif // wxUSE_XRC
+
+#endif // _WX_XH_PROPDLG_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_radbt.h
+// Purpose: XML resource handler for wxRadioButton
+// Author: Bob Mitchell
+// Created: 2000/03/21
+// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_RADBT_H_
+#define _WX_XH_RADBT_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_RADIOBTN
+
+class WXDLLIMPEXP_XRC wxRadioButtonXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxRadioButtonXmlHandler)
+
+public:
+ wxRadioButtonXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_RADIOBOX
+
+#endif // _WX_XH_RADBT_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_radbx.h
+// Purpose: XML resource handler for wxRadioBox
+// Author: Bob Mitchell
+// Created: 2000/03/21
+// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_RADBX_H_
+#define _WX_XH_RADBX_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_RADIOBOX
+
+class WXDLLIMPEXP_XRC wxRadioBoxXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxRadioBoxXmlHandler)
+
+public:
+ wxRadioBoxXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ bool m_insideBox;
+
+ // the items labels
+ wxArrayString m_labels;
+
+#if wxUSE_TOOLTIPS
+ // the items tooltips
+ wxArrayString m_tooltips;
+#endif // wxUSE_TOOLTIPS
+
+ // the item help text
+ wxArrayString m_helptexts;
+ wxArrayInt m_helptextSpecified;
+
+ // if the corresponding array element is 1, the radiobox item is
+ // disabled/hidden
+ wxArrayInt m_isEnabled,
+ m_isShown;
+};
+
+#endif // wxUSE_XRC && wxUSE_RADIOBOX
+
+#endif // _WX_XH_RADBX_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_ribbon.h
+// Purpose: XML resource handler for wxRibbon related classes
+// Author: Armel Asselin
+// Created: 2010-04-23
+// Copyright: (c) 2010 Armel Asselin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XRC_XH_RIBBON_H_
+#define _WX_XRC_XH_RIBBON_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_RIBBON
+
+class WXDLLIMPEXP_FWD_RIBBON wxRibbonControl;
+
+class WXDLLIMPEXP_RIBBON wxRibbonXmlHandler : public wxXmlResourceHandler
+{
+public:
+ wxRibbonXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ const wxClassInfo *m_isInside;
+
+ bool IsRibbonControl (wxXmlNode *node);
+
+ wxObject* Handle_buttonbar();
+ wxObject* Handle_button();
+ wxObject* Handle_control();
+ wxObject* Handle_page();
+ wxObject* Handle_gallery();
+ wxObject* Handle_galleryitem();
+ wxObject* Handle_panel();
+ wxObject* Handle_bar();
+
+ void Handle_RibbonArtProvider(wxRibbonControl *control);
+
+ wxDECLARE_DYNAMIC_CLASS(wxRibbonXmlHandler);
+};
+
+#endif // wxUSE_XRC && wxUSE_RIBBON
+
+#endif // _WX_XRC_XH_RIBBON_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_richtext.h
+// Purpose: XML resource handler for wxRichTextCtrl
+// Author: Julian Smart
+// Created: 2006-11-08
+// Copyright: (c) 2006 Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_RICHTEXT_H_
+#define _WX_XH_RICHTEXT_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_RICHTEXT
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextCtrlXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxRichTextCtrlXmlHandler)
+
+public:
+ wxRichTextCtrlXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_RICHTEXT
+
+#endif // _WX_XH_RICHTEXT_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_scrol.h
+// Purpose: XML resource handler for wxScrollBar
+// Author: Brian Gavin
+// Created: 2000/09/09
+// Copyright: (c) 2000 Brian Gavin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_SCROL_H_
+#define _WX_XH_SCROL_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_SCROLLBAR
+
+class WXDLLIMPEXP_XRC wxScrollBarXmlHandler : public wxXmlResourceHandler
+{
+public:
+ wxScrollBarXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+ DECLARE_DYNAMIC_CLASS(wxScrollBarXmlHandler)
+};
+
+#endif // wxUSE_XRC && wxUSE_SCROLLBAR
+
+#endif // _WX_XH_SCROL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_scwin.h
+// Purpose: XML resource handler for wxScrolledWindow
+// Author: Vaclav Slavik
+// Created: 2002/10/18
+// Copyright: (c) 2002 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_SCWIN_H_
+#define _WX_XH_SCWIN_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC
+
+class WXDLLIMPEXP_XRC wxScrolledWindowXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxScrolledWindowXmlHandler)
+
+public:
+ wxScrolledWindowXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC
+
+#endif // _WX_XH_SCWIN_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_sizer.h
+// Purpose: XML resource handler for wxBoxSizer
+// Author: Vaclav Slavik
+// Created: 2000/04/24
+// Copyright: (c) 2000 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_SIZER_H_
+#define _WX_XH_SIZER_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC
+
+#include "wx/sizer.h"
+#include "wx/gbsizer.h"
+
+class WXDLLIMPEXP_XRC wxSizerXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxSizerXmlHandler)
+
+public:
+ wxSizerXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+protected:
+ virtual wxSizer* DoCreateSizer(const wxString& name);
+ virtual bool IsSizerNode(wxXmlNode *node) const;
+
+private:
+ bool m_isInside;
+ bool m_isGBS;
+
+ wxSizer *m_parentSizer;
+
+
+ wxObject* Handle_sizeritem();
+ wxObject* Handle_spacer();
+ wxObject* Handle_sizer();
+ wxSizer* Handle_wxBoxSizer();
+#if wxUSE_STATBOX
+ wxSizer* Handle_wxStaticBoxSizer();
+#endif
+ wxSizer* Handle_wxGridSizer();
+ wxFlexGridSizer* Handle_wxFlexGridSizer();
+ wxGridBagSizer* Handle_wxGridBagSizer();
+ wxSizer* Handle_wxWrapSizer();
+
+ bool ValidateGridSizerChildren();
+ void SetFlexibleMode(wxFlexGridSizer* fsizer);
+ void SetGrowables(wxFlexGridSizer* fsizer, const wxChar* param, bool rows);
+ wxGBPosition GetGBPos(const wxString& param);
+ wxGBSpan GetGBSpan(const wxString& param);
+ wxSizerItem* MakeSizerItem();
+ void SetSizerItemAttributes(wxSizerItem* sitem);
+ void AddSizerItem(wxSizerItem* sitem);
+};
+
+#if wxUSE_BUTTON
+
+class WXDLLIMPEXP_XRC wxStdDialogButtonSizerXmlHandler
+ : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxStdDialogButtonSizerXmlHandler)
+
+public:
+ wxStdDialogButtonSizerXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ bool m_isInside;
+ wxStdDialogButtonSizer *m_parentSizer;
+};
+
+#endif // wxUSE_BUTTON
+
+#endif // wxUSE_XRC
+
+#endif // _WX_XH_SIZER_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_slidr.h
+// Purpose: XML resource handler for wxSlider
+// Author: Bob Mitchell
+// Created: 2000/03/21
+// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_SLIDR_H_
+#define _WX_XH_SLIDR_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_SLIDER
+
+class WXDLLIMPEXP_XRC wxSliderXmlHandler : public wxXmlResourceHandler
+{
+public:
+ wxSliderXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+ DECLARE_DYNAMIC_CLASS(wxSliderXmlHandler)
+};
+
+#endif // wxUSE_XRC && wxUSE_SLIDER
+
+#endif // _WX_XH_SLIDR_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_spin.h
+// Purpose: XML resource handler for wxSpinButton and wxSpinCtrl
+// Author: Bob Mitchell
+// Created: 2000/03/21
+// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_SPIN_H_
+#define _WX_XH_SPIN_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC
+
+#if wxUSE_SPINBTN
+
+class WXDLLIMPEXP_XRC wxSpinButtonXmlHandler : public wxXmlResourceHandler
+{
+public:
+ wxSpinButtonXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+ DECLARE_DYNAMIC_CLASS(wxSpinButtonXmlHandler)
+};
+
+#endif // wxUSE_SPINBTN
+
+
+#if wxUSE_SPINCTRL
+
+class WXDLLIMPEXP_XRC wxSpinCtrlXmlHandler : public wxXmlResourceHandler
+{
+public:
+ wxSpinCtrlXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+ DECLARE_DYNAMIC_CLASS(wxSpinCtrlXmlHandler)
+};
+
+#endif // wxUSE_SPINCTRL
+
+#endif // wxUSE_XRC
+
+#endif // _WX_XH_SPIN_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_split.h
+// Purpose: XRC resource for wxSplitterWindow
+// Author: panga@freemail.hu, Vaclav Slavik
+// Created: 2003/01/26
+// Copyright: (c) 2003 panga@freemail.hu, Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_SPLIT_H_
+#define _WX_XH_SPLIT_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_SPLITTER
+
+class WXDLLIMPEXP_XRC wxSplitterWindowXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxSplitterWindowXmlHandler)
+
+public:
+ wxSplitterWindowXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_SPLITTER
+
+#endif // _WX_XH_SPLIT_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_srchctl.h
+// Purpose: XRC resource handler for wxSearchCtrl
+// Author: Sander Berents
+// Created: 2007/07/12
+// Copyright: (c) 2007 Sander Berents
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_SRCH_H_
+#define _WX_XH_SRCH_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_SEARCHCTRL
+
+class WXDLLIMPEXP_XRC wxSearchCtrlXmlHandler : public wxXmlResourceHandler
+{
+public:
+ wxSearchCtrlXmlHandler();
+
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+ DECLARE_DYNAMIC_CLASS(wxSearchCtrlXmlHandler)
+};
+
+#endif // wxUSE_XRC && wxUSE_SEARCHCTRL
+
+#endif // _WX_XH_SRCH_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_statbar.h
+// Purpose: XML resource handler for wxStatusBar
+// Author: Brian Ravnsgaard Riis
+// Created: 2004/01/21
+// Copyright: (c) 2004 Brian Ravnsgaard Riis
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_STATBAR_H_
+#define _WX_XH_STATBAR_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_STATUSBAR
+
+class WXDLLIMPEXP_XRC wxStatusBarXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxStatusBarXmlHandler)
+
+public:
+ wxStatusBarXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_STATUSBAR
+
+#endif // _WX_XH_STATBAR_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_stbmp.h
+// Purpose: XML resource handler for wxStaticBitmap
+// Author: Vaclav Slavik
+// Created: 2000/04/22
+// Copyright: (c) 2000 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_STBMP_H_
+#define _WX_XH_STBMP_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_STATBMP
+
+class WXDLLIMPEXP_XRC wxStaticBitmapXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxStaticBitmapXmlHandler)
+
+public:
+ wxStaticBitmapXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_STATBMP
+
+#endif // _WX_XH_STBMP_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_stbox.h
+// Purpose: XML resource handler for wxStaticBox
+// Author: Brian Gavin
+// Created: 2000/09/00
+// Copyright: (c) 2000 Brian Gavin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_STBOX_H_
+#define _WX_XH_STBOX_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_STATBOX
+
+class WXDLLIMPEXP_XRC wxStaticBoxXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxStaticBoxXmlHandler)
+
+public:
+ wxStaticBoxXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_STATBOX
+
+#endif // _WX_XH_STBOX_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_stlin.h
+// Purpose: XML resource handler for wxStaticLine
+// Author: Vaclav Slavik
+// Created: 2000/09/00
+// Copyright: (c) 2000 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_STLIN_H_
+#define _WX_XH_STLIN_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_STATLINE
+
+class WXDLLIMPEXP_XRC wxStaticLineXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxStaticLineXmlHandler)
+
+public:
+ wxStaticLineXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_STATLINE
+
+#endif // _WX_XH_STLIN_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_sttxt.h
+// Purpose: XML resource handler for wxStaticText
+// Author: Bob Mitchell
+// Created: 2000/03/21
+// Copyright: (c) 2000 Bob Mitchell
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_STTXT_H_
+#define _WX_XH_STTXT_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_STATTEXT
+
+class WXDLLIMPEXP_XRC wxStaticTextXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxStaticTextXmlHandler)
+
+public:
+ wxStaticTextXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_STATTEXT
+
+#endif // _WX_XH_STTXT_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_text.h
+// Purpose: XML resource handler for wxTextCtrl
+// Author: Aleksandras Gluchovas
+// Created: 2000/03/21
+// Copyright: (c) 2000 Aleksandras Gluchovas
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_TEXT_H_
+#define _WX_XH_TEXT_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_TEXTCTRL
+
+class WXDLLIMPEXP_XRC wxTextCtrlXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxTextCtrlXmlHandler)
+
+public:
+ wxTextCtrlXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_TEXTCTRL
+
+#endif // _WX_XH_TEXT_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_tglbtn.h
+// Purpose: XML resource handler for wxToggleButton
+// Author: Julian Smart
+// Created: 2004-08-30
+// Copyright: (c) 2004 Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_TGLBTN_H_
+#define _WX_XH_TGLBTN_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_TOGGLEBTN
+
+class WXDLLIMPEXP_XRC wxToggleButtonXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxToggleButtonXmlHandler)
+
+public:
+ wxToggleButtonXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+protected:
+ virtual void DoCreateToggleButton(wxObject *control);
+#if !defined(__WXUNIVERSAL__) && !defined(__WXMOTIF__) && !defined(__WXPM__) && !(defined(__WXGTK__) && !defined(__WXGTK20__))
+ virtual void DoCreateBitmapToggleButton(wxObject *control);
+#endif
+};
+
+#endif // wxUSE_XRC && wxUSE_TOGGLEBTN
+
+#endif // _WX_XH_TGLBTN_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_timectrl.h
+// Purpose: XML resource handler for wxTimePickerCtrl
+// Author: Vadim Zeitlin
+// Created: 2011-09-22
+// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_TIMECTRL_H_
+#define _WX_XH_TIMECTRL_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_TIMEPICKCTRL
+
+class WXDLLIMPEXP_XRC wxTimeCtrlXmlHandler : public wxXmlResourceHandler
+{
+public:
+ wxTimeCtrlXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ wxDECLARE_DYNAMIC_CLASS(wxTimeCtrlXmlHandler);
+};
+
+#endif // wxUSE_XRC && wxUSE_TIMEPICKCTRL
+
+#endif // _WX_XH_TIMECTRL_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_toolb.h
+// Purpose: XML resource handler for wxToolBar
+// Author: Vaclav Slavik
+// Created: 2000/08/11
+// Copyright: (c) 2000 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_TOOLB_H_
+#define _WX_XH_TOOLB_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_TOOLBAR
+
+class WXDLLIMPEXP_FWD_CORE wxToolBar;
+
+class WXDLLIMPEXP_XRC wxToolBarXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxToolBarXmlHandler)
+
+public:
+ wxToolBarXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ bool m_isInside;
+ wxToolBar *m_toolbar;
+ wxSize m_toolSize;
+};
+
+#endif // wxUSE_XRC && wxUSE_TOOLBAR
+
+#endif // _WX_XH_TOOLB_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_toolbk.h
+// Purpose: XML resource handler for wxToolbook
+// Author: Andrea Zanellato
+// Created: 2009/12/12
+// Copyright: (c) 2010 wxWidgets development team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_TOOLBK_H_
+#define _WX_XH_TOOLBK_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_TOOLBOOK
+
+class WXDLLIMPEXP_FWD_CORE wxToolbook;
+
+class WXDLLIMPEXP_XRC wxToolbookXmlHandler : public wxXmlResourceHandler
+{
+public:
+ wxToolbookXmlHandler();
+
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ bool m_isInside;
+ wxToolbook *m_toolbook;
+
+ wxDECLARE_DYNAMIC_CLASS(wxToolbookXmlHandler);
+};
+
+#endif // wxUSE_XRC && wxUSE_TOOLBOOK
+
+#endif // _WX_XH_TOOLBK_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_tree.h
+// Purpose: XML resource handler for wxTreeCtrl
+// Author: Brian Gavin
+// Created: 2000/09/09
+// Copyright: (c) 2000 Brian Gavin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_TREE_H_
+#define _WX_XH_TREE_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_TREECTRL
+
+class WXDLLIMPEXP_XRC wxTreeCtrlXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxTreeCtrlXmlHandler)
+
+public:
+ wxTreeCtrlXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_TREECTRL
+
+#endif // _WX_XH_TREE_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_treebk.h
+// Purpose: XML resource handler for wxTreebook
+// Author: Evgeniy Tarassov
+// Created: 2005/09/28
+// Copyright: (c) 2005 TT-Solutions <vadim@tt-solutions.com>
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_TREEBK_H_
+#define _WX_XH_TREEBK_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_TREEBOOK
+
+class WXDLLIMPEXP_FWD_CORE wxTreebook;
+#include "wx/dynarray.h"
+
+WX_DEFINE_USER_EXPORTED_ARRAY_SIZE_T(size_t, wxArrayTbkPageIndexes,
+ class WXDLLIMPEXP_XRC);
+
+// ---------------------------------------------------------------------
+// wxTreebookXmlHandler class
+// ---------------------------------------------------------------------
+// Resource xml structure have to be almost the "same" as for wxNotebook
+// except the additional (size_t)depth parameter for treebookpage nodes
+// which indicates the depth of the page in the tree.
+// There is only one logical constraint on this parameter :
+// it cannot be greater than the previous page depth plus one
+class WXDLLIMPEXP_XRC wxTreebookXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxTreebookXmlHandler)
+
+public:
+ wxTreebookXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ wxTreebook *m_tbk;
+ wxArrayTbkPageIndexes m_treeContext;
+ bool m_isInside;
+};
+
+
+// Example:
+// -------
+// Label
+// \--First
+// | \--Second
+// \--Third
+//
+//<resource>
+// ...
+// <object class="wxTreebook">
+// <object class="treebookpage">
+// <object class="wxWindow" />
+// <label>My first page</label>
+// <depth>0</depth>
+// </object>
+// <object class="treebookpage">
+// <object class="wxWindow" />
+// <label>First</label>
+// <depth>1</depth>
+// </object>
+// <object class="treebookpage">
+// <object class="wxWindow" />
+// <label>Second</label>
+// <depth>2</depth>
+// </object>
+// <object class="treebookpage">
+// <object class="wxWindow" />
+// <label>Third</label>
+// <depth>1</depth>
+// </object>
+// </object>
+// ...
+//</resource>
+
+#endif // wxUSE_XRC && wxUSE_TREEBOOK
+
+#endif // _WX_XH_TREEBK_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_unkwn.h
+// Purpose: XML resource handler for unknown widget
+// Author: Vaclav Slavik
+// Created: 2000/03/05
+// Copyright: (c) 2000 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_UNKWN_H_
+#define _WX_XH_UNKWN_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC
+
+class WXDLLIMPEXP_XRC wxUnknownWidgetXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxUnknownWidgetXmlHandler)
+
+public:
+ wxUnknownWidgetXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC
+
+#endif // _WX_XH_UNKWN_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xh_wizrd.h
+// Purpose: XML resource handler for wxWizard
+// Author: Vaclav Slavik
+// Created: 2003/03/02
+// Copyright: (c) 2000 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_WIZRD_H_
+#define _WX_XH_WIZRD_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_WIZARDDLG
+
+class WXDLLIMPEXP_FWD_ADV wxWizard;
+class WXDLLIMPEXP_FWD_ADV wxWizardPageSimple;
+
+class WXDLLIMPEXP_XRC wxWizardXmlHandler : public wxXmlResourceHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxWizardXmlHandler)
+
+public:
+ wxWizardXmlHandler();
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+
+private:
+ wxWizard *m_wizard;
+ wxWizardPageSimple *m_lastSimplePage;
+};
+
+#endif // wxUSE_XRC && wxUSE_WIZARDDLG
+
+#endif // _WX_XH_WIZRD_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xmlres.h
+// Purpose: XML resources
+// Author: Vaclav Slavik
+// Created: 2000/03/05
+// Copyright: (c) 2000 Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XMLRES_H_
+#define _WX_XMLRES_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_XRC
+
+#include "wx/string.h"
+#include "wx/dynarray.h"
+#include "wx/arrstr.h"
+#include "wx/datetime.h"
+#include "wx/list.h"
+#include "wx/gdicmn.h"
+#include "wx/filesys.h"
+#include "wx/bitmap.h"
+#include "wx/icon.h"
+#include "wx/artprov.h"
+#include "wx/colour.h"
+#include "wx/vector.h"
+
+#include "wx/xrc/xmlreshandler.h"
+
+class WXDLLIMPEXP_FWD_BASE wxFileName;
+
+class WXDLLIMPEXP_FWD_CORE wxIconBundle;
+class WXDLLIMPEXP_FWD_CORE wxImageList;
+class WXDLLIMPEXP_FWD_CORE wxMenu;
+class WXDLLIMPEXP_FWD_CORE wxMenuBar;
+class WXDLLIMPEXP_FWD_CORE wxDialog;
+class WXDLLIMPEXP_FWD_CORE wxPanel;
+class WXDLLIMPEXP_FWD_CORE wxWindow;
+class WXDLLIMPEXP_FWD_CORE wxFrame;
+class WXDLLIMPEXP_FWD_CORE wxToolBar;
+
+class WXDLLIMPEXP_FWD_XML wxXmlDocument;
+class WXDLLIMPEXP_FWD_XML wxXmlNode;
+class WXDLLIMPEXP_FWD_XRC wxXmlSubclassFactory;
+class wxXmlSubclassFactories;
+class wxXmlResourceModule;
+class wxXmlResourceDataRecords;
+
+// These macros indicate current version of XML resources (this information is
+// encoded in root node of XRC file as "version" property).
+//
+// Rules for increasing version number:
+// - change it only if you made incompatible change to the format. Addition
+// of new attribute to control handler is _not_ incompatible change, because
+// older versions of the library may ignore it.
+// - if you change version number, follow these steps:
+// - set major, minor and release numbers to respective version numbers of
+// the wxWidgets library (see wx/version.h)
+// - reset revision to 0 unless the first three are same as before,
+// in which case you should increase revision by one
+#define WX_XMLRES_CURRENT_VERSION_MAJOR 2
+#define WX_XMLRES_CURRENT_VERSION_MINOR 5
+#define WX_XMLRES_CURRENT_VERSION_RELEASE 3
+#define WX_XMLRES_CURRENT_VERSION_REVISION 0
+#define WX_XMLRES_CURRENT_VERSION_STRING wxT("2.5.3.0")
+
+#define WX_XMLRES_CURRENT_VERSION \
+ (WX_XMLRES_CURRENT_VERSION_MAJOR * 256*256*256 + \
+ WX_XMLRES_CURRENT_VERSION_MINOR * 256*256 + \
+ WX_XMLRES_CURRENT_VERSION_RELEASE * 256 + \
+ WX_XMLRES_CURRENT_VERSION_REVISION)
+
+enum wxXmlResourceFlags
+{
+ wxXRC_USE_LOCALE = 1,
+ wxXRC_NO_SUBCLASSING = 2,
+ wxXRC_NO_RELOADING = 4
+};
+
+// This class holds XML resources from one or more .xml files
+// (or derived forms, either binary or zipped -- see manual for
+// details).
+class WXDLLIMPEXP_XRC wxXmlResource : public wxObject
+{
+public:
+ // Constructor.
+ // Flags: wxXRC_USE_LOCALE
+ // translatable strings will be translated via _()
+ // using the given domain if specified
+ // wxXRC_NO_SUBCLASSING
+ // subclass property of object nodes will be ignored
+ // (useful for previews in XRC editors)
+ // wxXRC_NO_RELOADING
+ // don't check the modification time of the XRC files and
+ // reload them if they have changed on disk
+ wxXmlResource(int flags = wxXRC_USE_LOCALE,
+ const wxString& domain = wxEmptyString);
+
+ // Constructor.
+ // Flags: wxXRC_USE_LOCALE
+ // translatable strings will be translated via _()
+ // using the given domain if specified
+ // wxXRC_NO_SUBCLASSING
+ // subclass property of object nodes will be ignored
+ // (useful for previews in XRC editors)
+ wxXmlResource(const wxString& filemask, int flags = wxXRC_USE_LOCALE,
+ const wxString& domain = wxEmptyString);
+
+ // Destructor.
+ virtual ~wxXmlResource();
+
+ // Loads resources from XML files that match given filemask.
+ // This method understands wxFileSystem URLs if wxUSE_FILESYS.
+ bool Load(const wxString& filemask);
+
+ // Loads resources from single XRC file.
+ bool LoadFile(const wxFileName& file);
+
+ // Loads all XRC files from a directory.
+ bool LoadAllFiles(const wxString& dirname);
+
+ // Unload resource from the given XML file (wildcards not allowed)
+ bool Unload(const wxString& filename);
+
+ // Initialize handlers for all supported controls/windows. This will
+ // make the executable quite big because it forces linking against
+ // most of the wxWidgets library.
+ void InitAllHandlers();
+
+ // Initialize only a specific handler (or custom handler). Convention says
+ // that handler name is equal to the control's name plus 'XmlHandler', for
+ // example wxTextCtrlXmlHandler, wxHtmlWindowXmlHandler. The XML resource
+ // compiler (xmlres) can create include file that contains initialization
+ // code for all controls used within the resource.
+ void AddHandler(wxXmlResourceHandler *handler);
+
+ // Add a new handler at the beginning of the handler list
+ void InsertHandler(wxXmlResourceHandler *handler);
+
+ // Removes all handlers
+ void ClearHandlers();
+
+ // Registers subclasses factory for use in XRC. This function is not meant
+ // for public use, please see the comment above wxXmlSubclassFactory
+ // definition.
+ static void AddSubclassFactory(wxXmlSubclassFactory *factory);
+
+ // Loads menu from resource. Returns NULL on failure.
+ wxMenu *LoadMenu(const wxString& name);
+
+ // Loads menubar from resource. Returns NULL on failure.
+ wxMenuBar *LoadMenuBar(wxWindow *parent, const wxString& name);
+
+ // Loads menubar from resource. Returns NULL on failure.
+ wxMenuBar *LoadMenuBar(const wxString& name) { return LoadMenuBar(NULL, name); }
+
+#if wxUSE_TOOLBAR
+ // Loads a toolbar.
+ wxToolBar *LoadToolBar(wxWindow *parent, const wxString& name);
+#endif
+
+ // Loads a dialog. dlg points to parent window (if any).
+ wxDialog *LoadDialog(wxWindow *parent, const wxString& name);
+
+ // Loads a dialog. dlg points to parent window (if any). This form
+ // is used to finish creation of already existing instance (main reason
+ // for this is that you may want to use derived class with new event table)
+ // Example (typical usage):
+ // MyDialog dlg;
+ // wxTheXmlResource->LoadDialog(&dlg, mainFrame, "my_dialog");
+ // dlg->ShowModal();
+ bool LoadDialog(wxDialog *dlg, wxWindow *parent, const wxString& name);
+
+ // Loads a panel. panel points to parent window (if any).
+ wxPanel *LoadPanel(wxWindow *parent, const wxString& name);
+
+ // Loads a panel. panel points to parent window (if any). This form
+ // is used to finish creation of already existing instance.
+ bool LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name);
+
+ // Loads a frame.
+ wxFrame *LoadFrame(wxWindow* parent, const wxString& name);
+ bool LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name);
+
+ // Load an object from the resource specifying both the resource name and
+ // the classname. This lets you load nonstandard container windows.
+ wxObject *LoadObject(wxWindow *parent, const wxString& name,
+ const wxString& classname)
+ {
+ return DoLoadObject(parent, name, classname, false /* !recursive */);
+ }
+
+ // Load an object from the resource specifying both the resource name and
+ // the classname. This form lets you finish the creation of an existing
+ // instance.
+ bool LoadObject(wxObject *instance,
+ wxWindow *parent,
+ const wxString& name,
+ const wxString& classname)
+ {
+ return DoLoadObject(instance, parent, name, classname, false);
+ }
+
+ // These versions of LoadObject() look for the object with the given name
+ // recursively (breadth first) and can be used to instantiate an individual
+ // control defined anywhere in an XRC file. No check is done that the name
+ // is unique, it's up to the caller to ensure this.
+ wxObject *LoadObjectRecursively(wxWindow *parent,
+ const wxString& name,
+ const wxString& classname)
+ {
+ return DoLoadObject(parent, name, classname, true /* recursive */);
+ }
+
+ bool LoadObjectRecursively(wxObject *instance,
+ wxWindow *parent,
+ const wxString& name,
+ const wxString& classname)
+ {
+ return DoLoadObject(instance, parent, name, classname, true);
+ }
+
+ // Loads a bitmap resource from a file.
+ wxBitmap LoadBitmap(const wxString& name);
+
+ // Loads an icon resource from a file.
+ wxIcon LoadIcon(const wxString& name);
+
+ // Attaches an unknown control to the given panel/window/dialog.
+ // Unknown controls are used in conjunction with <object class="unknown">.
+ bool AttachUnknownControl(const wxString& name, wxWindow *control,
+ wxWindow *parent = NULL);
+
+ // Returns a numeric ID that is equivalent to the string ID used in an XML
+ // resource. If an unknown str_id is requested (i.e. other than wxID_XXX
+ // or integer), a new record is created which associates the given string
+ // with a number. If value_if_not_found == wxID_NONE, the number is obtained via
+ // wxWindow::NewControlId(). Otherwise value_if_not_found is used.
+ // Macro XRCID(name) is provided for convenient use in event tables.
+ static int GetXRCID(const wxString& str_id, int value_if_not_found = wxID_NONE)
+ { return DoGetXRCID(str_id.mb_str(), value_if_not_found); }
+
+ // version for internal use only
+ static int DoGetXRCID(const char *str_id, int value_if_not_found = wxID_NONE);
+
+
+ // Find the string ID with the given numeric value, returns an empty string
+ // if no such ID is found.
+ //
+ // Notice that unlike GetXRCID(), which is fast, this operation is slow as
+ // it checks all the IDs used in XRC.
+ static wxString FindXRCIDById(int numId);
+
+
+ // Returns version information (a.b.c.d = d+ 256*c + 256^2*b + 256^3*a).
+ long GetVersion() const { return m_version; }
+
+ // Compares resources version to argument. Returns -1 if resources version
+ // is less than the argument, +1 if greater and 0 if they equal.
+ int CompareVersion(int major, int minor, int release, int revision) const
+ {
+ long diff = GetVersion() -
+ (major*256*256*256 + minor*256*256 + release*256 + revision);
+ if ( diff < 0 )
+ return -1;
+ else if ( diff > 0 )
+ return +1;
+ else
+ return 0;
+ }
+
+ //// Singleton accessors.
+
+ // Gets the global resources object or creates one if none exists.
+ static wxXmlResource *Get();
+
+ // Sets the global resources object and returns a pointer to the previous one (may be NULL).
+ static wxXmlResource *Set(wxXmlResource *res);
+
+ // Returns flags, which may be a bitlist of wxXRC_USE_LOCALE and wxXRC_NO_SUBCLASSING.
+ int GetFlags() const { return m_flags; }
+ // Set flags after construction.
+ void SetFlags(int flags) { m_flags = flags; }
+
+ // Get/Set the domain to be passed to the translation functions, defaults
+ // to empty string (no domain).
+ const wxString& GetDomain() const { return m_domain; }
+ void SetDomain(const wxString& domain);
+
+
+ // This function returns the wxXmlNode containing the definition of the
+ // object with the given name or NULL.
+ //
+ // It can be used to access additional information defined in the XRC file
+ // and not used by wxXmlResource itself.
+ const wxXmlNode *GetResourceNode(const wxString& name) const
+ { return GetResourceNodeAndLocation(name, wxString(), true); }
+
+protected:
+ // reports input error at position 'context'
+ void ReportError(const wxXmlNode *context, const wxString& message);
+
+ // override this in derived class to customize errors reporting
+ virtual void DoReportError(const wxString& xrcFile, const wxXmlNode *position,
+ const wxString& message);
+
+ // Load the contents of a single file and returns its contents as a new
+ // wxXmlDocument (which will be owned by caller) on success or NULL.
+ wxXmlDocument *DoLoadFile(const wxString& file);
+
+ // Scans the resources list for unloaded files and loads them. Also reloads
+ // files that have been modified since last loading.
+ bool UpdateResources();
+
+
+ // Common implementation of GetResourceNode() and FindResource(): searches
+ // all top-level or all (if recursive == true) nodes if all loaded XRC
+ // files and returns the node, if found, as well as the path of the file it
+ // was found in if path is non-NULL
+ wxXmlNode *GetResourceNodeAndLocation(const wxString& name,
+ const wxString& classname,
+ bool recursive = false,
+ wxString *path = NULL) const;
+
+
+ // Note that these functions are used outside of wxWidgets itself, e.g.
+ // there are several known cases of inheriting from wxXmlResource just to
+ // be able to call FindResource() so we keep them for compatibility even if
+ // their names are not really consistent with GetResourceNode() public
+ // function and FindResource() is also non-const because it changes the
+ // current path of m_curFileSystem to ensure that relative paths work
+ // correctly when CreateResFromNode() is called immediately afterwards
+ // (something const public function intentionally does not do)
+
+ // Returns the node containing the resource with the given name and class
+ // name unless it's empty (then any class matches) or NULL if not found.
+ wxXmlNode *FindResource(const wxString& name, const wxString& classname,
+ bool recursive = false);
+
+ // Helper function used by FindResource() to look under the given node.
+ wxXmlNode *DoFindResource(wxXmlNode *parent, const wxString& name,
+ const wxString& classname, bool recursive) const;
+
+ // Creates a resource from information in the given node
+ // (Uses only 'handlerToUse' if != NULL)
+ wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent,
+ wxObject *instance = NULL,
+ wxXmlResourceHandler *handlerToUse = NULL)
+ {
+ return node ? DoCreateResFromNode(*node, parent, instance, handlerToUse)
+ : NULL;
+ }
+
+ // Helper of Load() and Unload(): returns the URL corresponding to the
+ // given file if it's indeed a file, otherwise returns the original string
+ // unmodified
+ static wxString ConvertFileNameToURL(const wxString& filename);
+
+ // loading resources from archives is impossible without wxFileSystem
+#if wxUSE_FILESYSTEM
+ // Another helper: detect if the filename is a ZIP or XRS file
+ static bool IsArchive(const wxString& filename);
+#endif // wxUSE_FILESYSTEM
+
+private:
+ wxXmlResourceDataRecords& Data() { return *m_data; }
+ const wxXmlResourceDataRecords& Data() const { return *m_data; }
+
+ // the real implementation of CreateResFromNode(): this should be only
+ // called if node is non-NULL
+ wxObject *DoCreateResFromNode(wxXmlNode& node,
+ wxObject *parent,
+ wxObject *instance,
+ wxXmlResourceHandler *handlerToUse = NULL);
+
+ // common part of LoadObject() and LoadObjectRecursively()
+ wxObject *DoLoadObject(wxWindow *parent,
+ const wxString& name,
+ const wxString& classname,
+ bool recursive);
+ bool DoLoadObject(wxObject *instance,
+ wxWindow *parent,
+ const wxString& name,
+ const wxString& classname,
+ bool recursive);
+
+private:
+ long m_version;
+
+ int m_flags;
+ wxVector<wxXmlResourceHandler*> m_handlers;
+ wxXmlResourceDataRecords *m_data;
+#if wxUSE_FILESYSTEM
+ wxFileSystem m_curFileSystem;
+ wxFileSystem& GetCurFileSystem() { return m_curFileSystem; }
+#endif
+
+ // domain to pass to translation functions, if any.
+ wxString m_domain;
+
+ friend class wxXmlResourceHandlerImpl;
+ friend class wxXmlResourceModule;
+ friend class wxIdRangeManager;
+ friend class wxIdRange;
+
+ static wxXmlSubclassFactories *ms_subclassFactories;
+
+ // singleton instance:
+ static wxXmlResource *ms_instance;
+};
+
+
+// This macro translates string identifier (as used in XML resource,
+// e.g. <menuitem id="my_menu">...</menuitem>) to integer id that is needed by
+// wxWidgets event tables.
+// Example:
+// BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+// EVT_MENU(XRCID("quit"), MyFrame::OnQuit)
+// EVT_MENU(XRCID("about"), MyFrame::OnAbout)
+// EVT_MENU(XRCID("new"), MyFrame::OnNew)
+// EVT_MENU(XRCID("open"), MyFrame::OnOpen)
+// END_EVENT_TABLE()
+
+#define XRCID(str_id) \
+ wxXmlResource::DoGetXRCID(str_id)
+
+
+// This macro returns pointer to particular control in dialog
+// created using XML resources. You can use it to set/get values from
+// controls.
+// Example:
+// wxDialog dlg;
+// wxXmlResource::Get()->LoadDialog(&dlg, mainFrame, "my_dialog");
+// XRCCTRL(dlg, "my_textctrl", wxTextCtrl)->SetValue(wxT("default value"));
+
+#define XRCCTRL(window, id, type) \
+ (wxStaticCast((window).FindWindow(XRCID(id)), type))
+
+// This macro returns pointer to sizer item
+// Example:
+//
+// <object class="spacer" name="area">
+// <size>400, 300</size>
+// </object>
+//
+// wxSizerItem* item = XRCSIZERITEM(*this, "area")
+
+#define XRCSIZERITEM(window, id) \
+ ((window).GetSizer() ? (window).GetSizer()->GetItemById(XRCID(id)) : NULL)
+
+
+// wxXmlResourceHandlerImpl is the back-end of the wxXmlResourceHander class to
+// really implementing all its functionality. It is defined in the "xrc"
+// library unlike wxXmlResourceHandler itself which is defined in "core" to
+// allow inheriting from it in the code from the other libraries too.
+
+class WXDLLIMPEXP_XRC wxXmlResourceHandlerImpl : public wxXmlResourceHandlerImplBase
+{
+public:
+ // Constructor.
+ wxXmlResourceHandlerImpl(wxXmlResourceHandler *handler);
+
+ // Destructor.
+ virtual ~wxXmlResourceHandlerImpl() {}
+
+ // Creates an object (menu, dialog, control, ...) from an XML node.
+ // Should check for validity.
+ // parent is a higher-level object (usually window, dialog or panel)
+ // that is often necessary to create the resource.
+ // If instance is non-NULL it should not create a new instance via 'new' but
+ // should rather use this one, and call its Create method.
+ wxObject *CreateResource(wxXmlNode *node, wxObject *parent,
+ wxObject *instance);
+
+
+ // --- Handy methods:
+
+ // Returns true if the node has a property class equal to classname,
+ // e.g. <object class="wxDialog">.
+ bool IsOfClass(wxXmlNode *node, const wxString& classname) const;
+
+ // Gets node content from wxXML_ENTITY_NODE
+ // The problem is, <tag>content<tag> is represented as
+ // wxXML_ENTITY_NODE name="tag", content=""
+ // |-- wxXML_TEXT_NODE or
+ // wxXML_CDATA_SECTION_NODE name="" content="content"
+ wxString GetNodeContent(const wxXmlNode *node);
+
+ // Check to see if a parameter exists.
+ bool HasParam(const wxString& param);
+
+ // Finds the node or returns NULL.
+ wxXmlNode *GetParamNode(const wxString& param);
+
+ // Finds the parameter value or returns the empty string.
+ wxString GetParamValue(const wxString& param);
+
+ // Returns the parameter value from given node.
+ wxString GetParamValue(const wxXmlNode* node);
+
+ // Gets style flags from text in form "flag | flag2| flag3 |..."
+ // Only understands flags added with AddStyle
+ int GetStyle(const wxString& param = wxT("style"), int defaults = 0);
+
+ // Gets text from param and does some conversions:
+ // - replaces \n, \r, \t by respective chars (according to C syntax)
+ // - replaces _ by & and __ by _ (needed for _File => &File because of XML)
+ // - calls wxGetTranslations (unless disabled in wxXmlResource)
+ wxString GetText(const wxString& param, bool translate = true);
+
+ // Returns the XRCID.
+ int GetID();
+
+ // Returns the resource name.
+ wxString GetName();
+
+ // Gets a bool flag (1, t, yes, on, true are true, everything else is false).
+ bool GetBool(const wxString& param, bool defaultv = false);
+
+ // Gets an integer value from the parameter.
+ long GetLong(const wxString& param, long defaultv = 0);
+
+ // Gets a float value from the parameter.
+ float GetFloat(const wxString& param, float defaultv = 0);
+
+ // Gets colour in HTML syntax (#RRGGBB).
+ wxColour GetColour(const wxString& param, const wxColour& defaultv = wxNullColour);
+
+ // Gets the size (may be in dialog units).
+ wxSize GetSize(const wxString& param = wxT("size"),
+ wxWindow *windowToUse = NULL);
+
+ // Gets the position (may be in dialog units).
+ wxPoint GetPosition(const wxString& param = wxT("pos"));
+
+ // Gets a dimension (may be in dialog units).
+ wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0,
+ wxWindow *windowToUse = NULL);
+
+ // Gets a direction, complains if the value is invalid.
+ wxDirection GetDirection(const wxString& param, wxDirection dirDefault = wxLEFT);
+
+ // Gets a bitmap.
+ wxBitmap GetBitmap(const wxString& param = wxT("bitmap"),
+ const wxArtClient& defaultArtClient = wxART_OTHER,
+ wxSize size = wxDefaultSize);
+
+ // Gets a bitmap from an XmlNode.
+ wxBitmap GetBitmap(const wxXmlNode* node,
+ const wxArtClient& defaultArtClient = wxART_OTHER,
+ wxSize size = wxDefaultSize);
+
+ // Gets an icon.
+ wxIcon GetIcon(const wxString& param = wxT("icon"),
+ const wxArtClient& defaultArtClient = wxART_OTHER,
+ wxSize size = wxDefaultSize);
+
+ // Gets an icon from an XmlNode.
+ wxIcon GetIcon(const wxXmlNode* node,
+ const wxArtClient& defaultArtClient = wxART_OTHER,
+ wxSize size = wxDefaultSize);
+
+ // Gets an icon bundle.
+ wxIconBundle GetIconBundle(const wxString& param,
+ const wxArtClient& defaultArtClient = wxART_OTHER);
+
+ // Gets an image list.
+ wxImageList *GetImageList(const wxString& param = wxT("imagelist"));
+
+#if wxUSE_ANIMATIONCTRL
+ // Gets an animation.
+ wxAnimation* GetAnimation(const wxString& param = wxT("animation"));
+#endif
+
+ // Gets a font.
+ wxFont GetFont(const wxString& param = wxT("font"), wxWindow* parent = NULL);
+
+ // Gets the value of a boolean attribute (only "0" and "1" are valid values)
+ bool GetBoolAttr(const wxString& attr, bool defaultv);
+
+
+ // Sets common window options.
+ void SetupWindow(wxWindow *wnd);
+
+ // Creates children.
+ void CreateChildren(wxObject *parent, bool this_hnd_only = false);
+
+ // Helper function.
+ void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL);
+
+ // Creates a resource from a node.
+ wxObject *CreateResFromNode(wxXmlNode *node,
+ wxObject *parent, wxObject *instance = NULL);
+
+ // helper
+#if wxUSE_FILESYSTEM
+ wxFileSystem& GetCurFileSystem();
+#endif
+
+ // reports input error at position 'context'
+ void ReportError(wxXmlNode *context, const wxString& message);
+ // reports input error at m_node
+ void ReportError(const wxString& message);
+ // reports input error when parsing parameter with given name
+ void ReportParamError(const wxString& param, const wxString& message);
+};
+
+
+// Programmer-friendly macros for writing XRC handlers:
+
+#define XRC_MAKE_INSTANCE(variable, classname) \
+ classname *variable = NULL; \
+ if (m_instance) \
+ variable = wxStaticCast(m_instance, classname); \
+ if (!variable) \
+ variable = new classname;
+
+
+// FIXME -- remove this $%^#$%#$@# as soon as Ron checks his changes in!!
+WXDLLIMPEXP_XRC void wxXmlInitResourceModule();
+
+
+// This class is used to create instances of XRC "object" nodes with "subclass"
+// property. It is _not_ supposed to be used by XRC users, you should instead
+// register your subclasses via wxWidgets' RTTI mechanism. This class is useful
+// only for language bindings developer who need a way to implement subclassing
+// in wxWidgets ports that don't support wxRTTI (e.g. wxPython).
+class WXDLLIMPEXP_XRC wxXmlSubclassFactory
+{
+public:
+ // Try to create instance of given class and return it, return NULL on
+ // failure:
+ virtual wxObject *Create(const wxString& className) = 0;
+ virtual ~wxXmlSubclassFactory() {}
+};
+
+
+/* -------------------------------------------------------------------------
+ Backward compatibility macros. Do *NOT* use, they may disappear in future
+ versions of the XRC library!
+ ------------------------------------------------------------------------- */
+
+#endif // wxUSE_XRC
+
+#endif // _WX_XMLRES_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xrc/xmlreshandler.cpp
+// Purpose: XML resource handler
+// Author: Steven Lamerton
+// Created: 2011/01/26
+// RCS-ID: $id$
+// Copyright: (c) 2011 Steven Lamerton
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XRC_XMLRESHANDLER_H_
+#define _WX_XRC_XMLRESHANDLER_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_XRC
+
+#include "wx/string.h"
+#include "wx/artprov.h"
+#include "wx/colour.h"
+#include "wx/filesys.h"
+#include "wx/imaglist.h"
+#include "wx/window.h"
+
+class WXDLLIMPEXP_FWD_ADV wxAnimation;
+
+class WXDLLIMPEXP_FWD_XML wxXmlNode;
+class WXDLLIMPEXP_FWD_XML wxXmlResource;
+
+class WXDLLIMPEXP_FWD_CORE wxXmlResourceHandler;
+
+// Helper macro used by the classes derived from wxXmlResourceHandler but also
+// by wxXmlResourceHandler implementation itself.
+#define XRC_ADD_STYLE(style) AddStyle(wxT(#style), style)
+
+// Abstract base class for the implementation object used by
+// wxXmlResourceHandlerImpl. The real implementation is in
+// wxXmlResourceHandlerImpl class in the "xrc" library while this class is in
+// the "core" itself -- but it is so small that it doesn't matter.
+
+class WXDLLIMPEXP_CORE wxXmlResourceHandlerImplBase : public wxObject
+{
+public:
+ // Constructor.
+ wxXmlResourceHandlerImplBase(wxXmlResourceHandler *handler)
+ : m_handler(handler)
+ {}
+
+ // Destructor.
+ virtual ~wxXmlResourceHandlerImplBase() {}
+
+ virtual wxObject *CreateResource(wxXmlNode *node, wxObject *parent,
+ wxObject *instance) = 0;
+ virtual bool IsOfClass(wxXmlNode *node, const wxString& classname) const = 0;
+ virtual wxString GetNodeContent(const wxXmlNode *node) = 0;
+ virtual bool HasParam(const wxString& param) = 0;
+ virtual wxXmlNode *GetParamNode(const wxString& param) = 0;
+ virtual wxString GetParamValue(const wxString& param) = 0;
+ virtual wxString GetParamValue(const wxXmlNode* node) = 0;
+ virtual int GetStyle(const wxString& param = wxT("style"), int defaults = 0) = 0;
+ virtual wxString GetText(const wxString& param, bool translate = true) = 0;
+ virtual int GetID() = 0;
+ virtual wxString GetName() = 0;
+ virtual bool GetBool(const wxString& param, bool defaultv = false) = 0;
+ virtual long GetLong(const wxString& param, long defaultv = 0) = 0;
+ virtual float GetFloat(const wxString& param, float defaultv = 0) = 0;
+ virtual wxColour GetColour(const wxString& param,
+ const wxColour& defaultv = wxNullColour) = 0;
+ virtual wxSize GetSize(const wxString& param = wxT("size"),
+ wxWindow *windowToUse = NULL) = 0;
+ virtual wxPoint GetPosition(const wxString& param = wxT("pos")) = 0;
+ virtual wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0,
+ wxWindow *windowToUse = NULL) = 0;
+ virtual wxDirection GetDirection(const wxString& param, wxDirection dir = wxLEFT) = 0;
+ virtual wxBitmap GetBitmap(const wxString& param = wxT("bitmap"),
+ const wxArtClient& defaultArtClient = wxART_OTHER,
+ wxSize size = wxDefaultSize) = 0;
+ virtual wxBitmap GetBitmap(const wxXmlNode* node,
+ const wxArtClient& defaultArtClient = wxART_OTHER,
+ wxSize size = wxDefaultSize) = 0;
+ virtual wxIcon GetIcon(const wxString& param = wxT("icon"),
+ const wxArtClient& defaultArtClient = wxART_OTHER,
+ wxSize size = wxDefaultSize) = 0;
+ virtual wxIcon GetIcon(const wxXmlNode* node,
+ const wxArtClient& defaultArtClient = wxART_OTHER,
+ wxSize size = wxDefaultSize) = 0;
+ virtual wxIconBundle GetIconBundle(const wxString& param,
+ const wxArtClient& defaultArtClient = wxART_OTHER) = 0;
+ virtual wxImageList *GetImageList(const wxString& param = wxT("imagelist")) = 0;
+
+#if wxUSE_ANIMATIONCTRL
+ virtual wxAnimation* GetAnimation(const wxString& param = wxT("animation")) = 0;
+#endif
+
+ virtual wxFont GetFont(const wxString& param = wxT("font"), wxWindow* parent = NULL) = 0;
+ virtual bool GetBoolAttr(const wxString& attr, bool defaultv) = 0;
+ virtual void SetupWindow(wxWindow *wnd) = 0;
+ virtual void CreateChildren(wxObject *parent, bool this_hnd_only = false) = 0;
+ virtual void CreateChildrenPrivately(wxObject *parent,
+ wxXmlNode *rootnode = NULL) = 0;
+ virtual wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent,
+ wxObject *instance = NULL) = 0;
+
+#if wxUSE_FILESYSTEM
+ virtual wxFileSystem& GetCurFileSystem() = 0;
+#endif
+ virtual void ReportError(wxXmlNode *context, const wxString& message) = 0;
+ virtual void ReportError(const wxString& message) = 0;
+ virtual void ReportParamError(const wxString& param, const wxString& message) = 0;
+
+ wxXmlResourceHandler* GetHandler() { return m_handler; }
+
+protected:
+ wxXmlResourceHandler *m_handler;
+};
+
+// Base class for all XRC handlers.
+//
+// Notice that this class is defined in the core library itself and so can be
+// used as the base class by classes in any GUI library. However to actually be
+// usable, it needs to be registered with wxXmlResource which implies linking
+// the application with the xrc library.
+//
+// Also note that all the methods forwarding to GetImpl() are documented only
+// in wxXmlResourceHandlerImpl in wx/xrc/xmlres.h to avoid duplication.
+
+class WXDLLIMPEXP_CORE wxXmlResourceHandler : public wxObject
+{
+public:
+ // Constructor creates an unusable object, before anything can be done with
+ // it, SetImpl() needs to be called as done by wxXmlResource::AddHandler().
+ wxXmlResourceHandler()
+ {
+ m_node = NULL;
+ m_parent =
+ m_instance = NULL;
+ m_parentAsWindow = NULL;
+ m_resource = NULL;
+
+ m_impl = NULL;
+ }
+
+ // This should be called exactly once.
+ void SetImpl(wxXmlResourceHandlerImplBase* impl)
+ {
+ wxASSERT_MSG( !m_impl, wxS("Should be called exactly once") );
+
+ m_impl = impl;
+ }
+
+
+ // Destructor.
+ virtual ~wxXmlResourceHandler()
+ {
+ delete m_impl;
+ }
+
+ wxObject *CreateResource(wxXmlNode *node, wxObject *parent,
+ wxObject *instance)
+ {
+ return GetImpl()->CreateResource(node, parent, instance);
+ }
+
+ // This one is called from CreateResource after variables
+ // were filled.
+ virtual wxObject *DoCreateResource() = 0;
+
+ // Returns true if it understands this node and can create
+ // a resource from it, false otherwise.
+ virtual bool CanHandle(wxXmlNode *node) = 0;
+
+
+ void SetParentResource(wxXmlResource *res)
+ {
+ m_resource = res;
+ }
+
+
+ // These methods are not forwarded to wxXmlResourceHandlerImpl because they
+ // are called from the derived classes ctors and so before SetImpl() can be
+ // called.
+
+ // Add a style flag (e.g. wxMB_DOCKABLE) to the list of flags
+ // understood by this handler.
+ void AddStyle(const wxString& name, int value);
+
+ // Add styles common to all wxWindow-derived classes.
+ void AddWindowStyles();
+
+protected:
+ // Everything else is simply forwarded to wxXmlResourceHandlerImpl.
+ void ReportError(wxXmlNode *context, const wxString& message)
+ {
+ GetImpl()->ReportError(context, message);
+ }
+ void ReportError(const wxString& message)
+ {
+ GetImpl()->ReportError(message);
+ }
+ void ReportParamError(const wxString& param, const wxString& message)
+ {
+ GetImpl()->ReportParamError(param, message);
+ }
+
+ bool IsOfClass(wxXmlNode *node, const wxString& classname) const
+ {
+ return GetImpl()->IsOfClass(node, classname);
+ }
+ wxString GetNodeContent(const wxXmlNode *node)
+ {
+ return GetImpl()->GetNodeContent(node);
+ }
+ bool HasParam(const wxString& param)
+ {
+ return GetImpl()->HasParam(param);
+ }
+
+ wxXmlNode *GetParamNode(const wxString& param)
+ {
+ return GetImpl()->GetParamNode(param);
+ }
+ wxString GetParamValue(const wxString& param)
+ {
+ return GetImpl()->GetParamValue(param);
+ }
+ wxString GetParamValue(const wxXmlNode* node)
+ {
+ return GetImpl()->GetParamValue(node);
+ }
+ int GetStyle(const wxString& param = wxT("style"), int defaults = 0)
+ {
+ return GetImpl()->GetStyle(param, defaults);
+ }
+ wxString GetText(const wxString& param, bool translate = true)
+ {
+ return GetImpl()->GetText(param, translate);
+ }
+ int GetID() const
+ {
+ return GetImpl()->GetID();
+ }
+ wxString GetName()
+ {
+ return GetImpl()->GetName();
+ }
+ bool GetBool(const wxString& param, bool defaultv = false)
+ {
+ return GetImpl()->GetBool(param, defaultv);
+ }
+ long GetLong(const wxString& param, long defaultv = 0)
+ {
+ return GetImpl()->GetLong(param, defaultv);
+ }
+ float GetFloat(const wxString& param, float defaultv = 0)
+ {
+ return GetImpl()->GetFloat(param, defaultv);
+ }
+ wxColour GetColour(const wxString& param,
+ const wxColour& defaultv = wxNullColour)
+ {
+ return GetImpl()->GetColour(param, defaultv);
+ }
+ wxSize GetSize(const wxString& param = wxT("size"),
+ wxWindow *windowToUse = NULL)
+ {
+ return GetImpl()->GetSize(param, windowToUse);
+ }
+ wxPoint GetPosition(const wxString& param = wxT("pos"))
+ {
+ return GetImpl()->GetPosition(param);
+ }
+ wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0,
+ wxWindow *windowToUse = NULL)
+ {
+ return GetImpl()->GetDimension(param, defaultv, windowToUse);
+ }
+ wxDirection GetDirection(const wxString& param, wxDirection dir = wxLEFT)
+ {
+ return GetImpl()->GetDirection(param, dir);
+ }
+ wxBitmap GetBitmap(const wxString& param = wxT("bitmap"),
+ const wxArtClient& defaultArtClient = wxART_OTHER,
+ wxSize size = wxDefaultSize)
+ {
+ return GetImpl()->GetBitmap(param, defaultArtClient, size);
+ }
+ wxBitmap GetBitmap(const wxXmlNode* node,
+ const wxArtClient& defaultArtClient = wxART_OTHER,
+ wxSize size = wxDefaultSize)
+ {
+ return GetImpl()->GetBitmap(node, defaultArtClient, size);
+ }
+ wxIcon GetIcon(const wxString& param = wxT("icon"),
+ const wxArtClient& defaultArtClient = wxART_OTHER,
+ wxSize size = wxDefaultSize)
+ {
+ return GetImpl()->GetIcon(param, defaultArtClient, size);
+ }
+ wxIcon GetIcon(const wxXmlNode* node,
+ const wxArtClient& defaultArtClient = wxART_OTHER,
+ wxSize size = wxDefaultSize)
+ {
+ return GetImpl()->GetIcon(node, defaultArtClient, size);
+ }
+ wxIconBundle GetIconBundle(const wxString& param,
+ const wxArtClient& defaultArtClient = wxART_OTHER)
+ {
+ return GetImpl()->GetIconBundle(param, defaultArtClient);
+ }
+ wxImageList *GetImageList(const wxString& param = wxT("imagelist"))
+ {
+ return GetImpl()->GetImageList(param);
+ }
+
+#if wxUSE_ANIMATIONCTRL
+ wxAnimation* GetAnimation(const wxString& param = wxT("animation"))
+ {
+ return GetImpl()->GetAnimation(param);
+ }
+#endif
+
+ wxFont GetFont(const wxString& param = wxT("font"),
+ wxWindow* parent = NULL)
+ {
+ return GetImpl()->GetFont(param, parent);
+ }
+ bool GetBoolAttr(const wxString& attr, bool defaultv)
+ {
+ return GetImpl()->GetBoolAttr(attr, defaultv);
+ }
+ void SetupWindow(wxWindow *wnd)
+ {
+ GetImpl()->SetupWindow(wnd);
+ }
+ void CreateChildren(wxObject *parent, bool this_hnd_only = false)
+ {
+ GetImpl()->CreateChildren(parent, this_hnd_only);
+ }
+ void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL)
+ {
+ GetImpl()->CreateChildrenPrivately(parent, rootnode);
+ }
+ wxObject *CreateResFromNode(wxXmlNode *node,
+ wxObject *parent, wxObject *instance = NULL)
+ {
+ return GetImpl()->CreateResFromNode(node, parent, instance);
+ }
+
+#if wxUSE_FILESYSTEM
+ wxFileSystem& GetCurFileSystem()
+ {
+ return GetImpl()->GetCurFileSystem();
+ }
+#endif
+
+ // Variables (filled by CreateResource)
+ wxXmlNode *m_node;
+ wxString m_class;
+ wxObject *m_parent, *m_instance;
+ wxWindow *m_parentAsWindow;
+ wxXmlResource *m_resource;
+
+ // provide method access to those member variables
+ wxXmlResource* GetResource() const { return m_resource; }
+ wxXmlNode* GetNode() const { return m_node; }
+ wxString GetClass() const { return m_class; }
+ wxObject* GetParent() const { return m_parent; }
+ wxObject* GetInstance() const { return m_instance; }
+ wxWindow* GetParentAsWindow() const { return m_parentAsWindow; }
+
+
+ wxArrayString m_styleNames;
+ wxArrayInt m_styleValues;
+
+ friend class wxXmlResourceHandlerImpl;
+
+private:
+ // This is supposed to never return NULL because SetImpl() should have been
+ // called.
+ wxXmlResourceHandlerImplBase* GetImpl() const;
+
+ wxXmlResourceHandlerImplBase *m_impl;
+
+ wxDECLARE_ABSTRACT_CLASS(wxXmlResourceHandler);
+};
+
+#endif // wxUSE_XRC
+
+#endif // _WX_XRC_XMLRESHANDLER_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xti.h
+// Purpose: runtime metadata information (extended class info)
+// Author: Stefan Csomor
+// Modified by: Francesco Montorsi
+// Created: 27/07/03
+// Copyright: (c) 1997 Julian Smart
+// (c) 2003 Stefan Csomor
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XTIH__
+#define _WX_XTIH__
+
+// We want to support properties, event sources and events sinks through
+// explicit declarations, using templates and specialization to make the
+// effort as painless as possible.
+//
+// This means we have the following domains :
+//
+// - Type Information for categorizing built in types as well as custom types
+// this includes information about enums, their values and names
+// - Type safe value storage : a kind of wxVariant, called right now wxAny
+// which will be merged with wxVariant
+// - Property Information and Property Accessors providing access to a class'
+// values and exposed event delegates
+// - Information about event handlers
+// - extended Class Information for accessing all these
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#if wxUSE_EXTENDED_RTTI
+
+class WXDLLIMPEXP_FWD_BASE wxAny;
+class WXDLLIMPEXP_FWD_BASE wxAnyList;
+class WXDLLIMPEXP_FWD_BASE wxObject;
+class WXDLLIMPEXP_FWD_BASE wxString;
+class WXDLLIMPEXP_FWD_BASE wxClassInfo;
+class WXDLLIMPEXP_FWD_BASE wxHashTable;
+class WXDLLIMPEXP_FWD_BASE wxObject;
+class WXDLLIMPEXP_FWD_BASE wxPluginLibrary;
+class WXDLLIMPEXP_FWD_BASE wxHashTable;
+class WXDLLIMPEXP_FWD_BASE wxHashTable_Node;
+
+class WXDLLIMPEXP_FWD_BASE wxStringToAnyHashMap;
+class WXDLLIMPEXP_FWD_BASE wxPropertyInfoMap;
+class WXDLLIMPEXP_FWD_BASE wxPropertyAccessor;
+class WXDLLIMPEXP_FWD_BASE wxObjectAllocatorAndCreator;
+class WXDLLIMPEXP_FWD_BASE wxObjectAllocator;
+
+
+#define wx_dynamic_cast(t, x) dynamic_cast<t>(x)
+
+#include "wx/xtitypes.h"
+#include "wx/xtihandler.h"
+
+// ----------------------------------------------------------------------------
+// wxClassInfo
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxObjectFunctor
+{
+public:
+ virtual ~wxObjectFunctor();
+
+ // Invoke the actual event handler:
+ virtual void operator()(const wxObject *) = 0;
+};
+
+class WXDLLIMPEXP_FWD_BASE wxPropertyInfo;
+class WXDLLIMPEXP_FWD_BASE wxHandlerInfo;
+
+typedef wxObject *(*wxObjectConstructorFn)(void);
+typedef wxPropertyInfo *(*wxPropertyInfoFn)(void);
+typedef wxHandlerInfo *(*wxHandlerInfoFn)(void);
+typedef void (*wxVariantToObjectConverter)( const wxAny &data, wxObjectFunctor* fn );
+typedef wxObject* (*wxVariantToObjectPtrConverter) ( const wxAny& data);
+typedef wxAny (*wxObjectToVariantConverter)( wxObject* );
+
+WXDLLIMPEXP_BASE wxString wxAnyGetAsString( const wxAny& data);
+WXDLLIMPEXP_BASE const wxObject* wxAnyGetAsObjectPtr( const wxAny& data);
+
+class WXDLLIMPEXP_BASE wxObjectWriter;
+class WXDLLIMPEXP_BASE wxObjectWriterCallback;
+
+typedef bool (*wxObjectStreamingCallback) ( const wxObject *, wxObjectWriter *, \
+ wxObjectWriterCallback *, const wxStringToAnyHashMap & );
+
+
+
+class WXDLLIMPEXP_BASE wxClassInfo
+{
+ friend class WXDLLIMPEXP_BASE wxPropertyInfo;
+ friend class /* WXDLLIMPEXP_BASE */ wxHandlerInfo;
+ friend wxObject *wxCreateDynamicObject(const wxString& name);
+
+public:
+ wxClassInfo(const wxClassInfo **_Parents,
+ const wxChar *_UnitName,
+ const wxChar *_ClassName,
+ int size,
+ wxObjectConstructorFn ctor,
+ wxPropertyInfoFn _Props,
+ wxHandlerInfoFn _Handlers,
+ wxObjectAllocatorAndCreator* _Constructor,
+ const wxChar ** _ConstructorProperties,
+ const int _ConstructorPropertiesCount,
+ wxVariantToObjectPtrConverter _PtrConverter1,
+ wxVariantToObjectConverter _Converter2,
+ wxObjectToVariantConverter _Converter3,
+ wxObjectStreamingCallback _streamingCallback = NULL) :
+ m_className(_ClassName),
+ m_objectSize(size),
+ m_objectConstructor(ctor),
+ m_next(sm_first),
+ m_firstPropertyFn(_Props),
+ m_firstHandlerFn(_Handlers),
+ m_firstProperty(NULL),
+ m_firstHandler(NULL),
+ m_firstInited(false),
+ m_parents(_Parents),
+ m_unitName(_UnitName),
+ m_constructor(_Constructor),
+ m_constructorProperties(_ConstructorProperties),
+ m_constructorPropertiesCount(_ConstructorPropertiesCount),
+ m_variantOfPtrToObjectConverter(_PtrConverter1),
+ m_variantToObjectConverter(_Converter2),
+ m_objectToVariantConverter(_Converter3),
+ m_streamingCallback(_streamingCallback)
+ {
+ sm_first = this;
+ Register();
+ }
+
+ wxClassInfo(const wxChar *_UnitName, const wxChar *_ClassName,
+ const wxClassInfo **_Parents) :
+ m_className(_ClassName),
+ m_objectSize(0),
+ m_objectConstructor(NULL),
+ m_next(sm_first),
+ m_firstPropertyFn(NULL),
+ m_firstHandlerFn(NULL),
+ m_firstProperty(NULL),
+ m_firstHandler(NULL),
+ m_firstInited(true),
+ m_parents(_Parents),
+ m_unitName(_UnitName),
+ m_constructor(NULL),
+ m_constructorProperties(NULL),
+ m_constructorPropertiesCount(0),
+ m_variantOfPtrToObjectConverter(NULL),
+ m_variantToObjectConverter(NULL),
+ m_objectToVariantConverter(NULL),
+ m_streamingCallback(NULL)
+ {
+ sm_first = this;
+ Register();
+ }
+
+ // ctor compatible with old RTTI system
+ wxClassInfo(const wxChar *_ClassName,
+ const wxClassInfo *_Parent1,
+ const wxClassInfo *_Parent2,
+ int size,
+ wxObjectConstructorFn ctor) :
+ m_className(_ClassName),
+ m_objectSize(size),
+ m_objectConstructor(ctor),
+ m_next(sm_first),
+ m_firstPropertyFn(NULL),
+ m_firstHandlerFn(NULL),
+ m_firstProperty(NULL),
+ m_firstHandler(NULL),
+ m_firstInited(true),
+ m_parents(NULL),
+ m_unitName(NULL),
+ m_constructor(NULL),
+ m_constructorProperties(NULL),
+ m_constructorPropertiesCount(0),
+ m_variantOfPtrToObjectConverter(NULL),
+ m_variantToObjectConverter(NULL),
+ m_objectToVariantConverter(NULL),
+ m_streamingCallback(NULL)
+ {
+ sm_first = this;
+ m_parents[0] = _Parent1;
+ m_parents[1] = _Parent2;
+ m_parents[2] = NULL;
+ Register();
+ }
+
+ virtual ~wxClassInfo();
+
+ // allocates an instance of this class, this object does not have to be
+ // initialized or fully constructed as this call will be followed by a call to Create
+ virtual wxObject *AllocateObject() const
+ { return m_objectConstructor ? (*m_objectConstructor)() : 0; }
+
+ // 'old naming' for AllocateObject staying here for backward compatibility
+ wxObject *CreateObject() const { return AllocateObject(); }
+
+ // direct construction call for classes that cannot construct instances via alloc/create
+ wxObject *ConstructObject(int ParamCount, wxAny *Params) const;
+
+ bool NeedsDirectConstruction() const;
+
+ const wxChar *GetClassName() const
+ { return m_className; }
+ const wxChar *GetBaseClassName1() const
+ { return m_parents[0] ? m_parents[0]->GetClassName() : NULL; }
+ const wxChar *GetBaseClassName2() const
+ { return (m_parents[0] && m_parents[1]) ? m_parents[1]->GetClassName() : NULL; }
+
+ const wxClassInfo *GetBaseClass1() const
+ { return m_parents[0]; }
+ const wxClassInfo *GetBaseClass2() const
+ { return m_parents[0] ? m_parents[1] : NULL; }
+
+ const wxChar *GetIncludeName() const
+ { return m_unitName; }
+ const wxClassInfo **GetParents() const
+ { return m_parents; }
+ int GetSize() const
+ { return m_objectSize; }
+ bool IsDynamic() const
+ { return (NULL != m_objectConstructor); }
+
+ wxObjectConstructorFn GetConstructor() const
+ { return m_objectConstructor; }
+ const wxClassInfo *GetNext() const
+ { return m_next; }
+
+ // statics:
+
+ static void CleanUp();
+ static wxClassInfo *FindClass(const wxString& className);
+ static const wxClassInfo *GetFirst()
+ { return sm_first; }
+
+
+ // Climb upwards through inheritance hierarchy.
+ // Dual inheritance is catered for.
+
+ bool IsKindOf(const wxClassInfo *info) const;
+
+ wxDECLARE_CLASS_INFO_ITERATORS();
+
+ // if there is a callback registered with that class it will be called
+ // before this object will be written to disk, it can veto streaming out
+ // this object by returning false, if this class has not registered a
+ // callback, the search will go up the inheritance tree if no callback has
+ // been registered true will be returned by default
+ bool BeforeWriteObject( const wxObject *obj, wxObjectWriter *streamer,
+ wxObjectWriterCallback *writercallback, const wxStringToAnyHashMap &metadata) const;
+
+ // gets the streaming callback from this class or any superclass
+ wxObjectStreamingCallback GetStreamingCallback() const;
+
+ // returns the first property
+ wxPropertyInfo* GetFirstProperty() const
+ { EnsureInfosInited(); return m_firstProperty; }
+
+ // returns the first handler
+ wxHandlerInfo* GetFirstHandler() const
+ { EnsureInfosInited(); return m_firstHandler; }
+
+ // Call the Create upon an instance of the class, in the end the object is fully
+ // initialized
+ virtual bool Create (wxObject *object, int ParamCount, wxAny *Params) const;
+
+ // get number of parameters for constructor
+ virtual int GetCreateParamCount() const
+ { return m_constructorPropertiesCount; }
+
+ // get n-th constructor parameter
+ virtual const wxChar* GetCreateParamName(int n) const
+ { return m_constructorProperties[n]; }
+
+ // Runtime access to objects for simple properties (get/set) by property
+ // name and variant data
+ virtual void SetProperty (wxObject *object, const wxChar *propertyName,
+ const wxAny &value) const;
+ virtual wxAny GetProperty (wxObject *object, const wxChar *propertyName) const;
+
+ // Runtime access to objects for collection properties by property name
+ virtual wxAnyList GetPropertyCollection(wxObject *object,
+ const wxChar *propertyName) const;
+ virtual void AddToPropertyCollection(wxObject *object, const wxChar *propertyName,
+ const wxAny& value) const;
+
+ // we must be able to cast variants to wxObject pointers, templates seem
+ // not to be suitable
+ void CallOnAny( const wxAny &data, wxObjectFunctor* functor ) const;
+
+ wxObject* AnyToObjectPtr( const wxAny &data) const;
+
+ wxAny ObjectPtrToAny( wxObject *object ) const;
+
+ // find property by name
+ virtual const wxPropertyInfo *FindPropertyInfo (const wxChar *PropertyName) const;
+
+ // find handler by name
+ virtual const wxHandlerInfo *FindHandlerInfo (const wxChar *handlerName) const;
+
+ // find property by name
+ virtual wxPropertyInfo *FindPropertyInfoInThisClass (const wxChar *PropertyName) const;
+
+ // find handler by name
+ virtual wxHandlerInfo *FindHandlerInfoInThisClass (const wxChar *handlerName) const;
+
+ // puts all the properties of this class and its superclasses in the map,
+ // as long as there is not yet an entry with the same name (overriding mechanism)
+ void GetProperties( wxPropertyInfoMap &map ) const;
+
+private:
+ const wxChar *m_className;
+ int m_objectSize;
+ wxObjectConstructorFn m_objectConstructor;
+
+ // class info object live in a linked list:
+ // pointers to its head and the next element in it
+
+ static wxClassInfo *sm_first;
+ wxClassInfo *m_next;
+
+ static wxHashTable *sm_classTable;
+
+ wxPropertyInfoFn m_firstPropertyFn;
+ wxHandlerInfoFn m_firstHandlerFn;
+
+
+protected:
+ void EnsureInfosInited() const
+ {
+ if ( !m_firstInited)
+ {
+ if ( m_firstPropertyFn != NULL)
+ m_firstProperty = (*m_firstPropertyFn)();
+ if ( m_firstHandlerFn != NULL)
+ m_firstHandler = (*m_firstHandlerFn)();
+ m_firstInited = true;
+ }
+ }
+ mutable wxPropertyInfo* m_firstProperty;
+ mutable wxHandlerInfo* m_firstHandler;
+
+private:
+ mutable bool m_firstInited;
+
+ const wxClassInfo** m_parents;
+ const wxChar* m_unitName;
+
+ wxObjectAllocatorAndCreator* m_constructor;
+ const wxChar ** m_constructorProperties;
+ const int m_constructorPropertiesCount;
+ wxVariantToObjectPtrConverter m_variantOfPtrToObjectConverter;
+ wxVariantToObjectConverter m_variantToObjectConverter;
+ wxObjectToVariantConverter m_objectToVariantConverter;
+ wxObjectStreamingCallback m_streamingCallback;
+
+ const wxPropertyAccessor *FindAccessor (const wxChar *propertyName) const;
+
+protected:
+ // registers the class
+ void Register();
+ void Unregister();
+
+ DECLARE_NO_COPY_CLASS(wxClassInfo)
+};
+
+WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name);
+
+// ----------------------------------------------------------------------------
+// wxDynamicClassInfo
+// ----------------------------------------------------------------------------
+
+// this object leads to having a pure runtime-instantiation
+
+class WXDLLIMPEXP_BASE wxDynamicClassInfo : public wxClassInfo
+{
+ friend class WXDLLIMPEXP_BASE wxDynamicObject;
+
+public:
+ wxDynamicClassInfo( const wxChar *_UnitName, const wxChar *_ClassName,
+ const wxClassInfo* superClass );
+ virtual ~wxDynamicClassInfo();
+
+ // constructs a wxDynamicObject with an instance
+ virtual wxObject *AllocateObject() const;
+
+ // Call the Create method for a class
+ virtual bool Create (wxObject *object, int ParamCount, wxAny *Params) const;
+
+ // get number of parameters for constructor
+ virtual int GetCreateParamCount() const;
+
+ // get i-th constructor parameter
+ virtual const wxChar* GetCreateParamName(int i) const;
+
+ // Runtime access to objects by property name, and variant data
+ virtual void SetProperty (wxObject *object, const wxChar *PropertyName,
+ const wxAny &Value) const;
+ virtual wxAny GetProperty (wxObject *object, const wxChar *PropertyName) const;
+
+ // adds a property to this class at runtime
+ void AddProperty( const wxChar *propertyName, const wxTypeInfo* typeInfo );
+
+ // removes an existing runtime-property
+ void RemoveProperty( const wxChar *propertyName );
+
+ // renames an existing runtime-property
+ void RenameProperty( const wxChar *oldPropertyName, const wxChar *newPropertyName );
+
+ // as a handler to this class at runtime
+ void AddHandler( const wxChar *handlerName, wxObjectEventFunction address,
+ const wxClassInfo* eventClassInfo );
+
+ // removes an existing runtime-handler
+ void RemoveHandler( const wxChar *handlerName );
+
+ // renames an existing runtime-handler
+ void RenameHandler( const wxChar *oldHandlerName, const wxChar *newHandlerName );
+
+private:
+ struct wxDynamicClassInfoInternal;
+ wxDynamicClassInfoInternal* m_data;
+};
+
+// ----------------------------------------------------------------------------
+// wxDECLARE class macros
+// ----------------------------------------------------------------------------
+
+#define _DECLARE_DYNAMIC_CLASS(name) \
+ public: \
+ static wxClassInfo ms_classInfo; \
+ static const wxClassInfo* ms_classParents[]; \
+ static wxPropertyInfo* GetPropertiesStatic(); \
+ static wxHandlerInfo* GetHandlersStatic(); \
+ static wxClassInfo *GetClassInfoStatic() \
+ { return &name::ms_classInfo; } \
+ virtual wxClassInfo *GetClassInfo() const \
+ { return &name::ms_classInfo; }
+
+#define wxDECLARE_DYNAMIC_CLASS(name) \
+ static wxObjectAllocatorAndCreator* ms_constructor; \
+ static const wxChar * ms_constructorProperties[]; \
+ static const int ms_constructorPropertiesCount; \
+ _DECLARE_DYNAMIC_CLASS(name)
+
+#define wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \
+ wxDECLARE_NO_ASSIGN_CLASS(name); \
+ wxDECLARE_DYNAMIC_CLASS(name)
+
+#define wxDECLARE_DYNAMIC_CLASS_NO_COPY(name) \
+ wxDECLARE_NO_COPY_CLASS(name); \
+ wxDECLARE_DYNAMIC_CLASS(name)
+
+#define wxDECLARE_CLASS(name) \
+ wxDECLARE_DYNAMIC_CLASS(name)
+
+#define wxDECLARE_ABSTRACT_CLASS(name) _DECLARE_DYNAMIC_CLASS(name)
+#define wxCLASSINFO(name) (&name::ms_classInfo)
+
+#endif // wxUSE_EXTENDED_RTTI
+#endif // _WX_XTIH__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/wxt2.h
+// Purpose: runtime metadata information (extended class info)
+// Author: Stefan Csomor
+// Modified by: Francesco Montorsi
+// Created: 27/07/03
+// Copyright: (c) 1997 Julian Smart
+// (c) 2003 Stefan Csomor
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XTI2H__
+#define _WX_XTI2H__
+
+// ----------------------------------------------------------------------------
+// second part of xti headers, is included from object.h
+// ----------------------------------------------------------------------------
+
+#if wxUSE_EXTENDED_RTTI
+
+// ----------------------------------------------------------------------------
+// wxDynamicObject class, its instances connect to a 'super class instance'
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxDynamicObject : public wxObject
+{
+ friend class WXDLLIMPEXP_FWD_BASE wxDynamicClassInfo ;
+public:
+ // instantiates this object with an instance of its superclass
+ wxDynamicObject(wxObject* superClassInstance, const wxDynamicClassInfo *info) ;
+ virtual ~wxDynamicObject();
+
+ void SetProperty (const wxChar *propertyName, const wxAny &value);
+ wxAny GetProperty (const wxChar *propertyName) const ;
+
+ // get the runtime identity of this object
+ wxClassInfo *GetClassInfo() const
+ {
+#ifdef _MSC_VER
+ return (wxClassInfo*) m_classInfo;
+#else
+ wxDynamicClassInfo *nonconst = const_cast<wxDynamicClassInfo *>(m_classInfo);
+ return static_cast<wxClassInfo *>(nonconst);
+#endif
+ }
+
+ wxObject* GetSuperClassInstance() const
+ {
+ return m_superClassInstance ;
+ }
+private :
+ // removes an existing runtime-property
+ void RemoveProperty( const wxChar *propertyName ) ;
+
+ // renames an existing runtime-property
+ void RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) ;
+
+ wxObject *m_superClassInstance ;
+ const wxDynamicClassInfo *m_classInfo;
+ struct wxDynamicObjectInternal;
+ wxDynamicObjectInternal *m_data;
+};
+
+// ----------------------------------------------------------------------------
+// String conversion templates supporting older compilers
+// ----------------------------------------------------------------------------
+
+#if wxUSE_FUNC_TEMPLATE_POINTER
+# define wxTO_STRING(type) wxToStringConverter<type>
+# define wxTO_STRING_IMP(type)
+# define wxFROM_STRING(type) wxFromStringConverter<type>
+# define wxFROM_STRING_IMP(type)
+#else
+# define wxTO_STRING(type) ToString##type
+# define wxTO_STRING_IMP(type) \
+ inline void ToString##type( const wxAny& data, wxString &result ) \
+{ wxToStringConverter<type>(data, result); }
+
+# define wxFROM_STRING(type) FromString##type
+# define wxFROM_STRING_IMP(type) \
+ inline void FromString##type( const wxString& data, wxAny &result ) \
+{ wxFromStringConverter<type>(data, result); }
+#endif
+
+#include "wx/xtiprop.h"
+#include "wx/xtictor.h"
+
+// ----------------------------------------------------------------------------
+// wxIMPLEMENT class macros for concrete classes
+// ----------------------------------------------------------------------------
+
+// Single inheritance with one base class
+
+#define _DEFAULT_CONSTRUCTOR(name) \
+wxObject* wxConstructorFor##name() \
+{ return new name; }
+
+#define _DEFAULT_CONVERTERS(name) \
+wxObject* wxVariantOfPtrToObjectConverter##name ( const wxAny &data ) \
+{ return data.As( (name**)NULL ); } \
+ wxAny wxObjectToVariantConverter##name ( wxObject *data ) \
+{ return wxAny( wx_dynamic_cast(name*, data) ); }
+
+#define _TYPEINFO_CLASSES(n, toString, fromString ) \
+ wxClassTypeInfo s_typeInfo##n(wxT_OBJECT, &n::ms_classInfo, \
+ toString, fromString, typeid(n).name()); \
+ wxClassTypeInfo s_typeInfoPtr##n(wxT_OBJECT_PTR, &n::ms_classInfo, \
+ toString, fromString, typeid(n*).name());
+
+#define _IMPLEMENT_DYNAMIC_CLASS(name, basename, unit, callback) \
+ _DEFAULT_CONSTRUCTOR(name) \
+ _DEFAULT_CONVERTERS(name) \
+ \
+ const wxClassInfo* name::ms_classParents[] = \
+{ &basename::ms_classInfo, NULL }; \
+ wxClassInfo name::ms_classInfo(name::ms_classParents, wxT(unit), \
+ wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name, \
+ name::GetPropertiesStatic, name::GetHandlersStatic, name::ms_constructor, \
+ name::ms_constructorProperties, name::ms_constructorPropertiesCount, \
+ wxVariantOfPtrToObjectConverter##name, NULL, wxObjectToVariantConverter##name, \
+ callback);
+
+#define _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY(name, basename, unit, callback ) \
+ _DEFAULT_CONSTRUCTOR(name) \
+ _DEFAULT_CONVERTERS(name) \
+ void wxVariantToObjectConverter##name ( const wxAny &data, wxObjectFunctor* fn ) \
+ { name o = wxANY_AS(data, name); (*fn)( &o ); } \
+ \
+ const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo,NULL }; \
+ wxClassInfo name::ms_classInfo(name::ms_classParents, wxT(unit), \
+ wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name, \
+ name::GetPropertiesStatic,name::GetHandlersStatic,name::ms_constructor, \
+ name::ms_constructorProperties, name::ms_constructorPropertiesCount, \
+ wxVariantOfPtrToObjectConverter##name, wxVariantToObjectConverter##name, \
+ wxObjectToVariantConverter##name, callback);
+
+#define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename ) \
+ _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename, "", NULL ) \
+ _TYPEINFO_CLASSES(name, NULL, NULL) \
+ const wxPropertyInfo *name::GetPropertiesStatic() \
+{ return (wxPropertyInfo*) NULL; } \
+ const wxHandlerInfo *name::GetHandlersStatic() \
+{ return (wxHandlerInfo*) NULL; } \
+ wxCONSTRUCTOR_DUMMY( name )
+
+#define wxIMPLEMENT_DYNAMIC_CLASS( name, basename ) \
+ _IMPLEMENT_DYNAMIC_CLASS( name, basename, "", NULL ) \
+ _TYPEINFO_CLASSES(name, NULL, NULL) \
+ wxPropertyInfo *name::GetPropertiesStatic() \
+{ return (wxPropertyInfo*) NULL; } \
+ wxHandlerInfo *name::GetHandlersStatic() \
+{ return (wxHandlerInfo*) NULL; } \
+ wxCONSTRUCTOR_DUMMY( name )
+
+#define wxIMPLEMENT_DYNAMIC_CLASS_XTI( name, basename, unit ) \
+ _IMPLEMENT_DYNAMIC_CLASS( name, basename, unit, NULL ) \
+ _TYPEINFO_CLASSES(name, NULL, NULL)
+
+#define wxIMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK( name, basename, unit, callback )\
+ _IMPLEMENT_DYNAMIC_CLASS( name, basename, unit, &callback ) \
+ _TYPEINFO_CLASSES(name, NULL, NULL)
+
+#define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI( name, basename, unit ) \
+ _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename, unit, NULL ) \
+ _TYPEINFO_CLASSES(name, NULL, NULL)
+
+#define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( name, basename, \
+ unit, toString, \
+ fromString ) \
+ _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename, unit, NULL ) \
+ _TYPEINFO_CLASSES(name, toString, fromString)
+
+// this is for classes that do not derive from wxObject, there are no creators for these
+
+#define wxIMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_NO_BASE_XTI( name, unit ) \
+ const wxClassInfo* name::ms_classParents[] = { NULL }; \
+ wxClassInfo name::ms_classInfo(name::ms_classParents, wxEmptyString, \
+ wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) 0, \
+ name::GetPropertiesStatic,name::GetHandlersStatic, 0, 0, \
+ 0, 0, 0 ); \
+ _TYPEINFO_CLASSES(name, NULL, NULL)
+
+// this is for subclasses that still do not derive from wxObject
+
+#define wxIMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_XTI( name, basename, unit ) \
+ const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo, NULL }; \
+ wxClassInfo name::ms_classInfo(name::ms_classParents, wxEmptyString, \
+ wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) 0, \
+ name::GetPropertiesStatic,name::GetHandlersStatic, 0, 0, \
+ 0, 0, 0 ); \
+ _TYPEINFO_CLASSES(name, NULL, NULL)
+
+
+// Multiple inheritance with two base classes
+
+#define _IMPLEMENT_DYNAMIC_CLASS2(name, basename, basename2, unit, callback) \
+ _DEFAULT_CONSTRUCTOR(name) \
+ _DEFAULT_CONVERTERS(name) \
+ \
+ const wxClassInfo* name::ms_classParents[] = \
+{ &basename::ms_classInfo,&basename2::ms_classInfo, NULL }; \
+ wxClassInfo name::ms_classInfo(name::ms_classParents, wxT(unit), \
+ wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name, \
+ name::GetPropertiesStatic,name::GetHandlersStatic,name::ms_constructor, \
+ name::ms_constructorProperties, name::ms_constructorPropertiesCount, \
+ wxVariantOfPtrToObjectConverter##name, NULL, wxObjectToVariantConverter##name, \
+ callback);
+
+#define wxIMPLEMENT_DYNAMIC_CLASS2( name, basename, basename2) \
+ _IMPLEMENT_DYNAMIC_CLASS2( name, basename, basename2, "", NULL) \
+ _TYPEINFO_CLASSES(name, NULL, NULL) \
+ wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL; } \
+ wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL; } \
+ wxCONSTRUCTOR_DUMMY( name )
+
+#define wxIMPLEMENT_DYNAMIC_CLASS2_XTI( name, basename, basename2, unit) \
+ _IMPLEMENT_DYNAMIC_CLASS2( name, basename, basename2, unit, NULL) \
+ _TYPEINFO_CLASSES(name, NULL, NULL)
+
+
+
+// ----------------------------------------------------------------------------
+// wxIMPLEMENT class macros for abstract classes
+// ----------------------------------------------------------------------------
+
+// Single inheritance with one base class
+
+#define _IMPLEMENT_ABSTRACT_CLASS(name, basename) \
+ _DEFAULT_CONVERTERS(name) \
+ \
+ const wxClassInfo* name::ms_classParents[] = \
+{ &basename::ms_classInfo,NULL }; \
+ wxClassInfo name::ms_classInfo(name::ms_classParents, wxEmptyString, \
+ wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) 0, \
+ name::GetPropertiesStatic,name::GetHandlersStatic, 0, 0, \
+ 0, wxVariantOfPtrToObjectConverter##name,0, \
+ wxObjectToVariantConverter##name); \
+ _TYPEINFO_CLASSES(name, NULL, NULL)
+
+#define wxIMPLEMENT_ABSTRACT_CLASS( name, basename ) \
+ _IMPLEMENT_ABSTRACT_CLASS( name, basename ) \
+ wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL; } \
+ wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL; }
+
+// Multiple inheritance with two base classes
+
+#define wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \
+ wxClassInfo name::ms_classInfo(wxT(#name), wxT(#basename1), \
+ wxT(#basename2), (int) sizeof(name), \
+ (wxObjectConstructorFn) 0);
+
+// templated streaming, every type that can be converted to wxString
+// must have their specialization for these methods
+
+template<typename T>
+void wxStringReadValue( const wxString &s, T &data );
+
+template<typename T>
+void wxStringWriteValue( wxString &s, const T &data);
+
+template<typename T>
+void wxToStringConverter( const wxAny &v, wxString &s )
+{ wxStringWriteValue(s, wxANY_AS(v, T)); }
+
+template<typename T>
+void wxFromStringConverter( const wxString &s, wxAny &v)
+{ T d; wxStringReadValue(s, d); v = wxAny(d); }
+
+// --------------------------------------------------------------------------
+// Collection Support
+// --------------------------------------------------------------------------
+
+template<typename iter, typename collection_t > void wxListCollectionToAnyList(
+ const collection_t& coll, wxAnyList &value )
+{
+ for ( iter current = coll.GetFirst(); current;
+ current = current->GetNext() )
+ {
+ value.Append( new wxAny(current->GetData()) );
+ }
+}
+
+template<typename collection_t> void wxArrayCollectionToVariantArray(
+ const collection_t& coll, wxAnyList &value )
+{
+ for( size_t i = 0; i < coll.GetCount(); i++ )
+ {
+ value.Append( new wxAny(coll[i]) );
+ }
+}
+
+#endif
+
+#endif // _WX_XTIH2__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xtictor.h
+// Purpose: XTI constructors
+// Author: Stefan Csomor
+// Modified by: Francesco Montorsi
+// Created: 27/07/03
+// Copyright: (c) 1997 Julian Smart
+// (c) 2003 Stefan Csomor
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _XTICTOR_H_
+#define _XTICTOR_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_EXTENDED_RTTI
+
+#include "wx/xti.h"
+
+// ----------------------------------------------------------------------------
+// Constructor Bridges
+// ----------------------------------------------------------------------------
+
+// A constructor bridge allows to call a ctor with an arbitrary number
+// or parameters during runtime
+class WXDLLIMPEXP_BASE wxObjectAllocatorAndCreator
+{
+public:
+ virtual ~wxObjectAllocatorAndCreator() { }
+ virtual bool Create(wxObject * &o, wxAny *args) = 0;
+};
+
+// a direct constructor bridge calls the operator new for this class and
+// passes all params to the constructor. Needed for classes that cannot be
+// instantiated using alloc-create semantics
+class WXDLLIMPEXP_BASE wxObjectAllocator : public wxObjectAllocatorAndCreator
+{
+public:
+ virtual bool Create(wxObject * &o, wxAny *args) = 0;
+};
+
+
+// ----------------------------------------------------------------------------
+// Constructor Bridges for all Numbers of Params
+// ----------------------------------------------------------------------------
+
+// no params
+
+template<typename Class>
+struct wxObjectAllocatorAndCreator_0 : public wxObjectAllocatorAndCreator
+{
+ bool Create(wxObject * &o, wxAny *)
+ {
+ Class *obj = wx_dynamic_cast(Class*, o);
+ return obj->Create();
+ }
+};
+
+struct wxObjectAllocatorAndCreator_Dummy : public wxObjectAllocatorAndCreator
+{
+ bool Create(wxObject *&, wxAny *)
+ {
+ return true;
+ }
+};
+
+#define wxCONSTRUCTOR_0(klass) \
+ wxObjectAllocatorAndCreator_0<klass> constructor##klass; \
+ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
+ const wxChar *klass::ms_constructorProperties[] = { NULL }; \
+ const int klass::ms_constructorPropertiesCount = 0;
+
+#define wxCONSTRUCTOR_DUMMY(klass) \
+ wxObjectAllocatorAndCreator_Dummy constructor##klass; \
+ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
+ const wxChar *klass::ms_constructorProperties[] = { NULL }; \
+ const int klass::ms_constructorPropertiesCount = 0;
+
+// direct constructor version
+
+template<typename Class>
+struct wxDirectConstructorBridge_0 : public wxObjectAllocator
+{
+ bool Create(wxObject * &o, wxAny *args)
+ {
+ o = new Class( );
+ return o != NULL;
+ }
+};
+
+#define wxDIRECT_CONSTRUCTOR_0(klass) \
+ wxDirectConstructorBridge_0<klass> constructor##klass; \
+ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
+ const wxChar *klass::ms_constructorProperties[] = { NULL }; \
+ const int klass::ms_constructorPropertiesCount = 0;
+
+
+// 1 param
+
+template<typename Class, typename T0>
+struct wxObjectAllocatorAndCreator_1 : public wxObjectAllocatorAndCreator
+{
+ bool Create(wxObject * &o, wxAny *args)
+ {
+ Class *obj = wx_dynamic_cast(Class*, o);
+ return obj->Create(
+ (args[0]).As(static_cast<T0*>(NULL))
+ );
+ }
+};
+
+#define wxCONSTRUCTOR_1(klass,t0,v0) \
+ wxObjectAllocatorAndCreator_1<klass,t0> constructor##klass; \
+ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
+ const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) }; \
+ const int klass::ms_constructorPropertiesCount = 1;
+
+// direct constructor version
+
+template<typename Class, typename T0>
+struct wxDirectConstructorBridge_1 : public wxObjectAllocator
+{
+ bool Create(wxObject * &o, wxAny *args)
+ {
+ o = new Class(
+ (args[0]).As(static_cast<T0*>(NULL))
+ );
+ return o != NULL;
+ }
+};
+
+#define wxDIRECT_CONSTRUCTOR_1(klass,t0,v0) \
+ wxDirectConstructorBridge_1<klass,t0,t1> constructor##klass; \
+ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
+ const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) }; \
+ const int klass::ms_constructorPropertiesCount = 1;
+
+
+// 2 params
+
+template<typename Class,
+typename T0, typename T1>
+struct wxObjectAllocatorAndCreator_2 : public wxObjectAllocatorAndCreator
+{
+ bool Create(wxObject * &o, wxAny *args)
+ {
+ Class *obj = wx_dynamic_cast(Class*, o);
+ return obj->Create(
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL))
+ );
+ }
+};
+
+#define wxCONSTRUCTOR_2(klass,t0,v0,t1,v1) \
+ wxObjectAllocatorAndCreator_2<klass,t0,t1> constructor##klass; \
+ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
+ const wxChar *klass::ms_constructorProperties[] = { wxT(#v0), wxT(#v1) }; \
+ const int klass::ms_constructorPropertiesCount = 2;
+
+// direct constructor version
+
+template<typename Class,
+typename T0, typename T1>
+struct wxDirectConstructorBridge_2 : public wxObjectAllocator
+{
+ bool Create(wxObject * &o, wxAny *args)
+ {
+ o = new Class(
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL))
+ );
+ return o != NULL;
+ }
+};
+
+#define wxDIRECT_CONSTRUCTOR_2(klass,t0,v0,t1,v1) \
+ wxDirectConstructorBridge_2<klass,t0,t1> constructor##klass; \
+ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
+ const wxChar *klass::ms_constructorProperties[] = { wxT(#v0), wxT(#v1) }; \
+ const int klass::ms_constructorPropertiesCount = 2;
+
+
+// 3 params
+
+template<typename Class,
+typename T0, typename T1, typename T2>
+struct wxObjectAllocatorAndCreator_3 : public wxObjectAllocatorAndCreator
+{
+ bool Create(wxObject * &o, wxAny *args)
+ {
+ Class *obj = wx_dynamic_cast(Class*, o);
+ return obj->Create(
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL))
+ );
+ }
+};
+
+#define wxCONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \
+ wxObjectAllocatorAndCreator_3<klass,t0,t1,t2> constructor##klass; \
+ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
+ const wxChar *klass::ms_constructorProperties[] = { wxT(#v0), wxT(#v1), wxT(#v2) }; \
+ const int klass::ms_constructorPropertiesCount = 3;
+
+// direct constructor version
+
+template<typename Class,
+typename T0, typename T1, typename T2>
+struct wxDirectConstructorBridge_3 : public wxObjectAllocator
+{
+ bool Create(wxObject * &o, wxAny *args)
+ {
+ o = new Class(
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL))
+ );
+ return o != NULL;
+ }
+};
+
+#define wxDIRECT_CONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \
+ wxDirectConstructorBridge_3<klass,t0,t1,t2> constructor##klass; \
+ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
+ const wxChar *klass::ms_constructorProperties[] = { wxT(#v0), wxT(#v1), wxT(#v2) }; \
+ const int klass::ms_constructorPropertiesCount = 3;
+
+
+// 4 params
+
+template<typename Class,
+typename T0, typename T1, typename T2, typename T3>
+struct wxObjectAllocatorAndCreator_4 : public wxObjectAllocatorAndCreator
+{
+ bool Create(wxObject * &o, wxAny *args)
+ {
+ Class *obj = wx_dynamic_cast(Class*, o);
+ return obj->Create(
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL)),
+ (args[3]).As(static_cast<T3*>(NULL))
+ );
+ }
+};
+
+#define wxCONSTRUCTOR_4(klass,t0,v0,t1,v1,t2,v2,t3,v3) \
+ wxObjectAllocatorAndCreator_4<klass,t0,t1,t2,t3> constructor##klass; \
+ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
+ const wxChar *klass::ms_constructorProperties[] = \
+ { wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3) }; \
+ const int klass::ms_constructorPropertiesCount = 4;
+
+// direct constructor version
+
+template<typename Class,
+typename T0, typename T1, typename T2, typename T3>
+struct wxDirectConstructorBridge_4 : public wxObjectAllocator
+{
+ bool Create(wxObject * &o, wxAny *args)
+ {
+ o = new Class(
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL)),
+ (args[3]).As(static_cast<T3*>(NULL))
+ );
+ return o != NULL;
+ }
+};
+
+#define wxDIRECT_CONSTRUCTOR_4(klass,t0,v0,t1,v1,t2,v2,t3,v3) \
+ wxDirectConstructorBridge_4<klass,t0,t1,t2,t3> constructor##klass; \
+ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
+ const wxChar *klass::ms_constructorProperties[] = \
+ { wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3) }; \
+ const int klass::ms_constructorPropertiesCount = 4;
+
+
+// 5 params
+
+template<typename Class,
+typename T0, typename T1, typename T2, typename T3, typename T4>
+struct wxObjectAllocatorAndCreator_5 : public wxObjectAllocatorAndCreator
+{
+ bool Create(wxObject * &o, wxAny *args)
+ {
+ Class *obj = wx_dynamic_cast(Class*, o);
+ return obj->Create(
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL)),
+ (args[3]).As(static_cast<T3*>(NULL)),
+ (args[4]).As(static_cast<T4*>(NULL))
+ );
+ }
+};
+
+#define wxCONSTRUCTOR_5(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \
+ wxObjectAllocatorAndCreator_5<klass,t0,t1,t2,t3,t4> constructor##klass; \
+ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
+ const wxChar *klass::ms_constructorProperties[] = \
+ { wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3), wxT(#v4) }; \
+ const int klass::ms_constructorPropertiesCount = 5;
+
+// direct constructor version
+
+template<typename Class,
+typename T0, typename T1, typename T2, typename T3, typename T4>
+struct wxDirectConstructorBridge_5 : public wxObjectAllocator
+{
+ bool Create(wxObject * &o, wxAny *args)
+ {
+ o = new Class(
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL)),
+ (args[3]).As(static_cast<T3*>(NULL)),
+ (args[4]).As(static_cast<T4*>(NULL))
+ );
+ return o != NULL;
+ }
+};
+
+#define wxDIRECT_CONSTRUCTOR_5(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \
+ wxDirectConstructorBridge_5<klass,t0,t1,t2,t3,t4> constructor##klass; \
+ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
+ const wxChar *klass::ms_constructorProperties[] = \
+ { wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3), wxT(#v4) }; \
+ const int klass::ms_constructorPropertiesCount = 5;
+
+
+// 6 params
+
+template<typename Class,
+typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
+struct wxObjectAllocatorAndCreator_6 : public wxObjectAllocatorAndCreator
+{
+ bool Create(wxObject * &o, wxAny *args)
+ {
+ Class *obj = wx_dynamic_cast(Class*, o);
+ return obj->Create(
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL)),
+ (args[3]).As(static_cast<T3*>(NULL)),
+ (args[4]).As(static_cast<T4*>(NULL)),
+ (args[5]).As(static_cast<T5*>(NULL))
+ );
+ }
+};
+
+#define wxCONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \
+ wxObjectAllocatorAndCreator_6<klass,t0,t1,t2,t3,t4,t5> constructor##klass; \
+ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
+ const wxChar *klass::ms_constructorProperties[] = \
+ { wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3), wxT(#v4), wxT(#v5) }; \
+ const int klass::ms_constructorPropertiesCount = 6;
+
+// direct constructor version
+
+template<typename Class,
+typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
+struct wxDirectConstructorBridge_6 : public wxObjectAllocator
+{
+ bool Create(wxObject * &o, wxAny *args)
+ {
+ o = new Class(
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL)),
+ (args[3]).As(static_cast<T3*>(NULL)),
+ (args[4]).As(static_cast<T4*>(NULL)),
+ (args[5]).As(static_cast<T5*>(NULL))
+ );
+ return o != NULL;
+ }
+};
+
+#define wxDIRECT_CONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \
+ wxDirectConstructorBridge_6<klass,t0,t1,t2,t3,t4,t5> constructor##klass; \
+ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
+ const wxChar *klass::ms_constructorProperties[] = { wxT(#v0), wxT(#v1), \
+ wxT(#v2), wxT(#v3), wxT(#v4), wxT(#v5) }; \
+ const int klass::ms_constructorPropertiesCount = 6;
+
+
+// 7 params
+
+template<typename Class,
+typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+struct wxObjectAllocatorAndCreator_7 : public wxObjectAllocatorAndCreator
+{
+ bool Create(wxObject * &o, wxAny *args)
+ {
+ Class *obj = wx_dynamic_cast(Class*, o);
+ return obj->Create(
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL)),
+ (args[3]).As(static_cast<T3*>(NULL)),
+ (args[4]).As(static_cast<T4*>(NULL)),
+ (args[5]).As(static_cast<T5*>(NULL)),
+ (args[6]).As(static_cast<T6*>(NULL))
+ );
+ }
+};
+
+#define wxCONSTRUCTOR_7(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \
+ wxObjectAllocatorAndCreator_7<klass,t0,t1,t2,t3,t4,t5,t6> constructor##klass; \
+ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
+ const wxChar *klass::ms_constructorProperties[] = { wxT(#v0), wxT(#v1), \
+ wxT(#v2), wxT(#v3), wxT(#v4), wxT(#v5), wxT(#v6) }; \
+ const int klass::ms_constructorPropertiesCount = 7;
+
+// direct constructor version
+
+template<typename Class,
+typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+struct wxDirectConstructorBridge_7 : public wxObjectAllocator
+{
+ bool Create(wxObject * &o, wxAny *args)
+ {
+ o = new Class(
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL)),
+ (args[3]).As(static_cast<T3*>(NULL)),
+ (args[4]).As(static_cast<T4*>(NULL)),
+ (args[5]).As(static_cast<T5*>(NULL)),
+ (args[6]).As(static_cast<T6*>(NULL))
+ );
+ return o != NULL;
+ }
+};
+
+#define wxDIRECT_CONSTRUCTOR_7(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \
+ wxDirectConstructorBridge_7<klass,t0,t1,t2,t3,t4,t5,t6> constructor##klass; \
+ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
+ const wxChar *klass::ms_constructorProperties[] = \
+ { wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3), wxT(#v4), wxT(#v5), wxT(#v6) }; \
+ const int klass::ms_constructorPropertiesCount = 7;
+
+
+// 8 params
+
+template<typename Class,
+typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, \
+typename T6, typename T7>
+struct wxObjectAllocatorAndCreator_8 : public wxObjectAllocatorAndCreator
+{
+ bool Create(wxObject * &o, wxAny *args)
+ {
+ Class *obj = wx_dynamic_cast(Class*, o);
+ return obj->Create(
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL)),
+ (args[3]).As(static_cast<T3*>(NULL)),
+ (args[4]).As(static_cast<T4*>(NULL)),
+ (args[5]).As(static_cast<T5*>(NULL)),
+ (args[6]).As(static_cast<T6*>(NULL)),
+ (args[7]).As(static_cast<T7*>(NULL))
+ );
+ }
+};
+
+#define wxCONSTRUCTOR_8(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \
+ wxObjectAllocatorAndCreator_8<klass,t0,t1,t2,t3,t4,t5,t6,t7> constructor##klass; \
+ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
+ const wxChar *klass::ms_constructorProperties[] = \
+ { wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3), wxT(#v4), wxT(#v5), wxT(#v6), wxT(#v7) }; \
+ const int klass::ms_constructorPropertiesCount = 8;
+
+// direct constructor version
+
+template<typename Class,
+typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, \
+typename T6, typename T7>
+struct wxDirectConstructorBridge_8 : public wxObjectAllocator
+{
+ bool Create(wxObject * &o, wxAny *args)
+ {
+ o = new Class(
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL)),
+ (args[3]).As(static_cast<T3*>(NULL)),
+ (args[4]).As(static_cast<T4*>(NULL)),
+ (args[5]).As(static_cast<T5*>(NULL)),
+ (args[6]).As(static_cast<T6*>(NULL)),
+ (args[7]).As(static_cast<T7*>(NULL))
+ );
+ return o != NULL;
+ }
+};
+
+#define wxDIRECT_CONSTRUCTOR_8(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \
+ wxDirectConstructorBridge_8<klass,t0,t1,t2,t3,t4,t5,t6,t7> constructor##klass; \
+ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
+ const wxChar *klass::ms_constructorProperties[] = \
+ { wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3), wxT(#v4), wxT(#v5), wxT(#v6), wxT(#v7) }; \
+ const int klass::ms_constructorPropertiesCount = 8;
+
+#endif // wxUSE_EXTENDED_RTTI
+#endif // _XTICTOR_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xtihandler.h
+// Purpose: XTI handlers
+// Author: Stefan Csomor
+// Modified by: Francesco Montorsi
+// Created: 27/07/03
+// Copyright: (c) 1997 Julian Smart
+// (c) 2003 Stefan Csomor
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _XTIHANDLER_H_
+#define _XTIHANDLER_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_EXTENDED_RTTI
+
+#include "wx/xti.h"
+
+// copied from event.h which cannot be included at this place
+
+class WXDLLIMPEXP_FWD_BASE wxEvent;
+
+#ifdef __VISUALC__
+#define wxMSVC_FWD_MULTIPLE_BASES __multiple_inheritance
+#else
+#define wxMSVC_FWD_MULTIPLE_BASES
+#endif
+
+class WXDLLIMPEXP_FWD_BASE wxMSVC_FWD_MULTIPLE_BASES wxEvtHandler;
+typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
+typedef wxEventFunction wxObjectEventFunction;
+
+// ----------------------------------------------------------------------------
+// Handler Info
+//
+// this describes an event sink
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxHandlerInfo
+{
+ friend class WXDLLIMPEXP_BASE wxDynamicClassInfo;
+
+public:
+ wxHandlerInfo(wxHandlerInfo* &iter,
+ wxClassInfo* itsClass,
+ const wxString& name,
+ wxObjectEventFunction address,
+ const wxClassInfo* eventClassInfo) :
+ m_eventFunction(address),
+ m_name(name),
+ m_eventClassInfo(eventClassInfo),
+ m_itsClass(itsClass)
+ {
+ Insert(iter);
+ }
+
+ ~wxHandlerInfo()
+ { Remove(); }
+
+ // return the name of this handler
+ const wxString& GetName() const { return m_name; }
+
+ // return the class info of the event
+ const wxClassInfo *GetEventClassInfo() const { return m_eventClassInfo; }
+
+ // get the handler function pointer
+ wxObjectEventFunction GetEventFunction() const { return m_eventFunction; }
+
+ // returns NULL if this is the last handler of this class
+ wxHandlerInfo* GetNext() const { return m_next; }
+
+ // return the class this property is declared in
+ const wxClassInfo* GetDeclaringClass() const { return m_itsClass; }
+
+private:
+
+ // inserts this handler at the end of the linked chain which begins
+ // with "iter" handler.
+ void Insert(wxHandlerInfo* &iter);
+
+ // removes this handler from the linked chain of the m_itsClass handlers.
+ void Remove();
+
+ wxObjectEventFunction m_eventFunction;
+ wxString m_name;
+ const wxClassInfo* m_eventClassInfo;
+ wxHandlerInfo* m_next;
+ wxClassInfo* m_itsClass;
+};
+
+#define wxHANDLER(name,eventClassType) \
+ static wxHandlerInfo _handlerInfo##name( first, class_t::GetClassInfoStatic(), \
+ wxT(#name), (wxObjectEventFunction) (wxEventFunction) &name, \
+ wxCLASSINFO( eventClassType ) );
+
+#define wxBEGIN_HANDLERS_TABLE(theClass) \
+ wxHandlerInfo *theClass::GetHandlersStatic() \
+ { \
+ typedef theClass class_t; \
+ static wxHandlerInfo* first = NULL;
+
+#define wxEND_HANDLERS_TABLE() \
+ return first; }
+
+#define wxEMPTY_HANDLERS_TABLE(theClass) \
+ wxBEGIN_HANDLERS_TABLE(theClass) \
+ wxEND_HANDLERS_TABLE()
+
+#endif // wxUSE_EXTENDED_RTTI
+#endif // _XTIHANDLER_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xtiprop.h
+// Purpose: XTI properties
+// Author: Stefan Csomor
+// Modified by: Francesco Montorsi
+// Created: 27/07/03
+// Copyright: (c) 1997 Julian Smart
+// (c) 2003 Stefan Csomor
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _XTIPROP_H_
+#define _XTIPROP_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_EXTENDED_RTTI
+
+#include "wx/xti.h"
+#include "wx/any.h"
+
+/*
+class WXDLLIMPEXP_BASE wxObject;
+class WXDLLIMPEXP_BASE wxClassInfo;
+class WXDLLIMPEXP_BASE wxDynamicClassInfo;
+*/
+class WXDLLIMPEXP_BASE wxHashTable;
+class WXDLLIMPEXP_BASE wxHashTable_Node;
+class WXDLLIMPEXP_BASE wxEvent;
+class WXDLLIMPEXP_BASE wxEvtHandler;
+
+// ----------------------------------------------------------------------------
+// Property Accessors
+//
+// wxPropertySetter/Getter/CollectionGetter/CollectionAdder are all property
+// accessors which are managed by wxPropertyAccessor class which in turn is
+// handled by wxPropertyInfo.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxPropertySetter
+{
+public:
+ wxPropertySetter( const wxString name ) { m_name = name; }
+ virtual ~wxPropertySetter() {}
+
+ virtual void Set( wxObject *object, const wxAny &variantValue ) const = 0;
+ const wxString& GetName() const { return m_name; }
+
+private:
+ wxString m_name;
+};
+
+class WXDLLIMPEXP_BASE wxPropertyGetter
+{
+public:
+ wxPropertyGetter( const wxString name ) { m_name = name; }
+ virtual ~wxPropertyGetter() {}
+
+ virtual void Get( const wxObject *object, wxAny& result) const = 0;
+ const wxString& GetName() const { return m_name; }
+
+private:
+ wxString m_name;
+};
+
+class WXDLLIMPEXP_BASE wxPropertyCollectionGetter
+{
+public:
+ wxPropertyCollectionGetter( const wxString name ) { m_name = name; }
+ virtual ~wxPropertyCollectionGetter() {}
+
+ virtual void Get( const wxObject *object, wxAnyList& result) const = 0;
+ const wxString& GetName() const { return m_name; }
+
+private:
+ wxString m_name;
+};
+
+template<typename coll_t> void WXDLLIMPEXP_BASE \
+ wxCollectionToVariantArray( const coll_t& coll, wxAnyList& result );
+
+class WXDLLIMPEXP_BASE wxPropertyCollectionAdder
+{
+public:
+ wxPropertyCollectionAdder( const wxString name ) { m_name = name; }
+ virtual ~wxPropertyCollectionAdder() {}
+
+ virtual void Add( wxObject *object, const wxAny &variantValue ) const= 0;
+ const wxString& GetName() const { return m_name; }
+
+private:
+ wxString m_name;
+};
+
+#define wxPROPERTY_SETTER( property, Klass, valueType, setterMethod ) \
+class wxPropertySetter##property : public wxPropertySetter \
+{ \
+public: \
+ wxINFUNC_CLASS_TYPE_FIX(Klass) \
+ wxPropertySetter##property() : wxPropertySetter( wxT(#setterMethod) ) {} \
+ virtual ~wxPropertySetter##property() {} \
+ \
+ void Set( wxObject *object, const wxAny &variantValue ) const \
+ { \
+ Klass *obj = dynamic_cast<Klass*>(object); \
+ valueType tempobj; \
+ if ( variantValue.GetAs(&tempobj) ) \
+ obj->setterMethod(tempobj); \
+ else \
+ obj->setterMethod(*wxANY_AS(variantValue, valueType*)); \
+ } \
+};
+
+#define wxPROPERTY_GETTER( property, Klass, valueType, gettermethod ) \
+class wxPropertyGetter##property : public wxPropertyGetter \
+{ \
+public: \
+ wxINFUNC_CLASS_TYPE_FIX(Klass) \
+ wxPropertyGetter##property() : wxPropertyGetter( wxT(#gettermethod) ) {} \
+ virtual ~wxPropertyGetter##property() {} \
+ \
+ void Get( const wxObject *object, wxAny &result) const \
+ { \
+ const Klass *obj = dynamic_cast<const Klass*>(object); \
+ result = wxAny( obj->gettermethod() ); \
+ } \
+};
+
+#define wxPROPERTY_COLLECTION_ADDER( property, Klass, valueType, addermethod ) \
+class wxPropertyCollectionAdder##property : public wxPropertyCollectionAdder \
+{ \
+public: \
+ wxINFUNC_CLASS_TYPE_FIX(Klass) \
+ wxPropertyCollectionAdder##property() : wxPropertyCollectionAdder( wxT(#addermethod) ) {} \
+ virtual ~wxPropertyCollectionAdder##property() {} \
+ \
+ void Add( wxObject *object, const wxAny &variantValue ) const \
+ { \
+ Klass *obj = dynamic_cast<Klass*>(object); \
+ valueType tempobj; \
+ if ( variantValue.GetAs(&tempobj) ) \
+ obj->addermethod(tempobj); \
+ else \
+ obj->addermethod(*wxANY_AS(variantValue, valueType*)); \
+ } \
+};
+
+#define wxPROPERTY_COLLECTION_GETTER( property, Klass, valueType, gettermethod ) \
+class wxPropertyCollectionGetter##property : public wxPropertyCollectionGetter \
+{ \
+public: \
+ wxINFUNC_CLASS_TYPE_FIX(Klass) \
+ wxPropertyCollectionGetter##property() : wxPropertyCollectionGetter( wxT(#gettermethod) ) {} \
+ virtual ~wxPropertyCollectionGetter##property() {} \
+ \
+ void Get( const wxObject *object, wxAnyList &result) const \
+ { \
+ const Klass *obj = dynamic_cast<const Klass*>(object); \
+ wxCollectionToVariantArray( obj->gettermethod(), result ); \
+ } \
+};
+
+class WXDLLIMPEXP_BASE wxPropertyAccessor
+{
+public:
+ wxPropertyAccessor( wxPropertySetter *setter, wxPropertyGetter *getter,
+ wxPropertyCollectionAdder *adder, wxPropertyCollectionGetter *collectionGetter )
+ { m_setter = setter; m_getter = getter; m_adder = adder;
+ m_collectionGetter = collectionGetter; }
+
+ virtual ~wxPropertyAccessor() {}
+
+ // Setting a simple property (non-collection)
+ virtual void SetProperty(wxObject *object, const wxAny &value) const
+ {
+ if ( m_setter )
+ m_setter->Set( object, value );
+ else
+ wxLogError( wxGetTranslation("SetProperty called w/o valid setter") );
+ }
+
+ // Getting a simple property (non-collection)
+ virtual void GetProperty(const wxObject *object, wxAny &result) const
+ {
+ if ( m_getter )
+ m_getter->Get( object, result );
+ else
+ wxLogError( wxGetTranslation("GetProperty called w/o valid getter") );
+ }
+
+ // Adding an element to a collection property
+ virtual void AddToPropertyCollection(wxObject *object, const wxAny &value) const
+ {
+ if ( m_adder )
+ m_adder->Add( object, value );
+ else
+ wxLogError( wxGetTranslation("AddToPropertyCollection called w/o valid adder") );
+ }
+
+ // Getting a collection property
+ virtual void GetPropertyCollection( const wxObject *obj, wxAnyList &result) const
+ {
+ if ( m_collectionGetter )
+ m_collectionGetter->Get( obj, result);
+ else
+ wxLogError( wxGetTranslation("GetPropertyCollection called w/o valid collection getter") );
+ }
+
+ virtual bool HasSetter() const { return m_setter != NULL; }
+ virtual bool HasCollectionGetter() const { return m_collectionGetter != NULL; }
+ virtual bool HasGetter() const { return m_getter != NULL; }
+ virtual bool HasAdder() const { return m_adder != NULL; }
+
+ virtual const wxString& GetCollectionGetterName() const
+ { return m_collectionGetter->GetName(); }
+ virtual const wxString& GetGetterName() const
+ { return m_getter->GetName(); }
+ virtual const wxString& GetSetterName() const
+ { return m_setter->GetName(); }
+ virtual const wxString& GetAdderName() const
+ { return m_adder->GetName(); }
+
+protected:
+ wxPropertySetter *m_setter;
+ wxPropertyCollectionAdder *m_adder;
+ wxPropertyGetter *m_getter;
+ wxPropertyCollectionGetter* m_collectionGetter;
+};
+
+class WXDLLIMPEXP_BASE wxGenericPropertyAccessor : public wxPropertyAccessor
+{
+public:
+ wxGenericPropertyAccessor( const wxString &propName );
+ virtual ~wxGenericPropertyAccessor();
+
+ void RenameProperty( const wxString& WXUNUSED_UNLESS_DEBUG(oldName),
+ const wxString& newName )
+ {
+ wxASSERT( oldName == m_propertyName ); m_propertyName = newName;
+ }
+
+ virtual bool HasSetter() const { return true; }
+ virtual bool HasGetter() const { return true; }
+ virtual bool HasAdder() const { return false; }
+ virtual bool HasCollectionGetter() const { return false; }
+
+ virtual const wxString& GetGetterName() const
+ { return m_getterName; }
+ virtual const wxString& GetSetterName() const
+ { return m_setterName; }
+
+ virtual void SetProperty(wxObject *object, const wxAny &value) const;
+ virtual void GetProperty(const wxObject *object, wxAny &value) const;
+
+ // Adding an element to a collection property
+ virtual void AddToPropertyCollection(wxObject *WXUNUSED(object),
+ const wxAny &WXUNUSED(value)) const
+ {
+ wxLogError( wxGetTranslation("AddToPropertyCollection called on a generic accessor") );
+ }
+
+ // Getting a collection property
+ virtual void GetPropertyCollection( const wxObject *WXUNUSED(obj),
+ wxAnyList &WXUNUSED(result)) const
+ {
+ wxLogError ( wxGetTranslation("GetPropertyCollection called on a generic accessor") );
+ }
+
+private:
+ struct wxGenericPropertyAccessorInternal;
+ wxGenericPropertyAccessorInternal* m_data;
+ wxString m_propertyName;
+ wxString m_setterName;
+ wxString m_getterName;
+};
+
+typedef long wxPropertyInfoFlags;
+enum
+{
+ // will be removed in future releases
+ wxPROP_DEPRECATED = 0x00000001,
+
+ // object graph property, will be streamed with priority (after constructor properties)
+ wxPROP_OBJECT_GRAPH = 0x00000002,
+
+ // this will only be streamed out and in as enum/set, the internal representation
+ // is still a long
+ wxPROP_ENUM_STORE_LONG = 0x00000004,
+
+ // don't stream out this property, needed eg to avoid streaming out children
+ // that are always created by their parents
+ wxPROP_DONT_STREAM = 0x00000008
+};
+
+
+// ----------------------------------------------------------------------------
+// Property Support
+//
+// wxPropertyInfo is used to inquire of the property by name. It doesn't
+// provide access to the property, only information about it. If you
+// want access, look at wxPropertyAccessor.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxPropertyInfo
+{
+ friend class /* WXDLLIMPEXP_BASE */ wxDynamicClassInfo;
+
+public:
+ wxPropertyInfo(wxPropertyInfo* &iter,
+ wxClassInfo* itsClass,
+ const wxString& name,
+ const wxString& typeName,
+ wxPropertyAccessor *accessor,
+ wxAny dv,
+ wxPropertyInfoFlags flags = 0,
+ const wxString& helpString = wxEmptyString,
+ const wxString& groupString = wxEmptyString) :
+ m_itsClass(itsClass),
+ m_name(name),
+ m_typeInfo(NULL),
+ m_typeName(typeName),
+ m_collectionElementTypeInfo(NULL),
+ m_accessor(accessor),
+ m_defaultValue(dv),
+ m_flags(flags),
+ m_helpString(helpString),
+ m_groupString(groupString)
+ {
+ Insert(iter);
+ }
+
+ wxPropertyInfo(wxPropertyInfo* &iter,
+ wxClassInfo* itsClass,
+ const wxString& name,
+ wxEventSourceTypeInfo* type,
+ wxPropertyAccessor *accessor,
+ wxAny dv,
+ wxPropertyInfoFlags flags = 0,
+ const wxString& helpString = wxEmptyString,
+ const wxString& groupString = wxEmptyString) :
+ m_itsClass(itsClass),
+ m_name(name),
+ m_typeInfo(type),
+ m_collectionElementTypeInfo(NULL),
+ m_accessor(accessor),
+ m_defaultValue(dv),
+ m_flags(flags),
+ m_helpString(helpString),
+ m_groupString(groupString)
+ {
+ Insert(iter);
+ }
+
+ wxPropertyInfo(wxPropertyInfo* &iter,
+ wxClassInfo* itsClass, const wxString& name,
+ const wxString& collectionTypeName,
+ const wxString& elementTypeName,
+ wxPropertyAccessor *accessor,
+ wxPropertyInfoFlags flags = 0,
+ const wxString& helpString = wxEmptyString,
+ const wxString& groupString = wxEmptyString) :
+ m_itsClass(itsClass),
+ m_name(name),
+ m_typeInfo(NULL),
+ m_typeName(collectionTypeName),
+ m_collectionElementTypeInfo(NULL),
+ m_collectionElementTypeName(elementTypeName),
+ m_accessor(accessor),
+ m_flags(flags),
+ m_helpString(helpString),
+ m_groupString(groupString)
+ {
+ Insert(iter);
+ }
+
+ ~wxPropertyInfo()
+ { Remove(); }
+
+ // return the class this property is declared in
+ const wxClassInfo* GetDeclaringClass() const { return m_itsClass; }
+
+ // return the name of this property
+ const wxString& GetName() const { return m_name; }
+
+ // returns the flags of this property
+ wxPropertyInfoFlags GetFlags() const { return m_flags; }
+
+ // returns the short help string of this property
+ const wxString& GetHelpString() const { return m_helpString; }
+
+ // returns the group string of this property
+ const wxString& GetGroupString() const { return m_groupString; }
+
+ // return the element type info of this property (for collections, otherwise NULL)
+ const wxTypeInfo * GetCollectionElementTypeInfo() const
+ {
+ if ( m_collectionElementTypeInfo == NULL )
+ m_collectionElementTypeInfo = wxTypeInfo::FindType(m_collectionElementTypeName);
+ return m_collectionElementTypeInfo;
+ }
+
+ // return the type info of this property
+ const wxTypeInfo * GetTypeInfo() const
+ {
+ if ( m_typeInfo == NULL )
+ m_typeInfo = wxTypeInfo::FindType(m_typeName);
+ return m_typeInfo;
+ }
+
+ // return the accessor for this property
+ wxPropertyAccessor* GetAccessor() const { return m_accessor; }
+
+ // returns NULL if this is the last property of this class
+ wxPropertyInfo* GetNext() const { return m_next; }
+
+ // returns the default value of this property, its kind may be wxT_VOID if it is not valid
+ wxAny GetDefaultValue() const { return m_defaultValue; }
+
+private:
+
+ // inserts this property at the end of the linked chain which begins
+ // with "iter" property.
+ void Insert(wxPropertyInfo* &iter);
+
+ // removes this property from the linked chain of the m_itsClass properties.
+ void Remove();
+
+ wxClassInfo* m_itsClass;
+ wxString m_name;
+ mutable wxTypeInfo* m_typeInfo;
+ wxString m_typeName;
+ mutable wxTypeInfo* m_collectionElementTypeInfo;
+ wxString m_collectionElementTypeName;
+ wxPropertyAccessor* m_accessor;
+ wxAny m_defaultValue;
+ wxPropertyInfoFlags m_flags;
+ wxString m_helpString;
+ wxString m_groupString;
+ wxPropertyInfo* m_next;
+
+ // FIXME: what's this comment about??
+ // string representation of the default value
+ // to be assigned by the designer to the property
+ // when the component is dropped on the container.
+};
+
+// stl is giving problems when forwarding declarations, therefore we define it as a subclass
+
+WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxPropertyInfo*, wxPropertyInfoMapBase,
+ class WXDLLIMPEXP_BASE );
+
+class WXDLLIMPEXP_BASE wxPropertyInfoMap : public wxPropertyInfoMapBase {
+};
+
+WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxAny, wxStringToAnyHashMapBase,
+ class WXDLLIMPEXP_BASE );
+
+class WXDLLIMPEXP_FWD_BASE wxStringToAnyHashMap : public wxStringToAnyHashMapBase {
+};
+
+#define wxBEGIN_PROPERTIES_TABLE(theClass) \
+ wxPropertyInfo *theClass::GetPropertiesStatic() \
+ { \
+ typedef theClass class_t; \
+ static wxPropertyInfo* first = NULL;
+
+#define wxEND_PROPERTIES_TABLE() \
+ return first; }
+
+#define wxHIDE_PROPERTY( pname ) \
+ static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \
+ wxT(#pname), typeid(void).name(), NULL, wxAny(), wxPROP_DONT_STREAM, \
+ wxEmptyString, wxEmptyString );
+
+#define wxPROPERTY( pname, type, setter, getter, defaultValue, flags, help, group) \
+ wxPROPERTY_SETTER( pname, class_t, type, setter ) \
+ static wxPropertySetter##pname _setter##pname; \
+ wxPROPERTY_GETTER( pname, class_t, type, getter ) \
+ static wxPropertyGetter##pname _getter##pname; \
+ static wxPropertyAccessor _accessor##pname( &_setter##pname, \
+ &_getter##pname, NULL, NULL ); \
+ static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \
+ wxT(#pname), typeid(type).name(), &_accessor##pname, \
+ wxAny(defaultValue), flags, group, help );
+
+#define wxPROPERTY_FLAGS( pname, flags, type, setter, getter,defaultValue, \
+ pflags, help, group) \
+ wxPROPERTY_SETTER( pname, class_t, type, setter ) \
+ static wxPropertySetter##pname _setter##pname; \
+ wxPROPERTY_GETTER( pname, class_t, type, getter ) \
+ static wxPropertyGetter##pname _getter##pname; \
+ static wxPropertyAccessor _accessor##pname( &_setter##pname, \
+ &_getter##pname, NULL, NULL ); \
+ static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \
+ wxT(#pname), typeid(flags).name(), &_accessor##pname, \
+ wxAny(defaultValue), wxPROP_ENUM_STORE_LONG | pflags, help, group );
+
+#define wxREADONLY_PROPERTY( pname, type, getter,defaultValue, flags, help, group) \
+ wxPROPERTY_GETTER( pname, class_t, type, getter ) \
+ static wxPropertyGetter##pname _getter##pname; \
+ static wxPropertyAccessor _accessor##pname( NULL, &_getter##pname, NULL, NULL ); \
+ static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \
+ wxT(#pname), typeid(type).name(),&_accessor##pname, \
+ wxAny(defaultValue), flags, help, group );
+
+#define wxREADONLY_PROPERTY_FLAGS( pname, flags, type, getter,defaultValue, \
+ pflags, help, group) \
+ wxPROPERTY_GETTER( pname, class_t, type, getter ) \
+ static wxPropertyGetter##pname _getter##pname; \
+ static wxPropertyAccessor _accessor##pname( NULL, &_getter##pname, NULL, NULL ); \
+ static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \
+ wxT(#pname), typeid(flags).name(),&_accessor##pname, \
+ wxAny(defaultValue), wxPROP_ENUM_STORE_LONG | pflags, help, group );
+
+#define wxPROPERTY_COLLECTION( pname, colltype, addelemtype, adder, getter, \
+ flags, help, group ) \
+ wxPROPERTY_COLLECTION_ADDER( pname, class_t, addelemtype, adder ) \
+ static wxPropertyCollectionAdder##pname _adder##pname; \
+ wxPROPERTY_COLLECTION_GETTER( pname, class_t, colltype, getter ) \
+ static wxPropertyCollectionGetter##pname _collectionGetter##pname; \
+ static wxPropertyAccessor _accessor##pname( NULL, NULL,&_adder##pname, \
+ &_collectionGetter##pname ); \
+ static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \
+ wxT(#pname), typeid(colltype).name(),typeid(addelemtype).name(), \
+ &_accessor##pname, flags, help, group );
+
+#define wxREADONLY_PROPERTY_COLLECTION( pname, colltype, addelemtype, getter, \
+ flags, help, group) \
+ wxPROPERTY_COLLECTION_GETTER( pname, class_t, colltype, getter ) \
+ static wxPropertyCollectionGetter##pname _collectionGetter##pname; \
+ static wxPropertyAccessor _accessor##pname( NULL, NULL, NULL, \
+ &_collectionGetter##pname ); \
+ static wxPropertyInfo _propertyInfo##pname( first,class_t::GetClassInfoStatic(), \
+ wxT(#pname), typeid(colltype).name(),typeid(addelemtype).name(), \
+ &_accessor##pname, flags, help, group );
+
+#define wxEVENT_PROPERTY( name, eventType, eventClass ) \
+ static wxEventSourceTypeInfo _typeInfo##name( eventType, wxCLASSINFO( eventClass ) ); \
+ static wxPropertyInfo _propertyInfo##name( first,class_t::GetClassInfoStatic(), \
+ wxT(#name), &_typeInfo##name, NULL, wxAny() );
+
+#define wxEVENT_RANGE_PROPERTY( name, eventType, lastEventType, eventClass ) \
+ static wxEventSourceTypeInfo _typeInfo##name( eventType, lastEventType, \
+ wxCLASSINFO( eventClass ) ); \
+ static wxPropertyInfo _propertyInfo##name( first, class_t::GetClassInfoStatic(), \
+ wxT(#name), &_typeInfo##name, NULL, wxAny() );
+
+// ----------------------------------------------------------------------------
+// Implementation Helper for Simple Properties
+// ----------------------------------------------------------------------------
+
+#define wxIMPLEMENT_PROPERTY(name, type) \
+private: \
+ type m_##name; \
+public: \
+ void Set##name( type const & p) { m_##name = p; } \
+ type const & Get##name() const { return m_##name; }
+
+#endif // wxUSE_EXTENDED_RTTI
+#endif // _XTIPROP_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xtistrm.h
+// Purpose: streaming runtime metadata information (extended class info)
+// Author: Stefan Csomor
+// Modified by:
+// Created: 27/07/03
+// Copyright: (c) 2003 Stefan Csomor
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XTISTRMH__
+#define _WX_XTISTRMH__
+
+#include "wx/defs.h"
+
+#if wxUSE_EXTENDED_RTTI
+
+#include "wx/object.h"
+
+const int wxInvalidObjectID = -2;
+const int wxNullObjectID = -3;
+
+// Filer contains the interfaces for streaming objects in and out of XML,
+// rendering them either to objects in memory, or to code. Note: We
+// consider the process of generating code to be one of *depersisting* the
+// object from xml, *not* of persisting the object to code from an object
+// in memory. This distinction can be confusing, and should be kept
+// in mind when looking at the property streamers and callback interfaces
+// listed below.
+
+
+// ----------------------------------------------------------------------------
+// wxObjectWriterCallback
+//
+// This class will be asked during the streaming-out process about every single
+// property or object instance. It can veto streaming out by returning false
+// or modify the value before it is streamed-out.
+// ----------------------------------------------------------------------------
+
+/*
+ class WXDLLIMPEXP_BASE wxClassInfo;
+ class WXDLLIMPEXP_BASE wxAnyList;
+ class WXDLLIMPEXP_BASE wxPropertyInfo;
+ class WXDLLIMPEXP_BASE wxAny;
+ class WXDLLIMPEXP_BASE wxHandlerInfo;
+ */
+
+class WXDLLIMPEXP_BASE wxObjectWriter;
+class WXDLLIMPEXP_BASE wxObjectReader;
+
+class WXDLLIMPEXP_BASE wxObjectWriterCallback
+{
+public:
+ virtual ~wxObjectWriterCallback() {}
+
+ // will be called before an object is written, may veto by returning false
+ virtual bool BeforeWriteObject( wxObjectWriter *WXUNUSED(writer),
+ const wxObject *WXUNUSED(object),
+ const wxClassInfo *WXUNUSED(classInfo),
+ const wxStringToAnyHashMap &WXUNUSED(metadata))
+ { return true; }
+
+ // will be called after this object has been written, may be
+ // needed for adjusting stacks
+ virtual void AfterWriteObject( wxObjectWriter *WXUNUSED(writer),
+ const wxObject *WXUNUSED(object),
+ const wxClassInfo *WXUNUSED(classInfo) )
+ {}
+
+ // will be called before a property gets written, may change the value,
+ // eg replace a concrete wxSize by wxSize( wxDefaultCoord, wxDefaultCoord )
+ // or veto writing that property at all by returning false
+ virtual bool BeforeWriteProperty( wxObjectWriter *WXUNUSED(writer),
+ const wxObject *WXUNUSED(object),
+ const wxPropertyInfo *WXUNUSED(propInfo),
+ const wxAny &WXUNUSED(value) )
+ { return true; }
+
+ // will be called before a property gets written, may change the value,
+ // eg replace a concrete wxSize by wxSize( wxDefaultCoord, wxDefaultCoord )
+ // or veto writing that property at all by returning false
+ virtual bool BeforeWriteProperty( wxObjectWriter *WXUNUSED(writer),
+ const wxObject *WXUNUSED(object),
+ const wxPropertyInfo *WXUNUSED(propInfo),
+ const wxAnyList &WXUNUSED(value) )
+ { return true; }
+
+ // will be called after a property has been written out, may be needed
+ // for adjusting stacks
+ virtual void AfterWriteProperty( wxObjectWriter *WXUNUSED(writer),
+ const wxPropertyInfo *WXUNUSED(propInfo) )
+ {}
+
+ // will be called before this delegate gets written
+ virtual bool BeforeWriteDelegate( wxObjectWriter *WXUNUSED(writer),
+ const wxObject *WXUNUSED(object),
+ const wxClassInfo* WXUNUSED(classInfo),
+ const wxPropertyInfo *WXUNUSED(propInfo),
+ const wxObject *&WXUNUSED(eventSink),
+ const wxHandlerInfo* &WXUNUSED(handlerInfo) )
+ { return true; }
+
+ virtual void AfterWriteDelegate( wxObjectWriter *WXUNUSED(writer),
+ const wxObject *WXUNUSED(object),
+ const wxClassInfo* WXUNUSED(classInfo),
+ const wxPropertyInfo *WXUNUSED(propInfo),
+ const wxObject *&WXUNUSED(eventSink),
+ const wxHandlerInfo* &WXUNUSED(handlerInfo) )
+ { }
+};
+
+class WXDLLIMPEXP_BASE wxObjectWriterFunctor: public wxObjectFunctor
+{
+};
+
+class WXDLLIMPEXP_BASE wxObjectWriter: public wxObject
+{
+ friend class wxObjectWriterFunctor;
+public:
+ wxObjectWriter();
+ virtual ~wxObjectWriter();
+
+ // with this call you start writing out a new top-level object
+ void WriteObject(const wxObject *object, const wxClassInfo *classInfo,
+ wxObjectWriterCallback *writercallback, const wxString &name,
+ const wxStringToAnyHashMap &metadata);
+
+ // Managing the object identity table a.k.a context
+ //
+ // these methods make sure that no object gets written twice,
+ // because sometimes multiple calls to the WriteObject will be
+ // made without wanting to have duplicate objects written, the
+ // object identity table will be reset manually
+ virtual void ClearObjectContext();
+
+ // gets the object Id for a passed in object in the context
+ int GetObjectID(const wxObject *obj);
+
+ // returns true if this object has already been written in this context
+ bool IsObjectKnown( const wxObject *obj );
+
+ //
+ // streaming callbacks
+ //
+ // these callbacks really write out the values in the stream format
+
+ // begins writing out a new toplevel entry which has the indicated unique name
+ virtual void DoBeginWriteTopLevelEntry( const wxString &name ) = 0;
+
+ // ends writing out a new toplevel entry which has the indicated unique name
+ virtual void DoEndWriteTopLevelEntry( const wxString &name ) = 0;
+
+ // start of writing an object having the passed in ID
+ virtual void DoBeginWriteObject(const wxObject *object, const wxClassInfo *classInfo,
+ int objectID, const wxStringToAnyHashMap &metadata ) = 0;
+
+ // end of writing an toplevel object name param is used for unique
+ // identification within the container
+ virtual void DoEndWriteObject(const wxObject *object,
+ const wxClassInfo *classInfo, int objectID ) = 0;
+
+ // writes a simple property in the stream format
+ virtual void DoWriteSimpleType( const wxAny &value ) = 0;
+
+ // start of writing a complex property into the stream (
+ virtual void DoBeginWriteProperty( const wxPropertyInfo *propInfo ) = 0;
+
+ // end of writing a complex property into the stream
+ virtual void DoEndWriteProperty( const wxPropertyInfo *propInfo ) = 0;
+
+ virtual void DoBeginWriteElement() = 0;
+ virtual void DoEndWriteElement() = 0;
+ // insert an object reference to an already written object
+ virtual void DoWriteRepeatedObject( int objectID ) = 0;
+
+ // insert a null reference
+ virtual void DoWriteNullObject() = 0;
+
+ // writes a delegate in the stream format
+ virtual void DoWriteDelegate( const wxObject *object, const wxClassInfo* classInfo,
+ const wxPropertyInfo *propInfo, const wxObject *eventSink,
+ int sinkObjectID, const wxClassInfo* eventSinkClassInfo,
+ const wxHandlerInfo* handlerIndo ) = 0;
+
+ void WriteObject(const wxObject *object, const wxClassInfo *classInfo,
+ wxObjectWriterCallback *writercallback, bool isEmbedded, const wxStringToAnyHashMap &metadata );
+
+protected:
+ struct wxObjectWriterInternal;
+ wxObjectWriterInternal* m_data;
+
+ struct wxObjectWriterInternalPropertiesData;
+
+ void WriteAllProperties( const wxObject * obj, const wxClassInfo* ci,
+ wxObjectWriterCallback *writercallback,
+ wxObjectWriterInternalPropertiesData * data );
+
+ void WriteOneProperty( const wxObject *obj, const wxClassInfo* ci,
+ const wxPropertyInfo* pi, wxObjectWriterCallback *writercallback,
+ wxObjectWriterInternalPropertiesData *data );
+
+
+ void FindConnectEntry(const wxEvtHandler * evSource,
+ const wxEventSourceTypeInfo* dti, const wxObject* &sink,
+ const wxHandlerInfo *&handler);
+};
+
+
+/*
+Streaming callbacks for depersisting XML to code, or running objects
+*/
+
+class WXDLLIMPEXP_BASE wxObjectReaderCallback;
+
+/*
+wxObjectReader handles streaming in a class from a arbitrary format.
+While walking through it issues calls out to interfaces to readercallback
+the guts from the underlying storage format.
+*/
+
+class WXDLLIMPEXP_BASE wxObjectReader: public wxObject
+{
+public:
+ wxObjectReader();
+ virtual ~wxObjectReader();
+
+ // the only thing wxObjectReader knows about is the class info by object ID
+ wxClassInfo *GetObjectClassInfo(int objectID);
+ bool HasObjectClassInfo( int objectID );
+ void SetObjectClassInfo(int objectID, wxClassInfo* classInfo);
+
+ // Reads the component the reader is pointed at from the underlying format.
+ // The return value is the root object ID, which can
+ // then be used to ask the depersister about that object
+ // if there was a problem you will get back wxInvalidObjectID and the current
+ // error log will carry the problems encoutered
+ virtual int ReadObject( const wxString &name, wxObjectReaderCallback *readercallback ) = 0;
+
+private:
+ struct wxObjectReaderInternal;
+ wxObjectReaderInternal *m_data;
+};
+
+// This abstract class matches the allocate-init/create model of creation of objects.
+// At runtime, these will create actual instances, and manipulate them.
+// When generating code, these will just create statements of C++
+// code to create the objects.
+
+class WXDLLIMPEXP_BASE wxObjectReaderCallback
+{
+public:
+ virtual ~wxObjectReaderCallback() {}
+
+ // allocate the new object on the heap, that object will have the passed in ID
+ virtual void AllocateObject(int objectID, wxClassInfo *classInfo,
+ wxStringToAnyHashMap &metadata) = 0;
+
+ // initialize the already allocated object having the ID objectID with the Create method
+ // creation parameters which are objects are having their Ids passed in objectIDValues
+ // having objectId <> wxInvalidObjectID
+
+ virtual void CreateObject(int objectID,
+ const wxClassInfo *classInfo,
+ int paramCount,
+ wxAny *VariantValues,
+ int *objectIDValues,
+ const wxClassInfo **objectClassInfos,
+ wxStringToAnyHashMap &metadata) = 0;
+
+ // construct the new object on the heap, that object will have the passed in ID
+ // (for objects that don't support allocate-create type of creation)
+ // creation parameters which are objects are having their Ids passed in
+ // objectIDValues having objectId <> wxInvalidObjectID
+
+ virtual void ConstructObject(int objectID,
+ const wxClassInfo *classInfo,
+ int paramCount,
+ wxAny *VariantValues,
+ int *objectIDValues,
+ const wxClassInfo **objectClassInfos,
+ wxStringToAnyHashMap &metadata) = 0;
+
+ // destroy the heap-allocated object having the ID objectID, this may be used
+ // if an object is embedded in another object and set via value semantics,
+ // so the intermediate object can be destroyed after safely
+ virtual void DestroyObject(int objectID, wxClassInfo *classInfo) = 0;
+
+ // set the corresponding property
+ virtual void SetProperty(int objectID,
+ const wxClassInfo *classInfo,
+ const wxPropertyInfo* propertyInfo,
+ const wxAny &VariantValue) = 0;
+
+ // sets the corresponding property (value is an object)
+ virtual void SetPropertyAsObject(int objectID,
+ const wxClassInfo *classInfo,
+ const wxPropertyInfo* propertyInfo,
+ int valueObjectId) = 0;
+
+ // adds an element to a property collection
+ virtual void AddToPropertyCollection( int objectID,
+ const wxClassInfo *classInfo,
+ const wxPropertyInfo* propertyInfo,
+ const wxAny &VariantValue) = 0;
+
+ // sets the corresponding property (value is an object)
+ virtual void AddToPropertyCollectionAsObject(int objectID,
+ const wxClassInfo *classInfo,
+ const wxPropertyInfo* propertyInfo,
+ int valueObjectId) = 0;
+
+ // sets the corresponding event handler
+ virtual void SetConnect(int EventSourceObjectID,
+ const wxClassInfo *EventSourceClassInfo,
+ const wxPropertyInfo *delegateInfo,
+ const wxClassInfo *EventSinkClassInfo,
+ const wxHandlerInfo* handlerInfo,
+ int EventSinkObjectID ) = 0;
+};
+
+/*
+wxObjectRuntimeReaderCallback implements the callbacks that will bring back
+an object into a life memory instance
+*/
+
+class WXDLLIMPEXP_BASE wxObjectRuntimeReaderCallback: public wxObjectReaderCallback
+{
+ struct wxObjectRuntimeReaderCallbackInternal;
+ wxObjectRuntimeReaderCallbackInternal * m_data;
+
+public:
+ wxObjectRuntimeReaderCallback();
+ virtual ~wxObjectRuntimeReaderCallback();
+
+ // returns the object having the corresponding ID fully constructed
+ wxObject *GetObject(int objectID);
+
+ // allocate the new object on the heap, that object will have the passed in ID
+ virtual void AllocateObject(int objectID, wxClassInfo *classInfo,
+ wxStringToAnyHashMap &metadata);
+
+ // initialize the already allocated object having the ID objectID with
+ // the Create method creation parameters which are objects are having
+ // their Ids passed in objectIDValues having objectId <> wxInvalidObjectID
+
+ virtual void CreateObject(int objectID,
+ const wxClassInfo *classInfo,
+ int paramCount,
+ wxAny *VariantValues,
+ int *objectIDValues,
+ const wxClassInfo **objectClassInfos,
+ wxStringToAnyHashMap &metadata
+ );
+
+ // construct the new object on the heap, that object will have the
+ // passed in ID (for objects that don't support allocate-create type of
+ // creation) creation parameters which are objects are having their Ids
+ // passed in objectIDValues having objectId <> wxInvalidObjectID
+
+ virtual void ConstructObject(int objectID,
+ const wxClassInfo *classInfo,
+ int paramCount,
+ wxAny *VariantValues,
+ int *objectIDValues,
+ const wxClassInfo **objectClassInfos,
+ wxStringToAnyHashMap &metadata);
+
+ // destroy the heap-allocated object having the ID objectID, this may be
+ // used if an object is embedded in another object and set via value semantics,
+ // so the intermediate object can be destroyed after safely
+ virtual void DestroyObject(int objectID, wxClassInfo *classInfo);
+
+ // set the corresponding property
+ virtual void SetProperty(int objectID,
+ const wxClassInfo *classInfo,
+ const wxPropertyInfo* propertyInfo,
+ const wxAny &variantValue);
+
+ // sets the corresponding property (value is an object)
+ virtual void SetPropertyAsObject(int objectId,
+ const wxClassInfo *classInfo,
+ const wxPropertyInfo* propertyInfo,
+ int valueObjectId);
+
+ // adds an element to a property collection
+ virtual void AddToPropertyCollection( int objectID,
+ const wxClassInfo *classInfo,
+ const wxPropertyInfo* propertyInfo,
+ const wxAny &VariantValue);
+
+ // sets the corresponding property (value is an object)
+ virtual void AddToPropertyCollectionAsObject(int objectID,
+ const wxClassInfo *classInfo,
+ const wxPropertyInfo* propertyInfo,
+ int valueObjectId);
+
+ // sets the corresponding event handler
+ virtual void SetConnect(int eventSourceObjectID,
+ const wxClassInfo *eventSourceClassInfo,
+ const wxPropertyInfo *delegateInfo,
+ const wxClassInfo *eventSinkClassInfo,
+ const wxHandlerInfo* handlerInfo,
+ int eventSinkObjectID );
+};
+
+#endif // wxUSE_EXTENDED_RTTI
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xtitypes.h
+// Purpose: enum, set, basic types support
+// Author: Stefan Csomor
+// Modified by: Francesco Montorsi
+// Created: 27/07/03
+// Copyright: (c) 1997 Julian Smart
+// (c) 2003 Stefan Csomor
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _XTITYPES_H_
+#define _XTITYPES_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_EXTENDED_RTTI
+
+#include "wx/string.h"
+#include "wx/hashmap.h"
+#include "wx/arrstr.h"
+#include "wx/flags.h"
+#include "wx/intl.h"
+#include "wx/log.h"
+#include <typeinfo>
+
+class WXDLLIMPEXP_BASE wxClassInfo;
+
+// ----------------------------------------------------------------------------
+// Enum Support
+//
+// In the header files XTI requires no change from pure c++ code, however in the
+// implementation, an enum needs to be enumerated eg:
+//
+// wxBEGIN_ENUM( wxFlavor )
+// wxENUM_MEMBER( Vanilla )
+// wxENUM_MEMBER( Chocolate )
+// wxENUM_MEMBER( Strawberry )
+// wxEND_ENUM( wxFlavor )
+// ----------------------------------------------------------------------------
+
+struct WXDLLIMPEXP_BASE wxEnumMemberData
+{
+ const wxChar* m_name;
+ int m_value;
+};
+
+class WXDLLIMPEXP_BASE wxEnumData
+{
+public:
+ wxEnumData( wxEnumMemberData* data );
+
+ // returns true if the member has been found and sets the int value
+ // pointed to accordingly (if ptr != null )
+ // if not found returns false, value left unchanged
+ bool HasEnumMemberValue( const wxChar *name, int *value = NULL ) const;
+
+ // returns the value of the member, if not found in debug mode an
+ // assert is issued, in release 0 is returned
+ int GetEnumMemberValue(const wxChar *name ) const;
+
+ // returns the name of the enum member having the passed in value
+ // returns an emtpy string if not found
+ const wxChar *GetEnumMemberName(int value) const;
+
+ // returns the number of members in this enum
+ int GetEnumCount() const { return m_count; }
+
+ // returns the value of the nth member
+ int GetEnumMemberValueByIndex( int n ) const;
+
+ // returns the value of the nth member
+ const wxChar *GetEnumMemberNameByIndex( int n ) const;
+
+private:
+ wxEnumMemberData *m_members;
+ int m_count;
+};
+
+#define wxBEGIN_ENUM( e ) \
+ wxEnumMemberData s_enumDataMembers##e[] = {
+
+#define wxENUM_MEMBER( v ) { wxT(#v), v },
+
+#define wxEND_ENUM( e ) \
+ { NULL, 0 } }; \
+ wxEnumData s_enumData##e( s_enumDataMembers##e ); \
+ wxEnumData *wxGetEnumData(e) { return &s_enumData##e; } \
+ template<> void wxStringReadValue(const wxString& s, e &data ) \
+ { data = (e) s_enumData##e.GetEnumMemberValue(s.c_str()); } \
+ template<> void wxStringWriteValue(wxString &s, const e &data ) \
+ { s = s_enumData##e.GetEnumMemberName((int)data); } \
+ void FromLong##e( long data, wxAny& result ) \
+ { result = wxAny((e)data); } \
+ void ToLong##e( const wxAny& data, long &result ) \
+ { result = (long) (data).As(static_cast<e*>(NULL)); } \
+ \
+ wxTO_STRING_IMP( e ) \
+ wxFROM_STRING_IMP( e ) \
+ wxEnumTypeInfo s_typeInfo##e(wxT_ENUM, &s_enumData##e, \
+ &wxTO_STRING( e ), &wxFROM_STRING( e ), &ToLong##e, \
+ &FromLong##e, typeid(e).name() );
+
+
+// ----------------------------------------------------------------------------
+// Set Support
+//
+// in the header :
+//
+// enum wxFlavor
+// {
+// Vanilla,
+// Chocolate,
+// Strawberry,
+// };
+//
+// typedef wxBitset<wxFlavor> wxCoupe;
+//
+// in the implementation file :
+//
+// wxBEGIN_ENUM( wxFlavor )
+// wxENUM_MEMBER( Vanilla )
+// wxENUM_MEMBER( Chocolate )
+// wxENUM_MEMBER( Strawberry )
+// wxEND_ENUM( wxFlavor )
+//
+// wxIMPLEMENT_SET_STREAMING( wxCoupe, wxFlavor )
+//
+// implementation note: no partial specialization for streaming, but a delegation
+// to a different class
+//
+// ----------------------------------------------------------------------------
+
+void WXDLLIMPEXP_BASE wxSetStringToArray( const wxString &s, wxArrayString &array );
+
+template<typename e>
+void wxSetFromString(const wxString &s, wxBitset<e> &data )
+{
+ wxEnumData* edata = wxGetEnumData((e) 0);
+ data.reset();
+
+ wxArrayString array;
+ wxSetStringToArray( s, array );
+ wxString flag;
+ for ( int i = 0; i < array.Count(); ++i )
+ {
+ flag = array[i];
+ int ivalue;
+ if ( edata->HasEnumMemberValue( flag.c_str(), &ivalue ) )
+ {
+ data.set( (e) ivalue );
+ }
+ }
+}
+
+template<typename e>
+void wxSetToString( wxString &s, const wxBitset<e> &data )
+{
+ wxEnumData* edata = wxGetEnumData((e) 0);
+ int count = edata->GetEnumCount();
+ int i;
+ s.Clear();
+ for ( i = 0; i < count; i++ )
+ {
+ e value = (e) edata->GetEnumMemberValueByIndex(i);
+ if ( data.test( value ) )
+ {
+ // this could also be done by the templated calls
+ if ( !s.empty() )
+ s += wxT("|");
+ s += edata->GetEnumMemberNameByIndex(i);
+ }
+ }
+}
+
+#define wxIMPLEMENT_SET_STREAMING(SetName,e) \
+ template<> void wxStringReadValue(const wxString &s, wxBitset<e> &data ) \
+ { wxSetFromString( s, data ); } \
+ template<> void wxStringWriteValue( wxString &s, const wxBitset<e> &data ) \
+ { wxSetToString( s, data ); } \
+ void FromLong##SetName( long data, wxAny& result ) \
+ { result = wxAny(SetName((unsigned long)data)); } \
+ void ToLong##SetName( const wxAny& data, long &result ) \
+ { result = (long) (data).As(static_cast<SetName*>(NULL)).to_ulong(); } \
+ wxTO_STRING_IMP( SetName ) \
+ wxFROM_STRING_IMP( SetName ) \
+ wxEnumTypeInfo s_typeInfo##SetName(wxT_SET, &s_enumData##e, \
+ &wxTO_STRING( SetName ), &wxFROM_STRING( SetName ), \
+ &ToLong##SetName, &FromLong##SetName, typeid(SetName).name() );
+
+template<typename e>
+void wxFlagsFromString(const wxString &s, e &data )
+{
+ wxEnumData* edata = wxGetEnumData((e*) 0);
+ data.m_data = 0;
+
+ wxArrayString array;
+ wxSetStringToArray( s, array );
+ wxString flag;
+ for ( size_t i = 0; i < array.Count(); ++i )
+ {
+ flag = array[i];
+ int ivalue;
+ if ( edata->HasEnumMemberValue( flag.c_str(), &ivalue ) )
+ {
+ data.m_data |= ivalue;
+ }
+ }
+}
+
+template<typename e>
+void wxFlagsToString( wxString &s, const e& data )
+{
+ wxEnumData* edata = wxGetEnumData((e*) 0);
+ int count = edata->GetEnumCount();
+ int i;
+ s.Clear();
+ long dataValue = data.m_data;
+ for ( i = 0; i < count; i++ )
+ {
+ int value = edata->GetEnumMemberValueByIndex(i);
+ // make this to allow for multi-bit constants to work
+ if ( value && ( dataValue & value ) == value )
+ {
+ // clear the flags we just set
+ dataValue &= ~value;
+ // this could also be done by the templated calls
+ if ( !s.empty() )
+ s +=wxT("|");
+ s += edata->GetEnumMemberNameByIndex(i);
+ }
+ }
+}
+
+#define wxBEGIN_FLAGS( e ) \
+ wxEnumMemberData s_enumDataMembers##e[] = {
+
+#define wxFLAGS_MEMBER( v ) { wxT(#v), static_cast<int>(v) },
+
+#define wxEND_FLAGS( e ) \
+ { NULL, 0 } }; \
+ wxEnumData s_enumData##e( s_enumDataMembers##e ); \
+ wxEnumData *wxGetEnumData(e*) { return &s_enumData##e; } \
+ template<> void wxStringReadValue(const wxString &s, e &data ) \
+ { wxFlagsFromString<e>( s, data ); } \
+ template<> void wxStringWriteValue( wxString &s, const e& data ) \
+ { wxFlagsToString<e>( s, data ); } \
+ void FromLong##e( long data, wxAny& result ) \
+ { result = wxAny(e(data)); } \
+ void ToLong##e( const wxAny& data, long &result ) \
+ { result = (long) (data).As(static_cast<e*>(NULL)).m_data; } \
+ wxTO_STRING_IMP( e ) \
+ wxFROM_STRING_IMP( e ) \
+ wxEnumTypeInfo s_typeInfo##e(wxT_SET, &s_enumData##e, \
+ &wxTO_STRING( e ), &wxFROM_STRING( e ), &ToLong##e, \
+ &FromLong##e, typeid(e).name() );
+
+// ----------------------------------------------------------------------------
+// Type Information
+// ----------------------------------------------------------------------------
+
+// All data exposed by the RTTI is characterized using the following classes.
+// The first characterization is done by wxTypeKind. All enums up to and including
+// wxT_CUSTOM represent so called simple types. These cannot be divided any further.
+// They can be converted to and from wxStrings, that's all.
+// Other wxTypeKinds can instead be splitted recursively into smaller parts until
+// the simple types are reached.
+
+enum wxTypeKind
+{
+ wxT_VOID = 0, // unknown type
+ wxT_BOOL,
+ wxT_CHAR,
+ wxT_UCHAR,
+ wxT_INT,
+ wxT_UINT,
+ wxT_LONG,
+ wxT_ULONG,
+ wxT_LONGLONG,
+ wxT_ULONGLONG,
+ wxT_FLOAT,
+ wxT_DOUBLE,
+ wxT_STRING, // must be wxString
+ wxT_SET, // must be wxBitset<> template
+ wxT_ENUM,
+ wxT_CUSTOM, // user defined type (e.g. wxPoint)
+
+ wxT_LAST_SIMPLE_TYPE_KIND = wxT_CUSTOM,
+
+ wxT_OBJECT_PTR, // object reference
+ wxT_OBJECT, // embedded object
+ wxT_COLLECTION, // collection
+
+ wxT_DELEGATE, // for connecting against an event source
+
+ wxT_LAST_TYPE_KIND = wxT_DELEGATE // sentinel for bad data, asserts, debugging
+};
+
+class WXDLLIMPEXP_BASE wxAny;
+class WXDLLIMPEXP_BASE wxTypeInfo;
+
+WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxTypeInfo*, wxTypeInfoMap, class WXDLLIMPEXP_BASE );
+
+class WXDLLIMPEXP_BASE wxTypeInfo
+{
+public:
+ typedef void (*wxVariant2StringFnc)( const wxAny& data, wxString &result );
+ typedef void (*wxString2VariantFnc)( const wxString& data, wxAny &result );
+
+ wxTypeInfo(wxTypeKind kind,
+ wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL,
+ const wxString &name = wxEmptyString):
+ m_toString(to), m_fromString(from), m_kind(kind), m_name(name)
+ {
+ Register();
+ }
+#if 0 // wxUSE_UNICODE
+ wxTypeInfo(wxTypeKind kind,
+ wxVariant2StringFnc to, wxString2VariantFnc from,
+ const char *name):
+ m_toString(to), m_fromString(from), m_kind(kind),
+ m_name(wxString::FromAscii(name))
+ {
+ Register();
+ }
+#endif
+
+ virtual ~wxTypeInfo()
+ {
+ Unregister();
+ }
+
+ // return the kind of this type (wxT_... constants)
+ wxTypeKind GetKind() const { return m_kind; }
+
+ // returns the unique name of this type
+ const wxString& GetTypeName() const { return m_name; }
+
+ // is this type a delegate type
+ bool IsDelegateType() const { return m_kind == wxT_DELEGATE; }
+
+ // is this type a custom type
+ bool IsCustomType() const { return m_kind == wxT_CUSTOM; }
+
+ // is this type an object type
+ bool IsObjectType() const { return m_kind == wxT_OBJECT || m_kind == wxT_OBJECT_PTR; }
+
+ // can the content of this type be converted to and from strings ?
+ bool HasStringConverters() const { return m_toString != NULL && m_fromString != NULL; }
+
+ // convert a wxAny holding data of this type into a string
+ void ConvertToString( const wxAny& data, wxString &result ) const
+ {
+ if ( m_toString )
+ (*m_toString)( data, result );
+ else
+ wxLogError( wxGetTranslation(wxT("String conversions not supported")) );
+ }
+
+ // convert a string into a wxAny holding the corresponding data in this type
+ void ConvertFromString( const wxString& data, wxAny &result ) const
+ {
+ if( m_fromString )
+ (*m_fromString)( data, result );
+ else
+ wxLogError( wxGetTranslation(wxT("String conversions not supported")) );
+ }
+
+ // statics:
+
+ // looks for the corresponding type, will return NULL if not found
+ static wxTypeInfo *FindType( const wxString& typeName );
+private:
+ void Register();
+ void Unregister();
+
+ wxVariant2StringFnc m_toString;
+ wxString2VariantFnc m_fromString;
+
+ wxTypeKind m_kind;
+ wxString m_name;
+
+ // the static list of all types we know about
+ static wxTypeInfoMap* ms_typeTable;
+};
+
+class WXDLLIMPEXP_BASE wxBuiltInTypeInfo : public wxTypeInfo
+{
+public:
+ wxBuiltInTypeInfo( wxTypeKind kind, wxVariant2StringFnc to = NULL,
+ wxString2VariantFnc from = NULL,
+ const wxString &name = wxEmptyString ) :
+ wxTypeInfo( kind, to, from, name )
+ { wxASSERT_MSG( GetKind() < wxT_SET, wxT("Illegal Kind for Base Type") ); }
+};
+
+class WXDLLIMPEXP_BASE wxCustomTypeInfo : public wxTypeInfo
+{
+public:
+ wxCustomTypeInfo( const wxString &name, wxVariant2StringFnc to,
+ wxString2VariantFnc from ) :
+ wxTypeInfo( wxT_CUSTOM, to, from, name )
+ {}
+};
+
+class WXDLLIMPEXP_BASE wxEnumTypeInfo : public wxTypeInfo
+{
+public:
+ typedef void (*converterToLong_t)( const wxAny& data, long &result );
+ typedef void (*converterFromLong_t)( long data, wxAny &result );
+
+ wxEnumTypeInfo( wxTypeKind kind, wxEnumData* enumInfo, wxVariant2StringFnc to,
+ wxString2VariantFnc from, converterToLong_t toLong,
+ converterFromLong_t fromLong, const wxString &name ) :
+ wxTypeInfo( kind, to, from, name ), m_toLong( toLong ), m_fromLong( fromLong )
+ {
+ wxASSERT_MSG( kind == wxT_ENUM || kind == wxT_SET,
+ wxT("Illegal Kind for Enum Type"));
+ m_enumInfo = enumInfo;
+ }
+
+ const wxEnumData* GetEnumData() const { return m_enumInfo; }
+
+ // convert a wxAny holding data of this type into a long
+ void ConvertToLong( const wxAny& data, long &result ) const
+ {
+ if( m_toLong )
+ (*m_toLong)( data, result );
+ else
+ wxLogError( wxGetTranslation(wxT("Long Conversions not supported")) );
+ }
+
+ // convert a long into a wxAny holding the corresponding data in this type
+ void ConvertFromLong( long data, wxAny &result ) const
+ {
+ if( m_fromLong )
+ (*m_fromLong)( data, result );
+ else
+ wxLogError( wxGetTranslation(wxT("Long Conversions not supported")) );
+ }
+
+private:
+ converterToLong_t m_toLong;
+ converterFromLong_t m_fromLong;
+
+ wxEnumData *m_enumInfo; // Kind == wxT_ENUM or Kind == wxT_SET
+};
+
+class WXDLLIMPEXP_BASE wxClassTypeInfo : public wxTypeInfo
+{
+public:
+ wxClassTypeInfo( wxTypeKind kind, wxClassInfo* classInfo,
+ wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL,
+ const wxString &name = wxEmptyString);
+
+ const wxClassInfo *GetClassInfo() const { return m_classInfo; }
+
+private:
+ wxClassInfo *m_classInfo; // Kind == wxT_OBJECT - could be NULL
+};
+
+class WXDLLIMPEXP_BASE wxCollectionTypeInfo : public wxTypeInfo
+{
+public:
+ wxCollectionTypeInfo( const wxString &elementName, wxVariant2StringFnc to,
+ wxString2VariantFnc from , const wxString &name) :
+ wxTypeInfo( wxT_COLLECTION, to, from, name )
+ { m_elementTypeName = elementName; m_elementType = NULL; }
+
+ const wxTypeInfo* GetElementType() const
+ {
+ if ( m_elementType == NULL )
+ m_elementType = wxTypeInfo::FindType( m_elementTypeName );
+ return m_elementType;
+ }
+
+private:
+ mutable wxTypeInfo * m_elementType;
+ wxString m_elementTypeName;
+};
+
+class WXDLLIMPEXP_BASE wxEventSourceTypeInfo : public wxTypeInfo
+{
+public:
+ wxEventSourceTypeInfo( int eventType, wxClassInfo* eventClass,
+ wxVariant2StringFnc to = NULL,
+ wxString2VariantFnc from = NULL );
+ wxEventSourceTypeInfo( int eventType, int lastEventType, wxClassInfo* eventClass,
+ wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL );
+
+ int GetEventType() const { return m_eventType; }
+ int GetLastEventType() const { return m_lastEventType; }
+ const wxClassInfo* GetEventClass() const { return m_eventClass; }
+
+private:
+ const wxClassInfo *m_eventClass; // (extended will merge into classinfo)
+ int m_eventType;
+ int m_lastEventType;
+};
+
+template<typename T> const wxTypeInfo* wxGetTypeInfo( T * )
+ { return wxTypeInfo::FindType(typeid(T).name()); }
+
+// this macro is for usage with custom, non-object derived classes and structs,
+// wxPoint is such a custom type
+
+#if wxUSE_FUNC_TEMPLATE_POINTER
+ #define wxCUSTOM_TYPE_INFO( e, toString, fromString ) \
+ wxCustomTypeInfo s_typeInfo##e(typeid(e).name(), &toString, &fromString);
+#else
+ #define wxCUSTOM_TYPE_INFO( e, toString, fromString ) \
+ void ToString##e( const wxAny& data, wxString &result ) \
+ { toString(data, result); } \
+ void FromString##e( const wxString& data, wxAny &result ) \
+ { fromString(data, result); } \
+ wxCustomTypeInfo s_typeInfo##e(typeid(e).name(), \
+ &ToString##e, &FromString##e);
+#endif
+
+#define wxCOLLECTION_TYPE_INFO( element, collection ) \
+ wxCollectionTypeInfo s_typeInfo##collection( typeid(element).name(), \
+ NULL, NULL, typeid(collection).name() );
+
+// sometimes a compiler invents specializations that are nowhere called,
+// use this macro to satisfy the refs, currently we don't have to play
+// tricks, but if we will have to according to the compiler, we will use
+// that macro for that
+
+#define wxILLEGAL_TYPE_SPECIALIZATION( a )
+
+#endif // wxUSE_EXTENDED_RTTI
+#endif // _XTITYPES_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/xtixml.h
+// Purpose: xml streaming runtime metadata information (extended class info)
+// Author: Stefan Csomor
+// Modified by:
+// Created: 27/07/03
+// Copyright: (c) 2003 Stefan Csomor
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XTIXMLH__
+#define _WX_XTIXMLH__
+
+#include "wx/defs.h"
+
+#if wxUSE_EXTENDED_RTTI
+
+#include "wx/string.h"
+#include "wx/xtistrm.h"
+
+/*
+class WXDLLIMPEXP_XML wxXmlNode;
+class WXDLLIMPEXP_BASE wxPropertyInfo;
+class WXDLLIMPEXP_BASE wxObject;
+class WXDLLIMPEXP_BASE wxClassInfo;
+class WXDLLIMPEXP_BASE wxAnyList;
+class WXDLLIMPEXP_BASE wxHandlerInfo;
+class WXDLLIMPEXP_BASE wxObjectWriterCallback;
+*/
+
+class WXDLLIMPEXP_XML wxObjectXmlWriter: public wxObjectWriter
+{
+public:
+
+ wxObjectXmlWriter( wxXmlNode * parent );
+ virtual ~wxObjectXmlWriter();
+
+ //
+ // streaming callbacks
+ //
+ // these callbacks really write out the values in the stream format
+ //
+
+ //
+ // streaming callbacks
+ //
+ // these callbacks really write out the values in the stream format
+
+ // begins writing out a new toplevel entry which has the indicated unique name
+ virtual void DoBeginWriteTopLevelEntry( const wxString &name );
+
+ // ends writing out a new toplevel entry which has the indicated unique name
+ virtual void DoEndWriteTopLevelEntry( const wxString &name );
+
+ // start of writing an object having the passed in ID
+ virtual void DoBeginWriteObject(const wxObject *object,
+ const wxClassInfo *classInfo, int objectID, const wxStringToAnyHashMap &metadata );
+
+ // end of writing an toplevel object name param is used for unique
+ // identification within the container
+ virtual void DoEndWriteObject(const wxObject *object,
+ const wxClassInfo *classInfo, int objectID );
+
+ // writes a simple property in the stream format
+ virtual void DoWriteSimpleType( const wxAny &value );
+
+ // start of writing a complex property into the stream (
+ virtual void DoBeginWriteProperty( const wxPropertyInfo *propInfo );
+
+ // end of writing a complex property into the stream
+ virtual void DoEndWriteProperty( const wxPropertyInfo *propInfo );
+
+ virtual void DoBeginWriteElement();
+ virtual void DoEndWriteElement();
+
+ // insert an object reference to an already written object
+ virtual void DoWriteRepeatedObject( int objectID );
+
+ // insert a null reference
+ virtual void DoWriteNullObject();
+
+ // writes a delegate in the stream format
+ virtual void DoWriteDelegate( const wxObject *object,
+ const wxClassInfo* classInfo, const wxPropertyInfo *propInfo,
+ const wxObject *eventSink, int sinkObjectID,
+ const wxClassInfo* eventSinkClassInfo, const wxHandlerInfo* handlerIndo );
+
+private:
+ struct wxObjectXmlWriterInternal;
+ wxObjectXmlWriterInternal* m_data;
+};
+
+/*
+wxObjectXmlReader handles streaming in a class from XML
+*/
+
+class WXDLLIMPEXP_XML wxObjectXmlReader: public wxObjectReader
+{
+public:
+ wxObjectXmlReader(wxXmlNode *parent) { m_parent = parent; }
+ virtual ~wxObjectXmlReader() {}
+
+ // Reads a component from XML. The return value is the root object ID, which can
+ // then be used to ask the readercallback about that object
+
+ virtual int ReadObject( const wxString &name, wxObjectReaderCallback *readercallback );
+
+private:
+ int ReadComponent(wxXmlNode *parent, wxObjectReaderCallback *callbacks);
+
+ // read the content of this node (simple type) and return the corresponding value
+ wxAny ReadValue(wxXmlNode *Node, const wxTypeInfo *type );
+
+ wxXmlNode * m_parent;
+};
+
+#endif // wxUSE_EXTENDED_RTTI
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/zipstrm.h
+// Purpose: Streams for Zip files
+// Author: Mike Wetherell
+// Copyright: (c) Mike Wetherell
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WXZIPSTREAM_H__
+#define _WX_WXZIPSTREAM_H__
+
+#include "wx/defs.h"
+
+#if wxUSE_ZIPSTREAM
+
+#include "wx/archive.h"
+#include "wx/filename.h"
+
+// some methods from wxZipInputStream and wxZipOutputStream stream do not get
+// exported/imported when compiled with Mingw versions before 3.4.2. So they
+// are imported/exported individually as a workaround
+#if (defined(__GNUWIN32__) || defined(__MINGW32__)) \
+ && (!defined __GNUC__ \
+ || !defined __GNUC_MINOR__ \
+ || !defined __GNUC_PATCHLEVEL__ \
+ || __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ < 30402)
+#define WXZIPFIX WXDLLIMPEXP_BASE
+#else
+#define WXZIPFIX
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// constants
+
+// Compression Method, only 0 (store) and 8 (deflate) are supported here
+//
+enum wxZipMethod
+{
+ wxZIP_METHOD_STORE,
+ wxZIP_METHOD_SHRINK,
+ wxZIP_METHOD_REDUCE1,
+ wxZIP_METHOD_REDUCE2,
+ wxZIP_METHOD_REDUCE3,
+ wxZIP_METHOD_REDUCE4,
+ wxZIP_METHOD_IMPLODE,
+ wxZIP_METHOD_TOKENIZE,
+ wxZIP_METHOD_DEFLATE,
+ wxZIP_METHOD_DEFLATE64,
+ wxZIP_METHOD_BZIP2 = 12,
+ wxZIP_METHOD_DEFAULT = 0xffff
+};
+
+// Originating File-System.
+//
+// These are Pkware's values. Note that Info-zip disagree on some of them,
+// most notably NTFS.
+//
+enum wxZipSystem
+{
+ wxZIP_SYSTEM_MSDOS,
+ wxZIP_SYSTEM_AMIGA,
+ wxZIP_SYSTEM_OPENVMS,
+ wxZIP_SYSTEM_UNIX,
+ wxZIP_SYSTEM_VM_CMS,
+ wxZIP_SYSTEM_ATARI_ST,
+ wxZIP_SYSTEM_OS2_HPFS,
+ wxZIP_SYSTEM_MACINTOSH,
+ wxZIP_SYSTEM_Z_SYSTEM,
+ wxZIP_SYSTEM_CPM,
+ wxZIP_SYSTEM_WINDOWS_NTFS,
+ wxZIP_SYSTEM_MVS,
+ wxZIP_SYSTEM_VSE,
+ wxZIP_SYSTEM_ACORN_RISC,
+ wxZIP_SYSTEM_VFAT,
+ wxZIP_SYSTEM_ALTERNATE_MVS,
+ wxZIP_SYSTEM_BEOS,
+ wxZIP_SYSTEM_TANDEM,
+ wxZIP_SYSTEM_OS_400
+};
+
+// Dos/Win file attributes
+//
+enum wxZipAttributes
+{
+ wxZIP_A_RDONLY = 0x01,
+ wxZIP_A_HIDDEN = 0x02,
+ wxZIP_A_SYSTEM = 0x04,
+ wxZIP_A_SUBDIR = 0x10,
+ wxZIP_A_ARCH = 0x20,
+
+ wxZIP_A_MASK = 0x37
+};
+
+// Values for the flags field in the zip headers
+//
+enum wxZipFlags
+{
+ wxZIP_ENCRYPTED = 0x0001,
+ wxZIP_DEFLATE_NORMAL = 0x0000, // normal compression
+ wxZIP_DEFLATE_EXTRA = 0x0002, // extra compression
+ wxZIP_DEFLATE_FAST = 0x0004, // fast compression
+ wxZIP_DEFLATE_SUPERFAST = 0x0006, // superfast compression
+ wxZIP_DEFLATE_MASK = 0x0006,
+ wxZIP_SUMS_FOLLOW = 0x0008, // crc and sizes come after the data
+ wxZIP_ENHANCED = 0x0010,
+ wxZIP_PATCH = 0x0020,
+ wxZIP_STRONG_ENC = 0x0040,
+ wxZIP_UNUSED = 0x0F80,
+ wxZIP_RESERVED = 0xF000
+};
+
+// Forward decls
+//
+class WXDLLIMPEXP_FWD_BASE wxZipEntry;
+class WXDLLIMPEXP_FWD_BASE wxZipInputStream;
+
+
+/////////////////////////////////////////////////////////////////////////////
+// wxZipNotifier
+
+class WXDLLIMPEXP_BASE wxZipNotifier
+{
+public:
+ virtual ~wxZipNotifier() { }
+
+ virtual void OnEntryUpdated(wxZipEntry& entry) = 0;
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Zip Entry - holds the meta data for a file in the zip
+
+class WXDLLIMPEXP_BASE wxZipEntry : public wxArchiveEntry
+{
+public:
+ wxZipEntry(const wxString& name = wxEmptyString,
+ const wxDateTime& dt = wxDateTime::Now(),
+ wxFileOffset size = wxInvalidOffset);
+ virtual ~wxZipEntry();
+
+ wxZipEntry(const wxZipEntry& entry);
+ wxZipEntry& operator=(const wxZipEntry& entry);
+
+ // Get accessors
+ wxDateTime GetDateTime() const { return m_DateTime; }
+ wxFileOffset GetSize() const { return m_Size; }
+ wxFileOffset GetOffset() const { return m_Offset; }
+ wxString GetInternalName() const { return m_Name; }
+ int GetMethod() const { return m_Method; }
+ int GetFlags() const { return m_Flags; }
+ wxUint32 GetCrc() const { return m_Crc; }
+ wxFileOffset GetCompressedSize() const { return m_CompressedSize; }
+ int GetSystemMadeBy() const { return m_SystemMadeBy; }
+ wxString GetComment() const { return m_Comment; }
+ wxUint32 GetExternalAttributes() const { return m_ExternalAttributes; }
+ wxPathFormat GetInternalFormat() const { return wxPATH_UNIX; }
+ int GetMode() const;
+ const char *GetLocalExtra() const;
+ size_t GetLocalExtraLen() const;
+ const char *GetExtra() const;
+ size_t GetExtraLen() const;
+ wxString GetName(wxPathFormat format = wxPATH_NATIVE) const;
+
+ // is accessors
+ inline bool IsDir() const;
+ inline bool IsText() const;
+ inline bool IsReadOnly() const;
+ inline bool IsMadeByUnix() const;
+
+ // set accessors
+ void SetDateTime(const wxDateTime& dt) { m_DateTime = dt; }
+ void SetSize(wxFileOffset size) { m_Size = size; }
+ void SetMethod(int method) { m_Method = (wxUint16)method; }
+ void SetComment(const wxString& comment) { m_Comment = comment; }
+ void SetExternalAttributes(wxUint32 attr ) { m_ExternalAttributes = attr; }
+ void SetSystemMadeBy(int system);
+ void SetMode(int mode);
+ void SetExtra(const char *extra, size_t len);
+ void SetLocalExtra(const char *extra, size_t len);
+
+ inline void SetName(const wxString& name,
+ wxPathFormat format = wxPATH_NATIVE);
+
+ static wxString GetInternalName(const wxString& name,
+ wxPathFormat format = wxPATH_NATIVE,
+ bool *pIsDir = NULL);
+
+ // set is accessors
+ void SetIsDir(bool isDir = true);
+ inline void SetIsReadOnly(bool isReadOnly = true);
+ inline void SetIsText(bool isText = true);
+
+ wxZipEntry *Clone() const { return ZipClone(); }
+
+ void SetNotifier(wxZipNotifier& notifier);
+ void UnsetNotifier();
+
+protected:
+ // Internal attributes
+ enum { TEXT_ATTR = 1 };
+
+ // protected Get accessors
+ int GetVersionNeeded() const { return m_VersionNeeded; }
+ wxFileOffset GetKey() const { return m_Key; }
+ int GetVersionMadeBy() const { return m_VersionMadeBy; }
+ int GetDiskStart() const { return m_DiskStart; }
+ int GetInternalAttributes() const { return m_InternalAttributes; }
+
+ void SetVersionNeeded(int version) { m_VersionNeeded = (wxUint16)version; }
+ void SetOffset(wxFileOffset offset) { m_Offset = offset; }
+ void SetFlags(int flags) { m_Flags = (wxUint16)flags; }
+ void SetVersionMadeBy(int version) { m_VersionMadeBy = (wxUint8)version; }
+ void SetCrc(wxUint32 crc) { m_Crc = crc; }
+ void SetCompressedSize(wxFileOffset size) { m_CompressedSize = size; }
+ void SetKey(wxFileOffset offset) { m_Key = offset; }
+ void SetDiskStart(int start) { m_DiskStart = (wxUint16)start; }
+ void SetInternalAttributes(int attr) { m_InternalAttributes = (wxUint16)attr; }
+
+ virtual wxZipEntry *ZipClone() const { return new wxZipEntry(*this); }
+
+ void Notify();
+
+private:
+ wxArchiveEntry* DoClone() const { return ZipClone(); }
+
+ size_t ReadLocal(wxInputStream& stream, wxMBConv& conv);
+ size_t WriteLocal(wxOutputStream& stream, wxMBConv& conv) const;
+
+ size_t ReadCentral(wxInputStream& stream, wxMBConv& conv);
+ size_t WriteCentral(wxOutputStream& stream, wxMBConv& conv) const;
+
+ size_t ReadDescriptor(wxInputStream& stream);
+ size_t WriteDescriptor(wxOutputStream& stream, wxUint32 crc,
+ wxFileOffset compressedSize, wxFileOffset size);
+
+ wxUint8 m_SystemMadeBy; // one of enum wxZipSystem
+ wxUint8 m_VersionMadeBy; // major * 10 + minor
+
+ wxUint16 m_VersionNeeded; // ver needed to extract (20 i.e. v2.0)
+ wxUint16 m_Flags;
+ wxUint16 m_Method; // compression method (one of wxZipMethod)
+ wxDateTime m_DateTime;
+ wxUint32 m_Crc;
+ wxFileOffset m_CompressedSize;
+ wxFileOffset m_Size;
+ wxString m_Name; // in internal format
+ wxFileOffset m_Key; // the original offset for copied entries
+ wxFileOffset m_Offset; // file offset of the entry
+
+ wxString m_Comment;
+ wxUint16 m_DiskStart; // for multidisk archives, not unsupported
+ wxUint16 m_InternalAttributes; // bit 0 set for text files
+ wxUint32 m_ExternalAttributes; // system specific depends on SystemMadeBy
+
+ class wxZipMemory *m_Extra;
+ class wxZipMemory *m_LocalExtra;
+
+ wxZipNotifier *m_zipnotifier;
+ class wxZipWeakLinks *m_backlink;
+
+ friend class wxZipInputStream;
+ friend class wxZipOutputStream;
+
+ DECLARE_DYNAMIC_CLASS(wxZipEntry)
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+// wxZipOutputStream
+
+WX_DECLARE_LIST_WITH_DECL(wxZipEntry, wxZipEntryList_, class WXDLLIMPEXP_BASE);
+
+class WXDLLIMPEXP_BASE wxZipOutputStream : public wxArchiveOutputStream
+{
+public:
+ wxZipOutputStream(wxOutputStream& stream,
+ int level = -1,
+ wxMBConv& conv = wxConvLocal);
+ wxZipOutputStream(wxOutputStream *stream,
+ int level = -1,
+ wxMBConv& conv = wxConvLocal);
+ virtual WXZIPFIX ~wxZipOutputStream();
+
+ bool PutNextEntry(wxZipEntry *entry) { return DoCreate(entry); }
+
+ bool WXZIPFIX PutNextEntry(const wxString& name,
+ const wxDateTime& dt = wxDateTime::Now(),
+ wxFileOffset size = wxInvalidOffset);
+
+ bool WXZIPFIX PutNextDirEntry(const wxString& name,
+ const wxDateTime& dt = wxDateTime::Now());
+
+ bool WXZIPFIX CopyEntry(wxZipEntry *entry, wxZipInputStream& inputStream);
+ bool WXZIPFIX CopyArchiveMetaData(wxZipInputStream& inputStream);
+
+ void WXZIPFIX Sync();
+ bool WXZIPFIX CloseEntry();
+ bool WXZIPFIX Close();
+
+ void SetComment(const wxString& comment) { m_Comment = comment; }
+
+ int GetLevel() const { return m_level; }
+ void WXZIPFIX SetLevel(int level);
+
+protected:
+ virtual size_t WXZIPFIX OnSysWrite(const void *buffer, size_t size);
+ virtual wxFileOffset OnSysTell() const { return m_entrySize; }
+
+ // this protected interface isn't yet finalised
+ struct Buffer { const char *m_data; size_t m_size; };
+ virtual wxOutputStream* WXZIPFIX OpenCompressor(wxOutputStream& stream,
+ wxZipEntry& entry,
+ const Buffer bufs[]);
+ virtual bool WXZIPFIX CloseCompressor(wxOutputStream *comp);
+
+ bool IsParentSeekable() const
+ { return m_offsetAdjustment != wxInvalidOffset; }
+
+private:
+ void Init(int level);
+
+ bool WXZIPFIX PutNextEntry(wxArchiveEntry *entry);
+ bool WXZIPFIX CopyEntry(wxArchiveEntry *entry, wxArchiveInputStream& stream);
+ bool WXZIPFIX CopyArchiveMetaData(wxArchiveInputStream& stream);
+
+ bool IsOpened() const { return m_comp || m_pending; }
+
+ bool DoCreate(wxZipEntry *entry, bool raw = false);
+ void CreatePendingEntry(const void *buffer, size_t size);
+ void CreatePendingEntry();
+
+ class wxStoredOutputStream *m_store;
+ class wxZlibOutputStream2 *m_deflate;
+ class wxZipStreamLink *m_backlink;
+ wxZipEntryList_ m_entries;
+ char *m_initialData;
+ size_t m_initialSize;
+ wxZipEntry *m_pending;
+ bool m_raw;
+ wxFileOffset m_headerOffset;
+ size_t m_headerSize;
+ wxFileOffset m_entrySize;
+ wxUint32 m_crcAccumulator;
+ wxOutputStream *m_comp;
+ int m_level;
+ wxFileOffset m_offsetAdjustment;
+ wxString m_Comment;
+ bool m_endrecWritten;
+
+ wxDECLARE_NO_COPY_CLASS(wxZipOutputStream);
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+// wxZipInputStream
+
+class WXDLLIMPEXP_BASE wxZipInputStream : public wxArchiveInputStream
+{
+public:
+ typedef wxZipEntry entry_type;
+
+ wxZipInputStream(wxInputStream& stream, wxMBConv& conv = wxConvLocal);
+ wxZipInputStream(wxInputStream *stream, wxMBConv& conv = wxConvLocal);
+
+#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE
+ wxZipInputStream(const wxString& archive, const wxString& file)
+ : wxArchiveInputStream(OpenFile(archive), wxConvLocal) { Init(file); }
+#endif
+
+ virtual WXZIPFIX ~wxZipInputStream();
+
+ bool OpenEntry(wxZipEntry& entry) { return DoOpen(&entry); }
+ bool WXZIPFIX CloseEntry();
+
+ wxZipEntry *GetNextEntry();
+
+ wxString WXZIPFIX GetComment();
+ int WXZIPFIX GetTotalEntries();
+
+ virtual wxFileOffset GetLength() const { return m_entry.GetSize(); }
+
+protected:
+ size_t WXZIPFIX OnSysRead(void *buffer, size_t size);
+ wxFileOffset OnSysTell() const { return m_decomp ? m_decomp->TellI() : 0; }
+
+#if WXWIN_COMPATIBILITY_2_6
+ wxFileOffset WXZIPFIX OnSysSeek(wxFileOffset seek, wxSeekMode mode);
+#endif
+
+ // this protected interface isn't yet finalised
+ virtual wxInputStream* WXZIPFIX OpenDecompressor(wxInputStream& stream);
+ virtual bool WXZIPFIX CloseDecompressor(wxInputStream *decomp);
+
+private:
+ void Init();
+ void Init(const wxString& file);
+#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE
+ static wxInputStream *OpenFile(const wxString& archive);
+#endif
+
+ wxArchiveEntry *DoGetNextEntry() { return GetNextEntry(); }
+
+ bool WXZIPFIX OpenEntry(wxArchiveEntry& entry);
+
+ wxStreamError ReadLocal(bool readEndRec = false);
+ wxStreamError ReadCentral();
+
+ wxUint32 ReadSignature();
+ bool FindEndRecord();
+ bool LoadEndRecord();
+
+ bool AtHeader() const { return m_headerSize == 0; }
+ bool AfterHeader() const { return m_headerSize > 0 && !m_decomp; }
+ bool IsOpened() const { return m_decomp != NULL; }
+
+ wxZipStreamLink *MakeLink(wxZipOutputStream *out);
+
+ bool DoOpen(wxZipEntry *entry = NULL, bool raw = false);
+ bool OpenDecompressor(bool raw = false);
+
+ class wxStoredInputStream *m_store;
+ class wxZlibInputStream2 *m_inflate;
+ class wxRawInputStream *m_rawin;
+ wxZipEntry m_entry;
+ bool m_raw;
+ size_t m_headerSize;
+ wxUint32 m_crcAccumulator;
+ wxInputStream *m_decomp;
+ bool m_parentSeekable;
+ class wxZipWeakLinks *m_weaklinks;
+ class wxZipStreamLink *m_streamlink;
+ wxFileOffset m_offsetAdjustment;
+ wxFileOffset m_position;
+ wxUint32 m_signature;
+ size_t m_TotalEntries;
+ wxString m_Comment;
+
+ friend bool wxZipOutputStream::CopyEntry(
+ wxZipEntry *entry, wxZipInputStream& inputStream);
+ friend bool wxZipOutputStream::CopyArchiveMetaData(
+ wxZipInputStream& inputStream);
+
+#if WXWIN_COMPATIBILITY_2_6
+ bool m_allowSeeking;
+ friend class wxArchiveFSHandler;
+#endif
+
+ wxDECLARE_NO_COPY_CLASS(wxZipInputStream);
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Iterators
+
+#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR
+typedef wxArchiveIterator<wxZipInputStream> wxZipIter;
+typedef wxArchiveIterator<wxZipInputStream,
+ std::pair<wxString, wxZipEntry*> > wxZipPairIter;
+#endif
+
+
+/////////////////////////////////////////////////////////////////////////////
+// wxZipClassFactory
+
+class WXDLLIMPEXP_BASE wxZipClassFactory : public wxArchiveClassFactory
+{
+public:
+ typedef wxZipEntry entry_type;
+ typedef wxZipInputStream instream_type;
+ typedef wxZipOutputStream outstream_type;
+ typedef wxZipNotifier notifier_type;
+#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR
+ typedef wxZipIter iter_type;
+ typedef wxZipPairIter pairiter_type;
+#endif
+
+ wxZipClassFactory();
+
+ wxZipEntry *NewEntry() const
+ { return new wxZipEntry; }
+ wxZipInputStream *NewStream(wxInputStream& stream) const
+ { return new wxZipInputStream(stream, GetConv()); }
+ wxZipOutputStream *NewStream(wxOutputStream& stream) const
+ { return new wxZipOutputStream(stream, -1, GetConv()); }
+ wxZipInputStream *NewStream(wxInputStream *stream) const
+ { return new wxZipInputStream(stream, GetConv()); }
+ wxZipOutputStream *NewStream(wxOutputStream *stream) const
+ { return new wxZipOutputStream(stream, -1, GetConv()); }
+
+ wxString GetInternalName(const wxString& name,
+ wxPathFormat format = wxPATH_NATIVE) const
+ { return wxZipEntry::GetInternalName(name, format); }
+
+ const wxChar * const *GetProtocols(wxStreamProtocolType type
+ = wxSTREAM_PROTOCOL) const;
+
+protected:
+ wxArchiveEntry *DoNewEntry() const
+ { return NewEntry(); }
+ wxArchiveInputStream *DoNewStream(wxInputStream& stream) const
+ { return NewStream(stream); }
+ wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const
+ { return NewStream(stream); }
+ wxArchiveInputStream *DoNewStream(wxInputStream *stream) const
+ { return NewStream(stream); }
+ wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const
+ { return NewStream(stream); }
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxZipClassFactory)
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+// wxZipEntry inlines
+
+inline bool wxZipEntry::IsText() const
+{
+ return (m_InternalAttributes & TEXT_ATTR) != 0;
+}
+
+inline bool wxZipEntry::IsDir() const
+{
+ return (m_ExternalAttributes & wxZIP_A_SUBDIR) != 0;
+}
+
+inline bool wxZipEntry::IsReadOnly() const
+{
+ return (m_ExternalAttributes & wxZIP_A_RDONLY) != 0;
+}
+
+inline bool wxZipEntry::IsMadeByUnix() const
+{
+ const int pattern =
+ (1 << wxZIP_SYSTEM_OPENVMS) |
+ (1 << wxZIP_SYSTEM_UNIX) |
+ (1 << wxZIP_SYSTEM_ATARI_ST) |
+ (1 << wxZIP_SYSTEM_ACORN_RISC) |
+ (1 << wxZIP_SYSTEM_BEOS) | (1 << wxZIP_SYSTEM_TANDEM);
+
+ // note: some unix zippers put madeby = dos
+ return (m_SystemMadeBy == wxZIP_SYSTEM_MSDOS
+ && (m_ExternalAttributes & ~0xFFFF))
+ || ((pattern >> m_SystemMadeBy) & 1);
+}
+
+inline void wxZipEntry::SetIsText(bool isText)
+{
+ if (isText)
+ m_InternalAttributes |= TEXT_ATTR;
+ else
+ m_InternalAttributes &= ~TEXT_ATTR;
+}
+
+inline void wxZipEntry::SetIsReadOnly(bool isReadOnly)
+{
+ if (isReadOnly)
+ SetMode(GetMode() & ~0222);
+ else
+ SetMode(GetMode() | 0200);
+}
+
+inline void wxZipEntry::SetName(const wxString& name,
+ wxPathFormat format /*=wxPATH_NATIVE*/)
+{
+ bool isDir;
+ m_Name = GetInternalName(name, format, &isDir);
+ SetIsDir(isDir);
+}
+
+
+#endif // wxUSE_ZIPSTREAM
+
+#endif // _WX_WXZIPSTREAM_H__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/zstream.h
+// Purpose: Memory stream classes
+// Author: Guilhem Lavaux
+// Modified by: Mike Wetherell
+// Created: 11/07/98
+// Copyright: (c) Guilhem Lavaux
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+#ifndef _WX_WXZSTREAM_H__
+#define _WX_WXZSTREAM_H__
+
+#include "wx/defs.h"
+
+#if wxUSE_ZLIB && wxUSE_STREAMS
+
+#include "wx/stream.h"
+#include "wx/versioninfo.h"
+
+// Compression level
+enum wxZlibCompressionLevels {
+ wxZ_DEFAULT_COMPRESSION = -1,
+ wxZ_NO_COMPRESSION = 0,
+ wxZ_BEST_SPEED = 1,
+ wxZ_BEST_COMPRESSION = 9
+};
+
+// Flags
+enum wxZLibFlags {
+ wxZLIB_NO_HEADER = 0, // raw deflate stream, no header or checksum
+ wxZLIB_ZLIB = 1, // zlib header and checksum
+ wxZLIB_GZIP = 2, // gzip header and checksum, requires zlib 1.2.1+
+ wxZLIB_AUTO = 3 // autodetect header zlib or gzip
+};
+
+class WXDLLIMPEXP_BASE wxZlibInputStream: public wxFilterInputStream {
+ public:
+ wxZlibInputStream(wxInputStream& stream, int flags = wxZLIB_AUTO);
+ wxZlibInputStream(wxInputStream *stream, int flags = wxZLIB_AUTO);
+ virtual ~wxZlibInputStream();
+
+ char Peek() { return wxInputStream::Peek(); }
+ wxFileOffset GetLength() const { return wxInputStream::GetLength(); }
+
+ static bool CanHandleGZip();
+
+ bool SetDictionary(const char *data, const size_t datalen);
+ bool SetDictionary(const wxMemoryBuffer &buf);
+
+ protected:
+ size_t OnSysRead(void *buffer, size_t size);
+ wxFileOffset OnSysTell() const { return m_pos; }
+
+ private:
+ void Init(int flags);
+
+ protected:
+ size_t m_z_size;
+ unsigned char *m_z_buffer;
+ struct z_stream_s *m_inflate;
+ wxFileOffset m_pos;
+
+ wxDECLARE_NO_COPY_CLASS(wxZlibInputStream);
+};
+
+class WXDLLIMPEXP_BASE wxZlibOutputStream: public wxFilterOutputStream {
+ public:
+ wxZlibOutputStream(wxOutputStream& stream, int level = -1, int flags = wxZLIB_ZLIB);
+ wxZlibOutputStream(wxOutputStream *stream, int level = -1, int flags = wxZLIB_ZLIB);
+ virtual ~wxZlibOutputStream() { Close(); }
+
+ void Sync() { DoFlush(false); }
+ bool Close();
+ wxFileOffset GetLength() const { return m_pos; }
+
+ static bool CanHandleGZip();
+
+ bool SetDictionary(const char *data, const size_t datalen);
+ bool SetDictionary(const wxMemoryBuffer &buf);
+
+ protected:
+ size_t OnSysWrite(const void *buffer, size_t size);
+ wxFileOffset OnSysTell() const { return m_pos; }
+
+ virtual void DoFlush(bool final);
+
+ private:
+ void Init(int level, int flags);
+
+ protected:
+ size_t m_z_size;
+ unsigned char *m_z_buffer;
+ struct z_stream_s *m_deflate;
+ wxFileOffset m_pos;
+
+ wxDECLARE_NO_COPY_CLASS(wxZlibOutputStream);
+};
+
+class WXDLLIMPEXP_BASE wxZlibClassFactory: public wxFilterClassFactory
+{
+public:
+ wxZlibClassFactory();
+
+ wxFilterInputStream *NewStream(wxInputStream& stream) const
+ { return new wxZlibInputStream(stream); }
+ wxFilterOutputStream *NewStream(wxOutputStream& stream) const
+ { return new wxZlibOutputStream(stream, -1); }
+ wxFilterInputStream *NewStream(wxInputStream *stream) const
+ { return new wxZlibInputStream(stream); }
+ wxFilterOutputStream *NewStream(wxOutputStream *stream) const
+ { return new wxZlibOutputStream(stream, -1); }
+
+ const wxChar * const *GetProtocols(wxStreamProtocolType type
+ = wxSTREAM_PROTOCOL) const;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxZlibClassFactory)
+};
+
+class WXDLLIMPEXP_BASE wxGzipClassFactory: public wxFilterClassFactory
+{
+public:
+ wxGzipClassFactory();
+
+ wxFilterInputStream *NewStream(wxInputStream& stream) const
+ { return new wxZlibInputStream(stream); }
+ wxFilterOutputStream *NewStream(wxOutputStream& stream) const
+ { return new wxZlibOutputStream(stream, -1); }
+ wxFilterInputStream *NewStream(wxInputStream *stream) const
+ { return new wxZlibInputStream(stream); }
+ wxFilterOutputStream *NewStream(wxOutputStream *stream) const
+ { return new wxZlibOutputStream(stream, -1); }
+
+ const wxChar * const *GetProtocols(wxStreamProtocolType type
+ = wxSTREAM_PROTOCOL) const;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxGzipClassFactory)
+};
+
+WXDLLIMPEXP_BASE wxVersionInfo wxGetZlibVersionInfo();
+
+#endif
+ // wxUSE_ZLIB && wxUSE_STREAMS
+
+#endif
+ // _WX_WXZSTREAM_H__
+
--- /dev/null
+#!/bin/sh
+#
+# Name: wx-config{.in,}
+# Purpose: wx configuration search and query tool {template,}
+# Author: Ron <ron@debian.org>
+# Modified by:
+# Created: 8/9/2004
+# Copyright: (c) 2004 Ron <ron@debian.org>
+# Essentially a fresh start this time around, but for maximum
+# compatibility basic code was taken from, and heavy reference
+# made to, the previously unattributed wx-config from cvs.
+# All the usual suspects contributed to the dicussion that led
+# to this new work and likewise to the ideas and content in the
+# original (which was probably influenced by gtk), among them:
+# Robert Roebling, Vadim Zeitlin, Vaclav Slavik, Robin Dunn
+# Licence: wxWindows licence
+############################################################################
+
+# Extra^2 debug mode, for if things ever get really weird.
+[ -z "$WXDEBUG_X" ] || set -x
+
+
+# On with some basic stuff, like the ability to die gracefully,
+# and to tell people what we are about.
+# ------------------------------------------------------------------
+
+# decho _message
+# Output a message to stderr.
+decho() { echo "$*" 1>&2; }
+
+# usage _exitcode
+# Outputs a usage message to stderr and exits with _exitcode.
+# Try to keep this to a single page (ie. < 25 lines). We can add
+# alternate or interactive help targets if people want more detail.
+#
+# Exit codes are now subject to a more strict interpretation.
+# wx-config should return 0 upon successful operation, 1 if the
+# reqested operation could not be completed successfully, and 2
+# if the requested operation is not supported by this version of
+# wx-config.
+usage()
+{
+ cat 1>&2 <<EOF
+
+ wx-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--release] [--version-full]
+ [--list] [--selected-config] [--host=HOST] [--toolkit=TOOLKIT]
+ [--universal[=yes|no]] [--unicode[=yes|no]] [--static[=yes|no]]
+ [--debug[=yes|no]] [--version[=VERSION]] [--basename] [--cc] [--cxx]
+ [--cppflags [base]] [--cxxflags [base]] [--cflags]
+ [--rescomp] [--linkdeps] [--ld] [--utility=UTIL]
+ [--libs [LIBS...]] [--optional-libs [LIBS...]]
+
+ wx-config returns information about the wxWidgets libraries available on
+ your system. It may be used to retrieve the information required to build
+ applications using these libraries using --cppflags, --cxxflags, --cflags,
+ and --libs options. And you may query the properties of this configuration
+ using --query-{host,toolkit,widgetset,chartype,debugtype,version,linkage}.
+
+ NOTE: Usage of --debug and --query-debugtype are only relevant if you
+ have any versions prior to 2.9 installed and use the --version option to
+ select an earlier version.
+
+ If multiple builds of wxWidgets are available, you can use the options
+ --prefix, --host, --toolkit, --unicode, --static, --universal or --version
+ to select from them. The --selected-config option shows the name of the
+ current configuration and --list shows available alternatives which match
+ specified criteria. The --utility option returns the correct version of
+ UTIL to use with the selected build. The --linkdeps option returns only
+ static libraries for your makefile link rule dependencies.
+
+ The LIBS arguments (comma or space separated) may be used to specify the
+ wxWidgets libraries that you wish to use. The "std" label may be used to
+ import all libraries that would be used by default if none were specified
+ explicitly, e.g. wx-config --libs core,base. The "all" label may be used
+ to import all libraries that have been compiled which are shown in the
+ list below. The --optional-libs parameter should be followed by a list
+ of libs that should be linked to, but only if they are available.
+
+ Available libraries in this build are:
+ xrc webview stc richtext ribbon propgrid aui gl html qa adv core xml net base
+
+EOF
+
+ exit $1
+}
+
+# Unfussy people are the easiest to deal with, get them out of the way now.
+[ $# -gt 0 ] || usage 1
+
+
+# Contentious tools determined by configure.
+EGREP="/bin/grep -E"
+
+
+# For the people who know what they want, or think they do:
+# Divide the valid arguments into functional groups for later examination,
+# then parse all command line arguments completely, deferring action on
+# output options until all significant input has been processed and any
+# decision about delegation has been taken.
+
+# Note early, that '-' is a complete no-no for use in option names below.
+# It totally falls apart as soon as it becomes part of a variable name.
+# Use '_' instead, and by the magic of it all just being bits, you'll
+# be able to use --my-option or --my_option from the command line at
+# your discretion. They are synonymous as user input, but _ALWAYS_ use
+# underscores for compound names in the code here, never a dash.
+
+
+# The list of all options we recognise. If it is not in here, then
+# it is not something we want to handle.
+# ------------------------------------------------------------------
+
+# Options that specify a distinct library build.
+#
+# Note also that order in this list is significant later on, as this sets
+# the precedence with which we will try to gauge the similarity of other
+# configs to this one. Options earlier in the list should be more crucial
+# to match well than those that follow. Options specified by the user will
+# always take precedence and are not subject to any partial ordering here.
+wxconfig_schema="host toolkit widgetset chartype debugtype flavour version linkage"
+
+# Options that are expected to generate some output.
+wxconfig_output_options="prefix exec_prefix
+ list
+ release version version_full
+ basename
+ cppflags cflags cxxflags
+ rescomp
+ rezflags
+ libs
+ optional_libs
+ linkdeps
+ cc cxx ld
+ gl_libs"
+
+# Options that permit the user to supply hints that may affect the output.
+# These options all accept arbitrary values, to interpret as they please.
+wxconfig_input_options="prefix exec_prefix utility $wxconfig_schema"
+
+# Input options that accept only a yes or no argument.
+#
+# Notice that this includes "debug" but it is done only for compatibility, this
+# options (i.e. --debug[=yes] or --debug=no) is completely ignored as there is
+# no distinction between debug and release builds in wx any more
+wxconfig_yesno_options="universal unicode debug static"
+
+# Boolean options that do something or not.
+wxconfig_flag_options="$wxconfig_yesno_options selected_config no_rpath inplace"
+
+
+
+# Some simple sugar coating to keep things more readable below.
+# --------------------------------------------------------------
+
+# option_name _string
+# Returns NAME if _string is of the form: --NAME[=...]
+option_name()
+{
+ echo "$1" | sed -e 's/^--//' -e 's/=.*//' -e s/-/_/g
+}
+
+# option_value _string
+# Returns FOO if _string is of the form: --option=FOO
+option_value()
+{
+ echo "$1" | sed 's/^[^=]*=//'
+}
+
+# match_field _value _list
+# Returns true if _value is a field in _list
+match_field()
+{
+ _match_field_match="$1"
+ shift
+ for _match_field_i do
+ [ "x$_match_field_i" != "x$_match_field_match" ] || return 0
+ done
+ false
+}
+
+# remove_field _value _list
+# Returns _list minus any field(s) that match _value.
+remove_field()
+{
+ _remf_value="$1"
+ _remf_list=''
+ shift
+ if [ -n "$_remf_value" ]; then
+ for _remf_item do
+ [ "x$_remf_item" = "x$_remf_value" ] ||
+ _remf_list="${_remf_list:+$_remf_list }$_remf_item"
+ done
+ echo "$_remf_list"
+ else
+ echo $*
+ fi
+}
+
+# validate_arg _domain _set _name _value
+# Boilerplate to validate an argument and initialise a pseudo-hash.
+# This one is almost reduction into absurdity, and perhaps makes the
+# precise action of the argument parser below just a little more
+# obscure, but oh so neat and compact to use for multiple option
+# groups. It expands to replace repetitive clauses of the form:
+#
+# i="$(option_name $arg)"
+# if match_field "$i" $wxconfig_input_options; then
+# input_options="${input_options:+$input_options }$i"
+# eval "input_option_$i=$(option_value $arg)"
+# continue
+# fi
+#
+# with the one liners you see on the page below.
+validate_arg()
+{
+ if match_field "$3" `eval echo \"\\\$$1_$2_options\"`; then
+ eval "$2_options=\"\${$2_options:+\$$2_options }$3\""
+ eval "$2_option_$3=\"$4\""
+ return
+ fi
+ false
+}
+
+# check_yesno_option _ynoption _option _yesval _noval
+# This one might be made more generic and/or incorporated into
+# validate_arg above at some later stage, but right now we just
+# condition any specialist options into a generic one for later
+# handling. Once they are sanity checked there is no difference
+# in any case.
+check_yesno_option()
+{
+ eval "case \${yesno_option_$1-\${flag_option_$1-unset}} in
+ unset) ;;
+ y*|Y*) input_option_$2=\"$3\" ;;
+ n*|N*) input_option_$2=\"$4\" ;;
+ *)
+ decho
+ decho \" *** Error: Invalid request '--$1=\$yesno_option_$1'\"
+ decho \" Valid arguments for --$1 are: [ yes, no ]\"
+ decho
+ exit 1
+ ;;
+ esac"
+}
+
+
+MAC_FRAMEWORK=
+MAC_FRAMEWORK_PREFIX=
+
+
+# Now we are ready to find out what the user wants from us.
+# --------------------------------------------------------------
+
+# With just a little more complexity here we could have shortest
+# unique string matching for options, but that is probably overkill
+# today, so let's just get the job done.
+#
+# The important thing now then is that we simply read all input from
+# the user and don't try to act prematurely on partial information.
+# --help or an illegal argument are the only shortcuts out of here
+# at this point, otherwise, it's time to just shut up and listen for
+# a moment.
+
+for arg do
+ case "$arg" in
+ --help|-h)
+ usage
+ ;;
+
+ --*=*)
+ _name=`option_name $arg`
+ _value=`option_value $arg`
+ if validate_arg wxconfig input "$_name" "$_value" ||
+ validate_arg wxconfig yesno "$_name" "$_value"
+ then
+ continue
+ fi
+ ;;
+
+ --query-*)
+ _name=`echo $arg | sed 's/^--query-//'`
+ if match_field "$_name" $wxconfig_schema
+ then
+ query_options="${query_options:+$query_options }$_name"
+ continue
+ fi
+ ;;
+
+ --*)
+ _name=`option_name $arg`
+ if validate_arg wxconfig flag "$_name" yes ||
+ validate_arg wxconfig output "$_name" yes
+ then
+ continue
+ fi
+ ;;
+
+ *)
+ # We validate the parameters later ...
+
+ if [ "$_name" = "cxxflags" ] || [ "$_name" = "cppflags" ] || [ "$_name" = "cflags" ]; then
+ cxx_parameters="${cxx_parameters:+$cxx_parameters }$arg"
+ elif [ "$_name" = "libs" ]; then
+ libs_parameters="${libs_parameters:+$libs_parameters }$arg"
+ elif [ "$_name" = "optional_libs" ]; then
+ optional_libs_parameters="${optional_libs_parameters:+$optional_libs_parameters }$arg"
+ else
+ # normally anything here are unattached arguments and signify an
+ # error but for compatibility with the 2.8 wx-config and,
+ # especially, configure scripts generated using 2.8 wxwin.m4 and
+ # hence doing `wx-config --version base,std`, we ignore anything
+ # following this option, just as 2.8 version used to do
+ if [ "$_name" != "version" ]; then
+ input_parameters="${input_parameters:+$input_parameters }$arg"
+ fi
+ fi
+ continue
+ ;;
+ esac
+ decho " *** Error: Unrecognised option: '$arg'"
+ decho "Use wx-config --help for information on command line options."
+ exit 2
+done
+
+# validate_arg only checks and decomposes form. Sanity check the yes/no
+# options now too and push their respective mask values into place.
+
+check_yesno_option universal widgetset univ
+check_yesno_option unicode chartype unicode ansi
+check_yesno_option static linkage static
+check_yesno_option debug debugtype debug release
+
+# Dump everything we just read in debug mode.
+if [ -n "$WXDEBUG" ]; then
+
+ decho
+ decho " input parameters = $input_parameters"
+ decho " libs parameters = $libs_parameters"
+ decho " optional-libs parameters = $optional_libs_parameters"
+ decho " input options = $input_options"
+ for i in $input_options; do
+ decho " $i = `eval echo \"\\\$input_option_$i\"`"
+ done
+ decho " yes/no options = $yesno_options"
+ for y in $yesno_options; do
+ decho " $y = `eval echo \"\\\$yesno_option_$y\"`"
+ done
+ decho " flag options = $flag_options"
+ for f in $flag_options; do
+ decho " $f = `eval echo \"\\\$flag_option_$f\"`"
+ done
+ decho " output options = $output_options"
+ for o in $output_options; do
+ decho " $o = `eval echo \"\\\$output_option_$o\"`"
+ done
+ decho " query options = $query_options"
+
+fi
+
+
+
+# Everything came in as a legal argument then, let's put some of
+# the pieces together with a little self knowledge to see what
+# we should do next.
+# --------------------------------------------------------------
+
+# get_mask [ _hash ]
+# Construct a config filename mask from a pseudo-hash of component variables.
+# The optional argument is the prefix of the hash to use. If not specified
+# this will return a mask derived from the command line options that were used.
+get_mask()
+{
+ [ $# -gt 0 ] || set m
+
+ case "$m_ourversion" in
+ 2.9)
+ is29orlater=1
+ ;;
+ 2.*)
+ # there is no 2.10 so currently everything else is <= 2.8
+ is29orlater=0
+ ;;
+ *)
+ # 3.x and later "is29orlater" too
+ is29orlater=1
+ ;;
+ esac
+
+ # use 2.8 or 2.9 version of the mask: the difference is the presence of
+ # debug type in pre-2.9
+ if [ $is29orlater = 1 ]; then
+ eval echo "\${$1_host:+\$$1_host-}\${$1_toolkit}\${$1_widgetset}-\${$1_chartype}\${$1_linkage:+-\$$1_linkage}-\${$1_version}\${$1_flavour}"
+ else
+ eval echo "\${$1_host:+\$$1_host-}\${$1_toolkit}\${$1_widgetset}-\${$1_chartype}-\${$1_debugtype}\${$1_linkage:+-\$$1_linkage}-\${$1_version}\${$1_flavour}"
+ fi
+}
+
+# Returns true if this script is for a cross compiled config.
+is_cross() { [ "xno" = "xyes" ]; }
+
+
+# Determine the base directories we require.
+prefix=${input_option_prefix-${this_prefix:-/home/build/tmp/build/external/dist}}
+exec_prefix=${input_option_exec_prefix-${input_option_prefix-${this_exec_prefix:-${prefix}}}}
+wxconfdir="${exec_prefix}/lib/wx/config"
+
+installed_configs=`cd "$wxconfdir" 2> /dev/null && ls | grep -v "^inplace-"`
+
+is_cross && target=""
+
+# Define a pseudo-hash to contain the specification of this wx-config
+# instance and its associated library.
+this_host="${target:+${target}}"
+this_toolkit="gtk2"
+this_widgetset=""
+this_chartype="unicode"
+this_debugtype="release"
+this_flavour=""
+this_version="3.0"
+this_linkage=`[ "x0" = "x1" ] || echo 'static'`
+
+
+# Extract the user specification from the options parsed.
+m_host=${input_option_host:+"${input_option_host}-?"}
+m_host=${m_host:-$this_host}
+m_toolkit=${input_option_toolkit:-'[^-]+'}
+m_widgetset=${input_option_widgetset-'(univ)?'}
+m_chartype=${input_option_chartype:-'(unicode|ansi)'}
+m_debugtype=${input_option_debugtype:-'(debug|release)'}
+m_flavour=${input_option_flavour:+-$input_option_flavour}
+m_flavour=${m_flavour:-${input_option_flavour-'(-[^-]+)?'}}
+m_version=${input_option_version:-'[0-9]+\.[0-9]+'}
+m_linkage=${input_option_linkage-'?(static)?'}
+
+# Test whether or not --version has been specified
+#
+# This must be done after getting the input options so get_mask works correctly
+# since it is version-dependent
+
+if [ -z "$input_option_version" ]; then
+ m_ourversion="2.9"
+else
+ m_ourversion=$m_version
+fi
+
+this_config=`get_mask this`
+
+configmask="^`get_mask`$"
+
+
+# Dump the user specification in debug mode.
+if [ -n "$WXDEBUG" ]; then
+
+ decho
+ decho " prefix = '$prefix'"
+ decho " exec_prefix = '$exec_prefix'"
+ decho " wxconfdir = '$wxconfdir'"
+
+ decho " m_host = '$m_host'"
+ decho " m_toolkit = '$m_toolkit'"
+ decho " m_widgetset = '$m_widgetset'"
+ decho " m_chartype = '$m_chartype'"
+ decho " m_debugtype = '$m_debugtype'"
+ decho " m_flavour = '$m_flavour'"
+ decho " m_version = '$m_version'"
+ decho " m_linkage = '$m_linkage'"
+
+ decho " configmask = '$configmask'"
+ decho " this config = '$this_config'"
+ decho
+
+fi
+
+
+
+# From here on, we'll need to be able to figure out a delegation target.
+# -----------------------------------------------------------------------
+
+# The rules for delegation are:
+#
+# 1. If the specification is so general that it matches the default config
+# (ie. this one on a first pass), then the default config will be used
+# even if other installed libs would also match the spec.
+#
+# 2. If the default config does not match, find a list of all installed
+# libraries that do match.
+# a. If that list is empty, the specification is incompatible
+# with any installed lib. Warn and abort.
+# b. If that list contains exactly one candidate. Delegate to
+# that candidate.
+# c. If the list contains multiple candidates, pass on to step 3.
+#
+# 3. Attempt to discriminate among rival candidates by their similarity
+# to the default configuration (ie. this one). If we can find a unique
+# candidate in this way, delegate to it. If not, present a list of
+# options to the user and request that they disambiguate it with one or
+# more additional fields.
+#
+# To refine the specified pattern, we specialise each unbound field
+# using the default value from this config file. If that results in
+# no matches, we unbind it again and try the next field. If it still
+# results in multiple matches we try binding the next field as well
+# until a unique or null result again occurs.
+#
+# A more general way to look at this, is the feature specifiers are all
+# modifiers of the wx-config you are calling. If you supply none, the
+# default for that build configuration will be used. If you supply one
+# or more that the default build cannot satisfy, it will try to find the
+# config most like itself with the desired feature(s) enabled.
+# The features configured into the first wx-config called will be taken
+# as implicitly specified if it is necessary to disambiguate likely
+# candidates from the information that was explicitly provided.
+
+
+# But first, more sugar to keep what follows clear and legible.
+# --------------------------------------------------------------
+
+# find_eligible_delegates _mask
+# Outputs all the config files installed which match the
+# (extended regex) _mask passed as an argument.
+find_eligible_delegates() { echo "$installed_configs" | $EGREP "$1" 2> /dev/null; }
+
+# user_mask_fits _config
+# Returns true if the string _config satisfies the user specified mask.
+user_mask_fits() { echo "$1" | $EGREP "$configmask" > /dev/null 2>&1; }
+
+# count_fields _word
+# Returns the number of IFS split fields in _word
+count_fields() { return $#; }
+
+# count_delegates _mask
+# Return the number of eligible config files that match _mask
+count_delegates() { count_fields `find_eligible_delegates $1`; }
+
+# is_set _variablename
+# Returns true if $_variablename is initialised.
+is_set() { [ "x`eval echo \"\\\${$1-unset}\"`" != "xunset" ]; }
+
+# not _cmd _args...
+# true iff _cmd is false
+not() { if "$@"; then false; else true; fi; }
+
+# do_find_best_delegate _unbound-options
+# The real worker part of find_best_delegate below. Recurses though all
+# unbound options binding them one at a time to the default derived from
+# this file until a unique match is made or no alternatives remain that
+# may be sensibly guessed at. It will preferentially bind the unspecified
+# options in the order they are listed in wxconfig_schema. Using this
+# partial ordering it should find the first match with the most significant
+# similarity to this file that unambiguously meets the user specification.
+# If such a match exists it will be output to stdout.
+#
+# Be careful if you modify this function. If the pruning logic is rendered
+# inoperative it will simply recurse over every permutation in the search
+# space, which may still appear to work, but add a couple more options (or
+# explicitly specify a few less) and you may not live long enough to learn
+# the result. WXDEBUG=findprogress is your friend here, it will show you
+# how many nodes get searched before a result. If you start seeing
+# increases in that number for the same input, check your work.
+# Raising the number of discriminating options from 6 to 8 raised the worst
+# case time for this to run (without pruning) from 3 to nearly 15 seconds
+# and its downhill fast from here if we have to ride that boat.
+# Early pruning still gets that down to under half a second (up from about
+# .25), so we have some breathing space yet before a different search method
+# will be called for, but let's not squander it.
+do_find_best_delegate()
+{
+ (
+ if [ "x$WXDEBUG" = "xverbose" ]; then
+ _fbd_indent="${_fbd_indent}. "
+ decho " $_fbd_indent---> unbound options: $*"
+ fi
+
+ for i do
+
+ if [ "x$WXDEBUG" = "xverbose" ]; then
+ decho " ${_fbd_indent}binding '$i' with '`remove_field $i $*`' still free"
+ [ -z "$_pruned" ] || decho " ${_fbd_indent} --- pruned: $_pruned ---"
+ fi
+
+ if (
+ eval m_$i=\$this_$i
+ _mask="^`get_mask`$"
+
+ if [ "x$WXDEBUG" = "xverbose" ]; then
+ decho " ${_fbd_indent} checking: $_mask"
+ count_delegates "$_mask"
+ decho " $_fbd_indent $? eligible delegates"
+ for d in `find_eligible_delegates "$_mask"`; do
+ decho " ${_fbd_indent} $d"
+ done
+ fi
+
+ count_delegates "$_mask"
+ _still_eligible=$?
+
+ if [ $_still_eligible -eq 1 ]; then
+ echo `find_eligible_delegates "$_mask"`
+ return
+ fi
+
+ [ "x$WXDEBUG" != "xfindprogress" ] || printf "." 1>&2
+
+ [ $_still_eligible -gt 1 ] && [ $# -gt 1 ] &&
+ do_find_best_delegate `remove_field $i $*`
+ )
+ then
+
+ return
+
+ elif [ $# -gt 1 ]; then
+
+ if [ "x$WXDEBUG" = "xverbose" ]; then
+ decho " ${_fbd_indent}pruning: $i"
+ _pruned="${_pruned:+$_pruned }$i"
+ fi
+ set `remove_field $i $*`
+
+ fi
+
+ done
+ false
+ )
+}
+
+# find_best_delegate
+# A simple wrapper around do_find_best_delegate that first determines
+# the unbound options (ie. the ones that the user did not explicitly
+# declare a preference for on the command line)
+find_best_delegate()
+{
+ for _fbdi in $wxconfig_schema; do
+ is_set input_option_$_fbdi ||
+ _unbound_options="${_unbound_options:+$_unbound_options }$_fbdi"
+ done
+ do_find_best_delegate $_unbound_options
+}
+
+
+# Legacy wx-config helpers.
+# -------------------------
+
+# get_legacy_mask
+# Returns a mask in the format used by wx2.4.
+get_legacy_mask()
+{
+ [ $# -gt 0 ] || set m
+ eval [ "x\${$1_chartype}" != "xunicode" ] || _unicode_flag=u
+ eval echo "wx\${$1_toolkit}${_unicode_flag}-\${$1_version}\${$1_host}-config"
+}
+
+# find_legacy_configs
+# Returns a list of configs installed by wx2.4 releases.
+find_legacy_configs()
+{
+ (
+ cd "$prefix/bin" &&
+ {
+ ls wx*-2.4-config | grep -v ^wxbase
+ ls wx*-2.4-config | grep ^wxbase
+ }
+ ) 2> /dev/null
+}
+
+# find_best_legacy_config
+# Returns the best legacy config for a given specification.
+# This assumes no matching new style config has been found.
+find_best_legacy_config()
+{
+ _legacy_configs=`find_legacy_configs`
+ if [ -n "$_legacy_configs" ]; then
+ _legacy_mask=`get_legacy_mask`
+ for d in $_legacy_configs; do
+ if echo $d | $EGREP $_legacy_mask > /dev/null 2>&1 ; then
+ echo "$d"
+ return
+ fi
+ done
+ fi
+ false
+}
+
+
+
+# The only action we can perform authoritatively prior to delegation
+# is to list all the possible delegates.
+# --------------------------------------------------------------
+
+config_spec="$0 $*"
+[ -z "$WXDEBUG" ] || config_spec=$configmask
+
+# Next chance for another satisfied customer then
+#
+# If we want to get really polished here we can do plural checking,
+# but we should probably leave that until the day we gettextise it.
+if [ -n "$output_option_list" ]; then
+
+ _remains_in_prefix=$installed_configs
+ _delegates=`find_eligible_delegates $configmask`
+ _best_delegate=`find_best_delegate`
+
+ if [ "x$WXDEBUG" = "xverbose" ]; then
+ decho
+ decho " all = $_remains_in_prefix"
+ decho " matching = $_delegates"
+ decho " best = $_best_delegate"
+ decho " this = $this_config"
+ fi
+
+ for d in $_delegates; do
+ _remains_in_prefix=`remove_field $d $_remains_in_prefix`
+ done
+
+ echo
+ echo " Default config is $this_config"
+ echo
+
+ if user_mask_fits "$this_config" ; then
+
+ echo " Default config ${this_exec_prefix+in $this_exec_prefix }will be used for output"
+
+ if match_field "$this_config" $_delegates ; then
+ _delegates=`remove_field $this_config $_delegates`
+ else
+ echo " though it is not installed in: $prefix"
+ if [ -n "$_best_delegate" ] && [ "x$_best_delegate" != "x$this_config" ]; then
+ echo
+ echo " Best alternate in $prefix:"
+ echo " $_best_delegate"
+ fi
+ fi
+
+ elif [ -n "$_best_delegate" ]; then
+
+ echo " Specification best match: $_best_delegate"
+
+ elif [ -z "$_delegates" ]; then
+
+ _last_chance=`find_best_legacy_config`
+ if [ -n "$_last_chance" ]; then
+
+ echo " Specification matches legacy config: $_last_chance"
+
+ else
+
+ cat <<-EOF
+ No config found to match: $config_spec
+ in $wxconfdir
+
+ Please install the desired library build, or specify a different
+ prefix where it may be found. If the library is not installed
+ you may call its wx-config directly by specifying its full path.
+
+EOF
+
+ fi
+
+ else
+ echo " Specification was ambiguous. Use additional feature options"
+ echo " to choose between alternate matches."
+ fi
+
+ _delegates=`remove_field "$_best_delegate" $_delegates`
+
+ if [ -n "$_delegates" ]; then
+ echo
+ echo " Alternate matches:"
+ for d in $_delegates; do
+ echo " $d"
+ done
+ fi
+ if [ -n "$_remains_in_prefix" ]; then
+ echo
+ echo " Also available in $prefix:"
+ for d in $_remains_in_prefix; do
+ echo " $d"
+ done
+ fi
+
+ _legacy_configs=`find_legacy_configs`
+ if [ -n "$_legacy_configs" ]; then
+ echo
+ echo " Legacy configs available in $prefix:"
+ for d in $_legacy_configs; do
+ echo " $d" | sed 's/-config$//'
+ done
+ fi
+
+ echo
+ exit
+fi
+
+
+
+# ... so if that wasn't what they wanted, then we need to know for
+# certain, can this config satisfy the user specification?
+# --------------------------------------------------------------
+
+if not user_mask_fits "$this_config" ; then
+
+ # No? Then let's see if it knows anybody who can.
+ # But first, just be sure someone hasn't typo'd us into a loop.
+ # In present day wx, correct delegation should never need more
+ # than one hop so this is trivial to detect.
+
+ if [ -n "$WXCONFIG_DELEGATED" ]; then
+ decho
+ decho " *** Error: Bad config delegation"
+ decho
+ decho " to: $0"
+ decho " ($this_config) cannot satisfy:"
+ decho " $config_spec"
+ decho " Someone has been terribly careless."
+ decho
+ exit 1
+ fi
+
+ count_delegates "$configmask"
+ _numdelegates=$?
+
+ if [ -n "$WXDEBUG" ]; then
+ decho " must delegate to an alternate config"
+ decho " potential delegates ($_numdelegates):"
+ for i in `find_eligible_delegates "$configmask"`; do
+ decho " $i"
+ done
+ fi
+
+ if [ $_numdelegates -eq 0 ]; then
+
+ _last_chance=`find_best_legacy_config`
+ if [ -n "$_last_chance" ]; then
+
+ for arg do
+ case "$arg" in
+ --prefix*|--exec-prefix*| \
+ --version|--release|--basename| \
+ --static|--libs|--gl_libs| \
+ --cppflags|--cflags|--cxxflags| \
+ --cc|--cxx|--ld| \
+ --rezflags|--inplace)
+ _legacy_args="$_legacy_args $arg"
+ ;;
+
+ --static|--static=y*|--static=Y*)
+ _legacy_args="$_legacy_args --static"
+ ;;
+ esac
+ done
+
+ if [ -n "$WXDEBUG" ]; then
+ decho " found a suitable legacy delegate: $_last_chance"
+ decho "--> $prefix/bin/$_last_chance $_legacy_args"
+ fi
+
+ WXCONFIG_DELEGATED=yes
+ export WXCONFIG_DELEGATED
+ $prefix/bin/$_last_chance $_legacy_args
+ exit
+
+ else
+
+ cat 1>&2 <<-EOF
+
+ Warning: No config found to match: $config_spec
+ in $wxconfdir
+ If you require this configuration, please install the desired
+ library build. If this is part of an automated configuration
+ test and no other errors occur, you may safely ignore it.
+ You may use wx-config --list to see all configs available in
+ the default prefix.
+
+EOF
+
+ # PIPEDREAM: from here we are actually just a teensy step
+ # from simply building the missing config for the user
+ # on the fly if this is an in tree wx-config.
+
+ exit 1
+ fi
+ fi
+
+ if [ $_numdelegates -gt 1 ]; then
+
+ [ -z "$WXDEBUG" ] || decho " must prune the list of eligible delegates"
+
+ best_delegate=`find_best_delegate`
+
+ if [ -n "$best_delegate" ]; then
+
+ if [ -n "$WXDEBUG" ]; then
+ decho " found a suitable delegate: $best_delegate"
+ decho "--> $wxconfdir/$best_delegate $*"
+ fi
+
+ WXCONFIG_DELEGATED=yes
+ export WXCONFIG_DELEGATED
+ $wxconfdir/$best_delegate $*
+ exit
+ fi
+
+ decho
+ decho " *** Error: Specification is ambiguous"
+ decho " as $config_spec"
+ decho " Use additional feature options to choose between:"
+ for i in `find_eligible_delegates "$configmask"`; do
+ decho " $i"
+ done
+ decho
+
+ exit 1
+ fi
+
+ if [ -n "$WXDEBUG" ]; then
+ decho " using the only suitable delegate"
+ decho "--> $wxconfdir/`find_eligible_delegates $configmask` $*"
+ fi
+
+ WXCONFIG_DELEGATED=yes
+ export WXCONFIG_DELEGATED
+ $wxconfdir/`find_eligible_delegates $configmask` $*
+ exit
+fi
+
+
+
+# If we are still here, then from now on we are responsible for
+# all the user's needs. Time to rustle up some output for them.
+# --------------------------------------------------------------
+
+[ -z "$WXDEBUG" ] || decho " using this config"
+
+# If the user supplied a prefix, and the in tree config did not
+# delegate out to anything in that prefix, then reset the build
+# tree prefix to provide the correct output for using this
+# uninstalled wx build. Or put more simply:
+prefix=${this_prefix-$prefix}
+exec_prefix=${this_exec_prefix-$exec_prefix}
+
+includedir="${prefix}/include"
+libdir="${exec_prefix}/lib"
+bindir="${exec_prefix}/bin"
+
+# Trivial queries we can answer now.
+[ -z "$output_option_prefix" ] || echo $prefix
+[ -z "$output_option_exec_prefix" ] || echo $exec_prefix
+[ -z "$output_option_release" ] || echo "3.0"
+[ -z "$output_option_version" ] || echo "3.0.0"
+[ -z "$output_option_version_full" ] || echo "3.0.0.0"
+[ -z "$output_option_basename" ] || echo "wx_gtk2u"
+[ -z "$output_option_cc" ] || echo "gcc"
+[ -z "$output_option_cxx" ] || echo "g++"
+[ -z "$output_option_ld" ] || echo "g++ -o"
+[ -z "$flag_option_selected_config" ] || echo "$this_config"
+
+for q in $query_options; do
+ eval echo "\$this_$q"
+done
+
+# --rezflags is deprecated and disabled (2005/11/29)
+if [ -n "$output_option_rezflags" ]; then
+ echo "@true"
+ decho "Warning: --rezflags, along with Mac OS classic resource building" \
+ "is deprecated. You should remove this from your Makefile and" \
+ "build .app bundles instead."
+fi
+
+
+# The rest are going to need a little more work.
+# --------------------------------------------------------------
+
+is_monolithic() { [ "x0" = "x1" ]; }
+is_static() { [ -n "$this_linkage" ]; }
+is_installed() { [ -z "$this_prefix" ]; }
+
+
+# Is the user after a support utility?
+# If this is a cross build, we need to find and return a suitable
+# native utility for the job, so we search:
+#
+# 1. local build dir (for native uninstalled builds only).
+# 2. (optional) user supplied prefix.
+# 3. configured install prefix.
+# 4. environment $PATH.
+#
+# and if such a thing still cannot be found, exit signalling an error.
+if [ -n "$input_option_utility" ]; then
+
+ # This is dumb, in tree binaries should be in a standard location
+ # like the libs, but work with what we've got for now.
+ is_cross || _util="$exec_prefix/utils/$input_option_utility/$input_option_utility"
+
+ if not is_installed && [ -x "$_util" ]; then
+ is_static || _preload="eval LD_LIBRARY_PATH=$exec_prefix/lib"
+ echo $_preload $_util
+ exit
+ fi
+
+ IFS=':'
+ _user_prefix=${input_option_exec_prefix:-$input_option_prefix}
+
+ for _util in "${input_option_utility}-3.0" \
+ "${input_option_utility}-3.0" \
+ "${input_option_utility}"
+ do
+ for p in ${_user_prefix:+$_user_prefix/bin} $bindir $PATH; do
+
+ [ -z "$WXDEBUG" ] || decho " checking for: '$p/$_util'"
+
+ if [ -x "$p/$_util" ]; then
+ echo "$p/$_util"
+ exit
+ fi
+
+ done
+ done
+ exit 1
+
+fi
+
+
+# Still here? Then get the options together for building an app.
+# ----------------------------------------------------------------
+
+# Additional configuration for individual library components.
+ldflags_gl=""
+
+ldlibs_base="-lwxregexu-3.0 -lz -ldl -lm"
+ldlibs_core="-lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lfontconfig -lfreetype -lgthread-2.0 -pthread -lglib-2.0 -lX11 -lXxf86vm -lSM -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lnotify -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lwebkitgtk-1.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lpangoft2-1.0 -lpango-1.0 -lfontconfig -lfreetype -lsoup-2.4 -lgio-2.0 -lgobject-2.0 -ljavascriptcoregtk-1.0 -lglib-2.0 -lpng -lz -ljpeg -ltiff"
+ldlibs_gl="-lGL -lGLU"
+ldlibs_html=""
+ldlibs_xml=" -lexpat"
+ldlibs_adv=""
+ldlibs_stc="-lwxscintilla-3.0"
+
+
+# Order the libraries passed to us correctly for static linking.
+#
+# While the libraries order doesn't matter when linking dynamically, we must
+# put the libraries depending on other libraries in front of their dependencies
+# when linking statically or the dependencies wouldn't be resolved by the
+# standard UNIX linkers.
+order_libs()
+{
+ if is_static; then
+ for lib do
+ # Distinguish between the libraries that may need to be moved to
+ # the end of the list (because other ones may depend on them) and
+ # those that can be output immediately because no other libraries
+ # depend on them.
+ case "$lib" in
+ base|core|html|xml|adv) eval "use_$lib=1" ;;
+ *) libs="$libs $lib" ;;
+ esac
+ done
+
+ # Add the libraries that we postponed adding above.
+ # Order of the checks here is important.
+ [ -z "$use_html" ] || libs="$libs html"
+ [ -z "$use_adv" ] || libs="$libs adv"
+ [ -z "$use_core" ] || libs="$libs core"
+ [ -z "$use_xml" ] || libs="$libs xml"
+ [ -z "$use_base" ] || libs="$libs base"
+ else
+ # No need to order them.
+ libs="$@"
+ fi
+
+ echo $libs
+}
+
+# lib_flags_for _liblist
+# This function returns a list of flags suitable to return with the
+# output of --libs for all of the libraries in _liblist. You can
+# add support for a new library by adding an entry for it in the
+# psuedo-hashes above if it requires additional linker options.
+lib_flags_for()
+{
+ [ -z "$WXDEBUG" ] || decho " fetching lib flags for: '$*'"
+
+ _all_ldflags=''
+ _all_libs=''
+ _wxlibs=''
+
+ is_cross && _target="-${target}"
+
+ for lib do
+
+ # We evidently can't trust people not to duplicate things in
+ # configure, or to keep them in any sort of sane order overall,
+ # so only add unique new fields here even if it takes us a while.
+ # In the case of libs, we bubble any duplicates to the end,
+ # because if multiple libs require it, static linking at least
+ # will require it to come after all of them. So long as local
+ # order is ok in configure then we should always be able to
+ # massage a correct result here like this.
+ #
+ # FIXME: ldlibs_core is totally bogus. Fix the duplication
+ # there independently of this. This covers for it, but we
+ # want to do this anyway because some libs may share common
+ # deps without a common ancestor in wx. This is not a licence
+ # for sloppy work elsewhere though and @GUI_TK_LIBRARY should
+ # be fixed.
+
+ for f in `eval echo \"\\\$ldflags_$lib\"`; do
+ match_field "$f" $_all_ldflags || _all_ldflags="$_all_ldflags $f"
+ done
+
+ if match_field "$lib" xml net base ; then
+ _libname="wx_baseu"
+ else
+ _libname="wx_gtk2u"
+ fi
+ [ $lib = base ] || _libname="${_libname}_$lib"
+ _libname="${_libname}-3.0$_target"
+
+ if is_static; then
+ _wxlibs="$_wxlibs ${libdir}/lib${_libname}.a"
+ for f in `eval echo \"\\\$ldlibs_$lib\"`; do
+
+ # Only propagate duplicate -libraries to their latest
+ # possible position. Do not eliminate any other
+ # duplicates that might occur. They should be fixed
+ # in configure long before they get here.
+ # This started as a workaround for Mac -framework,
+ # but it seems like a better policy in general, which
+ # will let the more heinous bugs in configure shake out.
+ # We should maybe filter *.a here too, but not unless
+ # we have to.
+ case "$f" in
+ -l*) _all_libs="`remove_field $f $_all_libs` $f" ;;
+ *) _all_libs="$_all_libs $f" ;;
+ esac
+
+ done
+ else
+ _wxlibs="$_wxlibs -l${_libname}"
+ fi
+
+ done
+
+ if [ -n "$WXDEBUG" ]; then
+ decho " retrieved: ldflags = $_all_ldflags"
+ decho " wxlibs = $_wxlibs"
+ decho " alllibs = $_all_libs"
+ fi
+
+ echo $_all_ldflags $_wxlibs $_all_libs
+}
+
+# this is the strict subset of the above function which returns only the
+# (static) libraries themselves: this is used for linkdeps output which should
+# output the list of libraries the main program should depend on
+#
+# of course, this duplication is bad but I'll leave to somebody else the care
+# of refactoring this as I don't see any way to do it - VZ.
+
+# This (and the other cruft to support it) should be removed with
+# reference to the FIXME above when configure stops piping us a slurry
+# of options that need to be decomposed again for most practical uses - RL.
+link_deps_for()
+{
+ _wxlibs=''
+
+ is_cross && _target="-${target}"
+
+ for lib do
+ if match_field "$lib" xml net base ; then
+ _libname="wx_baseu"
+ else
+ _libname="wx_gtk2u"
+ fi
+ [ $lib = base ] || _libname="${_libname}_$lib"
+ _libname="${_libname}-3.0$_target"
+
+ _wxlibs="$_wxlibs ${libdir}/lib${_libname}.a"
+ done
+
+ echo $_wxlibs
+}
+
+# Sanity check the list of libs the user provided us, if any.
+# --------------------------------------------------------------
+
+wx_libs=`echo "$libs_parameters" | tr ',' ' '`
+wx_optional_libs=`echo "$optional_libs_parameters" | tr ',' ' '`
+
+# Add the --optional-libs, if they've been compiled and aren't already added
+for i in $wx_optional_libs; do
+ if match_field $i xrc webview stc richtext ribbon propgrid aui gl html qa adv core xml net base; then
+ if not match_field $i $wx_libs; then
+ wx_libs="${wx_libs:+$wx_libs }$i"
+ fi
+ fi
+done
+
+[ -z "$WXDEBUG" ] || decho " user supplied libs: '$wx_libs'"
+
+# Assume we are using the GUI, unless --libs was specified with no GUI libs
+using_gui=yes
+
+if is_monolithic; then
+
+ # Only add additional info if --libs was specified and not just --optional-libs
+ if [ -n "$output_option_libs" ]; then
+ # Core libs are already built into the blob.
+ for i in std xrc webview html qa adv core xml net base; do
+ wx_libs=`remove_field $i $wx_libs`
+ done
+
+ wx_libs=`order_libs $wx_libs`
+ wx_libs=" `lib_flags_for $wx_libs`"
+
+ # We still need the core lib deps for a static build though
+ if is_static; then
+ link_deps="${libdir}/libwx_gtk2u-3.0.a"
+ wx_libs="$wx_libs $link_deps $ldlibs_core $ldlibs_base"
+ else
+ wx_libs="$wx_libs -lwx_gtk2u-3.0"
+ fi
+ fi
+else # MONOLITHIC = 0
+
+ # Import core libs by default, expand std if specified, or add base if omitted.
+ if [ -n "$output_option_libs" ] && [ -z "$libs_parameters" ]; then
+ wx_libs="xrc webview html qa adv core xml net base"
+ elif match_field all $wx_libs; then
+ wx_libs="xrc webview stc richtext ribbon propgrid aui gl html qa adv core xml net base"
+ elif match_field std $wx_libs; then
+ # Bubble any libs that were already specified to the end
+ # of the list and ensure static linking order is retained.
+ wx_libs=`remove_field std $wx_libs`
+ for i in xrc webview html qa adv core xml net base; do
+ wx_libs="`remove_field $i $wx_libs` $i"
+ done
+ elif not match_field base $wx_libs ; then
+ # Only add base if --libs was specified and not just --optional-libs
+ if [ -n "$output_option_libs" ]; then
+ wx_libs="$wx_libs base"
+ fi
+ fi
+
+ if [ -n "$output_option_libs" ]; then
+ using_gui=no
+ for i in $wx_libs ; do
+ if match_field "$i" xrc webview html qa adv core; then
+ _guildflags=""
+ using_gui=yes
+ break
+ fi
+ match_field "$i" xml net base || using_gui=yes
+ done
+ fi
+
+ if is_static; then
+ link_deps=`link_deps_for $wx_libs`
+ fi
+ wx_libs=`order_libs $wx_libs`
+ wx_libs="$_guildflags `lib_flags_for $wx_libs`"
+fi
+
+
+# If they explicitly set "--cxx(pp)flags base" then they don't want the GUI
+if [ "$cxx_parameters" = "base" ]; then
+ using_gui=no
+fi
+
+
+if [ -n "$WXDEBUG" ]; then
+ decho
+ decho " using libs: '$wx_libs'"
+ decho " using_gui = $using_gui"
+ decho
+fi
+
+
+# Endgame. Nothing left to discover now.
+# --------------------------------------------------------------
+
+[ "$using_gui" = "yes" ] || _gui_cppflags="-DwxUSE_GUI=0"
+
+if is_installed; then
+ _include_cppflags="-I${includedir}/wx-3.0"
+else
+ _include_cppflags="-I${includedir}"
+fi
+
+_cppflags=`echo "-I${libdir}/wx/include/gtk2-unicode-static-3.0" $_include_cppflags "-D_FILE_OFFSET_BITS=64 -D__WXGTK__" $_gui_cppflags`
+
+# now without further ado, we can answer these too.
+[ -z "$output_option_cppflags" ] || echo $_cppflags
+[ -z "$output_option_cflags" ] || echo $_cppflags "-pthread"
+[ -z "$output_option_cxxflags" ] || echo $_cppflags "-pthread"
+[ -z "$output_option_gl_libs" ] || echo `lib_flags_for gl`
+[ -z "$output_option_linkdeps" ] || echo $link_deps
+
+if [ -n "$output_option_libs" ]; then
+ # if --libs [--optional-libs] then output the full linker information
+
+ is_cross &&
+ [ "x$libdir" = "x/usr/${target}/lib" ] ||
+ [ "x$libdir" = "x/usr/lib" ] ||
+ _ldflags="-L$libdir"
+
+ if [ -n "$MAC_FRAMEWORK" ]; then
+ wx_libs="-framework $MAC_FRAMEWORK"
+ if [ -n "$MAC_FRAMEWORK_PREFIX" ]; then
+ _ldflags="-F$MAC_FRAMEWORK_PREFIX"
+ else
+ _ldflags=""
+ fi
+ fi
+
+ is_installed || [ -n "$flag_option_no_rpath" ] || _rpath=""
+
+ echo $_ldflags "-pthread " $_rpath $wx_libs ""
+
+elif [ -n "$output_option_optional_libs" ]; then
+ # if only --optional-libs then output just the libs
+
+ echo $wx_libs
+fi
+
+
+# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+#
+# Beyond here reside only machine or tool specific workarounds
+# that require knowlege not obtainable prior to this comment.
+#
+# Please. Avoid addding things here, wx-config should avoid
+# hard coding tool specific details. Do not use things here
+# as an example of other things that should be here, These
+# shouldn't be here either. This is a place of last resort
+# for interim workarounds. I can but stress as strongly as
+# the censor will allow, there are only bad examples of things
+# that belong at this level of abstraction to follow. It is
+# a limbo for glitches awaiting the Next Design Repair. Ok.
+#
+# With that firmly in mind, our debut dilemma is:
+
+# Resource compilers. An elusive term that covers some pretty
+# dissimilar concepts on various platforms. The good news is,
+# each platform has only one definition of 'resource', compiled
+# or not, and so we can abstract that neatly to return a platform
+# specific invocation of the appropriate tool. The bad news is,
+# windres (at least) requires knowledge of the wx header files
+# location(s) that cannot be predicted reliably before the call to
+# wx-config is made. Currently for all known resource compilers,
+# we can simply return a command and some salient configuration
+# options in response to a request for --rescomp. So here we
+# top up the options for any tools that may require information
+# that was only just determined in the last few machine cycles,
+# then output the necessary incantation for the platform.
+#
+# Most things should already be constant by the time configure
+# has run. Do not add anything here that is already known there.
+
+if [ -n "$output_option_rescomp" ]; then
+
+ case "" in
+ *windres|wrc)
+ # Note that with late model windres, we could just insert
+ # _include_cppflags here, but use the old notation for now
+ # as it is more universally accepted.
+ if is_installed; then
+ echo " --include-dir" \
+ "${includedir}/wx-3.0" \
+ ""
+ else
+ echo " --include-dir ${includedir}" \
+ ""
+ fi
+ ;;
+
+ # neither rez not emxbind have any specific needs from
+ # us, so just output what was determined by configure.
+ *)
+ echo
+ ;;
+ esac
+
+fi
+
+#
+# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+
+# And so that's it, we're done. Have a nice build.
+
+exit 0
--- /dev/null
+/* lib/wx/include/gtk2-unicode-static-3.0/wx/setup.h. Generated from setup.h.in by configure. */
+/* This define (__WX_SETUP_H__) is used both to ensure setup.h is included
+ * only once and to indicate that we are building using configure. */
+#ifndef __WX_SETUP_H__
+#define __WX_SETUP_H__
+
+/* never undefine inline or const keywords for C++ compilation */
+#ifndef __cplusplus
+
+/* Define to empty if the keyword does not work. */
+/* #undef const */
+
+/* Define as __inline if that's what the C compiler calls it. */
+/* #undef inline */
+
+#endif /* __cplusplus */
+
+/* fill in with the string wxGetOsDescription() will return */
+#define WXWIN_OS_DESCRIPTION "Linux 3.14.9-200.fc20.x86_64 x86_64"
+
+/* the installation location prefix from configure */
+#define wxINSTALL_PREFIX "/home/build/tmp/build/external/dist"
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef gid_t */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef mode_t */
+
+/* Define to `long' if <sys/types.h> doesn't define. */
+/* #undef off_t */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef pid_t */
+
+/* Define to `unsigned' if <sys/types.h> doesn't define. */
+/* #undef size_t */
+
+/* Define if ssize_t type is available. */
+#define HAVE_SSIZE_T 1
+
+/* Define if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define this to get extra features from GNU libc. */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef uid_t */
+
+/* Define if your processor stores words with the most significant
+ byte first (like Motorola and SPARC, unlike Intel and VAX). */
+/* #undef WORDS_BIGENDIAN */
+
+/* Define this if your version of GTK+ is greater than 1.2.7 */
+/* #undef __WXGTK127__ */
+
+/* Define this if your version of GTK+ is greater than 2.0 */
+#define __WXGTK20__ 1
+
+/* Define this if your version of GTK+ is greater than 2.6 */
+/* #undef __WXGTK26__ */
+
+/* Define this if your version of GTK+ is greater than 2.10 */
+#define __WXGTK210__ 1
+
+/* Define this if your version of GTK+ is greater than 2.18 */
+#define __WXGTK218__ 1
+
+/* Define this if your version of GTK+ is >= 3.0 */
+/* #undef __WXGTK3__ */
+
+/* Define this if you want to use GPE features */
+/* #undef __WXGPE__ */
+
+/* Define this if your version of Motif is greater than 2.0 */
+/* #undef __WXMOTIF20__ */
+
+/* Define this if you are using Lesstif */
+/* #undef __WXLESSTIF__ */
+
+/*
+ * Define to 1 for Unix[-like] system
+ */
+#define wxUSE_UNIX 1
+
+#define __UNIX__ 1
+
+/* #undef __AIX__ */
+/* #undef __BSD__ */
+/* #undef __DARWIN__ */
+/* #undef __EMX__ */
+/* #undef __FREEBSD__ */
+/* #undef __HPUX__ */
+#define __LINUX__ 1
+/* #undef __NETBSD__ */
+/* #undef __OPENBSD__ */
+/* #undef __OSF__ */
+/* #undef __QNX__ */
+/* #undef __SGI__ */
+/* #undef __SOLARIS__ */
+/* #undef __SUN__ */
+/* #undef __SUNOS__ */
+/* #undef __SVR4__ */
+/* #undef __SYSV__ */
+/* #undef __ULTRIX__ */
+/* #undef __UNIXWARE__ */
+/* #undef __VMS__ */
+
+/* #undef __IA64__ */
+/* #undef __ALPHA__ */
+
+/* NanoX (with wxX11) */
+#define wxUSE_NANOX 0
+
+/* PowerPC Darwin & Mac OS X */
+/* #undef __POWERPC__ */
+/* #undef TARGET_CARBON */
+
+/* Hack to make IOGraphicsTypes.h not define Point conflicting with MacTypes */
+/* #undef __Point__ */
+
+/* MS-DOS with DJGPP */
+/* #undef __DOS__ */
+
+/* Stupid hack; __WINDOWS__ clashes with wx/defs.h */
+#ifndef __WINDOWS__
+/* #undef __WINDOWS__ */
+#endif
+
+#ifndef __WIN32__
+/* #undef __WIN32__ */
+#endif
+#ifndef __GNUWIN32__
+/* #undef __GNUWIN32__ */
+#endif
+#ifndef STRICT
+/* #undef STRICT */
+#endif
+#ifndef WINVER
+/* #undef WINVER */
+#endif
+
+/* OS/2 with EMX */
+/* #undef __OS2__ */
+
+/* --- start common options --- */
+
+#ifndef wxUSE_GUI
+ #define wxUSE_GUI 1
+#endif
+
+
+#define WXWIN_COMPATIBILITY_2_6 0
+
+#define WXWIN_COMPATIBILITY_2_8 1
+
+#define wxDIALOG_UNIT_COMPATIBILITY 0
+
+
+
+#define wxUSE_ON_FATAL_EXCEPTION 1
+
+#define wxUSE_STACKWALKER 1
+
+#define wxUSE_DEBUGREPORT 1
+
+
+
+#define wxUSE_DEBUG_CONTEXT 0
+
+#define wxUSE_MEMORY_TRACING 0
+
+#define wxUSE_GLOBAL_MEMORY_OPERATORS 0
+
+#define wxUSE_DEBUG_NEW_ALWAYS 0
+
+
+
+#ifndef wxUSE_UNICODE
+ #define wxUSE_UNICODE 1
+#endif
+
+#define wxUSE_WCHAR_T 1
+
+
+#define wxUSE_EXCEPTIONS 1
+
+#define wxUSE_EXTENDED_RTTI 0
+
+#define wxUSE_LOG 1
+
+#define wxUSE_LOGWINDOW 1
+
+#define wxUSE_LOGGUI 1
+
+#define wxUSE_LOG_DIALOG 1
+
+#define wxUSE_CMDLINE_PARSER 1
+
+#define wxUSE_THREADS 1
+
+#define wxUSE_STREAMS 1
+
+#define wxUSE_PRINTF_POS_PARAMS 1
+
+#define wxUSE_COMPILER_TLS 1
+
+
+#define wxUSE_STL 0
+
+#if defined(__DMC__) || defined(__WATCOMC__) \
+ || (defined(_MSC_VER) && _MSC_VER < 1200)
+ #define wxUSE_STD_DEFAULT 0
+#else
+ #define wxUSE_STD_DEFAULT 0
+#endif
+
+#define wxUSE_STD_CONTAINERS 0
+
+#define wxUSE_STD_IOSTREAM 1
+
+#define wxUSE_STD_STRING 1
+
+#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL
+
+#define wxUSE_IOSTREAMH 0
+
+
+
+#define wxUSE_LONGLONG 1
+
+#define wxUSE_BASE64 1
+
+#define wxUSE_CONSOLE_EVENTLOOP 1
+
+#define wxUSE_FILE 1
+#define wxUSE_FFILE 1
+
+#define wxUSE_FSVOLUME 1
+
+#define wxUSE_STDPATHS 1
+
+#define wxUSE_TEXTBUFFER 1
+
+#define wxUSE_TEXTFILE 1
+
+#define wxUSE_INTL 1
+
+#define wxUSE_XLOCALE 1
+
+#define wxUSE_DATETIME 1
+
+#define wxUSE_TIMER 1
+
+#define wxUSE_STOPWATCH 1
+
+#define wxUSE_FSWATCHER 1
+
+#define wxUSE_CONFIG 1
+
+#define wxUSE_CONFIG_NATIVE 1
+
+#define wxUSE_DIALUP_MANAGER 1
+
+#define wxUSE_DYNLIB_CLASS 1
+
+#define wxUSE_DYNAMIC_LOADER 1
+
+#define wxUSE_SOCKETS 1
+
+#define wxUSE_IPV6 0
+
+#define wxUSE_FILESYSTEM 1
+
+#define wxUSE_FS_ZIP 1
+
+#define wxUSE_FS_ARCHIVE 1
+
+#define wxUSE_FS_INET 1
+
+#define wxUSE_ARCHIVE_STREAMS 1
+
+#define wxUSE_ZIPSTREAM 1
+
+#define wxUSE_TARSTREAM 1
+
+#define wxUSE_ZLIB 1
+
+#define wxUSE_APPLE_IEEE 1
+
+#define wxUSE_JOYSTICK 1
+
+#define wxUSE_FONTENUM 1
+
+#define wxUSE_FONTMAP 1
+
+#define wxUSE_MIMETYPE 1
+
+#define wxUSE_PROTOCOL 1
+
+#define wxUSE_PROTOCOL_FILE 1
+#define wxUSE_PROTOCOL_FTP 1
+#define wxUSE_PROTOCOL_HTTP 1
+
+#define wxUSE_URL 1
+
+#define wxUSE_URL_NATIVE 0
+
+#define wxUSE_VARIANT 1
+
+#define wxUSE_ANY 1
+
+#define wxUSE_REGEX 1
+
+#define wxUSE_SYSTEM_OPTIONS 1
+
+#define wxUSE_SOUND 1
+
+#define wxUSE_MEDIACTRL 1
+
+#define wxUSE_XRC 1
+
+#define wxUSE_XML 1
+
+#define wxUSE_AUI 1
+
+#define wxUSE_RIBBON 1
+
+#define wxUSE_PROPGRID 1
+
+#define wxUSE_STC 1
+
+#define wxUSE_WEBVIEW 1
+
+#ifdef __WXMSW__
+#define wxUSE_WEBVIEW_IE 0
+#else
+#define wxUSE_WEBVIEW_IE 0
+#endif
+
+#if defined(__WXGTK__) || defined(__WXOSX__)
+#define wxUSE_WEBVIEW_WEBKIT 1
+#else
+#define wxUSE_WEBVIEW_WEBKIT 1
+#endif
+
+
+#ifdef _MSC_VER
+# if _MSC_VER >= 1310
+
+
+#define wxUSE_GRAPHICS_CONTEXT 1
+# else
+
+
+# define wxUSE_GRAPHICS_CONTEXT 1
+# endif
+#else
+
+
+
+
+
+# define wxUSE_GRAPHICS_CONTEXT 1
+#endif
+
+#define wxUSE_CAIRO 1
+
+
+
+#define wxUSE_CONTROLS 1
+
+#define wxUSE_MARKUP 1
+
+#define wxUSE_POPUPWIN 1
+
+#define wxUSE_TIPWINDOW 1
+
+#define wxUSE_ANIMATIONCTRL 1
+#define wxUSE_BANNERWINDOW 1
+#define wxUSE_BUTTON 1
+#define wxUSE_BMPBUTTON 1
+#define wxUSE_CALENDARCTRL 1
+#define wxUSE_CHECKBOX 1
+#define wxUSE_CHECKLISTBOX 1
+#define wxUSE_CHOICE 1
+#define wxUSE_COLLPANE 1
+#define wxUSE_COLOURPICKERCTRL 1
+#define wxUSE_COMBOBOX 1
+#define wxUSE_COMMANDLINKBUTTON 1
+#define wxUSE_DATAVIEWCTRL 1
+#define wxUSE_DATEPICKCTRL 1
+#define wxUSE_DIRPICKERCTRL 1
+#define wxUSE_EDITABLELISTBOX 1
+#define wxUSE_FILECTRL 1
+#define wxUSE_FILEPICKERCTRL 1
+#define wxUSE_FONTPICKERCTRL 1
+#define wxUSE_GAUGE 1
+#define wxUSE_HEADERCTRL 1
+#define wxUSE_HYPERLINKCTRL 1
+#define wxUSE_LISTBOX 1
+#define wxUSE_LISTCTRL 1
+#define wxUSE_RADIOBOX 1
+#define wxUSE_RADIOBTN 1
+#define wxUSE_RICHMSGDLG 1
+#define wxUSE_SCROLLBAR 1
+#define wxUSE_SEARCHCTRL 1
+#define wxUSE_SLIDER 1
+#define wxUSE_SPINBTN 1
+#define wxUSE_SPINCTRL 1
+#define wxUSE_STATBOX 1
+#define wxUSE_STATLINE 1
+#define wxUSE_STATTEXT 1
+#define wxUSE_STATBMP 1
+#define wxUSE_TEXTCTRL 1
+#define wxUSE_TIMEPICKCTRL 1
+#define wxUSE_TOGGLEBTN 1
+#define wxUSE_TREECTRL 1
+#define wxUSE_TREELISTCTRL 1
+
+#define wxUSE_STATUSBAR 1
+
+#define wxUSE_NATIVE_STATUSBAR 1
+
+#define wxUSE_TOOLBAR 1
+#define wxUSE_TOOLBAR_NATIVE 1
+
+#define wxUSE_NOTEBOOK 1
+
+#define wxUSE_LISTBOOK 1
+
+#define wxUSE_CHOICEBOOK 1
+
+#define wxUSE_TREEBOOK 1
+
+#define wxUSE_TOOLBOOK 1
+
+#define wxUSE_TASKBARICON 1
+
+#define wxUSE_GRID 1
+
+#define wxUSE_MINIFRAME 1
+
+#define wxUSE_COMBOCTRL 1
+
+#define wxUSE_ODCOMBOBOX 1
+
+#define wxUSE_BITMAPCOMBOBOX 1
+
+#define wxUSE_REARRANGECTRL 1
+
+
+#define wxUSE_ACCEL 1
+
+#define wxUSE_ARTPROVIDER_STD 1
+
+#define wxUSE_ARTPROVIDER_TANGO 0
+
+#define wxUSE_HOTKEY 0
+
+#define wxUSE_CARET 1
+
+#define wxUSE_DISPLAY 1
+
+#define wxUSE_GEOMETRY 1
+
+#define wxUSE_IMAGLIST 1
+
+#define wxUSE_INFOBAR 1
+
+#define wxUSE_MENUS 1
+
+#define wxUSE_NOTIFICATION_MESSAGE 1
+
+#define wxUSE_PREFERENCES_EDITOR 1
+
+#define wxUSE_RICHTOOLTIP 1
+
+#define wxUSE_SASH 1
+
+#define wxUSE_SPLITTER 1
+
+#define wxUSE_TOOLTIPS 1
+
+#define wxUSE_VALIDATORS 1
+
+#ifdef __WXMSW__
+#define wxUSE_AUTOID_MANAGEMENT 0
+#else
+#define wxUSE_AUTOID_MANAGEMENT 0
+#endif
+
+
+#define wxUSE_COMMON_DIALOGS 0
+
+#define wxUSE_BUSYINFO 1
+
+#define wxUSE_CHOICEDLG 1
+
+#define wxUSE_COLOURDLG 1
+
+#define wxUSE_DIRDLG 1
+
+
+#define wxUSE_FILEDLG 1
+
+#define wxUSE_FINDREPLDLG 1
+
+#define wxUSE_FONTDLG 1
+
+#define wxUSE_MSGDLG 1
+
+#define wxUSE_PROGRESSDLG 1
+
+#define wxUSE_STARTUP_TIPS 1
+
+#define wxUSE_TEXTDLG 1
+
+#define wxUSE_NUMBERDLG 1
+
+#define wxUSE_SPLASH 1
+
+#define wxUSE_WIZARDDLG 1
+
+#define wxUSE_ABOUTDLG 1
+
+#define wxUSE_FILE_HISTORY 1
+
+
+#define wxUSE_METAFILE 0
+#define wxUSE_ENH_METAFILE 0
+#define wxUSE_WIN_METAFILES_ALWAYS 0
+
+
+#define wxUSE_MDI 1
+
+#define wxUSE_DOC_VIEW_ARCHITECTURE 1
+
+#define wxUSE_MDI_ARCHITECTURE 1
+
+#define wxUSE_PRINTING_ARCHITECTURE 1
+
+#define wxUSE_HTML 1
+
+#define wxUSE_GLCANVAS 1
+
+#define wxUSE_RICHTEXT 1
+
+
+#define wxUSE_CLIPBOARD 1
+
+#define wxUSE_DATAOBJ 1
+
+#define wxUSE_DRAG_AND_DROP 1
+
+#define wxUSE_ACCESSIBILITY 0
+
+
+#define wxUSE_SNGLINST_CHECKER 1
+
+#define wxUSE_DRAGIMAGE 1
+
+#define wxUSE_IPC 1
+
+#define wxUSE_HELP 1
+
+
+#define wxUSE_MS_HTML_HELP 0
+
+
+#define wxUSE_WXHTML_HELP 1
+
+#define wxUSE_CONSTRAINTS 1
+
+
+#define wxUSE_SPLINES 1
+
+
+#define wxUSE_MOUSEWHEEL 1
+
+
+#define wxUSE_UIACTIONSIMULATOR 1
+
+
+#define wxUSE_POSTSCRIPT 1
+
+#define wxUSE_AFM_FOR_POSTSCRIPT 1
+
+#define wxUSE_SVG 1
+
+#define wxUSE_DC_TRANSFORM_MATRIX 1
+
+
+
+#define wxUSE_IMAGE 1
+
+#define wxUSE_LIBPNG 1
+
+#define wxUSE_LIBJPEG 1
+
+#define wxUSE_LIBTIFF 1
+
+#define wxUSE_TGA 1
+
+#define wxUSE_GIF 1
+
+#define wxUSE_PNM 1
+
+#define wxUSE_PCX 1
+
+#define wxUSE_IFF 1
+
+#define wxUSE_XPM 1
+
+#define wxUSE_ICO_CUR 1
+
+#define wxUSE_PALETTE 1
+
+
+#define wxUSE_ALL_THEMES 0
+
+#define wxUSE_THEME_GTK 0
+#define wxUSE_THEME_METAL 0
+#define wxUSE_THEME_MONO 0
+#define wxUSE_THEME_WIN32 0
+
+
+/* --- end common options --- */
+
+/*
+ * Unix-specific options
+ */
+#define wxUSE_SELECT_DISPATCHER 1
+#define wxUSE_EPOLL_DISPATCHER 1
+
+#define wxUSE_UNICODE_UTF8 0
+#define wxUSE_UTF8_LOCALE_ONLY 0
+
+/*
+ Use GStreamer for Unix.
+
+ Default is 0 as this requires a lot of dependencies which might not be
+ available.
+
+ Recommended setting: 1 (wxMediaCtrl won't work by default without it).
+ */
+#define wxUSE_GSTREAMER 1
+
+/* --- start MSW options --- */
+
+#ifndef wxUSE_UNICODE_MSLU
+ #define wxUSE_UNICODE_MSLU 0
+#endif
+
+#define wxUSE_MFC 0
+
+#define wxUSE_OLE 0
+
+#define wxUSE_OLE_AUTOMATION 0
+
+#define wxUSE_ACTIVEX 0
+
+#define wxUSE_DC_CACHEING 0
+
+#define wxUSE_WXDIB 0
+
+#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0
+
+#define wxUSE_REGKEY 0
+
+#define wxUSE_RICHEDIT 1
+
+#define wxUSE_RICHEDIT2 1
+
+#define wxUSE_OWNER_DRAWN 0
+
+#define wxUSE_TASKBARICON_BALLOONS 1
+
+#define wxUSE_UXTHEME 0
+
+#define wxUSE_INKEDIT 0
+
+#define wxUSE_INICONF 0
+
+
+#define wxUSE_DATEPICKCTRL_GENERIC 0
+
+#define wxUSE_TIMEPICKCTRL_GENERIC 0
+
+
+#define wxUSE_CRASHREPORT 0
+/* --- end MSW options --- */
+
+/*
+ * Define if your compiler supports the explicit keyword
+ */
+#define HAVE_EXPLICIT 1
+
+/*
+ * Define if your compiler has C99 va_copy
+ */
+#define HAVE_VA_COPY 1
+
+/*
+ * Define if va_list type is an array
+ */
+/* #undef VA_LIST_IS_ARRAY */
+
+/*
+ * Define if the compiler supports variadic macros
+ */
+#define HAVE_VARIADIC_MACROS 1
+
+/*
+ * Define if you don't want variadic macros to be used even if they are
+ * supported by the compiler.
+ */
+/* #undef wxNO_VARIADIC_MACROS */
+
+/*
+ * Define if your compiler has std::wstring
+ */
+#define HAVE_STD_WSTRING 1
+/*
+ * Define if your compiler has compliant std::string::compare
+ */
+/* #undef HAVE_STD_STRING_COMPARE */
+/*
+ * Define if your compiler has <hash_map>
+ */
+/* #undef HAVE_HASH_MAP */
+/*
+ * Define if your compiler has <ext/hash_map>
+ */
+/* #undef HAVE_EXT_HASH_MAP */
+/*
+ * Define if your compiler has std::hash_map/hash_set
+ */
+/* #undef HAVE_STD_HASH_MAP */
+/*
+ * Define if your compiler has __gnu_cxx::hash_map/hash_set
+ */
+/* #undef HAVE_GNU_CXX_HASH_MAP */
+
+/*
+ * Define if your compiler has std::unordered_map
+ */
+/* #undef HAVE_STD_UNORDERED_MAP */
+
+/*
+ * Define if your compiler has std::unordered_set
+ */
+/* #undef HAVE_STD_UNORDERED_SET */
+
+/*
+ * Define if your compiler has std::tr1::unordered_map
+ */
+/* #undef HAVE_TR1_UNORDERED_MAP */
+
+/*
+ * Define if your compiler has std::tr1::unordered_set
+ */
+/* #undef HAVE_TR1_UNORDERED_SET */
+
+/*
+ * Define if your compiler has <tr1/type_traits>
+ */
+#define HAVE_TR1_TYPE_TRAITS 1
+
+/*
+ * Define if your compiler has <type_traits>
+ */
+/* #undef HAVE_TYPE_TRAITS */
+
+/*
+ * Define if the compiler supports simple visibility declarations.
+ */
+/* #undef HAVE_VISIBILITY */
+
+/*
+ * Define if the compiler supports GCC's atomic memory access builtins
+ */
+#define HAVE_GCC_ATOMIC_BUILTINS 1
+
+/*
+ * Define if compiler's visibility support in libstdc++ is broken
+ */
+/* #undef HAVE_BROKEN_LIBSTDCXX_VISIBILITY */
+
+/*
+ * The built-in regex supports advanced REs in additional to POSIX's basic
+ * and extended. Your system regex probably won't support this, and in this
+ * case WX_NO_REGEX_ADVANCED should be defined.
+ */
+/* #undef WX_NO_REGEX_ADVANCED */
+/*
+ * On GNU systems use re_search instead of regexec, since the latter does a
+ * strlen on the search text affecting the performance of some operations.
+ */
+/* #undef HAVE_RE_SEARCH */
+/*
+ * Use SDL for audio (Unix)
+ */
+#define wxUSE_LIBSDL 0
+
+/*
+ * Compile sound backends as plugins
+ */
+#define wxUSE_PLUGINS 0
+
+/*
+ * Use GTK print for printing under GTK+ 2.10+
+ */
+#define wxUSE_GTKPRINT 1
+/*
+ * Use GNOME VFS for MIME types
+ */
+#define wxUSE_LIBGNOMEVFS 0
+/*
+ * Use the Hildon framework
+ */
+#define wxUSE_LIBHILDON 0
+/*
+ * Use the Hildon 2.0 framework
+ */
+#define wxUSE_LIBHILDON2 0
+/*
+ * Use libnotify library.
+ */
+#define wxUSE_LIBNOTIFY 1
+/*
+ * Use libnotify 0.7+ API.
+ */
+#define wxUSE_LIBNOTIFY_0_7 1
+/*
+ * Use libXpm
+ */
+#define wxHAVE_LIB_XPM 0
+/*
+ * Define if you have pthread_cleanup_push/pop()
+ */
+#define wxHAVE_PTHREAD_CLEANUP 1
+/*
+ * Define if compiler has __thread keyword.
+ */
+#define HAVE___THREAD_KEYWORD 1
+/*
+ * Define if large (64 bit file offsets) files are supported.
+ */
+#define HAVE_LARGEFILE_SUPPORT 1
+
+/*
+ * Use OpenGL
+ */
+#define wxUSE_OPENGL 1
+
+/*
+ * Use MS HTML Help via libmspack (Unix)
+ */
+#define wxUSE_LIBMSPACK 0
+
+/*
+ * Matthews garbage collection (used for MrEd?)
+ */
+#define WXGARBAGE_COLLECTION_ON 0
+
+/*
+ * wxWebKitCtrl
+ */
+#define wxUSE_WEBKIT 0
+
+/*
+ * Objective-C class name uniquifying
+ */
+#define wxUSE_OBJC_UNIQUIFYING 0
+
+/*
+ * The const keyword is being introduced more in wxWindows.
+ * You can use this setting to maintain backward compatibility.
+ * If 0: will use const wherever possible.
+ * If 1: will use const only where necessary
+ * for precompiled headers to work.
+ * If 2: will be totally backward compatible, but precompiled
+ * headers may not work and program size will be larger.
+ */
+#define CONST_COMPATIBILITY 0
+
+/*
+ * use the session manager to detect KDE/GNOME
+ */
+#define wxUSE_DETECT_SM 1
+
+
+/* define with the name of timezone variable */
+#define WX_TIMEZONE timezone
+
+/* The type of 3rd argument to getsockname() - usually size_t or int */
+#define WX_SOCKLEN_T socklen_t
+
+/* The type of 5th argument to getsockopt() - usually size_t or int */
+#define SOCKOPTLEN_T socklen_t
+
+/* The type of statvfs(2) argument */
+#define WX_STATFS_T struct statfs
+
+/* The signal handler prototype */
+#define wxTYPE_SA_HANDLER int
+
+/* gettimeofday() usually takes 2 arguments, but some really old systems might
+ * have only one, in which case define WX_GETTIMEOFDAY_NO_TZ */
+/* #undef WX_GETTIMEOFDAY_NO_TZ */
+
+/* struct tm doesn't always have the tm_gmtoff field, define this if it does */
+#define WX_GMTOFF_IN_TM 1
+
+/* Define if you have poll(2) function */
+/* #undef HAVE_POLL */
+
+/* Define if you have pw_gecos field in struct passwd */
+#define HAVE_PW_GECOS 1
+
+/* Define if you have __cxa_demangle() in <cxxabi.h> */
+#define HAVE_CXA_DEMANGLE 1
+
+/* Define if you have dlopen() */
+#define HAVE_DLOPEN 1
+
+/* Define if you have gettimeofday() */
+#define HAVE_GETTIMEOFDAY 1
+
+/* Define if fsync() is available */
+#define HAVE_FSYNC 1
+
+/* Define if round() is available */
+#define HAVE_ROUND 1
+
+/* Define if you have ftime() */
+/* #undef HAVE_FTIME */
+
+/* Define if you have nanosleep() */
+#define HAVE_NANOSLEEP 1
+
+/* Define if you have sched_yield */
+#define HAVE_SCHED_YIELD 1
+
+/* Define if you have pthread_mutexattr_t and functions to work with it */
+#define HAVE_PTHREAD_MUTEXATTR_T 1
+
+/* Define if you have pthread_mutexattr_settype() declaration */
+#define HAVE_PTHREAD_MUTEXATTR_SETTYPE_DECL 1
+
+/* Define if you have PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP */
+/* #undef HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER */
+
+/* Define if you have pthread_cancel */
+#define HAVE_PTHREAD_CANCEL 1
+
+/* Define if you have pthread_mutex_timedlock */
+#define HAVE_PTHREAD_MUTEX_TIMEDLOCK 1
+
+/* Define if you have pthread_attr_setstacksize */
+#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
+
+/* Define if you have shl_load() */
+/* #undef HAVE_SHL_LOAD */
+
+/* Define if you have snprintf() */
+#define HAVE_SNPRINTF 1
+
+/* Define if you have snprintf() declaration in the header */
+#define HAVE_SNPRINTF_DECL 1
+
+/* Define if you have a snprintf() which supports positional arguments
+ (defined in the unix98 standard) */
+#define HAVE_UNIX98_PRINTF 1
+
+/* define if you have statfs function */
+#define HAVE_STATFS 1
+
+/* define if you have statfs prototype */
+#define HAVE_STATFS_DECL 1
+
+/* define if you have statvfs function */
+/* #undef HAVE_STATVFS */
+
+/* Define if you have strtoull() and strtoll() */
+#define HAVE_STRTOULL 1
+
+/* Define if you have all functions to set thread priority */
+#define HAVE_THREAD_PRIORITY_FUNCTIONS 1
+
+/* Define if you have vsnprintf() */
+#define HAVE_VSNPRINTF 1
+
+/* Define if you have vsnprintf() declaration in the header */
+#define HAVE_VSNPRINTF_DECL 1
+
+/* Define if you have a _broken_ vsnprintf() declaration in the header,
+ * with 'char*' for the 3rd parameter instead of 'const char*' */
+/* #undef HAVE_BROKEN_VSNPRINTF_DECL */
+
+/* Define if you have vsscanf() */
+#define HAVE_VSSCANF 1
+
+/* Define if you have vsscanf() declaration in the header */
+#define HAVE_VSSCANF_DECL 1
+
+/* Define if you have usleep() */
+/* #undef HAVE_USLEEP */
+
+/* Define if you have wcscasecmp() function */
+#define HAVE_WCSCASECMP 1
+
+/* Define if you have wcsncasecmp() function */
+#define HAVE_WCSNCASECMP 1
+
+/* Define if you have wcslen function */
+#define HAVE_WCSLEN 1
+
+/* Define if you have wcsdup function */
+#define HAVE_WCSDUP 1
+
+/* Define if you have wcsftime() function */
+#define HAVE_WCSFTIME 1
+
+/* Define if you have strnlen() function */
+#define HAVE_STRNLEN 1
+
+/* Define if you have wcsnlen() function */
+#define HAVE_WCSNLEN 1
+
+/* Define if you have wcstoull() and wcstoll() */
+/* #undef HAVE_WCSTOULL */
+
+/* The number of bytes in a wchar_t. */
+#define SIZEOF_WCHAR_T 4
+
+/* The number of bytes in a int. */
+#define SIZEOF_INT 4
+
+/* The number of bytes in a pointer. */
+#define SIZEOF_VOID_P 8
+
+/* The number of bytes in a long. */
+#define SIZEOF_LONG 8
+
+/* The number of bytes in a long long. */
+#define SIZEOF_LONG_LONG 8
+
+/* The number of bytes in a short. */
+#define SIZEOF_SHORT 2
+
+/* The number of bytes in a size_t. */
+#define SIZEOF_SIZE_T 8
+
+/* Define if size_t on your machine is the same type as unsigned int. */
+/* #undef wxSIZE_T_IS_UINT */
+
+/* Define if size_t on your machine is the same type as unsigned long. */
+#define wxSIZE_T_IS_ULONG 1
+
+/* Define if wchar_t is distinct type in your compiler. */
+#define wxWCHAR_T_IS_REAL_TYPE 1
+
+/* Define if you have the dlerror function. */
+#define HAVE_DLERROR 1
+
+/* Define if you have Posix fnctl() function. */
+#define HAVE_FCNTL 1
+
+/* Define if you have BSD flock() function. */
+/* #undef HAVE_FLOCK */
+
+/* Define if you have getaddrinfo function. */
+/* #undef HAVE_GETADDRINFO */
+
+/* Define if you have a gethostbyname_r function taking 6 arguments. */
+#define HAVE_FUNC_GETHOSTBYNAME_R_6 1
+
+/* Define if you have a gethostbyname_r function taking 5 arguments. */
+/* #undef HAVE_FUNC_GETHOSTBYNAME_R_5 */
+
+/* Define if you have a gethostbyname_r function taking 3 arguments. */
+/* #undef HAVE_FUNC_GETHOSTBYNAME_R_3 */
+
+/* Define if you only have a gethostbyname function */
+/* #undef HAVE_GETHOSTBYNAME */
+
+/* Define if you have the gethostname function. */
+/* #undef HAVE_GETHOSTNAME */
+
+/* Define if you have a getservbyname_r function taking 6 arguments. */
+#define HAVE_FUNC_GETSERVBYNAME_R_6 1
+
+/* Define if you have a getservbyname_r function taking 5 arguments. */
+/* #undef HAVE_FUNC_GETSERVBYNAME_R_5 */
+
+/* Define if you have a getservbyname_r function taking 4 arguments. */
+/* #undef HAVE_FUNC_GETSERVBYNAME_R_4 */
+
+/* Define if you only have a getservbyname function */
+/* #undef HAVE_GETSERVBYNAME */
+
+/* Define if you have the gmtime_r function. */
+#define HAVE_GMTIME_R 1
+
+/* Define if you have the inet_addr function. */
+#define HAVE_INET_ADDR 1
+
+/* Define if you have the inet_aton function. */
+#define HAVE_INET_ATON 1
+
+/* Define if you have the localtime_r function. */
+#define HAVE_LOCALTIME_R 1
+
+/* Define if you have the mktemp function. */
+/* #undef HAVE_MKTEMP */
+
+/* Define if you have the mkstemp function. */
+#define HAVE_MKSTEMP 1
+
+/* Define if you have the putenv function. */
+/* #undef HAVE_PUTENV */
+
+/* Define if you have the setenv function. */
+#define HAVE_SETENV 1
+
+/* Define if you have strtok_r function. */
+#define HAVE_STRTOK_R 1
+
+/* Define if you have thr_setconcurrency function */
+/* #undef HAVE_THR_SETCONCURRENCY */
+
+/* Define if you have pthread_setconcurrency function */
+#define HAVE_PTHREAD_SET_CONCURRENCY 1
+
+/* Define if you have the uname function. */
+#define HAVE_UNAME 1
+
+/* Define if you have the unsetenv function. */
+#define HAVE_UNSETENV 1
+
+/* Define if you have the <X11/XKBlib.h> header file. */
+#define HAVE_X11_XKBLIB_H 1
+
+/* Define if you have the <X11/extensions/xf86vmode.h> header file. */
+#define HAVE_X11_EXTENSIONS_XF86VMODE_H 1
+
+/* Define if you have the <sched.h> header file. */
+#define HAVE_SCHED_H 1
+
+/* Define if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define if you have the <fcntl.h> header file. */
+/* #undef HAVE_FCNTL_H */
+
+/* Define if you have the <wchar.h> header file. */
+#define HAVE_WCHAR_H 1
+
+/* Define if you have the <wcstr.h> header file. */
+/* #undef HAVE_WCSTR_H */
+
+/* Define if you have <widec.h> (Solaris only) */
+/* #undef HAVE_WIDEC_H */
+
+/* Define if you have the <iconv.h> header file and iconv() symbol. */
+#define HAVE_ICONV 1
+
+/* Define as "const" if the declaration of iconv() needs const. */
+#define ICONV_CONST
+
+/* Define if you have the <langinfo.h> header file. */
+#define HAVE_LANGINFO_H 1
+
+/* Define if you have the <w32api.h> header file (mingw,cygwin). */
+/* #undef HAVE_W32API_H */
+
+/* Define if you have the <sys/soundcard.h> header file. */
+#define HAVE_SYS_SOUNDCARD_H 1
+
+/* Define if you have wcsrtombs() function */
+#define HAVE_WCSRTOMBS 1
+
+/* Define this if you have putws() */
+/* #undef HAVE_PUTWS */
+
+/* Define this if you have fputws() */
+#define HAVE_FPUTWS 1
+
+/* Define this if you have wprintf() and related functions */
+#define HAVE_WPRINTF 1
+
+/* Define this if you have vswprintf() and related functions */
+#define HAVE_VSWPRINTF 1
+
+/* Define this if you have _vsnwprintf */
+/* #undef HAVE__VSNWPRINTF */
+
+/* vswscanf() */
+#define HAVE_VSWSCANF 1
+
+/* Define if fseeko and ftello are available. */
+#define HAVE_FSEEKO 1
+
+/* Define this if you are using gtk and gdk contains support for X11R6 XIM */
+/* #undef HAVE_XIM */
+
+/* Define this if you have X11/extensions/shape.h */
+/* #undef HAVE_XSHAPE */
+
+/* Define this if you have type SPBCDATA */
+/* #undef HAVE_SPBCDATA */
+
+/* Define if you have pango_font_family_is_monospace() (Pango >= 1.3.3) */
+/* #undef HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE */
+
+/* Define if you have Pango xft support */
+/* #undef HAVE_PANGO_XFT */
+
+/* Define if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define if you have abi::__forced_unwind in your <cxxabi.h>. */
+#define HAVE_ABI_FORCEDUNWIND 1
+
+/* Define if fdopen is available. */
+#define HAVE_FDOPEN 1
+
+/* Define if sysconf is available. */
+#define HAVE_SYSCONF 1
+
+/* Define if getpwuid_r is available. */
+#define HAVE_GETPWUID_R 1
+
+/* Define if getgrgid_r is available. */
+#define HAVE_GETGRGID_R 1
+
+/* Define if setpriority() is available. */
+#define HAVE_SETPRIORITY 1
+
+/* Define if locale_t is available */
+#define HAVE_LOCALE_T 1
+
+/* Define if you have inotify_xxx() functions. */
+#define wxHAS_INOTIFY 1
+
+/* Define if you have kqueu_xxx() functions. */
+/* #undef wxHAS_KQUEUE */
+
+/* -------------------------------------------------------------------------
+ Win32 adjustments section
+ ------------------------------------------------------------------------- */
+
+#ifdef __WIN32__
+
+/* When using an external jpeg library and the Windows headers already define
+ * boolean, define to the type used by the jpeg library for boolean. */
+/* #undef wxHACK_BOOLEAN */
+
+/* Define if the header pbt.h is missing. */
+/* #undef NEED_PBT_H */
+
+#endif /* __WIN32__ */
+
+/* --------------------------------------------------------*
+ * This stuff is static, it doesn't get modified directly
+ * by configure.
+*/
+
+/*
+ define some constants identifying wxWindows version in more details than
+ just the version number
+ */
+
+/* wxLogChain class available */
+#define wxHAS_LOG_CHAIN
+
+/* define this when wxDC::Blit() respects SetDeviceOrigin() in wxGTK */
+/* #undef wxHAS_WORKING_GTK_DC_BLIT */
+
+#endif /* __WX_SETUP_H__ */
+